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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2698473006: Set layer scroll data from PaintArtifactCompositor (Closed)
Patch Set: Created 3 years, 10 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/PaintPropertyTreeBuilder.h" 5 #include "core/paint/PaintPropertyTreeBuilder.h"
6 6
7 #include "core/dom/DOMNodeIds.h" 7 #include "core/dom/DOMNodeIds.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 static bool updateScrollTranslation( 81 static bool updateScrollTranslation(
82 FrameView& frameView, 82 FrameView& frameView,
83 PassRefPtr<const TransformPaintPropertyNode> parent, 83 PassRefPtr<const TransformPaintPropertyNode> parent,
84 const TransformationMatrix& matrix, 84 const TransformationMatrix& matrix,
85 const FloatPoint3D& origin, 85 const FloatPoint3D& origin,
86 PassRefPtr<const ScrollPaintPropertyNode> scrollParent, 86 PassRefPtr<const ScrollPaintPropertyNode> scrollParent,
87 const IntSize& clip, 87 const IntSize& clip,
88 const IntSize& bounds, 88 const IntSize& bounds,
89 bool userScrollableHorizontal, 89 bool userScrollableHorizontal,
90 bool userScrollableVertical, 90 bool userScrollableVertical,
91 MainThreadScrollingReasons mainThreadScrollingReasons) { 91 MainThreadScrollingReasons mainThreadScrollingReasons,
92 WebLayerScrollClient* scrollClient) {
92 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); 93 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled());
93 CompositorElementId compositorElementId = 94 CompositorElementId compositorElementId =
94 createDomNodeBasedCompositorElementId(*frameView.layoutView()); 95 createDomNodeBasedCompositorElementId(*frameView.layoutView());
95 if (auto* existingScrollTranslation = frameView.scrollTranslation()) { 96 if (auto* existingScrollTranslation = frameView.scrollTranslation()) {
96 auto existingReasons = 97 auto existingReasons =
97 existingScrollTranslation->scrollNode()->mainThreadScrollingReasons(); 98 existingScrollTranslation->scrollNode()->mainThreadScrollingReasons();
98 existingScrollTranslation->updateScrollTranslation( 99 existingScrollTranslation->updateScrollTranslation(
99 std::move(parent), matrix, origin, false, 0, CompositingReasonNone, 100 std::move(parent), matrix, origin, false, 0, CompositingReasonNone,
100 compositorElementId, std::move(scrollParent), clip, bounds, 101 compositorElementId, std::move(scrollParent), clip, bounds,
101 userScrollableHorizontal, userScrollableVertical, 102 userScrollableHorizontal, userScrollableVertical,
102 mainThreadScrollingReasons); 103 mainThreadScrollingReasons, scrollClient);
103 return existingReasons != mainThreadScrollingReasons; 104 return existingReasons != mainThreadScrollingReasons;
104 } 105 }
105 frameView.setScrollTranslation( 106 frameView.setScrollTranslation(
106 TransformPaintPropertyNode::createScrollTranslation( 107 TransformPaintPropertyNode::createScrollTranslation(
107 std::move(parent), matrix, origin, false, 0, CompositingReasonNone, 108 std::move(parent), matrix, origin, false, 0, CompositingReasonNone,
108 compositorElementId, std::move(scrollParent), clip, bounds, 109 compositorElementId, std::move(scrollParent), clip, bounds,
109 userScrollableHorizontal, userScrollableVertical, 110 userScrollableHorizontal, userScrollableVertical,
110 mainThreadScrollingReasons)); 111 mainThreadScrollingReasons, scrollClient));
111 return true; 112 return true;
112 } 113 }
113 114
114 static MainThreadScrollingReasons mainThreadScrollingReasons( 115 static MainThreadScrollingReasons mainThreadScrollingReasons(
115 const FrameView& frameView, 116 const FrameView& frameView,
116 MainThreadScrollingReasons ancestorReasons) { 117 MainThreadScrollingReasons ancestorReasons) {
117 auto reasons = ancestorReasons; 118 auto reasons = ancestorReasons;
118 if (!frameView.frame().settings()->getThreadedScrollingEnabled()) 119 if (!frameView.frame().settings()->getThreadedScrollingEnabled())
119 reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled; 120 reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled;
120 if (frameView.hasBackgroundAttachmentFixedObjects()) 121 if (frameView.hasBackgroundAttachmentFixedObjects())
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 bool userScrollableVertical = 169 bool userScrollableVertical =
169 frameView.userInputScrollable(VerticalScrollbar); 170 frameView.userInputScrollable(VerticalScrollbar);
170 171
171 auto ancestorReasons = 172 auto ancestorReasons =
172 context.current.scroll->mainThreadScrollingReasons(); 173 context.current.scroll->mainThreadScrollingReasons();
173 auto reasons = mainThreadScrollingReasons(frameView, ancestorReasons); 174 auto reasons = mainThreadScrollingReasons(frameView, ancestorReasons);
174 175
175 context.forceSubtreeUpdate |= updateScrollTranslation( 176 context.forceSubtreeUpdate |= updateScrollTranslation(
176 frameView, frameView.preTranslation(), frameScroll, FloatPoint3D(), 177 frameView, frameView.preTranslation(), frameScroll, FloatPoint3D(),
177 context.current.scroll, scrollClip, scrollBounds, 178 context.current.scroll, scrollClip, scrollBounds,
178 userScrollableHorizontal, userScrollableVertical, reasons); 179 userScrollableHorizontal, userScrollableVertical, reasons,
180 frameView.getScrollableArea());
179 } else { 181 } else {
180 if (frameView.scrollTranslation()) { 182 if (frameView.scrollTranslation()) {
181 // Ensure pre-existing properties are cleared if there is no scrolling. 183 // Ensure pre-existing properties are cleared if there is no scrolling.
182 frameView.setScrollTranslation(nullptr); 184 frameView.setScrollTranslation(nullptr);
183 // Rebuild all descendant properties because a property was removed. 185 // Rebuild all descendant properties because a property was removed.
184 context.forceSubtreeUpdate = true; 186 context.forceSubtreeUpdate = true;
185 } 187 }
186 } 188 }
187 } 189 }
188 190
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 PaintPropertyTreeBuilderContext& context) { 741 PaintPropertyTreeBuilderContext& context) {
740 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { 742 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
741 bool needsScrollProperties = false; 743 bool needsScrollProperties = false;
742 if (object.hasOverflowClip()) { 744 if (object.hasOverflowClip()) {
743 auto ancestorReasons = 745 auto ancestorReasons =
744 context.current.scroll->mainThreadScrollingReasons(); 746 context.current.scroll->mainThreadScrollingReasons();
745 auto reasons = mainThreadScrollingReasons(object, ancestorReasons); 747 auto reasons = mainThreadScrollingReasons(object, ancestorReasons);
746 bool scrollNodeNeededForMainThreadReasons = ancestorReasons != reasons; 748 bool scrollNodeNeededForMainThreadReasons = ancestorReasons != reasons;
747 749
748 const LayoutBox& box = toLayoutBox(object); 750 const LayoutBox& box = toLayoutBox(object);
749 const auto* scrollableArea = box.getScrollableArea(); 751 auto* scrollableArea = box.getScrollableArea();
750 IntSize scrollOffset = box.scrolledContentOffset(); 752 IntSize scrollOffset = box.scrolledContentOffset();
751 if (scrollNodeNeededForMainThreadReasons || !scrollOffset.isZero() || 753 if (scrollNodeNeededForMainThreadReasons || !scrollOffset.isZero() ||
752 scrollableArea->scrollsOverflow()) { 754 scrollableArea->scrollsOverflow()) {
753 needsScrollProperties = true; 755 needsScrollProperties = true;
754 auto& properties = 756 auto& properties =
755 object.getMutableForPainting().ensurePaintProperties(); 757 object.getMutableForPainting().ensurePaintProperties();
756 758
757 IntSize scrollClip = scrollableArea->visibleContentRect().size(); 759 IntSize scrollClip = scrollableArea->visibleContentRect().size();
758 IntSize scrollBounds = scrollableArea->contentsSize(); 760 IntSize scrollBounds = scrollableArea->contentsSize();
759 bool userScrollableHorizontal = 761 bool userScrollableHorizontal =
(...skipping 12 matching lines...) Expand all
772 CompositorElementId compositorElementId = 774 CompositorElementId compositorElementId =
773 createDomNodeBasedCompositorElementId(object); 775 createDomNodeBasedCompositorElementId(object);
774 TransformationMatrix matrix = TransformationMatrix().translate( 776 TransformationMatrix matrix = TransformationMatrix().translate(
775 -scrollOffset.width(), -scrollOffset.height()); 777 -scrollOffset.width(), -scrollOffset.height());
776 context.forceSubtreeUpdate |= properties.updateScrollTranslation( 778 context.forceSubtreeUpdate |= properties.updateScrollTranslation(
777 context.current.transform, matrix, FloatPoint3D(), 779 context.current.transform, matrix, FloatPoint3D(),
778 context.current.shouldFlattenInheritedTransform, 780 context.current.shouldFlattenInheritedTransform,
779 context.current.renderingContextId, CompositingReasonNone, 781 context.current.renderingContextId, CompositingReasonNone,
780 compositorElementId, context.current.scroll, scrollClip, 782 compositorElementId, context.current.scroll, scrollClip,
781 scrollBounds, userScrollableHorizontal, userScrollableVertical, 783 scrollBounds, userScrollableHorizontal, userScrollableVertical,
782 reasons); 784 reasons, scrollableArea);
783 } 785 }
784 } 786 }
785 787
786 if (!needsScrollProperties) { 788 if (!needsScrollProperties) {
787 // Ensure pre-existing properties are cleared. 789 // Ensure pre-existing properties are cleared.
788 if (auto* properties = object.getMutableForPainting().paintProperties()) 790 if (auto* properties = object.getMutableForPainting().paintProperties())
789 context.forceSubtreeUpdate |= properties->clearScrollTranslation(); 791 context.forceSubtreeUpdate |= properties->clearScrollTranslation();
790 } 792 }
791 } 793 }
792 794
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 updateOverflowClip(object, context); 978 updateOverflowClip(object, context);
977 updatePerspective(object, context); 979 updatePerspective(object, context);
978 updateSvgLocalToBorderBoxTransform(object, context); 980 updateSvgLocalToBorderBoxTransform(object, context);
979 updateScrollAndScrollTranslation(object, context); 981 updateScrollAndScrollTranslation(object, context);
980 updateOutOfFlowContext(object, context); 982 updateOutOfFlowContext(object, context);
981 983
982 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); 984 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate();
983 } 985 }
984 986
985 } // namespace blink 987 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698