| 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 "core/paint/SVGRootPainter.h" |
| 15 #include "platform/transforms/TransformationMatrix.h" | 16 #include "platform/transforms/TransformationMatrix.h" |
| 16 #include "wtf/PtrUtil.h" | 17 #include "wtf/PtrUtil.h" |
| 17 #include <memory> | 18 #include <memory> |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 | 21 |
| 21 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) | 22 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) |
| 22 { | 23 { |
| 23 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame | 24 // 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. | 25 // unconditionally create frame translation / clip nodes otherwise. |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 context.currentTransform); | 255 context.currentTransform); |
| 255 context.currentTransform = perspective.get(); | 256 context.currentTransform = perspective.get(); |
| 256 object.getMutableForPainting().ensureObjectPaintProperties().setPerspective(
perspective.release()); | 257 object.getMutableForPainting().ensureObjectPaintProperties().setPerspective(
perspective.release()); |
| 257 } | 258 } |
| 258 | 259 |
| 259 void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(const LayoutOb
ject& object, PaintPropertyTreeBuilderContext& context) | 260 void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(const LayoutOb
ject& object, PaintPropertyTreeBuilderContext& context) |
| 260 { | 261 { |
| 261 if (!object.isSVGRoot()) | 262 if (!object.isSVGRoot()) |
| 262 return; | 263 return; |
| 263 | 264 |
| 264 AffineTransform transform = AffineTransform::translation(context.paintOffset
.x().toFloat(), context.paintOffset.y().toFloat()); | 265 AffineTransform snappedPaintOffsetToBorderBox = SVGRootPainter(toLayoutSVGRo
ot(object)).snappedPaintOffsetToBorderBox(context.paintOffset); |
| 265 transform *= toLayoutSVGRoot(object).localToBorderBoxTransform(); | 266 if (snappedPaintOffsetToBorderBox.isIdentity()) |
| 266 if (transform.isIdentity()) | |
| 267 return; | 267 return; |
| 268 | 268 |
| 269 RefPtr<TransformPaintPropertyNode> svgLocalToBorderBoxTransform = TransformP
aintPropertyNode::create( | 269 RefPtr<TransformPaintPropertyNode> svgLocalToBorderBoxTransform = TransformP
aintPropertyNode::create( |
| 270 transform, FloatPoint3D(0, 0, 0), context.currentTransform); | 270 snappedPaintOffsetToBorderBox, FloatPoint3D(0, 0, 0), context.currentTra
nsform); |
| 271 context.currentTransform = svgLocalToBorderBoxTransform.get(); | 271 context.currentTransform = svgLocalToBorderBoxTransform.get(); |
| 272 context.paintOffset = LayoutPoint(); | 272 context.paintOffset = LayoutPoint(); |
| 273 object.getMutableForPainting().ensureObjectPaintProperties().setSvgLocalToBo
rderBoxTransform(svgLocalToBorderBoxTransform.release()); | 273 object.getMutableForPainting().ensureObjectPaintProperties().setSvgLocalToBo
rderBoxTransform(svgLocalToBorderBoxTransform.release()); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec
t, PaintPropertyTreeBuilderContext& context) | 276 void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec
t, PaintPropertyTreeBuilderContext& context) |
| 277 { | 277 { |
| 278 if (!object.isBoxModelObject() || !object.hasOverflowClip()) | 278 if (!object.isBoxModelObject() || !object.hasOverflowClip()) |
| 279 return; | 279 return; |
| 280 | 280 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 updateOverflowClip(object, context); | 403 updateOverflowClip(object, context); |
| 404 // TODO(trchen): Insert flattening transform here, as specified by | 404 // TODO(trchen): Insert flattening transform here, as specified by |
| 405 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 405 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
| 406 updatePerspective(object, context); | 406 updatePerspective(object, context); |
| 407 updateSvgLocalToBorderBoxTransform(object, context); | 407 updateSvgLocalToBorderBoxTransform(object, context); |
| 408 updateScrollTranslation(object, context); | 408 updateScrollTranslation(object, context); |
| 409 updateOutOfFlowContext(object, context); | 409 updateOutOfFlowContext(object, context); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace blink | 412 } // namespace blink |
| OLD | NEW |