SVG Text NG: Fix a crash by <use> with display:contents and text-decoration
crrev.com/925670 was not enough for SVG <use> because it has a different
code path to propagate the <use> style to a referred tree. See
SVGElement::CustomStyleForLayoutObject().
This CL resolve the issue by not calling ApplyTextDecorations() for
display:contents, and revert the C++ part of crrev.com/925670.
Bug: 1252619, 1253243, 1273800
Change-Id: Iddee8ba2f2bb68d601bc0dbc55207267b8cb55cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3308292
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#946301}
diff --git a/css/css-text-decor/reference/text-decoration-propagation-display-contents-ref.html b/css/css-text-decor/reference/text-decoration-propagation-display-contents-ref.html
index 5eecc8c..c8381c6 100644
--- a/css/css-text-decor/reference/text-decoration-propagation-display-contents-ref.html
+++ b/css/css-text-decor/reference/text-decoration-propagation-display-contents-ref.html
@@ -4,9 +4,14 @@
<span>Should have</span>
only overline.
</p>
-<svg xmlns="http://www.w3.org/2000/svg" width="600" height="200">
+<svg xmlns="http://www.w3.org/2000/svg" width="600" height="100">
<text style="text-decoration: overline;" y="20">
<tspan>Should have</tspan> only overline.
</text>
</svg>
+
+<svg xmlns="http://www.w3.org/2000/svg" width="600" height="100"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <text id="text2" y="20"><tspan>Should have</tspan> no overline.</text>
+</svg>
</body>
diff --git a/css/css-text-decor/text-decoration-propagation-display-contents.html b/css/css-text-decor/text-decoration-propagation-display-contents.html
index d77dfe5..33d3593 100644
--- a/css/css-text-decor/text-decoration-propagation-display-contents.html
+++ b/css/css-text-decor/text-decoration-propagation-display-contents.html
@@ -13,11 +13,19 @@
only overline.
</span>
</p>
-<svg xmlns="http://www.w3.org/2000/svg" width="600" height="200">
+<svg xmlns="http://www.w3.org/2000/svg" width="600" height="100">
<text style="text-decoration: overline;" y="20">
<tspan style="text-decoration: underline; display: contents">
<tspan>Should have</tspan> only overline.
</tspan>
</text>
</svg>
+
+<svg xmlns="http://www.w3.org/2000/svg" width="600" height="100"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <text id="text2" y="20"><tspan>Should have</tspan> no overline.</text>
+ </defs>
+ <use style="display: contents" text-decoration="underline" xlink:href="#text2" />
+</svg>
</body>