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

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

Issue 1651153003: [SPv2] Adds pre-computed paint property context to PaintLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/ObjectPaintProperties.h" 9 #include "core/paint/ObjectPaintProperties.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 context.clipForOutOfFlowPositioned = context.currentClip; 303 context.clipForOutOfFlowPositioned = context.currentClip;
304 } 304 }
305 305
306 if (createdNewTransform || object.isSVGRoot()) { 306 if (createdNewTransform || object.isSVGRoot()) {
307 context.transformForFixedPositioned = context.currentTransform; 307 context.transformForFixedPositioned = context.currentTransform;
308 context.paintOffsetForFixedPositioned = context.paintOffset; 308 context.paintOffsetForFixedPositioned = context.paintOffset;
309 context.clipForFixedPositioned = context.currentClip; 309 context.clipForFixedPositioned = context.currentClip;
310 } 310 }
311 } 311 }
312 312
313 void cachePropertyIfPaintLayerPresents(LayoutObject& object, const PaintProperty TreeBuilderContext& context)
pdr. 2016/02/02 06:18:20 Nit: cachePropertyIfPaintLayerPresent (because "if
trchen 2016/02/02 21:48:53 Acknowledged.
314 {
315 if (!object.hasLayer())
316 return;
317 ASSERT(object.isBoxModelObject());
318 PaintLayerRareData::CachedSPv2PaintParameters &cachedParameters = toLayoutBo xModelObject(object).layer()->accessCachedSPv2PaintParameters();
319 cachedParameters.paintOffset = context.paintOffset;
320 cachedParameters.properties.transform = context.currentTransform;
321 cachedParameters.properties.clip = context.currentClip;
322 cachedParameters.properties.effect = context.currentEffect;
323 }
324
313 void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTre eBuilderContext& context) 325 void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTre eBuilderContext& context)
314 { 326 {
315 PaintPropertyTreeBuilderContext localContext(context); 327 PaintPropertyTreeBuilderContext localContext(context);
316 328
317 deriveBorderBoxFromContainerContext(object, localContext); 329 deriveBorderBoxFromContainerContext(object, localContext);
318 RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = createPaintOffsetTranslationIfNeeded(object, localContext); 330 RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = createPaintOffsetTranslationIfNeeded(object, localContext);
319 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTran sformIfNeeded(object, localContext); 331 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTran sformIfNeeded(object, localContext);
320 RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object, localContext); 332 RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object, localContext);
333 cachePropertyIfPaintLayerPresents(object, localContext);
pdr. 2016/02/02 06:18:20 I think what you're trying to do here is to store
trchen 2016/02/02 21:48:53 Essentially it is the state for painting the stack
321 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowCli pIfNeeded(object, localContext); 334 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowCli pIfNeeded(object, localContext);
pdr. 2016/02/02 06:18:20 This creates clips for both border radius and over
trchen 2016/02/02 21:48:53 See comments above. Border radius clip on normal f
322 // TODO(trchen): Insert flattening transform here, as specified by 335 // TODO(trchen): Insert flattening transform here, as specified by
323 // http://www.w3.org/TR/css3-transforms/#transform-style-property 336 // http://www.w3.org/TR/css3-transforms/#transform-style-property
324 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = createPe rspectiveIfNeeded(object, localContext); 337 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = createPe rspectiveIfNeeded(object, localContext);
325 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = cr eateScrollTranslationIfNeeded(object, localContext); 338 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = cr eateScrollTranslationIfNeeded(object, localContext);
326 updateOutOfFlowContext(object, newTransformNodeForTransform, localContext); 339 updateOutOfFlowContext(object, newTransformNodeForTransform, localContext);
327 340
328 if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransfor m || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForPerspecti ve || newTransformNodeForScrollTranslation) { 341 if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransfor m || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForPerspecti ve || newTransformNodeForScrollTranslation) {
329 OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPaintProper ties::create( 342 OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPaintProper ties::create(
330 newTransformNodeForPaintOffsetTranslation.release(), 343 newTransformNodeForPaintOffsetTranslation.release(),
331 newTransformNodeForTransform.release(), 344 newTransformNodeForTransform.release(),
332 newEffectNode.release(), 345 newEffectNode.release(),
333 newClipNodeForOverflowClip.release(), 346 newClipNodeForOverflowClip.release(),
334 newTransformNodeForPerspective.release(), 347 newTransformNodeForPerspective.release(),
335 newTransformNodeForScrollTranslation.release()); 348 newTransformNodeForScrollTranslation.release());
336 object.setObjectPaintProperties(updatedPaintProperties.release()); 349 object.setObjectPaintProperties(updatedPaintProperties.release());
337 } else { 350 } else {
338 object.clearObjectPaintProperties(); 351 object.clearObjectPaintProperties();
339 } 352 }
340 353
341 for (LayoutObject* child = object.slowFirstChild(); child; child = child->ne xtSibling()) { 354 for (LayoutObject* child = object.slowFirstChild(); child; child = child->ne xtSibling()) {
342 if (child->isBoxModelObject() || child->isSVG()) 355 if (child->isBoxModelObject() || child->isSVG())
343 walk(*child, localContext); 356 walk(*child, localContext);
344 } 357 }
345 } 358 }
346 359
347 } // namespace blink 360 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698