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

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: Rebase 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
« no previous file with comments | « content/test/BUILD.gn ('k') | third_party/WebKit/Source/core/exported/WebFrameTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 // propagate it too. 2012 // propagate it too.
2012 if (!overflow_style->HasNormalColumnGap()) { 2013 if (!overflow_style->HasNormalColumnGap()) {
2013 column_gap_normal = false; 2014 column_gap_normal = false;
2014 column_gap = overflow_style->ColumnGap(); 2015 column_gap = overflow_style->ColumnGap();
2015 } 2016 }
2016 } 2017 }
2017 2018
2018 ScrollSnapType snap_type = overflow_style->GetScrollSnapType(); 2019 ScrollSnapType snap_type = overflow_style->GetScrollSnapType();
2019 ScrollBehavior scroll_behavior = document_element_style->GetScrollBehavior(); 2020 ScrollBehavior scroll_behavior = document_element_style->GetScrollBehavior();
2020 2021
2022 EScrollBoundaryBehavior scroll_boundary_behavior_x =
2023 overflow_style->ScrollBoundaryBehaviorX();
2024 EScrollBoundaryBehavior scroll_boundary_behavior_y =
2025 overflow_style->ScrollBoundaryBehaviorY();
2026 using ScrollBoundaryBehaviorType =
2027 WebScrollBoundaryBehavior::ScrollBoundaryBehaviorType;
2028 if (RuntimeEnabledFeatures::CSSScrollBoundaryBehaviorEnabled() &&
2029 IsInMainFrame()) {
2030 GetPage()->GetOverscrollController().SetScrollBoundaryBehavior(
2031 WebScrollBoundaryBehavior(
2032 static_cast<ScrollBoundaryBehaviorType>(scroll_boundary_behavior_x),
2033 static_cast<ScrollBoundaryBehaviorType>(
2034 scroll_boundary_behavior_y)));
2035 }
2036
2021 RefPtr<ComputedStyle> viewport_style; 2037 RefPtr<ComputedStyle> viewport_style;
2022 if (change == kForce || !GetLayoutViewItem().Style()) { 2038 if (change == kForce || !GetLayoutViewItem().Style()) {
2023 viewport_style = StyleResolver::StyleForViewport(*this); 2039 viewport_style = StyleResolver::StyleForViewport(*this);
2024 } else { 2040 } else {
2025 const ComputedStyle& old_style = GetLayoutViewItem().StyleRef(); 2041 const ComputedStyle& old_style = GetLayoutViewItem().StyleRef();
2026 if (old_style.GetWritingMode() == root_writing_mode && 2042 if (old_style.GetWritingMode() == root_writing_mode &&
2027 old_style.Direction() == root_direction && 2043 old_style.Direction() == root_direction &&
2028 old_style.VisitedDependentColor(CSSPropertyBackgroundColor) == 2044 old_style.VisitedDependentColor(CSSPropertyBackgroundColor) ==
2029 background_color && 2045 background_color &&
2030 old_style.BackgroundLayers() == background_layers && 2046 old_style.BackgroundLayers() == background_layers &&
2031 old_style.ImageRendering() == image_rendering && 2047 old_style.ImageRendering() == image_rendering &&
2032 old_style.OverflowAnchor() == overflow_anchor && 2048 old_style.OverflowAnchor() == overflow_anchor &&
2033 old_style.OverflowX() == overflow_x && 2049 old_style.OverflowX() == overflow_x &&
2034 old_style.OverflowY() == overflow_y && 2050 old_style.OverflowY() == overflow_y &&
2035 old_style.HasNormalColumnGap() == column_gap_normal && 2051 old_style.HasNormalColumnGap() == column_gap_normal &&
2036 old_style.ColumnGap() == column_gap && 2052 old_style.ColumnGap() == column_gap &&
2037 old_style.GetScrollSnapType() == snap_type && 2053 old_style.GetScrollSnapType() == snap_type &&
2038 old_style.GetScrollBehavior() == scroll_behavior) { 2054 old_style.GetScrollBehavior() == scroll_behavior &&
2055 old_style.ScrollBoundaryBehaviorX() == scroll_boundary_behavior_x &&
2056 old_style.ScrollBoundaryBehaviorY() == scroll_boundary_behavior_y) {
2039 return; 2057 return;
2040 } 2058 }
2041 viewport_style = ComputedStyle::Clone(old_style); 2059 viewport_style = ComputedStyle::Clone(old_style);
2042 } 2060 }
2043 viewport_style->SetWritingMode(root_writing_mode); 2061 viewport_style->SetWritingMode(root_writing_mode);
2044 viewport_style->SetDirection(root_direction); 2062 viewport_style->SetDirection(root_direction);
2045 viewport_style->SetBackgroundColor(background_color); 2063 viewport_style->SetBackgroundColor(background_color);
2046 viewport_style->AccessBackgroundLayers() = background_layers; 2064 viewport_style->AccessBackgroundLayers() = background_layers;
2047 viewport_style->SetImageRendering(image_rendering); 2065 viewport_style->SetImageRendering(image_rendering);
2048 viewport_style->SetOverflowAnchor(overflow_anchor); 2066 viewport_style->SetOverflowAnchor(overflow_anchor);
2049 viewport_style->SetOverflowX(overflow_x); 2067 viewport_style->SetOverflowX(overflow_x);
2050 viewport_style->SetOverflowY(overflow_y); 2068 viewport_style->SetOverflowY(overflow_y);
2051 if (column_gap_normal) 2069 if (column_gap_normal)
2052 viewport_style->SetHasNormalColumnGap(); 2070 viewport_style->SetHasNormalColumnGap();
2053 else 2071 else
2054 viewport_style->SetColumnGap(column_gap); 2072 viewport_style->SetColumnGap(column_gap);
2055 viewport_style->SetScrollSnapType(snap_type); 2073 viewport_style->SetScrollSnapType(snap_type);
2056 viewport_style->SetScrollBehavior(scroll_behavior); 2074 viewport_style->SetScrollBehavior(scroll_behavior);
2075 viewport_style->SetScrollBoundaryBehaviorX(scroll_boundary_behavior_x);
2076 viewport_style->SetScrollBoundaryBehaviorY(scroll_boundary_behavior_y);
2057 GetLayoutViewItem().SetStyle(viewport_style); 2077 GetLayoutViewItem().SetStyle(viewport_style);
2058 SetupFontBuilder(*viewport_style); 2078 SetupFontBuilder(*viewport_style);
2059 } 2079 }
2060 2080
2061 #if DCHECK_IS_ON() 2081 #if DCHECK_IS_ON()
2062 static void AssertLayoutTreeUpdated(Node& root) { 2082 static void AssertLayoutTreeUpdated(Node& root) {
2063 for (Node& node : NodeTraversal::InclusiveDescendantsOf(root)) { 2083 for (Node& node : NodeTraversal::InclusiveDescendantsOf(root)) {
2064 // We leave some nodes with dirty bits in the tree because they don't 2084 // We leave some nodes with dirty bits in the tree because they don't
2065 // matter like Comment and ProcessingInstruction nodes. 2085 // matter like Comment and ProcessingInstruction nodes.
2066 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the 2086 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the
(...skipping 4982 matching lines...) Expand 10 before | Expand all | Expand 10 after
7049 } 7069 }
7050 7070
7051 void showLiveDocumentInstances() { 7071 void showLiveDocumentInstances() {
7052 WeakDocumentSet& set = liveDocumentSet(); 7072 WeakDocumentSet& set = liveDocumentSet();
7053 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 7073 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
7054 for (blink::Document* document : set) 7074 for (blink::Document* document : set)
7055 fprintf(stderr, "- Document %p URL: %s\n", document, 7075 fprintf(stderr, "- Document %p URL: %s\n", document,
7056 document->Url().GetString().Utf8().data()); 7076 document->Url().GetString().Utf8().data());
7057 } 7077 }
7058 #endif 7078 #endif
OLDNEW
« no previous file with comments | « content/test/BUILD.gn ('k') | third_party/WebKit/Source/core/exported/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698