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 30 matching lines...) Expand all Loading... |
41 : m_renderView(renderView) | 41 : m_renderView(renderView) |
42 , m_pixelsWithoutPromotingAllTransitions(0.0) | 42 , m_pixelsWithoutPromotingAllTransitions(0.0) |
43 , m_pixelsAddedByPromotingAllTransitions(0.0) | 43 , m_pixelsAddedByPromotingAllTransitions(0.0) |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 GraphicsLayerUpdater::~GraphicsLayerUpdater() | 47 GraphicsLayerUpdater::~GraphicsLayerUpdater() |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, Vector<GraphicsLayer*
>& childLayersOfEnclosingLayer, int depth) | 51 void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType
, Vector<GraphicsLayer*>& childLayersOfEnclosingLayer, int depth) |
52 { | 52 { |
53 // Make the layer compositing if necessary, and set up clipping and content
layers. | 53 // Make the layer compositing if necessary, and set up clipping and content
layers. |
54 // Note that we can only do work here that is independent of whether the des
cendant layers | 54 // Note that we can only do work here that is independent of whether the des
cendant layers |
55 // have been processed. computeCompositingRequirements() will already have d
one the repaint if necessary. | 55 // have been processed. computeCompositingRequirements() will already have d
one the repaint if necessary. |
56 | 56 |
57 layer.stackingNode()->updateLayerListsIfNeeded(); | 57 layer.stackingNode()->updateLayerListsIfNeeded(); |
58 layer.update3dRenderingContext(); | 58 layer.update3dRenderingContext(); |
59 | 59 |
60 const bool hasCompositedLayerMapping = layer.hasCompositedLayerMapping(); | 60 const bool hasCompositedLayerMapping = layer.hasCompositedLayerMapping(); |
61 CompositedLayerMappingPtr currentCompositedLayerMapping = layer.compositedLa
yerMapping(); | 61 CompositedLayerMappingPtr currentCompositedLayerMapping = layer.compositedLa
yerMapping(); |
62 | 62 |
63 update(layer); | 63 updateType = update(layer, updateType); |
64 | 64 |
65 // Grab some stats for histograms. | 65 // Grab some stats for histograms. |
66 if (hasCompositedLayerMapping) { | 66 if (hasCompositedLayerMapping) { |
67 m_pixelsWithoutPromotingAllTransitions += layer.size().height() * layer.
size().width(); | 67 m_pixelsWithoutPromotingAllTransitions += layer.size().height() * layer.
size().width(); |
68 } else { | 68 } else { |
69 if ((layer.renderer()->style()->transitionForProperty(CSSPropertyOpacity
) || | 69 if ((layer.renderer()->style()->transitionForProperty(CSSPropertyOpacity
) || |
70 layer.renderer()->style()->transitionForProperty(CSSPropertyWebkitT
ransform)) && | 70 layer.renderer()->style()->transitionForProperty(CSSPropertyWebkitT
ransform)) && |
71 m_renderView.viewRect().intersects(layer.absoluteBoundingBox())) | 71 m_renderView.viewRect().intersects(layer.absoluteBoundingBox())) |
72 m_pixelsAddedByPromotingAllTransitions += layer.size().height() * la
yer.size().width(); | 72 m_pixelsAddedByPromotingAllTransitions += layer.size().height() * la
yer.size().width(); |
73 } | 73 } |
74 | 74 |
75 // If this layer has a compositedLayerMapping, then that is where we place s
ubsequent children GraphicsLayers. | 75 // 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. | 76 // Otherwise children continue to append to the child list of the enclosing
layer. |
77 Vector<GraphicsLayer*> layerChildren; | 77 Vector<GraphicsLayer*> layerChildren; |
78 Vector<GraphicsLayer*>& childList = hasCompositedLayerMapping ? layerChildre
n : childLayersOfEnclosingLayer; | 78 Vector<GraphicsLayer*>& childList = hasCompositedLayerMapping ? layerChildre
n : childLayersOfEnclosingLayer; |
79 | 79 |
80 #if !ASSERT_DISABLED | 80 #if !ASSERT_DISABLED |
81 LayerListMutationDetector mutationChecker(layer.stackingNode()); | 81 LayerListMutationDetector mutationChecker(layer.stackingNode()); |
82 #endif | 82 #endif |
83 | 83 |
84 if (layer.stackingNode()->isStackingContainer()) { | 84 if (layer.stackingNode()->isStackingContainer()) { |
85 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), Negative
ZOrderChildren); | 85 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), Negative
ZOrderChildren); |
86 while (RenderLayerStackingNode* curNode = iterator.next()) | 86 while (RenderLayerStackingNode* curNode = iterator.next()) |
87 rebuildTree(*curNode->layer(), childList, depth + 1); | 87 rebuildTree(*curNode->layer(), updateType, childList, depth + 1); |
88 | 88 |
89 // If a negative z-order child is compositing, we get a foreground layer
which needs to get parented. | 89 // If a negative z-order child is compositing, we get a foreground layer
which needs to get parented. |
90 if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregrou
ndLayer()) | 90 if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregrou
ndLayer()) |
91 childList.append(currentCompositedLayerMapping->foregroundLayer()); | 91 childList.append(currentCompositedLayerMapping->foregroundLayer()); |
92 } | 92 } |
93 | 93 |
94 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowCh
ildren | PositiveZOrderChildren); | 94 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowCh
ildren | PositiveZOrderChildren); |
95 while (RenderLayerStackingNode* curNode = iterator.next()) | 95 while (RenderLayerStackingNode* curNode = iterator.next()) |
96 rebuildTree(*curNode->layer(), childList, depth + 1); | 96 rebuildTree(*curNode->layer(), updateType, childList, depth + 1); |
97 | 97 |
98 if (hasCompositedLayerMapping) { | 98 if (hasCompositedLayerMapping) { |
99 bool parented = false; | 99 bool parented = false; |
100 if (layer.renderer()->isRenderPart()) | 100 if (layer.renderer()->isRenderPart()) |
101 parented = RenderLayerCompositor::parentFrameContentLayers(toRenderP
art(layer.renderer())); | 101 parented = RenderLayerCompositor::parentFrameContentLayers(toRenderP
art(layer.renderer())); |
102 | 102 |
103 if (!parented) | 103 if (!parented) |
104 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay
erChildren); | 104 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay
erChildren); |
105 | 105 |
106 // If the layer has a clipping layer the overflow controls layers will b
e siblings of the clipping layer. | 106 // If the layer has a clipping layer the overflow controls layers will b
e siblings of the clipping layer. |
(...skipping 18 matching lines...) Expand all Loading... |
125 childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childF
orSuperlayers()); | 125 childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childF
orSuperlayers()); |
126 } | 126 } |
127 | 127 |
128 if (!depth) { | 128 if (!depth) { |
129 int percentageIncreaseInPixels = static_cast<int>(m_pixelsAddedByPromoti
ngAllTransitions / m_pixelsWithoutPromotingAllTransitions * 100); | 129 int percentageIncreaseInPixels = static_cast<int>(m_pixelsAddedByPromoti
ngAllTransitions / m_pixelsWithoutPromotingAllTransitions * 100); |
130 blink::Platform::current()->histogramCustomCounts("Renderer.PixelIncreas
eFromTransitions", percentageIncreaseInPixels, 0, 1000, 50); | 130 blink::Platform::current()->histogramCustomCounts("Renderer.PixelIncreas
eFromTransitions", percentageIncreaseInPixels, 0, 1000, 50); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 // This just updates layer geometry without changing the hierarchy. | 134 // This just updates layer geometry without changing the hierarchy. |
135 void GraphicsLayerUpdater::updateRecursive(RenderLayer& layer) | 135 void GraphicsLayerUpdater::updateRecursive(RenderLayer& layer, UpdateType update
Type) |
136 { | 136 { |
137 update(layer); | 137 updateType = update(layer, updateType); |
138 | 138 |
139 #if !ASSERT_DISABLED | 139 #if !ASSERT_DISABLED |
140 LayerListMutationDetector mutationChecker(layer.stackingNode()); | 140 LayerListMutationDetector mutationChecker(layer.stackingNode()); |
141 #endif | 141 #endif |
142 | 142 |
143 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), AllChildren)
; | 143 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), AllChildren)
; |
144 while (RenderLayerStackingNode* curNode = iterator.next()) | 144 while (RenderLayerStackingNode* curNode = iterator.next()) |
145 updateRecursive(*curNode->layer()); | 145 updateRecursive(*curNode->layer(), updateType); |
146 } | 146 } |
147 | 147 |
148 void GraphicsLayerUpdater::update(RenderLayer& layer) | 148 GraphicsLayerUpdater::UpdateType GraphicsLayerUpdater::update(RenderLayer& layer
, UpdateType updateType) |
149 { | 149 { |
150 if (!layer.hasCompositedLayerMapping()) | 150 if (!layer.hasCompositedLayerMapping()) |
151 return; | 151 return updateType; |
152 | 152 |
153 CompositedLayerMappingPtr mapping = layer.compositedLayerMapping(); | 153 CompositedLayerMappingPtr mapping = layer.compositedLayerMapping(); |
154 | 154 |
155 // Note carefully: here we assume that the compositing state of all descenda
nts have been updated already, | 155 // Note carefully: here we assume that the compositing state of all descenda
nts have been updated already, |
156 // so it is legitimate to compute and cache the composited bounds for this l
ayer. | 156 // so it is legitimate to compute and cache the composited bounds for this l
ayer. |
157 mapping->updateCompositedBounds(); | 157 mapping->updateCompositedBounds(); |
158 | 158 |
159 if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) { | 159 if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) { |
160 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) | 160 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) |
161 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); | 161 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); |
162 } | 162 } |
163 | 163 |
164 mapping->updateGraphicsLayerConfiguration(); | 164 mapping->updateGraphicsLayerConfiguration(); |
165 mapping->updateGraphicsLayerGeometry(); | 165 updateType = mapping->updateGraphicsLayerGeometry(updateType); |
| 166 mapping->clearNeedsGeometryUpdate(); |
166 | 167 |
167 if (!layer.parent()) | 168 if (!layer.parent()) |
168 layer.compositor()->updateRootLayerPosition(); | 169 layer.compositor()->updateRootLayerPosition(); |
169 | 170 |
170 if (mapping->hasUnpositionedOverflowControlsLayers()) | 171 if (mapping->hasUnpositionedOverflowControlsLayers()) |
171 layer.scrollableArea()->positionOverflowControls(); | 172 layer.scrollableArea()->positionOverflowControls(); |
| 173 |
| 174 return updateType; |
172 } | 175 } |
173 | 176 |
174 } // namespace WebCore | 177 } // namespace WebCore |
OLD | NEW |