| 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" |
| 11 #include "core/layout/LayoutPart.h" | 11 #include "core/layout/LayoutPart.h" |
| 12 #include "core/paint/ObjectPaintProperties.h" | 12 #include "core/paint/ObjectPaintProperties.h" |
| 13 #include "core/paint/PaintLayer.h" | 13 #include "core/paint/PaintLayer.h" |
| 14 #include "platform/transforms/TransformationMatrix.h" | 14 #include "platform/transforms/TransformationMatrix.h" |
| 15 #include "wtf/PtrUtil.h" |
| 16 #include <memory> |
| 15 | 17 |
| 16 namespace blink { | 18 namespace blink { |
| 17 | 19 |
| 18 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) | 20 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) |
| 19 { | 21 { |
| 20 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame | 22 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame |
| 21 // unconditionally create frame translation / clip nodes otherwise. | 23 // unconditionally create frame translation / clip nodes otherwise. |
| 22 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { | 24 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { |
| 23 transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(
), FloatPoint3D(), nullptr); | 25 transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(
), FloatPoint3D(), nullptr); |
| 24 context.currentTransform = context.transformForAbsolutePosition = contex
t.transformForFixedPosition = transformRoot.get(); | 26 context.currentTransform = context.transformForAbsolutePosition = contex
t.transformForFixedPosition = transformRoot.get(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip
Node.release()); | 141 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip
Node.release()); |
| 140 } | 142 } |
| 141 | 143 |
| 142 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o
bject, const PaintPropertyTreeBuilderContext& context) | 144 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o
bject, const PaintPropertyTreeBuilderContext& context) |
| 143 { | 145 { |
| 144 // Note: Currently only layer painter makes use of the pre-computed context. | 146 // Note: Currently only layer painter makes use of the pre-computed context. |
| 145 // This condition may be loosened with no adverse effects beside memory use. | 147 // This condition may be loosened with no adverse effects beside memory use. |
| 146 if (!object.hasLayer()) | 148 if (!object.hasLayer()) |
| 147 return; | 149 return; |
| 148 | 150 |
| 149 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxContext = | 151 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo
ntext = |
| 150 adoptPtr(new ObjectPaintProperties::LocalBorderBoxProperties); | 152 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); |
| 151 borderBoxContext->paintOffset = context.paintOffset; | 153 borderBoxContext->paintOffset = context.paintOffset; |
| 152 borderBoxContext->transform = context.currentTransform; | 154 borderBoxContext->transform = context.currentTransform; |
| 153 borderBoxContext->clip = context.currentClip; | 155 borderBoxContext->clip = context.currentClip; |
| 154 borderBoxContext->effect = context.currentEffect; | 156 borderBoxContext->effect = context.currentEffect; |
| 155 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB
oxProperties(std::move(borderBoxContext)); | 157 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB
oxProperties(std::move(borderBoxContext)); |
| 156 } | 158 } |
| 157 | 159 |
| 158 // TODO(trchen): Remove this once we bake the paint offset into frameRect. | 160 // TODO(trchen): Remove this once we bake the paint offset into frameRect. |
| 159 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob
ject, const PaintPropertyTreeBuilderContext& context) | 161 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob
ject, const PaintPropertyTreeBuilderContext& context) |
| 160 { | 162 { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 updateOverflowClip(object, context); | 380 updateOverflowClip(object, context); |
| 379 // TODO(trchen): Insert flattening transform here, as specified by | 381 // TODO(trchen): Insert flattening transform here, as specified by |
| 380 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 382 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
| 381 updatePerspective(object, context); | 383 updatePerspective(object, context); |
| 382 updateSvgLocalTransform(object, context); | 384 updateSvgLocalTransform(object, context); |
| 383 updateScrollTranslation(object, context); | 385 updateScrollTranslation(object, context); |
| 384 updateOutOfFlowContext(object, context); | 386 updateOutOfFlowContext(object, context); |
| 385 } | 387 } |
| 386 | 388 |
| 387 } // namespace blink | 389 } // namespace blink |
| OLD | NEW |