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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 | 63 |
64 void GraphicsLayerTreeBuilder::rebuild(RenderLayer& layer, AncestorInfo info) | 64 void GraphicsLayerTreeBuilder::rebuild(RenderLayer& layer, AncestorInfo info) |
65 { | 65 { |
66 // Make the layer compositing if necessary, and set up clipping and content
layers. | 66 // Make the layer compositing if necessary, and set up clipping and content
layers. |
67 // Note that we can only do work here that is independent of whether the des
cendant layers | 67 // Note that we can only do work here that is independent of whether the des
cendant layers |
68 // have been processed. computeCompositingRequirements() will already have d
one the paint invalidation if necessary. | 68 // have been processed. computeCompositingRequirements() will already have d
one the paint invalidation if necessary. |
69 | 69 |
70 layer.stackingNode()->updateLayerListsIfNeeded(); | 70 layer.stackingNode()->updateLayerListsIfNeeded(); |
71 | 71 |
72 const bool hasCompositedLayerMapping = layer.hasCompositedLayerMapping(); | |
73 CompositedLayerMapping* currentCompositedLayerMapping = layer.compositedLaye
rMapping(); | 72 CompositedLayerMapping* currentCompositedLayerMapping = layer.compositedLaye
rMapping(); |
74 | 73 |
75 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. | 74 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. |
76 // Otherwise children continue to append to the child list of the enclosing
layer. | 75 // Otherwise children continue to append to the child list of the enclosing
layer. |
77 GraphicsLayerVector layerChildren; | 76 GraphicsLayerVector layerChildren; |
78 AncestorInfo infoForChildren(info); | 77 AncestorInfo infoForChildren(info); |
79 if (hasCompositedLayerMapping) { | 78 if (currentCompositedLayerMapping) { |
80 infoForChildren.childLayersOfEnclosingCompositedLayer = &layerChildren; | 79 infoForChildren.childLayersOfEnclosingCompositedLayer = &layerChildren; |
81 infoForChildren.enclosingCompositedLayer = &layer; | 80 infoForChildren.enclosingCompositedLayer = &layer; |
82 } | 81 } |
83 | 82 |
84 #if ENABLE(ASSERT) | 83 #if ENABLE(ASSERT) |
85 LayerListMutationDetector mutationChecker(layer.stackingNode()); | 84 LayerListMutationDetector mutationChecker(layer.stackingNode()); |
86 #endif | 85 #endif |
87 | 86 |
88 if (layer.stackingNode()->isStackingContext()) { | 87 if (layer.stackingNode()->isStackingContext()) { |
89 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), Negative
ZOrderChildren); | 88 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), Negative
ZOrderChildren); |
90 while (RenderLayerStackingNode* curNode = iterator.next()) | 89 while (RenderLayerStackingNode* curNode = iterator.next()) |
91 rebuild(*curNode->layer(), infoForChildren); | 90 rebuild(*curNode->layer(), infoForChildren); |
92 | 91 |
93 // If a negative z-order child is compositing, we get a foreground layer
which needs to get parented. | 92 // If a negative z-order child is compositing, we get a foreground layer
which needs to get parented. |
94 if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregrou
ndLayer()) | 93 if (currentCompositedLayerMapping && currentCompositedLayerMapping->fore
groundLayer()) |
95 infoForChildren.childLayersOfEnclosingCompositedLayer->append(curren
tCompositedLayerMapping->foregroundLayer()); | 94 infoForChildren.childLayersOfEnclosingCompositedLayer->append(curren
tCompositedLayerMapping->foregroundLayer()); |
96 } | 95 } |
97 | 96 |
98 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowCh
ildren | PositiveZOrderChildren); | 97 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowCh
ildren | PositiveZOrderChildren); |
99 while (RenderLayerStackingNode* curNode = iterator.next()) | 98 while (RenderLayerStackingNode* curNode = iterator.next()) |
100 rebuild(*curNode->layer(), infoForChildren); | 99 rebuild(*curNode->layer(), infoForChildren); |
101 | 100 |
102 if (hasCompositedLayerMapping) { | 101 if (currentCompositedLayerMapping) { |
103 bool parented = false; | 102 bool parented = false; |
104 if (layer.renderer()->isRenderPart()) | 103 if (layer.renderer()->isRenderPart()) |
105 parented = RenderLayerCompositor::parentFrameContentLayers(toRenderP
art(layer.renderer())); | 104 parented = RenderLayerCompositor::parentFrameContentLayers(toRenderP
art(layer.renderer())); |
106 | 105 |
107 if (!parented) | 106 if (!parented) |
108 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay
erChildren); | 107 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay
erChildren); |
109 | 108 |
110 // If the layer has a clipping layer the overflow controls layers will b
e siblings of the clipping layer. | 109 // If the layer has a clipping layer the overflow controls layers will b
e siblings of the clipping layer. |
111 // Otherwise, the overflow control layers are normal children. | 110 // Otherwise, the overflow control layers are normal children. |
112 // FIXME: Why isn't this handled in CLM updateInternalHierarchy? | 111 // FIXME: Why isn't this handled in CLM updateInternalHierarchy? |
(...skipping 11 matching lines...) Expand all Loading... |
124 if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapp
ing->layerForScrollCorner()) { | 123 if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapp
ing->layerForScrollCorner()) { |
125 overflowControlLayer->removeFromParent(); | 124 overflowControlLayer->removeFromParent(); |
126 currentCompositedLayerMapping->parentForSublayers()->addChild(ov
erflowControlLayer); | 125 currentCompositedLayerMapping->parentForSublayers()->addChild(ov
erflowControlLayer); |
127 } | 126 } |
128 } | 127 } |
129 | 128 |
130 if (shouldAppendLayer(layer)) | 129 if (shouldAppendLayer(layer)) |
131 info.childLayersOfEnclosingCompositedLayer->append(currentComposited
LayerMapping->childForSuperlayers()); | 130 info.childLayersOfEnclosingCompositedLayer->append(currentComposited
LayerMapping->childForSuperlayers()); |
132 } | 131 } |
133 | 132 |
134 if (layer.scrollParent() | 133 if (!layer.scrollParent()) |
135 && layer.scrollParent()->hasCompositedLayerMapping() | 134 return; |
136 && layer.scrollParent()->compositedLayerMapping()->needsToReparentOverfl
owControls() | 135 |
137 && layer.scrollParent()->scrollableArea()->topmostScrollChild() == &laye
r) | 136 CompositedLayerMapping* scrollParentCompositedLayerMapping = layer.scrollPar
ent()->compositedLayerMapping(); |
138 info.childLayersOfEnclosingCompositedLayer->append(layer.scrollParent()-
>compositedLayerMapping()->detachLayerForOverflowControls(*info.enclosingComposi
tedLayer)); | 137 if (layer.scrollParent()->scrollableArea()->topmostScrollChild() == &layer |
| 138 &&scrollParentCompositedLayerMapping |
| 139 && scrollParentCompositedLayerMapping->needsToReparentOverflowControls()
) |
| 140 info.childLayersOfEnclosingCompositedLayer->append(scrollParentComposite
dLayerMapping->detachLayerForOverflowControls(*info.enclosingCompositedLayer)); |
139 } | 141 } |
140 | 142 |
141 } | 143 } |
OLD | NEW |