Index: Source/core/html/HTMLBodyElement.cpp |
diff --git a/Source/core/html/HTMLBodyElement.cpp b/Source/core/html/HTMLBodyElement.cpp |
index c855c82efd216db3f03ca1b4ffeb019dd2497f65..dc2055871c882c484c77d5baa6d0ec5d0c356d57 100644 |
--- a/Source/core/html/HTMLBodyElement.cpp |
+++ b/Source/core/html/HTMLBodyElement.cpp |
@@ -33,6 +33,7 @@ |
#include "core/dom/Attribute.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
+#include "core/frame/ScrollToOptions.h" |
#include "core/frame/UseCounter.h" |
#include "core/html/HTMLFrameElementBase.h" |
#include "core/html/parser/HTMLParserIdioms.h" |
@@ -265,7 +266,7 @@ void HTMLBodyElement::setScrollLeft(double scrollLeft) |
FrameView* view = frame->view(); |
if (!view) |
return; |
- view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), view->scrollY())); |
+ view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), view->scrollY()), ScrollBehaviorAuto); |
} |
double HTMLBodyElement::scrollTop() |
@@ -315,7 +316,7 @@ void HTMLBodyElement::setScrollTop(double scrollTop) |
FrameView* view = frame->view(); |
if (!view) |
return; |
- view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->pageZoomFactor())); |
+ view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->pageZoomFactor()), ScrollBehaviorAuto); |
} |
int HTMLBodyElement::scrollHeight() |
@@ -336,4 +337,50 @@ int HTMLBodyElement::scrollWidth() |
return view ? adjustForZoom(view->contentsWidth(), &document) : 0; |
} |
+void HTMLBodyElement::scrollBy(const ScrollToOptions& scrollToOptions) |
+{ |
+ Document& document = this->document(); |
+ |
+ // FIXME: This should be removed once scroll updates are processed only after |
+ // the compositing update. See http://crbug.com/420741. |
+ document.updateLayoutIgnorePendingStylesheets(); |
+ |
+ if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
+ RenderBox* render = renderBox(); |
+ if (!render) |
+ return; |
+ if (render->hasOverflowClip()) { |
+ scrollRenderBoxBy(scrollToOptions); |
+ return; |
+ } |
+ if (!document.inQuirksMode()) |
+ return; |
+ } |
+ |
+ scrollFrameBy(scrollToOptions); |
+} |
+ |
+void HTMLBodyElement::scrollTo(const ScrollToOptions& scrollToOptions) |
+{ |
+ Document& document = this->document(); |
+ |
+ // FIXME: This should be removed once scroll updates are processed only after |
+ // the compositing update. See http://crbug.com/420741. |
+ document.updateLayoutIgnorePendingStylesheets(); |
+ |
+ if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
+ RenderBox* render = renderBox(); |
+ if (!render) |
+ return; |
+ if (render->hasOverflowClip()) { |
+ scrollRenderBoxTo(scrollToOptions); |
+ return; |
+ } |
+ if (!document.inQuirksMode()) |
+ return; |
+ } |
+ |
+ scrollFrameTo(scrollToOptions); |
+} |
+ |
} // namespace blink |