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

Unified Diff: Source/core/dom/Element.cpp

Issue 25039006: document.documentElement.scrollTop/Left is zero (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: document.documentElement.scrollTop/Left is zero Created 7 years, 3 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
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 7d79c4509285dd9a56b10a3a931230cbccdaa47d..f71b1d2ed88d80c309ff7e5dcc3e2dd0a51a1c76 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -685,6 +685,18 @@ int Element::clientHeight()
int Element::scrollLeft()
{
document().updateLayoutIgnorePendingStylesheets();
+
+ bool inQuirksMode = document().inQuirksMode();
Julien - ping for review 2013/09/30 23:39:57 For consistency, this should be moved inside the b
tonikitoo_ 2013/10/01 14:42:17 Ok
+ if (document().documentElement() == this) {
+ if (inQuirksMode)
+ return 0;
+
+ if (FrameView* view = document().view()) {
+ if (RenderView* renderView = document().renderView())
+ return adjustForAbsoluteZoom(view->scrollX(), renderView);
Julien - ping for review 2013/09/30 23:39:57 It would be nice to have some zoom testing too.
tonikitoo_ 2013/10/01 14:42:17 Do you think the test this patch edits in LayoutTe
Julien - ping for review 2013/10/01 15:19:51 I missed this test which exercise this code, my ba
tonikitoo_ 2013/10/01 16:49:19 In fact, it changes the test fine. The expected re
+ }
+ }
+
if (RenderBox* rend = renderBox())
return adjustForAbsoluteZoom(rend->scrollLeft(), rend);
return 0;
@@ -693,6 +705,17 @@ int Element::scrollLeft()
int Element::scrollTop()
{
document().updateLayoutIgnorePendingStylesheets();
+
+ if (document().documentElement() == this) {
+ if (document().inQuirksMode())
+ return 0;
+
+ if (FrameView* view = document().view()) {
+ if (RenderView* renderView = document().renderView())
+ return adjustForAbsoluteZoom(view->scrollY(), renderView);
+ }
+ }
+
if (RenderBox* rend = renderBox())
return adjustForAbsoluteZoom(rend->scrollTop(), rend);
return 0;

Powered by Google App Engine
This is Rietveld 408576698