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.
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.
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.