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/PrePaintTreeWalk.h" | 5 #include "core/paint/PrePaintTreeWalk.h" |
6 | 6 |
7 #include "core/dom/DocumentLifecycle.h" | 7 #include "core/dom/DocumentLifecycle.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/layout/LayoutMultiColumnSpannerPlaceholder.h" | 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 76 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
77 return; | 77 return; |
78 | 78 |
79 if (!object.hasLayer()) | 79 if (!object.hasLayer()) |
80 return; | 80 return; |
81 | 81 |
82 PaintLayer* paintLayer = object.enclosingLayer(); | 82 PaintLayer* paintLayer = object.enclosingLayer(); |
83 paintLayer->updateAncestorOverflowLayer(context.ancestorOverflowPaintLayer); | 83 paintLayer->updateAncestorOverflowLayer(context.ancestorOverflowPaintLayer); |
84 | 84 |
85 if (object.styleRef().position() == EPosition::kSticky) { | 85 if (object.styleRef().position() == EPosition::kSticky) { |
86 paintLayer->layoutObject()->updateStickyPositionConstraints(); | 86 paintLayer->layoutObject().updateStickyPositionConstraints(); |
87 | 87 |
88 // Sticky position constraints and ancestor overflow scroller affect the | 88 // Sticky position constraints and ancestor overflow scroller affect the |
89 // sticky layer position, so we need to update it again here. | 89 // sticky layer position, so we need to update it again here. |
90 // TODO(flackr): This should be refactored in the future to be clearer (i.e. | 90 // TODO(flackr): This should be refactored in the future to be clearer (i.e. |
91 // update layer position and ancestor inputs updates in the same walk). | 91 // update layer position and ancestor inputs updates in the same walk). |
92 paintLayer->updateLayerPosition(); | 92 paintLayer->updateLayerPosition(); |
93 } | 93 } |
94 | 94 |
95 if (paintLayer->isRootLayer() || object.hasOverflowClip()) | 95 if (paintLayer->isRootLayer() || object.hasOverflowClip()) |
96 context.ancestorOverflowPaintLayer = paintLayer; | 96 context.ancestorOverflowPaintLayer = paintLayer; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded( | 131 void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded( |
132 const LayoutObject& object, | 132 const LayoutObject& object, |
133 const PaintLayer& ancestorTransformedOrRootPaintLayer, | 133 const PaintLayer& ancestorTransformedOrRootPaintLayer, |
134 PaintPropertyTreeBuilderContext& context) { | 134 PaintPropertyTreeBuilderContext& context) { |
135 if (!object.hasLayer()) | 135 if (!object.hasLayer()) |
136 return; | 136 return; |
137 | 137 |
138 PaintLayer& paintLayer = *toLayoutBoxModelObject(object).layer(); | 138 PaintLayer& paintLayer = *toLayoutBoxModelObject(object).layer(); |
139 PropertyTreeState ancestorState = | 139 PropertyTreeState ancestorState = |
140 *ancestorTransformedOrRootPaintLayer.layoutObject() | 140 *ancestorTransformedOrRootPaintLayer.layoutObject() |
141 ->paintProperties() | 141 .paintProperties() |
142 ->localBorderBoxProperties(); | 142 ->localBorderBoxProperties(); |
143 | 143 |
144 #ifdef CHECK_CLIP_RECTS | 144 #ifdef CHECK_CLIP_RECTS |
145 ShouldRespectOverflowClipType respectOverflowClip = RespectOverflowClip; | 145 ShouldRespectOverflowClipType respectOverflowClip = RespectOverflowClip; |
146 #endif | 146 #endif |
147 if (ancestorTransformedOrRootPaintLayer.compositingState() == | 147 if (ancestorTransformedOrRootPaintLayer.compositingState() == |
148 PaintsIntoOwnBacking && | 148 PaintsIntoOwnBacking && |
149 ancestorTransformedOrRootPaintLayer.layoutObject() | 149 ancestorTransformedOrRootPaintLayer.layoutObject() |
150 ->paintProperties() | 150 .paintProperties() |
151 ->overflowClip()) { | 151 ->overflowClip()) { |
152 ancestorState.setClip(ancestorTransformedOrRootPaintLayer.layoutObject() | 152 ancestorState.setClip(ancestorTransformedOrRootPaintLayer.layoutObject() |
153 ->paintProperties() | 153 .paintProperties() |
154 ->overflowClip()); | 154 ->overflowClip()); |
155 #ifdef CHECK_CLIP_RECTS | 155 #ifdef CHECK_CLIP_RECTS |
156 respectOverflowClip = IgnoreOverflowClip; | 156 respectOverflowClip = IgnoreOverflowClip; |
157 #endif | 157 #endif |
158 } | 158 } |
159 | 159 |
160 #ifdef CHECK_CLIP_RECTS | 160 #ifdef CHECK_CLIP_RECTS |
161 ClipRects& oldClipRects = paintLayer.clipper().paintingClipRects( | 161 ClipRects& oldClipRects = paintLayer.clipper().paintingClipRects( |
162 &ancestorTransformedOrRootPaintLayer, respectOverflowClip, LayoutSize()); | 162 &ancestorTransformedOrRootPaintLayer, respectOverflowClip, LayoutSize()); |
163 #endif | 163 #endif |
164 | 164 |
165 bool hasClip = false; | 165 bool hasClip = false; |
166 RefPtr<ClipRects> clipRects = ClipRects::create(); | 166 RefPtr<ClipRects> clipRects = ClipRects::create(); |
167 clipRects->setOverflowClipRect(clipRectForContext( | 167 clipRects->setOverflowClipRect(clipRectForContext( |
168 context.current, context.currentEffect, ancestorState, | 168 context.current, context.currentEffect, ancestorState, |
169 ancestorTransformedOrRootPaintLayer.layoutObject()->paintOffset(), | 169 ancestorTransformedOrRootPaintLayer.layoutObject().paintOffset(), |
170 hasClip)); | 170 hasClip)); |
171 #ifdef CHECK_CLIP_RECTS | 171 #ifdef CHECK_CLIP_RECTS |
172 CHECK(!hasClip || | 172 CHECK(!hasClip || |
173 clipRects->overflowClipRect() == oldClipRects.overflowClipRect()) | 173 clipRects->overflowClipRect() == oldClipRects.overflowClipRect()) |
174 << "rect= " << clipRects->overflowClipRect().toString(); | 174 << "rect= " << clipRects->overflowClipRect().toString(); |
175 #endif | 175 #endif |
176 | 176 |
177 clipRects->setFixedClipRect(clipRectForContext( | 177 clipRects->setFixedClipRect(clipRectForContext( |
178 context.fixedPosition, context.currentEffect, ancestorState, | 178 context.fixedPosition, context.currentEffect, ancestorState, |
179 ancestorTransformedOrRootPaintLayer.layoutObject()->paintOffset(), | 179 ancestorTransformedOrRootPaintLayer.layoutObject().paintOffset(), |
180 hasClip)); | 180 hasClip)); |
181 #ifdef CHECK_CLIP_RECTS | 181 #ifdef CHECK_CLIP_RECTS |
182 CHECK(hasClip || clipRects->fixedClipRect() == oldClipRects.fixedClipRect()) | 182 CHECK(hasClip || clipRects->fixedClipRect() == oldClipRects.fixedClipRect()) |
183 << " fixed=" << clipRects->fixedClipRect().toString(); | 183 << " fixed=" << clipRects->fixedClipRect().toString(); |
184 #endif | 184 #endif |
185 | 185 |
186 clipRects->setPosClipRect(clipRectForContext( | 186 clipRects->setPosClipRect(clipRectForContext( |
187 context.absolutePosition, context.currentEffect, ancestorState, | 187 context.absolutePosition, context.currentEffect, ancestorState, |
188 ancestorTransformedOrRootPaintLayer.layoutObject()->paintOffset(), | 188 ancestorTransformedOrRootPaintLayer.layoutObject().paintOffset(), |
189 hasClip)); | 189 hasClip)); |
190 #ifdef CHECK_CLIP_RECTS | 190 #ifdef CHECK_CLIP_RECTS |
191 CHECK(!hasClip || clipRects->posClipRect() == oldClipRects.posClipRect()) | 191 CHECK(!hasClip || clipRects->posClipRect() == oldClipRects.posClipRect()) |
192 << " abs=" << clipRects->posClipRect().toString(); | 192 << " abs=" << clipRects->posClipRect().toString(); |
193 #endif | 193 #endif |
194 | 194 |
195 ClipRects* previousClipRects = paintLayer.previousPaintingClipRects(); | 195 ClipRects* previousClipRects = paintLayer.previousPaintingClipRects(); |
196 | 196 |
197 if (!previousClipRects || *clipRects != *previousClipRects) { | 197 if (!previousClipRects || *clipRects != *previousClipRects) { |
198 paintLayer.setNeedsRepaint(); | 198 paintLayer.setNeedsRepaint(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 roundedIntPoint(context.treeBuilderContext.current.paintOffset); | 263 roundedIntPoint(context.treeBuilderContext.current.paintOffset); |
264 walk(*toFrameView(widget), context); | 264 walk(*toFrameView(widget), context); |
265 } | 265 } |
266 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 266 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
267 } | 267 } |
268 | 268 |
269 object.getMutableForPainting().clearPaintFlags(); | 269 object.getMutableForPainting().clearPaintFlags(); |
270 } | 270 } |
271 | 271 |
272 } // namespace blink | 272 } // namespace blink |
OLD | NEW |