Skip to content

Commit

Permalink
Merge r228914 - [RenderTreeBuilder] Move RenderObject::insertedInto()…
Browse files Browse the repository at this point in the history
… mutation logic to RenderTreeBuilder

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

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::insertedIntoTree):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::insertChildToRenderElementInternal):
(WebCore::RenderTreeBuilder::moveChildrenTo):
(WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted.
* rendering/updating/RenderTreeBuilder.h:
  • Loading branch information
alanbaradlay authored and carlosgcampos committed Mar 5, 2018
1 parent 04bbd13 commit 68279f3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
18 changes: 18 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
2018-02-21 Zalan Bujtas <zalan@apple.com>

[RenderTreeBuilder] Move RenderObject::insertedInto() mutation logic to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=183022
<rdar://problem/37764326>

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::insertedIntoTree):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::insertChildToRenderElementInternal):
(WebCore::RenderTreeBuilder::moveChildrenTo):
(WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted.
* rendering/updating/RenderTreeBuilder.h:

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

Remove UTF-32 BOM parsing code
Expand Down
5 changes: 0 additions & 5 deletions Source/WebCore/rendering/RenderObject.cpp
Expand Up @@ -1449,13 +1449,8 @@ void RenderObject::willBeDestroyed()
void RenderObject::insertedIntoTree()
{
// FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.

if (!isFloating() && parent()->childrenInline())
parent()->dirtyLinesFromChangedChild(*this);

auto* fragmentedFlow = enclosingFragmentedFlow();
if (is<RenderMultiColumnFlow>(fragmentedFlow))
RenderTreeBuilder::current()->multiColumnDescendantInserted(downcast<RenderMultiColumnFlow>(*fragmentedFlow), *this);
}

void RenderObject::willBeRemovedFromTree()
Expand Down
24 changes: 12 additions & 12 deletions Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Expand Up @@ -387,7 +387,7 @@ void RenderTreeBuilder::insertChildToRenderElementInternal(RenderElement& parent
ASSERT(!parent.isRenderBlockFlow() || (!child->isTableSection() && !child->isTableRow() && !child->isTableCell()));

while (beforeChild && beforeChild->parent() && beforeChild->parent() != &parent)
beforeChild = beforeChild->parent();
beforeChild = beforeChild->parent();

ASSERT(!beforeChild || beforeChild->parent() == &parent);
ASSERT(!is<RenderText>(beforeChild) || !downcast<RenderText>(*beforeChild).inlineWrapperForDisplayContents());
Expand All @@ -398,21 +398,26 @@ void RenderTreeBuilder::insertChildToRenderElementInternal(RenderElement& parent
newChild->initializeFragmentedFlowStateOnInsertion();
if (!parent.renderTreeBeingDestroyed()) {
newChild->insertedIntoTree();

auto* fragmentedFlow = newChild->enclosingFragmentedFlow();
if (is<RenderMultiColumnFlow>(fragmentedFlow))
multiColumnBuilder().multiColumnDescendantInserted(downcast<RenderMultiColumnFlow>(*fragmentedFlow), *newChild);

if (is<RenderElement>(*newChild))
RenderCounter::rendererSubtreeAttached(downcast<RenderElement>(*newChild));
RenderCounter::rendererSubtreeAttached(downcast<RenderElement>(*newChild));
}

newChild->setNeedsLayoutAndPrefWidthsRecalc();
parent.setPreferredLogicalWidthsDirty(true);
if (!parent.normalChildNeedsLayout())
parent.setChildNeedsLayout(); // We may supply the static position for an absolute positioned child.
parent.setChildNeedsLayout(); // We may supply the static position for an absolute positioned child.

if (AXObjectCache* cache = parent.document().axObjectCache())
cache->childrenChanged(&parent, newChild);
cache->childrenChanged(&parent, newChild);
if (is<RenderBlockFlow>(parent))
downcast<RenderBlockFlow>(parent).invalidateLineLayoutPath();
downcast<RenderBlockFlow>(parent).invalidateLineLayoutPath();
if (parent.hasOutlineAutoAncestor() || parent.outlineStyleForRepaint().outlineStyleIsAuto())
newChild->setHasOutlineAutoAncestor();
newChild->setHasOutlineAutoAncestor();
}

void RenderTreeBuilder::moveChildTo(RenderBoxModelObject& from, RenderBoxModelObject& to, RenderObject& child, RenderObject* beforeChild, NormalizeAfterInsertion normalizeAfterInsertion)
Expand Down Expand Up @@ -484,7 +489,7 @@ void RenderTreeBuilder::moveChildrenTo(RenderBoxModelObject& from, RenderBoxMode

// This is the first letter, skip it.
if (firstLetterObj == nextSibling)
nextSibling = nextSibling->nextSibling();
nextSibling = nextSibling->nextSibling();
}

moveChildTo(from, to, *child, beforeChild, normalizeAfterInsertion);
Expand Down Expand Up @@ -632,11 +637,6 @@ void RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock(Rende
removeAnonymousWrappersForInlineChildrenIfNeeded(*child.parent());
}

void RenderTreeBuilder::multiColumnDescendantInserted(RenderMultiColumnFlow& flow, RenderObject& newDescendant)
{
multiColumnBuilder().multiColumnDescendantInserted(flow, newDescendant);
}

static bool isAnonymousAndSafeToDelete(RenderElement& element)
{
if (!element.isAnonymous())
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/rendering/updating/RenderTreeBuilder.h
Expand Up @@ -56,7 +56,6 @@ class RenderTreeBuilder {

void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
void childFlowStateChangesAndNoLongerAffectsParentBlock(RenderElement& child);
void multiColumnDescendantInserted(RenderMultiColumnFlow&, RenderObject& newDescendant);

private:
void insertChildIgnoringContinuation(RenderElement& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
Expand Down

0 comments on commit 68279f3

Please sign in to comment.