Chromium Code Reviews| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 | 54 |
| 55 GraphicsLayerPaintInfo() : paintLayer(nullptr), offsetFromLayoutObjectSet(fa lse) { } | 55 GraphicsLayerPaintInfo() : paintLayer(nullptr), offsetFromLayoutObjectSet(fa lse) { } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 enum GraphicsLayerUpdateScope { | 58 enum GraphicsLayerUpdateScope { |
| 59 GraphicsLayerUpdateNone, | 59 GraphicsLayerUpdateNone, |
| 60 GraphicsLayerUpdateLocal, | 60 GraphicsLayerUpdateLocal, |
| 61 GraphicsLayerUpdateSubtree, | 61 GraphicsLayerUpdateSubtree, |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // CompositedLayerMapping keeps track of how Layers of the layout tree correspon d to | 64 // CompositedLayerMapping keeps track of how PaintLayers correspond to |
| 65 // GraphicsLayers of the composited layer tree. Each instance of CompositedLayer Mapping | 65 // GraphicsLayers of the composited layer tree. Each instance of CompositedLayer Mapping |
| 66 // manages a small cluster of GraphicsLayers and the references to which Layers | 66 // manages a small cluster of GraphicsLayers and the references to which Layers |
| 67 // and paint phases contribute to each GraphicsLayer. | 67 // and paint phases contribute to each GraphicsLayer. |
| 68 // | 68 // |
| 69 // Currently (Oct. 2013) there is one CompositedLayerMapping for each Layer, | 69 // - If a PaintLayer is composited, |
| 70 // but this is likely to evolve soon. | 70 // - if it paints into its own backings (GraphicsLayers), it owns a |
| 71 // CompositedLayerMapping (PaintLayer::compositedLayerMapping()) to keep | |
| 72 // track the backings; | |
| 73 // - if it paints into grouped backing (i.e. it's squashed), it has a pointer | |
| 74 // (PaintLayer::groupedMapping()) to the CompositedLayerMapping into which | |
| 75 // the layer is squashed; | |
|
chrishtr
2016/01/28 18:04:29
s/layer/PaintLayer/
Xianzhu
2016/01/28 18:30:30
Done.
| |
| 76 // - Otherwise the layer doesn't own or directly reference any CompositedLayerMa pping. | |
|
chrishtr
2016/01/28 18:04:29
s/layer/PaintLayer/
Xianzhu
2016/01/28 18:30:30
Done.
| |
| 71 class CORE_EXPORT CompositedLayerMapping final : public GraphicsLayerClient { | 77 class CORE_EXPORT CompositedLayerMapping final : public GraphicsLayerClient { |
| 72 | 78 |
| 73 WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); USING_FAST_MALLOC(CompositedLa yerMapping); | 79 WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); USING_FAST_MALLOC(CompositedLa yerMapping); |
| 74 public: | 80 public: |
| 75 explicit CompositedLayerMapping(PaintLayer&); | 81 explicit CompositedLayerMapping(PaintLayer&); |
| 76 ~CompositedLayerMapping() override; | 82 ~CompositedLayerMapping() override; |
| 77 | 83 |
| 78 PaintLayer& owningLayer() const { return m_owningLayer; } | 84 PaintLayer& owningLayer() const { return m_owningLayer; } |
| 79 | 85 |
| 80 bool updateGraphicsLayerConfiguration(); | 86 bool updateGraphicsLayerConfiguration(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 bool updateChildTransformLayer(bool needsChildTransformLayer); | 252 bool updateChildTransformLayer(bool needsChildTransformLayer); |
| 247 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n eedsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip) ; | 253 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n eedsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip) ; |
| 248 bool updateForegroundLayer(bool needsForegroundLayer); | 254 bool updateForegroundLayer(bool needsForegroundLayer); |
| 249 bool updateBackgroundLayer(bool needsBackgroundLayer); | 255 bool updateBackgroundLayer(bool needsBackgroundLayer); |
| 250 bool updateMaskLayer(bool needsMaskLayer); | 256 bool updateMaskLayer(bool needsMaskLayer); |
| 251 void updateChildClippingMaskLayer(bool needsChildClippingMaskLayer); | 257 void updateChildClippingMaskLayer(bool needsChildClippingMaskLayer); |
| 252 bool requiresHorizontalScrollbarLayer() const { return m_owningLayer.scrolla bleArea() && m_owningLayer.scrollableArea()->horizontalScrollbar(); } | 258 bool requiresHorizontalScrollbarLayer() const { return m_owningLayer.scrolla bleArea() && m_owningLayer.scrollableArea()->horizontalScrollbar(); } |
| 253 bool requiresVerticalScrollbarLayer() const { return m_owningLayer.scrollabl eArea() && m_owningLayer.scrollableArea()->verticalScrollbar(); } | 259 bool requiresVerticalScrollbarLayer() const { return m_owningLayer.scrollabl eArea() && m_owningLayer.scrollableArea()->verticalScrollbar(); } |
| 254 bool requiresScrollCornerLayer() const { return m_owningLayer.scrollableArea () && !m_owningLayer.scrollableArea()->scrollCornerAndResizerRect().isEmpty(); } | 260 bool requiresScrollCornerLayer() const { return m_owningLayer.scrollableArea () && !m_owningLayer.scrollableArea()->scrollCornerAndResizerRect().isEmpty(); } |
| 255 bool updateScrollingLayers(bool scrollingLayers); | 261 bool updateScrollingLayers(bool scrollingLayers); |
| 256 void updateScrollParent(PaintLayer*); | 262 void updateScrollParent(const PaintLayer*); |
| 257 void updateClipParent(PaintLayer* scrollParent); | 263 void updateClipParent(const PaintLayer* scrollParent); |
| 258 bool updateSquashingLayers(bool needsSquashingLayers); | 264 bool updateSquashingLayers(bool needsSquashingLayers); |
| 259 void updateDrawsContent(); | 265 void updateDrawsContent(); |
| 260 void updateChildrenTransform(); | 266 void updateChildrenTransform(); |
| 261 void updateCompositedBounds(); | 267 void updateCompositedBounds(); |
| 262 void registerScrollingLayers(); | 268 void registerScrollingLayers(); |
| 263 | 269 |
| 264 // Also sets subpixelAccumulation on the layer. | 270 // Also sets subpixelAccumulation on the layer. |
| 265 void computeBoundsOfOwningLayer(const PaintLayer* compositedAncestor, IntRec t& localCompositingBounds, IntRect& compositingBoundsRelativeToCompositedAncesto r, LayoutPoint& offsetFromCompositedAncestor, IntPoint& snappedOffsetFromComposi tedAncestor); | 271 void computeBoundsOfOwningLayer(const PaintLayer* compositedAncestor, IntRec t& localCompositingBounds, IntRect& compositingBoundsRelativeToCompositedAncesto r, LayoutPoint& offsetFromCompositedAncestor, IntPoint& snappedOffsetFromComposi tedAncestor); |
| 266 | 272 |
| 267 void setBackgroundLayerPaintsFixedRootBackground(bool); | 273 void setBackgroundLayerPaintsFixedRootBackground(bool); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 | 305 |
| 300 // Computes the background clip rect for the given squashed layer, up to any containing layer that is squashed into the | 306 // Computes the background clip rect for the given squashed layer, up to any containing layer that is squashed into the |
| 301 // same squashing layer and contains this squashed layer's clipping ancestor . | 307 // same squashing layer and contains this squashed layer's clipping ancestor . |
| 302 // The clip rect is returned in the coordinate space of the given squashed l ayer. | 308 // The clip rect is returned in the coordinate space of the given squashed l ayer. |
| 303 // If there is no such containing layer, returns the infinite rect. | 309 // If there is no such containing layer, returns the infinite rect. |
| 304 // FIXME: unify this code with the code that sets up m_ancestorClippingLayer . They are doing very similar things. | 310 // FIXME: unify this code with the code that sets up m_ancestorClippingLayer . They are doing very similar things. |
| 305 static IntRect localClipRectForSquashedLayer(const PaintLayer& referenceLaye r, const GraphicsLayerPaintInfo&, const Vector<GraphicsLayerPaintInfo>& layers) ; | 311 static IntRect localClipRectForSquashedLayer(const PaintLayer& referenceLaye r, const GraphicsLayerPaintInfo&, const Vector<GraphicsLayerPaintInfo>& layers) ; |
| 306 | 312 |
| 307 // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (inclusive) of the | 313 // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (inclusive) of the |
| 308 // clipping container for |m_owningLayer|. | 314 // clipping container for |m_owningLayer|. |
| 309 bool owningLayerClippedByLayerNotAboveCompositedAncestor(PaintLayer* scrollP arent); | 315 bool owningLayerClippedByLayerNotAboveCompositedAncestor(const PaintLayer* s crollParent); |
| 310 | 316 |
| 311 PaintLayer* scrollParent(); | 317 const PaintLayer* scrollParent(); |
| 312 | 318 |
| 313 // Clear the groupedMapping entry on the layer at the given index, only if t hat layer does | 319 // Clear the groupedMapping entry on the layer at the given index, only if t hat layer does |
| 314 // not appear earlier in the set of layers for this object. | 320 // not appear earlier in the set of layers for this object. |
| 315 bool invalidateLayerIfNoPrecedingEntry(size_t); | 321 bool invalidateLayerIfNoPrecedingEntry(size_t); |
| 316 | 322 |
| 317 PaintLayer& m_owningLayer; | 323 PaintLayer& m_owningLayer; |
| 318 | 324 |
| 319 // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this: | 325 // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this: |
| 320 // | 326 // |
| 321 // + m_ancestorClippingLayer [OPTIONAL] | 327 // + m_ancestorClippingLayer [OPTIONAL] |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 | 443 |
| 438 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; | 444 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; |
| 439 unsigned m_scrollingContentsAreEmpty : 1; | 445 unsigned m_scrollingContentsAreEmpty : 1; |
| 440 | 446 |
| 441 friend class CompositedLayerMappingTest; | 447 friend class CompositedLayerMappingTest; |
| 442 }; | 448 }; |
| 443 | 449 |
| 444 } // namespace blink | 450 } // namespace blink |
| 445 | 451 |
| 446 #endif // CompositedLayerMapping_h | 452 #endif // CompositedLayerMapping_h |
| OLD | NEW |