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

LibWeb: Apply CSS scaling to SVG elements

Not sure why this was not done before, not now it works easily :^)
This commit is contained in:
MacDue 2023-04-10 12:34:39 +01:00 committed by Andreas Kling
parent cf23a2b82d
commit d0496ae9b8
5 changed files with 18 additions and 7 deletions

View file

@ -14,7 +14,7 @@ namespace Web {
class SVGContext {
public:
SVGContext(Gfx::FloatRect svg_element_bounds)
SVGContext(CSSPixelRect svg_element_bounds)
: m_svg_element_bounds(svg_element_bounds)
{
m_states.append(State());
@ -28,7 +28,7 @@ public:
void set_stroke_color(Gfx::Color color) { state().stroke_color = color; }
void set_stroke_width(float width) { state().stroke_width = width; }
Gfx::FloatPoint svg_element_position() const { return m_svg_element_bounds.top_left(); }
CSSPixelPoint svg_element_position() const { return m_svg_element_bounds.top_left(); }
void save() { m_states.append(m_states.last()); }
void restore() { m_states.take_last(); }
@ -43,7 +43,7 @@ private:
State const& state() const { return m_states.last(); }
State& state() { return m_states.last(); }
Gfx::FloatRect m_svg_element_bounds;
CSSPixelRect m_svg_element_bounds;
Vector<State> m_states;
};