Changeset 223131 in webkit
- Timestamp:
- Oct 10, 2017 6:02:47 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223126 r223131 1 2017-10-10 Antti Koivisto <antti@apple.com> 2 3 RenderObject::destroy() should only be invoked after renderer has been removed from the tree 4 https://bugs.webkit.org/show_bug.cgi?id=178075 5 6 Reviewed by Zalan Bujtas. 7 8 * accessibility/mac/textbox-role-reports-notifications.html: 9 10 This passed because spurious AXValueChanged notifications. Force layout to prevent coalescing between mutations. 11 1 12 2017-10-10 Joanmarie Diggs <jdiggs@igalia.com> 2 13 -
trunk/LayoutTests/accessibility/mac/textbox-role-reports-notifications.html
r217171 r223131 20 20 pendingNotifications = 3; 21 21 ariaTextBox.firstChild.deleteData(0, 5); 22 ariaTextBox.offsetWidth; 22 23 ariaTextBox.textContent = "changed textContent"; 24 ariaTextBox.offsetWidth; 23 25 ariaTextBox.innerText = "changed innerText"; 24 26 } -
trunk/Source/WebCore/ChangeLog
r223127 r223131 1 2017-10-10 Antti Koivisto <antti@apple.com> 2 3 RenderObject::destroy() should only be invoked after renderer has been removed from the tree 4 https://bugs.webkit.org/show_bug.cgi?id=178075 5 6 Reviewed by Zalan Bujtas. 7 8 This patch fixes the remaining cases where the renderer is still in the tree while destroy() 9 is called and adds the assert. 10 11 * rendering/RenderBlock.cpp: 12 (WebCore::RenderBlock::removeLeftoverAnonymousBlock): 13 (WebCore::RenderBlock::takeChild): 14 * rendering/RenderBoxModelObject.cpp: 15 (WebCore::RenderBoxModelObject::willBeDestroyed): 16 * rendering/RenderLayer.cpp: 17 (WebCore::RenderLayer::~RenderLayer): 18 19 Null the parent pointers for m_scrollCorner/m_resizer. 20 21 (WebCore::RenderLayer::calculateClipRects const): 22 * rendering/RenderLayer.h: 23 * rendering/RenderObject.cpp: 24 (WebCore::RenderObject::willBeDestroyed): 25 (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): 26 (WebCore::RenderObject::destroy): 27 28 Use RELEASE_ASSERT as these are cheap and important checks. 29 Also turn isBeingDestroyed test into RELEASE_ASSERT. 30 Remove AX call that no longer does anything. 31 32 (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers): Deleted. 33 * rendering/RenderObject.h: 34 * rendering/RenderRubyBase.cpp: 35 (WebCore::RenderRubyBase::moveBlockChildren): 36 * rendering/RenderTableRow.cpp: 37 (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): 38 (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows): Deleted. 39 40 Renamed and made this no longer destroy itself. The caller now takes care of that. 41 Removed an unnecessary lambda. 42 43 * rendering/RenderTableRow.h: 44 * style/RenderTreeUpdater.cpp: 45 (WebCore::RenderTreeUpdater::tearDownRenderers): 46 (WebCore::RenderTreeUpdater::tearDownRenderer): 47 * style/RenderTreeUpdaterListItem.cpp: 48 (WebCore::RenderTreeUpdater::ListItem::updateMarker): 49 1 50 2017-10-09 Antti Koivisto <antti@apple.com> 2 51 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r223072 r223131 765 765 } 766 766 767 child->setFirstChild( 0);768 child->m_next = 0;767 child->setFirstChild(nullptr); 768 child->m_next = nullptr; 769 769 770 770 // Remove all the information in the flow thread associated with the leftover anonymous block. 771 771 child->resetFragmentedFlowStateOnRemoval(); 772 772 773 child->setParent( 0);774 child->setPreviousSibling( 0);775 child->setNextSibling( 0);773 child->setParent(nullptr); 774 child->setPreviousSibling(nullptr); 775 child->setNextSibling(nullptr); 776 776 777 777 child->destroy(); … … 876 876 // Delete the now-empty block's lines and nuke it. 877 877 nextBlock.deleteLines(); 878 nextBlock. destroy();878 nextBlock.removeFromParentAndDestroy(); 879 879 next = nullptr; 880 880 } … … 935 935 } 936 936 setContinuation(nullptr); 937 destroy(); 937 // FIXME: This is dangerous. 938 removeFromParentAndDestroy(); 938 939 } 939 940 } -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r223127 r223131 189 189 { 190 190 if (hasContinuation()) { 191 continuation()-> destroy();191 continuation()->removeFromParentAndDestroy(); 192 192 setContinuation(nullptr); 193 193 } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r222575 r223131 370 370 removeReflection(); 371 371 372 clearScrollCorner(); 373 clearResizer(); 374 372 375 FilterInfo::remove(*this); 373 376 … … 6664 6667 6665 6668 if (!corner) { 6666 m_scrollCorner = nullptr;6669 clearScrollCorner(); 6667 6670 return; 6668 6671 } … … 6670 6673 if (!m_scrollCorner) { 6671 6674 m_scrollCorner = createRenderer<RenderScrollbarPart>(renderer().document(), WTFMove(*corner)); 6675 // FIXME: A renderer should be a child of its parent! 6672 6676 m_scrollCorner->setParent(&renderer()); 6673 6677 m_scrollCorner->initializeStyle(); … … 6676 6680 } 6677 6681 6682 void RenderLayer::clearScrollCorner() 6683 { 6684 if (!m_scrollCorner) 6685 return; 6686 m_scrollCorner->setParent(nullptr); 6687 m_scrollCorner = nullptr; 6688 } 6689 6678 6690 void RenderLayer::updateResizerStyle() 6679 6691 { … … 6682 6694 6683 6695 if (!resizer) { 6684 m_resizer = nullptr;6696 clearResizer(); 6685 6697 return; 6686 6698 } … … 6688 6700 if (!m_resizer) { 6689 6701 m_resizer = createRenderer<RenderScrollbarPart>(renderer().document(), WTFMove(*resizer)); 6702 // FIXME: A renderer should be a child of its parent! 6690 6703 m_resizer->setParent(&renderer()); 6691 6704 m_resizer->initializeStyle(); … … 6694 6707 } 6695 6708 6709 void RenderLayer::clearResizer() 6710 { 6711 if (!m_resizer) 6712 return; 6713 m_resizer->setParent(nullptr); 6714 m_resizer = nullptr; 6715 } 6716 6696 6717 RenderLayer* RenderLayer::reflectionLayer() const 6697 6718 { … … 6703 6724 ASSERT(!m_reflection); 6704 6725 m_reflection = createRenderer<RenderReplica>(renderer().document(), createReflectionStyle()); 6726 // FIXME: A renderer should be a child of its parent! 6705 6727 m_reflection->setParent(&renderer()); // We create a 1-way connection. 6706 6728 m_reflection->initializeStyle(); -
trunk/Source/WebCore/rendering/RenderLayer.h
r222575 r223131 979 979 void positionOverflowControls(const IntSize&); 980 980 void updateScrollCornerStyle(); 981 void clearScrollCorner(); 981 982 void updateResizerStyle(); 983 void clearResizer(); 982 984 983 985 void drawPlatformResizerImage(GraphicsContext&, const LayoutRect& resizerCornerRect); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r223047 r223131 1429 1429 void RenderObject::willBeDestroyed() 1430 1430 { 1431 // For accessibility management, notify the parent of the imminent change to its child set. 1432 // We do it now, before remove(), while the parent pointer is still available. 1433 if (AXObjectCache* cache = document().existingAXObjectCache()) 1434 cache->childrenChanged(this->parent()); 1435 1436 if (m_parent) { 1437 // FIXME: We should have always been removed from the parent before being destroyed. 1438 auto takenThis = m_parent->takeChild(*this); 1439 auto* leakedPtr = takenThis.release(); 1440 UNUSED_PARAM(leakedPtr); 1441 } 1442 1431 ASSERT(!m_parent); 1443 1432 ASSERT(renderTreeBeingDestroyed() || !is<RenderElement>(*this) || !view().frameView().hasSlowRepaintObject(downcast<RenderElement>(*this))); 1444 1433 1445 // The remove() call above may invoke axObjectCache()->childrenChanged() on the parent, which may require the AX render1446 // object for this renderer. So we remove the AX render object now, after the renderer is removed.1447 1434 if (AXObjectCache* cache = document().existingAXObjectCache()) 1448 1435 cache->remove(this); … … 1477 1464 } 1478 1465 1479 void RenderObject:: destroyAndCleanupAnonymousWrappers()1466 void RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers() 1480 1467 { 1481 1468 // If the tree is destroyed, there is no need for a clean-up phase. 1482 1469 if (renderTreeBeingDestroyed()) { 1483 destroy();1470 removeFromParentAndDestroy(); 1484 1471 return; 1485 1472 } … … 1498 1485 } 1499 1486 1500 if (is<RenderTableRow>(*destroyRoot)) { 1501 downcast<RenderTableRow>(*destroyRoot).destroyAndCollapseAnonymousSiblingRows(); 1502 return; 1503 } 1504 1505 destroyRoot->destroy(); 1487 if (is<RenderTableRow>(*destroyRoot)) 1488 downcast<RenderTableRow>(*destroyRoot).collapseAndDestroyAnonymousSiblingRows(); 1489 1490 destroyRoot->removeFromParentAndDestroy(); 1506 1491 // WARNING: |this| is deleted here. 1507 1492 } … … 1509 1494 void RenderObject::destroy() 1510 1495 { 1511 ASSERT(!m_bitfields.beingDestroyed()); 1496 RELEASE_ASSERT(!m_parent); 1497 RELEASE_ASSERT(!m_next); 1498 RELEASE_ASSERT(!m_previous); 1499 RELEASE_ASSERT(!m_bitfields.beingDestroyed()); 1500 1512 1501 m_bitfields.setBeingDestroyed(true); 1513 1502 -
trunk/Source/WebCore/rendering/RenderObject.h
r223127 r223131 722 722 bool renderTreeBeingDestroyed() const; 723 723 724 void destroyAndCleanupAnonymousWrappers();725 724 void destroy(); 726 725 … … 749 748 750 749 void removeFromParentAndDestroy(); 750 void removeFromParentAndDestroyCleaningUpAnonymousWrappers(); 751 751 752 752 CSSAnimationController& animation() const; -
trunk/Source/WebCore/rendering/RenderRubyBase.cpp
r222679 r223131 126 126 anonBlockHere->moveAllChildrenTo(anonBlockThere, true); 127 127 anonBlockHere->deleteLines(); 128 anonBlockHere-> destroy();128 anonBlockHere->removeFromParentAndDestroy(); 129 129 } 130 130 // Move all remaining children normally. -
trunk/Source/WebCore/rendering/RenderTableRow.cpp
r222679 r223131 285 285 } 286 286 287 void RenderTableRow::destroyAndCollapseAnonymousSiblingRows() 288 { 289 auto collapseAnonymousSiblingRows = [&] { 290 auto* section = this->section(); 291 if (!section) 287 void RenderTableRow::collapseAndDestroyAnonymousSiblingRows() 288 { 289 auto* section = this->section(); 290 if (!section) 291 return; 292 293 // All siblings generated? 294 for (auto* current = section->firstRow(); current; current = current->nextRow()) { 295 if (current == this) 296 continue; 297 if (!current->isAnonymous()) 292 298 return; 293 294 // All siblings generated? 295 for (auto* current = section->firstRow(); current; current = current->nextRow()) { 296 if (current == this) 297 continue; 298 if (!current->isAnonymous()) 299 return; 300 } 301 302 RenderTableRow* rowToInsertInto = nullptr; 303 auto* currentRow = section->firstRow(); 304 while (currentRow) { 305 if (currentRow == this) { 306 currentRow = currentRow->nextRow(); 307 continue; 308 } 309 if (!rowToInsertInto) { 310 rowToInsertInto = currentRow; 311 currentRow = currentRow->nextRow(); 312 continue; 313 } 314 currentRow->moveAllChildrenTo(rowToInsertInto); 315 auto* destroyThis = currentRow; 299 } 300 301 RenderTableRow* rowToInsertInto = nullptr; 302 auto* currentRow = section->firstRow(); 303 while (currentRow) { 304 if (currentRow == this) { 316 305 currentRow = currentRow->nextRow(); 317 destroyThis->destroy(); 318 } 319 if (rowToInsertInto) 320 rowToInsertInto->setNeedsLayout(); 321 }; 322 323 collapseAnonymousSiblingRows(); 324 destroy(); 306 continue; 307 } 308 if (!rowToInsertInto) { 309 rowToInsertInto = currentRow; 310 currentRow = currentRow->nextRow(); 311 continue; 312 } 313 currentRow->moveAllChildrenTo(rowToInsertInto); 314 auto toDestroy = section->takeChild(*currentRow); 315 currentRow = currentRow->nextRow(); 316 } 317 if (rowToInsertInto) 318 rowToInsertInto->setNeedsLayout(); 325 319 } 326 320 -
trunk/Source/WebCore/rendering/RenderTableRow.h
r222679 r223131 63 63 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; 64 64 65 void destroyAndCollapseAnonymousSiblingRows();65 void collapseAndDestroyAnonymousSiblingRows(); 66 66 67 67 private: -
trunk/Source/WebCore/style/RenderTreeUpdater.cpp
r222679 r223131 521 521 522 522 if (auto* renderer = element.renderer()) { 523 renderer-> destroyAndCleanupAnonymousWrappers();523 renderer->removeFromParentAndDestroyCleaningUpAnonymousWrappers(); 524 524 element.setRenderer(nullptr); 525 525 } … … 551 551 if (!renderer) 552 552 return; 553 renderer-> destroyAndCleanupAnonymousWrappers();553 renderer->removeFromParentAndDestroyCleaningUpAnonymousWrappers(); 554 554 text.setRenderer(nullptr); 555 555 } -
trunk/Source/WebCore/style/RenderTreeUpdaterListItem.cpp
r222936 r223131 117 117 // If current parent is an anonymous block that has lost all its children, destroy it. 118 118 if (currentParent && currentParent->isAnonymousBlock() && !currentParent->firstChild() && !downcast<RenderBlock>(*currentParent).continuation()) 119 currentParent-> destroy();119 currentParent->removeFromParentAndDestroy(); 120 120 } 121 121 }
Note: See TracChangeset
for help on using the changeset viewer.