| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Google Inc. All rights reserved. | 3 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 CompositingState compositingState = layer.compositingState(); | 47 CompositingState compositingState = layer.compositingState(); |
| 48 if (compositingState != NotComposited && | 48 if (compositingState != NotComposited && |
| 49 compositingState != PaintsIntoGroupedBacking) { | 49 compositingState != PaintsIntoGroupedBacking) { |
| 50 m_compositingAncestor = &layer; | 50 m_compositingAncestor = &layer; |
| 51 if (layer.stackingNode()->isStackingContext()) | 51 if (layer.stackingNode()->isStackingContext()) |
| 52 m_compositingStackingContext = &layer; | 52 m_compositingStackingContext = &layer; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 const PaintLayer* compositingContainer(const PaintLayer& layer) const { | 56 const PaintLayer* compositingContainer(const PaintLayer& layer) const { |
| 57 if (layer.stackingNode()->isStacked()) | 57 const PaintLayer* compositingContainer; |
| 58 return m_compositingStackingContext; | 58 if (layer.stackingNode()->isStacked()) { |
| 59 compositingContainer = m_compositingStackingContext; |
| 60 } else if ((layer.parent() && |
| 61 !layer.parent()->layoutObject().isLayoutBlock()) || |
| 62 layer.layoutObject().isColumnSpanAll()) { |
| 63 // In these cases, compositingContainer may escape the normal layer |
| 64 // hierarchy. Use the slow path to ensure correct result. |
| 65 // See PaintLayer::containingLayer() for details. |
| 66 compositingContainer = |
| 67 layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf); |
| 68 } else { |
| 69 compositingContainer = m_compositingAncestor; |
| 70 } |
| 59 | 71 |
| 60 // TODO(wangxianzhu, chrishtr): This is incorrect if m_compositingAncestor | 72 // We should always get the same result as the slow path. |
| 61 // is inline and there is any non-layer floating object between layer and | 73 DCHECK_EQ(compositingContainer, |
| 62 // m_compositingAncestor. Should use the logic in PaintLayer:: | 74 layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); |
| 63 // containingLayer(). | 75 return compositingContainer; |
| 64 if (layer.layoutObject().isFloatingWithNonContainingBlockParent()) | |
| 65 return layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf); | |
| 66 | |
| 67 return m_compositingAncestor; | |
| 68 } | 76 } |
| 69 | 77 |
| 70 const PaintLayer* compositingStackingContext() const { | 78 const PaintLayer* compositingStackingContext() const { |
| 71 return m_compositingStackingContext; | 79 return m_compositingStackingContext; |
| 72 } | 80 } |
| 73 | 81 |
| 74 private: | 82 private: |
| 75 const PaintLayer* m_compositingStackingContext; | 83 const PaintLayer* m_compositingStackingContext; |
| 76 const PaintLayer* m_compositingAncestor; | 84 const PaintLayer* m_compositingAncestor; |
| 77 }; | 85 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 | 99 |
| 92 void GraphicsLayerUpdater::updateRecursive( | 100 void GraphicsLayerUpdater::updateRecursive( |
| 93 PaintLayer& layer, | 101 PaintLayer& layer, |
| 94 UpdateType updateType, | 102 UpdateType updateType, |
| 95 const UpdateContext& context, | 103 const UpdateContext& context, |
| 96 Vector<PaintLayer*>& layersNeedingPaintInvalidation) { | 104 Vector<PaintLayer*>& layersNeedingPaintInvalidation) { |
| 97 if (layer.hasCompositedLayerMapping()) { | 105 if (layer.hasCompositedLayerMapping()) { |
| 98 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); | 106 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); |
| 99 | 107 |
| 100 if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) { | 108 if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) { |
| 101 const PaintLayer* compositingContainer = | |
| 102 context.compositingContainer(layer); | |
| 103 DCHECK_EQ(compositingContainer, | |
| 104 layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); | |
| 105 | |
| 106 if (mapping->updateGraphicsLayerConfiguration()) | 109 if (mapping->updateGraphicsLayerConfiguration()) |
| 107 m_needsRebuildTree = true; | 110 m_needsRebuildTree = true; |
| 108 | 111 mapping->updateGraphicsLayerGeometry(context.compositingContainer(layer), |
| 109 mapping->updateGraphicsLayerGeometry(compositingContainer, | |
| 110 context.compositingStackingContext(), | 112 context.compositingStackingContext(), |
| 111 layersNeedingPaintInvalidation); | 113 layersNeedingPaintInvalidation); |
| 112 if (PaintLayerScrollableArea* scrollableArea = layer.getScrollableArea()) | 114 if (PaintLayerScrollableArea* scrollableArea = layer.getScrollableArea()) |
| 113 scrollableArea->positionOverflowControls(); | 115 scrollableArea->positionOverflowControls(); |
| 114 updateType = mapping->updateTypeForChildren(updateType); | 116 updateType = mapping->updateTypeForChildren(updateType); |
| 115 mapping->clearNeedsGraphicsLayerUpdate(); | 117 mapping->clearNeedsGraphicsLayerUpdate(); |
| 116 } | 118 } |
| 117 } | 119 } |
| 118 | 120 |
| 119 UpdateContext childContext(context, layer); | 121 UpdateContext childContext(context, layer); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 132 ->assertNeedsToUpdateGraphicsLayerBitsCleared(); | 134 ->assertNeedsToUpdateGraphicsLayerBitsCleared(); |
| 133 | 135 |
| 134 for (PaintLayer* child = layer.firstChild(); child; | 136 for (PaintLayer* child = layer.firstChild(); child; |
| 135 child = child->nextSibling()) | 137 child = child->nextSibling()) |
| 136 assertNeedsToUpdateGraphicsLayerBitsCleared(*child); | 138 assertNeedsToUpdateGraphicsLayerBitsCleared(*child); |
| 137 } | 139 } |
| 138 | 140 |
| 139 #endif | 141 #endif |
| 140 | 142 |
| 141 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |