Changeset 237121 in webkit
- Timestamp:
- Oct 15, 2018, 10:25:42 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r237119 r237121 1 2018-10-15 Simon Fraser <simon.fraser@apple.com> 2 3 RenderLayer::addChild() and removeChild() should take references 4 https://bugs.webkit.org/show_bug.cgi?id=190582 5 6 Reviewed by Zalan Bujtas. 7 8 Pass the layer to be added or removed as a reference; it's never null. 9 10 * rendering/RenderElement.cpp: 11 (WebCore::addLayers): 12 (WebCore::RenderElement::removeLayers): 13 (WebCore::RenderElement::moveLayers): 14 * rendering/RenderLayer.cpp: 15 (WebCore::RenderLayer::addChild): 16 (WebCore::RenderLayer::removeChild): 17 (WebCore::RenderLayer::insertOnlyThisLayer): 18 (WebCore::RenderLayer::removeOnlyThisLayer): 19 * rendering/RenderLayer.h: 20 1 21 2018-10-15 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> 2 22 -
TabularUnified trunk/Source/WebCore/rendering/RenderElement.cpp ¶
r236753 r237121 549 549 newObject = nullptr; 550 550 } 551 parentLayer->addChild( downcast<RenderLayerModelObject>(renderer).layer(), beforeChild);551 parentLayer->addChild(*downcast<RenderLayerModelObject>(renderer).layer(), beforeChild); 552 552 return; 553 553 } … … 573 573 574 574 if (hasLayer()) { 575 parentLayer->removeChild( downcast<RenderLayerModelObject>(*this).layer());575 parentLayer->removeChild(*downcast<RenderLayerModelObject>(*this).layer()); 576 576 return; 577 577 } … … 590 590 ASSERT(oldParent == layer->parent()); 591 591 if (oldParent) 592 oldParent->removeChild( layer);593 newParent->addChild( layer);592 oldParent->removeChild(*layer); 593 newParent->addChild(*layer); 594 594 return; 595 595 } -
TabularUnified trunk/Source/WebCore/rendering/RenderLayer.cpp ¶
r237117 r237121 376 376 } 377 377 378 void RenderLayer::addChild(RenderLayer *child, RenderLayer* beforeChild)378 void RenderLayer::addChild(RenderLayer& child, RenderLayer* beforeChild) 379 379 { 380 380 RenderLayer* prevSibling = beforeChild ? beforeChild->previousSibling() : lastChild(); 381 381 if (prevSibling) { 382 child ->setPreviousSibling(prevSibling);383 prevSibling->setNextSibling( child);384 ASSERT(prevSibling != child);382 child.setPreviousSibling(prevSibling); 383 prevSibling->setNextSibling(&child); 384 ASSERT(prevSibling != &child); 385 385 } else 386 setFirstChild( child);386 setFirstChild(&child); 387 387 388 388 if (beforeChild) { 389 beforeChild->setPreviousSibling( child);390 child ->setNextSibling(beforeChild);391 ASSERT(beforeChild != child);389 beforeChild->setPreviousSibling(&child); 390 child.setNextSibling(beforeChild); 391 ASSERT(beforeChild != &child); 392 392 } else 393 setLastChild( child);394 395 child ->setParent(this);396 397 if (child ->isNormalFlowOnly())393 setLastChild(&child); 394 395 child.setParent(this); 396 397 if (child.isNormalFlowOnly()) 398 398 dirtyNormalFlowList(); 399 399 400 if (!child ->isNormalFlowOnly() || child->firstChild()) {400 if (!child.isNormalFlowOnly() || child.firstChild()) { 401 401 // Dirty the z-order list in which we are contained. The stackingContext() can be null in the 402 402 // case where we're building up generated content layers. This is ok, since the lists will start 403 403 // off dirty in that case anyway. 404 child ->dirtyStackingContextZOrderLists();405 } 406 407 child ->updateDescendantDependentFlags();408 if (child ->m_hasVisibleContent || child->m_hasVisibleDescendant)404 child.dirtyStackingContextZOrderLists(); 405 } 406 407 child.updateDescendantDependentFlags(); 408 if (child.m_hasVisibleContent || child.m_hasVisibleDescendant) 409 409 setAncestorChainHasVisibleDescendant(); 410 410 411 if (child ->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())411 if (child.isSelfPaintingLayer() || child.hasSelfPaintingLayerDescendant()) 412 412 setAncestorChainHasSelfPaintingLayerDescendant(); 413 413 414 414 #if ENABLE(CSS_COMPOSITING) 415 if (child ->hasBlendMode() || (child->hasNotIsolatedBlendingDescendants() && !child->isolatesBlending()))415 if (child.hasBlendMode() || (child.hasNotIsolatedBlendingDescendants() && !child.isolatesBlending())) 416 416 updateAncestorChainHasBlendingDescendants(); 417 417 #endif 418 418 419 compositor().layerWasAdded(*this, *child);420 } 421 422 RenderLayer* RenderLayer::removeChild(RenderLayer*oldChild)419 compositor().layerWasAdded(*this, child); 420 } 421 422 void RenderLayer::removeChild(RenderLayer& oldChild) 423 423 { 424 424 if (!renderer().renderTreeBeingDestroyed()) 425 compositor().layerWillBeRemoved(*this, *oldChild);425 compositor().layerWillBeRemoved(*this, oldChild); 426 426 427 427 // remove the child 428 if (oldChild ->previousSibling())429 oldChild ->previousSibling()->setNextSibling(oldChild->nextSibling());430 if (oldChild ->nextSibling())431 oldChild ->nextSibling()->setPreviousSibling(oldChild->previousSibling());432 433 if (m_first == oldChild)434 m_first = oldChild ->nextSibling();435 if (m_last == oldChild)436 m_last = oldChild ->previousSibling();437 438 if (oldChild ->isNormalFlowOnly())428 if (oldChild.previousSibling()) 429 oldChild.previousSibling()->setNextSibling(oldChild.nextSibling()); 430 if (oldChild.nextSibling()) 431 oldChild.nextSibling()->setPreviousSibling(oldChild.previousSibling()); 432 433 if (m_first == &oldChild) 434 m_first = oldChild.nextSibling(); 435 if (m_last == &oldChild) 436 m_last = oldChild.previousSibling(); 437 438 if (oldChild.isNormalFlowOnly()) 439 439 dirtyNormalFlowList(); 440 if (!oldChild ->isNormalFlowOnly() || oldChild->firstChild()) {440 if (!oldChild.isNormalFlowOnly() || oldChild.firstChild()) { 441 441 // Dirty the z-order list in which we are contained. When called via the 442 442 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected 443 443 // from the main layer tree, so we need to null-check the |stackingContext| value. 444 oldChild ->dirtyStackingContextZOrderLists();445 } 446 447 oldChild ->setPreviousSibling(nullptr);448 oldChild ->setNextSibling(nullptr);449 oldChild ->setParent(nullptr);450 451 oldChild ->updateDescendantDependentFlags();452 if (oldChild ->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)444 oldChild.dirtyStackingContextZOrderLists(); 445 } 446 447 oldChild.setPreviousSibling(nullptr); 448 oldChild.setNextSibling(nullptr); 449 oldChild.setParent(nullptr); 450 451 oldChild.updateDescendantDependentFlags(); 452 if (oldChild.m_hasVisibleContent || oldChild.m_hasVisibleDescendant) 453 453 dirtyAncestorChainVisibleDescendantStatus(); 454 454 455 if (oldChild ->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescendant())455 if (oldChild.isSelfPaintingLayer() || oldChild.hasSelfPaintingLayerDescendant()) 456 456 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 457 457 458 458 #if ENABLE(CSS_COMPOSITING) 459 if (oldChild ->hasBlendMode() || (oldChild->hasNotIsolatedBlendingDescendants() && !oldChild->isolatesBlending()))459 if (oldChild.hasBlendMode() || (oldChild.hasNotIsolatedBlendingDescendants() && !oldChild.isolatesBlending())) 460 460 dirtyAncestorChainHasBlendingDescendants(); 461 461 #endif 462 463 return oldChild;464 462 } 465 463 … … 472 470 ASSERT(parentLayer); 473 471 RenderLayer* beforeChild = parentLayer->reflectionLayer() != this ? renderer().parent()->findNextLayer(parentLayer, &renderer()) : nullptr; 474 parentLayer->addChild( this, beforeChild);472 parentLayer->addChild(*this, beforeChild); 475 473 } 476 474 … … 502 500 // The reflection layer should not be moved to the parent. 503 501 if (reflection()) 504 removeChild( reflectionLayer());502 removeChild(*reflectionLayer()); 505 503 506 504 // Now walk our kids and reattach them to our parent. … … 508 506 while (current) { 509 507 RenderLayer* next = current->nextSibling(); 510 removeChild( current);511 m_parent->addChild( current, nextSib);508 removeChild(*current); 509 m_parent->addChild(*current, nextSib); 512 510 current->setRepaintStatus(NeedsFullRepaint); 513 511 current = next; … … 515 513 516 514 // Remove us from the parent. 517 m_parent->removeChild( this);515 m_parent->removeChild(*this); 518 516 renderer().destroyLayer(); 519 517 } -
TabularUnified trunk/Source/WebCore/rendering/RenderLayer.h ¶
r237117 r237121 163 163 } 164 164 165 void addChild(RenderLayer *newChild, RenderLayer* beforeChild = nullptr);166 RenderLayer* removeChild(RenderLayer*);165 void addChild(RenderLayer& newChild, RenderLayer* beforeChild = nullptr); 166 void removeChild(RenderLayer&); 167 167 168 168 void insertOnlyThisLayer();
Note:
See TracChangeset
for help on using the changeset viewer.