mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibWeb: Support shorthand properties as presentational hints
This commit is contained in:
parent
9480b1fc5c
commit
45689936f2
Notes:
github-actions[bot]
2025-05-29 10:05:54 +00:00
Author: https://github.com/Calme1709
Commit: 45689936f2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4832
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/gmta ✅
4 changed files with 23 additions and 19 deletions
|
@ -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,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue