mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb/SVG: SVGSymbolElement includes SVGFitToViewBox
This commit is contained in:
parent
821416027d
commit
6c7089fc9e
Notes:
github-actions[bot]
2024-07-21 11:26:44 +00:00
Author: https://github.com/jamierocks
Commit: 6c7089fc9e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/744
3 changed files with 21 additions and 2 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/SVGAnimatedRect.h>
|
||||
#include <LibWeb/SVG/SVGSymbolElement.h>
|
||||
#include <LibWeb/SVG/SVGUseElement.h>
|
||||
|
||||
|
@ -29,6 +30,13 @@ void SVGSymbolElement::initialize(JS::Realm& realm)
|
|||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGSymbolElement);
|
||||
m_view_box_for_bindings = heap().allocate<SVGAnimatedRect>(realm, realm);
|
||||
}
|
||||
|
||||
void SVGSymbolElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_view_box_for_bindings);
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/struct.html#SymbolNotes
|
||||
|
@ -45,8 +53,14 @@ void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
|
||||
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) {
|
||||
m_view_box = try_parse_view_box(value.value_or(String {}));
|
||||
m_view_box_for_bindings->set_nulled(!m_view_box.has_value());
|
||||
if (m_view_box.has_value()) {
|
||||
m_view_box_for_bindings->set_base_val(Gfx::DoubleRect { m_view_box->min_x, m_view_box->min_y, m_view_box->width, m_view_box->height });
|
||||
m_view_box_for_bindings->set_anim_val(Gfx::DoubleRect { m_view_box->min_x, m_view_box->min_y, m_view_box->width, m_view_box->height });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SVGSymbolElement::is_direct_child_of_use_shadow_tree() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue