1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Allow any valid <color> in CSS gradients

We now keep the color value as a StyleValue up until we go to paint the
gradient, which makes `currentColor` work, along with any other color
values that can't be immediately converted into a `Gfx::Color` while
parsing.
This commit is contained in:
Sam Atkins 2023-08-16 12:45:23 +01:00 committed by Andreas Kling
parent 2971ae59d8
commit 631a988a57
13 changed files with 53 additions and 28 deletions

View file

@ -8,6 +8,7 @@
*/
#include "RadialGradientStyleValue.h"
#include <LibWeb/Layout/Node.h>
namespace Web::CSS {
@ -184,7 +185,7 @@ Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node,
return resolved_size;
}
void RadialGradientStyleValue::resolve_for_size(Layout::Node const& node, CSSPixelSize paint_size) const
void RadialGradientStyleValue::resolve_for_size(Layout::NodeWithStyleAndBoxModelMetrics const& node, CSSPixelSize paint_size) const
{
CSSPixelRect gradient_box { { 0, 0 }, paint_size };
auto center = m_properties.position.resolved(node, gradient_box).to_type<float>();