layout: Correctly marking box damage when text-related style changed (#38059)

This change aims to supplement the missing incremental box tree
construction when text-related styles change. Since certain text style
adjustments can alter visible text content and typography. Therefore,
the parent nodes of such text are marked as needing to re-collect their
box tree children to ensure the correct display of text.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
JoeDow 2025-07-26 19:50:13 +08:00 committed by GitHub
parent d678901122
commit 9ef4d0c9d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 92 additions and 0 deletions

View file

@ -271423,6 +271423,19 @@
{}
]
],
"pre-001.html": [
"0e3e1e38c7293303d7cf07c0e64facfa76ba966d",
[
null,
[
[
"/css/css-text/white-space/reference/pre-001-ref.html",
"=="
]
],
{}
]
],
"pre-float-001.html": [
"8dd08d80992e6d6310a6697f84c2533d399c8e5e",
[
@ -453875,6 +453888,10 @@
"644dfc4b025e62babeddd3575af5ffee40c77e26",
[]
],
"pre-001-ref.html": [
"e950bbbc4960c650cd08b2532e6b0a3309ca5ffb",
[]
],
"pre-float-001-ref.html": [
"9753cb37b641f3f25d1045f3149875deffb1613c",
[]

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<title>CSS-white-space test: restore collapsed whitespace</title>
<link rel="author" title="JoeDow" href="ibluegalaxy_taoj@163.com">
<link rel="match" href="reference/pre-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
html {
font: 20px/1 Ahem;
}
.span {
background-color: blueviolet;
}
#target {
background-color: blue;
}
</style>
<body>
<div>
<span class="span">aa bb </span><span id="target"> target </span><span class="span">bb aa</span>
</div>
<script>
window.onload = function() {
const target = document.getElementById("target");
// force layout
target.offsetLeft;
target.style.whiteSpace = "pre";
}
</script>
</body>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
html {
font: 20px/1 Ahem;
}
.span {
background-color: blueviolet;
}
#target {
background-color: blue;
white-space: pre;
}
</style>
<body>
<div>
<span class="span">aa bb </span><span id="target"> target </span><span class="span">bb aa</span>
</div>
</body>