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

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

Issue 782793002: Update Element API for CSSOM smooth scrolling to match the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments Created 6 years 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/html/HTMLBodyElement.h ('k') | Source/core/html/HTMLSelectElement.h » ('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 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
« no previous file with comments | « Source/core/html/HTMLBodyElement.h ('k') | Source/core/html/HTMLSelectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698