The 'M' is missing from the second line in this test case: https://codepen.io/AmeliaBR/pen/61a8a4f3848023859253cb5341e17ef2?editors=1100
<rdar://problem/31989978>
Created attachment 313200 [details] Testcase
Any test-transform triggers this, even if using uppercase and the letters are already uppercase. Happens only when the text-transform is on the encoding <text>, not an individual <tspan>.
I think this is about whitespace collapsing. If you remove the whitespace between the <tspan>s, the bug goes away.
In RenderText::styleDidChange() we call RenderText::setText(originalText(), true), which sets the text to RenderSVGInlineText::originalText() which adds a newline that is not included in RenderText::originalText(). I'm not sure why RenderSVGInlineText has to override originalText().
Antti added RenderSVGInlineText::originalText() in https://trac.webkit.org/changeset/160259/webkit, but without an explanation for why SVG is special.
Possible patch: diff --git a/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp b/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp index 5aebea8abc3a9ede361f2edfc3e20d5ea1e9b611..a5af6fe694a4982ec697fed6339d32be624f474e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp @@ -78,7 +78,7 @@ String RenderSVGInlineText::originalText() const void RenderSVGInlineText::setRenderedText(const String& text) { - RenderText::setRenderedText(text); + RenderText::setRenderedText(applySVGWhitespaceRules(text, style().whiteSpace() == PRE)); if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this)) textAncestor->subtreeTextDidChange(this); }
Created attachment 461574 [details] Safari 156 and STP 151 differs from other browsers I am able to reproduce this issue in Safari 15.6 and Safari TP 151 and as can bee seen in the attached screenshot "M" is on top line and not next line like other browsers. Just wanted to share updated testing results. Thanks!
*** Bug 245248 has been marked as a duplicate of this bug. ***
It works and compile if you do: void RenderSVGInlineText::setRenderedText(const String& text) { - RenderText::setRenderedText(text); + RenderText::setRenderedText(applySVGWhitespaceRules(text, style().whiteSpace() == WhiteSpace::Pre)); But it has performance implications, my PR was here: https://github.com/WebKit/WebKit/pull/4405 It has performance implications as mentioned by @Simon since above change will take assumption that all text has whitespace and run with it. ____ I had to close my PR due to mid changes clash, it got unintended changes from some other changes. Will try again in future but if someone has to take it up, they can.