Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2842343002: Perform layout when viewport size is queried. (Closed)
Patch Set: Nit Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-in-iframe-causes-layout.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
index 8a160dc47ddfc162c9401120eb9ec334d57c06bb..cdca6ad5e2f56c1ae2061d2b017de495b9c5a7d1 100644
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -83,6 +83,7 @@
#include "platform/Histogram.h"
#include "platform/WebFrameScheduler.h"
#include "platform/loader/fetch/ResourceFetcher.h"
+#include "platform/scroll/ScrollbarTheme.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "platform/weborigin/Suborigin.h"
#include "public/platform/Platform.h"
@@ -975,11 +976,17 @@ FloatSize LocalDOMWindow::GetViewportSize(
if (!page)
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 (page->GetSettings().GetViewportEnabled() && GetFrame()->IsMainFrame())
+ // The main frame's viewport size depends on the page scale. If viewport is
+ // enabled, 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.
+ bool affectedByScale =
+ page->GetSettings().GetViewportEnabled() && GetFrame()->IsMainFrame();
+ bool affectedByScrollbars =
+ scrollbar_inclusion == kExcludeScrollbars &&
+ !ScrollbarTheme::GetTheme().UsesOverlayScrollbars();
+
+ if (affectedByScale || affectedByScrollbars)
document()->UpdateStyleAndLayoutIgnorePendingStylesheets();
// FIXME: This is potentially too much work. We really only need to know the
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-in-iframe-causes-layout.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698