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

Unified Diff: Source/core/html/HTMLBodyElement.cpp

Issue 69143002: Guard the rework of documentElement|body.scrollTop/Left under a runtime flag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 | « Source/core/dom/Element.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLBodyElement.cpp
diff --git a/Source/core/html/HTMLBodyElement.cpp b/Source/core/html/HTMLBodyElement.cpp
index 182ec0aa1af594a8ad4242dd00112e0bf39ff8d9..e31e3414741b93e407ecac5f5c16db1b6a58f842 100644
--- a/Source/core/html/HTMLBodyElement.cpp
+++ b/Source/core/html/HTMLBodyElement.cpp
@@ -199,18 +199,21 @@ static int adjustForZoom(int value, Document* document)
return static_cast<int>(value / zoomFactor);
}
+// FIXME: There are cases where body.scrollLeft is allowed to return
+// non-zero values in both quirks and strict mode. It happens when
+// <body> has an overflow that is not the Frame overflow.
+// http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
+// http://code.google.com/p/chromium/issues/detail?id=312435
int HTMLBodyElement::scrollLeft()
{
Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
- // FIXME: There are cases where body.scrollLeft is allowed to return
- // non-zero values in both quirks and strict mode. It happens when
- // <body> has an overflow that is not the Frame overflow.
- // http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
- if (!document.inQuirksMode())
- UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBodyNotQuirksMode);
+ if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
+ if (!document.inQuirksMode())
+ return 0;
+ }
- document.updateLayoutIgnorePendingStylesheets();
FrameView* view = document.view();
return view ? adjustForZoom(view->scrollX(), &document) : 0;
}
@@ -218,11 +221,13 @@ int HTMLBodyElement::scrollLeft()
void HTMLBodyElement::setScrollLeft(int scrollLeft)
{
Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
- if (!document.inQuirksMode())
- UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBodyNotQuirksMode);
+ if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
+ if (!document.inQuirksMode())
+ return;
+ }
- document.updateLayoutIgnorePendingStylesheets();
Frame* frame = document.frame();
if (!frame)
return;
@@ -235,15 +240,13 @@ void HTMLBodyElement::setScrollLeft(int scrollLeft)
int HTMLBodyElement::scrollTop()
{
Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
- // FIXME: There are cases where body.scrollTop is allowed to return
- // non-zero values in both quirks and strict mode. It happens when
- // body has a overflow that is not the Frame overflow.
- // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
- if (!document.inQuirksMode())
- UseCounter::countDeprecation(&document, UseCounter::ScrollTopBodyNotQuirksMode);
+ if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
+ if (!document.inQuirksMode())
+ return 0;
+ }
- document.updateLayoutIgnorePendingStylesheets();
FrameView* view = document.view();
return view ? adjustForZoom(view->scrollY(), &document) : 0;
}
@@ -251,11 +254,13 @@ int HTMLBodyElement::scrollTop()
void HTMLBodyElement::setScrollTop(int scrollTop)
{
Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
- if (!document.inQuirksMode())
- UseCounter::countDeprecation(&document, UseCounter::ScrollTopBodyNotQuirksMode);
+ if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
+ if (!document.inQuirksMode())
+ return;
+ }
- document.updateLayoutIgnorePendingStylesheets();
Frame* frame = document.frame();
if (!frame)
return;
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698