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

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

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: Update the test Created 3 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
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 252d0aa7089ab20330dc086bc1cf3870f0b1afb5..f5cf8ad863565e942f31ad927086065fcf5ee9d8 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -201,6 +201,7 @@
#include "core/page/FrameTree.h"
#include "core/page/Page.h"
#include "core/page/PointerLockController.h"
+#include "core/page/scrolling/OverscrollController.h"
#include "core/page/scrolling/RootScrollerController.h"
#include "core/page/scrolling/ScrollStateCallback.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
@@ -1949,6 +1950,19 @@ void Document::InheritHtmlAndBodyElementStyles(StyleRecalcChange change) {
ScrollSnapType snap_type = overflow_style->GetScrollSnapType();
const LengthPoint& snap_destination = overflow_style->ScrollSnapDestination();
+ EScrollBoundaryBehavior scroll_boundary_behavior_x =
+ overflow_style->ScrollBoundaryBehaviorX();
+ EScrollBoundaryBehavior scroll_boundary_behavior_y =
+ overflow_style->ScrollBoundaryBehaviorY();
+ using ScrollBoundaryBehaviorType =
+ WebScrollBoundaryBehavior::ScrollBoundaryBehaviorType;
+ if (RuntimeEnabledFeatures::CSSScrollBoundaryBehaviorEnabled()) {
+ GetPage()->GetOverscrollController().SetScrollBoundaryBehavior(
+ WebScrollBoundaryBehavior(
+ static_cast<ScrollBoundaryBehaviorType>(scroll_boundary_behavior_x),
+ static_cast<ScrollBoundaryBehaviorType>(
+ scroll_boundary_behavior_y)));
+ }
RefPtr<ComputedStyle> document_style = GetLayoutViewItem().MutableStyle();
if (document_style->GetWritingMode() != root_writing_mode ||
@@ -1962,7 +1976,9 @@ void Document::InheritHtmlAndBodyElementStyles(StyleRecalcChange change) {
document_style->OverflowY() != overflow_y ||
document_style->ColumnGap() != column_gap ||
document_style->GetScrollSnapType() != snap_type ||
- document_style->ScrollSnapDestination() != snap_destination) {
+ document_style->ScrollSnapDestination() != snap_destination ||
+ document_style->ScrollBoundaryBehaviorX() != scroll_boundary_behavior_x ||
+ document_style->ScrollBoundaryBehaviorY() != scroll_boundary_behavior_y) {
RefPtr<ComputedStyle> new_style = ComputedStyle::Clone(*document_style);
new_style->SetWritingMode(root_writing_mode);
new_style->SetDirection(root_direction);
@@ -1975,6 +1991,8 @@ void Document::InheritHtmlAndBodyElementStyles(StyleRecalcChange change) {
new_style->SetColumnGap(column_gap);
new_style->SetScrollSnapType(snap_type);
new_style->SetScrollSnapDestination(snap_destination);
+ new_style->SetScrollBoundaryBehaviorX(scroll_boundary_behavior_x);
+ new_style->SetScrollBoundaryBehaviorY(scroll_boundary_behavior_y);
GetLayoutViewItem().SetStyle(new_style);
SetupFontBuilder(*new_style);
}

Powered by Google App Engine
This is Rietveld 408576698