Diff
Modified: branches/safari-613-branch/LayoutTests/ChangeLog (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/ChangeLog 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/ChangeLog 2022-04-19 00:49:17 UTC (rev 292983)
@@ -1,5 +1,61 @@
2022-04-18 Kocsen Chung <kocsen_ch...@apple.com>
+ Cherry-pick r291852. rdar://problem/83235846
+
+ Improve rebuilding of ruby subtrees
+ https://bugs.webkit.org/show_bug.cgi?id=238365
+
+ Source/WebCore:
+
+ Patch by Frédéric Wang <fw...@igalia.com> on 2022-03-25
+ Reviewed by Alan Bujtas.
+
+ Don't collapse generated Ruby subtree when tearing down children and take into account the
+ fact that anonymous before/after node can belong to a display: content child.
+
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): Don't collapse.
+ * rendering/updating/RenderTreeBuilderRuby.cpp:
+ (WebCore::lastRubyRun): Child can be also be an anonymous after content.
+ (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): When beforeChild is
+ an anonymous before/after, just fallback to appending to the last ruby run.
+
+ LayoutTests:
+
+ Patch by Frederic Wang <fred.w...@free.fr> on 2022-03-25
+ Reviewed by Alan Bujtas.
+
+ Expectation for rubyDOM-remove-text2.html is updated now that we don't collapse anonymous
+ RenderRubyBase nodes.
+
+ * platform/gtk/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/ios/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/mac/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/win/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/wincairo/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/wpe/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-25 Frederic Wang <fred.w...@free.fr>
+
+ Improve rebuilding of ruby subtrees
+ https://bugs.webkit.org/show_bug.cgi?id=238365
+
+ Reviewed by Alan Bujtas.
+
+ Expectation for rubyDOM-remove-text2.html is updated now that we don't collapse anonymous
+ RenderRubyBase nodes.
+
+ * platform/gtk/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/ios/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/mac/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/win/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/wincairo/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/wpe/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+
+2022-04-18 Kocsen Chung <kocsen_ch...@apple.com>
+
Cherry-pick r290622. rdar://problem/90454629
REBASELINE [ iOS15 ] fast/text/khmer-lao-font.html is a constant text failure
Modified: branches/safari-613-branch/LayoutTests/platform/gtk/fast/ruby/rubyDOM-remove-text2-expected.txt (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/platform/gtk/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/platform/gtk/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:17 UTC (rev 292983)
@@ -20,6 +20,7 @@
RenderRubyText {RT} at (0,-10) size 114x10
RenderText {#text} at (0,0) size 114x10
text run at (0,0) width 114: "Hyper-text Markup Language"
+ RenderRubyBase (anonymous) at (0,0) size 114x0
RenderRubyRun (anonymous) at (268,0) size 9x18
RenderRubyBase (anonymous) at (0,0) size 8x18
RenderText {#text} at (0,0) size 8x17
Modified: branches/safari-613-branch/LayoutTests/platform/ios/fast/ruby/rubyDOM-remove-text2-expected.txt (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/platform/ios/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/platform/ios/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:17 UTC (rev 292983)
@@ -20,6 +20,7 @@
RenderRubyText {RT} at (0,-11) size 108x12
RenderText {#text} at (0,0) size 108x11
text run at (0,0) width 108: "Hyper-text Markup Language"
+ RenderRubyBase (anonymous) at (0,0) size 108x0
RenderRubyRun (anonymous) at (265,0) size 9x20
RenderRubyBase (anonymous) at (0,0) size 8x20
RenderText {#text} at (0,0) size 8x19
Modified: branches/safari-613-branch/LayoutTests/platform/mac/fast/ruby/rubyDOM-remove-text2-expected.txt (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/platform/mac/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/platform/mac/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:17 UTC (rev 292983)
@@ -20,6 +20,7 @@
RenderRubyText {RT} at (0,-10) size 108x10
RenderText {#text} at (0,0) size 108x10
text run at (0,0) width 108: "Hyper-text Markup Language"
+ RenderRubyBase (anonymous) at (0,0) size 108x0
RenderRubyRun (anonymous) at (264,0) size 9x18
RenderRubyBase (anonymous) at (0,0) size 8x18
RenderText {#text} at (0,0) size 8x18
Modified: branches/safari-613-branch/LayoutTests/platform/win/fast/ruby/rubyDOM-remove-text2-expected.txt (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/platform/win/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/platform/win/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:17 UTC (rev 292983)
@@ -20,6 +20,7 @@
RenderRubyText {RT} at (0,-10) size 112x10
RenderText {#text} at (0,0) size 112x10
text run at (0,0) width 112: "Hyper-text Markup Language"
+ RenderRubyBase (anonymous) at (0,0) size 112x0
RenderRubyRun (anonymous) at (267,0) size 8x18
RenderRubyBase (anonymous) at (0,0) size 8x18
RenderText {#text} at (0,0) size 8x18
Modified: branches/safari-613-branch/LayoutTests/platform/wincairo/fast/ruby/rubyDOM-remove-text2-expected.txt (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/platform/wincairo/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/platform/wincairo/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:17 UTC (rev 292983)
@@ -20,6 +20,7 @@
RenderRubyText {RT} at (0,-12) size 113x12
RenderText {#text} at (0,0) size 113x12
text run at (0,0) width 113: "Hyper-text Markup Language"
+ RenderRubyBase (anonymous) at (0,0) size 113x0
RenderRubyRun (anonymous) at (259,0) size 8x20
RenderRubyBase (anonymous) at (0,0) size 8x20
RenderText {#text} at (0,0) size 8x19
Modified: branches/safari-613-branch/LayoutTests/platform/wpe/fast/ruby/rubyDOM-remove-text2-expected.txt (292982 => 292983)
--- branches/safari-613-branch/LayoutTests/platform/wpe/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/LayoutTests/platform/wpe/fast/ruby/rubyDOM-remove-text2-expected.txt 2022-04-19 00:49:17 UTC (rev 292983)
@@ -20,6 +20,7 @@
RenderRubyText {RT} at (0,-10) size 114x10
RenderText {#text} at (0,0) size 114x10
text run at (0,0) width 114: "Hyper-text Markup Language"
+ RenderRubyBase (anonymous) at (0,0) size 114x0
RenderRubyRun (anonymous) at (269,0) size 8x18
RenderRubyBase (anonymous) at (0,0) size 8x18
RenderText {#text} at (0,0) size 8x17
Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292982 => 292983)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-04-19 00:49:17 UTC (rev 292983)
@@ -1,3 +1,59 @@
+2022-04-18 Kocsen Chung <kocsen_ch...@apple.com>
+
+ Cherry-pick r291852. rdar://problem/83235846
+
+ Improve rebuilding of ruby subtrees
+ https://bugs.webkit.org/show_bug.cgi?id=238365
+
+ Source/WebCore:
+
+ Patch by Frédéric Wang <fw...@igalia.com> on 2022-03-25
+ Reviewed by Alan Bujtas.
+
+ Don't collapse generated Ruby subtree when tearing down children and take into account the
+ fact that anonymous before/after node can belong to a display: content child.
+
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): Don't collapse.
+ * rendering/updating/RenderTreeBuilderRuby.cpp:
+ (WebCore::lastRubyRun): Child can be also be an anonymous after content.
+ (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): When beforeChild is
+ an anonymous before/after, just fallback to appending to the last ruby run.
+
+ LayoutTests:
+
+ Patch by Frederic Wang <fred.w...@free.fr> on 2022-03-25
+ Reviewed by Alan Bujtas.
+
+ Expectation for rubyDOM-remove-text2.html is updated now that we don't collapse anonymous
+ RenderRubyBase nodes.
+
+ * platform/gtk/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/ios/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/mac/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/win/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/wincairo/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+ * platform/wpe/fast/ruby/rubyDOM-remove-text2-expected.txt: Updated.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-25 Frédéric Wang <fw...@igalia.com>
+
+ Improve rebuilding of ruby subtrees
+ https://bugs.webkit.org/show_bug.cgi?id=238365
+
+ Reviewed by Alan Bujtas.
+
+ Don't collapse generated Ruby subtree when tearing down children and take into account the
+ fact that anonymous before/after node can belong to a display: content child.
+
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): Don't collapse.
+ * rendering/updating/RenderTreeBuilderRuby.cpp:
+ (WebCore::lastRubyRun): Child can be also be an anonymous after content.
+ (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): When beforeChild is
+ an anonymous before/after, just fallback to appending to the last ruby run.
+
2022-04-15 Russell Epstein <repst...@apple.com>
Apply patch. rdar://problem/84869202
Modified: branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (292982 => 292983)
--- branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2022-04-19 00:49:17 UTC (rev 292983)
@@ -830,7 +830,7 @@
}
auto isAnonymousAndSafeToDelete = [] (const auto& renderer) {
- return renderer.isAnonymous() && !renderer.isRenderView() && !renderer.isRenderFragmentedFlow();
+ return renderer.isAnonymous() && !is<RenderRubyBase>(renderer) && !renderer.isRenderView() && !renderer.isRenderFragmentedFlow();
};
auto destroyRootIncludingAnonymous = [&] () -> RenderObject& {
Modified: branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp (292982 => 292983)
--- branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp 2022-04-19 00:49:11 UTC (rev 292982)
+++ branches/safari-613-branch/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp 2022-04-19 00:49:17 UTC (rev 292983)
@@ -105,18 +105,6 @@
return newBlock;
}
-static RenderRubyRun* lastRubyRun(const RenderElement* ruby)
-{
- RenderObject* child = ruby->lastChild();
- if (child && !is<RenderRubyRun>(*child))
- child = child->previousSibling();
- if (!is<RenderRubyRun>(child)) {
- ASSERT(!child || child->isBeforeContent() || child == rubyBeforeBlock(ruby) || child->isRenderMultiColumnFlow() || child->isRenderMultiColumnSet());
- return nullptr;
- }
- return downcast<RenderRubyRun>(child);
-}
-
RenderTreeBuilder::Ruby::Ruby(RenderTreeBuilder& builder)
: m_builder(builder)
{
@@ -288,7 +276,7 @@
if (child.isRubyRun())
return parent;
- if (beforeChild && !parent.isAfterContent(beforeChild)) {
+ if (beforeChild && !parent.isBeforeOrAfterContent(beforeChild)) {
// insert child into run
ASSERT(!beforeChild->isRubyRun());
auto* run = beforeChild->parent();
@@ -303,7 +291,7 @@
// If the new child would be appended, try to add the child to the previous run
// if possible, or create a new run otherwise.
// (The RenderRubyRun object will handle the details)
- auto* lastRun = lastRubyRun(&parent);
+ auto* lastRun = childrenOfType<RenderRubyRun>(parent).last();
if (!lastRun || lastRun->hasRubyText()) {
auto newRun = RenderRubyRun::staticCreateRubyRun(&parent);
lastRun = newRun.get();
@@ -350,7 +338,7 @@
if (child.isRubyRun())
return parent;
- if (beforeChild && !parent.isAfterContent(beforeChild)) {
+ if (beforeChild && !parent.isBeforeOrAfterContent(beforeChild)) {
// insert child into run
ASSERT(!beforeChild->isRubyRun());
auto* run = beforeChild->parent();
@@ -365,7 +353,7 @@
// If the new child would be appended, try to add the child to the previous run
// if possible, or create a new run otherwise.
// (The RenderRubyRun object will handle the details)
- auto* lastRun = lastRubyRun(&parent);
+ auto* lastRun = childrenOfType<RenderRubyRun>(parent).last();
if (!lastRun || lastRun->hasRubyText()) {
auto newRun = RenderRubyRun::staticCreateRubyRun(&parent);
lastRun = newRun.get();