mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
This commit is contained in:
parent
bb547ce1c4
commit
6f433c8656
445 changed files with 4797 additions and 4268 deletions
|
@ -4,15 +4,18 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SVGCircleElement.h"
|
||||
#include <LibWeb/Bindings/SVGCircleElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGCircleElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGCircleElementPrototype>("SVGCircleElement"));
|
||||
}
|
||||
|
||||
void SVGCircleElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGCircleElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGCircleElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGCircleElement, SVGGraphicsElement);
|
||||
|
||||
SVGCircleElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGCircleElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -27,6 +26,8 @@ public:
|
|||
NonnullRefPtr<SVGAnimatedLength> r() const;
|
||||
|
||||
private:
|
||||
SVGCircleElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
Optional<float> m_center_x;
|
||||
|
@ -35,3 +36,5 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGCircleElement, Web::SVG)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGClipPathElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGClipPathElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
@ -11,6 +13,7 @@ namespace Web::SVG {
|
|||
SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGClipPathElementPrototype>("SVGClipPathElement"));
|
||||
}
|
||||
|
||||
SVGClipPathElement::~SVGClipPathElement()
|
||||
|
|
|
@ -11,13 +11,17 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGClipPathElement final : public SVGElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGClipPathElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGClipPathElement, SVGElement);
|
||||
|
||||
SVGClipPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGClipPathElement();
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGClipPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGClipPathElement, Web::SVG)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGDefsElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGDefsElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
@ -11,6 +13,7 @@ namespace Web::SVG {
|
|||
SVGDefsElement::SVGDefsElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGDefsElementPrototype>("SVGDefsElement"));
|
||||
}
|
||||
|
||||
SVGDefsElement::~SVGDefsElement()
|
||||
|
|
|
@ -11,13 +11,17 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGDefsElement final : public SVGGraphicsElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGDefsElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGDefsElement, SVGGraphicsElement);
|
||||
|
||||
SVGDefsElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGDefsElement();
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGDefsElement(DOM::Document&, DOM::QualifiedName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGDefsElement, Web::SVG)
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: Element(document, move(qualified_name))
|
||||
, m_dataset(JS::make_handle(HTML::DOMStringMap::create(*this)))
|
||||
, m_dataset(HTML::DOMStringMap::create(*this))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGElementPrototype>("SVGElement"));
|
||||
}
|
||||
|
||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_dataset.ptr());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,18 +12,22 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGElement : public DOM::Element {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGElement, DOM::Element);
|
||||
|
||||
public:
|
||||
virtual bool requires_svg_container() const override { return true; }
|
||||
|
||||
HTML::DOMStringMap* dataset() { return m_dataset.cell(); }
|
||||
HTML::DOMStringMap const* dataset() const { return m_dataset.cell(); }
|
||||
HTML::DOMStringMap* dataset() { return m_dataset.ptr(); }
|
||||
HTML::DOMStringMap const* dataset() const { return m_dataset.ptr(); }
|
||||
|
||||
protected:
|
||||
SVGElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
JS::Handle<HTML::DOMStringMap> m_dataset;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<HTML::DOMStringMap> m_dataset;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGElement, Web::SVG)
|
||||
|
|
|
@ -4,15 +4,18 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SVGEllipseElement.h"
|
||||
#include <LibWeb/Bindings/SVGEllipseElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGEllipseElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGEllipseElementPrototype>("SVGEllipseElement"));
|
||||
}
|
||||
|
||||
void SVGEllipseElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGEllipseElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGEllipseElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGEllipseElement, SVGGraphicsElement);
|
||||
|
||||
SVGEllipseElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGEllipseElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -28,6 +27,8 @@ public:
|
|||
NonnullRefPtr<SVGAnimatedLength> ry() const;
|
||||
|
||||
private:
|
||||
SVGEllipseElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
Optional<float> m_center_x;
|
||||
|
@ -37,3 +38,5 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGEllipseElement, Web::SVG)
|
||||
|
|
|
@ -11,13 +11,17 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGGElement final : public SVGGraphicsElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGPathElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGGElement, SVGGraphicsElement);
|
||||
|
||||
SVGGElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGGElement() override = default;
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGGElement(DOM::Document&, DOM::QualifiedName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGGElement, Web::SVG)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGGeometryElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||
#include <LibWeb/SVG/SVGGeometryElement.h>
|
||||
|
||||
|
@ -12,6 +14,7 @@ namespace Web::SVG {
|
|||
SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGGeometryElementPrototype>("SVGGeometryElement"));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Web::SVG {
|
|||
|
||||
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
|
||||
class SVGGeometryElement : public SVGGraphicsElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGGeometryElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGGeometryElement, SVGGraphicsElement);
|
||||
|
||||
public:
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
virtual Gfx::Path& get_path() = 0;
|
||||
|
@ -28,3 +28,5 @@ protected:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGGeometryElement, Web::SVG)
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGGraphicsElementPrototype.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
||||
#include <LibWeb/SVG/SVGSVGElement.h>
|
||||
|
@ -15,6 +17,7 @@ namespace Web::SVG {
|
|||
SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGGraphicsElementPrototype>("SVGGraphicsElement"));
|
||||
}
|
||||
|
||||
void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
|
|
|
@ -15,16 +15,19 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGGraphicsElement : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(SVGGraphicsElement, SVGElement);
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::SVGGraphicsElementWrapper;
|
||||
|
||||
SVGGraphicsElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
Optional<Gfx::Color> fill_color() const;
|
||||
Optional<Gfx::Color> stroke_color() const;
|
||||
Optional<float> stroke_width() const;
|
||||
|
||||
protected:
|
||||
SVGGraphicsElement(DOM::Document&, DOM::QualifiedName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGGraphicsElement, Web::SVG)
|
||||
|
|
|
@ -4,15 +4,18 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SVGLineElement.h"
|
||||
#include <LibWeb/Bindings/SVGLineElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGLineElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGLineElementPrototype>("SVGLineElement"));
|
||||
}
|
||||
|
||||
void SVGLineElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGLineElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGLineElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGLineElement, SVGGraphicsElement);
|
||||
|
||||
SVGLineElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGLineElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -28,6 +27,8 @@ public:
|
|||
NonnullRefPtr<SVGAnimatedLength> y2() const;
|
||||
|
||||
private:
|
||||
SVGLineElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
Optional<float> m_x1;
|
||||
|
@ -37,3 +38,5 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGLineElement, Web::SVG)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <AK/ExtraMathConstants.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Path.h>
|
||||
#include <LibWeb/Bindings/SVGPathElementPrototype.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||
|
@ -86,6 +87,7 @@ namespace Web::SVG {
|
|||
SVGPathElement::SVGPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGPathElementPrototype>("SVGPathElement"));
|
||||
}
|
||||
|
||||
void SVGPathElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGPathElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGPathElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGPathElement, SVGGeometryElement);
|
||||
|
||||
SVGPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGPathElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -25,9 +24,13 @@ public:
|
|||
virtual Gfx::Path& get_path() override;
|
||||
|
||||
private:
|
||||
SVGPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Vector<PathInstruction> m_instructions;
|
||||
Gfx::FloatPoint m_previous_control_point = {};
|
||||
Optional<Gfx::Path> m_path;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGPathElement, Web::SVG)
|
||||
|
|
|
@ -4,15 +4,18 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SVGPolygonElement.h"
|
||||
#include <LibWeb/Bindings/SVGPolygonElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGPolygonElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGPolygonElementPrototype>("SVGPolygonElement"));
|
||||
}
|
||||
|
||||
void SVGPolygonElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGPolygonElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGPolygonElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGPolygonElement, SVGGeometryElement);
|
||||
|
||||
SVGPolygonElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGPolygonElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -22,9 +21,13 @@ public:
|
|||
virtual Gfx::Path& get_path() override;
|
||||
|
||||
private:
|
||||
SVGPolygonElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
Vector<Gfx::FloatPoint> m_points;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGPolygonElement, Web::SVG)
|
||||
|
|
|
@ -4,15 +4,18 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SVGPolylineElement.h"
|
||||
#include <LibWeb/Bindings/SVGPolylineElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGPolylineElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGPolylineElementPrototype>("SVGPolylineElement"));
|
||||
}
|
||||
|
||||
void SVGPolylineElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGPolylineElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGPolylineElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGPolylineElement, SVGGeometryElement);
|
||||
|
||||
SVGPolylineElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGPolylineElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -22,9 +21,13 @@ public:
|
|||
virtual Gfx::Path& get_path() override;
|
||||
|
||||
private:
|
||||
SVGPolylineElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
Vector<Gfx::FloatPoint> m_points;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGPolylineElement, Web::SVG)
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "SVGRectElement.h"
|
||||
#include <LibWeb/Bindings/SVGRectElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
||||
|
@ -15,6 +17,7 @@ namespace Web::SVG {
|
|||
SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGRectElementPrototype>("SVGRectElement"));
|
||||
}
|
||||
|
||||
void SVGRectElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -12,10 +12,9 @@ namespace Web::SVG {
|
|||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElement
|
||||
class SVGRectElement final : public SVGGeometryElement {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGRectElementWrapper;
|
||||
WEB_PLATFORM_OBJECT(SVGRectElement, SVGGeometryElement);
|
||||
|
||||
SVGRectElement(DOM::Document&, DOM::QualifiedName);
|
||||
public:
|
||||
virtual ~SVGRectElement() override = default;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -30,6 +29,8 @@ public:
|
|||
NonnullRefPtr<SVGAnimatedLength> ry() const;
|
||||
|
||||
private:
|
||||
SVGRectElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
Gfx::FloatPoint calculate_used_corner_radius_values();
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
@ -43,3 +44,5 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGRectElement, Web::SVG)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibWeb/Bindings/SVGSVGElementPrototype.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -20,6 +21,7 @@ namespace Web::SVG {
|
|||
SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGSVGElementPrototype>("SVGSVGElement"));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
|
@ -13,11 +13,9 @@
|
|||
namespace Web::SVG {
|
||||
|
||||
class SVGSVGElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGSVGElement, SVGGraphicsElement);
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::SVGSVGElementWrapper;
|
||||
|
||||
SVGSVGElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
@ -28,6 +26,8 @@ public:
|
|||
Optional<ViewBox> const& view_box() const { return m_view_box; }
|
||||
|
||||
private:
|
||||
SVGSVGElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual bool is_svg_svg_element() const override { return true; }
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
@ -43,3 +43,5 @@ template<>
|
|||
inline bool Node::fast_is<SVG::SVGSVGElement>() const { return is_svg_svg_element(); }
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGSVGElement, Web::SVG)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Utf16View.h>
|
||||
#include <LibWeb/Bindings/SVGTextContentElementPrototype.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/SVG/SVGTextContentElement.h>
|
||||
|
||||
|
@ -13,6 +14,7 @@ namespace Web::SVG {
|
|||
SVGTextContentElement::SVGTextContentElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGTextContentElementPrototype>("SVGTextContentElement"));
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars
|
||||
|
|
|
@ -12,12 +12,15 @@ namespace Web::SVG {
|
|||
|
||||
// https://svgwg.org/svg2-draft/text.html#InterfaceSVGTextContentElement
|
||||
class SVGTextContentElement : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGTextContentElement, SVGGraphicsElement);
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::SVGTextContentElementWrapper;
|
||||
|
||||
SVGTextContentElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
int get_number_of_chars() const;
|
||||
|
||||
protected:
|
||||
SVGTextContentElement(DOM::Document&, DOM::QualifiedName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(SVGTextContentElement, Web::SVG)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue