cloudtrends / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
1 stars 1 forks source link

window.open size and position parameters are being ignored #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here is a test page: http://www.gusverdun.com/cef/window_open/main.html

Clicking on "Create Child" does a window.open on "child.html" with a height and 
width of 300x200.

// the code is getting "ignored" at this point:
void BrowserWebViewDelegate::setWindowRect(const WebRect& rect) {
  if (this == browser_->GetWebViewDelegate()) {
    // ignored
  } else if (this == browser_->GetPopupDelegate()) {
    MoveWindow(browser_->GetPopupWndHandle(),
               rect.x, rect.y, rect.width, rect.height, FALSE);
  }
}

Original issue reported on code.google.com by gusver...@gmail.com on 10 Jan 2011 at 10:22

GoogleCodeExporter commented 9 years ago
Setting the window rectangle for popups at that location could be problematic 
in situations where the host application is creating their own popup window 
class implementation. The host application should instead use 
HandleBeforeCreated to transfer the popup window size and location information 
from |popupFeatures| to |windowInfo|:

virtual RetVal HandleBeforeCreated(
    CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
    const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
    CefString& url, CefBrowserSettings& settings)
{
  if(popup) {
    if(popupFeatures.xSet)
      createInfo.m_x = popupFeatures.x;
    if(popupFeatures.ySet)
      createInfo.m_y = popupFeatures.y;
    if(popupFeatures.widthSet)
      createInfo.m_nWidth = popupFeatures.width;
    if(popupFeatures.heightSet)
      createInfo.m_nHeight = popupFeatures.height;
  }

  return RV_CONTINUE;
}

Original comment by magreenb...@gmail.com on 11 Jan 2011 at 3:52