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 "core/paint/SVGRootPainter.h" |
16 #include "platform/transforms/TransformationMatrix.h" | 16 #include "platform/transforms/TransformationMatrix.h" |
17 #include "wtf/PtrUtil.h" | 17 #include "wtf/PtrUtil.h" |
18 #include <memory> | 18 #include <memory> |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) | 22 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) |
23 { | 23 { |
24 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame | 24 RefPtr<TransformPaintPropertyNode> transformRoot = TransformPaintPropertyNod
e::create(TransformationMatrix(), FloatPoint3D(), nullptr); |
25 // unconditionally create frame translation / clip nodes otherwise. | 25 context.currentTransform = context.transformForAbsolutePosition = context.tr
ansformForFixedPosition = transformRoot.get(); |
26 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { | 26 rootFrame.setRootTransform(std::move(transformRoot)); |
27 transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(
), FloatPoint3D(), nullptr); | |
28 context.currentTransform = context.transformForAbsolutePosition = contex
t.transformForFixedPosition = transformRoot.get(); | |
29 | 27 |
30 clipRoot = ClipPaintPropertyNode::create(transformRoot, FloatRoundedRect
(LayoutRect::infiniteIntRect()), nullptr); | 28 RefPtr<ClipPaintPropertyNode> clipRoot = ClipPaintPropertyNode::create(trans
formRoot, FloatRoundedRect(LayoutRect::infiniteIntRect()), nullptr); |
31 context.currentClip = context.clipForAbsolutePosition = context.clipForF
ixedPosition = clipRoot.get(); | 29 context.currentClip = context.clipForAbsolutePosition = context.clipForFixed
Position = clipRoot.get(); |
32 } | 30 rootFrame.setRootClip(std::move(clipRoot)); |
33 | 31 |
34 // The root frame never creates effect node so we unconditionally create a r
oot node here. | 32 RefPtr<EffectPaintPropertyNode> effectRoot = EffectPaintPropertyNode::create
(1.0, nullptr); |
35 effectRoot = EffectPaintPropertyNode::create(1.0, nullptr); | |
36 context.currentEffect = effectRoot.get(); | 33 context.currentEffect = effectRoot.get(); |
| 34 rootFrame.setRootEffect(std::move(effectRoot)); |
37 } | 35 } |
38 | 36 |
39 void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
yTreeBuilderContext& context) | 37 void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
yTreeBuilderContext& context) |
40 { | 38 { |
41 // TODO(pdr): Creating paint properties for FrameView here will not be | 39 // TODO(pdr): Creating paint properties for FrameView here will not be |
42 // needed once settings()->rootLayerScrolls() is enabled. | 40 // needed once settings()->rootLayerScrolls() is enabled. |
43 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. | 41 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. |
44 | 42 |
45 TransformationMatrix frameTranslate; | 43 TransformationMatrix frameTranslate; |
46 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView.
y() + context.paintOffset.y()); | 44 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView.
y() + context.paintOffset.y()); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 updateOverflowClip(object, context); | 406 updateOverflowClip(object, context); |
409 // TODO(trchen): Insert flattening transform here, as specified by | 407 // TODO(trchen): Insert flattening transform here, as specified by |
410 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 408 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
411 updatePerspective(object, context); | 409 updatePerspective(object, context); |
412 updateSvgLocalToBorderBoxTransform(object, context); | 410 updateSvgLocalToBorderBoxTransform(object, context); |
413 updateScrollTranslation(object, context); | 411 updateScrollTranslation(object, context); |
414 updateOutOfFlowContext(object, context); | 412 updateOutOfFlowContext(object, context); |
415 } | 413 } |
416 | 414 |
417 } // namespace blink | 415 } // namespace blink |
OLD | NEW |