mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibWeb: Remove unecessary dependence on Window from SVG classes
These classes only needed Window to get at its realm. Pass a realm directly to construct SCG classes.
This commit is contained in:
parent
62a8c26b73
commit
320dddde6a
20 changed files with 87 additions and 93 deletions
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
||||
|
@ -16,7 +16,7 @@ namespace Web::SVG {
|
|||
SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().cached_web_prototype("SVGRectElement"));
|
||||
set_prototype(&Bindings::cached_web_prototype(realm(), "SVGRectElement"));
|
||||
}
|
||||
|
||||
void SVGRectElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
@ -159,9 +159,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::x() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(window(), 0, m_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(window(), 0, m_x.value_or(0));
|
||||
return SVGAnimatedLength::create(window(), move(base_length), move(anim_length));
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementYAttribute
|
||||
|
@ -169,9 +169,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::y() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(window(), 0, m_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(window(), 0, m_y.value_or(0));
|
||||
return SVGAnimatedLength::create(window(), move(base_length), move(anim_length));
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementWidthAttribute
|
||||
|
@ -179,9 +179,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::width() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(window(), 0, m_width.value_or(0));
|
||||
auto anim_length = SVGLength::create(window(), 0, m_width.value_or(0));
|
||||
return SVGAnimatedLength::create(window(), move(base_length), move(anim_length));
|
||||
auto base_length = SVGLength::create(realm(), 0, m_width.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_width.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementHeightAttribute
|
||||
|
@ -189,9 +189,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::height() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(window(), 0, m_height.value_or(0));
|
||||
auto anim_length = SVGLength::create(window(), 0, m_height.value_or(0));
|
||||
return SVGAnimatedLength::create(window(), move(base_length), move(anim_length));
|
||||
auto base_length = SVGLength::create(realm(), 0, m_height.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_height.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementRXAttribute
|
||||
|
@ -199,9 +199,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::rx() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(window(), 0, m_radius_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(window(), 0, m_radius_x.value_or(0));
|
||||
return SVGAnimatedLength::create(window(), move(base_length), move(anim_length));
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementRYAttribute
|
||||
|
@ -209,9 +209,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::ry() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(window(), 0, m_radius_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(window(), 0, m_radius_y.value_or(0));
|
||||
return SVGAnimatedLength::create(window(), move(base_length), move(anim_length));
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue