Skip to content
Permalink
Browse files
[RenderTreeBuilder] Move RenderBlock::dropAnonymousBoxChild to Render…
…TreeBuilder

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

Reviewed by Antti Koivisto.

All the callsites are now in RenderTreeBuilder.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::dropAnonymousBoxChild): Deleted.
* rendering/RenderBlock.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):
(WebCore::RenderTreeBuilder::dropAnonymousBoxChild):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::takeChild):
(WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
* rendering/updating/RenderTreeBuilderBlock.h:


Canonical link: https://commits.webkit.org/198501@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228391 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Feb 12, 2018
1 parent 33771f4 commit 435b7689014bb6348177d90b5d21665f8fe43f9d
@@ -1,3 +1,27 @@
2018-02-12 Zalan Bujtas <zalan@apple.com>

[RenderTreeBuilder] Move RenderBlock::dropAnonymousBoxChild to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=182704
<rdar://problem/37469469>

Reviewed by Antti Koivisto.

All the callsites are now in RenderTreeBuilder.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::dropAnonymousBoxChild): Deleted.
* rendering/RenderBlock.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):
(WebCore::RenderTreeBuilder::dropAnonymousBoxChild):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::takeChild):
(WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
* rendering/updating/RenderTreeBuilderBlock.h:

2018-02-12 Matt Lewis <jlewis3@apple.com>

Unreviewed, rolling out r228376.
@@ -482,18 +482,6 @@ void RenderBlock::deleteLines()
cache->deferRecomputeIsIgnored(element());
}

void RenderBlock::dropAnonymousBoxChild(RenderTreeBuilder& builder, RenderBlock& child)
{
setNeedsLayoutAndPrefWidthsRecalc();
setChildrenInline(child.childrenInline());
RenderObject* nextSibling = child.nextSibling();

auto toBeDeleted = takeChildInternal(child);
child.moveAllChildrenTo(builder, this, nextSibling, RenderBoxModelObject::NormalizeAfterInsertion::No);
// Delete the now-empty block's lines and nuke it.
child.deleteLines();
}

RenderPtr<RenderObject> RenderBlock::takeChild(RenderTreeBuilder& builder, RenderObject& oldChild)
{
return builder.takeChildFromRenderBlock(*this, oldChild);
@@ -191,7 +191,6 @@ class RenderBlock : public RenderBox {

static RenderPtr<RenderBlock> createAnonymousWithParentRendererAndDisplay(const RenderBox& parent, EDisplay = BLOCK);
RenderPtr<RenderBlock> createAnonymousBlock(EDisplay = BLOCK) const;
void dropAnonymousBoxChild(RenderTreeBuilder&, RenderBlock& child);

RenderPtr<RenderBox> createAnonymousBoxWithSameTypeAs(const RenderBox&) const override;

@@ -342,7 +342,7 @@ void RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded(RenderE
for (current = blockParent.firstChild(); current; current = next) {
next = current->nextSibling();
if (current->isAnonymousBlock())
blockParent.dropAnonymousBoxChild(*this, downcast<RenderBlock>(*current));
blockBuilder().dropAnonymousBoxChild(blockParent, downcast<RenderBlock>(*current));
}
}

@@ -405,6 +405,12 @@ void RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers(Re
removeFromParentAndDestroyCleaningUpAnonymousWrappers(destroyRootParent);
// WARNING: child is deleted here.
}

void RenderTreeBuilder::dropAnonymousBoxChild(RenderBlock& parent, RenderBlock& child)
{
blockBuilder().dropAnonymousBoxChild(parent, child);
}

void RenderTreeBuilder::multiColumnRelativeWillBeRemoved(RenderMultiColumnFlow& flow, RenderObject& relative)
{
multiColumnBuilder().multiColumnRelativeWillBeRemoved(flow, relative);
@@ -88,6 +88,7 @@ class RenderTreeBuilder {
void removeFromParentAndDestroyCleaningUpAnonymousWrappers(RenderObject& child);
void multiColumnDescendantInserted(RenderMultiColumnFlow&, RenderObject& newDescendant);
void multiColumnRelativeWillBeRemoved(RenderMultiColumnFlow&, RenderObject& relative);
void dropAnonymousBoxChild(RenderBlock& parent, RenderBlock& child);

private:
class FirstLetter;
@@ -325,7 +325,7 @@ RenderPtr<RenderObject> RenderTreeBuilder::Block::takeChild(RenderBlock& parent,
if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child->nextSibling() && parent.canDropAnonymousBlockChild()) {
// The removal has knocked us down to containing only a single anonymous
// box. We can pull the content right back up into our box.
parent.dropAnonymousBoxChild(m_builder, downcast<RenderBlock>(*child));
dropAnonymousBoxChild(parent, downcast<RenderBlock>(*child));
} else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) && parent.canDropAnonymousBlockChild()) {
// It's possible that the removal has knocked us down to a single anonymous
// block with floating siblings.
@@ -341,7 +341,7 @@ RenderPtr<RenderObject> RenderTreeBuilder::Block::takeChild(RenderBlock& parent,
}
}
if (dropAnonymousBlock)
parent.dropAnonymousBoxChild(m_builder, anonBlock);
dropAnonymousBoxChild(parent, anonBlock);
}
}

@@ -353,4 +353,16 @@ RenderPtr<RenderObject> RenderTreeBuilder::Block::takeChild(RenderBlock& parent,
return takenChild;
}

void RenderTreeBuilder::Block::dropAnonymousBoxChild(RenderBlock& parent, RenderBlock& child)
{
parent.setNeedsLayoutAndPrefWidthsRecalc();
parent.setChildrenInline(child.childrenInline());
auto* nextSibling = child.nextSibling();

auto toBeDeleted = parent.takeChildInternal(child);
child.moveAllChildrenTo(m_builder, &parent, nextSibling, RenderBoxModelObject::NormalizeAfterInsertion::No);
// Delete the now-empty block's lines and nuke it.
child.deleteLines();
}

}
@@ -38,6 +38,7 @@ class RenderTreeBuilder::Block {

RenderPtr<RenderObject> takeChild(RenderBlock& parent, RenderObject& oldChild);

void dropAnonymousBoxChild(RenderBlock& parent, RenderBlock& child);
void childBecameNonInline(RenderBlock& parent, RenderElement& child);

private:

0 comments on commit 435b768

Please sign in to comment.