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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp

Issue 1636563003: Put rare PaintLayer fields into PaintLayerRareData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/compositing/CompositingInputsUpdater.h" 5 #include "core/layout/compositing/CompositingInputsUpdater.h"
6 6
7 #include "core/layout/LayoutBlock.h" 7 #include "core/layout/LayoutBlock.h"
8 #include "core/layout/compositing/CompositedLayerMapping.h" 8 #include "core/layout/compositing/CompositedLayerMapping.h"
9 #include "core/layout/compositing/PaintLayerCompositor.h" 9 #include "core/layout/compositing/PaintLayerCompositor.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 info.enclosingCompositedLayer = layer; 103 info.enclosingCompositedLayer = layer;
104 104
105 if (layer->needsCompositingInputsUpdate()) { 105 if (layer->needsCompositingInputsUpdate()) {
106 if (info.enclosingCompositedLayer) 106 if (info.enclosingCompositedLayer)
107 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra phicsLayerUpdate(GraphicsLayerUpdateSubtree); 107 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra phicsLayerUpdate(GraphicsLayerUpdateSubtree);
108 updateType = ForceUpdate; 108 updateType = ForceUpdate;
109 } 109 }
110 110
111 if (updateType == ForceUpdate) { 111 if (updateType == ForceUpdate) {
112 PaintLayer::AncestorDependentCompositingInputs properties; 112 PaintLayer::AncestorDependentCompositingInputs properties;
113 PaintLayer::RareAncestorDependentCompositingInputs rareProperties;
113 114
114 if (!layer->isRootLayer()) { 115 if (!layer->isRootLayer()) {
115 properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryM ap.absoluteRect(FloatRect(layer->boundingBoxForCompositingOverlapTest()))); 116 properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryM ap.absoluteRect(FloatRect(layer->boundingBoxForCompositingOverlapTest())));
116 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very lit tle sense, 117 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very lit tle sense,
117 // but removing this code will make JSGameBench sad. 118 // but removing this code will make JSGameBench sad.
118 // See https://codereview.chromium.org/13912020/ 119 // See https://codereview.chromium.org/13912020/
119 if (properties.clippedAbsoluteBoundingBox.isEmpty()) 120 if (properties.clippedAbsoluteBoundingBox.isEmpty())
120 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); 121 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1));
121 122
122 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundCl ipRect(ClipRectsContext(m_rootLayer, AbsoluteClipRects)).rect()); 123 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundCl ipRect(ClipRectsContext(m_rootLayer, AbsoluteClipRects)).rect());
123 properties.clippedAbsoluteBoundingBox.intersect(clipRect); 124 properties.clippedAbsoluteBoundingBox.intersect(clipRect);
124 125
125 const PaintLayer* parent = layer->parent(); 126 const PaintLayer* parent = layer->parent();
126 properties.opacityAncestor = parent->isTransparent() ? parent : pare nt->opacityAncestor(); 127 rareProperties.opacityAncestor = parent->isTransparent() ? parent : parent->opacityAncestor();
127 properties.transformAncestor = parent->hasTransformRelatedProperty() ? parent : parent->transformAncestor(); 128 rareProperties.transformAncestor = parent->hasTransformRelatedProper ty() ? parent : parent->transformAncestor();
128 properties.filterAncestor = parent->hasFilter() ? parent : parent->f ilterAncestor(); 129 rareProperties.filterAncestor = parent->hasFilter() ? parent : paren t->filterAncestor();
129 bool layerIsFixedPosition = layer->layoutObject()->style()->position () == FixedPosition; 130 bool layerIsFixedPosition = layer->layoutObject()->style()->position () == FixedPosition;
130 properties.nearestFixedPositionLayer = layerIsFixedPosition ? layer : parent->nearestFixedPositionLayer(); 131 rareProperties.nearestFixedPositionLayer = layerIsFixedPosition ? la yer : parent->nearestFixedPositionLayer();
131 132
132 if (info.hasAncestorWithClipRelatedProperty) { 133 if (info.hasAncestorWithClipRelatedProperty) {
133 const PaintLayer* parentLayerOnClippingContainerChain = findPare ntLayerOnClippingContainerChain(layer); 134 const PaintLayer* parentLayerOnClippingContainerChain = findPare ntLayerOnClippingContainerChain(layer);
134 const bool parentHasClipRelatedProperty = parentLayerOnClippingC ontainerChain->layoutObject()->hasClipRelatedProperty(); 135 const bool parentHasClipRelatedProperty = parentLayerOnClippingC ontainerChain->layoutObject()->hasClipRelatedProperty();
135 properties.clippingContainer = parentHasClipRelatedProperty ? pa rentLayerOnClippingContainerChain->layoutObject() : parentLayerOnClippingContain erChain->clippingContainer(); 136 properties.clippingContainer = parentHasClipRelatedProperty ? pa rentLayerOnClippingContainerChain->layoutObject() : parentLayerOnClippingContain erChain->clippingContainer();
136 } 137 }
137 138
138 if (info.lastScrollingAncestor) { 139 if (info.lastScrollingAncestor) {
139 const LayoutObject* containingBlock = layer->layoutObject()->con tainingBlock(); 140 const LayoutObject* containingBlock = layer->layoutObject()->con tainingBlock();
140 const PaintLayer* parentLayerOnContainingBlockChain = findParent LayerOnContainingBlockChain(containingBlock); 141 const PaintLayer* parentLayerOnContainingBlockChain = findParent LayerOnContainingBlockChain(containingBlock);
141 142
142 properties.ancestorScrollingLayer = parentLayerOnContainingBlock Chain->ancestorScrollingLayer(); 143 rareProperties.ancestorScrollingLayer = parentLayerOnContainingB lockChain->ancestorScrollingLayer();
143 if (parentLayerOnContainingBlockChain->scrollsOverflow()) 144 if (parentLayerOnContainingBlockChain->scrollsOverflow())
144 properties.ancestorScrollingLayer = parentLayerOnContainingB lockChain; 145 rareProperties.ancestorScrollingLayer = parentLayerOnContain ingBlockChain;
145 146
146 if (layer->layoutObject()->isOutOfFlowPositioned() && !layer->su btreeIsInvisible()) { 147 if (layer->layoutObject()->isOutOfFlowPositioned() && !layer->su btreeIsInvisible()) {
147 const PaintLayer* clippingLayer = properties.clippingContain er ? properties.clippingContainer->enclosingLayer() : layer->compositor()->rootL ayer(); 148 const PaintLayer* clippingLayer = properties.clippingContain er ? properties.clippingContainer->enclosingLayer() : layer->compositor()->rootL ayer();
148 if (hasClippedStackingAncestor(layer, clippingLayer)) 149 if (hasClippedStackingAncestor(layer, clippingLayer))
149 properties.clipParent = clippingLayer; 150 rareProperties.clipParent = clippingLayer;
150 } 151 }
151 152
152 if (layer->stackingNode()->isTreatedAsOrStackingContext() 153 if (layer->stackingNode()->isTreatedAsOrStackingContext()
153 && properties.ancestorScrollingLayer 154 && rareProperties.ancestorScrollingLayer
154 && !info.ancestorStackingContext->layoutObject()->isDescenda ntOf(properties.ancestorScrollingLayer->layoutObject())) 155 && !info.ancestorStackingContext->layoutObject()->isDescenda ntOf(rareProperties.ancestorScrollingLayer->layoutObject()))
155 properties.scrollParent = properties.ancestorScrollingLayer; 156 rareProperties.scrollParent = rareProperties.ancestorScrolli ngLayer;
156 } 157 }
157 } 158 }
158 159
159 properties.hasAncestorWithClipPath = info.hasAncestorWithClipPath; 160 layer->updateAncestorDependentCompositingInputs(properties, rareProperti es, info.hasAncestorWithClipPath);
160 layer->updateAncestorDependentCompositingInputs(properties);
161 } 161 }
162 162
163 if (layer->stackingNode()->isStackingContext()) 163 if (layer->stackingNode()->isStackingContext())
164 info.ancestorStackingContext = layer; 164 info.ancestorStackingContext = layer;
165 165
166 if (layer->scrollsOverflow()) 166 if (layer->scrollsOverflow())
167 info.lastScrollingAncestor = layer; 167 info.lastScrollingAncestor = layer;
168 168
169 if (layer->layoutObject()->hasClipRelatedProperty()) 169 if (layer->layoutObject()->hasClipRelatedProperty())
170 info.hasAncestorWithClipRelatedProperty = true; 170 info.hasAncestorWithClipRelatedProperty = true;
171 171
172 if (layer->layoutObject()->hasClipPath()) 172 if (layer->layoutObject()->hasClipPath())
173 info.hasAncestorWithClipPath = true; 173 info.hasAncestorWithClipPath = true;
174 174
175 PaintLayer::DescendantDependentCompositingInputs descendantProperties; 175 bool hasDescendantWithClipPath = false;
176 bool hasNonIsolatedDescendantWithBlendMode = false;
176 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl ing()) { 177 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl ing()) {
177 updateRecursive(child, updateType, info); 178 updateRecursive(child, updateType, info);
178 179
179 descendantProperties.hasDescendantWithClipPath |= child->hasDescendantWi thClipPath() || child->layoutObject()->hasClipPath(); 180 hasDescendantWithClipPath |= child->hasDescendantWithClipPath() || child ->layoutObject()->hasClipPath();
180 descendantProperties.hasNonIsolatedDescendantWithBlendMode |= (!child->s tackingNode()->isStackingContext() && child->hasNonIsolatedDescendantWithBlendMo de()) || child->layoutObject()->style()->hasBlendMode(); 181 hasNonIsolatedDescendantWithBlendMode |= (!child->stackingNode()->isStac kingContext() && child->hasNonIsolatedDescendantWithBlendMode()) || child->layou tObject()->style()->hasBlendMode();
181 } 182 }
182 183
183 layer->updateDescendantDependentCompositingInputs(descendantProperties); 184 layer->updateDescendantDependentCompositingInputs(hasDescendantWithClipPath, hasNonIsolatedDescendantWithBlendMode);
184 layer->didUpdateCompositingInputs(); 185 layer->didUpdateCompositingInputs();
185 186
186 m_geometryMap.popMappingsToAncestor(layer->parent()); 187 m_geometryMap.popMappingsToAncestor(layer->parent());
187 } 188 }
188 189
189 #if ENABLE(ASSERT) 190 #if ENABLE(ASSERT)
190 191
191 void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(Pai ntLayer* layer) 192 void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(Pai ntLayer* layer)
192 { 193 {
193 ASSERT(!layer->childNeedsCompositingInputsUpdate()); 194 ASSERT(!layer->childNeedsCompositingInputsUpdate());
194 ASSERT(!layer->needsCompositingInputsUpdate()); 195 ASSERT(!layer->needsCompositingInputsUpdate());
195 196
196 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl ing()) 197 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl ing())
197 assertNeedsCompositingInputsUpdateBitsCleared(child); 198 assertNeedsCompositingInputsUpdateBitsCleared(child);
198 } 199 }
199 200
200 #endif 201 #endif
201 202
202 } // namespace blink 203 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698