LibWeb: Invalidate style for tree counting functions when required
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

We mark any element that relies on tree counting functions as needing a
style update when a sibling is inserted/removed.
This commit is contained in:
Callum Law 2025-10-06 17:09:22 +13:00 committed by Tim Ledbetter
commit 2404f95e03
Notes: github-actions[bot] 2025-10-20 15:13:22 +00:00
50 changed files with 297 additions and 230 deletions

View file

@ -86,11 +86,14 @@ ParsedFontFace ParsedFontFace::from_descriptors(CSSFontFaceDescriptors const& de
// The auto values for these three descriptors have the following effects:
// - For font selection purposes, the font is selected as if the appropriate normal value (normal, normal or normal) is chosen
// - FIXME: For variation axis clamping, clamping does not occur
if (value->to_keyword() == Keyword::Auto)
if (value->to_keyword() == Keyword::Auto) {
weight = 400;
else
} else {
// NOTE: We can disregard the dependencies here because they won't change
PropertyComputationDependencies property_computation_dependencies;
// NOTE: The value we pass here for inherited_font_weight is irrelevant as relative keywords (lighter, bolder) should be disallowed at parse time
weight = StyleComputer::compute_font_weight(*value, 0, computation_context)->as_number().number();
weight = StyleComputer::compute_font_weight(*value, 0, computation_context, property_computation_dependencies)->as_number().number();
}
}
Optional<int> slope;
@ -99,10 +102,13 @@ ParsedFontFace ParsedFontFace::from_descriptors(CSSFontFaceDescriptors const& de
// The auto values for these three descriptors have the following effects:
// - For font selection purposes, the font is selected as if the appropriate normal value (normal, normal or normal) is chosen
// - FIXME: For variation axis clamping, clamping does not occur
if (value->to_keyword() == Keyword::Auto)
if (value->to_keyword() == Keyword::Auto) {
slope = 0;
else
slope = StyleComputer::compute_font_style(*value, computation_context)->as_font_style().to_font_slope();
} else {
// NOTE: We can disregard the dependencies here because they won't change
PropertyComputationDependencies property_computation_dependencies;
slope = StyleComputer::compute_font_style(*value, computation_context, property_computation_dependencies)->as_font_style().to_font_slope();
}
}
Optional<int> width;
@ -111,10 +117,13 @@ ParsedFontFace ParsedFontFace::from_descriptors(CSSFontFaceDescriptors const& de
// The auto values for these three descriptors have the following effects:
// - For font selection purposes, the font is selected as if the appropriate normal value (normal, normal or normal) is chosen
// - FIXME: For variation axis clamping, clamping does not occur
if (value->to_keyword() == Keyword::Auto)
if (value->to_keyword() == Keyword::Auto) {
width = 100;
else
width = StyleComputer::compute_font_width(*value, computation_context)->as_percentage().raw_value();
} else {
// NOTE: We can disregard the dependencies here because they won't change
PropertyComputationDependencies property_computation_dependencies;
width = StyleComputer::compute_font_width(*value, computation_context, property_computation_dependencies)->as_percentage().raw_value();
}
}
Vector<Source> sources;