| Index: Source/core/dom/Element.cpp
|
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
|
| index 01a776123369040ba8f456d07d240bc9561a6aba..0fb87fd82ba96ed9c6922149e4532f81f10bc1bc 100644
|
| --- a/Source/core/dom/Element.cpp
|
| +++ b/Source/core/dom/Element.cpp
|
| @@ -677,7 +677,13 @@ int Element::scrollLeft()
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|
| - if (document().documentElement() == this) {
|
| + if (document().documentElement() != this) {
|
| + if (RenderBox* rend = renderBox())
|
| + return adjustForAbsoluteZoom(rend->scrollLeft(), rend);
|
| + return 0;
|
| + }
|
| +
|
| + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
|
| if (document().inQuirksMode())
|
| return 0;
|
|
|
| @@ -687,8 +693,6 @@ int Element::scrollLeft()
|
| }
|
| }
|
|
|
| - if (RenderBox* rend = renderBox())
|
| - return adjustForAbsoluteZoom(rend->scrollLeft(), rend);
|
| return 0;
|
| }
|
|
|
| @@ -696,7 +700,13 @@ int Element::scrollTop()
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|
| - if (document().documentElement() == this) {
|
| + if (document().documentElement() != this) {
|
| + if (RenderBox* rend = renderBox())
|
| + return adjustForAbsoluteZoom(rend->scrollTop(), rend);
|
| + return 0;
|
| + }
|
| +
|
| + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
|
| if (document().inQuirksMode())
|
| return 0;
|
|
|
| @@ -706,8 +716,6 @@ int Element::scrollTop()
|
| }
|
| }
|
|
|
| - if (RenderBox* rend = renderBox())
|
| - return adjustForAbsoluteZoom(rend->scrollTop(), rend);
|
| return 0;
|
| }
|
|
|
| @@ -715,7 +723,13 @@ void Element::setScrollLeft(int newLeft)
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|
| - if (document().documentElement() == this) {
|
| + if (document().documentElement() != this) {
|
| + if (RenderBox* rend = renderBox())
|
| + rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZoom()));
|
| + return;
|
| + }
|
| +
|
| + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
|
| if (document().inQuirksMode())
|
| return;
|
|
|
| @@ -726,24 +740,21 @@ void Element::setScrollLeft(int newLeft)
|
| if (!view)
|
| return;
|
|
|
| - // WHATWG spec says [1]: "If the element is the root element invoke scroll()
|
| - // with x as first argument and zero as second". Blink intentionally matches
|
| - // other engine's behaviors here, instead, where the 'y' scroll position is
|
| - // preversed. See [2].
|
| - // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
|
| - // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448
|
| view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZoomFactor()), view->scrollY()));
|
| }
|
| -
|
| - if (RenderBox* rend = renderBox())
|
| - rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZoom()));
|
| }
|
|
|
| void Element::setScrollTop(int newTop)
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|
| - if (document().documentElement() == this) {
|
| + if (document().documentElement() != this) {
|
| + if (RenderBox* rend = renderBox())
|
| + rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoom()));
|
| + return;
|
| + }
|
| +
|
| + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
|
| if (document().inQuirksMode())
|
| return;
|
|
|
| @@ -754,17 +765,8 @@ void Element::setScrollTop(int newTop)
|
| if (!view)
|
| return;
|
|
|
| - // WHATWG spec says [1]: "If the element is the root element invoke scroll()
|
| - // with zero as first argument and y as second". Blink intentionally
|
| - // matches other engine's behaviors here, instead, where the 'x' scroll
|
| - // position is preversed. See [2].
|
| - // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
|
| - // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448
|
| view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor())));
|
| }
|
| -
|
| - if (RenderBox* rend = renderBox())
|
| - rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoom()));
|
| }
|
|
|
| int Element::scrollWidth()
|
|
|