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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 468633002: hasSelfPaintingLayerDescendant should clean m_hasSelfPaintingLayerDescendantDirty (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 4 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/rendering/RenderLayer.h ('k') | no next file » | 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 // FIXME: We should be able to remove this call because we don't care about 269 // FIXME: We should be able to remove this call because we don't care about
270 // any descendant-dependent flags, but code somewhere else is reading these 270 // any descendant-dependent flags, but code somewhere else is reading these
271 // flags and depending on us to update them. 271 // flags and depending on us to update them.
272 updateDescendantDependentFlags(); 272 updateDescendantDependentFlags();
273 273
274 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 274 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
275 child->updateLayerPositionRecursive(); 275 child->updateLayerPositionRecursive();
276 } 276 }
277 277
278 void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant() 278 void RenderLayer::updateHasSelfPaintingLayerDescendant() const
279 { 279 {
280 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 280 ASSERT(m_hasSelfPaintingLayerDescendantDirty);
281 if (!layer->m_hasSelfPaintingLayerDescendantDirty && layer->hasSelfPaint ingLayerDescendant()) 281
282 m_hasSelfPaintingLayerDescendant = false;
283
284 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
285 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendan t()) {
286 m_hasSelfPaintingLayerDescendant = true;
282 break; 287 break;
288 }
289 }
283 290
284 layer->m_hasSelfPaintingLayerDescendantDirty = false; 291 m_hasSelfPaintingLayerDescendantDirty = false;
285 layer->m_hasSelfPaintingLayerDescendant = true;
286 }
287 } 292 }
288 293
289 void RenderLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() 294 void RenderLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus()
290 { 295 {
291 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 296 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
292 layer->m_hasSelfPaintingLayerDescendantDirty = true; 297 layer->m_hasSelfPaintingLayerDescendantDirty = true;
293 // If we have reached a self-painting layer, we know our parent should h ave a self-painting descendant 298 // If we have reached a self-painting layer, we know our parent should h ave a self-painting descendant
294 // in this case, there is no need to dirty our ancestors further. 299 // in this case, there is no need to dirty our ancestors further.
295 if (layer->isSelfPaintingLayer()) { 300 if (layer->isSelfPaintingLayer()) {
296 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->hasSelfPaintingLayerDescendant()); 301 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->m_hasSelfPaintingLayerDescendant);
297 break; 302 break;
298 } 303 }
299 } 304 }
300 } 305 }
301 306
302 bool RenderLayer::scrollsWithViewport() const 307 bool RenderLayer::scrollsWithViewport() const
303 { 308 {
304 return renderer()->style()->position() == FixedPosition && renderer()->conta iningBlock()->enclosingLayer()->isRootLayer(); 309 return renderer()->style()->position() == FixedPosition && renderer()->conta iningBlock()->enclosingLayer()->isRootLayer();
305 } 310 }
306 311
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 void RenderLayer::updateDescendantDependentFlagsForEntireSubtree() 648 void RenderLayer::updateDescendantDependentFlagsForEntireSubtree()
644 { 649 {
645 updateDescendantDependentFlags(); 650 updateDescendantDependentFlags();
646 651
647 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 652 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
648 child->updateDescendantDependentFlagsForEntireSubtree(); 653 child->updateDescendantDependentFlagsForEntireSubtree();
649 } 654 }
650 655
651 void RenderLayer::updateDescendantDependentFlags() 656 void RenderLayer::updateDescendantDependentFlags()
652 { 657 {
653 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty) { 658 if (m_visibleDescendantStatusDirty) {
654 m_hasVisibleDescendant = false; 659 m_hasVisibleDescendant = false;
655 m_hasSelfPaintingLayerDescendant = false;
656 660
657 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { 661 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
658 child->updateDescendantDependentFlags(); 662 child->updateDescendantDependentFlags();
659 663
660 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; 664 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) {
661 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); 665 m_hasVisibleDescendant = true;
662
663 m_hasVisibleDescendant |= hasVisibleDescendant;
664 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant;
665
666 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant)
667 break; 666 break;
667 }
668 } 668 }
669 669
670 m_visibleDescendantStatusDirty = false; 670 m_visibleDescendantStatusDirty = false;
671 m_hasSelfPaintingLayerDescendantDirty = false;
672 } 671 }
673 672
674 if (m_blendInfo.childLayerHasBlendModeStatusDirty()) { 673 if (m_blendInfo.childLayerHasBlendModeStatusDirty()) {
675 m_blendInfo.setChildLayerHasBlendMode(false); 674 m_blendInfo.setChildLayerHasBlendMode(false);
676 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { 675 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
677 if (!child->stackingNode()->isStackingContext()) 676 if (!child->stackingNode()->isStackingContext())
678 child->updateDescendantDependentFlags(); 677 child->updateDescendantDependentFlags();
679 678
680 bool childLayerHadBlendMode = child->blendInfo().childLayerHasBlendM odeWhileDirty(); 679 bool childLayerHadBlendMode = child->blendInfo().childLayerHasBlendM odeWhileDirty();
681 bool childLayerHasBlendMode = childLayerHadBlendMode || child->blend Info().hasBlendMode(); 680 bool childLayerHasBlendMode = childLayerHadBlendMode || child->blend Info().hasBlendMode();
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 m_stackingNode->dirtyNormalFlowList(); 1255 m_stackingNode->dirtyNormalFlowList();
1257 1256
1258 if (!child->stackingNode()->isNormalFlowOnly() || child->firstChild()) { 1257 if (!child->stackingNode()->isNormalFlowOnly() || child->firstChild()) {
1259 // Dirty the z-order list in which we are contained. The ancestorStackin gContextNode() can be null in the 1258 // Dirty the z-order list in which we are contained. The ancestorStackin gContextNode() can be null in the
1260 // case where we're building up generated content layers. This is ok, si nce the lists will start 1259 // case where we're building up generated content layers. This is ok, si nce the lists will start
1261 // off dirty in that case anyway. 1260 // off dirty in that case anyway.
1262 child->stackingNode()->dirtyStackingContextZOrderLists(); 1261 child->stackingNode()->dirtyStackingContextZOrderLists();
1263 } 1262 }
1264 1263
1265 dirtyAncestorChainVisibleDescendantStatus(); 1264 dirtyAncestorChainVisibleDescendantStatus();
1265 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1266 1266
1267 child->updateDescendantDependentFlags(); 1267 child->updateDescendantDependentFlags();
1268 1268
1269 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
1270 setAncestorChainHasSelfPaintingLayerDescendant();
1271
1272 if (child->blendInfo().hasBlendMode() || child->blendInfo().childLayerHasBle ndMode()) 1269 if (child->blendInfo().hasBlendMode() || child->blendInfo().childLayerHasBle ndMode())
1273 m_blendInfo.setAncestorChainBlendedDescendant(); 1270 m_blendInfo.setAncestorChainBlendedDescendant();
1274 } 1271 }
1275 1272
1276 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) 1273 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
1277 { 1274 {
1278 if (oldChild->previousSibling()) 1275 if (oldChild->previousSibling())
1279 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); 1276 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
1280 if (oldChild->nextSibling()) 1277 if (oldChild->nextSibling())
1281 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; 1278 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ;
(...skipping 13 matching lines...) Expand all
1295 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); 1292 oldChild->stackingNode()->dirtyStackingContextZOrderLists();
1296 } 1293 }
1297 1294
1298 if (renderer()->style()->visibility() != VISIBLE) 1295 if (renderer()->style()->visibility() != VISIBLE)
1299 dirtyVisibleContentStatus(); 1296 dirtyVisibleContentStatus();
1300 1297
1301 oldChild->setPreviousSibling(0); 1298 oldChild->setPreviousSibling(0);
1302 oldChild->setNextSibling(0); 1299 oldChild->setNextSibling(0);
1303 oldChild->m_parent = 0; 1300 oldChild->m_parent = 0;
1304 1301
1302 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1303
1305 oldChild->updateDescendantDependentFlags(); 1304 oldChild->updateDescendantDependentFlags();
1306 1305
1307 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) 1306 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
1308 dirtyAncestorChainVisibleDescendantStatus(); 1307 dirtyAncestorChainVisibleDescendantStatus();
1309 1308
1310 if (oldChild->m_blendInfo.hasBlendMode() || oldChild->blendInfo().childLayer HasBlendMode()) 1309 if (oldChild->m_blendInfo.hasBlendMode() || oldChild->blendInfo().childLayer HasBlendMode())
1311 m_blendInfo.dirtyAncestorChainBlendedDescendantStatus(); 1310 m_blendInfo.dirtyAncestorChainBlendedDescendantStatus();
1312 1311
1313 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant())
1314 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1315
1316 return oldChild; 1312 return oldChild;
1317 } 1313 }
1318 1314
1319 void RenderLayer::removeOnlyThisLayer() 1315 void RenderLayer::removeOnlyThisLayer()
1320 { 1316 {
1321 if (!m_parent) 1317 if (!m_parent)
1322 return; 1318 return;
1323 1319
1324 m_clipper.clearClipRectsIncludingDescendants(); 1320 m_clipper.clearClipRectsIncludingDescendants();
1325 repainter().repaintIncludingNonCompositingDescendants(); 1321 repainter().repaintIncludingNonCompositingDescendants();
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 { 3400 {
3405 if (renderer()->isRenderPart() && toRenderPart(renderer())->requiresAccelera tedCompositing()) 3401 if (renderer()->isRenderPart() && toRenderPart(renderer())->requiresAccelera tedCompositing())
3406 return true; 3402 return true;
3407 return m_layerType == NormalLayer 3403 return m_layerType == NormalLayer
3408 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) 3404 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars())
3409 || needsCompositedScrolling(); 3405 || needsCompositedScrolling();
3410 } 3406 }
3411 3407
3412 void RenderLayer::updateSelfPaintingLayer() 3408 void RenderLayer::updateSelfPaintingLayer()
3413 { 3409 {
3414 bool isSelfPaintingLayer = this->shouldBeSelfPaintingLayer(); 3410 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer();
3415 if (this->isSelfPaintingLayer() == isSelfPaintingLayer) 3411 if (this->isSelfPaintingLayer() == isSelfPaintingLayer)
3416 return; 3412 return;
3417 3413
3418 m_isSelfPaintingLayer = isSelfPaintingLayer; 3414 m_isSelfPaintingLayer = isSelfPaintingLayer;
3419 if (!parent()) 3415
3420 return; 3416 if (parent())
3421 if (isSelfPaintingLayer)
3422 parent()->setAncestorChainHasSelfPaintingLayerDescendant();
3423 else
3424 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 3417 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
3425 } 3418 }
3426 3419
3427 bool RenderLayer::hasNonEmptyChildRenderers() const 3420 bool RenderLayer::hasNonEmptyChildRenderers() const
3428 { 3421 {
3429 // Some HTML can cause whitespace text nodes to have renderers, like: 3422 // Some HTML can cause whitespace text nodes to have renderers, like:
3430 // <div> 3423 // <div>
3431 // <img src=...> 3424 // <img src=...>
3432 // </div> 3425 // </div>
3433 // so test for 0x0 RenderTexts here 3426 // so test for 0x0 RenderTexts here
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3729 } 3722 }
3730 } 3723 }
3731 3724
3732 void showLayerTree(const blink::RenderObject* renderer) 3725 void showLayerTree(const blink::RenderObject* renderer)
3733 { 3726 {
3734 if (!renderer) 3727 if (!renderer)
3735 return; 3728 return;
3736 showLayerTree(renderer->enclosingLayer()); 3729 showLayerTree(renderer->enclosingLayer());
3737 } 3730 }
3738 #endif 3731 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698