double VisualViewport::scrollTop() { if (!mainFrame()) return 0; updateStyleAndLayoutIgnorePendingStylesheets(); return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomFactor()); }
double VisualViewport::clientHeight() { if (!mainFrame()) return 0; updateStyleAndLayoutIgnorePendingStylesheets(); float height = adjustScrollForAbsoluteZoom(visibleSize().height(), mainFrame()->pageZoomFactor()); return height - mainFrame()->view()->horizontalScrollbarHeight() / m_scale; }
double VisualViewport::clientWidth() { if (!mainFrame()) return 0; updateStyleAndLayoutIgnorePendingStylesheets(); float width = adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame()->pageZoomFactor()); return width - mainFrame()->view()->verticalScrollbarWidth() / m_scale; }
// Blink, Gecko and Presto's quirks mode implementations of overflow set to the // body element differ from IE's: the formers can create a scrollable area for the // body element that is not the same as the root elements's one. On IE's quirks mode // though, as body is the root element, body's and the root element's scrollable areas, // if any, are the same. // In order words, a <body> will only have an overflow clip (that differs from // documentElement's) if both html and body nodes have its overflow set to either hidden, // auto or scroll. // That said, Blink's {set}scroll{Top,Left} behaviors match Gecko's: even if there is a non-overflown // scrollable area, scrolling should not get propagated to the viewport in neither strict // or quirks modes. double HTMLBodyElement::scrollLeft() { Document& document = this->document(); document.updateLayoutIgnorePendingStylesheets(); if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { RenderBox* render = renderBox(); if (!render) return 0; if (render->hasOverflowClip()) return adjustScrollForAbsoluteZoom(render->scrollLeft(), *render); if (!document.inQuirksMode()) return 0; } if (FrameView* view = document.view()) return adjustScrollForAbsoluteZoom(view->scrollX(), document.frame()->pageZoomFactor()); return 0; }