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

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: Mark OverscrollRefresh() as protected. Created 3 years, 3 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #include "core/loader/PrerendererClient.h" 197 #include "core/loader/PrerendererClient.h"
198 #include "core/loader/TextResourceDecoderBuilder.h" 198 #include "core/loader/TextResourceDecoderBuilder.h"
199 #include "core/loader/appcache/ApplicationCacheHost.h" 199 #include "core/loader/appcache/ApplicationCacheHost.h"
200 #include "core/origin_trials/OriginTrials.h" 200 #include "core/origin_trials/OriginTrials.h"
201 #include "core/page/ChromeClient.h" 201 #include "core/page/ChromeClient.h"
202 #include "core/page/EventWithHitTestResults.h" 202 #include "core/page/EventWithHitTestResults.h"
203 #include "core/page/FocusController.h" 203 #include "core/page/FocusController.h"
204 #include "core/page/FrameTree.h" 204 #include "core/page/FrameTree.h"
205 #include "core/page/Page.h" 205 #include "core/page/Page.h"
206 #include "core/page/PointerLockController.h" 206 #include "core/page/PointerLockController.h"
207 #include "core/page/scrolling/OverscrollController.h"
207 #include "core/page/scrolling/RootScrollerController.h" 208 #include "core/page/scrolling/RootScrollerController.h"
208 #include "core/page/scrolling/ScrollStateCallback.h" 209 #include "core/page/scrolling/ScrollStateCallback.h"
209 #include "core/page/scrolling/ScrollingCoordinator.h" 210 #include "core/page/scrolling/ScrollingCoordinator.h"
210 #include "core/page/scrolling/SnapCoordinator.h" 211 #include "core/page/scrolling/SnapCoordinator.h"
211 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 212 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
212 #include "core/paint/compositing/PaintLayerCompositor.h" 213 #include "core/paint/compositing/PaintLayerCompositor.h"
213 #include "core/probe/CoreProbes.h" 214 #include "core/probe/CoreProbes.h"
214 #include "core/resize_observer/ResizeObserverController.h" 215 #include "core/resize_observer/ResizeObserverController.h"
215 #include "core/svg/SVGDocumentExtensions.h" 216 #include "core/svg/SVGDocumentExtensions.h"
216 #include "core/svg/SVGScriptElement.h" 217 #include "core/svg/SVGScriptElement.h"
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 // Column-gap is (ab)used by the current paged overflow implementation (in 1989 // Column-gap is (ab)used by the current paged overflow implementation (in
1989 // lack of other ways to specify gaps between pages), so we have to 1990 // lack of other ways to specify gaps between pages), so we have to
1990 // propagate it too. 1991 // propagate it too.
1991 if (!overflow_style->HasNormalColumnGap()) { 1992 if (!overflow_style->HasNormalColumnGap()) {
1992 column_gap_normal = false; 1993 column_gap_normal = false;
1993 column_gap = overflow_style->ColumnGap(); 1994 column_gap = overflow_style->ColumnGap();
1994 } 1995 }
1995 } 1996 }
1996 1997
1997 ScrollSnapType snap_type = overflow_style->GetScrollSnapType(); 1998 ScrollSnapType snap_type = overflow_style->GetScrollSnapType();
1999 EScrollBoundaryBehavior scroll_boundary_behavior_x =
2000 overflow_style->ScrollBoundaryBehaviorX();
2001 EScrollBoundaryBehavior scroll_boundary_behavior_y =
2002 overflow_style->ScrollBoundaryBehaviorY();
2003 using ScrollBoundaryBehaviorType =
2004 WebScrollBoundaryBehavior::ScrollBoundaryBehaviorType;
2005 if (RuntimeEnabledFeatures::CSSScrollBoundaryBehaviorEnabled() &&
2006 IsInMainFrame()) {
2007 GetPage()->GetOverscrollController().SetScrollBoundaryBehavior(
2008 WebScrollBoundaryBehavior(
2009 static_cast<ScrollBoundaryBehaviorType>(scroll_boundary_behavior_x),
2010 static_cast<ScrollBoundaryBehaviorType>(
2011 scroll_boundary_behavior_y)));
2012 }
1998 2013
1999 RefPtr<ComputedStyle> viewport_style; 2014 RefPtr<ComputedStyle> viewport_style;
2000 if (change == kForce || !GetLayoutViewItem().Style()) { 2015 if (change == kForce || !GetLayoutViewItem().Style()) {
2001 viewport_style = StyleResolver::StyleForViewport(*this); 2016 viewport_style = StyleResolver::StyleForViewport(*this);
2002 } else { 2017 } else {
2003 const ComputedStyle& old_style = GetLayoutViewItem().StyleRef(); 2018 const ComputedStyle& old_style = GetLayoutViewItem().StyleRef();
2004 if (old_style.GetWritingMode() == root_writing_mode && 2019 if (old_style.GetWritingMode() == root_writing_mode &&
2005 old_style.Direction() == root_direction && 2020 old_style.Direction() == root_direction &&
2006 old_style.VisitedDependentColor(CSSPropertyBackgroundColor) == 2021 old_style.VisitedDependentColor(CSSPropertyBackgroundColor) ==
2007 background_color && 2022 background_color &&
2008 old_style.BackgroundLayers() == background_layers && 2023 old_style.BackgroundLayers() == background_layers &&
2009 old_style.ImageRendering() == image_rendering && 2024 old_style.ImageRendering() == image_rendering &&
2010 old_style.OverflowAnchor() == overflow_anchor && 2025 old_style.OverflowAnchor() == overflow_anchor &&
2011 old_style.OverflowX() == overflow_x && 2026 old_style.OverflowX() == overflow_x &&
2012 old_style.OverflowY() == overflow_y && 2027 old_style.OverflowY() == overflow_y &&
2013 old_style.HasNormalColumnGap() == column_gap_normal && 2028 old_style.HasNormalColumnGap() == column_gap_normal &&
2014 old_style.ColumnGap() == column_gap && 2029 old_style.ColumnGap() == column_gap &&
2015 old_style.GetScrollSnapType() == snap_type) { 2030 old_style.GetScrollSnapType() == snap_type &&
2031 old_style.ScrollBoundaryBehaviorX() == scroll_boundary_behavior_x &&
2032 old_style.ScrollBoundaryBehaviorY() == scroll_boundary_behavior_y) {
2016 return; 2033 return;
2017 } 2034 }
2018 viewport_style = ComputedStyle::Clone(old_style); 2035 viewport_style = ComputedStyle::Clone(old_style);
2019 } 2036 }
2020 viewport_style->SetWritingMode(root_writing_mode); 2037 viewport_style->SetWritingMode(root_writing_mode);
2021 viewport_style->SetDirection(root_direction); 2038 viewport_style->SetDirection(root_direction);
2022 viewport_style->SetBackgroundColor(background_color); 2039 viewport_style->SetBackgroundColor(background_color);
2023 viewport_style->AccessBackgroundLayers() = background_layers; 2040 viewport_style->AccessBackgroundLayers() = background_layers;
2024 viewport_style->SetImageRendering(image_rendering); 2041 viewport_style->SetImageRendering(image_rendering);
2025 viewport_style->SetOverflowAnchor(overflow_anchor); 2042 viewport_style->SetOverflowAnchor(overflow_anchor);
2026 viewport_style->SetOverflowX(overflow_x); 2043 viewport_style->SetOverflowX(overflow_x);
2027 viewport_style->SetOverflowY(overflow_y); 2044 viewport_style->SetOverflowY(overflow_y);
2028 if (column_gap_normal) 2045 if (column_gap_normal)
2029 viewport_style->SetHasNormalColumnGap(); 2046 viewport_style->SetHasNormalColumnGap();
2030 else 2047 else
2031 viewport_style->SetColumnGap(column_gap); 2048 viewport_style->SetColumnGap(column_gap);
2032 viewport_style->SetScrollSnapType(snap_type); 2049 viewport_style->SetScrollSnapType(snap_type);
2050 viewport_style->SetScrollBoundaryBehaviorX(scroll_boundary_behavior_x);
2051 viewport_style->SetScrollBoundaryBehaviorY(scroll_boundary_behavior_y);
2033 GetLayoutViewItem().SetStyle(viewport_style); 2052 GetLayoutViewItem().SetStyle(viewport_style);
2034 SetupFontBuilder(*viewport_style); 2053 SetupFontBuilder(*viewport_style);
2035 } 2054 }
2036 2055
2037 #if DCHECK_IS_ON() 2056 #if DCHECK_IS_ON()
2038 static void AssertLayoutTreeUpdated(Node& root) { 2057 static void AssertLayoutTreeUpdated(Node& root) {
2039 for (Node& node : NodeTraversal::InclusiveDescendantsOf(root)) { 2058 for (Node& node : NodeTraversal::InclusiveDescendantsOf(root)) {
2040 // We leave some nodes with dirty bits in the tree because they don't 2059 // We leave some nodes with dirty bits in the tree because they don't
2041 // matter like Comment and ProcessingInstruction nodes. 2060 // matter like Comment and ProcessingInstruction nodes.
2042 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the 2061 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the
(...skipping 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after
7022 } 7041 }
7023 7042
7024 void showLiveDocumentInstances() { 7043 void showLiveDocumentInstances() {
7025 WeakDocumentSet& set = liveDocumentSet(); 7044 WeakDocumentSet& set = liveDocumentSet();
7026 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 7045 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
7027 for (blink::Document* document : set) 7046 for (blink::Document* document : set)
7028 fprintf(stderr, "- Document %p URL: %s\n", document, 7047 fprintf(stderr, "- Document %p URL: %s\n", document,
7029 document->Url().GetString().Utf8().data()); 7048 document->Url().GetString().Utf8().data());
7030 } 7049 }
7031 #endif 7050 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698