mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibWeb: Allow specifying a URL for an SVG fill
This does not do anything yet, but will allow for gradients later!
This commit is contained in:
parent
2fbe5b969b
commit
a5fa5e55ef
4 changed files with 25 additions and 1 deletions
|
@ -72,6 +72,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/URLStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/UnsetStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -2361,6 +2362,14 @@ Optional<AK::URL> Parser::parse_url_function(ComponentValue const& component_val
|
|||
return {};
|
||||
}
|
||||
|
||||
RefPtr<StyleValue> Parser::parse_url_value(ComponentValue const& component_value, AllowedDataUrlType allowed_data_url_type)
|
||||
{
|
||||
auto url = parse_url_function(component_value, allowed_data_url_type);
|
||||
if (!url.has_value())
|
||||
return {};
|
||||
return URLStyleValue::create(*url);
|
||||
}
|
||||
|
||||
template<typename TElement>
|
||||
static Optional<Vector<TElement>> parse_color_stop_list(auto& tokens, auto is_position, auto get_position, auto parse_color, auto parse_dimension)
|
||||
{
|
||||
|
@ -6738,6 +6747,14 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|||
if (auto parse_value = parse_transform_origin_value(component_values))
|
||||
return parse_value.release_nonnull();
|
||||
return ParseError ::SyntaxError;
|
||||
case PropertyID::Fill:
|
||||
if (component_values.size() == 1) {
|
||||
if (auto parsed_url = parse_url_value(component_values.first()))
|
||||
return parsed_url.release_nonnull();
|
||||
}
|
||||
// Allow normal value parsing to continue.
|
||||
// URL is done here to avoid ambiguity with images.
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue