Chromium Code Reviews| 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 namespace { | |
| 23 | |
| 24 // Creates a transform node which uses the current rendering context ID and | |
| 25 // flattening behavior from the tree builder context. | |
| 26 PassRefPtr<TransformPaintPropertyNode> createTransformNode( | |
| 27 const PaintPropertyTreeBuilderContext& context, | |
| 28 const TransformationMatrix& matrix, | |
| 29 const FloatPoint3D& origin, | |
| 30 PassRefPtr<TransformPaintPropertyNode> parent) | |
| 31 { | |
| 32 return TransformPaintPropertyNode::create( | |
| 33 matrix, origin, parent, | |
| 34 context.current.shouldFlattenInheritedTransform, | |
| 35 context.current.renderingContextID); | |
| 36 } | |
| 37 | |
| 38 } // namespace | |
| 39 | |
| 22 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro pertyTreeBuilderContext& context) | 40 void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro pertyTreeBuilderContext& context) |
| 23 { | 41 { |
| 24 RefPtr<TransformPaintPropertyNode> transformRoot = TransformPaintPropertyNod e::create(TransformationMatrix(), FloatPoint3D(), nullptr); | 42 RefPtr<TransformPaintPropertyNode> transformRoot = TransformPaintPropertyNod e::create(TransformationMatrix(), FloatPoint3D(), nullptr, true); |
| 25 context.current.transform = context.absolutePosition.transform = context.fix edPosition.transform = transformRoot.get(); | 43 context.current.transform = context.absolutePosition.transform = context.fix edPosition.transform = transformRoot.get(); |
| 26 rootFrame.setRootTransform(std::move(transformRoot)); | 44 rootFrame.setRootTransform(std::move(transformRoot)); |
| 27 | 45 |
| 28 RefPtr<ClipPaintPropertyNode> clipRoot = ClipPaintPropertyNode::create(trans formRoot, FloatRoundedRect(LayoutRect::infiniteIntRect()), nullptr); | 46 RefPtr<ClipPaintPropertyNode> clipRoot = ClipPaintPropertyNode::create(trans formRoot, FloatRoundedRect(LayoutRect::infiniteIntRect()), nullptr); |
| 29 context.current.clip = context.absolutePosition.clip = context.fixedPosition .clip = clipRoot.get(); | 47 context.current.clip = context.absolutePosition.clip = context.fixedPosition .clip = clipRoot.get(); |
| 30 rootFrame.setRootClip(std::move(clipRoot)); | 48 rootFrame.setRootClip(std::move(clipRoot)); |
| 31 | 49 |
| 32 RefPtr<EffectPaintPropertyNode> effectRoot = EffectPaintPropertyNode::create (1.0, nullptr); | 50 RefPtr<EffectPaintPropertyNode> effectRoot = EffectPaintPropertyNode::create (1.0, nullptr); |
| 33 context.currentEffect = effectRoot.get(); | 51 context.currentEffect = effectRoot.get(); |
| 34 rootFrame.setRootEffect(std::move(effectRoot)); | 52 rootFrame.setRootEffect(std::move(effectRoot)); |
| 35 } | 53 } |
| 36 | 54 |
| 37 void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert yTreeBuilderContext& context) | 55 void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert yTreeBuilderContext& context) |
| 38 { | 56 { |
| 39 // TODO(pdr): Creating paint properties for FrameView here will not be | 57 // TODO(pdr): Creating paint properties for FrameView here will not be |
| 40 // needed once settings()->rootLayerScrolls() is enabled. | 58 // needed once settings()->rootLayerScrolls() is enabled. |
| 41 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. | 59 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. |
| 42 | 60 |
| 43 TransformationMatrix frameTranslate; | 61 TransformationMatrix frameTranslate; |
| 44 frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), fr ameView.y() + context.current.paintOffset.y()); | 62 frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), fr ameView.y() + context.current.paintOffset.y()); |
| 45 RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = Trans formPaintPropertyNode::create(frameTranslate, FloatPoint3D(), context.current.tr ansform); | 63 RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = creat eTransformNode(context, frameTranslate, FloatPoint3D(), context.current.transfor m); |
| 46 | 64 |
| 47 FloatRoundedRect contentClip(IntRect(IntPoint(), frameView.visibleContentSiz e())); | 65 FloatRoundedRect contentClip(IntRect(IntPoint(), frameView.visibleContentSiz e())); |
| 48 RefPtr<ClipPaintPropertyNode> newClipNodeForContentClip = ClipPaintPropertyN ode::create(newTransformNodeForPreTranslation.get(), contentClip, context.curren t.clip); | 66 RefPtr<ClipPaintPropertyNode> newClipNodeForContentClip = ClipPaintPropertyN ode::create(newTransformNodeForPreTranslation.get(), contentClip, context.curren t.clip); |
| 49 | 67 |
| 50 DoubleSize scrollOffset = frameView.scrollOffsetDouble(); | 68 DoubleSize scrollOffset = frameView.scrollOffsetDouble(); |
| 51 TransformationMatrix frameScroll; | 69 TransformationMatrix frameScroll; |
| 52 frameScroll.translate(-scrollOffset.width(), -scrollOffset.height()); | 70 frameScroll.translate(-scrollOffset.width(), -scrollOffset.height()); |
| 53 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = Tr ansformPaintPropertyNode::create(frameScroll, FloatPoint3D(), newTransformNodeFo rPreTranslation); | 71 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = Tr ansformPaintPropertyNode::create(frameScroll, FloatPoint3D(), newTransformNodeFo rPreTranslation); |
| 54 | 72 |
| 55 // Initialize the context for current, absolute and fixed position cases. | 73 // Initialize the context for current, absolute and fixed position cases. |
| 56 // They are the same, except that scroll translation does not apply to | 74 // They are the same, except that scroll translation does not apply to |
| 57 // fixed position descendants. | 75 // fixed position descendants. |
| 58 context.current.transform = newTransformNodeForScrollTranslation.get(); | 76 context.current.transform = newTransformNodeForScrollTranslation.get(); |
| 59 context.current.paintOffset = LayoutPoint(); | 77 context.current.paintOffset = LayoutPoint(); |
| 60 context.current.clip = newClipNodeForContentClip.get(); | 78 context.current.clip = newClipNodeForContentClip.get(); |
| 79 context.current.renderingContextID = 0; | |
| 80 context.current.shouldFlattenInheritedTransform = true; | |
| 61 context.absolutePosition = context.current; | 81 context.absolutePosition = context.current; |
| 62 context.containerForAbsolutePosition = nullptr; | 82 context.containerForAbsolutePosition = nullptr; |
| 63 context.fixedPosition = context.current; | 83 context.fixedPosition = context.current; |
| 64 context.fixedPosition.transform = newTransformNodeForPreTranslation.get(); | 84 context.fixedPosition.transform = newTransformNodeForPreTranslation.get(); |
| 65 | 85 |
| 66 frameView.setPreTranslation(newTransformNodeForPreTranslation.release()); | 86 frameView.setPreTranslation(newTransformNodeForPreTranslation.release()); |
| 67 frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release( )); | 87 frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release( )); |
| 68 frameView.setContentClip(newClipNodeForContentClip.release()); | 88 frameView.setContentClip(newClipNodeForContentClip.release()); |
| 69 } | 89 } |
| 70 | 90 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 81 return; | 101 return; |
| 82 | 102 |
| 83 // We should use the same subpixel paint offset values for snapping regardle ss of whether a | 103 // We should use the same subpixel paint offset values for snapping regardle ss of whether a |
| 84 // transform is present. If there is a transform we round the paint offset b ut keep around | 104 // transform is present. If there is a transform we round the paint offset b ut keep around |
| 85 // the residual fractional component for the transformed content to paint wi th. | 105 // the residual fractional component for the transformed content to paint wi th. |
| 86 // In spv1 this was called "subpixel accumulation". For more information, se e | 106 // In spv1 this was called "subpixel accumulation". For more information, se e |
| 87 // PaintLayer::subpixelAccumulation() and PaintLayerPainter::paintFragmentBy ApplyingTransform. | 107 // PaintLayer::subpixelAccumulation() and PaintLayerPainter::paintFragmentBy ApplyingTransform. |
| 88 IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); | 108 IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); |
| 89 LayoutPoint fractionalPaintOffset = LayoutPoint(context.current.paintOffset - roundedPaintOffset); | 109 LayoutPoint fractionalPaintOffset = LayoutPoint(context.current.paintOffset - roundedPaintOffset); |
| 90 | 110 |
| 91 RefPtr<TransformPaintPropertyNode> paintOffsetTranslation = TransformPaintPr opertyNode::create( | 111 RefPtr<TransformPaintPropertyNode> paintOffsetTranslation = createTransformN ode( |
| 112 context, | |
| 92 TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOff set.y()), | 113 TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOff set.y()), |
| 93 FloatPoint3D(), context.current.transform); | 114 FloatPoint3D(), context.current.transform); |
| 94 context.current.transform = paintOffsetTranslation.get(); | 115 context.current.transform = paintOffsetTranslation.get(); |
| 95 context.current.paintOffset = fractionalPaintOffset; | 116 context.current.paintOffset = fractionalPaintOffset; |
| 117 context.current.shouldFlattenInheritedTransform = false; | |
| 96 object.getMutableForPainting().ensureObjectPaintProperties().setPaintOffsetT ranslation(paintOffsetTranslation.release()); | 118 object.getMutableForPainting().ensureObjectPaintProperties().setPaintOffsetT ranslation(paintOffsetTranslation.release()); |
| 97 } | 119 } |
| 98 | 120 |
| 99 static FloatPoint3D transformOrigin(const LayoutBox& box) | 121 static FloatPoint3D transformOrigin(const LayoutBox& box) |
| 100 { | 122 { |
| 101 const ComputedStyle& style = box.styleRef(); | 123 const ComputedStyle& style = box.styleRef(); |
| 102 FloatSize borderBoxSize(box.size()); | 124 FloatSize borderBoxSize(box.size()); |
| 103 return FloatPoint3D( | 125 return FloatPoint3D( |
| 104 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), | 126 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), |
| 105 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), | 127 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 117 // the animation passes through the identity matrix. | 139 // the animation passes through the identity matrix. |
| 118 // FIXME(pdr): Refactor this so all non-root SVG objects use the same tr ansform function. | 140 // FIXME(pdr): Refactor this so all non-root SVG objects use the same tr ansform function. |
| 119 const AffineTransform& transform = object.isSVGForeignObject() ? object. localSVGTransform() : object.localToSVGParentTransform(); | 141 const AffineTransform& transform = object.isSVGForeignObject() ? object. localSVGTransform() : object.localToSVGParentTransform(); |
| 120 if (transform.isIdentity()) | 142 if (transform.isIdentity()) |
| 121 return; | 143 return; |
| 122 | 144 |
| 123 // The origin is included in the local transform, so use an empty origin . | 145 // The origin is included in the local transform, so use an empty origin . |
| 124 RefPtr<TransformPaintPropertyNode> svgTransform = TransformPaintProperty Node::create( | 146 RefPtr<TransformPaintPropertyNode> svgTransform = TransformPaintProperty Node::create( |
| 125 transform, FloatPoint3D(0, 0, 0), context.current.transform); | 147 transform, FloatPoint3D(0, 0, 0), context.current.transform); |
| 126 context.current.transform = svgTransform.get(); | 148 context.current.transform = svgTransform.get(); |
| 149 context.current.renderingContextID = 0; | |
| 150 context.current.shouldFlattenInheritedTransform = false; | |
| 127 object.getMutableForPainting().ensureObjectPaintProperties().setTransfor m(svgTransform.release()); | 151 object.getMutableForPainting().ensureObjectPaintProperties().setTransfor m(svgTransform.release()); |
| 128 return; | 152 return; |
| 129 } | 153 } |
| 130 | 154 |
| 155 if (!object.isBox()) | |
| 156 return; | |
| 131 const ComputedStyle& style = object.styleRef(); | 157 const ComputedStyle& style = object.styleRef(); |
| 132 if (!object.isBox() || !style.hasTransform()) | 158 if (!style.hasTransform() && !style.preserves3D()) |
| 133 return; | 159 return; |
| 134 | 160 |
| 135 TransformationMatrix matrix; | 161 TransformationMatrix matrix; |
| 136 style.applyTransform(matrix, toLayoutBox(object).size(), ComputedStyle::Excl udeTransformOrigin, | 162 style.applyTransform(matrix, toLayoutBox(object).size(), ComputedStyle::Excl udeTransformOrigin, |
| 137 ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTrans formProperties); | 163 ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTrans formProperties); |
| 164 | |
| 165 unsigned renderingContextID = context.current.renderingContextID; | |
| 166 unsigned renderingContextIDForChildren = 0; | |
| 167 bool flattensInheritedTransform = context.current.shouldFlattenInheritedTran sform; | |
| 168 bool childrenFlattenInheritedTransform = true; | |
| 169 | |
| 170 if (style.preserves3D()) { | |
| 171 // If a node with transform-style: preserve-3d does not exist in an | |
| 172 // existing rendering context, it establishes a new one. | |
| 173 if (!renderingContextID) | |
| 174 renderingContextID = PtrHash<const LayoutObject>::hash(&object); | |
| 175 renderingContextIDForChildren = renderingContextID; | |
| 176 childrenFlattenInheritedTransform = false; | |
|
trchen
2016/07/19 22:19:42
Note: transform-style should be respected if and o
jbroman
2016/07/20 15:30:56
Are you asking for a TODO, a bug, or would you lik
| |
| 177 } | |
| 178 | |
| 138 RefPtr<TransformPaintPropertyNode> transformNode = TransformPaintPropertyNod e::create( | 179 RefPtr<TransformPaintPropertyNode> transformNode = TransformPaintPropertyNod e::create( |
| 139 matrix, transformOrigin(toLayoutBox(object)), context.current.transform) ; | 180 matrix, transformOrigin(toLayoutBox(object)), context.current.transform, |
| 181 flattensInheritedTransform, renderingContextID); | |
| 140 context.current.transform = transformNode.get(); | 182 context.current.transform = transformNode.get(); |
| 183 context.current.renderingContextID = renderingContextIDForChildren; | |
| 184 context.current.shouldFlattenInheritedTransform = childrenFlattenInheritedTr ansform; | |
| 141 object.getMutableForPainting().ensureObjectPaintProperties().setTransform(tr ansformNode.release()); | 185 object.getMutableForPainting().ensureObjectPaintProperties().setTransform(tr ansformNode.release()); |
| 142 } | 186 } |
| 143 | 187 |
| 144 void PaintPropertyTreeBuilder::updateEffect(const LayoutObject& object, PaintPro pertyTreeBuilderContext& context) | 188 void PaintPropertyTreeBuilder::updateEffect(const LayoutObject& object, PaintPro pertyTreeBuilderContext& context) |
| 145 { | 189 { |
| 146 if (!object.styleRef().hasOpacity()) | 190 if (!object.styleRef().hasOpacity()) |
| 147 return; | 191 return; |
| 148 RefPtr<EffectPaintPropertyNode> effectNode = EffectPaintPropertyNode::create (object.styleRef().opacity(), context.currentEffect); | 192 RefPtr<EffectPaintPropertyNode> effectNode = EffectPaintPropertyNode::create (object.styleRef().opacity(), context.currentEffect); |
| 149 context.currentEffect = effectNode.get(); | 193 context.currentEffect = effectNode.get(); |
| 150 object.getMutableForPainting().ensureObjectPaintProperties().setEffect(effec tNode.release()); | 194 object.getMutableForPainting().ensureObjectPaintProperties().setEffect(effec tNode.release()); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), | 288 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), |
| 245 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())) ; | 289 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())) ; |
| 246 } | 290 } |
| 247 | 291 |
| 248 void PaintPropertyTreeBuilder::updatePerspective(const LayoutObject& object, Pai ntPropertyTreeBuilderContext& context) | 292 void PaintPropertyTreeBuilder::updatePerspective(const LayoutObject& object, Pai ntPropertyTreeBuilderContext& context) |
| 249 { | 293 { |
| 250 const ComputedStyle& style = object.styleRef(); | 294 const ComputedStyle& style = object.styleRef(); |
| 251 if (!object.isBox() || !style.hasPerspective()) | 295 if (!object.isBox() || !style.hasPerspective()) |
| 252 return; | 296 return; |
| 253 | 297 |
| 254 RefPtr<TransformPaintPropertyNode> perspective = TransformPaintPropertyNode: :create( | 298 // The perspective node must not flatten (else nothing will get |
| 299 // perspective), but it should still extend the rendering context as most | |
| 300 // transform nodes do. | |
| 301 RefPtr<TransformPaintPropertyNode> perspective = createTransformNode( | |
| 302 context, | |
| 255 TransformationMatrix().applyPerspective(style.perspective()), | 303 TransformationMatrix().applyPerspective(style.perspective()), |
| 256 perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.current.pa intOffset), | 304 perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.current.pa intOffset), |
| 257 context.current.transform); | 305 context.current.transform); |
| 258 context.current.transform = perspective.get(); | 306 context.current.transform = perspective.get(); |
| 307 context.current.shouldFlattenInheritedTransform = false; | |
| 308 | |
| 259 object.getMutableForPainting().ensureObjectPaintProperties().setPerspective( perspective.release()); | 309 object.getMutableForPainting().ensureObjectPaintProperties().setPerspective( perspective.release()); |
| 260 } | 310 } |
| 261 | 311 |
| 262 void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(const LayoutOb ject& object, PaintPropertyTreeBuilderContext& context) | 312 void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(const LayoutOb ject& object, PaintPropertyTreeBuilderContext& context) |
| 263 { | 313 { |
| 264 if (!object.isSVGRoot()) | 314 if (!object.isSVGRoot()) |
| 265 return; | 315 return; |
| 266 | 316 |
| 267 AffineTransform transformToBorderBox = SVGRootPainter(toLayoutSVGRoot(object )).transformToPixelSnappedBorderBox(context.current.paintOffset); | 317 AffineTransform transformToBorderBox = SVGRootPainter(toLayoutSVGRoot(object )).transformToPixelSnappedBorderBox(context.current.paintOffset); |
| 268 | 318 |
| 269 // The paint offset is included in |transformToBorderBox| so SVG does not ne ed to handle paint | 319 // The paint offset is included in |transformToBorderBox| so SVG does not ne ed to handle paint |
| 270 // offset internally. | 320 // offset internally. |
| 271 context.current.paintOffset = LayoutPoint(); | 321 context.current.paintOffset = LayoutPoint(); |
| 272 | 322 |
| 273 if (transformToBorderBox.isIdentity()) | 323 if (transformToBorderBox.isIdentity()) |
| 274 return; | 324 return; |
| 275 | 325 |
| 276 RefPtr<TransformPaintPropertyNode> svgLocalToBorderBoxTransform = TransformP aintPropertyNode::create( | 326 RefPtr<TransformPaintPropertyNode> svgLocalToBorderBoxTransform = TransformP aintPropertyNode::create( |
| 277 transformToBorderBox, FloatPoint3D(0, 0, 0), context.current.transform); | 327 transformToBorderBox, FloatPoint3D(0, 0, 0), context.current.transform); |
| 278 context.current.transform = svgLocalToBorderBoxTransform.get(); | 328 context.current.transform = svgLocalToBorderBoxTransform.get(); |
| 279 context.current.paintOffset = LayoutPoint(); | 329 context.current.paintOffset = LayoutPoint(); |
| 330 context.current.renderingContextID = 0; | |
| 331 context.current.shouldFlattenInheritedTransform = false; | |
| 280 object.getMutableForPainting().ensureObjectPaintProperties().setSvgLocalToBo rderBoxTransform(svgLocalToBorderBoxTransform.release()); | 332 object.getMutableForPainting().ensureObjectPaintProperties().setSvgLocalToBo rderBoxTransform(svgLocalToBorderBoxTransform.release()); |
| 281 } | 333 } |
| 282 | 334 |
| 283 void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec t, PaintPropertyTreeBuilderContext& context) | 335 void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec t, PaintPropertyTreeBuilderContext& context) |
| 284 { | 336 { |
| 285 if (!object.isBoxModelObject() || !object.hasOverflowClip()) | 337 if (!object.isBoxModelObject() || !object.hasOverflowClip()) |
| 286 return; | 338 return; |
| 287 | 339 |
| 288 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); | 340 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
| 289 ASSERT(layer); | 341 ASSERT(layer); |
| 290 DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset(); | 342 DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset(); |
| 291 if (scrollOffset.isZero() && !layer->scrollsOverflow()) | 343 if (scrollOffset.isZero() && !layer->scrollsOverflow()) |
| 292 return; | 344 return; |
| 293 | 345 |
| 294 RefPtr<TransformPaintPropertyNode> scrollTranslation = TransformPaintPropert yNode::create( | 346 RefPtr<TransformPaintPropertyNode> scrollTranslation = createTransformNode( |
| 347 context, | |
| 295 TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.he ight()), | 348 TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.he ight()), |
| 296 FloatPoint3D(), | 349 FloatPoint3D(), |
| 297 context.current.transform); | 350 context.current.transform); |
| 298 context.current.transform = scrollTranslation.get(); | 351 context.current.transform = scrollTranslation.get(); |
| 352 context.current.shouldFlattenInheritedTransform = false; | |
| 299 object.getMutableForPainting().ensureObjectPaintProperties().setScrollTransl ation(scrollTranslation.release()); | 353 object.getMutableForPainting().ensureObjectPaintProperties().setScrollTransl ation(scrollTranslation.release()); |
| 300 } | 354 } |
| 301 | 355 |
| 302 void PaintPropertyTreeBuilder::updateOutOfFlowContext(const LayoutObject& object , PaintPropertyTreeBuilderContext& context) | 356 void PaintPropertyTreeBuilder::updateOutOfFlowContext(const LayoutObject& object , PaintPropertyTreeBuilderContext& context) |
| 303 { | 357 { |
| 304 if (object.canContainAbsolutePositionObjects()) { | 358 if (object.canContainAbsolutePositionObjects()) { |
| 305 context.absolutePosition = context.current; | 359 context.absolutePosition = context.current; |
| 306 context.containerForAbsolutePosition = &object; | 360 context.containerForAbsolutePosition = &object; |
| 307 } | 361 } |
| 308 | 362 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 | 446 |
| 393 deriveBorderBoxFromContainerContext(object, context); | 447 deriveBorderBoxFromContainerContext(object, context); |
| 394 | 448 |
| 395 updatePaintOffsetTranslation(object, context); | 449 updatePaintOffsetTranslation(object, context); |
| 396 updateTransform(object, context); | 450 updateTransform(object, context); |
| 397 updateEffect(object, context); | 451 updateEffect(object, context); |
| 398 updateCssClip(object, context); | 452 updateCssClip(object, context); |
| 399 updateLocalBorderBoxContext(object, context); | 453 updateLocalBorderBoxContext(object, context); |
| 400 updateScrollbarPaintOffset(object, context); | 454 updateScrollbarPaintOffset(object, context); |
| 401 updateOverflowClip(object, context); | 455 updateOverflowClip(object, context); |
| 402 // TODO(trchen): Insert flattening transform here, as specified by | |
| 403 // http://www.w3.org/TR/css3-transforms/#transform-style-property | |
| 404 updatePerspective(object, context); | 456 updatePerspective(object, context); |
| 405 updateSvgLocalToBorderBoxTransform(object, context); | 457 updateSvgLocalToBorderBoxTransform(object, context); |
| 406 updateScrollTranslation(object, context); | 458 updateScrollTranslation(object, context); |
| 407 updateOutOfFlowContext(object, context); | 459 updateOutOfFlowContext(object, context); |
| 408 } | 460 } |
| 409 | 461 |
| 410 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |