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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 // but this is likely to evolve soon. | 83 // but this is likely to evolve soon. |
84 class CompositedLayerMapping FINAL : public GraphicsLayerClient { | 84 class CompositedLayerMapping FINAL : public GraphicsLayerClient { |
85 WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); WTF_MAKE_FAST_ALLOCATED; | 85 WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); WTF_MAKE_FAST_ALLOCATED; |
86 public: | 86 public: |
87 explicit CompositedLayerMapping(RenderLayer&); | 87 explicit CompositedLayerMapping(RenderLayer&); |
88 virtual ~CompositedLayerMapping(); | 88 virtual ~CompositedLayerMapping(); |
89 | 89 |
90 RenderLayer& owningLayer() const { return m_owningLayer; } | 90 RenderLayer& owningLayer() const { return m_owningLayer; } |
91 | 91 |
92 bool updateGraphicsLayerConfiguration(); | 92 bool updateGraphicsLayerConfiguration(); |
93 void updateGraphicsLayerGeometry(const RenderLayer* compositingContainer, Ve ctor<RenderLayer*>& layersNeedingPaintInvalidation); | 93 void updateGraphicsLayerGeometry(const RenderLayer* compositingContainer, co nst RenderLayer* compositingStackingContext, Vector<RenderLayer*>& layersNeeding PaintInvalidation); |
94 | 94 |
95 // Update whether layer needs blending. | 95 // Update whether layer needs blending. |
96 void updateContentsOpaque(); | 96 void updateContentsOpaque(); |
97 | 97 |
98 GraphicsLayer* mainGraphicsLayer() const { return m_graphicsLayer.get(); } | 98 GraphicsLayer* mainGraphicsLayer() const { return m_graphicsLayer.get(); } |
99 | 99 |
100 // Layer to clip children | 100 // Layer to clip children |
101 bool hasClippingLayer() const { return m_childContainmentLayer; } | 101 bool hasClippingLayer() const { return m_childContainmentLayer; } |
102 GraphicsLayer* clippingLayer() const { return m_childContainmentLayer.get(); } | 102 GraphicsLayer* clippingLayer() const { return m_childContainmentLayer.get(); } |
103 | 103 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 void updateScrollingBlockSelection(); | 219 void updateScrollingBlockSelection(); |
220 | 220 |
221 private: | 221 private: |
222 static const GraphicsLayerPaintInfo* containingSquashedLayer(const RenderObj ect*, const Vector<GraphicsLayerPaintInfo>& layers); | 222 static const GraphicsLayerPaintInfo* containingSquashedLayer(const RenderObj ect*, const Vector<GraphicsLayerPaintInfo>& layers); |
223 | 223 |
224 // Helper methods to updateGraphicsLayerGeometry: | 224 // Helper methods to updateGraphicsLayerGeometry: |
225 void computeGraphicsLayerParentLocation(const RenderLayer* compositingContai ner, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLoca tion); | 225 void computeGraphicsLayerParentLocation(const RenderLayer* compositingContai ner, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLoca tion); |
226 void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAnc estor, const IntPoint& graphicsLayerParentLocation, const RenderLayer& reference Layer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offs etFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintInvalidation) ; | 226 void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAnc estor, const IntPoint& graphicsLayerParentLocation, const RenderLayer& reference Layer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offs etFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintInvalidation) ; |
227 void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBound s, const IntRect& localCompositingBounds, IntPoint& graphicsLayerParentLocation) ; | 227 void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBound s, const IntRect& localCompositingBounds, IntPoint& graphicsLayerParentLocation) ; |
228 void updateAncestorClippingLayerGeometry(const RenderLayer* compositingConta iner, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLay erParentLocation); | 228 void updateAncestorClippingLayerGeometry(const RenderLayer* compositingConta iner, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLay erParentLocation); |
229 void updateOverflowControlsHostLayerGeometry(const RenderLayer* compositingS tackingContext); | |
229 void updateChildContainmentLayerGeometry(const IntRect& clippingBox, const I ntRect& localCompositingBounds); | 230 void updateChildContainmentLayerGeometry(const IntRect& clippingBox, const I ntRect& localCompositingBounds); |
230 void updateChildTransformLayerGeometry(); | 231 void updateChildTransformLayerGeometry(); |
231 void updateMaskLayerGeometry(); | 232 void updateMaskLayerGeometry(); |
232 void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAnce stor, const IntRect& relativeCompositingBounds); | 233 void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAnce stor, const IntRect& relativeCompositingBounds); |
233 void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBound sSize, const IntRect& clippingBox); | 234 void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBound sSize, const IntRect& clippingBox); |
234 void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBound sSize); | 235 void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBound sSize); |
235 void updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintI nvalidation); | 236 void updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintI nvalidation); |
236 void updateScrollingLayerGeometry(const IntRect& localCompositingBounds); | 237 void updateScrollingLayerGeometry(const IntRect& localCompositingBounds); |
237 void updateChildClippingMaskLayerGeometry(); | 238 void updateChildClippingMaskLayerGeometry(); |
238 | 239 |
239 void createPrimaryGraphicsLayer(); | 240 void createPrimaryGraphicsLayer(); |
240 void destroyGraphicsLayers(); | 241 void destroyGraphicsLayers(); |
241 | 242 |
242 PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons); | 243 PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons); |
243 bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, C ompositingReasons); | 244 bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, C ompositingReasons); |
244 | 245 |
245 RenderLayerModelObject* renderer() const { return m_owningLayer.renderer(); } | 246 RenderLayerModelObject* renderer() const { return m_owningLayer.renderer(); } |
246 RenderLayerCompositor* compositor() const { return m_owningLayer.compositor( ); } | 247 RenderLayerCompositor* compositor() const { return m_owningLayer.compositor( ); } |
247 | 248 |
248 void updateInternalHierarchy(); | 249 void updateInternalHierarchy(); |
249 void updatePaintingPhases(); | 250 void updatePaintingPhases(); |
250 bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); | 251 bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); |
251 bool updateChildTransformLayer(bool needsChildTransformLayer); | 252 bool updateChildTransformLayer(bool needsChildTransformLayer); |
252 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n eedsVerticalScrollbarLayer, bool needsScrollCornerLayer); | 253 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n eedsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip) ; |
253 bool updateForegroundLayer(bool needsForegroundLayer); | 254 bool updateForegroundLayer(bool needsForegroundLayer); |
254 bool updateBackgroundLayer(bool needsBackgroundLayer); | 255 bool updateBackgroundLayer(bool needsBackgroundLayer); |
255 bool updateMaskLayer(bool needsMaskLayer); | 256 bool updateMaskLayer(bool needsMaskLayer); |
256 bool updateClippingMaskLayers(bool needsChildClippingMaskLayer); | 257 bool updateClippingMaskLayers(bool needsChildClippingMaskLayer); |
257 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(); } |
258 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(); } |
259 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(); } |
260 bool updateScrollingLayers(bool scrollingLayers); | 261 bool updateScrollingLayers(bool scrollingLayers); |
261 void updateScrollParent(RenderLayer*); | 262 void updateScrollParent(RenderLayer*); |
262 void updateClipParent(); | 263 void updateClipParent(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 // clipping container for |m_owningLayer|. | 314 // clipping container for |m_owningLayer|. |
314 bool owningLayerClippedByLayerNotAboveCompositedAncestor(); | 315 bool owningLayerClippedByLayerNotAboveCompositedAncestor(); |
315 | 316 |
316 RenderLayer& m_owningLayer; | 317 RenderLayer& m_owningLayer; |
317 | 318 |
318 // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this: | 319 // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this: |
319 // | 320 // |
320 // + m_ancestorClippingLayer [OPTIONAL] | 321 // + m_ancestorClippingLayer [OPTIONAL] |
321 // + m_graphicsLayer | 322 // + m_graphicsLayer |
322 // + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTI ONAL] <-OR-> m_childTransformLayer | 323 // + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTI ONAL] <-OR-> m_childTransformLayer |
323 // + m_scrollingContents Layer [Present iff m_scrollingLayer is present] | 324 // | + m_scrollingContents Layer [Present iff m_scrollingLayer is present] |
324 // + m_scrollingBlock SelectionLayer [Present iff m_scrollingLayer is present] | 325 // | + m_scrollingBlock SelectionLayer [Present iff m_scrollingLayer is present] |
326 // | | |
327 // + m_overflowControlsClippingLayer [OPTIONAL] // *The overflow cont rols may need to be repositioned in the | |
chrishtr
2014/07/25 18:00:33
Is it positioned here, or is it a sibling of m_gra
Ian Vollick
2014/07/25 18:19:51
If the overflow controls need to be reparented (an
| |
328 // + m_overflowControlsHostLayer // graphics layer tr ee by the RLC to ensure that they stack | |
329 // + m_layerForVerticalScrollbar // above scrolling c ontent. | |
330 // + m_layerForHorizontalScrollbar | |
331 // + m_layerForScrollCorner | |
325 // | 332 // |
326 // We need an ancestor clipping layer if our clipping ancestor is not our an cestor in the | 333 // We need an ancestor clipping layer if our clipping ancestor is not our an cestor in the |
327 // clipping tree. Here's what that might look like. | 334 // clipping tree. Here's what that might look like. |
328 // | 335 // |
329 // Let A = the clipping ancestor, | 336 // Let A = the clipping ancestor, |
330 // B = the clip descendant, and | 337 // B = the clip descendant, and |
331 // SC = the stacking context that is the ancestor of A and B in the stac king tree. | 338 // SC = the stacking context that is the ancestor of A and B in the stac king tree. |
332 // | 339 // |
333 // SC | 340 // SC |
334 // + A = m_graphicsLayer | 341 // + A = m_graphicsLayer |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 // + root content layer | 385 // + root content layer |
379 // | 386 // |
380 // With the hierarchy set up like this, the root content layer is able to sc roll without affecting | 387 // With the hierarchy set up like this, the root content layer is able to sc roll without affecting |
381 // the background layer (or repainting). | 388 // the background layer (or repainting). |
382 OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. | 389 OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. |
383 OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. | 390 OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. |
384 | 391 |
385 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; | 392 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; |
386 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; | 393 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; |
387 OwnPtr<GraphicsLayer> m_layerForScrollCorner; | 394 OwnPtr<GraphicsLayer> m_layerForScrollCorner; |
395 | |
396 // This layer exists to simplify the reparenting of overflow control that is occasionally required | |
397 // to ensure that scrollbars appear above scrolling content. | |
388 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; | 398 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; |
389 | 399 |
400 // The reparented overflow controls sometimes need to be clipped by a non-an cestor. In just the same | |
401 // way we need an ancestor clipping layer to clip this CLM's internal hierar chy, we add another layer | |
402 // to clip the overflow controls. It would be possible to make m_overflowCon trolsHostLayer be | |
403 // responsible for applying this clip, but that could require repositioning all of the overflow | |
404 // controls since the this clip may apply an offset. By using a separate lay er, the overflow controls | |
405 // can remain ignorant of the layers above them and still work correctly. | |
406 OwnPtr<GraphicsLayer> m_overflowControlsClippingLayer; | |
407 | |
390 // A squashing CLM has two possible squashing-related structures. | 408 // A squashing CLM has two possible squashing-related structures. |
391 // | 409 // |
392 // If m_ancestorClippingLayer is present: | 410 // If m_ancestorClippingLayer is present: |
393 // | 411 // |
394 // m_ancestorClippingLayer | 412 // m_ancestorClippingLayer |
395 // + m_graphicsLayer | 413 // + m_graphicsLayer |
396 // + m_squashingLayer | 414 // + m_squashingLayer |
397 // | 415 // |
398 // If not: | 416 // If not: |
399 // | 417 // |
(...skipping 14 matching lines...) Expand all Loading... | |
414 unsigned m_isMainFrameRenderViewLayer : 1; | 432 unsigned m_isMainFrameRenderViewLayer : 1; |
415 unsigned m_requiresOwnBackingStoreForIntrinsicReasons : 1; | 433 unsigned m_requiresOwnBackingStoreForIntrinsicReasons : 1; |
416 unsigned m_requiresOwnBackingStoreForAncestorReasons : 1; | 434 unsigned m_requiresOwnBackingStoreForAncestorReasons : 1; |
417 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; | 435 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; |
418 unsigned m_scrollingContentsAreEmpty : 1; | 436 unsigned m_scrollingContentsAreEmpty : 1; |
419 }; | 437 }; |
420 | 438 |
421 } // namespace blink | 439 } // namespace blink |
422 | 440 |
423 #endif // CompositedLayerMapping_h | 441 #endif // CompositedLayerMapping_h |
OLD | NEW |