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

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

Issue 261053004: Simplify RenderLayer::setParent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 7 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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 } else 1397 } else
1398 setFirstChild(child); 1398 setFirstChild(child);
1399 1399
1400 if (beforeChild) { 1400 if (beforeChild) {
1401 beforeChild->setPreviousSibling(child); 1401 beforeChild->setPreviousSibling(child);
1402 child->setNextSibling(beforeChild); 1402 child->setNextSibling(beforeChild);
1403 ASSERT(beforeChild != child); 1403 ASSERT(beforeChild != child);
1404 } else 1404 } else
1405 setLastChild(child); 1405 setLastChild(child);
1406 1406
1407 child->setParent(this); 1407 child->m_parent = this;
1408 1408
1409 setNeedsToUpdateAncestorDependentProperties(); 1409 setNeedsToUpdateAncestorDependentProperties();
1410 1410
1411 if (child->stackingNode()->isNormalFlowOnly()) 1411 if (child->stackingNode()->isNormalFlowOnly())
1412 m_stackingNode->dirtyNormalFlowList(); 1412 m_stackingNode->dirtyNormalFlowList();
1413 1413
1414 if (!child->stackingNode()->isNormalFlowOnly() || child->firstChild()) { 1414 if (!child->stackingNode()->isNormalFlowOnly() || child->firstChild()) {
1415 // Dirty the z-order list in which we are contained. The ancestorStackin gContainerNode() can be null in the 1415 // Dirty the z-order list in which we are contained. The ancestorStackin gContainerNode() can be null in the
1416 // case where we're building up generated content layers. This is ok, si nce the lists will start 1416 // case where we're building up generated content layers. This is ok, si nce the lists will start
1417 // off dirty in that case anyway. 1417 // off dirty in that case anyway.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected 1468 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
1469 // from the main layer tree, so we need to null-check the |stackingConta iner| value. 1469 // from the main layer tree, so we need to null-check the |stackingConta iner| value.
1470 oldChild->stackingNode()->dirtyStackingContainerZOrderLists(); 1470 oldChild->stackingNode()->dirtyStackingContainerZOrderLists();
1471 } 1471 }
1472 1472
1473 if (renderer()->style()->visibility() != VISIBLE) 1473 if (renderer()->style()->visibility() != VISIBLE)
1474 dirtyVisibleContentStatus(); 1474 dirtyVisibleContentStatus();
1475 1475
1476 oldChild->setPreviousSibling(0); 1476 oldChild->setPreviousSibling(0);
1477 oldChild->setNextSibling(0); 1477 oldChild->setNextSibling(0);
1478 oldChild->setParent(0); 1478 oldChild->m_parent = 0;
1479 1479
1480 oldChild->updateDescendantDependentFlags(); 1480 oldChild->updateDescendantDependentFlags();
1481 if (subtreeContainsOutOfFlowPositionedLayer(oldChild)) { 1481 if (subtreeContainsOutOfFlowPositionedLayer(oldChild)) {
1482 // It may now be the case that a layer no longer has an unclipped 1482 // It may now be the case that a layer no longer has an unclipped
1483 // descendant. Let the compositor know that it needs to reevaluate 1483 // descendant. Let the compositor know that it needs to reevaluate
1484 // its compositing requirements to check this. 1484 // its compositing requirements to check this.
1485 compositor()->setNeedsUpdateCompositingRequirementsState(); 1485 compositor()->setNeedsUpdateCompositingRequirementsState();
1486 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 1486 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
1487 } 1487 }
1488 1488
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3605 LayoutRect childLocalRect(localRect); 3605 LayoutRect childLocalRect(localRect);
3606 childLayer->convertToLayerCoords(this, childOffset); 3606 childLayer->convertToLayerCoords(this, childOffset);
3607 childLocalRect.moveBy(-childOffset); 3607 childLocalRect.moveBy(-childOffset);
3608 3608
3609 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) 3609 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect))
3610 return true; 3610 return true;
3611 } 3611 }
3612 return false; 3612 return false;
3613 } 3613 }
3614 3614
3615 void RenderLayer::setParent(RenderLayer* parent)
3616 {
3617 if (parent == m_parent)
3618 return;
3619
3620 if (m_parent && !renderer()->documentBeingDestroyed())
3621 compositor()->layerWillBeRemoved(m_parent, this);
3622
3623 m_parent = parent;
3624
3625 if (m_parent && !renderer()->documentBeingDestroyed())
3626 compositor()->layerWasAdded(m_parent, this);
3627 }
3628
3629 bool RenderLayer::shouldBeSelfPaintingLayer() const 3615 bool RenderLayer::shouldBeSelfPaintingLayer() const
3630 { 3616 {
3631 return m_layerType == NormalLayer 3617 return m_layerType == NormalLayer
3632 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) 3618 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars())
3633 || needsCompositedScrolling(); 3619 || needsCompositedScrolling();
3634 } 3620 }
3635 3621
3636 void RenderLayer::updateSelfPaintingLayer() 3622 void RenderLayer::updateSelfPaintingLayer()
3637 { 3623 {
3638 bool isSelfPaintingLayer = this->shouldBeSelfPaintingLayer(); 3624 bool isSelfPaintingLayer = this->shouldBeSelfPaintingLayer();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
4024 } 4010 }
4025 } 4011 }
4026 4012
4027 void showLayerTree(const WebCore::RenderObject* renderer) 4013 void showLayerTree(const WebCore::RenderObject* renderer)
4028 { 4014 {
4029 if (!renderer) 4015 if (!renderer)
4030 return; 4016 return;
4031 showLayerTree(renderer->enclosingLayer()); 4017 showLayerTree(renderer->enclosingLayer());
4032 } 4018 }
4033 #endif 4019 #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