1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Support shorthand properties as presentational hints

This commit is contained in:
Callum Law 2025-05-21 14:07:27 +12:00 committed by Jelle Raaijmakers
parent 9480b1fc5c
commit 45689936f2
Notes: github-actions[bot] 2025-05-29 10:05:54 +00:00
4 changed files with 23 additions and 19 deletions

View file

@ -7,6 +7,8 @@
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/CascadedProperties.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
#include <LibWeb/DOM/Element.h>
namespace Web::CSS {
@ -99,17 +101,19 @@ void CascadedProperties::set_property(PropertyID property_id, NonnullRefPtr<CSSS
void CascadedProperties::set_property_from_presentational_hint(PropertyID property_id, NonnullRefPtr<CSSStyleValue const> value)
{
auto& entries = m_properties.ensure(property_id);
StyleComputer::for_each_property_expanding_shorthands(property_id, value, [this](PropertyID longhand_property_id, CSSStyleValue const& longhand_value) {
auto& entries = m_properties.ensure(longhand_property_id);
entries.append(Entry {
.property = StyleProperty {
.important = Important::No,
.property_id = property_id,
.value = value,
},
.origin = CascadeOrigin::Author,
.layer_name = {},
.source = nullptr,
entries.append(Entry {
.property = StyleProperty {
.important = Important::No,
.property_id = longhand_property_id,
.value = longhand_value,
},
.origin = CascadeOrigin::Author,
.layer_name = {},
.source = nullptr,
});
});
}

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 42 tests
37 Pass
5 Fail
38 Pass
4 Fail
Pass clip-path presentation attribute supported on an irrelevant element
Pass clip-rule presentation attribute supported on an irrelevant element
Pass color presentation attribute supported on an irrelevant element
@ -25,7 +25,7 @@ Pass letter-spacing presentation attribute supported on an irrelevant element
Pass mask-type presentation attribute supported on an irrelevant element
Pass mask presentation attribute supported on an irrelevant element
Pass opacity presentation attribute supported on an irrelevant element
Fail overflow presentation attribute supported on an irrelevant element
Pass overflow presentation attribute supported on an irrelevant element
Pass pointer-events presentation attribute supported on an irrelevant element
Pass stop-color presentation attribute supported on an irrelevant element
Pass stop-opacity presentation attribute supported on an irrelevant element

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 52 tests
40 Pass
12 Fail
41 Pass
11 Fail
Pass clip-path presentation attribute supported on a relevant element
Pass clip-rule presentation attribute supported on a relevant element
Pass color presentation attribute supported on a relevant element
@ -28,7 +28,7 @@ Pass letter-spacing presentation attribute supported on a relevant element
Pass mask-type presentation attribute supported on a relevant element
Pass mask presentation attribute supported on a relevant element
Pass opacity presentation attribute supported on a relevant element
Fail overflow presentation attribute supported on a relevant element
Pass overflow presentation attribute supported on a relevant element
Pass pointer-events presentation attribute supported on a relevant element
Pass r presentation attribute supported on a relevant element
Fail rx presentation attribute supported on a relevant element

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 42 tests
37 Pass
5 Fail
38 Pass
4 Fail
Pass clip-path presentation attribute supported on an unknown SVG element
Pass clip-rule presentation attribute supported on an unknown SVG element
Pass color presentation attribute supported on an unknown SVG element
@ -25,7 +25,7 @@ Pass letter-spacing presentation attribute supported on an unknown SVG element
Pass mask-type presentation attribute supported on an unknown SVG element
Pass mask presentation attribute supported on an unknown SVG element
Pass opacity presentation attribute supported on an unknown SVG element
Fail overflow presentation attribute supported on an unknown SVG element
Pass overflow presentation attribute supported on an unknown SVG element
Pass pointer-events presentation attribute supported on an unknown SVG element
Pass stop-color presentation attribute supported on an unknown SVG element
Pass stop-opacity presentation attribute supported on an unknown SVG element