mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Handle serialization of invalid border in all contexts
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
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
Previously as we handled this in `get_property_internal` there were some contexts that we missed, for instance `CSSStyleProperties::serialized`.
This commit is contained in:
parent
927cd969b2
commit
93f957051a
Notes:
github-actions[bot]
2025-07-15 13:27:17 +00:00
Author: https://github.com/Calme1709
Commit: 93f957051a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5386
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 21 additions and 29 deletions
|
@ -238,6 +238,22 @@ String ShorthandStyleValue::to_string(SerializationMode mode) const
|
|||
|
||||
return MUST(builder.to_string());
|
||||
}
|
||||
case PropertyID::Border: {
|
||||
auto all_longhands_same_value = [](ValueComparingRefPtr<CSSStyleValue const> const& shorthand) -> bool {
|
||||
VERIFY(shorthand);
|
||||
VERIFY(shorthand->is_shorthand());
|
||||
|
||||
auto longhands = shorthand->as_shorthand().values();
|
||||
|
||||
return all_of(longhands, [&](auto const& longhand) { return longhand == longhands[0]; });
|
||||
};
|
||||
|
||||
// `border` only has a reasonable value if all four sides are the same.
|
||||
if (!all_longhands_same_value(longhand(PropertyID::BorderWidth)) || !all_longhands_same_value(longhand(PropertyID::BorderStyle)) || !all_longhands_same_value(longhand(PropertyID::BorderColor)))
|
||||
return ""_string;
|
||||
|
||||
return default_to_string();
|
||||
}
|
||||
case PropertyID::BorderImage: {
|
||||
auto source = longhand(PropertyID::BorderImageSource);
|
||||
auto slice = longhand(PropertyID::BorderImageSlice);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue