mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibWeb/CSS: Clarify types of image-parsing methods
parse_image_value() always returns some kind of AbstractImageStyleValue.
This commit is contained in:
parent
09d2c5eb9b
commit
c77456a508
Notes:
github-actions[bot]
2025-02-28 12:52:02 +00:00
Author: https://github.com/AtkinsSJ
Commit: c77456a508
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3644
3 changed files with 11 additions and 8 deletions
|
@ -128,7 +128,7 @@ Optional<Vector<AngularColorStopListElement>> Parser::parse_angular_color_stop_l
|
|||
[&](auto& it) { return parse_angle_percentage(it); });
|
||||
}
|
||||
|
||||
RefPtr<CSSStyleValue> Parser::parse_linear_gradient_function(TokenStream<ComponentValue>& outer_tokens)
|
||||
RefPtr<LinearGradientStyleValue> Parser::parse_linear_gradient_function(TokenStream<ComponentValue>& outer_tokens)
|
||||
{
|
||||
using GradientType = LinearGradientStyleValue::GradientType;
|
||||
|
||||
|
@ -262,7 +262,7 @@ RefPtr<CSSStyleValue> Parser::parse_linear_gradient_function(TokenStream<Compone
|
|||
return LinearGradientStyleValue::create(gradient_direction, move(*color_stops), gradient_type, repeating_gradient);
|
||||
}
|
||||
|
||||
RefPtr<CSSStyleValue> Parser::parse_conic_gradient_function(TokenStream<ComponentValue>& outer_tokens)
|
||||
RefPtr<ConicGradientStyleValue> Parser::parse_conic_gradient_function(TokenStream<ComponentValue>& outer_tokens)
|
||||
{
|
||||
auto transaction = outer_tokens.begin_transaction();
|
||||
auto& component_value = outer_tokens.consume_a_token();
|
||||
|
@ -367,7 +367,7 @@ RefPtr<CSSStyleValue> Parser::parse_conic_gradient_function(TokenStream<Componen
|
|||
return ConicGradientStyleValue::create(from_angle, at_position.release_nonnull(), move(*color_stops), repeating_gradient);
|
||||
}
|
||||
|
||||
RefPtr<CSSStyleValue> Parser::parse_radial_gradient_function(TokenStream<ComponentValue>& outer_tokens)
|
||||
RefPtr<RadialGradientStyleValue> Parser::parse_radial_gradient_function(TokenStream<ComponentValue>& outer_tokens)
|
||||
{
|
||||
using EndingShape = RadialGradientStyleValue::EndingShape;
|
||||
using Extent = RadialGradientStyleValue::Extent;
|
||||
|
|
|
@ -282,9 +282,9 @@ private:
|
|||
Optional<Vector<LinearColorStopListElement>> parse_linear_color_stop_list(TokenStream<ComponentValue>&);
|
||||
Optional<Vector<AngularColorStopListElement>> parse_angular_color_stop_list(TokenStream<ComponentValue>&);
|
||||
|
||||
RefPtr<CSSStyleValue> parse_linear_gradient_function(TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_conic_gradient_function(TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_radial_gradient_function(TokenStream<ComponentValue>&);
|
||||
RefPtr<LinearGradientStyleValue> parse_linear_gradient_function(TokenStream<ComponentValue>&);
|
||||
RefPtr<ConicGradientStyleValue> parse_conic_gradient_function(TokenStream<ComponentValue>&);
|
||||
RefPtr<RadialGradientStyleValue> parse_radial_gradient_function(TokenStream<ComponentValue>&);
|
||||
|
||||
ParseErrorOr<NonnullRefPtr<CSSStyleValue>> parse_css_value(PropertyID, TokenStream<ComponentValue>&, Optional<String> original_source_text = {});
|
||||
RefPtr<CSSStyleValue> parse_css_value_for_property(PropertyID, TokenStream<ComponentValue>&);
|
||||
|
@ -324,7 +324,7 @@ private:
|
|||
RefPtr<CSSStyleValue> parse_rect_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_ratio_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<StringStyleValue> parse_string_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_image_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<AbstractImageStyleValue> parse_image_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_paint_value(TokenStream<ComponentValue>&);
|
||||
enum class PositionParsingMode {
|
||||
Normal,
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/CSSLabLike.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSLightDark.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSRGB.h>
|
||||
#include <LibWeb/CSS/StyleValues/ConicGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CounterDefinitionsStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CounterStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
||||
|
@ -43,9 +44,11 @@
|
|||
#include <LibWeb/CSS/StyleValues/ImageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LinearGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RatioStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
||||
|
@ -1920,7 +1923,7 @@ RefPtr<StringStyleValue> Parser::parse_string_value(TokenStream<ComponentValue>&
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<CSSStyleValue> Parser::parse_image_value(TokenStream<ComponentValue>& tokens)
|
||||
RefPtr<AbstractImageStyleValue> Parser::parse_image_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
if (auto url = parse_url_function(tokens); url.has_value())
|
||||
return ImageStyleValue::create(url.value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue