| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 { | 43 { |
| 44 DEFINE_STATIC_REF(ScrollPaintPropertyNode, rootScroll, (ScrollPaintPrope
rtyNode::create(nullptr, rootTransformNode(), IntSize(), IntSize(), false, false
))); | 44 DEFINE_STATIC_REF(ScrollPaintPropertyNode, rootScroll, (ScrollPaintPrope
rtyNode::create(nullptr, rootTransformNode(), IntSize(), IntSize(), false, false
))); |
| 45 return rootScroll; | 45 return rootScroll; |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 PaintPropertyTreeBuilderContext PaintPropertyTreeBuilder::setupInitialContext() | 49 PaintPropertyTreeBuilderContext PaintPropertyTreeBuilder::setupInitialContext() |
| 50 { | 50 { |
| 51 PaintPropertyTreeBuilderContext context; | 51 PaintPropertyTreeBuilderContext context; |
| 52 | 52 |
| 53 // TODO(pdr): Update the root layer scrolling paths to use the static root n
odes. | 53 context.current.clip = context.absolutePosition.clip = context.fixedPosition
.clip = rootClipNode(); |
| 54 |
| 55 // TODO(pdr): Update the root layer scrolling paths to use the static root n
odes for transform, effect, and scroll. |
| 54 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 56 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 55 return context; | 57 return context; |
| 56 | 58 |
| 57 context.current.transform = context.absolutePosition.transform = context.fix
edPosition.transform = rootTransformNode(); | 59 context.current.transform = context.absolutePosition.transform = context.fix
edPosition.transform = rootTransformNode(); |
| 58 context.current.scroll = context.absolutePosition.scroll = context.fixedPosi
tion.scroll = rootScrollNode(); | 60 context.current.scroll = context.absolutePosition.scroll = context.fixedPosi
tion.scroll = rootScrollNode(); |
| 59 context.current.clip = context.absolutePosition.clip = context.fixedPosition
.clip = rootClipNode(); | |
| 60 context.currentEffect = rootEffectNode(); | 61 context.currentEffect = rootEffectNode(); |
| 61 | 62 |
| 62 // Ensure scroll tree properties are reset. They will be rebuilt during the
tree walk. | 63 // Ensure scroll tree properties are reset. They will be rebuilt during the
tree walk. |
| 63 rootScrollNode()->clearMainThreadScrollingReasons(); | 64 rootScrollNode()->clearMainThreadScrollingReasons(); |
| 64 | 65 |
| 65 return context; | 66 return context; |
| 66 } | 67 } |
| 67 | 68 |
| 68 void createOrUpdateFrameViewPreTranslation(FrameView& frameView, | 69 void createOrUpdateFrameViewPreTranslation(FrameView& frameView, |
| 69 PassRefPtr<const TransformPaintPropertyNode> parent, | 70 PassRefPtr<const TransformPaintPropertyNode> parent, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since
we don't need them at the moment. | 320 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since
we don't need them at the moment. |
| 320 if (!object.isBox() && !object.hasLayer()) | 321 if (!object.isBox() && !object.hasLayer()) |
| 321 return; | 322 return; |
| 322 | 323 |
| 323 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo
ntext = | 324 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo
ntext = |
| 324 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); | 325 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); |
| 325 borderBoxContext->paintOffset = context.current.paintOffset; | 326 borderBoxContext->paintOffset = context.current.paintOffset; |
| 326 borderBoxContext->geometryPropertyTreeState = GeometryPropertyTreeState(cont
ext.current.transform, context.current.clip, context.currentEffect); | 327 borderBoxContext->geometryPropertyTreeState = GeometryPropertyTreeState(cont
ext.current.transform, context.current.clip, context.currentEffect); |
| 327 borderBoxContext->scroll = context.current.scroll; | 328 borderBoxContext->scroll = context.current.scroll; |
| 328 | 329 |
| 329 if (!context.current.clip) { | |
| 330 DCHECK(object.isLayoutView()); | |
| 331 DCHECK(toLayoutView(object).frameView()->frame().isMainFrame()); | |
| 332 DCHECK(RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | |
| 333 borderBoxContext->geometryPropertyTreeState.clip = ClipPaintPropertyNode
::create(nullptr, context.current.transform, FloatRoundedRect(LayoutRect::infini
teIntRect())); | |
| 334 context.current.clip = borderBoxContext->geometryPropertyTreeState.clip.
get(); | |
| 335 } | |
| 336 | |
| 337 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB
oxProperties(std::move(borderBoxContext)); | 330 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB
oxProperties(std::move(borderBoxContext)); |
| 338 | 331 |
| 339 } | 332 } |
| 340 | 333 |
| 341 // TODO(trchen): Remove this once we bake the paint offset into frameRect. | 334 // TODO(trchen): Remove this once we bake the paint offset into frameRect. |
| 342 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob
ject, const PaintPropertyTreeBuilderContext& context) | 335 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob
ject, const PaintPropertyTreeBuilderContext& context) |
| 343 { | 336 { |
| 344 IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); | 337 IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset); |
| 345 if (roundedPaintOffset != IntPoint() && object.isBoxModelObject()) { | 338 if (roundedPaintOffset != IntPoint() && object.isBoxModelObject()) { |
| 346 if (PaintLayerScrollableArea* scrollableArea = toLayoutBoxModelObject(ob
ject).getScrollableArea()) { | 339 if (PaintLayerScrollableArea* scrollableArea = toLayoutBoxModelObject(ob
ject).getScrollableArea()) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 return; | 590 return; |
| 598 | 591 |
| 599 updateOverflowClip(object, context); | 592 updateOverflowClip(object, context); |
| 600 updatePerspective(object, context); | 593 updatePerspective(object, context); |
| 601 updateSvgLocalToBorderBoxTransform(object, context); | 594 updateSvgLocalToBorderBoxTransform(object, context); |
| 602 updateScrollAndScrollTranslation(object, context); | 595 updateScrollAndScrollTranslation(object, context); |
| 603 updateOutOfFlowContext(object, context); | 596 updateOutOfFlowContext(object, context); |
| 604 } | 597 } |
| 605 | 598 |
| 606 } // namespace blink | 599 } // namespace blink |
| OLD | NEW |