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

Side by Side 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 ScrollManager to pass the test. Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #include "core/loader/NavigationScheduler.h" 196 #include "core/loader/NavigationScheduler.h"
197 #include "core/loader/PrerendererClient.h" 197 #include "core/loader/PrerendererClient.h"
198 #include "core/loader/appcache/ApplicationCacheHost.h" 198 #include "core/loader/appcache/ApplicationCacheHost.h"
199 #include "core/origin_trials/OriginTrials.h" 199 #include "core/origin_trials/OriginTrials.h"
200 #include "core/page/ChromeClient.h" 200 #include "core/page/ChromeClient.h"
201 #include "core/page/EventWithHitTestResults.h" 201 #include "core/page/EventWithHitTestResults.h"
202 #include "core/page/FocusController.h" 202 #include "core/page/FocusController.h"
203 #include "core/page/FrameTree.h" 203 #include "core/page/FrameTree.h"
204 #include "core/page/Page.h" 204 #include "core/page/Page.h"
205 #include "core/page/PointerLockController.h" 205 #include "core/page/PointerLockController.h"
206 #include "core/page/scrolling/OverscrollController.h"
206 #include "core/page/scrolling/RootScrollerController.h" 207 #include "core/page/scrolling/RootScrollerController.h"
207 #include "core/page/scrolling/ScrollStateCallback.h" 208 #include "core/page/scrolling/ScrollStateCallback.h"
208 #include "core/page/scrolling/ScrollingCoordinator.h" 209 #include "core/page/scrolling/ScrollingCoordinator.h"
209 #include "core/page/scrolling/SnapCoordinator.h" 210 #include "core/page/scrolling/SnapCoordinator.h"
210 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 211 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
211 #include "core/paint/compositing/PaintLayerCompositor.h" 212 #include "core/paint/compositing/PaintLayerCompositor.h"
212 #include "core/probe/CoreProbes.h" 213 #include "core/probe/CoreProbes.h"
213 #include "core/resize_observer/ResizeObserverController.h" 214 #include "core/resize_observer/ResizeObserverController.h"
214 #include "core/svg/SVGDocumentExtensions.h" 215 #include "core/svg/SVGDocumentExtensions.h"
215 #include "core/svg/SVGScriptElement.h" 216 #include "core/svg/SVGScriptElement.h"
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 overflow_y = EOverflow::kAuto; 1944 overflow_y = EOverflow::kAuto;
1944 if (overflow_anchor == EOverflowAnchor::kVisible) 1945 if (overflow_anchor == EOverflowAnchor::kVisible)
1945 overflow_anchor = EOverflowAnchor::kAuto; 1946 overflow_anchor = EOverflowAnchor::kAuto;
1946 // Column-gap is (ab)used by the current paged overflow implementation (in 1947 // Column-gap is (ab)used by the current paged overflow implementation (in
1947 // lack of other ways to specify gaps between pages), so we have to 1948 // lack of other ways to specify gaps between pages), so we have to
1948 // propagate it too. 1949 // propagate it too.
1949 column_gap = overflow_style->ColumnGap(); 1950 column_gap = overflow_style->ColumnGap();
1950 } 1951 }
1951 1952
1952 ScrollSnapType snap_type = overflow_style->GetScrollSnapType(); 1953 ScrollSnapType snap_type = overflow_style->GetScrollSnapType();
1954 EScrollBoundaryBehavior scroll_boundary_behavior_x =
1955 overflow_style->ScrollBoundaryBehaviorX();
1956 EScrollBoundaryBehavior scroll_boundary_behavior_y =
1957 overflow_style->ScrollBoundaryBehaviorY();
1958 using ScrollBoundaryBehaviorType =
1959 WebScrollBoundaryBehavior::ScrollBoundaryBehaviorType;
1960 if (RuntimeEnabledFeatures::CSSScrollBoundaryBehaviorEnabled() &&
1961 IsInMainFrame()) {
1962 GetPage()->GetOverscrollController().SetScrollBoundaryBehavior(
1963 WebScrollBoundaryBehavior(
1964 static_cast<ScrollBoundaryBehaviorType>(scroll_boundary_behavior_x),
dtapuska 2017/08/22 14:51:04 Is there someone where asserting that the CSS cast
sunyunjia 2017/08/22 23:55:37 Yes see https://cs.chromium.org/chromium/src/third
1965 static_cast<ScrollBoundaryBehaviorType>(
1966 scroll_boundary_behavior_y)));
1967 }
1953 1968
1954 RefPtr<ComputedStyle> viewport_style = GetLayoutViewItem().MutableStyle(); 1969 RefPtr<ComputedStyle> viewport_style = GetLayoutViewItem().MutableStyle();
1955 if (viewport_style->GetWritingMode() != root_writing_mode || 1970 if (viewport_style->GetWritingMode() != root_writing_mode ||
1956 viewport_style->Direction() != root_direction || 1971 viewport_style->Direction() != root_direction ||
1957 viewport_style->VisitedDependentColor(CSSPropertyBackgroundColor) != 1972 viewport_style->VisitedDependentColor(CSSPropertyBackgroundColor) !=
1958 background_color || 1973 background_color ||
1959 viewport_style->BackgroundLayers() != background_layers || 1974 viewport_style->BackgroundLayers() != background_layers ||
1960 viewport_style->ImageRendering() != image_rendering || 1975 viewport_style->ImageRendering() != image_rendering ||
1961 viewport_style->OverflowAnchor() != overflow_anchor || 1976 viewport_style->OverflowAnchor() != overflow_anchor ||
1962 viewport_style->OverflowX() != overflow_x || 1977 viewport_style->OverflowX() != overflow_x ||
1963 viewport_style->OverflowY() != overflow_y || 1978 viewport_style->OverflowY() != overflow_y ||
1964 viewport_style->ColumnGap() != column_gap || 1979 viewport_style->ColumnGap() != column_gap ||
1965 viewport_style->GetScrollSnapType() != snap_type) { 1980 viewport_style->GetScrollSnapType() != snap_type ||
1981 viewport_style->ScrollBoundaryBehaviorX() != scroll_boundary_behavior_x ||
1982 viewport_style->ScrollBoundaryBehaviorY() != scroll_boundary_behavior_y) {
1966 RefPtr<ComputedStyle> new_style = ComputedStyle::Clone(*viewport_style); 1983 RefPtr<ComputedStyle> new_style = ComputedStyle::Clone(*viewport_style);
1967 new_style->SetWritingMode(root_writing_mode); 1984 new_style->SetWritingMode(root_writing_mode);
1968 new_style->SetDirection(root_direction); 1985 new_style->SetDirection(root_direction);
1969 new_style->SetBackgroundColor(background_color); 1986 new_style->SetBackgroundColor(background_color);
1970 new_style->AccessBackgroundLayers() = background_layers; 1987 new_style->AccessBackgroundLayers() = background_layers;
1971 new_style->SetImageRendering(image_rendering); 1988 new_style->SetImageRendering(image_rendering);
1972 new_style->SetOverflowAnchor(overflow_anchor); 1989 new_style->SetOverflowAnchor(overflow_anchor);
1973 new_style->SetOverflowX(overflow_x); 1990 new_style->SetOverflowX(overflow_x);
1974 new_style->SetOverflowY(overflow_y); 1991 new_style->SetOverflowY(overflow_y);
1975 new_style->SetColumnGap(column_gap); 1992 new_style->SetColumnGap(column_gap);
1976 new_style->SetScrollSnapType(snap_type); 1993 new_style->SetScrollSnapType(snap_type);
1994 new_style->SetScrollBoundaryBehaviorX(scroll_boundary_behavior_x);
1995 new_style->SetScrollBoundaryBehaviorY(scroll_boundary_behavior_y);
1977 GetLayoutViewItem().SetStyle(new_style); 1996 GetLayoutViewItem().SetStyle(new_style);
1978 SetupFontBuilder(*new_style); 1997 SetupFontBuilder(*new_style);
1979 } 1998 }
1980 } 1999 }
1981 2000
1982 #if DCHECK_IS_ON() 2001 #if DCHECK_IS_ON()
1983 static void AssertLayoutTreeUpdated(Node& root) { 2002 static void AssertLayoutTreeUpdated(Node& root) {
1984 for (Node& node : NodeTraversal::InclusiveDescendantsOf(root)) { 2003 for (Node& node : NodeTraversal::InclusiveDescendantsOf(root)) {
1985 // We leave some nodes with dirty bits in the tree because they don't 2004 // We leave some nodes with dirty bits in the tree because they don't
1986 // matter like Comment and ProcessingInstruction nodes. 2005 // matter like Comment and ProcessingInstruction nodes.
(...skipping 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after
6966 } 6985 }
6967 6986
6968 void showLiveDocumentInstances() { 6987 void showLiveDocumentInstances() {
6969 WeakDocumentSet& set = liveDocumentSet(); 6988 WeakDocumentSet& set = liveDocumentSet();
6970 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6989 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6971 for (blink::Document* document : set) 6990 for (blink::Document* document : set)
6972 fprintf(stderr, "- Document %p URL: %s\n", document, 6991 fprintf(stderr, "- Document %p URL: %s\n", document,
6973 document->Url().GetString().Utf8().data()); 6992 document->Url().GetString().Utf8().data());
6974 } 6993 }
6975 #endif 6994 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698