Bug 81208 - innerHeight and Width returns wrong values when scaled and having non-overlay scrollbars
Summary: innerHeight and Width returns wrong values when scaled and having non-overlay...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 81209
  Show dependency treegraph
 
Reported: 2012-03-15 04:26 PDT by Kenneth Rohde Christiansen
Modified: 2012-03-15 10:32 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Rohde Christiansen 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.
Comment 1 Kenneth Rohde Christiansen 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.
Comment 2 Kenneth Rohde Christiansen 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.