| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "platform/geometry/FloatPoint3D.h" | 32 #include "platform/geometry/FloatPoint3D.h" |
| 33 #include "platform/graphics/GraphicsLayer.h" | 33 #include "platform/graphics/GraphicsLayer.h" |
| 34 #include "platform/graphics/GraphicsLayerClient.h" | 34 #include "platform/graphics/GraphicsLayerClient.h" |
| 35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 36 #include <memory> | 36 #include <memory> |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class PaintLayerCompositor; | 40 class PaintLayerCompositor; |
| 41 | 41 |
| 42 // A GraphicsLayerPaintInfo contains all the info needed to paint a partial subt
ree of Layers into a GraphicsLayer. | 42 // A GraphicsLayerPaintInfo contains all the info needed to paint a partial |
| 43 // subtree of Layers into a GraphicsLayer. |
| 43 struct GraphicsLayerPaintInfo { | 44 struct GraphicsLayerPaintInfo { |
| 44 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 45 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 45 PaintLayer* paintLayer; | 46 PaintLayer* paintLayer; |
| 46 | 47 |
| 47 LayoutRect compositedBounds; | 48 LayoutRect compositedBounds; |
| 48 | 49 |
| 49 // The clip rect to apply, in the local coordinate space of the squashed layer
, when painting it. | 50 // The clip rect to apply, in the local coordinate space of the squashed |
| 51 // layer, when painting it. |
| 50 IntRect localClipRectForSquashedLayer; | 52 IntRect localClipRectForSquashedLayer; |
| 51 | 53 |
| 52 // Offset describing where this squashed Layer paints into the shared Graphics
Layer backing. | 54 // Offset describing where this squashed Layer paints into the shared |
| 55 // GraphicsLayer backing. |
| 53 IntSize offsetFromLayoutObject; | 56 IntSize offsetFromLayoutObject; |
| 54 bool offsetFromLayoutObjectSet; | 57 bool offsetFromLayoutObjectSet; |
| 55 | 58 |
| 56 GraphicsLayerPaintInfo() | 59 GraphicsLayerPaintInfo() |
| 57 : paintLayer(nullptr), offsetFromLayoutObjectSet(false) {} | 60 : paintLayer(nullptr), offsetFromLayoutObjectSet(false) {} |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 enum GraphicsLayerUpdateScope { | 63 enum GraphicsLayerUpdateScope { |
| 61 GraphicsLayerUpdateNone, | 64 GraphicsLayerUpdateNone, |
| 62 GraphicsLayerUpdateLocal, | 65 GraphicsLayerUpdateLocal, |
| 63 GraphicsLayerUpdateSubtree, | 66 GraphicsLayerUpdateSubtree, |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 // CompositedLayerMapping keeps track of how PaintLayers correspond to | 69 // CompositedLayerMapping keeps track of how PaintLayers correspond to |
| 67 // GraphicsLayers of the composited layer tree. Each instance of CompositedLayer
Mapping | 70 // GraphicsLayers of the composited layer tree. Each instance of |
| 68 // manages a small cluster of GraphicsLayers and the references to which Layers | 71 // CompositedLayerMapping manages a small cluster of GraphicsLayers and the |
| 69 // and paint phases contribute to each GraphicsLayer. | 72 // references to which Layers and paint phases contribute to each GraphicsLayer. |
| 70 // | 73 // |
| 71 // - If a PaintLayer is composited, | 74 // - If a PaintLayer is composited, |
| 72 // - if it paints into its own backings (GraphicsLayers), it owns a | 75 // - if it paints into its own backings (GraphicsLayers), it owns a |
| 73 // CompositedLayerMapping (PaintLayer::compositedLayerMapping()) to keep | 76 // CompositedLayerMapping (PaintLayer::compositedLayerMapping()) to keep |
| 74 // track the backings; | 77 // track the backings; |
| 75 // - if it paints into grouped backing (i.e. it's squashed), it has a pointer | 78 // - if it paints into grouped backing (i.e. it's squashed), it has a pointer |
| 76 // (PaintLayer::groupedMapping()) to the CompositedLayerMapping into which | 79 // (PaintLayer::groupedMapping()) to the CompositedLayerMapping into which |
| 77 // the PaintLayer is squashed; | 80 // the PaintLayer is squashed; |
| 78 // - Otherwise the PaintLayer doesn't own or directly reference any CompositedLa
yerMapping. | 81 // - Otherwise the PaintLayer doesn't own or directly reference any |
| 82 // CompositedLayerMapping. |
| 79 class CORE_EXPORT CompositedLayerMapping final : public GraphicsLayerClient { | 83 class CORE_EXPORT CompositedLayerMapping final : public GraphicsLayerClient { |
| 80 WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); | 84 WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); |
| 81 USING_FAST_MALLOC(CompositedLayerMapping); | 85 USING_FAST_MALLOC(CompositedLayerMapping); |
| 82 | 86 |
| 83 public: | 87 public: |
| 84 explicit CompositedLayerMapping(PaintLayer&); | 88 explicit CompositedLayerMapping(PaintLayer&); |
| 85 ~CompositedLayerMapping() override; | 89 ~CompositedLayerMapping() override; |
| 86 | 90 |
| 87 PaintLayer& owningLayer() const { return m_owningLayer; } | 91 PaintLayer& owningLayer() const { return m_owningLayer; } |
| 88 | 92 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 const DisplayItemClient&); | 169 const DisplayItemClient&); |
| 166 | 170 |
| 167 // Notification from the layoutObject that its content changed. | 171 // Notification from the layoutObject that its content changed. |
| 168 void contentChanged(ContentChangeType); | 172 void contentChanged(ContentChangeType); |
| 169 | 173 |
| 170 LayoutRect compositedBounds() const { return m_compositedBounds; } | 174 LayoutRect compositedBounds() const { return m_compositedBounds; } |
| 171 IntRect pixelSnappedCompositedBounds() const; | 175 IntRect pixelSnappedCompositedBounds() const; |
| 172 | 176 |
| 173 void positionOverflowControlsLayers(); | 177 void positionOverflowControlsLayers(); |
| 174 | 178 |
| 175 // Returns true if the assignment actually changed the assigned squashing laye
r. | 179 // Returns true if the assignment actually changed the assigned squashing |
| 180 // layer. |
| 176 bool updateSquashingLayerAssignment(PaintLayer* squashedLayer, | 181 bool updateSquashingLayerAssignment(PaintLayer* squashedLayer, |
| 177 size_t nextSquashedLayerIndex); | 182 size_t nextSquashedLayerIndex); |
| 178 void removeLayerFromSquashingGraphicsLayer(const PaintLayer*); | 183 void removeLayerFromSquashingGraphicsLayer(const PaintLayer*); |
| 179 #if ENABLE(ASSERT) | 184 #if ENABLE(ASSERT) |
| 180 bool verifyLayerInSquashingVector(const PaintLayer*); | 185 bool verifyLayerInSquashingVector(const PaintLayer*); |
| 181 #endif | 186 #endif |
| 182 | 187 |
| 183 void finishAccumulatingSquashingLayers( | 188 void finishAccumulatingSquashingLayers( |
| 184 size_t nextSquashedLayerIndex, | 189 size_t nextSquashedLayerIndex, |
| 185 Vector<PaintLayer*>& layersNeedingPaintInvalidation); | 190 Vector<PaintLayer*>& layersNeedingPaintInvalidation); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 #endif | 267 #endif |
| 263 | 268 |
| 264 String debugName(const GraphicsLayer*) const override; | 269 String debugName(const GraphicsLayer*) const override; |
| 265 | 270 |
| 266 LayoutSize contentOffsetInCompositingLayer() const; | 271 LayoutSize contentOffsetInCompositingLayer() const; |
| 267 | 272 |
| 268 LayoutPoint squashingOffsetFromTransformedAncestor() { | 273 LayoutPoint squashingOffsetFromTransformedAncestor() { |
| 269 return m_squashingLayerOffsetFromTransformedAncestor; | 274 return m_squashingLayerOffsetFromTransformedAncestor; |
| 270 } | 275 } |
| 271 | 276 |
| 272 // If there is a squashed layer painting into this CLM that is an ancestor of
the given LayoutObject, return it. Otherwise return nullptr. | 277 // If there is a squashed layer painting into this CLM that is an ancestor of |
| 278 // the given LayoutObject, return it. Otherwise return nullptr. |
| 273 const GraphicsLayerPaintInfo* containingSquashedLayer( | 279 const GraphicsLayerPaintInfo* containingSquashedLayer( |
| 274 const LayoutObject*, | 280 const LayoutObject*, |
| 275 unsigned maxSquashedLayerIndex); | 281 unsigned maxSquashedLayerIndex); |
| 276 | 282 |
| 277 void updateScrollingBlockSelection(); | 283 void updateScrollingBlockSelection(); |
| 278 | 284 |
| 279 void adjustForCompositedScrolling(const GraphicsLayer*, | 285 void adjustForCompositedScrolling(const GraphicsLayer*, |
| 280 IntSize& offset) const; | 286 IntSize& offset) const; |
| 281 | 287 |
| 282 // Returns true for layers with scrollable overflow which have a background | 288 // Returns true for layers with scrollable overflow which have a background |
| (...skipping 10 matching lines...) Expand all Loading... |
| 293 static bool interestRectChangedEnoughToRepaint( | 299 static bool interestRectChangedEnoughToRepaint( |
| 294 const IntRect& previousInterestRect, | 300 const IntRect& previousInterestRect, |
| 295 const IntRect& newInterestRect, | 301 const IntRect& newInterestRect, |
| 296 const IntSize& layerSize); | 302 const IntSize& layerSize); |
| 297 | 303 |
| 298 static const GraphicsLayerPaintInfo* containingSquashedLayer( | 304 static const GraphicsLayerPaintInfo* containingSquashedLayer( |
| 299 const LayoutObject*, | 305 const LayoutObject*, |
| 300 const Vector<GraphicsLayerPaintInfo>& layers, | 306 const Vector<GraphicsLayerPaintInfo>& layers, |
| 301 unsigned maxSquashedLayerIndex); | 307 unsigned maxSquashedLayerIndex); |
| 302 | 308 |
| 303 // Paints the scrollbar part associated with the given graphics layer into the
given context. | 309 // Paints the scrollbar part associated with the given graphics layer into the |
| 310 // given context. |
| 304 void paintScrollableArea(const GraphicsLayer*, | 311 void paintScrollableArea(const GraphicsLayer*, |
| 305 GraphicsContext&, | 312 GraphicsContext&, |
| 306 const IntRect& interestRect) const; | 313 const IntRect& interestRect) const; |
| 307 // Returns whether the given layer is part of the scrollable area, if any, ass
ociated with this mapping. | 314 // Returns whether the given layer is part of the scrollable area, if any, |
| 315 // associated with this mapping. |
| 308 bool isScrollableAreaLayer(const GraphicsLayer*) const; | 316 bool isScrollableAreaLayer(const GraphicsLayer*) const; |
| 309 | 317 |
| 310 // Helper methods to updateGraphicsLayerGeometry: | 318 // Helper methods to updateGraphicsLayerGeometry: |
| 311 void computeGraphicsLayerParentLocation( | 319 void computeGraphicsLayerParentLocation( |
| 312 const PaintLayer* compositingContainer, | 320 const PaintLayer* compositingContainer, |
| 313 const IntRect& ancestorCompositingBounds, | 321 const IntRect& ancestorCompositingBounds, |
| 314 IntPoint& graphicsLayerParentLocation); | 322 IntPoint& graphicsLayerParentLocation); |
| 315 void updateSquashingLayerGeometry( | 323 void updateSquashingLayerGeometry( |
| 316 const IntPoint& graphicsLayerParentLocation, | 324 const IntPoint& graphicsLayerParentLocation, |
| 317 const PaintLayer* compositingContainer, | 325 const PaintLayer* compositingContainer, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 424 |
| 417 void updateOpacity(const ComputedStyle&); | 425 void updateOpacity(const ComputedStyle&); |
| 418 void updateTransform(const ComputedStyle&); | 426 void updateTransform(const ComputedStyle&); |
| 419 void updateLayerBlendMode(const ComputedStyle&); | 427 void updateLayerBlendMode(const ComputedStyle&); |
| 420 void updateIsRootForIsolatedGroup(); | 428 void updateIsRootForIsolatedGroup(); |
| 421 // Return the opacity value that this layer should use for compositing. | 429 // Return the opacity value that this layer should use for compositing. |
| 422 float compositingOpacity(float layoutObjectOpacity) const; | 430 float compositingOpacity(float layoutObjectOpacity) const; |
| 423 | 431 |
| 424 bool paintsChildren() const; | 432 bool paintsChildren() const; |
| 425 | 433 |
| 426 // Returns true if this layer has content that needs to be displayed by painti
ng into the backing store. | 434 // Returns true if this layer has content that needs to be displayed by |
| 435 // painting into the backing store. |
| 427 bool containsPaintedContent() const; | 436 bool containsPaintedContent() const; |
| 428 // Returns true if the Layer just contains an image that we can composite dire
ctly. | 437 // Returns true if the Layer just contains an image that we can composite |
| 438 // directly. |
| 429 bool isDirectlyCompositedImage() const; | 439 bool isDirectlyCompositedImage() const; |
| 430 void updateImageContents(); | 440 void updateImageContents(); |
| 431 | 441 |
| 432 Color layoutObjectBackgroundColor() const; | 442 Color layoutObjectBackgroundColor() const; |
| 433 void updateBackgroundColor(); | 443 void updateBackgroundColor(); |
| 434 void updateContentsRect(); | 444 void updateContentsRect(); |
| 435 void updateContentsOffsetInCompositingLayer( | 445 void updateContentsOffsetInCompositingLayer( |
| 436 const IntPoint& snappedOffsetFromCompositedAncestor, | 446 const IntPoint& snappedOffsetFromCompositedAncestor, |
| 437 const IntPoint& graphicsLayerParentLocation); | 447 const IntPoint& graphicsLayerParentLocation); |
| 438 void updateAfterPartResize(); | 448 void updateAfterPartResize(); |
| 439 void updateCompositingReasons(); | 449 void updateCompositingReasons(); |
| 440 | 450 |
| 441 static bool hasVisibleNonCompositingDescendant(PaintLayer* parent); | 451 static bool hasVisibleNonCompositingDescendant(PaintLayer* parent); |
| 442 | 452 |
| 443 void doPaintTask(const GraphicsLayerPaintInfo&, | 453 void doPaintTask(const GraphicsLayerPaintInfo&, |
| 444 const GraphicsLayer&, | 454 const GraphicsLayer&, |
| 445 const PaintLayerFlags&, | 455 const PaintLayerFlags&, |
| 446 GraphicsContext&, | 456 GraphicsContext&, |
| 447 const IntRect& clip) const; | 457 const IntRect& clip) const; |
| 448 | 458 |
| 449 // Computes the background clip rect for the given squashed layer, up to any c
ontaining layer that is squashed into the | 459 // Computes the background clip rect for the given squashed layer, up to any |
| 450 // same squashing layer and contains this squashed layer's clipping ancestor. | 460 // containing layer that is squashed into the same squashing layer and |
| 451 // The clip rect is returned in the coordinate space of the given squashed lay
er. | 461 // contains this squashed layer's clipping ancestor. The clip rect is |
| 452 // If there is no such containing layer, returns the infinite rect. | 462 // returned in the coordinate space of the given squashed layer. If there is |
| 453 // FIXME: unify this code with the code that sets up m_ancestorClippingLayer.
They are doing very similar things. | 463 // no such containing layer, returns the infinite rect. |
| 464 // FIXME: unify this code with the code that sets up m_ancestorClippingLayer. |
| 465 // They are doing very similar things. |
| 454 static IntRect localClipRectForSquashedLayer( | 466 static IntRect localClipRectForSquashedLayer( |
| 455 const PaintLayer& referenceLayer, | 467 const PaintLayer& referenceLayer, |
| 456 const GraphicsLayerPaintInfo&, | 468 const GraphicsLayerPaintInfo&, |
| 457 const Vector<GraphicsLayerPaintInfo>& layers); | 469 const Vector<GraphicsLayerPaintInfo>& layers); |
| 458 | 470 |
| 459 // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (
inclusive) of the | 471 // Return true if |m_owningLayer|'s compositing ancestor is not a descendant |
| 460 // clipping container for |m_owningLayer|. | 472 // (inclusive) of the clipping container for |m_owningLayer|. |
| 461 bool owningLayerClippedByLayerNotAboveCompositedAncestor( | 473 bool owningLayerClippedByLayerNotAboveCompositedAncestor( |
| 462 const PaintLayer* scrollParent); | 474 const PaintLayer* scrollParent); |
| 463 | 475 |
| 464 const PaintLayer* scrollParent(); | 476 const PaintLayer* scrollParent(); |
| 465 | 477 |
| 466 // Clear the groupedMapping entry on the layer at the given index, only if tha
t layer does | 478 // Clear the groupedMapping entry on the layer at the given index, only if |
| 467 // not appear earlier in the set of layers for this object. | 479 // that layer does not appear earlier in the set of layers for this object. |
| 468 bool invalidateLayerIfNoPrecedingEntry(size_t); | 480 bool invalidateLayerIfNoPrecedingEntry(size_t); |
| 469 | 481 |
| 470 PaintLayer& m_owningLayer; | 482 PaintLayer& m_owningLayer; |
| 471 | 483 |
| 472 // The hierarchy of layers that is maintained by the CompositedLayerMapping lo
oks like this: | 484 // The hierarchy of layers that is maintained by the CompositedLayerMapping |
| 485 // looks like this: |
| 473 // | 486 // |
| 474 // + m_ancestorClippingLayer [OPTIONAL] | 487 // + m_ancestorClippingLayer [OPTIONAL] |
| 475 // + m_graphicsLayer | 488 // + m_graphicsLayer |
| 476 // + m_childTransformLayer [OPTIONAL] | 489 // + m_childTransformLayer [OPTIONAL] |
| 477 // | + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTION
AL] | 490 // | + m_childContainmentLayer [OPTIONAL] |
| 478 // | + m_scrollingContentsLay
er [Present iff m_scrollingLayer is present] | 491 // | <-OR-> |
| 479 // + m_overflowControlsAncestorClippingLayer [OPTIONAL] // *The overflow
controls may need to be repositioned in the | 492 // | (m_scrollingLayer + m_scrollingContentsLayer) [OPTIONAL] |
| 480 // + m_overflowControlsHostLayer [OPTIONAL] // graphics laye
r tree by the RLC to ensure that they stack | 493 // + m_overflowControlsAncestorClippingLayer [OPTIONAL] |
| 481 // + m_layerForVerticalScrollbar [OPTIONAL] // above scrolli
ng content. | 494 // + m_overflowControlsHostLayer [OPTIONAL] |
| 495 // + m_layerForVerticalScrollbar [OPTIONAL] |
| 482 // + m_layerForHorizontalScrollbar [OPTIONAL] | 496 // + m_layerForHorizontalScrollbar [OPTIONAL] |
| 483 // + m_layerForScrollCorner [OPTIONAL] | 497 // + m_layerForScrollCorner [OPTIONAL] |
| 498 // The overflow controls may need to be repositioned in the graphics layer |
| 499 // tree by the RLC to ensure that they stack above scrolling content. |
| 484 // | 500 // |
| 485 // We need an ancestor clipping layer if our clipping ancestor is not our ance
stor in the | 501 // We need an ancestor clipping layer if our clipping ancestor is not our |
| 486 // clipping tree. Here's what that might look like. | 502 // ancestor in the clipping tree. Here's what that might look like. |
| 487 // | 503 // |
| 488 // Let A = the clipping ancestor, | 504 // Let A = the clipping ancestor, |
| 489 // B = the clip descendant, and | 505 // B = the clip descendant, and |
| 490 // SC = the stacking context that is the ancestor of A and B in the stacki
ng tree. | 506 // SC = the stacking context that is the ancestor of A and B in the |
| 507 // stacking tree. |
| 491 // | 508 // |
| 492 // SC | 509 // SC |
| 493 // + A = m_graphicsLayer | 510 // + A = m_graphicsLayer |
| 494 // | + m_childContainmentLayer | 511 // | + m_childContainmentLayer |
| 495 // | + ... | 512 // | + ... |
| 496 // ... | 513 // ... |
| 497 // | | 514 // | |
| 498 // + B = m_ancestorClippingLayer [+] | 515 // + B = m_ancestorClippingLayer [+] |
| 499 // + m_graphicsLayer | 516 // + m_graphicsLayer |
| 500 // + ... | 517 // + ... |
| 501 // | 518 // |
| 502 // In this case B is clipped by another layer that doesn't happen to be its an
cestor: A. | 519 // In this case B is clipped by another layer that doesn't happen to be its |
| 503 // So we create an ancestor clipping layer for B, [+], which ensures that B is
clipped | 520 // ancestor: A. So we create an ancestor clipping layer for B, [+], which |
| 504 // as if it had been A's descendant. | 521 // ensures that B is clipped as if it had been A's descendant. |
| 505 std::unique_ptr<GraphicsLayer> | 522 |
| 506 m_ancestorClippingLayer; // Only used if we are clipped by an ancestor wh
ich is not a stacking context. | 523 // Only used if we are clipped by an ancestor which is not a stacking context. |
| 524 std::unique_ptr<GraphicsLayer> m_ancestorClippingLayer; |
| 507 std::unique_ptr<GraphicsLayer> m_graphicsLayer; | 525 std::unique_ptr<GraphicsLayer> m_graphicsLayer; |
| 508 std::unique_ptr<GraphicsLayer> | |
| 509 m_childContainmentLayer; // Only used if we have clipping on a stacking c
ontext with compositing children. | |
| 510 std::unique_ptr<GraphicsLayer> | |
| 511 m_childTransformLayer; // Only used if we have perspective. | |
| 512 std::unique_ptr<GraphicsLayer> | |
| 513 m_scrollingLayer; // Only used if the layer is using composited scrolling
. | |
| 514 std::unique_ptr<GraphicsLayer> | |
| 515 m_scrollingContentsLayer; // Only used if the layer is using composited s
crolling. | |
| 516 | 526 |
| 517 // This layer is also added to the hierarchy by the RLB, but in a different wa
y than | 527 // Only used if we have clipping on a stacking context with compositing |
| 518 // the layers above. It's added to m_graphicsLayer as its mask layer (naturall
y) if | 528 // children. |
| 519 // we have a mask, and isn't part of the typical hierarchy (it has no children
). | 529 std::unique_ptr<GraphicsLayer> m_childContainmentLayer; |
| 520 std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask. | |
| 521 std::unique_ptr<GraphicsLayer> | |
| 522 m_childClippingMaskLayer; // Only used if we have to clip child layers or
accelerated contents with border radius or clip-path. | |
| 523 | 530 |
| 524 // There are two other (optional) layers whose painting is managed by the Comp
ositedLayerMapping, | 531 // Only used if we have perspective. |
| 525 // but whose position in the hierarchy is maintained by the PaintLayerComposit
or. These | 532 std::unique_ptr<GraphicsLayer> m_childTransformLayer; |
| 526 // are the foreground and background layers. The foreground layer exists if we
have composited | 533 |
| 527 // descendants with negative z-order. We need the extra layer in this case bec
ause the layer | 534 // Only used if the layer is using composited scrolling. |
| 528 // needs to draw both below (for the background, say) and above (for the norma
l flow content, say) | 535 std::unique_ptr<GraphicsLayer> m_scrollingLayer; |
| 529 // the negative z-order descendants and this is impossible with a single layer
. The RLC handles | 536 |
| 530 // inserting m_foregroundLayer in the correct position in our descendant list
for us (right after | 537 // Only used if the layer is using composited scrolling. |
| 531 // the neg z-order dsecendants). | 538 std::unique_ptr<GraphicsLayer> m_scrollingContentsLayer; |
| 539 |
| 540 // This layer is also added to the hierarchy by the RLB, but in a different |
| 541 // way than the layers above. It's added to m_graphicsLayer as its mask layer |
| 542 // (naturally) if we have a mask, and isn't part of the typical hierarchy (it |
| 543 // has no children). |
| 544 // Only used if we have a mask. |
| 545 std::unique_ptr<GraphicsLayer> m_maskLayer; |
| 546 |
| 547 // Only used if we have to clip child layers or accelerated contents with |
| 548 // border radius or clip-path. |
| 549 std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; |
| 550 |
| 551 // There are two other (optional) layers whose painting is managed by the |
| 552 // CompositedLayerMapping, but whose position in the hierarchy is maintained |
| 553 // by the PaintLayerCompositor. These are the foreground and background |
| 554 // layers. The foreground layer exists if we have composited descendants with |
| 555 // negative z-order. We need the extra layer in this case because the layer |
| 556 // needs to draw both below (for the background, say) and above (for the |
| 557 // normal flow content, say) the negative z-order descendants and this is |
| 558 // impossible with a single layer. The RLC handles inserting m_foregroundLayer |
| 559 // in the correct position in our descendant list for us (right after the neg |
| 560 // z-order dsecendants). |
| 532 // | 561 // |
| 533 // The background layer is only created if this is the root layer and our back
ground is entirely | 562 // The background layer is only created if this is the root layer and our |
| 534 // fixed. In this case we want to put the background in a separate composited
layer so that when | 563 // background is entirely fixed. In this case we want to put the background in |
| 535 // we scroll, we don't have to re-raster the background into position. This la
yer is also inserted | 564 // a separate composited layer so that when we scroll, we don't have to |
| 536 // into the tree by the RLC as it gets a special home. This layer becomes a de
scendant of the | 565 // re-raster the background into position. This layer is also inserted into |
| 537 // frame clipping layer. That is: | 566 // the tree by the RLC as it gets a special home. This layer becomes a |
| 567 // descendant of the frame clipping layer. That is: |
| 538 // ... | 568 // ... |
| 539 // + frame clipping layer | 569 // + frame clipping layer |
| 540 // + m_backgroundLayer | 570 // + m_backgroundLayer |
| 541 // + frame scrolling layer | 571 // + frame scrolling layer |
| 542 // + root content layer | 572 // + root content layer |
| 543 // | 573 // |
| 544 // With the hierarchy set up like this, the root content layer is able to scro
ll without affecting | 574 // With the hierarchy set up like this, the root content layer is able to |
| 545 // the background layer (or paint invalidation). | 575 // scroll without affecting the background layer (or paint invalidation). |
| 546 std::unique_ptr<GraphicsLayer> | 576 |
| 547 m_foregroundLayer; // Only used in cases where we need to draw the foregr
ound separately. | 577 // Only used in cases where we need to draw the foreground separately. |
| 548 std::unique_ptr<GraphicsLayer> | 578 std::unique_ptr<GraphicsLayer> m_foregroundLayer; |
| 549 m_backgroundLayer; // Only used in cases where we need to draw the backgr
ound separately. | 579 |
| 580 // Only used in cases where we need to draw the background separately. |
| 581 std::unique_ptr<GraphicsLayer> m_backgroundLayer; |
| 550 | 582 |
| 551 std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; | 583 std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; |
| 552 std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; | 584 std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; |
| 553 std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; | 585 std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; |
| 554 | 586 |
| 555 // This layer contains the scrollbar and scroll corner layers and clips them t
o the border box | 587 // This layer contains the scrollbar and scroll corner layers and clips them |
| 556 // bounds of our LayoutObject. It is usually added to m_graphicsLayer, but may
be reparented by | 588 // to the border box bounds of our LayoutObject. It is usually added to |
| 557 // GraphicsLayerTreeBuilder to ensure that scrollbars appear above scrolling c
ontent. | 589 // m_graphicsLayer, but may be reparented by GraphicsLayerTreeBuilder to |
| 590 // ensure that scrollbars appear above scrolling content. |
| 558 std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; | 591 std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; |
| 559 | 592 |
| 560 // The reparented overflow controls sometimes need to be clipped by a non-ance
stor. In just the same | 593 // The reparented overflow controls sometimes need to be clipped by a |
| 561 // way we need an ancestor clipping layer to clip this CLM's internal hierarch
y, we add another layer | 594 // non-ancestor. In just the same way we need an ancestor clipping layer to |
| 562 // to clip the overflow controls. We could combine this with m_overflowControl
sHostLayer, but that | 595 // clip this CLM's internal hierarchy, we add another layer to clip the |
| 563 // would require manually intersecting their clips, and shifting the overflow
controls to compensate | 596 // overflow controls. We could combine this with m_overflowControlsHostLayer, |
| 564 // for this clip's offset. By using a separate layer, the overflow controls ca
n remain ignorant of | 597 // but that would require manually intersecting their clips, and shifting the |
| 565 // ancestor clipping. | 598 // overflow controls to compensate for this clip's offset. By using a separate |
| 599 // layer, the overflow controls can remain ignorant of ancestor clipping. |
| 566 std::unique_ptr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; | 600 std::unique_ptr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; |
| 567 | 601 |
| 568 // A squashing CLM has two possible squashing-related structures. | 602 // A squashing CLM has two possible squashing-related structures. |
| 569 // | 603 // |
| 570 // If m_ancestorClippingLayer is present: | 604 // If m_ancestorClippingLayer is present: |
| 571 // | 605 // |
| 572 // m_ancestorClippingLayer | 606 // m_ancestorClippingLayer |
| 573 // + m_graphicsLayer | 607 // + m_graphicsLayer |
| 574 // + m_squashingLayer | 608 // + m_squashingLayer |
| 575 // | 609 // |
| 576 // If not: | 610 // If not: |
| 577 // | 611 // |
| 578 // m_squashingContainmentLayer | 612 // m_squashingContainmentLayer |
| 579 // + m_graphicsLayer | 613 // + m_graphicsLayer |
| 580 // + m_squashingLayer | 614 // + m_squashingLayer |
| 581 // | 615 // |
| 582 // Stacking children of a squashed layer receive graphics layers that are pare
nted to the compositd ancestor of the | 616 // Stacking children of a squashed layer receive graphics layers that are |
| 583 // squashed layer (i.e. nearest enclosing composited layer that is not squashe
d). | 617 // parented to the compositd ancestor of the squashed layer (i.e. nearest |
| 584 std::unique_ptr<GraphicsLayer> | 618 // enclosing composited layer that is not |
| 585 m_squashingContainmentLayer; // Only used if any squashed layers exist an
d m_squashingContainmentLayer is not present, to contain the squashed layers as
siblings to the rest of the GraphicsLayer tree chunk. | 619 // squashed). |
| 586 std::unique_ptr<GraphicsLayer> | 620 |
| 587 m_squashingLayer; // Only used if any squashed layers exist, this is the
backing that squashed layers paint into. | 621 // Only used if any squashed layers exist and m_squashingContainmentLayer is |
| 622 // not present, to contain the squashed layers as siblings to the rest of the |
| 623 // GraphicsLayer tree chunk. |
| 624 std::unique_ptr<GraphicsLayer> m_squashingContainmentLayer; |
| 625 |
| 626 // Only used if any squashed layers exist, this is the backing that squashed |
| 627 // layers paint into. |
| 628 std::unique_ptr<GraphicsLayer> m_squashingLayer; |
| 588 Vector<GraphicsLayerPaintInfo> m_squashedLayers; | 629 Vector<GraphicsLayerPaintInfo> m_squashedLayers; |
| 589 LayoutPoint m_squashingLayerOffsetFromTransformedAncestor; | 630 LayoutPoint m_squashingLayerOffsetFromTransformedAncestor; |
| 590 | 631 |
| 591 LayoutRect m_compositedBounds; | 632 LayoutRect m_compositedBounds; |
| 592 | 633 |
| 593 LayoutSize m_contentOffsetInCompositingLayer; | 634 LayoutSize m_contentOffsetInCompositingLayer; |
| 594 | 635 |
| 595 // We keep track of the scrolling contents offset, so that when it changes we
can notify the ScrollingCoordinator, which | 636 // We keep track of the scrolling contents offset, so that when it changes we |
| 596 // passes on main-thread scrolling updates to the compositor. | 637 // can notify the ScrollingCoordinator, which passes on main-thread scrolling |
| 638 // updates to the compositor. |
| 597 DoubleSize m_scrollingContentsOffset; | 639 DoubleSize m_scrollingContentsOffset; |
| 598 | 640 |
| 599 unsigned m_contentOffsetInCompositingLayerDirty : 1; | 641 unsigned m_contentOffsetInCompositingLayerDirty : 1; |
| 600 | 642 |
| 601 unsigned m_pendingUpdateScope : 2; | 643 unsigned m_pendingUpdateScope : 2; |
| 602 unsigned m_isMainFrameLayoutViewLayer : 1; | 644 unsigned m_isMainFrameLayoutViewLayer : 1; |
| 603 | 645 |
| 604 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; | 646 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; |
| 605 unsigned m_scrollingContentsAreEmpty : 1; | 647 unsigned m_scrollingContentsAreEmpty : 1; |
| 606 | 648 |
| 607 // Keep track of whether the background is painted onto the scrolling contents
layer for invalidations. | 649 // Keep track of whether the background is painted onto the scrolling contents |
| 650 // layer for invalidations. |
| 608 unsigned m_backgroundPaintsOntoScrollingContentsLayer : 1; | 651 unsigned m_backgroundPaintsOntoScrollingContentsLayer : 1; |
| 609 | 652 |
| 610 friend class CompositedLayerMappingTest; | 653 friend class CompositedLayerMappingTest; |
| 611 }; | 654 }; |
| 612 | 655 |
| 613 } // namespace blink | 656 } // namespace blink |
| 614 | 657 |
| 615 #endif // CompositedLayerMapping_h | 658 #endif // CompositedLayerMapping_h |
| OLD | NEW |