Skip to content

Commit

Permalink
Call RebuildLayoutTreeForChild for pseudo elements
Browse files Browse the repository at this point in the history
Use the same code path as for normal elements to make sure the
WhiteSpaceAttacher marks pseudo elements as visited to get correct
whitespace handling. Also use RebuildPseudoElementLayoutTree() for the
::marker pseudo since the implementation was basically the same.

Fixes an incorrect whitespace removal bug and a fuzzer crash caused by
inconsistent ::first-letter texts when size containers were involved.

Bug: 372252513, 372358471
Change-Id: I1f99f3b83809b9eef72b42aec9ad099bf3c56ded
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5920416
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1366747}
  • Loading branch information
Rune Lillesveen authored and chromium-wpt-export-bot committed Oct 10, 2024
1 parent 481d201 commit f7366fb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<title>::first-letter text crash during size query change</title>
<link rel="help" href="https://crbug/com/372358471">
<style>
body {
&::first-letter { color: green; }
&::before { content: "."; }
}
canvas {
float: left;
container-type: inline-size;
&::first-line {
color: pink;
}
}
:first-of-type {}
</style>
<body> <canvas></canvas><span id="id_1"></span><span>x</span>
<script>
document.body.offsetTop;
id_1.remove();
document.body.offsetTop;
</script>

15 changes: 15 additions & 0 deletions css/css-pseudo/before-preceding-whitespace-dynamic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<title>Removing an empty inline should not cause a space after ::before content to collapse</title>
<link rel="help" href="https://drafts.csswg.org/css-pseudo/#generated-content">
<link rel="help" href="https://drafts.csswg.org/css-text/#white-space-rules">
<link rel="match" href="../reference/pass_if_two_words.html">
<style>
div::before { content: "two" }
</style>
<p>There should be a space between "two" and "words" below.</p>
<div> <span id="rm"></span><span>words</span></div>
<script>
rm.offsetTop;
rm.remove();
rm.offsetTop;
</script>

0 comments on commit f7366fb

Please sign in to comment.