mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
LibWeb/CSS: Automate parsing view-transition-name
This commit is contained in:
parent
c729c3fcee
commit
ab4b46f990
Notes:
github-actions[bot]
2025-02-26 11:24:05 +00:00
Author: https://github.com/AtkinsSJ
Commit: ab4b46f990
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3684
Reviewed-by: https://github.com/trflynn89
3 changed files with 3 additions and 37 deletions
|
@ -1602,12 +1602,8 @@ MixBlendMode ComputedProperties::mix_blend_mode() const
|
||||||
Optional<FlyString> ComputedProperties::view_transition_name() const
|
Optional<FlyString> ComputedProperties::view_transition_name() const
|
||||||
{
|
{
|
||||||
auto const& value = property(PropertyID::ViewTransitionName);
|
auto const& value = property(PropertyID::ViewTransitionName);
|
||||||
if (value.is_custom_ident()) {
|
if (value.is_custom_ident())
|
||||||
auto ident = value.as_custom_ident().custom_ident();
|
return value.as_custom_ident().custom_ident();
|
||||||
if (ident == "none"_fly_string)
|
|
||||||
return {};
|
|
||||||
return ident;
|
|
||||||
}
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,6 @@ private:
|
||||||
RefPtr<CSSStyleValue> parse_transition_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue> parse_transition_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue> parse_translate_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue> parse_translate_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue> parse_scale_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue> parse_scale_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue> parse_view_transition_name_value(TokenStream<ComponentValue>&);
|
|
||||||
RefPtr<CSSStyleValue> parse_grid_track_size_list(TokenStream<ComponentValue>&, bool allow_separate_line_name_blocks = false);
|
RefPtr<CSSStyleValue> parse_grid_track_size_list(TokenStream<ComponentValue>&, bool allow_separate_line_name_blocks = false);
|
||||||
RefPtr<CSSStyleValue> parse_grid_auto_track_sizes(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue> parse_grid_auto_track_sizes(TokenStream<ComponentValue>&);
|
||||||
RefPtr<GridAutoFlowStyleValue> parse_grid_auto_flow_value(TokenStream<ComponentValue>&);
|
RefPtr<GridAutoFlowStyleValue> parse_grid_auto_flow_value(TokenStream<ComponentValue>&);
|
||||||
|
|
|
@ -158,7 +158,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
|
||||||
// Custom idents
|
// Custom idents
|
||||||
if (auto property = any_property_accepts_type(property_ids, ValueType::CustomIdent); property.has_value()) {
|
if (auto property = any_property_accepts_type(property_ids, ValueType::CustomIdent); property.has_value()) {
|
||||||
auto context_guard = push_temporary_value_parsing_context(*property);
|
auto context_guard = push_temporary_value_parsing_context(*property);
|
||||||
if (auto custom_ident = parse_custom_ident_value(tokens, {}))
|
if (auto custom_ident = parse_custom_ident_value(tokens, property_custom_ident_blacklist(*property)))
|
||||||
return PropertyAndValue { *property, custom_ident };
|
return PropertyAndValue { *property, custom_ident };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,10 +714,6 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue>> Parser::parse_css_value(Prope
|
||||||
if (auto parsed_value = parse_scale_value(tokens); parsed_value && !tokens.has_next_token())
|
if (auto parsed_value = parse_scale_value(tokens); parsed_value && !tokens.has_next_token())
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::ViewTransitionName:
|
|
||||||
if (auto parsed_value = parse_view_transition_name_value(tokens); parsed_value && !tokens.has_next_token())
|
|
||||||
return parsed_value.release_nonnull();
|
|
||||||
return ParseError::SyntaxError;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4443,29 +4439,4 @@ RefPtr<CSSStyleValue> Parser::parse_filter_value_list_value(TokenStream<Componen
|
||||||
return FilterValueListStyleValue::create(move(filter_value_list));
|
return FilterValueListStyleValue::create(move(filter_value_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<CSSStyleValue> Parser::parse_view_transition_name_value(TokenStream<ComponentValue>& tokens)
|
|
||||||
{
|
|
||||||
// none | <custom-ident>
|
|
||||||
tokens.discard_whitespace();
|
|
||||||
{
|
|
||||||
auto transaction = tokens.begin_transaction();
|
|
||||||
|
|
||||||
// The values 'none' and 'auto' are excluded from <custom-ident> here.
|
|
||||||
// Note: Only auto is excluded here since none isn't parsed differently.
|
|
||||||
auto ident = parse_custom_ident_value(tokens, { { "auto"sv } });
|
|
||||||
if (!ident)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
tokens.discard_whitespace();
|
|
||||||
transaction.commit();
|
|
||||||
|
|
||||||
if (Infra::is_ascii_case_insensitive_match(ident->custom_ident().to_string(), "none"sv)) {
|
|
||||||
return CustomIdentStyleValue::create("none"_fly_string);
|
|
||||||
} else {
|
|
||||||
return ident;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue