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

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

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: Update WebScrollBoundaryBehavior. Created 3 years, 7 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
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 af710a5670f2b3475c8303f1f71f48bc76d84b35..34e34df6d64fb1d5768382103a1d7d8a4c96adbe 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -528,8 +528,9 @@ void Element::NativeDistributeScroll(ScrollState& scroll_state) {
CallApplyScroll(scroll_state);
- if (delta_x != scroll_state.deltaX() || delta_y != scroll_state.deltaY())
+ if (delta_x != scroll_state.deltaX() || delta_y != scroll_state.deltaY()) {
scroll_state.SetCurrentNativeScrollingElement(this);
+ }
bokan 2017/05/19 19:35:57 Nit: no braces
sunyunjia 2017/05/25 20:07:10 Done.
}
void Element::CallDistributeScroll(ScrollState& scroll_state) {
@@ -593,8 +594,17 @@ void Element::NativeApplyScroll(ScrollState& scroll_state) {
scroll_state.deltaGranularity())),
delta);
- if (!result.DidScroll())
+ if (!result.DidScroll()) {
+ if (GetComputedStyle()->ScrollBoundaryBehaviorX() !=
bokan 2017/05/19 19:35:57 Similarly, this should be done at the time that we
sunyunjia 2017/05/25 20:07:10 Done.
+ EScrollBoundaryBehavior::kAuto &&
+ std::abs(delta.Width()) > std::abs(delta.Height()))
+ scroll_state.ConsumeDeltaNative(delta.Width(), 0);
+ if (GetComputedStyle()->ScrollBoundaryBehaviorY() !=
+ EScrollBoundaryBehavior::kAuto &&
+ std::abs(delta.Height()) > std::abs(delta.Width()))
+ scroll_state.ConsumeDeltaNative(0, delta.Height());
return;
+ }
// FIXME: Native scrollers should only consume the scroll they
// apply. See crbug.com/457765.

Powered by Google App Engine
This is Rietveld 408576698