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; |