mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Don't assume opacity values are CSS numbers
...since they can also be percentages. Better to resolve them to a pair
of absolute values, and then compare those. :^)
Regressed in 921aee8c66
.
This commit is contained in:
parent
cb8664e2e1
commit
9937fcc5e1
Notes:
sideshowbarker
2024-07-17 08:25:15 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9937fcc5e1 Pull-request: https://github.com/SerenityOS/serenity/pull/20273
@ -0,0 +1 @@
|
||||
Didn't crash :^)
|
@ -0,0 +1,12 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
document.body.style.opacity = '0.5';
|
||||
document.body.offsetWidth
|
||||
document.body.style.opacity = '100.0%';
|
||||
document.body.offsetWidth
|
||||
document.body.style.opacity = '0.5';
|
||||
document.body.offsetWidth
|
||||
println("Didn't crash :^)");
|
||||
});
|
||||
</script>
|
@ -425,8 +425,8 @@ static Element::RequiredInvalidationAfterStyleChange compute_required_invalidati
|
||||
// OPTIMIZATION: An element creates a stacking context when its opacity changes from 1 to less than 1
|
||||
// and stops to create one when opacity returns to 1. So stacking context tree rebuild is
|
||||
// not required for opacity changes within the range below 1.
|
||||
auto old_value_opacity = old_value.has_value() ? old_value->style->as_number().number() : 1;
|
||||
auto new_value_opacity = new_value.has_value() ? new_value->style->as_number().number() : 1;
|
||||
auto old_value_opacity = old_style.opacity();
|
||||
auto new_value_opacity = new_style.opacity();
|
||||
if (old_value_opacity != new_value_opacity && (old_value_opacity == 1 || new_value_opacity == 1)) {
|
||||
invalidation.rebuild_stacking_context_tree = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user