Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Side by Side Diff: Source/core/rendering/compositing/GraphicsLayerUpdater.cpp

Issue 215063006: Separate the geometry update from rebuilding the GraphicsLayer tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 GraphicsLayerUpdater::GraphicsLayerUpdater() 51 GraphicsLayerUpdater::GraphicsLayerUpdater()
52 { 52 {
53 } 53 }
54 54
55 GraphicsLayerUpdater::~GraphicsLayerUpdater() 55 GraphicsLayerUpdater::~GraphicsLayerUpdater()
56 { 56 {
57 } 57 }
58 58
59 void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, UpdateType updateType , GraphicsLayerVector& childLayersOfEnclosingLayer) 59 void GraphicsLayerUpdater::rebuildTree(RenderLayer& layer, GraphicsLayerVector& childLayersOfEnclosingLayer)
60 { 60 {
61 // Make the layer compositing if necessary, and set up clipping and content layers. 61 // Make the layer compositing if necessary, and set up clipping and content layers.
62 // Note that we can only do work here that is independent of whether the des cendant layers 62 // Note that we can only do work here that is independent of whether the des cendant layers
63 // have been processed. computeCompositingRequirements() will already have d one the repaint if necessary. 63 // have been processed. computeCompositingRequirements() will already have d one the repaint if necessary.
64 64
65 layer.stackingNode()->updateLayerListsIfNeeded(); 65 layer.stackingNode()->updateLayerListsIfNeeded();
66 66
67 const bool hasCompositedLayerMapping = layer.hasCompositedLayerMapping(); 67 const bool hasCompositedLayerMapping = layer.hasCompositedLayerMapping();
68 CompositedLayerMappingPtr currentCompositedLayerMapping = layer.compositedLa yerMapping(); 68 CompositedLayerMappingPtr currentCompositedLayerMapping = layer.compositedLa yerMapping();
69 69
70 updateType = update(layer, updateType);
71
72 // If this layer has a compositedLayerMapping, then that is where we place s ubsequent children GraphicsLayers. 70 // If this layer has a compositedLayerMapping, then that is where we place s ubsequent children GraphicsLayers.
73 // Otherwise children continue to append to the child list of the enclosing layer. 71 // Otherwise children continue to append to the child list of the enclosing layer.
74 GraphicsLayerVector layerChildren; 72 GraphicsLayerVector layerChildren;
75 GraphicsLayerVector& childList = hasCompositedLayerMapping ? layerChildren : childLayersOfEnclosingLayer; 73 GraphicsLayerVector& childList = hasCompositedLayerMapping ? layerChildren : childLayersOfEnclosingLayer;
76 74
77 #if !ASSERT_DISABLED 75 #if !ASSERT_DISABLED
78 LayerListMutationDetector mutationChecker(layer.stackingNode()); 76 LayerListMutationDetector mutationChecker(layer.stackingNode());
79 #endif 77 #endif
80 78
81 if (layer.stackingNode()->isStackingContainer()) { 79 if (layer.stackingNode()->isStackingContainer()) {
82 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), Negative ZOrderChildren); 80 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), Negative ZOrderChildren);
83 while (RenderLayerStackingNode* curNode = iterator.next()) 81 while (RenderLayerStackingNode* curNode = iterator.next())
84 rebuildTree(*curNode->layer(), updateType, childList); 82 rebuildTree(*curNode->layer(), childList);
85 83
86 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented. 84 // If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
87 if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregrou ndLayer()) 85 if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregrou ndLayer())
88 childList.append(currentCompositedLayerMapping->foregroundLayer()); 86 childList.append(currentCompositedLayerMapping->foregroundLayer());
89 } 87 }
90 88
91 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowCh ildren | PositiveZOrderChildren); 89 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowCh ildren | PositiveZOrderChildren);
92 while (RenderLayerStackingNode* curNode = iterator.next()) 90 while (RenderLayerStackingNode* curNode = iterator.next())
93 rebuildTree(*curNode->layer(), updateType, childList); 91 rebuildTree(*curNode->layer(), childList);
94 92
95 if (hasCompositedLayerMapping) { 93 if (hasCompositedLayerMapping) {
96 bool parented = false; 94 bool parented = false;
97 if (layer.renderer()->isRenderPart()) 95 if (layer.renderer()->isRenderPart())
98 parented = RenderLayerCompositor::parentFrameContentLayers(toRenderP art(layer.renderer())); 96 parented = RenderLayerCompositor::parentFrameContentLayers(toRenderP art(layer.renderer()));
99 97
100 if (!parented) 98 if (!parented)
101 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay erChildren); 99 currentCompositedLayerMapping->parentForSublayers()->setChildren(lay erChildren);
102 100
103 // If the layer has a clipping layer the overflow controls layers will b e siblings of the clipping layer. 101 // If the layer has a clipping layer the overflow controls layers will b e siblings of the clipping layer.
(...skipping 13 matching lines...) Expand all
117 overflowControlLayer->removeFromParent(); 115 overflowControlLayer->removeFromParent();
118 currentCompositedLayerMapping->parentForSublayers()->addChild(ov erflowControlLayer); 116 currentCompositedLayerMapping->parentForSublayers()->addChild(ov erflowControlLayer);
119 } 117 }
120 } 118 }
121 119
122 if (shouldAppendLayer(layer)) 120 if (shouldAppendLayer(layer))
123 childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->ch ildForSuperlayers()); 121 childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->ch ildForSuperlayers());
124 } 122 }
125 } 123 }
126 124
127 // This just updates layer geometry without changing the hierarchy. 125 void GraphicsLayerUpdater::update(RenderLayer& layer, UpdateType updateType)
128 void GraphicsLayerUpdater::updateRecursive(RenderLayer& layer, UpdateType update Type)
129 { 126 {
130 updateType = update(layer, updateType); 127 if (layer.hasCompositedLayerMapping()) {
128 CompositedLayerMappingPtr mapping = layer.compositedLayerMapping();
131 129
132 #if !ASSERT_DISABLED 130 // Note carefully: here we assume that the compositing state of all desc endants have been updated already,
133 LayerListMutationDetector mutationChecker(layer.stackingNode()); 131 // so it is legitimate to compute and cache the composited bounds for th is layer.
134 #endif 132 mapping->updateCompositedBounds(updateType);
135 133
136 RenderLayerStackingNodeIterator iterator(*layer.stackingNode(), AllChildren) ; 134 if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) {
137 while (RenderLayerStackingNode* curNode = iterator.next()) 135 if (reflection->reflectionLayer()->hasCompositedLayerMapping())
138 updateRecursive(*curNode->layer(), updateType); 136 reflection->reflectionLayer()->compositedLayerMapping()->updateC ompositedBounds(ForceUpdate);
139 } 137 }
140 138
141 GraphicsLayerUpdater::UpdateType GraphicsLayerUpdater::update(RenderLayer& layer , UpdateType updateType) 139 mapping->updateGraphicsLayerConfiguration();
142 { 140 updateType = mapping->updateGraphicsLayerGeometry(updateType);
143 if (!layer.hasCompositedLayerMapping()) 141 mapping->clearNeedsGeometryUpdate();
144 return updateType;
145 142
146 CompositedLayerMappingPtr mapping = layer.compositedLayerMapping(); 143 if (!layer.parent())
144 layer.compositor()->updateRootLayerPosition();
147 145
148 // Note carefully: here we assume that the compositing state of all descenda nts have been updated already, 146 if (mapping->hasUnpositionedOverflowControlsLayers())
149 // so it is legitimate to compute and cache the composited bounds for this l ayer. 147 layer.scrollableArea()->positionOverflowControls();
150 mapping->updateCompositedBounds(updateType);
151
152 if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) {
153 if (reflection->reflectionLayer()->hasCompositedLayerMapping())
154 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo sitedBounds(ForceUpdate);
155 } 148 }
156 149
157 mapping->updateGraphicsLayerConfiguration(); 150 for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibl ing())
esprehn 2014/03/28 02:24:09 We should add a travserseNext() like method or a T
abarth-chromium 2014/03/28 02:37:14 +1
158 updateType = mapping->updateGraphicsLayerGeometry(updateType); 151 update(*child, updateType);
159 mapping->clearNeedsGeometryUpdate();
160
161 if (!layer.parent())
162 layer.compositor()->updateRootLayerPosition();
163
164 if (mapping->hasUnpositionedOverflowControlsLayers())
165 layer.scrollableArea()->positionOverflowControls();
166
167 return updateType;
168 } 152 }
169 153
170 } // namespace WebCore 154 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698