Skip to content

Commit

Permalink
[css-pseudo] Fix DCHECK failure with ::marker and text-combine-upright
Browse files Browse the repository at this point in the history
The 'text-combine-upright' property is not supported in LayoutNG, so it
forces the element to use legacy layout. However, when used on ::marker,
this could leave the list item using LayoutNG and only force the marker
to legacy. But markers depend on their originating list item, so this
would make some DCHECKs fail.

This patch makes DefinitelyNewFormattingContext always return false for
::marker, even if it's an outside marker with 'display: inline-block'.
This way ForceLegacyLayoutInFormattingContext will also force the list
item to use legacy layout when the marker requires it.

Bug: 457718

TEST=external/wpt/css/css-pseudo/marker-text-combine-upright.html

The test fails because 'text-combine-upright' doesn't seem to work well
on pseudo-elements, but now it doesn't crash.

Change-Id: I7f9f26914af39a9d30dbcff7fcd1ae1308981989
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264129
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#782375}
  • Loading branch information
Loirooriol authored and Hexcles committed Jun 26, 2020
1 parent 74de00a commit 1156b01
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
36 changes: 36 additions & 0 deletions css/css-pseudo/marker-text-combine-upright-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference: ::marker supports 'text-combine-upright'</title>
<style>
body {
writing-mode: vertical-lr;
}
ol, ul {
display: flow-root;
list-style-type: none;
}
.symbol {
list-style-type: disc;
}
ul {
list-style-position: inside;
}
ol span {
display: inline-block;
margin-top: -50px;
height: 50px;
text-align: end;
}
span {
text-combine-upright: all;
}
</style>
<ol><li><span>1. </span>outside decimal</li></ol>
<ol><li><span>2. </span>outside string</li></ol>
<ol><li><span>3. </span>outside content</li></ol>
<ol class="symbol"><li>outside symbol</li></ol>

<ul><li><span>1. </span>inside decimal</li></ul>
<ul><li><span>2. </span>inside string</li></ul>
<ul><li><span>3. </span>inside content</li></ul>
<ul class="symbol"><li>inside symbol</li></ul>
43 changes: 43 additions & 0 deletions css/css-pseudo/marker-text-combine-upright.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test: ::marker supports 'text-combine-upright'</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="match" href="marker-text-combine-upright-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#marker-pseudo">
<link rel="help" href="https://drafts.csswg.org/css-writing-modes-4/#propdef-text-combine-upright">
<meta name="assert" content="Checks that 'text-combine-upright' works well in ::marker, and doesn't crash.">
<style>
body {
writing-mode: vertical-lr;
}
ol, ul {
display: flow-root;
}
ul {
list-style-position: inside;
}
.decimal {
list-style-type: decimal;
}
.string {
list-style-type: "2. ";
}
.content ::marker {
content: "3. ";
}
.symbol {
list-style-type: disc;
}
::marker {
text-combine-upright: all;
}
</style>
<ol class="decimal"><li>outside decimal</li></ol>
<ol class="string"><li>outside string</li></ol>
<ol class="content"><li>outside content</li></ol>
<ol class="symbol"><li>outside symbol</li></ol>

<ul class="decimal"><li>inside decimal</li></ul>
<ul class="string"><li>inside string</li></ul>
<ul class="content"><li>inside content</li></ul>
<ul class="symbol"><li>inside symbol</li></ul>

0 comments on commit 1156b01

Please sign in to comment.