Skip to content

Commit

Permalink
[IFC][Ruby][Integration] Propage style to anomymous inlines
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=262877
rdar://116668321

Reviewed by Alan Baradlay.

Ruby uses anonymous inlines. They need style propagation similar to blocks.

* Source/WebCore/rendering/RenderInline.cpp:
(WebCore::RenderInline::styleDidChange):

Propage similarly to RenderBlock.

* Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForStyleBasedRubyChild):

Take care to call initializeStyle() for the anonymous renderers.

Canonical link: https://commits.webkit.org/269073@main
  • Loading branch information
anttijk committed Oct 9, 2023
1 parent 08de817 commit 2aa546e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/RenderInline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
lineLayout->updateStyle(*this, *oldStyle);
}
}

propagateStyleToAnonymousChildren(PropagateToAllChildren);
}

bool RenderInline::mayAffectLayout() const
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ RenderElement& RenderTreeBuilder::Ruby::findOrCreateParentForStyleBasedRubyChild

if (parent.style().display() != DisplayType::Ruby) {
auto rubyContainer = createRenderer<RenderInline>(RenderObject::Type::Inline, parent.document(), RenderStyle::createAnonymousStyleWithDisplay(parent.style(), DisplayType::Ruby));
rubyContainer->initializeStyle();
WeakPtr newParent = rubyContainer.get();
m_builder.attach(parent, WTFMove(rubyContainer), beforeChild);
beforeChild = nullptr;
Expand All @@ -389,6 +390,7 @@ RenderElement& RenderTreeBuilder::Ruby::findOrCreateParentForStyleBasedRubyChild
}

auto rubyBase = createRenderer<RenderInline>(RenderObject::Type::Inline, parent.document(), RenderStyle::createAnonymousStyleWithDisplay(parent.style(), DisplayType::RubyBase));
rubyBase->initializeStyle();
WeakPtr newParent = rubyBase.get();
m_builder.inlineBuilder().attach(downcast<RenderInline>(parent), WTFMove(rubyBase), beforeChild);
beforeChild = nullptr;
Expand Down

0 comments on commit 2aa546e

Please sign in to comment.