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/layout/svg/LayoutSVGRoot.h" | 12 #include "core/layout/svg/LayoutSVGRoot.h" |
13 #include "core/paint/ObjectPaintProperties.h" | 13 #include "core/paint/ObjectPaintProperties.h" |
14 #include "core/paint/PaintLayer.h" | 14 #include "core/paint/PaintLayer.h" |
15 #include "platform/transforms/TransformationMatrix.h" | 15 #include "platform/transforms/TransformationMatrix.h" |
| 16 #include "wtf/PtrUtil.h" |
| 17 #include <memory> |
16 | 18 |
17 namespace blink { | 19 namespace blink { |
18 | 20 |
19 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) | 21 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) |
20 { | 22 { |
21 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame | 23 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame |
22 // unconditionally create frame translation / clip nodes otherwise. | 24 // unconditionally create frame translation / clip nodes otherwise. |
23 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { | 25 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { |
24 transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(
), FloatPoint3D(), nullptr); | 26 transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(
), FloatPoint3D(), nullptr); |
25 context.currentTransform = context.transformForAbsolutePosition = contex
t.transformForFixedPosition = transformRoot.get(); | 27 context.currentTransform = context.transformForAbsolutePosition = contex
t.transformForFixedPosition = transformRoot.get(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip
Node.release()); | 159 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip
Node.release()); |
158 } | 160 } |
159 | 161 |
160 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o
bject, const PaintPropertyTreeBuilderContext& context) | 162 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o
bject, const PaintPropertyTreeBuilderContext& context) |
161 { | 163 { |
162 // Note: Currently only layer painter makes use of the pre-computed context. | 164 // Note: Currently only layer painter makes use of the pre-computed context. |
163 // This condition may be loosened with no adverse effects beside memory use. | 165 // This condition may be loosened with no adverse effects beside memory use. |
164 if (!object.hasLayer()) | 166 if (!object.hasLayer()) |
165 return; | 167 return; |
166 | 168 |
167 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxContext = | 169 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo
ntext = |
168 adoptPtr(new ObjectPaintProperties::LocalBorderBoxProperties); | 170 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); |
169 borderBoxContext->paintOffset = context.paintOffset; | 171 borderBoxContext->paintOffset = context.paintOffset; |
170 borderBoxContext->transform = context.currentTransform; | 172 borderBoxContext->transform = context.currentTransform; |
171 borderBoxContext->clip = context.currentClip; | 173 borderBoxContext->clip = context.currentClip; |
172 borderBoxContext->effect = context.currentEffect; | 174 borderBoxContext->effect = context.currentEffect; |
173 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB
oxProperties(std::move(borderBoxContext)); | 175 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB
oxProperties(std::move(borderBoxContext)); |
174 } | 176 } |
175 | 177 |
176 // TODO(trchen): Remove this once we bake the paint offset into frameRect. | 178 // TODO(trchen): Remove this once we bake the paint offset into frameRect. |
177 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob
ject, const PaintPropertyTreeBuilderContext& context) | 179 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob
ject, const PaintPropertyTreeBuilderContext& context) |
178 { | 180 { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 updateOverflowClip(object, context); | 399 updateOverflowClip(object, context); |
398 // TODO(trchen): Insert flattening transform here, as specified by | 400 // TODO(trchen): Insert flattening transform here, as specified by |
399 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 401 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
400 updatePerspective(object, context); | 402 updatePerspective(object, context); |
401 updateSvgLocalToBorderBoxTransform(object, context); | 403 updateSvgLocalToBorderBoxTransform(object, context); |
402 updateScrollTranslation(object, context); | 404 updateScrollTranslation(object, context); |
403 updateOutOfFlowContext(object, context); | 405 updateOutOfFlowContext(object, context); |
404 } | 406 } |
405 | 407 |
406 } // namespace blink | 408 } // namespace blink |
OLD | NEW |