mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 00:52:12 +00:00
LibWeb: Resolve and paint SVG gradient fills
This bit is mostly ad-hoc for now. This simply turns fill: url(#grad1) into document().get_element_by_id('grad1') then resolves the gradient. This seems to do the trick for most use cases, but this is not attempting to follow the spec yet to keep things simple.
This commit is contained in:
parent
aa3464466e
commit
afd355c135
6 changed files with 97 additions and 17 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/EdgeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
#include <LibWeb/CSS/StyleValues/URLStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
|
@ -646,8 +647,12 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
computed_values.set_grid_row_start(computed_style.grid_row_start());
|
||||
computed_values.set_grid_template_areas(computed_style.grid_template_areas());
|
||||
|
||||
if (auto fill = computed_style.property(CSS::PropertyID::Fill); fill->has_color())
|
||||
auto fill = computed_style.property(CSS::PropertyID::Fill);
|
||||
if (fill->has_color())
|
||||
computed_values.set_fill(fill->to_color(*this));
|
||||
else if (fill->is_url())
|
||||
computed_values.set_fill(fill->as_url().url());
|
||||
// TODO: Allow url()s for strokes
|
||||
if (auto stroke = computed_style.property(CSS::PropertyID::Stroke); stroke->has_color())
|
||||
computed_values.set_stroke(stroke->to_color(*this));
|
||||
if (auto stop_color = computed_style.property(CSS::PropertyID::StopColor); stop_color->has_color())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue