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