mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 23:59:53 +00:00
LibWeb: Move and rename CSSStyleValue to StyleValues/StyleValue.{h,cpp}
This reverts 0e3487b9ab
.
Back when I made that change, I thought we could make our StyleValue
classes match the typed-om definitions directly. However, they have
different requirements. Typed-om types need to be mutable and GCed,
whereas StyleValues are immutable and ideally wouldn't require a JS VM.
While I was already making such a cataclysmic change, I've moved it into
the StyleValues directory, because it *not* being there has bothered me
for a long time. 😅
This commit is contained in:
parent
0d8ad0a9fe
commit
c57975c9fd
Notes:
github-actions[bot]
2025-08-08 14:20:54 +00:00
Author: https://github.com/AtkinsSJ
Commit: c57975c9fd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5775
Reviewed-by: https://github.com/tcl3 ✅
167 changed files with 989 additions and 990 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace Web::CSS::Parser {
|
||||
|
||||
Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_descriptor_value(AtRuleID at_rule_id, DescriptorID descriptor_id, TokenStream<ComponentValue>& unprocessed_tokens)
|
||||
Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_descriptor_value(AtRuleID at_rule_id, DescriptorID descriptor_id, TokenStream<ComponentValue>& unprocessed_tokens)
|
||||
{
|
||||
if (!at_rule_supports_descriptor(at_rule_id, descriptor_id)) {
|
||||
ErrorReporter::the().report(UnknownPropertyError {
|
||||
|
@ -46,7 +46,7 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_descripto
|
|||
[&](Keyword keyword) {
|
||||
return parse_all_as_single_keyword_value(tokens, keyword);
|
||||
},
|
||||
[&](PropertyID property_id) -> RefPtr<CSSStyleValue const> {
|
||||
[&](PropertyID property_id) -> RefPtr<StyleValue const> {
|
||||
auto value_or_error = parse_css_value(property_id, tokens);
|
||||
if (value_or_error.is_error())
|
||||
return nullptr;
|
||||
|
@ -59,7 +59,7 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_descripto
|
|||
return nullptr;
|
||||
return value_for_property;
|
||||
},
|
||||
[&](DescriptorMetadata::ValueType value_type) -> RefPtr<CSSStyleValue const> {
|
||||
[&](DescriptorMetadata::ValueType value_type) -> RefPtr<StyleValue const> {
|
||||
switch (value_type) {
|
||||
case DescriptorMetadata::ValueType::CropOrCross: {
|
||||
// crop || cross
|
||||
|
@ -70,8 +70,8 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_descripto
|
|||
if (!first)
|
||||
return nullptr;
|
||||
|
||||
RefPtr<CSSStyleValue const> crop;
|
||||
RefPtr<CSSStyleValue const> cross;
|
||||
RefPtr<StyleValue const> crop;
|
||||
RefPtr<StyleValue const> cross;
|
||||
|
||||
if (first->to_keyword() == Keyword::Crop)
|
||||
crop = first;
|
||||
|
@ -149,8 +149,8 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_descripto
|
|||
}
|
||||
|
||||
// [ <page-size> || [ portrait | landscape ] ]
|
||||
RefPtr<CSSStyleValue const> page_size;
|
||||
RefPtr<CSSStyleValue const> orientation;
|
||||
RefPtr<StyleValue const> page_size;
|
||||
RefPtr<StyleValue const> orientation;
|
||||
if (auto first_keyword = parse_keyword_value(tokens)) {
|
||||
if (first_is_one_of(first_keyword->to_keyword(), Keyword::Landscape, Keyword::Portrait)) {
|
||||
orientation = first_keyword.release_nonnull();
|
||||
|
@ -203,7 +203,7 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_descripto
|
|||
case DescriptorMetadata::ValueType::String:
|
||||
return parse_string_value(tokens);
|
||||
case DescriptorMetadata::ValueType::UnicodeRangeTokens: {
|
||||
return parse_comma_separated_value_list(tokens, [this](auto& tokens) -> RefPtr<CSSStyleValue const> {
|
||||
return parse_comma_separated_value_list(tokens, [this](auto& tokens) -> RefPtr<StyleValue const> {
|
||||
return parse_unicode_range_value(tokens);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue