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

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

Issue 1774193002: New paint invalidation using paint property tree walk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct tracking of paintInvalidationContainer Created 4 years, 9 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/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutPart.h" 8 #include "core/layout/LayoutPart.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ObjectPaintProperties.h" 10 #include "core/paint/ObjectPaintProperties.h"
11 #include "core/paint/PaintLayer.h" 11 #include "core/paint/PaintLayer.h"
12 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 12 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
13 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 13 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
14 #include "platform/transforms/TransformationMatrix.h" 14 #include "platform/transforms/TransformationMatrix.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 // The context for layout tree walk. 18 // The context for layout tree walk.
19 // The walk will be done in the primary tree order (= DOM order), thus the conte xt will also be 19 // The walk will be done in the primary tree order (= DOM order), thus the conte xt will also be
20 // responsible for bookkeeping tree state in other order, for example, the most recent position 20 // responsible for bookkeeping tree state in other order, for example, the most recent position
21 // container seen. 21 // container seen.
22 struct PaintPropertyTreeBuilderContext { 22 struct PaintPropertyTreeBuilderContext {
23 PaintPropertyTreeBuilderContext() 23 PaintPropertyTreeBuilderContext()
24 : currentTransform(nullptr) 24 : paintInvalidationContainer(nullptr)
25 , currentClip(nullptr) 25 , paintInvalidationContainerForOutOfFlowPositioned(nullptr)
26 , transformForAbsolutePosition(nullptr) 26 { }
27 , clipForAbsolutePosition(nullptr) 27
28 , transformForFixedPosition(nullptr) 28 // TODO(wangxianzhu): The RefPtrs are needed for SPv1 which doesn't save the properties
29 , clipForFixedPosition(nullptr) 29 // into LayoutObjects. Change them to normal pointers for SPv2.
30 , currentEffect(nullptr) { }
31 30
32 // The combination of a transform and paint offset describes a linear space. 31 // The combination of a transform and paint offset describes a linear space.
33 // When a layout object recur to its children, the main context is expected to refer 32 // When a layout object recur to its children, the main context is expected to refer
34 // the object's border box, then the callee will derive its own border box b y translating 33 // the object's border box, then the callee will derive its own border box b y translating
35 // the space with its own layout location. 34 // the space with its own layout location.
36 TransformPaintPropertyNode* currentTransform; 35 RefPtr<TransformPaintPropertyNode> currentTransform;
37 LayoutPoint paintOffset; 36 LayoutPoint paintOffset;
38 // The clip node describes the accumulated raster clip for the current subtr ee. 37 // The clip node describes the accumulated raster clip for the current subtr ee.
39 // Note that the computed raster region in canvas space for a clip node is i ndependent from 38 // Note that the computed raster region in canvas space for a clip node is i ndependent from
40 // the transform and paint offset above. Also the actual raster region may b e affected 39 // the transform and paint offset above. Also the actual raster region may b e affected
41 // by layerization and occlusion tracking. 40 // by layerization and occlusion tracking.
42 ClipPaintPropertyNode* currentClip; 41 RefPtr<ClipPaintPropertyNode> currentClip;
43 42
44 // Separate context for out-of-flow positioned and fixed positioned elements are needed 43 // Separate context for out-of-flow positioned and fixed positioned elements are needed
45 // because they don't use DOM parent as their containing block. 44 // because they don't use DOM parent as their containing block.
46 // These additional contexts normally pass through untouched, and are only c opied from 45 // These additional contexts normally pass through untouched, and are only c opied from
47 // the main context when the current element serves as the containing block of corresponding 46 // the main context when the current element serves as the containing block of corresponding
48 // positioned descendants. 47 // positioned descendants.
49 // Overflow clips are also inherited by containing block tree instead of DOM tree, thus they 48 // Overflow clips are also inherited by containing block tree instead of DOM tree, thus they
50 // are included in the additional context too. 49 // are included in the additional context too.
51 TransformPaintPropertyNode* transformForAbsolutePosition; 50 RefPtr<TransformPaintPropertyNode> transformForAbsolutePosition;
52 LayoutPoint paintOffsetForAbsolutePosition; 51 LayoutPoint paintOffsetForAbsolutePosition;
53 ClipPaintPropertyNode* clipForAbsolutePosition; 52 RefPtr<ClipPaintPropertyNode> clipForAbsolutePosition;
54 53
55 TransformPaintPropertyNode* transformForFixedPosition; 54 RefPtr<TransformPaintPropertyNode> transformForFixedPosition;
56 LayoutPoint paintOffsetForFixedPosition; 55 LayoutPoint paintOffsetForFixedPosition;
57 ClipPaintPropertyNode* clipForFixedPosition; 56 RefPtr<ClipPaintPropertyNode> clipForFixedPosition;
58 57
59 // The effect hierarchy is applied by the stacking context tree. It is guara nteed that every 58 // The effect hierarchy is applied by the stacking context tree. It is guara nteed that every
60 // DOM descendant is also a stacking context descendant. Therefore, we don't need extra 59 // DOM descendant is also a stacking context descendant. Therefore, we don't need extra
61 // bookkeeping for effect nodes and can generate the effect tree from a DOM- order traversal. 60 // bookkeeping for effect nodes and can generate the effect tree from a DOM- order traversal.
62 EffectPaintPropertyNode* currentEffect; 61 RefPtr<EffectPaintPropertyNode> currentEffect;
62
63 const LayoutBoxModelObject* paintInvalidationContainer;
pdr. 2016/03/11 02:56:41 Even when spv2 and spinvalidation are both enabled
Xianzhu 2016/03/11 20:03:44 The paintInvalidationContainer fields are for spv1
64 const LayoutBoxModelObject* paintInvalidationContainerForOutOfFlowPositioned ;
63 }; 65 };
64 66
65 void PaintPropertyTreeBuilder::buildPropertyTrees(FrameView& rootFrame) 67 void PaintPropertyTreeBuilder::buildPropertyTrees(FrameView& rootFrame)
66 { 68 {
67 walk(rootFrame, PaintPropertyTreeBuilderContext()); 69 walk(rootFrame, PaintPropertyTreeBuilderContext(), nullptr);
68 } 70 }
69 71
70 void PaintPropertyTreeBuilder::walk(FrameView& frameView, const PaintPropertyTre eBuilderContext& context) 72 void PaintPropertyTreeBuilder::walk(FrameView& frameView, const PaintPropertyTre eBuilderContext& context, const PaintInvalidationState* paintInvalidationState)
71 { 73 {
72 PaintPropertyTreeBuilderContext localContext(context); 74 PaintPropertyTreeBuilderContext localContext(context);
73 75
74 // TODO(pdr): Creating paint properties for FrameView here will not be 76 // TODO(pdr): Creating paint properties for FrameView here will not be
75 // needed once settings()->rootLayerScrolls() is enabled. 77 // needed once settings()->rootLayerScrolls() is enabled.
76 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. 78 // TODO(pdr): Make this conditional on the rootLayerScrolls setting.
77 79
78 TransformationMatrix frameTranslate; 80 TransformationMatrix frameTranslate;
79 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView. y() + context.paintOffset.y()); 81 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView. y() + context.paintOffset.y());
80 RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = Trans formPaintPropertyNode::create(frameTranslate, FloatPoint3D(), context.currentTra nsform); 82 RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = Trans formPaintPropertyNode::create(frameTranslate, FloatPoint3D(), context.currentTra nsform);
81 localContext.transformForFixedPosition = newTransformNodeForPreTranslation.g et(); 83 localContext.transformForFixedPosition = newTransformNodeForPreTranslation.g et();
82 localContext.paintOffsetForFixedPosition = LayoutPoint(); 84 localContext.paintOffsetForFixedPosition = LayoutPoint();
83 85
84 FloatRoundedRect contentClip(IntRect(IntPoint(), frameView.visibleContentSiz e())); 86 FloatRoundedRect contentClip(IntRect(IntPoint(), frameView.visibleContentSiz e()));
85 RefPtr<ClipPaintPropertyNode> newClipNodeForContentClip = ClipPaintPropertyN ode::create(newTransformNodeForPreTranslation.get(), contentClip, localContext.c urrentClip); 87 RefPtr<ClipPaintPropertyNode> newClipNodeForContentClip = ClipPaintPropertyN ode::create(newTransformNodeForPreTranslation.get(), contentClip, localContext.c urrentClip);
86 localContext.currentClip = localContext.clipForAbsolutePosition = localConte xt.clipForFixedPosition = newClipNodeForContentClip.get(); 88 localContext.currentClip = localContext.clipForAbsolutePosition = localConte xt.clipForFixedPosition = newClipNodeForContentClip.get();
87 89
88 DoubleSize scrollOffset = frameView.scrollOffsetDouble(); 90 DoubleSize scrollOffset = frameView.scrollOffsetDouble();
89 TransformationMatrix frameScroll; 91 TransformationMatrix frameScroll;
90 frameScroll.translate(-scrollOffset.width(), -scrollOffset.height()); 92 frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
91 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = Tr ansformPaintPropertyNode::create(frameScroll, FloatPoint3D(), newTransformNodeFo rPreTranslation); 93 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = Tr ansformPaintPropertyNode::create(frameScroll, FloatPoint3D(), newTransformNodeFo rPreTranslation);
92 localContext.currentTransform = localContext.transformForAbsolutePosition = newTransformNodeForScrollTranslation.get(); 94 localContext.currentTransform = localContext.transformForAbsolutePosition = newTransformNodeForScrollTranslation.get();
93 localContext.paintOffset = localContext.paintOffsetForAbsolutePosition = Lay outPoint(); 95 localContext.paintOffset = localContext.paintOffsetForAbsolutePosition = Lay outPoint();
94 96
95 frameView.setPreTranslation(newTransformNodeForPreTranslation.release()); 97 frameView.setPreTranslation(newTransformNodeForPreTranslation.release());
96 frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release( )); 98 frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release( ));
97 frameView.setContentClip(newClipNodeForContentClip.release()); 99 frameView.setContentClip(newClipNodeForContentClip.release());
98 100
99 if (LayoutView* layoutView = frameView.layoutView()) 101 if (LayoutView* layoutView = frameView.layoutView())
100 walk(*layoutView, localContext); 102 walk(*layoutView, localContext, paintInvalidationState);
103 }
104
105 static void adjustContainerContextForPosition(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context)
106 {
107 switch (object.styleRef().position()) {
108 case AbsolutePosition:
109 context.currentTransform = context.transformForAbsolutePosition;
110 context.paintOffset = context.paintOffsetForAbsolutePosition;
111 context.currentClip = context.clipForAbsolutePosition;
112 context.paintInvalidationContainer = context.paintInvalidationContainerF orOutOfFlowPositioned;
113 break;
114 case FixedPosition:
115 context.currentTransform = context.transformForFixedPosition;
116 context.paintOffset = context.paintOffsetForFixedPosition;
117 context.currentClip = context.clipForFixedPosition;
118 context.paintInvalidationContainer = context.paintInvalidationContainerF orOutOfFlowPositioned;
119 break;
120 default:
121 break;
122 }
101 } 123 }
102 124
103 static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain tPropertyTreeBuilderContext& context) 125 static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain tPropertyTreeBuilderContext& context)
104 { 126 {
105 if (!object.isBoxModelObject()) 127 if (!object.isBoxModelObject())
106 return; 128 return;
107 129
108 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); 130 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object);
109 131
110 // TODO(trchen): There is some insanity going on with tables. Double check r esults. 132 // TODO(trchen): There is some insanity going on with tables. Double check r esults.
111 switch (object.styleRef().position()) { 133 if (object.isInFlowPositioned())
112 case StaticPosition:
113 break;
114 case RelativePosition:
115 context.paintOffset += boxModelObject.offsetForInFlowPosition(); 134 context.paintOffset += boxModelObject.offsetForInFlowPosition();
116 break; 135
117 case AbsolutePosition:
118 context.currentTransform = context.transformForAbsolutePosition;
119 context.paintOffset = context.paintOffsetForAbsolutePosition;
120 context.currentClip = context.clipForAbsolutePosition;
121 break;
122 case StickyPosition:
123 context.paintOffset += boxModelObject.offsetForInFlowPosition();
124 break;
125 case FixedPosition:
126 context.currentTransform = context.transformForFixedPosition;
127 context.paintOffset = context.paintOffsetForFixedPosition;
128 context.currentClip = context.clipForFixedPosition;
129 break;
130 default:
131 ASSERT_NOT_REACHED();
132 }
133 if (boxModelObject.isBox()) 136 if (boxModelObject.isBox())
134 context.paintOffset += toLayoutBox(boxModelObject).locationOffset(); 137 context.paintOffset += toLayoutBox(boxModelObject).locationOffset();
135 } 138 }
136 139
137 static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeed ed(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) 140 static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeed ed(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
138 { 141 {
139 bool shouldCreatePaintOffsetTranslationNode = false; 142 bool shouldCreatePaintOffsetTranslationNode = false;
140 if (object.isSVGRoot()) { 143 if (object.isSVGRoot()) {
141 // SVG doesn't use paint offset internally so emit a paint offset at the html->svg boundary. 144 // SVG doesn't use paint offset internally so emit a paint offset at the html->svg boundary.
142 shouldCreatePaintOffsetTranslationNode = true; 145 shouldCreatePaintOffsetTranslationNode = true;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (style.hasBorderRadius()) { 232 if (style.hasBorderRadius()) {
230 newClipNodeForBorderRadiusClip = ClipPaintPropertyNode::create( 233 newClipNodeForBorderRadiusClip = ClipPaintPropertyNode::create(
231 context.currentTransform, 234 context.currentTransform,
232 style.getRoundedInnerBorderFor(LayoutRect(context.paintOffset, box.s ize())), 235 style.getRoundedInnerBorderFor(LayoutRect(context.paintOffset, box.s ize())),
233 context.currentClip); 236 context.currentClip);
234 } 237 }
235 238
236 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = ClipPaintProperty Node::create( 239 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = ClipPaintProperty Node::create(
237 context.currentTransform, 240 context.currentTransform,
238 FloatRoundedRect(FloatRect(clipRect)), 241 FloatRoundedRect(FloatRect(clipRect)),
239 newClipNodeForBorderRadiusClip ? newClipNodeForBorderRadiusClip.release( ) : context.currentClip); 242 newClipNodeForBorderRadiusClip ? newClipNodeForBorderRadiusClip.release( ) : PassRefPtr<ClipPaintPropertyNode>(context.currentClip));
240 context.currentClip = newClipNodeForOverflowClip.get(); 243 context.currentClip = newClipNodeForOverflowClip.get();
241 return newClipNodeForOverflowClip.release(); 244 return newClipNodeForOverflowClip.release();
242 } 245 }
243 246
244 static FloatPoint perspectiveOrigin(const LayoutBox& box) 247 static FloatPoint perspectiveOrigin(const LayoutBox& box)
245 { 248 {
246 const ComputedStyle& style = box.styleRef(); 249 const ComputedStyle& style = box.styleRef();
247 FloatSize borderBoxSize(box.size()); 250 FloatSize borderBoxSize(box.size());
248 return FloatPoint( 251 return FloatPoint(
249 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), 252 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 299
297 // TODO(pdr): Remove the !object.isLayoutView() condition when removing Fram eView 300 // TODO(pdr): Remove the !object.isLayoutView() condition when removing Fram eView
298 // paint properties for rootLayerScrolls. 301 // paint properties for rootLayerScrolls.
299 if (!object.isLayoutView() && object.canContainFixedPositionObjects()) { 302 if (!object.isLayoutView() && object.canContainFixedPositionObjects()) {
300 context.transformForFixedPosition = context.currentTransform; 303 context.transformForFixedPosition = context.currentTransform;
301 context.paintOffsetForFixedPosition = context.paintOffset; 304 context.paintOffsetForFixedPosition = context.paintOffset;
302 context.clipForFixedPosition = context.currentClip; 305 context.clipForFixedPosition = context.currentClip;
303 } 306 }
304 } 307 }
305 308
306 static PassOwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordTreeCon textIfNeeded(LayoutObject& object, const PaintPropertyTreeBuilderContext& contex t) 309 static PassOwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordTreeCon textIfNeeded(const LayoutObject& object, const PaintPropertyTreeBuilderContext& context)
307 { 310 {
308 // Note: Currently only layer painter makes use of the pre-computed context. 311 // Note: Currently only layer painter makes use of the pre-computed context.
309 // This condition may be loosened with no adverse effects beside memory use. 312 // This condition may be loosened with no adverse effects beside memory use.
310 if (!object.hasLayer()) 313 if (!object.hasLayer())
311 return nullptr; 314 return nullptr;
312 315
313 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordedContext = ad optPtr(new ObjectPaintProperties::LocalBorderBoxProperties); 316 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordedContext = ad optPtr(new ObjectPaintProperties::LocalBorderBoxProperties);
314 recordedContext->paintOffset = context.paintOffset; 317 recordedContext->paintOffset = context.paintOffset;
315 recordedContext->transform = context.currentTransform; 318 recordedContext->transform = context.currentTransform;
316 recordedContext->clip = context.currentClip; 319 recordedContext->clip = context.currentClip;
317 recordedContext->effect = context.currentEffect; 320 recordedContext->effect = context.currentEffect;
318 return recordedContext.release(); 321 return recordedContext.release();
319 } 322 }
320 323
321 void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTre eBuilderContext& context) 324 static void updatePaintInvalidationContainer(const LayoutObject& object, PaintPr opertyTreeBuilderContext& context)
325 {
326 if (!object.isPaintInvalidationContainer()) {
327 if (context.paintInvalidationContainer)
328 return;
329 ASSERT(object.isLayoutView());
330 }
331
332 context.currentTransform = nullptr;
333 context.paintOffset = LayoutPoint();
334 context.currentClip = nullptr;
335 context.paintInvalidationContainer = &toLayoutBoxModelObject(object);
336
337 if (object.styleRef().isStackingContext() || !context.paintInvalidationConta inerForOutOfFlowPositioned) {
pdr. 2016/03/11 02:56:41 Can you help me understand why this is needed? We
Xianzhu 2016/03/11 20:03:44 This is for SPv1 only in which we need to keep sep
338 // TODO(wangxianzhu): The following may be incorrect for some complex ca ses. Investigate if we could
339 // make it correct for all cases or have to use ForceHorriblySlowRectMap ping.
340 context.transformForAbsolutePosition = nullptr;
341 context.paintOffsetForAbsolutePosition = LayoutPoint();
342 context.clipForAbsolutePosition = nullptr;
343 context.transformForFixedPosition = nullptr;
344 context.paintOffsetForFixedPosition = LayoutPoint();
345 context.clipForFixedPosition = nullptr;
346 context.paintInvalidationContainerForOutOfFlowPositioned = &toLayoutBoxM odelObject(object);
347 }
348 }
349
350 void PaintPropertyTreeBuilder::walk(const LayoutObject& object, const PaintPrope rtyTreeBuilderContext& context, const PaintInvalidationState* parentPaintInvalid ationState)
322 { 351 {
323 PaintPropertyTreeBuilderContext localContext(context); 352 PaintPropertyTreeBuilderContext localContext(context);
353 adjustContainerContextForPosition(object, localContext);
324 354
325 deriveBorderBoxFromContainerContext(object, localContext); 355 Optional<PaintInvalidationState> paintInvalidationState;
326 RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = createPaintOffsetTranslationIfNeeded(object, localContext); 356 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
327 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTran sformIfNeeded(object, localContext); 357 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
328 RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object, localContext); 358 updatePaintInvalidationContainer(object, localContext);
329 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> newRecordedContext = recordTreeContextIfNeeded(object, localContext); 359 paintInvalidationState.emplace(parentPaintInvalidationState, object, *lo calContext.paintInvalidationContainer, localContext.paintOffset);
330 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowCli pIfNeeded(object, localContext); 360 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !object.shouldC heckForPaintInvalidation(*paintInvalidationState))
331 // TODO(trchen): Insert flattening transform here, as specified by 361 return;
332 // http://www.w3.org/TR/css3-transforms/#transform-style-property
333 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = createPe rspectiveIfNeeded(object, localContext);
334 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = cr eateScrollTranslationIfNeeded(object, localContext);
335 updateOutOfFlowContext(object, localContext);
336 362
337 if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransfor m || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForPerspecti ve || newTransformNodeForScrollTranslation || newRecordedContext) { 363 PaintInvalidationReason reason = object.getMutableForPainting().invalida tePaintIfNeeded(*paintInvalidationState, *localContext.paintInvalidationContaine r);
338 OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPaintProper ties::create( 364 object.getMutableForPainting().clearPaintInvalidationState(*paintInvalid ationState);
339 newTransformNodeForPaintOffsetTranslation.release(), 365 if (reason == PaintInvalidationDelayedFull)
340 newTransformNodeForTransform.release(), 366 m_pendingDelayedPaintInvalidations.append(const_cast<LayoutObject*>( &object));
341 newEffectNode.release(),
342 newClipNodeForOverflowClip.release(),
343 newTransformNodeForPerspective.release(),
344 newTransformNodeForScrollTranslation.release(),
345 newRecordedContext.release());
346 object.setObjectPaintProperties(updatedPaintProperties.release());
347 } else {
348 object.clearObjectPaintProperties();
349 } 367 }
350 368
351 for (LayoutObject* child = object.slowFirstChild(); child; child = child->ne xtSibling()) { 369 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() || !object.isPaintInval idationContainer()) {
352 if (child->isBoxModelObject() || child->isSVG()) 370 deriveBorderBoxFromContainerContext(object, localContext);
353 walk(*child, localContext); 371 RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTransla tion = createPaintOffsetTranslationIfNeeded(object, localContext);
372 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = create TransformIfNeeded(object, localContext);
373 RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(obj ect, localContext);
374 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> newRecordedConte xt = recordTreeContextIfNeeded(object, localContext);
375 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflo wClipIfNeeded(object, localContext);
376 // TODO(trchen): Insert flattening transform here, as specified by
377 // http://www.w3.org/TR/css3-transforms/#transform-style-property
378 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = crea tePerspectiveIfNeeded(object, localContext);
379 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = createScrollTranslationIfNeeded(object, localContext);
380 updateOutOfFlowContext(object, localContext);
381
382 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
383 if (newTransformNodeForPaintOffsetTranslation || newTransformNodeFor Transform || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForP erspective || newTransformNodeForScrollTranslation || newRecordedContext) {
384 OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPai ntProperties::create(
385 newTransformNodeForPaintOffsetTranslation.release(),
386 newTransformNodeForTransform.release(),
387 newEffectNode.release(),
388 newClipNodeForOverflowClip.release(),
389 newTransformNodeForPerspective.release(),
390 newTransformNodeForScrollTranslation.release(),
391 newRecordedContext.release());
392 object.getMutableForPainting().setObjectPaintProperties(updatedP aintProperties.release());
393 } else {
394 object.getMutableForPainting().clearObjectPaintProperties();
395 }
396 }
397 }
398
399 for (const LayoutObject* child = object.slowFirstChild(); child; child = chi ld->nextSibling()) {
400 if (child->isBoxModelObject() || child->isSVG()) {
401 walk(*child, localContext, paintInvalidationState.get());
402 } else if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && child->shouldCheckForPaintInvalidation(*paintInvalidationState)) {
403 child->getMutableForPainting().invalidatePaintIfNeeded(*paintInvalid ationState, *localContext.paintInvalidationContainer);
404 child->getMutableForPainting().clearPaintInvalidationState(*paintInv alidationState);
405 }
354 } 406 }
355 407
356 if (object.isLayoutPart()) { 408 if (object.isLayoutPart()) {
357 Widget* widget = toLayoutPart(object).widget(); 409 Widget* widget = toLayoutPart(object).widget();
358 if (widget && widget->isFrameView()) 410 if (widget && widget->isFrameView())
359 walk(*toFrameView(widget), localContext); 411 walk(*toFrameView(widget), localContext, paintInvalidationState.get( ));
360 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). 412 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281).
361 } 413 }
362 } 414 }
363 415
364 } // namespace blink 416 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698