OLD | NEW |
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 Loading... |
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 Loading... |
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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 PaintPropertyTreeBuilderContext& context) { | 848 PaintPropertyTreeBuilderContext& context) { |
847 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { | 849 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
848 bool needsScrollProperties = false; | 850 bool needsScrollProperties = false; |
849 if (object.hasOverflowClip()) { | 851 if (object.hasOverflowClip()) { |
850 auto ancestorReasons = | 852 auto ancestorReasons = |
851 context.current.scroll->mainThreadScrollingReasons(); | 853 context.current.scroll->mainThreadScrollingReasons(); |
852 auto reasons = mainThreadScrollingReasons(object, ancestorReasons); | 854 auto reasons = mainThreadScrollingReasons(object, ancestorReasons); |
853 bool scrollNodeNeededForMainThreadReasons = ancestorReasons != reasons; | 855 bool scrollNodeNeededForMainThreadReasons = ancestorReasons != reasons; |
854 | 856 |
855 const LayoutBox& box = toLayoutBox(object); | 857 const LayoutBox& box = toLayoutBox(object); |
856 const auto* scrollableArea = box.getScrollableArea(); | 858 auto* scrollableArea = box.getScrollableArea(); |
857 IntSize scrollOffset = box.scrolledContentOffset(); | 859 IntSize scrollOffset = box.scrolledContentOffset(); |
858 if (scrollNodeNeededForMainThreadReasons || !scrollOffset.isZero() || | 860 if (scrollNodeNeededForMainThreadReasons || !scrollOffset.isZero() || |
859 scrollableArea->scrollsOverflow()) { | 861 scrollableArea->scrollsOverflow()) { |
860 needsScrollProperties = true; | 862 needsScrollProperties = true; |
861 auto& properties = | 863 auto& properties = |
862 object.getMutableForPainting().ensurePaintProperties(); | 864 object.getMutableForPainting().ensurePaintProperties(); |
863 | 865 |
864 IntSize scrollClip = scrollableArea->visibleContentRect().size(); | 866 IntSize scrollClip = scrollableArea->visibleContentRect().size(); |
865 IntSize scrollBounds = scrollableArea->contentsSize(); | 867 IntSize scrollBounds = scrollableArea->contentsSize(); |
866 bool userScrollableHorizontal = | 868 bool userScrollableHorizontal = |
(...skipping 12 matching lines...) Expand all Loading... |
879 CompositorElementId compositorElementId = | 881 CompositorElementId compositorElementId = |
880 createDomNodeBasedCompositorElementId(object); | 882 createDomNodeBasedCompositorElementId(object); |
881 TransformationMatrix matrix = TransformationMatrix().translate( | 883 TransformationMatrix matrix = TransformationMatrix().translate( |
882 -scrollOffset.width(), -scrollOffset.height()); | 884 -scrollOffset.width(), -scrollOffset.height()); |
883 context.forceSubtreeUpdate |= properties.updateScrollTranslation( | 885 context.forceSubtreeUpdate |= properties.updateScrollTranslation( |
884 context.current.transform, matrix, FloatPoint3D(), | 886 context.current.transform, matrix, FloatPoint3D(), |
885 context.current.shouldFlattenInheritedTransform, | 887 context.current.shouldFlattenInheritedTransform, |
886 context.current.renderingContextId, CompositingReasonNone, | 888 context.current.renderingContextId, CompositingReasonNone, |
887 compositorElementId, context.current.scroll, scrollClip, | 889 compositorElementId, context.current.scroll, scrollClip, |
888 scrollBounds, userScrollableHorizontal, userScrollableVertical, | 890 scrollBounds, userScrollableHorizontal, userScrollableVertical, |
889 reasons); | 891 reasons, scrollableArea); |
890 } | 892 } |
891 } | 893 } |
892 | 894 |
893 if (!needsScrollProperties) { | 895 if (!needsScrollProperties) { |
894 // Ensure pre-existing properties are cleared. | 896 // Ensure pre-existing properties are cleared. |
895 if (auto* properties = object.getMutableForPainting().paintProperties()) | 897 if (auto* properties = object.getMutableForPainting().paintProperties()) |
896 context.forceSubtreeUpdate |= properties->clearScrollTranslation(); | 898 context.forceSubtreeUpdate |= properties->clearScrollTranslation(); |
897 } | 899 } |
898 } | 900 } |
899 | 901 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 updateOverflowClip(object, context); | 1087 updateOverflowClip(object, context); |
1086 updatePerspective(object, context); | 1088 updatePerspective(object, context); |
1087 updateSvgLocalToBorderBoxTransform(object, context); | 1089 updateSvgLocalToBorderBoxTransform(object, context); |
1088 updateScrollAndScrollTranslation(object, context); | 1090 updateScrollAndScrollTranslation(object, context); |
1089 updateOutOfFlowContext(object, context); | 1091 updateOutOfFlowContext(object, context); |
1090 | 1092 |
1091 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); | 1093 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); |
1092 } | 1094 } |
1093 | 1095 |
1094 } // namespace blink | 1096 } // namespace blink |
OLD | NEW |