Skip to content
Permalink
Browse files
[RenderTreeBuilder] Rename RenderTreeBuilder::removeAndDestroyChild()…
… -> removeAndDestroy()

https://bugs.webkit.org/show_bug.cgi?id=182934
<rdar://problem/37678241>

Reviewed by Antti Koivisto.

No change in functionality.

* dom/Document.cpp:
(WebCore::Document::setFullScreenRenderer):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
* rendering/RenderButton.cpp:
(WebCore::RenderButton::setText):
* rendering/RenderFullScreen.cpp:
(WebCore::RenderFullScreen::willBeDestroyed):
(WebCore::RenderFullScreen::unwrapRenderer):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::willBeDestroyed):
* rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::willBeDestroyed):
(WebCore::RenderTextFragment::setText):
* rendering/RenderView.cpp:
(WebCore::RenderView::willBeDestroyed):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAndDestroy):
(WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
(WebCore::RenderTreeBuilder::removeAndDestroyChild): Deleted.
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::takeChild):
* rendering/updating/RenderTreeBuilderFirstLetter.cpp:
(WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
(WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
* rendering/updating/RenderTreeBuilderList.cpp:
(WebCore::RenderTreeBuilder::List::updateItemMarker):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
(WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
* rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
(WebCore::RenderTreeBuilder::Ruby::takeChild):


Canonical link: https://commits.webkit.org/198688@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228704 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Feb 19, 2018
1 parent 6dfbe41 commit aecd27edf6c4356dca51ee6b474cf6eed4567624
@@ -1,3 +1,48 @@
2018-02-19 Zalan Bujtas <zalan@apple.com>

[RenderTreeBuilder] Rename RenderTreeBuilder::removeAndDestroyChild() -> removeAndDestroy()
https://bugs.webkit.org/show_bug.cgi?id=182934
<rdar://problem/37678241>

Reviewed by Antti Koivisto.

No change in functionality.

* dom/Document.cpp:
(WebCore::Document::setFullScreenRenderer):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
* rendering/RenderButton.cpp:
(WebCore::RenderButton::setText):
* rendering/RenderFullScreen.cpp:
(WebCore::RenderFullScreen::willBeDestroyed):
(WebCore::RenderFullScreen::unwrapRenderer):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::willBeDestroyed):
* rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::willBeDestroyed):
(WebCore::RenderTextFragment::setText):
* rendering/RenderView.cpp:
(WebCore::RenderView::willBeDestroyed):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAndDestroy):
(WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
(WebCore::RenderTreeBuilder::removeAndDestroyChild): Deleted.
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::takeChild):
* rendering/updating/RenderTreeBuilderFirstLetter.cpp:
(WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
(WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
* rendering/updating/RenderTreeBuilderList.cpp:
(WebCore::RenderTreeBuilder::List::updateItemMarker):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
(WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
* rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
(WebCore::RenderTreeBuilder::Ruby::takeChild):

2018-02-19 Daniel Bates <dabates@apple.com>

Do not block authentication challenge to navigated resources
@@ -6315,7 +6315,7 @@ void Document::setFullScreenRenderer(RenderTreeBuilder& builder, RenderFullScree
}

if (m_fullScreenRenderer)
builder.removeAndDestroyChild(*m_fullScreenRenderer);
builder.removeAndDestroy(*m_fullScreenRenderer);
ASSERT(!m_fullScreenRenderer);

m_fullScreenRenderer = makeWeakPtr(renderer);
@@ -2558,7 +2558,7 @@ void RenderBoxModelObject::removeAndDestroyAllContinuations(RenderTreeBuilder& b
ASSERT(continuationChainNodeMap().contains(this));
auto& continuationChainNode = *continuationChainNodeMap().get(this);
while (continuationChainNode.next)
builder.removeAndDestroyChild(*continuationChainNode.next->renderer);
builder.removeAndDestroy(*continuationChainNode.next->renderer);
removeFromContinuationChain();
}

@@ -117,9 +117,9 @@ void RenderButton::setText(const String& str)
return;
}
if (RenderTreeBuilder::current())
RenderTreeBuilder::current()->removeAndDestroyChild(*m_buttonText);
RenderTreeBuilder::current()->removeAndDestroy(*m_buttonText);
else
RenderTreeBuilder(*document().renderView()).removeAndDestroyChild(*m_buttonText);
RenderTreeBuilder(*document().renderView()).removeAndDestroy(*m_buttonText);
}

String RenderButton::text() const
@@ -61,7 +61,7 @@ RenderFullScreen::RenderFullScreen(Document& document, RenderStyle&& style)
void RenderFullScreen::willBeDestroyed(RenderTreeBuilder& builder)
{
if (m_placeholder) {
builder.removeAndDestroyChild(*m_placeholder);
builder.removeAndDestroy(*m_placeholder);
ASSERT(!m_placeholder);
}

@@ -169,7 +169,7 @@ void RenderFullScreen::unwrapRenderer(bool& requiresRenderTreeRebuild)
if (auto* nonAnonymousChild = downcast<RenderBlock>(*child).firstChild())
child = nonAnonymousChild;
else {
builder.removeAndDestroyChild(*child);
builder.removeAndDestroy(*child);
continue;
}
}
@@ -184,10 +184,10 @@ void RenderFullScreen::unwrapRenderer(bool& requiresRenderTreeRebuild)
}
}
if (placeholder())
builder.removeAndDestroyChild(*placeholder());
builder.removeAndDestroy(*placeholder());
ASSERT(!placeholder());

builder.removeAndDestroyChild(*this);
builder.removeAndDestroy(*this);
}

void RenderFullScreen::createPlaceholder(std::unique_ptr<RenderStyle> style, const LayoutRect& frameRect)
@@ -58,7 +58,7 @@ RenderListItem::~RenderListItem()
void RenderListItem::willBeDestroyed(RenderTreeBuilder& builder)
{
if (m_marker)
builder.removeAndDestroyChild(*m_marker);
builder.removeAndDestroy(*m_marker);
RenderBlockFlow::willBeDestroyed(builder);
}

@@ -77,7 +77,7 @@ void RenderTextFragment::styleDidChange(StyleDifference diff, const RenderStyle*
void RenderTextFragment::willBeDestroyed(RenderTreeBuilder& builder)
{
if (m_firstLetter)
builder.removeAndDestroyChild(*m_firstLetter);
builder.removeAndDestroy(*m_firstLetter);
RenderText::willBeDestroyed(builder);
}

@@ -89,9 +89,9 @@ void RenderTextFragment::setText(const String& newText, bool force)
if (!m_firstLetter)
return;
if (RenderTreeBuilder::current())
RenderTreeBuilder::current()->removeAndDestroyChild(*m_firstLetter);
RenderTreeBuilder::current()->removeAndDestroy(*m_firstLetter);
else
RenderTreeBuilder(*document().renderView()).removeAndDestroyChild(*m_firstLetter);
RenderTreeBuilder(*document().renderView()).removeAndDestroy(*m_firstLetter);
ASSERT(!m_firstLetter);
ASSERT(!textNode() || textNode()->renderer() == this);
}
@@ -616,7 +616,7 @@ void RenderView::willBeDestroyed(RenderTreeBuilder& builder)
RenderBlockFlow::willBeDestroyed(builder);
// FIXME: This is a workaround for leftover content (see webkit.org/b/182547).
while (firstChild())
builder.removeAndDestroyChild(*firstChild());
builder.removeAndDestroy(*firstChild());

ASSERT_WITH_MESSAGE(m_rendererCount == 1, "All other renderers in this render tree should have been destroyed");
}
@@ -139,7 +139,7 @@ RenderTreeBuilder::~RenderTreeBuilder()
s_current = m_previous;
}

void RenderTreeBuilder::removeAndDestroyChild(RenderObject& child)
void RenderTreeBuilder::removeAndDestroy(RenderObject& child)
{
ASSERT(child.parent());
auto toDestroy = takeChild(*child.parent(), child);
@@ -154,7 +154,7 @@ void RenderTreeBuilder::removeAndDestroyChild(RenderObject& child)
auto& firstChild = *childToDestroy.firstChild();
if (auto* node = firstChild.node())
node->setRenderer(nullptr);
removeAndDestroyChild(firstChild);
removeAndDestroy(firstChild);
}
}

@@ -646,7 +646,7 @@ void RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers(Re
{
// If the tree is destroyed, there is no need for a clean-up phase.
if (child.renderTreeBeingDestroyed()) {
removeAndDestroyChild(child);
removeAndDestroy(child);
return;
}

@@ -658,7 +658,7 @@ void RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers(Re
tableBuilder().collapseAndDestroyAnonymousSiblingRows(downcast<RenderTableRow>(destroyRoot));

auto& destroyRootParent = *destroyRoot.parent();
removeAndDestroyChild(destroyRoot);
removeAndDestroy(destroyRoot);
removeAnonymousWrappersForInlineChildrenIfNeeded(destroyRootParent);

// Anonymous parent might have become empty, try to delete it too.
@@ -44,7 +44,7 @@ class RenderTreeBuilder {
void insertChild(RenderTreePosition&, RenderPtr<RenderObject>);
void insertChild(RenderElement& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);

void removeAndDestroyChild(RenderObject& child);
void removeAndDestroy(RenderObject& child);
RenderPtr<RenderObject> takeChild(RenderElement&, RenderObject&) WARN_UNUSED_RETURN;

// NormalizeAfterInsertion::Yes ensures that the destination subtree is consistent after the insertion (anonymous wrappers etc).
@@ -319,7 +319,7 @@ RenderPtr<RenderObject> RenderTreeBuilder::Block::takeChild(RenderBlock& parent,

// Delete the now-empty block's lines and nuke it.
nextBlock.deleteLines();
m_builder.removeAndDestroyChild(nextBlock);
m_builder.removeAndDestroy(nextBlock);
next = nullptr;
}
}
@@ -185,7 +185,7 @@ void RenderTreeBuilder::FirstLetter::updateStyle(RenderBlock& firstLetterBlock,
remainingText->setFirstLetter(*newFirstLetter);
newFirstLetter->setFirstLetterRemainingText(*remainingText);
}
m_builder.removeAndDestroyChild(*firstLetter);
m_builder.removeAndDestroy(*firstLetter);
m_builder.insertChild(*firstLetterContainer, WTFMove(newFirstLetter), nextSibling);
return;
}
@@ -241,7 +241,7 @@ void RenderTreeBuilder::FirstLetter::createRenderers(RenderBlock& firstLetterBlo

auto* textNode = currentTextChild.textNode();
auto* beforeChild = currentTextChild.nextSibling();
m_builder.removeAndDestroyChild(currentTextChild);
m_builder.removeAndDestroy(currentTextChild);

// Construct a text fragment for the text after the first letter.
// This text fragment might be empty.
@@ -80,7 +80,7 @@ void RenderTreeBuilder::List::updateItemMarker(RenderListItem& listItemRenderer)

if (style.listStyleType() == NoneListStyle && (!style.listStyleImage() || style.listStyleImage()->errorOccurred())) {
if (auto* marker = listItemRenderer.markerRenderer())
m_builder.removeAndDestroyChild(*marker);
m_builder.removeAndDestroy(*marker);
return;
}

@@ -121,7 +121,7 @@ void RenderTreeBuilder::List::updateItemMarker(RenderListItem& listItemRenderer)

// If current parent is an anonymous block that has lost all its children, destroy it.
if (currentParent && currentParent->isAnonymousBlock() && !currentParent->firstChild() && !downcast<RenderBlock>(*currentParent).continuation())
m_builder.removeAndDestroyChild(*currentParent);
m_builder.removeAndDestroy(*currentParent);
}

}
@@ -212,11 +212,11 @@ void RenderTreeBuilder::MultiColumn::destroyFragmentedFlow(RenderBlockFlow& flow
parentAndSpannerList.append(std::make_pair(spannerOriginalParent, m_builder.takeChild(*spanner->parent(), *spanner)));
}
while (auto* columnSet = multiColumnFlow.firstMultiColumnSet())
m_builder.removeAndDestroyChild(*columnSet);
m_builder.removeAndDestroy(*columnSet);

flow.clearMultiColumnFlow();
m_builder.moveAllChildrenTo(multiColumnFlow, flow, RenderTreeBuilder::NormalizeAfterInsertion::Yes);
m_builder.removeAndDestroyChild(multiColumnFlow);
m_builder.removeAndDestroy(multiColumnFlow);
for (auto& parentAndSpanner : parentAndSpannerList)
m_builder.insertChild(*parentAndSpanner.first, WTFMove(parentAndSpanner.second));
}
@@ -372,13 +372,13 @@ void RenderTreeBuilder::MultiColumn::handleSpannerRemoval(RenderMultiColumnFlow&
{
// The placeholder may already have been removed, but if it hasn't, do so now.
if (auto placeholder = flow.spannerMap().take(&downcast<RenderBox>(spanner)))
m_builder.removeAndDestroyChild(*placeholder);
m_builder.removeAndDestroy(*placeholder);

if (auto* next = spanner.nextSibling()) {
if (auto* previous = spanner.previousSibling()) {
if (previous->isRenderMultiColumnSet() && next->isRenderMultiColumnSet()) {
// Merge two sets that no longer will be separated by a spanner.
m_builder.removeAndDestroyChild(*next);
m_builder.removeAndDestroy(*next);
previous->setNeedsLayout();
}
}
@@ -166,7 +166,7 @@ void RenderTreeBuilder::Ruby::moveBlockChildren(RenderRubyBase& from, RenderRuby
auto* anonBlockThere = downcast<RenderBlock>(lastChildThere);
m_builder.moveAllChildrenTo(*anonBlockHere, *anonBlockThere, RenderTreeBuilder::NormalizeAfterInsertion::Yes);
anonBlockHere->deleteLines();
m_builder.removeAndDestroyChild(*anonBlockHere);
m_builder.removeAndDestroy(*anonBlockHere);
}
// Move all remaining children normally.
m_builder.moveChildrenTo(from, to, from.firstChild(), beforeChild, RenderTreeBuilder::NormalizeAfterInsertion::No);
@@ -393,7 +393,7 @@ RenderPtr<RenderObject> RenderTreeBuilder::Ruby::takeChild(RenderRubyAsInline& p
ASSERT(child.isBeforeContent() || child.isAfterContent());
auto& parent = *child.parent();
auto takenChild = m_builder.takeChild(parent, child);
m_builder.removeAndDestroyChild(parent);
m_builder.removeAndDestroy(parent);
return takenChild;
}

@@ -417,7 +417,7 @@ RenderPtr<RenderObject> RenderTreeBuilder::Ruby::takeChild(RenderRubyAsBlock& pa
ASSERT(child.isBeforeContent() || child.isAfterContent());
auto& parent = *child.parent();
auto takenChild = m_builder.takeChild(parent, child);
m_builder.removeAndDestroyChild(parent);
m_builder.removeAndDestroy(parent);
return takenChild;
}

0 comments on commit aecd27e

Please sign in to comment.