| 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 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderRootContext& rootContext) | 18 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro
pertyTreeBuilderContext& context) |
| 19 { | 19 { |
| 20 // Only create extra root clip and transform nodes when RLS is enabled, beca
use the main frame | 20 // 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. | 21 // unconditionally create frame translation / clip nodes otherwise. |
| 22 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { | 22 if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerS
crolls()) { |
| 23 rootContext.transformRoot = TransformPaintPropertyNode::create(Transform
ationMatrix(), FloatPoint3D(), nullptr); | 23 transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(
), FloatPoint3D(), nullptr); |
| 24 rootContext.currentTransform = rootContext.transformForAbsolutePosition
= rootContext.transformForFixedPosition = rootContext.transformRoot.get(); | 24 context.currentTransform = context.transformForAbsolutePosition = contex
t.transformForFixedPosition = transformRoot.get(); |
| 25 | 25 |
| 26 rootContext.clipRoot = ClipPaintPropertyNode::create(rootContext.transfo
rmRoot, FloatRoundedRect(LayoutRect::infiniteIntRect()), nullptr); | 26 clipRoot = ClipPaintPropertyNode::create(transformRoot, FloatRoundedRect
(LayoutRect::infiniteIntRect()), nullptr); |
| 27 rootContext.currentClip = rootContext.clipForAbsolutePosition = rootCont
ext.clipForFixedPosition = rootContext.clipRoot.get(); | 27 context.currentClip = context.clipForAbsolutePosition = context.clipForF
ixedPosition = clipRoot.get(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // The root frame never creates effect node so we unconditionally create a r
oot node here. | 30 // The root frame never creates effect node so we unconditionally create a r
oot node here. |
| 31 rootContext.effectRoot = EffectPaintPropertyNode::create(1.0, nullptr); | 31 effectRoot = EffectPaintPropertyNode::create(1.0, nullptr); |
| 32 rootContext.currentEffect = rootContext.effectRoot.get(); | 32 context.currentEffect = effectRoot.get(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
yTreeBuilderContext& context) | 35 void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
yTreeBuilderContext& context) |
| 36 { | 36 { |
| 37 // TODO(pdr): Creating paint properties for FrameView here will not be | 37 // TODO(pdr): Creating paint properties for FrameView here will not be |
| 38 // needed once settings()->rootLayerScrolls() is enabled. | 38 // needed once settings()->rootLayerScrolls() is enabled. |
| 39 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. | 39 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. |
| 40 | 40 |
| 41 TransformationMatrix frameTranslate; | 41 TransformationMatrix frameTranslate; |
| 42 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView.
y() + context.paintOffset.y()); | 42 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView.
y() + context.paintOffset.y()); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 if (boxModelObject.isTableCell()) { | 352 if (boxModelObject.isTableCell()) { |
| 353 LayoutObject* parentRow = boxModelObject.parent(); | 353 LayoutObject* parentRow = boxModelObject.parent(); |
| 354 ASSERT(parentRow && parentRow->isTableRow()); | 354 ASSERT(parentRow && parentRow->isTableRow()); |
| 355 context.paintOffset -= toLayoutBox(parentRow)->locationOffset(); | 355 context.paintOffset -= toLayoutBox(parentRow)->locationOffset(); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP
ropertyTreeBuilderContext& context) | 360 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP
ropertyTreeBuilderContext& context) |
| 361 { | 361 { |
| 362 if (!object.isBoxModelObject() && !object.isSVG()) |
| 363 return; |
| 364 |
| 362 object.getMutableForPainting().clearObjectPaintProperties(); | 365 object.getMutableForPainting().clearObjectPaintProperties(); |
| 363 | 366 |
| 364 deriveBorderBoxFromContainerContext(object, context); | 367 deriveBorderBoxFromContainerContext(object, context); |
| 365 | 368 |
| 366 updatePaintOffsetTranslation(object, context); | 369 updatePaintOffsetTranslation(object, context); |
| 367 updateTransform(object, context); | 370 updateTransform(object, context); |
| 368 updateEffect(object, context); | 371 updateEffect(object, context); |
| 369 updateCssClip(object, context); | 372 updateCssClip(object, context); |
| 370 updateLocalBorderBoxContext(object, context); | 373 updateLocalBorderBoxContext(object, context); |
| 371 updateScrollbarPaintOffset(object, context); | 374 updateScrollbarPaintOffset(object, context); |
| 372 updateOverflowClip(object, context); | 375 updateOverflowClip(object, context); |
| 373 // TODO(trchen): Insert flattening transform here, as specified by | 376 // TODO(trchen): Insert flattening transform here, as specified by |
| 374 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 377 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
| 375 updatePerspective(object, context); | 378 updatePerspective(object, context); |
| 376 updateSvgLocalTransform(object, context); | 379 updateSvgLocalTransform(object, context); |
| 377 updateScrollTranslation(object, context); | 380 updateScrollTranslation(object, context); |
| 378 updateOutOfFlowContext(object, context); | 381 updateOutOfFlowContext(object, context); |
| 379 } | 382 } |
| 380 | 383 |
| 381 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |