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

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

Issue 1094673002: Make window.innerWidth and innerHeight cause layout if needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | « no previous file | Source/web/tests/PinchViewportTest.cpp » ('j') | Source/web/tests/PinchViewportTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index 6f4e6ec346538fefab490d39a3bed0beb2a49eda..758e2bbebfa433ad9022fbf3b7bf5ba410b5b995 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -945,6 +945,13 @@ int LocalDOMWindow::innerHeight() const
if (!host)
return 0;
+ // The main frame's innerHeight 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 before the first layout reflect the true size
+ // of the window.
rune 2015/04/16 22:02:12 The initial scale can be adjusted multiple times a
bokan 2015/04/20 17:47:24 Done.
+ 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 (parent && parent->isLocalFrame())
@@ -971,6 +978,13 @@ int LocalDOMWindow::innerWidth() const
if (!host)
return 0;
+ // The main frame's innerHeight 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 before the first layout reflect the true size
+ // of the window.
+ if (host->settings().viewportEnabled() && frame()->isMainFrame())
+ frame()->document()->updateLayoutIgnorePendingStylesheets();
+
rune 2015/04/16 22:02:12 Most code and comments in innerWidth and innerHeig
bokan 2015/04/20 17:47:24 Done.
// 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())
« no previous file with comments | « no previous file | Source/web/tests/PinchViewportTest.cpp » ('j') | Source/web/tests/PinchViewportTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698