mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
LibWeb: Parse the <svg viewBox> attribute
Just parse it into an SVG::ViewBox object for now, we don't actually use it for anything yet.
This commit is contained in:
parent
63c4fcdc69
commit
7de23aede2
2 changed files with 15 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/Layout/SVGSVGBox.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/SVGSVGElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
@ -36,4 +37,12 @@ unsigned SVGSVGElement::height() const
|
|||
return attribute(HTML::AttributeNames::height).to_uint().value_or(150);
|
||||
}
|
||||
|
||||
void SVGSVGElement::parse_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
SVGGraphicsElement::parse_attribute(name, value);
|
||||
|
||||
if (name.equals_ignoring_case(SVG::AttributeNames::viewBox))
|
||||
m_view_box = try_parse_view_box(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
||||
#include <LibWeb/SVG/ViewBox.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
|
@ -25,8 +26,13 @@ public:
|
|||
virtual bool requires_svg_container() const override { return false; }
|
||||
virtual bool is_svg_container() const override { return true; }
|
||||
|
||||
Optional<ViewBox> const& view_box() { return m_view_box; }
|
||||
|
||||
private:
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
Optional<ViewBox> m_view_box;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue