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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 // 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 "config.h" 5 #include "config.h"
6 #include "core/layout/compositing/CompositingInputsUpdater.h" 6 #include "core/layout/compositing/CompositingInputsUpdater.h"
7 7
8 #include "core/layout/Layer.h" 8 #include "core/layout/Layer.h"
9 #include "core/layout/LayoutBlock.h" 9 #include "core/layout/LayoutBlock.h"
10 #include "core/layout/compositing/CompositedLayerMapping.h" 10 #include "core/layout/compositing/CompositedLayerMapping.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 void CompositingInputsUpdater::update() 26 void CompositingInputsUpdater::update()
27 { 27 {
28 TRACE_EVENT0("blink", "CompositingInputsUpdater::update"); 28 TRACE_EVENT0("blink", "CompositingInputsUpdater::update");
29 updateRecursive(m_rootLayer, DoNotForceUpdate, AncestorInfo()); 29 updateRecursive(m_rootLayer, DoNotForceUpdate, AncestorInfo());
30 } 30 }
31 31
32 static const Layer* findParentLayerOnClippingContainerChain(const Layer* layer) 32 static const Layer* findParentLayerOnClippingContainerChain(const Layer* layer)
33 { 33 {
34 LayoutObject* current = layer->renderer(); 34 LayoutObject* current = layer->layoutObject();
35 while (current) { 35 while (current) {
36 if (current->style()->position() == FixedPosition) { 36 if (current->style()->position() == FixedPosition) {
37 for (current = current->parent(); current && !current->canContainFix edPositionObjects(); current = current->parent()) { 37 for (current = current->parent(); current && !current->canContainFix edPositionObjects(); current = current->parent()) {
38 // All types of clips apply to fixed-position descendants of oth er fixed-position elements. 38 // All types of clips apply to fixed-position descendants of oth er fixed-position elements.
39 // Note: it's unclear whether this is what the spec says. Firefo x does not clip, but Chrome does. 39 // Note: it's unclear whether this is what the spec says. Firefo x does not clip, but Chrome does.
40 if (current->style()->position() == FixedPosition && current->ha sClipOrOverflowClip()) { 40 if (current->style()->position() == FixedPosition && current->ha sClipOrOverflowClip()) {
41 ASSERT(current->hasLayer()); 41 ASSERT(current->hasLayer());
42 return static_cast<const LayoutBoxModelObject*>(current)->la yer(); 42 return static_cast<const LayoutBoxModelObject*>(current)->la yer();
43 } 43 }
44 44
(...skipping 24 matching lines...) Expand all
69 return static_cast<const LayoutBoxModelObject*>(current)->layer(); 69 return static_cast<const LayoutBoxModelObject*>(current)->layer();
70 } 70 }
71 ASSERT_NOT_REACHED(); 71 ASSERT_NOT_REACHED();
72 return 0; 72 return 0;
73 } 73 }
74 74
75 static bool hasClippedStackingAncestor(const Layer* layer, const Layer* clipping Layer) 75 static bool hasClippedStackingAncestor(const Layer* layer, const Layer* clipping Layer)
76 { 76 {
77 if (layer == clippingLayer) 77 if (layer == clippingLayer)
78 return false; 78 return false;
79 const LayoutObject* clippingRenderer = clippingLayer->renderer(); 79 const LayoutObject* clippingRenderer = clippingLayer->layoutObject();
80 for (const Layer* current = layer->compositingContainer(); current && curren t != clippingLayer; current = current->compositingContainer()) { 80 for (const Layer* current = layer->compositingContainer(); current && curren t != clippingLayer; current = current->compositingContainer()) {
81 if (current->renderer()->hasClipOrOverflowClip() && !clippingRenderer->i sDescendantOf(current->renderer())) 81 if (current->layoutObject()->hasClipOrOverflowClip() && !clippingRendere r->isDescendantOf(current->layoutObject()))
82 return true; 82 return true;
83 83
84 if (const LayoutObject* container = current->clippingContainer()) { 84 if (const LayoutObject* container = current->clippingContainer()) {
85 if (clippingRenderer != container && !clippingRenderer->isDescendant Of(container)) 85 if (clippingRenderer != container && !clippingRenderer->isDescendant Of(container))
86 return true; 86 return true;
87 } 87 }
88 } 88 }
89 return false; 89 return false;
90 } 90 }
91 91
(...skipping 27 matching lines...) Expand all
119 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundCl ipRect(ClipRectsContext(m_rootLayer, AbsoluteClipRects)).rect()); 119 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundCl ipRect(ClipRectsContext(m_rootLayer, AbsoluteClipRects)).rect());
120 properties.clippedAbsoluteBoundingBox.intersect(clipRect); 120 properties.clippedAbsoluteBoundingBox.intersect(clipRect);
121 121
122 const Layer* parent = layer->parent(); 122 const Layer* parent = layer->parent();
123 properties.opacityAncestor = parent->isTransparent() ? parent : pare nt->opacityAncestor(); 123 properties.opacityAncestor = parent->isTransparent() ? parent : pare nt->opacityAncestor();
124 properties.transformAncestor = parent->hasTransformRelatedProperty() ? parent : parent->transformAncestor(); 124 properties.transformAncestor = parent->hasTransformRelatedProperty() ? parent : parent->transformAncestor();
125 properties.filterAncestor = parent->hasFilter() ? parent : parent->f ilterAncestor(); 125 properties.filterAncestor = parent->hasFilter() ? parent : parent->f ilterAncestor();
126 126
127 if (info.hasAncestorWithClipOrOverflowClip) { 127 if (info.hasAncestorWithClipOrOverflowClip) {
128 const Layer* parentLayerOnClippingContainerChain = findParentLay erOnClippingContainerChain(layer); 128 const Layer* parentLayerOnClippingContainerChain = findParentLay erOnClippingContainerChain(layer);
129 const bool parentHasClipOrOverflowClip = parentLayerOnClippingCo ntainerChain->renderer()->hasClipOrOverflowClip(); 129 const bool parentHasClipOrOverflowClip = parentLayerOnClippingCo ntainerChain->layoutObject()->hasClipOrOverflowClip();
130 properties.clippingContainer = parentHasClipOrOverflowClip ? par entLayerOnClippingContainerChain->renderer() : parentLayerOnClippingContainerCha in->clippingContainer(); 130 properties.clippingContainer = parentHasClipOrOverflowClip ? par entLayerOnClippingContainerChain->layoutObject() : parentLayerOnClippingContaine rChain->clippingContainer();
131 } 131 }
132 132
133 if (info.lastScrollingAncestor) { 133 if (info.lastScrollingAncestor) {
134 const LayoutObject* containingBlock = layer->renderer()->contain ingBlock(); 134 const LayoutObject* containingBlock = layer->layoutObject()->con tainingBlock();
135 const Layer* parentLayerOnContainingBlockChain = findParentLayer OnContainingBlockChain(containingBlock); 135 const Layer* parentLayerOnContainingBlockChain = findParentLayer OnContainingBlockChain(containingBlock);
136 136
137 properties.ancestorScrollingLayer = parentLayerOnContainingBlock Chain->ancestorScrollingLayer(); 137 properties.ancestorScrollingLayer = parentLayerOnContainingBlock Chain->ancestorScrollingLayer();
138 if (parentLayerOnContainingBlockChain->scrollsOverflow()) 138 if (parentLayerOnContainingBlockChain->scrollsOverflow())
139 properties.ancestorScrollingLayer = parentLayerOnContainingB lockChain; 139 properties.ancestorScrollingLayer = parentLayerOnContainingB lockChain;
140 140
141 if (layer->renderer()->isOutOfFlowPositioned() && !layer->subtre eIsInvisible()) { 141 if (layer->layoutObject()->isOutOfFlowPositioned() && !layer->su btreeIsInvisible()) {
142 const Layer* clippingLayer = properties.clippingContainer ? properties.clippingContainer->enclosingLayer() : layer->compositor()->rootLayer( ); 142 const Layer* clippingLayer = properties.clippingContainer ? properties.clippingContainer->enclosingLayer() : layer->compositor()->rootLayer( );
143 if (hasClippedStackingAncestor(layer, clippingLayer)) 143 if (hasClippedStackingAncestor(layer, clippingLayer))
144 properties.clipParent = clippingLayer; 144 properties.clipParent = clippingLayer;
145 } 145 }
146 146
147 if (!layer->stackingNode()->isNormalFlowOnly() 147 if (!layer->stackingNode()->isNormalFlowOnly()
148 && properties.ancestorScrollingLayer 148 && properties.ancestorScrollingLayer
149 && !info.ancestorStackingContext->renderer()->isDescendantOf (properties.ancestorScrollingLayer->renderer())) 149 && !info.ancestorStackingContext->layoutObject()->isDescenda ntOf(properties.ancestorScrollingLayer->layoutObject()))
150 properties.scrollParent = properties.ancestorScrollingLayer; 150 properties.scrollParent = properties.ancestorScrollingLayer;
151 } 151 }
152 } 152 }
153 153
154 properties.hasAncestorWithClipPath = info.hasAncestorWithClipPath; 154 properties.hasAncestorWithClipPath = info.hasAncestorWithClipPath;
155 layer->updateAncestorDependentCompositingInputs(properties); 155 layer->updateAncestorDependentCompositingInputs(properties);
156 } 156 }
157 157
158 if (layer->stackingNode()->isStackingContext()) 158 if (layer->stackingNode()->isStackingContext())
159 info.ancestorStackingContext = layer; 159 info.ancestorStackingContext = layer;
160 160
161 if (layer->scrollsOverflow()) 161 if (layer->scrollsOverflow())
162 info.lastScrollingAncestor = layer; 162 info.lastScrollingAncestor = layer;
163 163
164 if (layer->renderer()->hasClipOrOverflowClip()) 164 if (layer->layoutObject()->hasClipOrOverflowClip())
165 info.hasAncestorWithClipOrOverflowClip = true; 165 info.hasAncestorWithClipOrOverflowClip = true;
166 166
167 if (layer->renderer()->hasClipPath()) 167 if (layer->layoutObject()->hasClipPath())
168 info.hasAncestorWithClipPath = true; 168 info.hasAncestorWithClipPath = true;
169 169
170 Layer::DescendantDependentCompositingInputs descendantProperties; 170 Layer::DescendantDependentCompositingInputs descendantProperties;
171 for (Layer* child = layer->firstChild(); child; child = child->nextSibling() ) { 171 for (Layer* child = layer->firstChild(); child; child = child->nextSibling() ) {
172 updateRecursive(child, updateType, info); 172 updateRecursive(child, updateType, info);
173 173
174 descendantProperties.hasDescendantWithClipPath |= child->hasDescendantWi thClipPath() || child->renderer()->hasClipPath(); 174 descendantProperties.hasDescendantWithClipPath |= child->hasDescendantWi thClipPath() || child->layoutObject()->hasClipPath();
175 descendantProperties.hasNonIsolatedDescendantWithBlendMode |= (!child->s tackingNode()->isStackingContext() && child->hasNonIsolatedDescendantWithBlendMo de()) || child->renderer()->style()->hasBlendMode(); 175 descendantProperties.hasNonIsolatedDescendantWithBlendMode |= (!child->s tackingNode()->isStackingContext() && child->hasNonIsolatedDescendantWithBlendMo de()) || child->layoutObject()->style()->hasBlendMode();
176 } 176 }
177 177
178 layer->updateDescendantDependentCompositingInputs(descendantProperties); 178 layer->updateDescendantDependentCompositingInputs(descendantProperties);
179 layer->didUpdateCompositingInputs(); 179 layer->didUpdateCompositingInputs();
180 180
181 m_geometryMap.popMappingsToAncestor(layer->parent()); 181 m_geometryMap.popMappingsToAncestor(layer->parent());
182 } 182 }
183 183
184 #if ENABLE(ASSERT) 184 #if ENABLE(ASSERT)
185 185
186 void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(Lay er* layer) 186 void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(Lay er* layer)
187 { 187 {
188 ASSERT(!layer->childNeedsCompositingInputsUpdate()); 188 ASSERT(!layer->childNeedsCompositingInputsUpdate());
189 ASSERT(!layer->needsCompositingInputsUpdate()); 189 ASSERT(!layer->needsCompositingInputsUpdate());
190 190
191 for (Layer* child = layer->firstChild(); child; child = child->nextSibling() ) 191 for (Layer* child = layer->firstChild(); child; child = child->nextSibling() )
192 assertNeedsCompositingInputsUpdateBitsCleared(child); 192 assertNeedsCompositingInputsUpdateBitsCleared(child);
193 } 193 }
194 194
195 #endif 195 #endif
196 196
197 } // namespace blink 197 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | Source/core/layout/compositing/CompositingLayerAssigner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698