Chromium Code Reviews| 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/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create( | 155 RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create( |
| 156 context.currentTransform, | 156 context.currentTransform, |
| 157 FloatRoundedRect(FloatRect(clipRect)), | 157 FloatRoundedRect(FloatRect(clipRect)), |
| 158 context.currentClip); | 158 context.currentClip); |
| 159 context.currentClip = clipNode.get(); | 159 context.currentClip = clipNode.get(); |
| 160 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip Node.release()); | 160 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip Node.release()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o bject, const PaintPropertyTreeBuilderContext& context) | 163 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o bject, const PaintPropertyTreeBuilderContext& context) |
| 164 { | 164 { |
| 165 // Note: Currently only layer painter makes use of the pre-computed context. | |
| 166 // This condition may be loosened with no adverse effects beside memory use. | |
| 167 if (!object.hasLayer()) | |
| 168 return; | |
| 169 | |
| 170 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo ntext = | 165 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo ntext = |
| 171 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); | 166 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); |
| 172 borderBoxContext->paintOffset = context.paintOffset; | 167 borderBoxContext->paintOffset = context.paintOffset; |
| 173 borderBoxContext->transform = context.currentTransform; | 168 borderBoxContext->propertyTreeState = PropertyTreeState(context.currentTrans form, context.currentClip, context.currentEffect); |
| 174 borderBoxContext->clip = context.currentClip; | |
| 175 borderBoxContext->effect = context.currentEffect; | |
| 176 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB oxProperties(std::move(borderBoxContext)); | 169 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB oxProperties(std::move(borderBoxContext)); |
| 177 } | 170 } |
| 178 | 171 |
| 179 // TODO(trchen): Remove this once we bake the paint offset into frameRect. | 172 // TODO(trchen): Remove this once we bake the paint offset into frameRect. |
| 180 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob ject, const PaintPropertyTreeBuilderContext& context) | 173 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob ject, const PaintPropertyTreeBuilderContext& context) |
| 181 { | 174 { |
| 182 IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset); | 175 IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset); |
| 183 if (roundedPaintOffset == IntPoint()) | 176 if (roundedPaintOffset == IntPoint()) |
| 184 return; | 177 return; |
| 185 | 178 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 if (boxModelObject.isTableCell()) { | 370 if (boxModelObject.isTableCell()) { |
| 378 LayoutObject* parentRow = boxModelObject.parent(); | 371 LayoutObject* parentRow = boxModelObject.parent(); |
| 379 ASSERT(parentRow && parentRow->isTableRow()); | 372 ASSERT(parentRow && parentRow->isTableRow()); |
| 380 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation( )); | 373 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation( )); |
| 381 } | 374 } |
| 382 } | 375 } |
| 383 } | 376 } |
| 384 | 377 |
| 385 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context) | 378 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context) |
| 386 { | 379 { |
| 380 object.getMutableForPainting().clearObjectPaintProperties(); | |
|
chrishtr
2016/06/30 16:49:55
Now allocating an ObjectPaintProperties object for
pdr.
2016/06/30 21:21:50
To enforce this and ensure we don't create too man
chrishtr
2016/07/01 17:52:24
Done (in updateLocalBorderBoxContext)
| |
| 381 | |
| 387 if (!object.isBoxModelObject() && !object.isSVG()) | 382 if (!object.isBoxModelObject() && !object.isSVG()) |
| 388 return; | 383 return; |
| 389 | 384 |
| 390 object.getMutableForPainting().clearObjectPaintProperties(); | |
| 391 | |
| 392 deriveBorderBoxFromContainerContext(object, context); | 385 deriveBorderBoxFromContainerContext(object, context); |
| 393 | 386 |
| 394 updatePaintOffsetTranslation(object, context); | 387 updatePaintOffsetTranslation(object, context); |
| 395 updateTransform(object, context); | 388 updateTransform(object, context); |
| 396 updateEffect(object, context); | 389 updateEffect(object, context); |
| 397 updateCssClip(object, context); | 390 updateCssClip(object, context); |
| 398 updateLocalBorderBoxContext(object, context); | 391 updateLocalBorderBoxContext(object, context); |
| 399 updateScrollbarPaintOffset(object, context); | 392 updateScrollbarPaintOffset(object, context); |
| 400 updateOverflowClip(object, context); | 393 updateOverflowClip(object, context); |
| 401 // TODO(trchen): Insert flattening transform here, as specified by | 394 // TODO(trchen): Insert flattening transform here, as specified by |
| 402 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 395 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
| 403 updatePerspective(object, context); | 396 updatePerspective(object, context); |
| 404 updateSvgLocalToBorderBoxTransform(object, context); | 397 updateSvgLocalToBorderBoxTransform(object, context); |
| 405 updateScrollTranslation(object, context); | 398 updateScrollTranslation(object, context); |
| 406 updateOutOfFlowContext(object, context); | 399 updateOutOfFlowContext(object, context); |
| 407 } | 400 } |
| 408 | 401 |
| 409 } // namespace blink | 402 } // namespace blink |
| OLD | NEW |