Commit 434c646e authored by Frédéric Wang's avatar Frédéric Wang Committed by Commit Bot

[mathml] Make math display values on pseudo elements compute to flow

This is a follow-up of [1] which didn't handle the case of pseudo
elements with a math display value. A reftest is added to verify the
expected behavior with pseudo elements, but will fail until the
parsing of math display values is adjusted to match what the CSSWG
agreed. However, this test checks the fix for an assertion failure
(http://crbug.com/1130127).

Bug: 6606, 1127222, 1130127

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2404789

Change-Id: I4f7c13db003f776045a934eae9be5839b3c0343f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418658Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Frédéric Wang <fwang@igalia.com>
Cr-Commit-Position: refs/heads/master@{#809177}
parent 9ae5688f
......@@ -665,7 +665,7 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state,
// math display values on non-MathML elements compute to flow display
// values.
if (element && !element->IsMathMLElement() &&
if ((!element || !element->IsMathMLElement()) &&
(style.Display() == EDisplay::kMath ||
style.Display() == EDisplay::kInlineMath)) {
style.SetDisplay(style.Display() == EDisplay::kMath ? EDisplay::kBlock
......
......@@ -1264,6 +1264,10 @@ crbug.com/6606 external/wpt/mathml/relations/html5-tree/href-click-1.html [ Fail
crbug.com/6606 external/wpt/mathml/relations/html5-tree/href-click-2.html [ Failure ]
crbug.com/6606 external/wpt/mathml/relations/html5-tree/href-click-3.html [ Failure ]
# These tests fail because we don't parse math display values according to the spec.
crbug.com/1127222 external/wpt/css/css-display/display-math-on-pseudo-elements-001.html [ Failure ]
crbug.com/1127222 external/wpt/css/css-display/display-math-on-pseudo-elements-002.html [ Failure ]
# This test fails on windows. It should really be made more reliable and take
# into account fallback parameters.
crbug.com/6606 [ Win ] external/wpt/mathml/presentation-markup/fractions/frac-1.html [ Failure ]
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: math and inline-math on pseudo elements compute to flow</title>
<link rel="help" href="https://drafts.csswg.org/css-display/#the-display-properties">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
[data-expected="inline"]::before { content: 'math'; display: math; }
[data-expected="inline"]::after { content: 'math'; display: math; }
[data-expected="block"]::before { content: 'math'; display: block math; }
[data-expected="block"]::after { content: 'math'; display: block math; }
</style>
<div>
<div data-expected="block"></div>
<math data-expected="block"></math>
<math><mrow data-expected="block"></mrow></math>
<div data-expected="inline"></div>
<math data-expected="inline"></math>
<math><mrow data-expected="inline"></mrow></math>
</div>
<script>
Array.from(document.querySelectorAll('[data-expected]')).forEach(element => {
test(function() {
assert_equals(window.getComputedStyle(element, "::before").display,
element.getAttribute('data-expected'));
assert_equals(window.getComputedStyle(element, "::after").display,
element.getAttribute('data-expected'));
}, `computed display on ::before and ::after for <${element.tagName} class="${element.getAttribute('class')}">`);
});
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: block math and inline math on pseudo elements (reference)</title>
<style>
.inline::before { content: 'math'; display: inline; }
.inline::after { content: 'math'; display: inline; }
.block::before { content: 'math'; display: block; }
.block::after { content: 'math'; display: block; }
</style>
<p>Test passes if SPAN and DIV are respectively surrounded by inline and block
"math" text.</p>
<div>
<span class="inline">SPAN</span>
</div>
<div>
<span class="block">DIV</span>
</div>
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: block math and inline math on pseudo elements</title>
<link rel="help" href="https://drafts.csswg.org/css-display/#the-display-properties">
<meta name="assert" content="display: inline math and display: block math on compute to flow">
<link rel="match" href="display-math-on-pseudo-elements-002-ref.html">
<style>
.inline::before { content: 'math'; display: math; }
.inline::after { content: 'math'; display: math; }
.block::before { content: 'math'; display: block math; }
.block::after { content: 'math'; display: block math; }
</style>
<p>Test passes if SPAN and DIV are respectively surrounded by inline and block
"math" text.</p>
<div>
<span class="inline">SPAN</span>
</div>
<div>
<span class="block">DIV</span>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment