mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-17 21:49:42 +00:00
LibWeb: Store opacity
in computed form in ComputedProperties
This commit is contained in:
parent
246a1c41ff
commit
1ba84de4f6
Notes:
github-actions[bot]
2025-09-08 10:07:09 +00:00
Author: https://github.com/Calme1709
Commit: 1ba84de4f6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6112
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 31 additions and 9 deletions
|
@ -5,9 +5,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/StyleInvalidation.h>
|
||||
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -61,8 +61,8 @@ RequiredInvalidationAfterStyleChange compute_property_invalidation(CSS::Property
|
|||
// 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 = CSS::ComputedProperties::resolve_opacity_value(*old_value);
|
||||
auto new_value_opacity = CSS::ComputedProperties::resolve_opacity_value(*new_value);
|
||||
auto old_value_opacity = old_value->as_number().number();
|
||||
auto new_value_opacity = new_value->as_number().number();
|
||||
if (old_value_opacity != new_value_opacity && (old_value_opacity == 1 || new_value_opacity == 1)) {
|
||||
invalidation.rebuild_stacking_context_tree = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue