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 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 // + root content layer | 379 // + root content layer |
| 379 // | 380 // |
| 380 // With the hierarchy set up like this, the root content layer is able to sc roll without affecting | 381 // With the hierarchy set up like this, the root content layer is able to sc roll without affecting |
| 381 // the background layer (or repainting). | 382 // the background layer (or repainting). |
| 382 OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. | 383 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. | 384 OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. |
| 384 | 385 |
| 385 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; | 386 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; |
| 386 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; | 387 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; |
| 387 OwnPtr<GraphicsLayer> m_layerForScrollCorner; | 388 OwnPtr<GraphicsLayer> m_layerForScrollCorner; |
| 389 | |
| 390 // This layer exists to simplify the reparenting of overflow control that is occasionally required | |
| 391 // to ensure that scrollbars appear above scrolling content. | |
| 388 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; | 392 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; |
| 389 | 393 |
| 394 // The reparented overflow controls sometimes need to be clipped by a non-an cestor. In just the same | |
| 395 // way we need an ancestor clipping layer to clip this CLM's internal hierar chy, we add another layer | |
| 396 // to clip the overflow controls. It would be possible to make m_overflowCon trolsHostLayer be | |
| 397 // responsible for applying this clip, but that could require repositioning all of the overflow | |
| 398 // controls since the this clip may apply an offset. By using a separate lay er, the overflow controls | |
| 399 // can remain ignorant of the layers above them and still work correctly. | |
|
chrishtr
2014/07/24 18:44:57
Starting with a basic question..
Can you give me
| |
| 400 OwnPtr<GraphicsLayer> m_overflowControlsClippingLayer; | |
| 401 | |
| 390 // A squashing CLM has two possible squashing-related structures. | 402 // A squashing CLM has two possible squashing-related structures. |
| 391 // | 403 // |
| 392 // If m_ancestorClippingLayer is present: | 404 // If m_ancestorClippingLayer is present: |
| 393 // | 405 // |
| 394 // m_ancestorClippingLayer | 406 // m_ancestorClippingLayer |
| 395 // + m_graphicsLayer | 407 // + m_graphicsLayer |
| 396 // + m_squashingLayer | 408 // + m_squashingLayer |
| 397 // | 409 // |
| 398 // If not: | 410 // If not: |
| 399 // | 411 // |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 414 unsigned m_isMainFrameRenderViewLayer : 1; | 426 unsigned m_isMainFrameRenderViewLayer : 1; |
| 415 unsigned m_requiresOwnBackingStoreForIntrinsicReasons : 1; | 427 unsigned m_requiresOwnBackingStoreForIntrinsicReasons : 1; |
| 416 unsigned m_requiresOwnBackingStoreForAncestorReasons : 1; | 428 unsigned m_requiresOwnBackingStoreForAncestorReasons : 1; |
| 417 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; | 429 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; |
| 418 unsigned m_scrollingContentsAreEmpty : 1; | 430 unsigned m_scrollingContentsAreEmpty : 1; |
| 419 }; | 431 }; |
| 420 | 432 |
| 421 } // namespace blink | 433 } // namespace blink |
| 422 | 434 |
| 423 #endif // CompositedLayerMapping_h | 435 #endif // CompositedLayerMapping_h |
| OLD | NEW |