Bug 143678
Summary: | javascript window.open window size | ||
---|---|---|---|
Product: | WebKit | Reporter: | Josef <jd> |
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Major | CC: | bdakin, cdumez, robertknight, thorton, zcorpan |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.10 |
Josef
Environment: on MacBook with Retina display with and without external monitor.
If I am open with Javascript a new window with e.g.
window.open("","queryLogFrame","height=700,width=1000,scrollbars=no,resizable,status");
The window height is about 30-50 pixel smaller than with Firefox or Chrome.
This problem I notice the first time with 10.10 in conjunction with the Retina display.
--
Josef
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Simon Pieters (:zcorpan)
This causes failures in these tests:
https://github.com/w3c/web-platform-tests/pull/5390
I think it would be good to have predictable behavior here, that "height" feature sets the viewport height like in other browsers.
Chris Dumez
Hmm, we do:
FloatSize viewportSize = page->chrome().pageRect().size();
FloatRect windowRect = page->chrome().windowRect();
windowRect.setHeight(*features.height + (windowRect.height() - viewportSize.height()));
So we *seem* to be doing the right thing. However, viewportSize and windowRect are identical :/
Chris Dumez
(In reply to Chris Dumez from comment #2)
> Hmm, we do:
> FloatSize viewportSize = page->chrome().pageRect().size();
> FloatRect windowRect = page->chrome().windowRect();
> windowRect.setHeight(*features.height + (windowRect.height() -
> viewportSize.height()));
>
> So we *seem* to be doing the right thing. However, viewportSize and
> windowRect are identical :/
From what I can see viewportSize is wrong and windowRect is right.
Chris Dumez
Tim says we should subtract the topContentInset because the view is the same height as the window since Yosemite.
Tim Horton
Really I said "probably we should leave it up to the WebKits and ask them for window-size-for-given-view-size or something, instead of hoping that subtracting will give you what you want, but if you want to quickly work around the problem you could subtract topContentInset" :)
Chris Dumez
Test:
http://w3c-test.org/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-width-height.html
Chris Dumez
Page::setTopContentInset() gets called *after* we set the new Window size unfortunately.
Tim Horton
(In reply to Chris Dumez from comment #7)
> Page::setTopContentInset() gets called *after* we set the new Window size
> unfortunately.
Where is the size set? You might be able to reorder it, because TCI is sent in WebProcessCreationParameters, so it's not like we don't have it.
Tim Horton
(In reply to Tim Horton from comment #8)
> (In reply to Chris Dumez from comment #7)
> > Page::setTopContentInset() gets called *after* we set the new Window size
> > unfortunately.
>
> Where is the size set? You might be able to reorder it, because TCI is sent
> in WebProcessCreationParameters, so it's not like we don't have it.
WebPageCreationParameters, whatever.
Chris Dumez
(In reply to Tim Horton from comment #9)
> (In reply to Tim Horton from comment #8)
> > (In reply to Chris Dumez from comment #7)
> > > Page::setTopContentInset() gets called *after* we set the new Window size
> > > unfortunately.
> >
> > Where is the size set? You might be able to reorder it, because TCI is sent
> > in WebProcessCreationParameters, so it's not like we don't have it.
>
> WebPageCreationParameters, whatever.
The logic for setting the new window size is in:
RefPtr<Frame> createWindow(Frame& openerFrame, Frame& lookupFrame, const FrameLoadRequest& request, const WindowFeatures& features, bool& created) inside FrameLoader.cpp.
We first call chrome().createWindow() to create the Window.
Then we compute the height we want.
Finally we call chrome().setWindowRect().
Chris Dumez
(In reply to Chris Dumez from comment #10)
> (In reply to Tim Horton from comment #9)
> > (In reply to Tim Horton from comment #8)
> > > (In reply to Chris Dumez from comment #7)
> > > > Page::setTopContentInset() gets called *after* we set the new Window size
> > > > unfortunately.
> > >
> > > Where is the size set? You might be able to reorder it, because TCI is sent
> > > in WebProcessCreationParameters, so it's not like we don't have it.
> >
> > WebPageCreationParameters, whatever.
>
> The logic for setting the new window size is in:
> RefPtr<Frame> createWindow(Frame& openerFrame, Frame& lookupFrame, const
> FrameLoadRequest& request, const WindowFeatures& features, bool& created)
> inside FrameLoader.cpp.
>
> We first call chrome().createWindow() to create the Window.
> Then we compute the height we want.
> Finally we call chrome().setWindowRect().
And to make things a bit more complicated, between the window creation and setting the window size, there is a call to chrome().setToolbarsVisible(), which I believe would impact the topContentInset.