mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
LibWeb: Update the layout tree when CSS text-transform changes
Because we cache the transformed text string in text nodes affected by text-transform, we have to actually update the layout tree when this property value changes.
This commit is contained in:
parent
def0bcdfa2
commit
0a300fe59b
Notes:
github-actions[bot]
2025-03-08 19:23:07 +00:00
Author: https://github.com/awesomekling
Commit: 0a300fe59b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3864
4 changed files with 32 additions and 0 deletions
|
@ -2750,6 +2750,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"text-transform": {
|
"text-transform": {
|
||||||
|
"__comment": "NOTE: This property has custom invalidation handling.",
|
||||||
"animation-type": "discrete",
|
"animation-type": "discrete",
|
||||||
"inherited": true,
|
"inherited": true,
|
||||||
"initial": "none",
|
"initial": "none",
|
||||||
|
|
|
@ -24,6 +24,15 @@ RequiredInvalidationAfterStyleChange compute_property_invalidation(CSS::Property
|
||||||
return RequiredInvalidationAfterStyleChange::full();
|
return RequiredInvalidationAfterStyleChange::full();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: If the text-transform property changes, it may affect layout. Furthermore, since the
|
||||||
|
// Layout::TextNode caches the post-transform text, we have to update the layout tree.
|
||||||
|
if (property_id == CSS::PropertyID::TextTransform) {
|
||||||
|
invalidation.rebuild_layout_tree = true;
|
||||||
|
invalidation.relayout = true;
|
||||||
|
invalidation.repaint = true;
|
||||||
|
return invalidation;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: If one of the overflow properties change, we rebuild the entire layout tree.
|
// NOTE: If one of the overflow properties change, we rebuild the entire layout tree.
|
||||||
// This ensures that overflow propagation from root/body to viewport happens correctly.
|
// This ensures that overflow propagation from root/body to viewport happens correctly.
|
||||||
// In the future, we can make this invalidation narrower.
|
// In the future, we can make this invalidation narrower.
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
119
|
||||||
|
141
|
||||||
|
100
|
||||||
|
122
|
|
@ -0,0 +1,18 @@
|
||||||
|
<style>
|
||||||
|
#theDiv {
|
||||||
|
width: max-content;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<div id="theDiv">heLLo FrIends</div>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
println(theDiv.offsetWidth);
|
||||||
|
theDiv.style.textTransform = 'uppercase';
|
||||||
|
println(theDiv.offsetWidth);
|
||||||
|
theDiv.style.textTransform = 'lowercase';
|
||||||
|
println(theDiv.offsetWidth);
|
||||||
|
theDiv.style.textTransform = 'capitalize';
|
||||||
|
println(theDiv.offsetWidth);
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue