WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
81208
innerHeight and Width returns wrong values when scaled and having non-overlay scrollbars
https://bugs.webkit.org/show_bug.cgi?id=81208
Summary
innerHeight and Width returns wrong values when scaled and having non-overlay...
Kenneth Rohde Christiansen
Reported
2012-03-15 04:26:32 PDT
1136 long height = view->visibleContentRect(/* includeScrollbars */ true).height(); 1137 InspectorInstrumentation::applyScreenHeightOverride(m_frame, &height); 1138 return static_cast<int>(height / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor())); Calculating back doesn't work in the case there is a scrollbar actually taking up space. Example viewport is 110 (100 pixels css contents, 10 pixels scrollbar) content is scaled by 2.0, you have 50 pixels css content and 10 pixels scrollbar (50 + 10) * 2 = 120 != 110 FrameView should really have a way to get the innerWidth and Height instead.
Attachments
Add attachment
proposed patch, testcase, etc.
Kenneth Rohde Christiansen
Comment 1
2012-03-15 04:50:14 PDT
My example below is wrong, but the issue is still there. According to
http://www.quirksmode.org/mobile/tableViewport.html
we should return the 'Dimensions of the visual viewport in CSS pixels.' CSSOM View says 'The innerWidth attribute must return the viewport width including the size of a rendered scroll bar (if any).' So we could reformulate both as The visual viewport in CSS pixels including the size of non-overlay scroll bar (if any). It still seems as it would be nice to keep the scrollbar size calculation separate from the visibleContentRect method.
Kenneth Rohde Christiansen
Comment 2
2012-03-15 05:10:32 PDT
LayoutTests/fast/dom/inner-width-height.html tests that it includes scrollbars, but with weird comments: 30 This tests that window.innerWidth/innerHeight does not include the size of the scrollbars.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug