| Index: Source/core/frame/LocalDOMWindow.cpp
|
| diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
|
| index 6f4e6ec346538fefab490d39a3bed0beb2a49eda..7163f829c96cf22af7286b0b320ebe477c621b02 100644
|
| --- a/Source/core/frame/LocalDOMWindow.cpp
|
| +++ b/Source/core/frame/LocalDOMWindow.cpp
|
| @@ -932,55 +932,49 @@ int LocalDOMWindow::outerWidth() const
|
| return host->chrome().windowRect().width();
|
| }
|
|
|
| -int LocalDOMWindow::innerHeight() const
|
| +static FloatSize getViewportSize(LocalFrame* frame)
|
| {
|
| - if (!frame())
|
| - return 0;
|
| -
|
| - FrameView* view = frame()->view();
|
| + FrameView* view = frame->view();
|
| if (!view)
|
| - return 0;
|
| + return FloatSize();
|
|
|
| - FrameHost* host = frame()->host();
|
| + FrameHost* host = frame->host();
|
| if (!host)
|
| - return 0;
|
| + return FloatSize();
|
| +
|
| + // The main frame's viewport size depends on the page scale. Since the
|
| + // initial page scale depends on the content width and is set after a
|
| + // layout, perform one now so queries during page load will use the up to
|
| + // date viewport.
|
| + if (host->settings().viewportEnabled() && frame->isMainFrame())
|
| + frame->document()->updateLayoutIgnorePendingStylesheets();
|
|
|
| // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
|
| - if (Frame* parent = frame()->tree().parent()) {
|
| + if (Frame* parent = frame->tree().parent()) {
|
| if (parent && parent->isLocalFrame())
|
| toLocalFrame(parent)->document()->updateLayoutIgnorePendingStylesheets();
|
| }
|
|
|
| - FloatSize viewportSize = frame()->isMainFrame()
|
| + return frame->isMainFrame()
|
| ? host->pinchViewport().visibleRect().size()
|
| : view->visibleContentRect(IncludeScrollbars).size();
|
| -
|
| - return adjustForAbsoluteZoom(expandedIntSize(viewportSize).height(), frame()->pageZoomFactor());
|
| }
|
|
|
| -int LocalDOMWindow::innerWidth() const
|
| +int LocalDOMWindow::innerHeight() const
|
| {
|
| if (!frame())
|
| return 0;
|
|
|
| - FrameView* view = frame()->view();
|
| - if (!view)
|
| - return 0;
|
| + FloatSize viewportSize = getViewportSize(frame());
|
| + return adjustForAbsoluteZoom(expandedIntSize(viewportSize).height(), frame()->pageZoomFactor());
|
| +}
|
|
|
| - FrameHost* host = frame()->host();
|
| - if (!host)
|
| +int LocalDOMWindow::innerWidth() const
|
| +{
|
| + if (!frame())
|
| return 0;
|
|
|
| - // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
|
| - if (Frame* parent = frame()->tree().parent()) {
|
| - if (parent && parent->isLocalFrame())
|
| - toLocalFrame(parent)->document()->updateLayoutIgnorePendingStylesheets();
|
| - }
|
| -
|
| - FloatSize viewportSize = frame()->isMainFrame()
|
| - ? host->pinchViewport().visibleRect().size()
|
| - : view->visibleContentRect(IncludeScrollbars).size();
|
| -
|
| + FloatSize viewportSize = getViewportSize(frame());
|
| return adjustForAbsoluteZoom(expandedIntSize(viewportSize).width(), frame()->pageZoomFactor());
|
| }
|
|
|
|
|