Skip to content

Commit

Permalink
Do not clear fragmented state when removing inline renderer's anonymo…
Browse files Browse the repository at this point in the history
…us wrapper

https://bugs.webkit.org/show_bug.cgi?id=242734

Reviewed by Antti Koivisto.

When the anonymous block wrapper for an inline level child is not needed anymore (sibling block is removed or became non-inflow), we
1. detach the inline level child (and its subtree)
2. destroy the anonymous wrapper
3. re-attach the inline level child under the new parent (most likely the parent of the destroyed anonymous wrapper)

We call this re-parenting activity an "internal move".
Certain properties (e.g fragmentation state) are not supposed to change during this type of move (we simply stop calling some "reset" functions when RenderObject::IsInternalMove::Yes)

This patch ensures that the internal move flag is set for both #1 and #3.

* Source/WebCore/rendering/RenderBlockFlow.cpp: drive-by fix to ensure no ruby content gets multi-column context.
(WebCore::RenderBlockFlow::willCreateColumns const):
* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): Make sure both detach and attach are covered with the "internal move" flag as currently only the attach is covered. It means that whatever flags we reset at detach (not an internal move) we don't set back on attach (internal move).

Canonical link: https://commits.webkit.org/252456@main
  • Loading branch information
alanbaradlay committed Jul 14, 2022
1 parent 4e6bb84 commit e94f977
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderBlockFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ bool RenderBlockFlow::willCreateColumns(std::optional<unsigned> desiredColumnCou
// The following types are not supposed to create multicol context.
if (isFileUploadControl() || isTextControl() || isListBox())
return false;
if (isRenderSVGBlock() || isRubyRun())
if (isRenderSVGBlock() || isRubyRun() || isRubyBlock() || isRubyInline() || isRubyBase())
return false;
#if ENABLE(MATHML)
if (isRenderMathMLBlock())
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ void RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded(RenderE
}

RenderObject* next = nullptr;
auto internalMoveScope = SetForScope { m_internalMovesType, RenderObject::IsInternalMove::Yes };
for (auto* current = blockParent.firstChild(); current; current = next) {
next = current->nextSibling();
if (current->isAnonymousBlock())
Expand Down

0 comments on commit e94f977

Please sign in to comment.