[css-text-decor] Don't propagate decorations to inline-flex/inline-grid

Previously we wouldn't propagate into inline-block/inline-table, however
the logic didn't account for additional types of atomic inlines we've
added through the years. Use IsDisplayReplacedType (which in itself is
a bad name).

Fixed: 1414859, 1403082
Change-Id: I5e028db931bc7e9b2b7da9c508ed0e103d105b01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4247538
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105194}
diff --git a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
index a259660..c1fa8a5 100644
--- a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
+++ b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
@@ -269,9 +269,7 @@
 // to manually stop text-decorations to apply to text inside media controls.
 static bool StopPropagateTextDecorations(const ComputedStyleBuilder& builder,
                                          const Element* element) {
-  return builder.Display() == EDisplay::kInlineTable ||
-         builder.Display() == EDisplay::kInlineBlock ||
-         builder.Display() == EDisplay::kWebkitInlineBox ||
+  return builder.IsDisplayReplacedType() ||
          IsAtMediaUAShadowBoundary(element) || builder.IsFloating() ||
          builder.HasOutOfFlowPosition() || IsOutermostSVGElement(element) ||
          IsA<HTMLRTElement>(element);
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/reference/text-decoration-propagation-02-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/reference/text-decoration-propagation-02-ref.html
new file mode 100644
index 0000000..84ad43f
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/reference/text-decoration-propagation-02-ref.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+This text must not be underlined.
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/reference/text-decoration-propagation-03-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/reference/text-decoration-propagation-03-ref.html
new file mode 100644
index 0000000..84ad43f
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/reference/text-decoration-propagation-03-ref.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+This text must not be underlined.
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/text-decoration-propagation-02.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/text-decoration-propagation-02.html
new file mode 100644
index 0000000..d618452
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/text-decoration-propagation-02.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="help" href="http://www.w3.org/TR/css-text-decor-3/#line-decoration">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1414859">
+<link rel="match" href="reference/text-decoration-propagation-02-ref.html">
+<style>
+span { text-decoration: underline; }
+</style>
+<span>
+  <div style="display: inline-flex;">
+    This text must not be underlined.
+  </div>
+</span>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text-decor/text-decoration-propagation-03.html b/third_party/blink/web_tests/external/wpt/css/css-text-decor/text-decoration-propagation-03.html
new file mode 100644
index 0000000..b019c25e
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text-decor/text-decoration-propagation-03.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="help" href="http://www.w3.org/TR/css-text-decor-3/#line-decoration">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1414859">
+<link rel="match" href="reference/text-decoration-propagation-03-ref.html">
+<style>
+span { text-decoration: underline; }
+</style>
+<span>
+  <div style="display: inline-grid;">
+    This text must not be underlined.
+  </div>
+</span>