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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerStackingNode.cpp

Issue 1176503002: Rename isNormalFlowOnly to something meaningful (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Nittified! Created 5 years, 6 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
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerStackingNode.h ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/layout/HitTestRequest.h" 48 #include "core/layout/HitTestRequest.h"
49 #include "core/layout/HitTestResult.h" 49 #include "core/layout/HitTestResult.h"
50 #include "core/layout/LayoutView.h" 50 #include "core/layout/LayoutView.h"
51 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 51 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
52 #include "core/paint/DeprecatedPaintLayer.h" 52 #include "core/paint/DeprecatedPaintLayer.h"
53 #include "public/platform/Platform.h" 53 #include "public/platform/Platform.h"
54 54
55 namespace blink { 55 namespace blink {
56 56
57 // FIXME: This should not require DeprecatedPaintLayer. There is currently a cyc le where 57 // FIXME: This should not require DeprecatedPaintLayer. There is currently a cyc le where
58 // in order to determine if we shoulBeNormalFlowOnly() we have to ask the paint 58 // in order to determine if we shoulBeTreatedAsStackingContextForPainting() we h ave to ask the paint
59 // layer about some of its state. 59 // layer about some of its state.
60 DeprecatedPaintLayerStackingNode::DeprecatedPaintLayerStackingNode(DeprecatedPai ntLayer* layer) 60 DeprecatedPaintLayerStackingNode::DeprecatedPaintLayerStackingNode(DeprecatedPai ntLayer* layer)
61 : m_layer(layer) 61 : m_layer(layer)
62 , m_normalFlowListDirty(true) 62 , m_normalFlowListDirty(true)
63 #if ENABLE(ASSERT) 63 #if ENABLE(ASSERT)
64 , m_layerListMutationAllowed(true) 64 , m_layerListMutationAllowed(true)
65 , m_stackingParent(0) 65 , m_stackingParent(0)
66 #endif 66 #endif
67 { 67 {
68 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); 68 m_isTreatedAsStackingContextForPainting = shouldBeTreatedAsStackingContextFo rPainting();
69 69
70 // Non-stacking contexts should have empty z-order lists. As this is already the case, 70 // Non-stacking contexts should have empty z-order lists. As this is already the case,
71 // there is no need to dirty / recompute these lists. 71 // there is no need to dirty / recompute these lists.
72 m_zOrderListsDirty = isStackingContext(); 72 m_zOrderListsDirty = isStackingContext();
73 } 73 }
74 74
75 DeprecatedPaintLayerStackingNode::~DeprecatedPaintLayerStackingNode() 75 DeprecatedPaintLayerStackingNode::~DeprecatedPaintLayerStackingNode()
76 { 76 {
77 #if ENABLE(ASSERT) 77 #if ENABLE(ASSERT)
78 if (!layoutObject()->documentBeingDestroyed()) { 78 if (!layoutObject()->documentBeingDestroyed()) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 void DeprecatedPaintLayerStackingNode::updateNormalFlowList() 181 void DeprecatedPaintLayerStackingNode::updateNormalFlowList()
182 { 182 {
183 if (!m_normalFlowListDirty) 183 if (!m_normalFlowListDirty)
184 return; 184 return;
185 185
186 ASSERT(m_layerListMutationAllowed); 186 ASSERT(m_layerListMutationAllowed);
187 187
188 for (DeprecatedPaintLayer* child = layer()->firstChild(); child; child = chi ld->nextSibling()) { 188 for (DeprecatedPaintLayer* child = layer()->firstChild(); child; child = chi ld->nextSibling()) {
189 if (child->stackingNode()->isNormalFlowOnly() && (!layer()->reflectionIn fo() || layer()->reflectionInfo()->reflectionLayer() != child)) { 189 if (!child->stackingNode()->isTreatedAsStackingContextForPainting() && ( !layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != ch ild)) {
190 if (!m_normalFlowList) 190 if (!m_normalFlowList)
191 m_normalFlowList = adoptPtr(new Vector<DeprecatedPaintLayerStack ingNode*>); 191 m_normalFlowList = adoptPtr(new Vector<DeprecatedPaintLayerStack ingNode*>);
192 m_normalFlowList->append(child->stackingNode()); 192 m_normalFlowList->append(child->stackingNode());
193 } 193 }
194 } 194 }
195 195
196 #if ENABLE(ASSERT) 196 #if ENABLE(ASSERT)
197 updateStackingParentForNormalFlowList(this); 197 updateStackingParentForNormalFlowList(this);
198 #endif 198 #endif
199 199
200 m_normalFlowListDirty = false; 200 m_normalFlowListDirty = false;
201 } 201 }
202 202
203 void DeprecatedPaintLayerStackingNode::collectLayers(OwnPtr<Vector<DeprecatedPai ntLayerStackingNode*>>& posBuffer, OwnPtr<Vector<DeprecatedPaintLayerStackingNod e*>>& negBuffer) 203 void DeprecatedPaintLayerStackingNode::collectLayers(OwnPtr<Vector<DeprecatedPai ntLayerStackingNode*>>& posBuffer, OwnPtr<Vector<DeprecatedPaintLayerStackingNod e*>>& negBuffer)
204 { 204 {
205 if (layer()->isInTopLayer()) 205 if (layer()->isInTopLayer())
206 return; 206 return;
207 207
208 if (!isNormalFlowOnly()) { 208 if (isTreatedAsStackingContextForPainting()) {
209 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer; 209 OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer;
210 if (!buffer) 210 if (!buffer)
211 buffer = adoptPtr(new Vector<DeprecatedPaintLayerStackingNode*>); 211 buffer = adoptPtr(new Vector<DeprecatedPaintLayerStackingNode*>);
212 buffer->append(this); 212 buffer->append(this);
213 } 213 }
214 214
215 if (!isStackingContext()) { 215 if (!isStackingContext()) {
216 for (DeprecatedPaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) { 216 for (DeprecatedPaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) {
217 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect ionLayer() != child) 217 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect ionLayer() != child)
218 child->stackingNode()->collectLayers(posBuffer, negBuffer); 218 child->stackingNode()->collectLayers(posBuffer, negBuffer);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 return; 288 return;
289 289
290 dirtyStackingContextZOrderLists(); 290 dirtyStackingContextZOrderLists();
291 291
292 if (isStackingContext) 292 if (isStackingContext)
293 dirtyZOrderLists(); 293 dirtyZOrderLists();
294 else 294 else
295 clearZOrderLists(); 295 clearZOrderLists();
296 } 296 }
297 297
298 // FIXME: Rename shouldBeNormalFlowOnly to something more accurate now that CSS 298 void DeprecatedPaintLayerStackingNode::updateIsTreatedAsStackingContextForPainti ng()
299 // 2.1 defines the term "normal flow".
300 bool DeprecatedPaintLayerStackingNode::shouldBeNormalFlowOnly() const
301 { 299 {
302 return !isStackingContext() && !layoutObject()->isPositioned(); 300 bool isTreatedAsStackingContextForPainting = shouldBeTreatedAsStackingContex tForPainting();
303 } 301 if (isTreatedAsStackingContextForPainting == this->isTreatedAsStackingContex tForPainting())
304
305 void DeprecatedPaintLayerStackingNode::updateIsNormalFlowOnly()
306 {
307 bool isNormalFlowOnly = shouldBeNormalFlowOnly();
308 if (isNormalFlowOnly == this->isNormalFlowOnly())
309 return; 302 return;
310 303
311 m_isNormalFlowOnly = isNormalFlowOnly; 304 m_isTreatedAsStackingContextForPainting = isTreatedAsStackingContextForPaint ing;
312 if (DeprecatedPaintLayer* p = layer()->parent()) 305 if (DeprecatedPaintLayer* p = layer()->parent())
313 p->stackingNode()->dirtyNormalFlowList(); 306 p->stackingNode()->dirtyNormalFlowList();
314 dirtyStackingContextZOrderLists(); 307 dirtyStackingContextZOrderLists();
315 } 308 }
316 309
317 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNode::ancestorStac kingContextNode() const 310 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNode::ancestorStac kingContextNode() const
318 { 311 {
319 for (DeprecatedPaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor->parent()) { 312 for (DeprecatedPaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor->parent()) {
320 DeprecatedPaintLayerStackingNode* stackingNode = ancestor->stackingNode( ); 313 DeprecatedPaintLayerStackingNode* stackingNode = ancestor->stackingNode( );
321 if (stackingNode->isStackingContext()) 314 if (stackingNode->isStackingContext())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 Node* node = result.innerNode(); 367 Node* node = result.innerNode();
375 if (node && !result.URLElement()) 368 if (node && !result.URLElement())
376 result.setURLElement(node->enclosingLinkEventParentOrSelf()); 369 result.setURLElement(node->enclosingLinkEventParentOrSelf());
377 370
378 // Now return whether we were inside this layer (this will always be true fo r the root 371 // Now return whether we were inside this layer (this will always be true fo r the root
379 // layer). 372 // layer).
380 return insideLayer; 373 return insideLayer;
381 } 374 }
382 375
383 } // namespace blink 376 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerStackingNode.h ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698