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

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2069713002: Make all gesture scrolls use customization path internally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + Fix test Created 4 years, 6 months 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 | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index d60418fc0621c83708f1cb70e3a579755d2d42e8..810755bd6138d2740859c6dfeebac5ffb123a164 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -525,7 +525,15 @@ void Element::nativeDistributeScroll(ScrollState& scrollState)
void Element::callDistributeScroll(ScrollState& scrollState)
{
ScrollStateCallback* callback = scrollCustomizationCallbacks().getDistributeScroll(this);
- if (!callback) {
+
+ // TODO(bokan): Need to add tests before we allow calling custom callbacks
+ // for non-touch modalities. For now, just call into the native callback but
+ // allow the viewport scroll callback so we don't disable overscroll.
+ // crbug.com/623079.
+ bool disableCustomCallbacks = !scrollState.isDirectManipulation()
+ && !document().isViewportScrollCallback(callback);
+
+ if (!callback || disableCustomCallbacks) {
nativeDistributeScroll(scrollState);
return;
}
@@ -539,8 +547,6 @@ void Element::callDistributeScroll(ScrollState& scrollState)
void Element::nativeApplyScroll(ScrollState& scrollState)
{
- DCHECK(RuntimeEnabledFeatures::scrollCustomizationEnabled());
-
// All elements in the scroll chain should be boxes.
DCHECK(!layoutObject() || layoutObject()->isBox());
@@ -557,8 +563,9 @@ void Element::nativeApplyScroll(ScrollState& scrollState)
LayoutBox* boxToScroll = nullptr;
- // Handle the scrollingElement separately, as it should scroll the viewport.
- if (this == document().scrollingElement())
+ // We should only ever scroll the effective root scroller this way when the
+ // page removes the default applyScroll (ViewportScrollCallback).
+ if (document().effectiveRootScroller() == this)
boxToScroll = document().layoutView();
else if (layoutObject())
boxToScroll = toLayoutBox(layoutObject());
@@ -568,7 +575,7 @@ void Element::nativeApplyScroll(ScrollState& scrollState)
ScrollResult result =
LayoutBoxItem(boxToScroll).enclosingBox().scroll(
- ScrollByPrecisePixel,
+ ScrollGranularity(static_cast<int>(scrollState.deltaGranularity())),
delta);
if (!result.didScroll())
@@ -592,7 +599,15 @@ void Element::nativeApplyScroll(ScrollState& scrollState)
void Element::callApplyScroll(ScrollState& scrollState)
{
ScrollStateCallback* callback = scrollCustomizationCallbacks().getApplyScroll(this);
- if (!callback) {
+
+ // TODO(bokan): Need to add tests before we allow calling custom callbacks
+ // for non-touch modalities. For now, just call into the native callback but
+ // allow the viewport scroll callback so we don't disable overscroll.
+ // crbug.com/623079.
+ bool disableCustomCallbacks = !scrollState.isDirectManipulation()
+ && !document().isViewportScrollCallback(callback);
+
+ if (!callback || disableCustomCallbacks) {
nativeApplyScroll(scrollState);
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698