LibGC+Everywhere: Factor out a LibGC from LibJS

Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
This commit is contained in:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGAElement);
GC_DEFINE_ALLOCATOR(SVGAElement);
SVGAElement::SVGAElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, move(qualified_name))
@ -55,7 +55,7 @@ i32 SVGAElement::default_tab_index_value() const
}
// https://svgwg.org/svg2-draft/linking.html#__svg__SVGAElement__relList
JS::NonnullGCPtr<DOM::DOMTokenList> SVGAElement::rel_list()
GC::Ref<DOM::DOMTokenList> SVGAElement::rel_list()
{
// The relList IDL attribute reflects the rel content attribute.
if (!m_rel_list)
@ -63,7 +63,7 @@ JS::NonnullGCPtr<DOM::DOMTokenList> SVGAElement::rel_list()
return *m_rel_list;
}
JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGAElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGGraphicsBox>(document(), *this, move(style));
}

View file

@ -16,14 +16,14 @@ class SVGAElement final
: public SVGGraphicsElement
, public SVGURIReferenceMixin<SupportsXLinkHref::Yes> {
WEB_PLATFORM_OBJECT(SVGAElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGAElement);
GC_DECLARE_ALLOCATOR(SVGAElement);
public:
virtual ~SVGAElement() override;
JS::NonnullGCPtr<DOM::DOMTokenList> rel_list();
GC::Ref<DOM::DOMTokenList> rel_list();
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
private:
SVGAElement(DOM::Document&, DOM::QualifiedName);
@ -35,7 +35,7 @@ private:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual i32 default_tab_index_value() const override;
JS::GCPtr<DOM::DOMTokenList> m_rel_list;
GC::Ptr<DOM::DOMTokenList> m_rel_list;
};
}

View file

@ -10,14 +10,14 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGAnimatedLength);
GC_DEFINE_ALLOCATOR(SVGAnimatedLength);
JS::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
GC::Ref<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, GC::Ref<SVGLength> base_val, GC::Ref<SVGLength> anim_val)
{
return realm.create<SVGAnimatedLength>(realm, move(base_val), move(anim_val));
}
SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, GC::Ref<SVGLength> base_val, GC::Ref<SVGLength> anim_val)
: PlatformObject(realm)
, m_base_val(move(base_val))
, m_anim_val(move(anim_val))

View file

@ -14,23 +14,23 @@ namespace Web::SVG {
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedLength
class SVGAnimatedLength final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedLength, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGAnimatedLength);
GC_DECLARE_ALLOCATOR(SVGAnimatedLength);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedLength> create(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val);
[[nodiscard]] static GC::Ref<SVGAnimatedLength> create(JS::Realm&, GC::Ref<SVGLength> base_val, GC::Ref<SVGLength> anim_val);
virtual ~SVGAnimatedLength() override;
JS::NonnullGCPtr<SVGLength> base_val() const { return m_base_val; }
JS::NonnullGCPtr<SVGLength> anim_val() const { return m_anim_val; }
GC::Ref<SVGLength> base_val() const { return m_base_val; }
GC::Ref<SVGLength> anim_val() const { return m_anim_val; }
private:
SVGAnimatedLength(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val);
SVGAnimatedLength(JS::Realm&, GC::Ref<SVGLength> base_val, GC::Ref<SVGLength> anim_val);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<SVGLength> m_base_val;
JS::NonnullGCPtr<SVGLength> m_anim_val;
GC::Ref<SVGLength> m_base_val;
GC::Ref<SVGLength> m_anim_val;
};
}

View file

@ -10,9 +10,9 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGAnimatedNumber);
GC_DEFINE_ALLOCATOR(SVGAnimatedNumber);
JS::NonnullGCPtr<SVGAnimatedNumber> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
GC::Ref<SVGAnimatedNumber> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
{
return realm.create<SVGAnimatedNumber>(realm, base_val, anim_val);
}

View file

@ -14,10 +14,10 @@ namespace Web::SVG {
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedNumber
class SVGAnimatedNumber final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedNumber, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGAnimatedNumber);
GC_DECLARE_ALLOCATOR(SVGAnimatedNumber);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedNumber> create(JS::Realm&, float base_val, float anim_val);
[[nodiscard]] static GC::Ref<SVGAnimatedNumber> create(JS::Realm&, float base_val, float anim_val);
virtual ~SVGAnimatedNumber() override;
float base_val() const { return m_base_val; }

View file

@ -11,7 +11,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGAnimatedRect);
GC_DEFINE_ALLOCATOR(SVGAnimatedRect);
SVGAnimatedRect::SVGAnimatedRect(JS::Realm& realm)
: Bindings::PlatformObject(realm)
@ -35,14 +35,14 @@ void SVGAnimatedRect::visit_edges(Visitor& visitor)
visitor.visit(m_anim_val);
}
JS::GCPtr<Geometry::DOMRect> SVGAnimatedRect::base_val() const
GC::Ptr<Geometry::DOMRect> SVGAnimatedRect::base_val() const
{
if (m_nulled)
return nullptr;
return m_base_val;
}
JS::GCPtr<Geometry::DOMRect> SVGAnimatedRect::anim_val() const
GC::Ptr<Geometry::DOMRect> SVGAnimatedRect::anim_val() const
{
if (m_nulled)
return nullptr;

View file

@ -13,13 +13,13 @@ namespace Web::SVG {
class SVGAnimatedRect final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedRect, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGAnimatedRect);
GC_DECLARE_ALLOCATOR(SVGAnimatedRect);
public:
virtual ~SVGAnimatedRect();
JS::GCPtr<Geometry::DOMRect> base_val() const;
JS::GCPtr<Geometry::DOMRect> anim_val() const;
GC::Ptr<Geometry::DOMRect> base_val() const;
GC::Ptr<Geometry::DOMRect> anim_val() const;
void set_base_val(Gfx::DoubleRect const&);
void set_anim_val(Gfx::DoubleRect const&);
@ -32,8 +32,8 @@ private:
explicit SVGAnimatedRect(JS::Realm&);
JS::GCPtr<Geometry::DOMRect> m_base_val;
JS::GCPtr<Geometry::DOMRect> m_anim_val;
GC::Ptr<Geometry::DOMRect> m_base_val;
GC::Ptr<Geometry::DOMRect> m_anim_val;
bool m_nulled { true };
};

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Heap/Heap.h>
#include <LibGC/Heap.h>
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/SVGAnimatedStringPrototype.h>
@ -13,14 +13,14 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGAnimatedString);
GC_DEFINE_ALLOCATOR(SVGAnimatedString);
JS::NonnullGCPtr<SVGAnimatedString> SVGAnimatedString::create(JS::Realm& realm, JS::NonnullGCPtr<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute, Optional<FlyString> initial_value)
GC::Ref<SVGAnimatedString> SVGAnimatedString::create(JS::Realm& realm, GC::Ref<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute, Optional<FlyString> initial_value)
{
return realm.create<SVGAnimatedString>(realm, element, move(reflected_attribute), move(deprecated_reflected_attribute), move(initial_value));
}
SVGAnimatedString::SVGAnimatedString(JS::Realm& realm, JS::NonnullGCPtr<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute, Optional<FlyString> initial_value)
SVGAnimatedString::SVGAnimatedString(JS::Realm& realm, GC::Ref<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute, Optional<FlyString> initial_value)
: Bindings::PlatformObject(realm)
, m_element(element)
, m_reflected_attribute(move(reflected_attribute))

View file

@ -14,22 +14,22 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedString
class SVGAnimatedString final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedString, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGAnimatedString);
GC_DECLARE_ALLOCATOR(SVGAnimatedString);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedString> create(JS::Realm&, JS::NonnullGCPtr<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute = {}, Optional<FlyString> initial_value = {});
[[nodiscard]] static GC::Ref<SVGAnimatedString> create(JS::Realm&, GC::Ref<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute = {}, Optional<FlyString> initial_value = {});
virtual ~SVGAnimatedString() override;
String base_val() const;
void set_base_val(String const& base_val);
private:
SVGAnimatedString(JS::Realm&, JS::NonnullGCPtr<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute, Optional<FlyString> initial_value);
SVGAnimatedString(JS::Realm&, GC::Ref<SVGElement> element, FlyString reflected_attribute, Optional<FlyString> deprecated_reflected_attribute, Optional<FlyString> initial_value);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<SVGElement> m_element;
GC::Ref<SVGElement> m_element;
FlyString m_reflected_attribute;
Optional<FlyString> m_deprecated_reflected_attribute;
Optional<FlyString> m_initial_value;

View file

@ -10,14 +10,14 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGAnimatedTransformList);
GC_DEFINE_ALLOCATOR(SVGAnimatedTransformList);
JS::NonnullGCPtr<SVGAnimatedTransformList> SVGAnimatedTransformList::create(JS::Realm& realm, JS::NonnullGCPtr<SVGTransformList> base_val, JS::NonnullGCPtr<SVGTransformList> anim_val)
GC::Ref<SVGAnimatedTransformList> SVGAnimatedTransformList::create(JS::Realm& realm, GC::Ref<SVGTransformList> base_val, GC::Ref<SVGTransformList> anim_val)
{
return realm.create<SVGAnimatedTransformList>(realm, base_val, anim_val);
}
SVGAnimatedTransformList::SVGAnimatedTransformList(JS::Realm& realm, JS::NonnullGCPtr<SVGTransformList> base_val, JS::NonnullGCPtr<SVGTransformList> anim_val)
SVGAnimatedTransformList::SVGAnimatedTransformList(JS::Realm& realm, GC::Ref<SVGTransformList> base_val, GC::Ref<SVGTransformList> anim_val)
: PlatformObject(realm)
, m_base_val(base_val)
, m_anim_val(anim_val) {};

View file

@ -14,30 +14,30 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/single-page.html#coords-InterfaceSVGTransformList
class SVGAnimatedTransformList final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedTransformList, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGAnimatedTransformList);
GC_DECLARE_ALLOCATOR(SVGAnimatedTransformList);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedTransformList> create(JS::Realm& realm, JS::NonnullGCPtr<SVGTransformList> base_val, JS::NonnullGCPtr<SVGTransformList> anim_val);
[[nodiscard]] static GC::Ref<SVGAnimatedTransformList> create(JS::Realm& realm, GC::Ref<SVGTransformList> base_val, GC::Ref<SVGTransformList> anim_val);
virtual ~SVGAnimatedTransformList() override;
JS::NonnullGCPtr<SVGTransformList> base_val() const
GC::Ref<SVGTransformList> base_val() const
{
return m_anim_val;
}
JS::NonnullGCPtr<SVGTransformList> anim_val() const
GC::Ref<SVGTransformList> anim_val() const
{
return m_anim_val;
}
private:
SVGAnimatedTransformList(JS::Realm& realm, JS::NonnullGCPtr<SVGTransformList> base_val, JS::NonnullGCPtr<SVGTransformList> anim_val);
SVGAnimatedTransformList(JS::Realm& realm, GC::Ref<SVGTransformList> base_val, GC::Ref<SVGTransformList> anim_val);
virtual void initialize(JS::Realm& realm) override;
virtual void visit_edges(Cell::Visitor& visitor) override;
JS::NonnullGCPtr<SVGTransformList> m_base_val;
JS::NonnullGCPtr<SVGTransformList> m_anim_val;
GC::Ref<SVGTransformList> m_base_val;
GC::Ref<SVGTransformList> m_anim_val;
};
}

View file

@ -16,7 +16,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGCircleElement);
GC_DEFINE_ALLOCATOR(SVGCircleElement);
SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGeometryElement(document, qualified_name)
@ -83,19 +83,19 @@ Gfx::Path SVGCircleElement::get_path(CSSPixelSize viewport_size)
}
// https://www.w3.org/TR/SVG11/shapes.html#CircleElementCXAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGCircleElement::cx() const
GC::Ref<SVGAnimatedLength> SVGCircleElement::cx() const
{
return svg_animated_length_for_property(CSS::PropertyID::Cx);
}
// https://www.w3.org/TR/SVG11/shapes.html#CircleElementCYAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGCircleElement::cy() const
GC::Ref<SVGAnimatedLength> SVGCircleElement::cy() const
{
return svg_animated_length_for_property(CSS::PropertyID::Cy);
}
// https://www.w3.org/TR/SVG11/shapes.html#CircleElementRAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGCircleElement::r() const
GC::Ref<SVGAnimatedLength> SVGCircleElement::r() const
{
return svg_animated_length_for_property(CSS::PropertyID::R);
}

View file

@ -13,7 +13,7 @@ namespace Web::SVG {
class SVGCircleElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGCircleElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGCircleElement);
GC_DECLARE_ALLOCATOR(SVGCircleElement);
public:
virtual ~SVGCircleElement() override = default;
@ -22,9 +22,9 @@ public:
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> cx() const;
JS::NonnullGCPtr<SVGAnimatedLength> cy() const;
JS::NonnullGCPtr<SVGAnimatedLength> r() const;
GC::Ref<SVGAnimatedLength> cx() const;
GC::Ref<SVGAnimatedLength> cy() const;
GC::Ref<SVGAnimatedLength> r() const;
private:
SVGCircleElement(DOM::Document&, DOM::QualifiedName);

View file

@ -11,7 +11,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGClipPathElement);
GC_DEFINE_ALLOCATOR(SVGClipPathElement);
SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))
@ -36,7 +36,7 @@ void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<Strin
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
}
JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(CSS::StyleProperties)
GC::Ptr<Layout::Node> SVGClipPathElement::create_layout_node(CSS::StyleProperties)
{
// Clip paths are handled as a special case in the TreeBuilder.
return nullptr;

View file

@ -15,7 +15,7 @@ namespace Web::SVG {
class SVGClipPathElement final : public SVGElement
, public SVGViewport {
WEB_PLATFORM_OBJECT(SVGClipPathElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGClipPathElement);
GC_DECLARE_ALLOCATOR(SVGClipPathElement);
public:
virtual ~SVGClipPathElement();
@ -40,7 +40,7 @@ public:
return m_clip_path_units.value_or(ClipPathUnits::UserSpaceOnUse);
}
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
private:
SVGClipPathElement(DOM::Document&, DOM::QualifiedName);

View file

@ -23,16 +23,16 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGDecodedImageData);
JS_DEFINE_ALLOCATOR(SVGDecodedImageData::SVGPageClient);
GC_DEFINE_ALLOCATOR(SVGDecodedImageData);
GC_DEFINE_ALLOCATOR(SVGDecodedImageData::SVGPageClient);
ErrorOr<JS::NonnullGCPtr<SVGDecodedImageData>> SVGDecodedImageData::create(JS::Realm& realm, JS::NonnullGCPtr<Page> host_page, URL::URL const& url, ByteBuffer data)
ErrorOr<GC::Ref<SVGDecodedImageData>> SVGDecodedImageData::create(JS::Realm& realm, GC::Ref<Page> host_page, URL::URL const& url, ByteBuffer data)
{
auto page_client = SVGPageClient::create(Bindings::main_thread_vm(), host_page);
auto page = Page::create(Bindings::main_thread_vm(), *page_client);
page_client->m_svg_page = page.ptr();
page->set_top_level_traversable(MUST(Web::HTML::TraversableNavigable::create_a_new_top_level_traversable(*page, nullptr, {})));
JS::NonnullGCPtr<HTML::Navigable> navigable = page->top_level_traversable();
GC::Ref<HTML::Navigable> navigable = page->top_level_traversable();
auto response = Fetch::Infrastructure::Response::create(navigable->vm());
response->url_list().append(url);
auto navigation_params = navigable->heap().allocate<HTML::NavigationParams>();
@ -66,7 +66,7 @@ ErrorOr<JS::NonnullGCPtr<SVGDecodedImageData>> SVGDecodedImageData::create(JS::R
return realm.create<SVGDecodedImageData>(page, page_client, document, *svg_root);
}
SVGDecodedImageData::SVGDecodedImageData(JS::NonnullGCPtr<Page> page, JS::NonnullGCPtr<SVGPageClient> page_client, JS::NonnullGCPtr<DOM::Document> document, JS::NonnullGCPtr<SVG::SVGSVGElement> root_element)
SVGDecodedImageData::SVGDecodedImageData(GC::Ref<Page> page, GC::Ref<SVGPageClient> page_client, GC::Ref<DOM::Document> document, GC::Ref<SVG::SVGSVGElement> root_element)
: m_page(page)
, m_page_client(page_client)
, m_document(document)

View file

@ -13,12 +13,12 @@
namespace Web::SVG {
class SVGDecodedImageData final : public HTML::DecodedImageData {
JS_CELL(SVGDecodedImageData, HTML::DecodedImageData);
JS_DECLARE_ALLOCATOR(SVGDecodedImageData);
GC_CELL(SVGDecodedImageData, HTML::DecodedImageData);
GC_DECLARE_ALLOCATOR(SVGDecodedImageData);
public:
class SVGPageClient;
static ErrorOr<JS::NonnullGCPtr<SVGDecodedImageData>> create(JS::Realm&, JS::NonnullGCPtr<Page>, URL::URL const&, ByteBuffer encoded_svg);
static ErrorOr<GC::Ref<SVGDecodedImageData>> create(JS::Realm&, GC::Ref<Page>, URL::URL const&, ByteBuffer encoded_svg);
virtual ~SVGDecodedImageData() override;
virtual RefPtr<Gfx::ImmutableBitmap> bitmap(size_t frame_index, Gfx::IntSize) const override;
@ -38,33 +38,33 @@ public:
virtual void visit_edges(Cell::Visitor& visitor) override;
private:
SVGDecodedImageData(JS::NonnullGCPtr<Page>, JS::NonnullGCPtr<SVGPageClient>, JS::NonnullGCPtr<DOM::Document>, JS::NonnullGCPtr<SVG::SVGSVGElement>);
SVGDecodedImageData(GC::Ref<Page>, GC::Ref<SVGPageClient>, GC::Ref<DOM::Document>, GC::Ref<SVG::SVGSVGElement>);
RefPtr<Gfx::Bitmap> render(Gfx::IntSize) const;
mutable HashMap<Gfx::IntSize, NonnullRefPtr<Gfx::ImmutableBitmap>> m_cached_rendered_bitmaps;
JS::NonnullGCPtr<Page> m_page;
JS::NonnullGCPtr<SVGPageClient> m_page_client;
GC::Ref<Page> m_page;
GC::Ref<SVGPageClient> m_page_client;
JS::NonnullGCPtr<DOM::Document> m_document;
JS::NonnullGCPtr<SVG::SVGSVGElement> m_root_element;
GC::Ref<DOM::Document> m_document;
GC::Ref<SVG::SVGSVGElement> m_root_element;
};
class SVGDecodedImageData::SVGPageClient final : public PageClient {
JS_CELL(SVGDecodedImageData::SVGPageClient, PageClient);
JS_DECLARE_ALLOCATOR(SVGDecodedImageData::SVGPageClient);
GC_CELL(SVGDecodedImageData::SVGPageClient, PageClient);
GC_DECLARE_ALLOCATOR(SVGDecodedImageData::SVGPageClient);
public:
static JS::NonnullGCPtr<SVGPageClient> create(JS::VM& vm, Page& page)
static GC::Ref<SVGPageClient> create(JS::VM& vm, Page& page)
{
return vm.heap().allocate<SVGPageClient>(page);
}
virtual ~SVGPageClient() override = default;
JS::NonnullGCPtr<Page> m_host_page;
JS::GCPtr<Page> m_svg_page;
GC::Ref<Page> m_host_page;
GC::Ptr<Page> m_svg_page;
virtual Page& page() override { return *m_svg_page; }
virtual Page const& page() const override { return *m_svg_page; }

View file

@ -11,7 +11,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGDefsElement);
GC_DEFINE_ALLOCATOR(SVGDefsElement);
SVGDefsElement::SVGDefsElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, move(qualified_name))

View file

@ -12,12 +12,12 @@ namespace Web::SVG {
class SVGDefsElement final : public SVGGraphicsElement {
WEB_PLATFORM_OBJECT(SVGDefsElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGDefsElement);
GC_DECLARE_ALLOCATOR(SVGDefsElement);
public:
virtual ~SVGDefsElement();
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override
{
return nullptr;
}

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGDescElement);
GC_DEFINE_ALLOCATOR(SVGDescElement);
SVGDescElement::SVGDescElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))
@ -25,7 +25,7 @@ void SVGDescElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGDescElement);
}
JS::GCPtr<Layout::Node> SVGDescElement::create_layout_node(CSS::StyleProperties)
GC::Ptr<Layout::Node> SVGDescElement::create_layout_node(CSS::StyleProperties)
{
return nullptr;
}

View file

@ -12,14 +12,14 @@ namespace Web::SVG {
class SVGDescElement final : public SVGElement {
WEB_PLATFORM_OBJECT(SVGDescElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGDescElement);
GC_DECLARE_ALLOCATOR(SVGDescElement);
private:
SVGDescElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
};
}

View file

@ -108,7 +108,7 @@ void SVGElement::remove_from_use_element_that_reference_this()
}
// https://svgwg.org/svg2-draft/types.html#__svg__SVGElement__classNames
JS::NonnullGCPtr<SVGAnimatedString> SVGElement::class_name()
GC::Ref<SVGAnimatedString> SVGElement::class_name()
{
// The className IDL attribute reflects the class attribute.
if (!m_class_name_animated_string)
@ -118,7 +118,7 @@ JS::NonnullGCPtr<SVGAnimatedString> SVGElement::class_name()
}
// https://svgwg.org/svg2-draft/types.html#__svg__SVGElement__ownerSVGElement
JS::GCPtr<SVGSVGElement> SVGElement::owner_svg_element()
GC::Ptr<SVGSVGElement> SVGElement::owner_svg_element()
{
// The ownerSVGElement IDL attribute represents the nearest ancestor svg element.
// On getting ownerSVGElement, the nearest ancestor svg element is returned;
@ -126,7 +126,7 @@ JS::GCPtr<SVGSVGElement> SVGElement::owner_svg_element()
return shadow_including_first_ancestor_of_type<SVGSVGElement>();
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGElement::svg_animated_length_for_property(CSS::PropertyID property) const
GC::Ref<SVGAnimatedLength> SVGElement::svg_animated_length_for_property(CSS::PropertyID property) const
{
// FIXME: Create a proper animated value when animations are supported.
auto make_length = [&] {

View file

@ -22,8 +22,8 @@ class SVGElement
public:
virtual bool requires_svg_container() const override { return true; }
JS::NonnullGCPtr<SVGAnimatedString> class_name();
JS::GCPtr<SVGSVGElement> owner_svg_element();
GC::Ref<SVGAnimatedString> class_name();
GC::Ptr<SVGSVGElement> owner_svg_element();
protected:
SVGElement(DOM::Document&, DOM::QualifiedName);
@ -40,15 +40,15 @@ protected:
void update_use_elements_that_reference_this();
void remove_from_use_element_that_reference_this();
JS::NonnullGCPtr<SVGAnimatedLength> svg_animated_length_for_property(CSS::PropertyID) const;
GC::Ref<SVGAnimatedLength> svg_animated_length_for_property(CSS::PropertyID) const;
private:
// ^HTML::GlobalEventHandlers
virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
virtual GC::Ptr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
virtual bool is_svg_element() const final { return true; }
JS::GCPtr<SVGAnimatedString> m_class_name_animated_string;
GC::Ptr<SVGAnimatedString> m_class_name_animated_string;
};
}

View file

@ -13,7 +13,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGEllipseElement);
GC_DEFINE_ALLOCATOR(SVGEllipseElement);
SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGeometryElement(document, qualified_name)
@ -77,7 +77,7 @@ Gfx::Path SVGEllipseElement::get_path(CSSPixelSize)
}
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementCXAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::cx() const
GC::Ref<SVGAnimatedLength> SVGEllipseElement::cx() const
{
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
// FIXME: Create a proper animated value when animations are supported.
@ -87,7 +87,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::cx() const
}
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementCYAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::cy() const
GC::Ref<SVGAnimatedLength> SVGEllipseElement::cy() const
{
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
// FIXME: Create a proper animated value when animations are supported.
@ -97,7 +97,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::cy() const
}
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementRXAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::rx() const
GC::Ref<SVGAnimatedLength> SVGEllipseElement::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.
@ -107,7 +107,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::rx() const
}
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementRYAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::ry() const
GC::Ref<SVGAnimatedLength> SVGEllipseElement::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.

View file

@ -13,7 +13,7 @@ namespace Web::SVG {
class SVGEllipseElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGEllipseElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGEllipseElement);
GC_DECLARE_ALLOCATOR(SVGEllipseElement);
public:
virtual ~SVGEllipseElement() override = default;
@ -22,10 +22,10 @@ public:
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> cx() const;
JS::NonnullGCPtr<SVGAnimatedLength> cy() const;
JS::NonnullGCPtr<SVGAnimatedLength> rx() const;
JS::NonnullGCPtr<SVGAnimatedLength> ry() const;
GC::Ref<SVGAnimatedLength> cx() const;
GC::Ref<SVGAnimatedLength> cy() const;
GC::Ref<SVGAnimatedLength> rx() const;
GC::Ref<SVGAnimatedLength> ry() const;
private:
SVGEllipseElement(DOM::Document&, DOM::QualifiedName);

View file

@ -17,7 +17,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGForeignObjectElement);
GC_DEFINE_ALLOCATOR(SVGForeignObjectElement);
SVGForeignObjectElement::SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, move(qualified_name))
@ -47,7 +47,7 @@ void SVGForeignObjectElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_height);
}
JS::GCPtr<Layout::Node> SVGForeignObjectElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGForeignObjectElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGForeignObjectBox>(document(), *this, move(style));
}
@ -63,22 +63,22 @@ void SVGForeignObjectElement::apply_presentational_hints(CSS::StyleProperties& s
style.set_property(CSS::PropertyID::Height, height_value.release_nonnull());
}
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGForeignObjectElement::x()
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::x()
{
return *m_x;
}
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGForeignObjectElement::y()
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::y()
{
return *m_y;
}
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGForeignObjectElement::width()
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::width()
{
return *m_width;
}
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGForeignObjectElement::height()
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::height()
{
return *m_height;
}

View file

@ -13,17 +13,17 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/embedded.html#InterfaceSVGForeignObjectElement
class SVGForeignObjectElement final : public SVGGraphicsElement {
WEB_PLATFORM_OBJECT(SVGForeignObjectElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGForeignObjectElement);
GC_DECLARE_ALLOCATOR(SVGForeignObjectElement);
public:
virtual ~SVGForeignObjectElement() override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
JS::NonnullGCPtr<SVG::SVGAnimatedLength> x();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> width();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> height();
GC::Ref<SVG::SVGAnimatedLength> x();
GC::Ref<SVG::SVGAnimatedLength> y();
GC::Ref<SVG::SVGAnimatedLength> width();
GC::Ref<SVG::SVGAnimatedLength> height();
private:
SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name);
@ -33,10 +33,10 @@ private:
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
JS::GCPtr<SVG::SVGAnimatedLength> m_x;
JS::GCPtr<SVG::SVGAnimatedLength> m_y;
JS::GCPtr<SVG::SVGAnimatedLength> m_width;
JS::GCPtr<SVG::SVGAnimatedLength> m_height;
GC::Ptr<SVG::SVGAnimatedLength> m_x;
GC::Ptr<SVG::SVGAnimatedLength> m_y;
GC::Ptr<SVG::SVGAnimatedLength> m_width;
GC::Ptr<SVG::SVGAnimatedLength> m_height;
};
}

View file

@ -13,7 +13,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGGElement);
GC_DEFINE_ALLOCATOR(SVGGElement);
SVGGElement::SVGGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, move(qualified_name))
@ -26,7 +26,7 @@ void SVGGElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGElement);
}
JS::GCPtr<Layout::Node> SVGGElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGGElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGGraphicsBox>(document(), *this, move(style));
}

View file

@ -12,12 +12,12 @@ namespace Web::SVG {
class SVGGElement final : public SVGGraphicsElement {
WEB_PLATFORM_OBJECT(SVGGElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGGElement);
GC_DECLARE_ALLOCATOR(SVGGElement);
public:
virtual ~SVGGElement() override = default;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
private:
SVGGElement(DOM::Document&, DOM::QualifiedName);

View file

@ -22,7 +22,7 @@ void SVGGeometryElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGeometryElement);
}
JS::GCPtr<Layout::Node> SVGGeometryElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGGeometryElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGGeometryBox>(document(), *this, move(style));
}
@ -32,7 +32,7 @@ float SVGGeometryElement::get_total_length()
return 0;
}
JS::NonnullGCPtr<Geometry::DOMPoint> SVGGeometryElement::get_point_at_length(float distance)
GC::Ref<Geometry::DOMPoint> SVGGeometryElement::get_point_at_length(float distance)
{
(void)distance;
return Geometry::DOMPoint::construct_impl(realm(), 0, 0, 0, 0);

View file

@ -16,12 +16,12 @@ class SVGGeometryElement : public SVGGraphicsElement {
WEB_PLATFORM_OBJECT(SVGGeometryElement, SVGGraphicsElement);
public:
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) = 0;
float get_total_length();
JS::NonnullGCPtr<Geometry::DOMPoint> get_point_at_length(float distance);
GC::Ref<Geometry::DOMPoint> get_point_at_length(float distance);
protected:
SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name);

View file

@ -121,7 +121,7 @@ void SVGGradientElement::add_color_stops(Painting::SVGGradientPaintStyle& paint_
});
}
JS::GCPtr<SVGGradientElement const> SVGGradientElement::linked_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
GC::Ptr<SVGGradientElement const> SVGGradientElement::linked_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
{
// FIXME: This entire function is an ad-hoc hack!
// It can only resolve #<ids> in the same document.

View file

@ -59,7 +59,7 @@ protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
JS::GCPtr<SVGGradientElement const> linked_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const;
GC::Ptr<SVGGradientElement const> linked_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const;
Gfx::AffineTransform gradient_paint_transform(SVGPaintContext const&) const;

View file

@ -74,7 +74,7 @@ Optional<Painting::PaintStyle> SVGGraphicsElement::stroke_paint_style(SVGPaintCo
return svg_paint_computed_value_to_gfx_paint_style(paint_context, layout_node()->computed_values().stroke());
}
JS::GCPtr<SVG::SVGMaskElement const> SVGGraphicsElement::mask() const
GC::Ptr<SVG::SVGMaskElement const> SVGGraphicsElement::mask() const
{
auto const& mask_reference = layout_node()->computed_values().mask();
if (!mask_reference.has_value())
@ -82,7 +82,7 @@ JS::GCPtr<SVG::SVGMaskElement const> SVGGraphicsElement::mask() const
return try_resolve_url_to<SVG::SVGMaskElement const>(mask_reference->url());
}
JS::GCPtr<SVG::SVGClipPathElement const> SVGGraphicsElement::clip_path() const
GC::Ptr<SVG::SVGClipPathElement const> SVGGraphicsElement::clip_path() const
{
auto const& clip_path_reference = layout_node()->computed_values().clip_path();
if (!clip_path_reference.has_value() || !clip_path_reference->is_url())
@ -288,7 +288,7 @@ Optional<float> SVGGraphicsElement::stroke_width() const
}
// https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getBBox
JS::NonnullGCPtr<Geometry::DOMRect> SVGGraphicsElement::get_b_box(Optional<SVGBoundingBoxOptions>)
GC::Ref<Geometry::DOMRect> SVGGraphicsElement::get_b_box(Optional<SVGBoundingBoxOptions>)
{
// FIXME: It should be possible to compute this without layout updates. The bounding box is within the
// SVG coordinate space (before any viewbox or other transformations), so it should be possible to
@ -309,7 +309,7 @@ JS::NonnullGCPtr<Geometry::DOMRect> SVGGraphicsElement::get_b_box(Optional<SVGBo
return Geometry::DOMRect::create(realm(), translated_rect);
}
JS::NonnullGCPtr<SVGAnimatedTransformList> SVGGraphicsElement::transform() const
GC::Ref<SVGAnimatedTransformList> SVGGraphicsElement::transform() const
{
dbgln("(STUBBED) SVGGraphicsElement::transform(). Called on: {}", debug_description());
auto base_val = SVGTransformList::create(realm());
@ -317,7 +317,7 @@ JS::NonnullGCPtr<SVGAnimatedTransformList> SVGGraphicsElement::transform() const
return SVGAnimatedTransformList::create(realm(), base_val, anim_val);
}
JS::GCPtr<Geometry::DOMMatrix> SVGGraphicsElement::get_screen_ctm()
GC::Ptr<Geometry::DOMMatrix> SVGGraphicsElement::get_screen_ctm()
{
dbgln("(STUBBED) SVGGraphicsElement::get_screen_ctm(). Called on: {}", debug_description());
return Geometry::DOMMatrix::create(realm());

View file

@ -57,13 +57,13 @@ public:
Optional<Painting::PaintStyle> fill_paint_style(SVGPaintContext const&) const;
Optional<Painting::PaintStyle> stroke_paint_style(SVGPaintContext const&) const;
JS::GCPtr<SVG::SVGMaskElement const> mask() const;
JS::GCPtr<SVG::SVGClipPathElement const> clip_path() const;
GC::Ptr<SVG::SVGMaskElement const> mask() const;
GC::Ptr<SVG::SVGClipPathElement const> clip_path() const;
JS::NonnullGCPtr<Geometry::DOMRect> get_b_box(Optional<SVGBoundingBoxOptions>);
JS::NonnullGCPtr<SVGAnimatedTransformList> transform() const;
GC::Ref<Geometry::DOMRect> get_b_box(Optional<SVGBoundingBoxOptions>);
GC::Ref<SVGAnimatedTransformList> transform() const;
JS::GCPtr<Geometry::DOMMatrix> get_screen_ctm();
GC::Ptr<Geometry::DOMMatrix> get_screen_ctm();
protected:
SVGGraphicsElement(DOM::Document&, DOM::QualifiedName);
@ -80,7 +80,7 @@ protected:
Gfx::AffineTransform m_transform = {};
template<typename T>
JS::GCPtr<T> try_resolve_url_to(URL::URL const& url) const
GC::Ptr<T> try_resolve_url_to(URL::URL const& url) const
{
if (!url.fragment().has_value())
return {};

View file

@ -6,7 +6,7 @@
#include "SVGImageElement.h"
#include <LibCore/Timer.h>
#include <LibJS/Heap/Heap.h>
#include <LibGC/Heap.h>
#include <LibWeb/Bindings/SVGImageElementPrototype.h>
#include <LibWeb/DOM/DocumentObserver.h>
#include <LibWeb/DOM/Event.h>
@ -64,7 +64,7 @@ void SVGImageElement::attribute_changed(FlyString const& name, Optional<String>
}
// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__x
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::x()
GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::x()
{
if (!m_x) {
auto& realm = this->realm();
@ -75,7 +75,7 @@ JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::x()
}
// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__y
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::y()
GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::y()
{
if (!m_y) {
auto& realm = this->realm();
@ -86,7 +86,7 @@ JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::y()
}
// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__width
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::width()
GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::width()
{
if (!m_width) {
auto& realm = this->realm();
@ -97,7 +97,7 @@ JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::width()
}
// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__height
JS::NonnullGCPtr<SVG::SVGAnimatedLength> SVGImageElement::height()
GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::height()
{
if (!m_height) {
auto& realm = this->realm();
@ -179,7 +179,7 @@ void SVGImageElement::fetch_the_document(URL::URL const& url)
}
}
JS::GCPtr<Layout::Node> SVGImageElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGImageElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGImageBox>(document(), *this, move(style));
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibJS/Heap/GCPtr.h>
#include <LibGC/Ptr.h>
#include <LibWeb/Layout/ImageProvider.h>
#include <LibWeb/SVG/SVGAnimatedLength.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>
@ -22,10 +22,10 @@ class SVGImageElement
public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
JS::NonnullGCPtr<SVG::SVGAnimatedLength> x();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> width();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> height();
GC::Ref<SVG::SVGAnimatedLength> x();
GC::Ref<SVG::SVGAnimatedLength> y();
GC::Ref<SVG::SVGAnimatedLength> width();
GC::Ref<SVG::SVGAnimatedLength> height();
Gfx::Rect<CSSPixels> bounding_box() const;
@ -36,7 +36,7 @@ public:
virtual Optional<CSSPixelFraction> intrinsic_aspect_ratio() const override;
virtual RefPtr<Gfx::ImmutableBitmap> current_image_bitmap(Gfx::IntSize = {}) const override;
virtual void set_visible_in_viewport(bool) override { }
virtual JS::NonnullGCPtr<DOM::Element const> to_html_element() const override { return *this; }
virtual GC::Ref<DOM::Element const> to_html_element() const override { return *this; }
protected:
SVGImageElement(DOM::Document&, DOM::QualifiedName);
@ -48,13 +48,13 @@ protected:
void fetch_the_document(URL::URL const& url);
private:
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
void animate();
JS::GCPtr<SVG::SVGAnimatedLength> m_x;
JS::GCPtr<SVG::SVGAnimatedLength> m_y;
JS::GCPtr<SVG::SVGAnimatedLength> m_width;
JS::GCPtr<SVG::SVGAnimatedLength> m_height;
GC::Ptr<SVG::SVGAnimatedLength> m_x;
GC::Ptr<SVG::SVGAnimatedLength> m_y;
GC::Ptr<SVG::SVGAnimatedLength> m_width;
GC::Ptr<SVG::SVGAnimatedLength> m_height;
RefPtr<Core::Timer> m_animation_timer;
size_t m_current_frame_index { 0 };
@ -62,7 +62,7 @@ private:
URL::URL m_href;
JS::GCPtr<HTML::SharedResourceRequest> m_resource_request;
GC::Ptr<HTML::SharedResourceRequest> m_resource_request;
Optional<DOM::DocumentLoadEventDelayer> m_load_event_delayer;
};

View file

@ -11,14 +11,14 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGLength);
GC_DEFINE_ALLOCATOR(SVGLength);
JS::NonnullGCPtr<SVGLength> SVGLength::create(JS::Realm& realm, u8 unit_type, float value)
GC::Ref<SVGLength> SVGLength::create(JS::Realm& realm, u8 unit_type, float value)
{
return realm.create<SVGLength>(realm, unit_type, value);
}
JS::NonnullGCPtr<SVGLength> SVGLength::from_length_percentage(JS::Realm& realm, CSS::LengthPercentage const& length_percentage)
GC::Ref<SVGLength> SVGLength::from_length_percentage(JS::Realm& realm, CSS::LengthPercentage const& length_percentage)
{
// FIXME: We can't tell if a CSS::LengthPercentage was a unitless length.
(void)SVG_LENGTHTYPE_NUMBER;

View file

@ -14,7 +14,7 @@ namespace Web::SVG {
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength
class SVGLength : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGLength);
GC_DECLARE_ALLOCATOR(SVGLength);
public:
// Same as SVGLength.idl
@ -30,7 +30,7 @@ public:
static constexpr unsigned short SVG_LENGTHTYPE_PT = 9;
static constexpr unsigned short SVG_LENGTHTYPE_PC = 10;
[[nodiscard]] static JS::NonnullGCPtr<SVGLength> create(JS::Realm&, u8 unit_type, float value);
[[nodiscard]] static GC::Ref<SVGLength> create(JS::Realm&, u8 unit_type, float value);
virtual ~SVGLength() override;
u8 unit_type() const { return m_unit_type; }
@ -38,7 +38,7 @@ public:
float value() const { return m_value; }
WebIDL::ExceptionOr<void> set_value(float value);
[[nodiscard]] static JS::NonnullGCPtr<SVGLength> from_length_percentage(JS::Realm&, CSS::LengthPercentage const&);
[[nodiscard]] static GC::Ref<SVGLength> from_length_percentage(JS::Realm&, CSS::LengthPercentage const&);
private:
SVGLength(JS::Realm&, u8 unit_type, float value);

View file

@ -13,7 +13,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGLineElement);
GC_DEFINE_ALLOCATOR(SVGLineElement);
SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGeometryElement(document, qualified_name)
@ -62,7 +62,7 @@ Gfx::Path SVGLineElement::get_path(CSSPixelSize viewport_size)
}
// https://www.w3.org/TR/SVG11/shapes.html#LineElementX1Attribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::x1() const
GC::Ref<SVGAnimatedLength> SVGLineElement::x1() const
{
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
// FIXME: Create a proper animated value when animations are supported.
@ -72,7 +72,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::x1() const
}
// https://www.w3.org/TR/SVG11/shapes.html#LineElementY1Attribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::y1() const
GC::Ref<SVGAnimatedLength> SVGLineElement::y1() const
{
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
// FIXME: Create a proper animated value when animations are supported.
@ -82,7 +82,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::y1() const
}
// https://www.w3.org/TR/SVG11/shapes.html#LineElementX2Attribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::x2() const
GC::Ref<SVGAnimatedLength> SVGLineElement::x2() const
{
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
// FIXME: Create a proper animated value when animations are supported.
@ -92,7 +92,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::x2() const
}
// https://www.w3.org/TR/SVG11/shapes.html#LineElementY2Attribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::y2() const
GC::Ref<SVGAnimatedLength> SVGLineElement::y2() const
{
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
// FIXME: Create a proper animated value when animations are supported.

View file

@ -13,7 +13,7 @@ namespace Web::SVG {
class SVGLineElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGLineElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGLineElement);
GC_DECLARE_ALLOCATOR(SVGLineElement);
public:
virtual ~SVGLineElement() override = default;
@ -22,10 +22,10 @@ public:
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> x1() const;
JS::NonnullGCPtr<SVGAnimatedLength> y1() const;
JS::NonnullGCPtr<SVGAnimatedLength> x2() const;
JS::NonnullGCPtr<SVGAnimatedLength> y2() const;
GC::Ref<SVGAnimatedLength> x1() const;
GC::Ref<SVGAnimatedLength> y1() const;
GC::Ref<SVGAnimatedLength> x2() const;
GC::Ref<SVGAnimatedLength> y2() const;
private:
SVGLineElement(DOM::Document&, DOM::QualifiedName);

View file

@ -15,7 +15,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGLinearGradientElement);
GC_DEFINE_ALLOCATOR(SVGLinearGradientElement);
SVGLinearGradientElement::SVGLinearGradientElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGradientElement(document, qualified_name)
@ -159,25 +159,25 @@ Optional<Painting::PaintStyle> SVGLinearGradientElement::to_gfx_paint_style(SVGP
return *m_paint_style;
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::x1() const
GC::Ref<SVGAnimatedLength> SVGLinearGradientElement::x1() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::y1() const
GC::Ref<SVGAnimatedLength> SVGLinearGradientElement::y1() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::x2() const
GC::Ref<SVGAnimatedLength> SVGLinearGradientElement::x2() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::y2() const
GC::Ref<SVGAnimatedLength> SVGLinearGradientElement::y2() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));

View file

@ -14,7 +14,7 @@ namespace Web::SVG {
class SVGLinearGradientElement : public SVGGradientElement {
WEB_PLATFORM_OBJECT(SVGLinearGradientElement, SVGGradientElement);
JS_DECLARE_ALLOCATOR(SVGLinearGradientElement);
GC_DECLARE_ALLOCATOR(SVGLinearGradientElement);
public:
virtual ~SVGLinearGradientElement() override = default;
@ -23,10 +23,10 @@ public:
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
JS::NonnullGCPtr<SVGAnimatedLength> x1() const;
JS::NonnullGCPtr<SVGAnimatedLength> y1() const;
JS::NonnullGCPtr<SVGAnimatedLength> x2() const;
JS::NonnullGCPtr<SVGAnimatedLength> y2() const;
GC::Ref<SVGAnimatedLength> x1() const;
GC::Ref<SVGAnimatedLength> y1() const;
GC::Ref<SVGAnimatedLength> x2() const;
GC::Ref<SVGAnimatedLength> y2() const;
protected:
SVGLinearGradientElement(DOM::Document&, DOM::QualifiedName);
@ -34,7 +34,7 @@ protected:
virtual void initialize(JS::Realm&) override;
private:
JS::GCPtr<SVGLinearGradientElement const> linked_linear_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
GC::Ptr<SVGLinearGradientElement const> linked_linear_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
{
if (auto gradient = linked_gradient(seen_gradients); gradient && is<SVGLinearGradientElement>(*gradient))
return &verify_cast<SVGLinearGradientElement>(*gradient);

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGMaskElement);
GC_DEFINE_ALLOCATOR(SVGMaskElement);
SVGMaskElement::SVGMaskElement(DOM::Document& document, DOM::QualifiedName tag_name)
: SVGGraphicsElement(document, move(tag_name))
@ -27,7 +27,7 @@ void SVGMaskElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGMaskElement);
}
JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(CSS::StyleProperties)
GC::Ptr<Layout::Node> SVGMaskElement::create_layout_node(CSS::StyleProperties)
{
// Masks are handled as a special case in the TreeBuilder.
return nullptr;

View file

@ -16,7 +16,7 @@ class SVGMaskElement final : public SVGGraphicsElement
, public SVGViewport {
WEB_PLATFORM_OBJECT(SVGMaskElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGMaskElement);
GC_DECLARE_ALLOCATOR(SVGMaskElement);
public:
virtual ~SVGMaskElement() override;
@ -38,7 +38,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
CSSPixelRect resolve_masking_area(CSSPixelRect const& mask_target) const;

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGMetadataElement);
GC_DEFINE_ALLOCATOR(SVGMetadataElement);
SVGMetadataElement::SVGMetadataElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))
@ -25,7 +25,7 @@ void SVGMetadataElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGMetadataElement);
}
JS::GCPtr<Layout::Node> SVGMetadataElement::create_layout_node(CSS::StyleProperties)
GC::Ptr<Layout::Node> SVGMetadataElement::create_layout_node(CSS::StyleProperties)
{
return nullptr;
}

View file

@ -13,14 +13,14 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/struct.html#InterfaceSVGMetadataElement
class SVGMetadataElement final : public SVGElement {
WEB_PLATFORM_OBJECT(SVGMetadataElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGMetadataElement);
GC_DECLARE_ALLOCATOR(SVGMetadataElement);
private:
SVGMetadataElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
};
}

View file

@ -16,7 +16,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGPathElement);
GC_DEFINE_ALLOCATOR(SVGPathElement);
[[maybe_unused]] static void print_instruction(PathInstruction const& instruction)
{

View file

@ -15,7 +15,7 @@ namespace Web::SVG {
class SVGPathElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGPathElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGPathElement);
GC_DECLARE_ALLOCATOR(SVGPathElement);
public:
virtual ~SVGPathElement() override = default;

View file

@ -13,7 +13,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGPolygonElement);
GC_DEFINE_ALLOCATOR(SVGPolygonElement);
SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGeometryElement(document, qualified_name)

View file

@ -12,7 +12,7 @@ namespace Web::SVG {
class SVGPolygonElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGPolygonElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGPolygonElement);
GC_DECLARE_ALLOCATOR(SVGPolygonElement);
public:
virtual ~SVGPolygonElement() override = default;

View file

@ -13,7 +13,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGPolylineElement);
GC_DEFINE_ALLOCATOR(SVGPolylineElement);
SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGeometryElement(document, qualified_name)

View file

@ -12,7 +12,7 @@ namespace Web::SVG {
class SVGPolylineElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGPolylineElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGPolylineElement);
GC_DECLARE_ALLOCATOR(SVGPolylineElement);
public:
virtual ~SVGPolylineElement() override = default;

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGRadialGradientElement);
GC_DEFINE_ALLOCATOR(SVGRadialGradientElement);
SVGRadialGradientElement::SVGRadialGradientElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGradientElement(document, qualified_name)
@ -215,37 +215,37 @@ Optional<Painting::PaintStyle> SVGRadialGradientElement::to_gfx_paint_style(SVGP
return *m_paint_style;
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::cx() const
GC::Ref<SVGAnimatedLength> SVGRadialGradientElement::cx() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::cy() const
GC::Ref<SVGAnimatedLength> SVGRadialGradientElement::cy() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::fx() const
GC::Ref<SVGAnimatedLength> SVGRadialGradientElement::fx() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::fy() const
GC::Ref<SVGAnimatedLength> SVGRadialGradientElement::fy() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::fr() const
GC::Ref<SVGAnimatedLength> SVGRadialGradientElement::fr() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::r() const
GC::Ref<SVGAnimatedLength> SVGRadialGradientElement::r() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));

View file

@ -14,7 +14,7 @@ namespace Web::SVG {
class SVGRadialGradientElement : public SVGGradientElement {
WEB_PLATFORM_OBJECT(SVGRadialGradientElement, SVGGradientElement);
JS_DECLARE_ALLOCATOR(SVGRadialGradientElement);
GC_DECLARE_ALLOCATOR(SVGRadialGradientElement);
public:
virtual ~SVGRadialGradientElement() override = default;
@ -23,12 +23,12 @@ public:
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
JS::NonnullGCPtr<SVGAnimatedLength> cx() const;
JS::NonnullGCPtr<SVGAnimatedLength> cy() const;
JS::NonnullGCPtr<SVGAnimatedLength> fx() const;
JS::NonnullGCPtr<SVGAnimatedLength> fy() const;
JS::NonnullGCPtr<SVGAnimatedLength> fr() const;
JS::NonnullGCPtr<SVGAnimatedLength> r() const;
GC::Ref<SVGAnimatedLength> cx() const;
GC::Ref<SVGAnimatedLength> cy() const;
GC::Ref<SVGAnimatedLength> fx() const;
GC::Ref<SVGAnimatedLength> fy() const;
GC::Ref<SVGAnimatedLength> fr() const;
GC::Ref<SVGAnimatedLength> r() const;
protected:
SVGRadialGradientElement(DOM::Document&, DOM::QualifiedName);
@ -36,7 +36,7 @@ protected:
virtual void initialize(JS::Realm&) override;
private:
JS::GCPtr<SVGRadialGradientElement const> linked_radial_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
GC::Ptr<SVGRadialGradientElement const> linked_radial_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
{
if (auto gradient = linked_gradient(seen_gradients); gradient && is<SVGRadialGradientElement>(*gradient))
return &verify_cast<SVGRadialGradientElement>(*gradient);

View file

@ -15,7 +15,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGRectElement);
GC_DEFINE_ALLOCATOR(SVGRectElement);
SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGeometryElement(document, qualified_name)
@ -154,7 +154,7 @@ Gfx::FloatSize SVGRectElement::calculate_used_corner_radius_values() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementXAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::x() const
GC::Ref<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.
@ -164,7 +164,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::x() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementYAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::y() const
GC::Ref<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.
@ -174,7 +174,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::y() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementWidthAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::width() const
GC::Ref<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.
@ -184,7 +184,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::width() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementHeightAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::height() const
GC::Ref<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.
@ -194,7 +194,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::height() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementRXAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::rx() const
GC::Ref<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.
@ -204,7 +204,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::rx() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementRYAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::ry() const
GC::Ref<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.

View file

@ -13,7 +13,7 @@ namespace Web::SVG {
// https://www.w3.org/TR/SVG11/shapes.html#RectElement
class SVGRectElement final : public SVGGeometryElement {
WEB_PLATFORM_OBJECT(SVGRectElement, SVGGeometryElement);
JS_DECLARE_ALLOCATOR(SVGRectElement);
GC_DECLARE_ALLOCATOR(SVGRectElement);
public:
virtual ~SVGRectElement() override = default;
@ -22,12 +22,12 @@ public:
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> x() const;
JS::NonnullGCPtr<SVGAnimatedLength> y() const;
JS::NonnullGCPtr<SVGAnimatedLength> width() const;
JS::NonnullGCPtr<SVGAnimatedLength> height() const;
JS::NonnullGCPtr<SVGAnimatedLength> rx() const;
JS::NonnullGCPtr<SVGAnimatedLength> ry() const;
GC::Ref<SVGAnimatedLength> x() const;
GC::Ref<SVGAnimatedLength> y() const;
GC::Ref<SVGAnimatedLength> width() const;
GC::Ref<SVGAnimatedLength> height() const;
GC::Ref<SVGAnimatedLength> rx() const;
GC::Ref<SVGAnimatedLength> ry() const;
private:
SVGRectElement(DOM::Document&, DOM::QualifiedName);

View file

@ -22,7 +22,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGSVGElement);
GC_DEFINE_ALLOCATOR(SVGSVGElement);
SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, qualified_name)
@ -42,7 +42,7 @@ void SVGSVGElement::visit_edges(Visitor& visitor)
visitor.visit(m_view_box_for_bindings);
}
JS::GCPtr<Layout::Node> SVGSVGElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGSVGElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGSVGBox>(document(), *this, move(style));
}
@ -169,22 +169,22 @@ Optional<ViewBox> SVGSVGElement::view_box() const
return {};
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGSVGElement::x() const
GC::Ref<SVGAnimatedLength> SVGSVGElement::x() const
{
return svg_animated_length_for_property(CSS::PropertyID::X);
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGSVGElement::y() const
GC::Ref<SVGAnimatedLength> SVGSVGElement::y() const
{
return svg_animated_length_for_property(CSS::PropertyID::Y);
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGSVGElement::width() const
GC::Ref<SVGAnimatedLength> SVGSVGElement::width() const
{
return svg_animated_length_for_property(CSS::PropertyID::Width);
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGSVGElement::height() const
GC::Ref<SVGAnimatedLength> SVGSVGElement::height() const
{
return svg_animated_length_for_property(CSS::PropertyID::Height);
}
@ -200,31 +200,31 @@ void SVGSVGElement::set_current_scale(float)
dbgln("(STUBBED) SVGSVGElement::set_current_scale(). Called on: {}", debug_description());
}
JS::NonnullGCPtr<Geometry::DOMPointReadOnly> SVGSVGElement::current_translate() const
GC::Ref<Geometry::DOMPointReadOnly> SVGSVGElement::current_translate() const
{
dbgln("(STUBBED) SVGSVGElement::current_translate(). Called on: {}", debug_description());
return Geometry::DOMPointReadOnly::create(realm());
}
JS::NonnullGCPtr<DOM::NodeList> SVGSVGElement::get_intersection_list(JS::NonnullGCPtr<Geometry::DOMRectReadOnly>, JS::GCPtr<SVGElement>) const
GC::Ref<DOM::NodeList> SVGSVGElement::get_intersection_list(GC::Ref<Geometry::DOMRectReadOnly>, GC::Ptr<SVGElement>) const
{
dbgln("(STUBBED) SVGSVGElement::get_intersection_list(). Called on: {}", debug_description());
return DOM::StaticNodeList::create(realm(), {});
}
JS::NonnullGCPtr<DOM::NodeList> SVGSVGElement::get_enclosure_list(JS::NonnullGCPtr<Geometry::DOMRectReadOnly>, JS::GCPtr<SVGElement>) const
GC::Ref<DOM::NodeList> SVGSVGElement::get_enclosure_list(GC::Ref<Geometry::DOMRectReadOnly>, GC::Ptr<SVGElement>) const
{
dbgln("(STUBBED) SVGSVGElement::get_enclosure_list(). Called on: {}", debug_description());
return DOM::StaticNodeList::create(realm(), {});
}
bool SVGSVGElement::check_intersection(JS::NonnullGCPtr<SVGElement>, JS::NonnullGCPtr<Geometry::DOMRectReadOnly>) const
bool SVGSVGElement::check_intersection(GC::Ref<SVGElement>, GC::Ref<Geometry::DOMRectReadOnly>) const
{
dbgln("(STUBBED) SVGSVGElement::check_intersection(). Called on: {}", debug_description());
return false;
}
bool SVGSVGElement::check_enclosure(JS::NonnullGCPtr<SVGElement>, JS::NonnullGCPtr<Geometry::DOMRectReadOnly>) const
bool SVGSVGElement::check_enclosure(GC::Ref<SVGElement>, GC::Ref<Geometry::DOMRectReadOnly>) const
{
dbgln("(STUBBED) SVGSVGElement::check_enclosure(). Called on: {}", debug_description());
return false;
@ -237,31 +237,31 @@ void SVGSVGElement::deselect_all() const
selection->remove_all_ranges();
}
JS::NonnullGCPtr<SVGLength> SVGSVGElement::create_svg_length() const
GC::Ref<SVGLength> SVGSVGElement::create_svg_length() const
{
// A new, detached SVGLength object whose value is the unitless <number> 0.
return SVGLength::create(realm(), SVGLength::SVG_LENGTHTYPE_NUMBER, 0);
}
JS::NonnullGCPtr<Geometry::DOMPoint> SVGSVGElement::create_svg_point() const
GC::Ref<Geometry::DOMPoint> SVGSVGElement::create_svg_point() const
{
// A new, detached DOMPoint object whose coordinates are all 0.
return Geometry::DOMPoint::from_point(vm(), Geometry::DOMPointInit {});
}
JS::NonnullGCPtr<Geometry::DOMMatrix> SVGSVGElement::create_svg_matrix() const
GC::Ref<Geometry::DOMMatrix> SVGSVGElement::create_svg_matrix() const
{
// A new, detached DOMMatrix object representing the identity matrix.
return Geometry::DOMMatrix::create(realm());
}
JS::NonnullGCPtr<Geometry::DOMRect> SVGSVGElement::create_svg_rect() const
GC::Ref<Geometry::DOMRect> SVGSVGElement::create_svg_rect() const
{
// A new, DOMRect object whose x, y, width and height are all 0.
return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0).release_value_but_fixme_should_propagate_errors();
}
JS::NonnullGCPtr<SVGTransform> SVGSVGElement::create_svg_transform() const
GC::Ref<SVGTransform> SVGSVGElement::create_svg_transform() const
{
return SVGTransform::create(realm());
}

View file

@ -26,10 +26,10 @@ class SVGSVGElement final : public SVGGraphicsElement
// SVGSVGElement is not strictly a NonElementParentNode, but it implements the same get_element_by_id() method.
, public DOM::NonElementParentNode<SVGSVGElement> {
WEB_PLATFORM_OBJECT(SVGSVGElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGSVGElement);
GC_DECLARE_ALLOCATOR(SVGSVGElement);
public:
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
@ -41,30 +41,30 @@ public:
void set_fallback_view_box_for_svg_as_image(Optional<ViewBox>);
JS::NonnullGCPtr<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
GC::Ref<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
JS::NonnullGCPtr<SVGAnimatedLength> x() const;
JS::NonnullGCPtr<SVGAnimatedLength> y() const;
JS::NonnullGCPtr<SVGAnimatedLength> width() const;
JS::NonnullGCPtr<SVGAnimatedLength> height() const;
GC::Ref<SVGAnimatedLength> x() const;
GC::Ref<SVGAnimatedLength> y() const;
GC::Ref<SVGAnimatedLength> width() const;
GC::Ref<SVGAnimatedLength> height() const;
float current_scale() const;
void set_current_scale(float);
JS::NonnullGCPtr<Geometry::DOMPointReadOnly> current_translate() const;
GC::Ref<Geometry::DOMPointReadOnly> current_translate() const;
JS::NonnullGCPtr<DOM::NodeList> get_intersection_list(JS::NonnullGCPtr<Geometry::DOMRectReadOnly> rect, JS::GCPtr<SVGElement> reference_element) const;
JS::NonnullGCPtr<DOM::NodeList> get_enclosure_list(JS::NonnullGCPtr<Geometry::DOMRectReadOnly> rect, JS::GCPtr<SVGElement> reference_element) const;
bool check_intersection(JS::NonnullGCPtr<SVGElement> element, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> rect) const;
bool check_enclosure(JS::NonnullGCPtr<SVGElement> element, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> rect) const;
GC::Ref<DOM::NodeList> get_intersection_list(GC::Ref<Geometry::DOMRectReadOnly> rect, GC::Ptr<SVGElement> reference_element) const;
GC::Ref<DOM::NodeList> get_enclosure_list(GC::Ref<Geometry::DOMRectReadOnly> rect, GC::Ptr<SVGElement> reference_element) const;
bool check_intersection(GC::Ref<SVGElement> element, GC::Ref<Geometry::DOMRectReadOnly> rect) const;
bool check_enclosure(GC::Ref<SVGElement> element, GC::Ref<Geometry::DOMRectReadOnly> rect) const;
void deselect_all() const;
JS::NonnullGCPtr<SVGLength> create_svg_length() const;
JS::NonnullGCPtr<Geometry::DOMPoint> create_svg_point() const;
JS::NonnullGCPtr<Geometry::DOMMatrix> create_svg_matrix() const;
JS::NonnullGCPtr<Geometry::DOMRect> create_svg_rect() const;
JS::NonnullGCPtr<SVGTransform> create_svg_transform() const;
GC::Ref<SVGLength> create_svg_length() const;
GC::Ref<Geometry::DOMPoint> create_svg_point() const;
GC::Ref<Geometry::DOMMatrix> create_svg_matrix() const;
GC::Ref<Geometry::DOMRect> create_svg_rect() const;
GC::Ref<SVGTransform> create_svg_transform() const;
// Deprecated methods that have no effect when called, but which are kept for compatibility reasons.
WebIDL::UnsignedLong suspend_redraw(WebIDL::UnsignedLong max_wait_milliseconds) const
@ -100,7 +100,7 @@ private:
Optional<ViewBox> m_fallback_view_box_for_svg_as_image;
JS::GCPtr<SVGAnimatedRect> m_view_box_for_bindings;
GC::Ptr<SVGAnimatedRect> m_view_box_for_bindings;
};
}

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGScriptElement);
GC_DEFINE_ALLOCATOR(SVGScriptElement);
SVGScriptElement::SVGScriptElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))
@ -61,7 +61,7 @@ void SVGScriptElement::process_the_script_element()
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#read-html
// Before any script execution occurs, the user agent must wait for scripts may run for the newly-created document to be true for document.
if (!m_document->ready_to_run_scripts())
HTML::main_thread_event_loop().spin_until(JS::create_heap_function(heap(), [&] { return m_document->ready_to_run_scripts(); }));
HTML::main_thread_event_loop().spin_until(GC::create_function(heap(), [&] { return m_document->ready_to_run_scripts(); }));
// FIXME: Support non-inline scripts.
auto base_url = document().base_url();

View file

@ -16,7 +16,7 @@ class SVGScriptElement
: public SVGElement
, public SVGURIReferenceMixin<SupportsXLinkHref::Yes> {
WEB_PLATFORM_OBJECT(SVGScriptElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGScriptElement);
GC_DECLARE_ALLOCATOR(SVGScriptElement);
public:
void process_the_script_element();
@ -35,7 +35,7 @@ private:
bool m_already_processed { false };
JS::GCPtr<HTML::ClassicScript> m_script;
GC::Ptr<HTML::ClassicScript> m_script;
size_t m_source_line_number { 1 };
};

View file

@ -14,7 +14,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGStopElement);
GC_DEFINE_ALLOCATOR(SVGStopElement);
SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, qualified_name)
@ -61,7 +61,7 @@ float SVGStopElement::stop_opacity() const
return 1;
}
JS::NonnullGCPtr<SVGAnimatedNumber> SVGStopElement::offset() const
GC::Ref<SVGAnimatedNumber> SVGStopElement::offset() const
{
// FIXME: Implement this properly.
return SVGAnimatedNumber::create(realm(), 0, 0);

View file

@ -16,14 +16,14 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/pservers.html#GradientStops
class SVGStopElement final : public SVGElement {
WEB_PLATFORM_OBJECT(SVGStopElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGStopElement);
GC_DECLARE_ALLOCATOR(SVGStopElement);
public:
virtual ~SVGStopElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
JS::NonnullGCPtr<SVGAnimatedNumber> offset() const;
GC::Ref<SVGAnimatedNumber> offset() const;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;

View file

@ -9,7 +9,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGStyleElement);
GC_DEFINE_ALLOCATOR(SVGStyleElement);
SVGStyleElement::SVGStyleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))

View file

@ -13,7 +13,7 @@ namespace Web::SVG {
class SVGStyleElement final : public SVGElement {
WEB_PLATFORM_OBJECT(SVGStyleElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGStyleElement);
GC_DECLARE_ALLOCATOR(SVGStyleElement);
public:
virtual ~SVGStyleElement() override;

View file

@ -19,7 +19,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGSymbolElement);
GC_DEFINE_ALLOCATOR(SVGSymbolElement);
SVGSymbolElement::SVGSymbolElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, qualified_name)
@ -75,7 +75,7 @@ bool SVGSymbolElement::is_direct_child_of_use_shadow_tree() const
return is<SVGUseElement>(host);
}
JS::GCPtr<Layout::Node> SVGSymbolElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGSymbolElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGGraphicsBox>(document(), *this, move(style));
}

View file

@ -14,7 +14,7 @@ namespace Web::SVG {
class SVGSymbolElement final : public SVGGraphicsElement
, public SVGViewport {
WEB_PLATFORM_OBJECT(SVGSymbolElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGSymbolElement);
GC_DECLARE_ALLOCATOR(SVGSymbolElement);
public:
virtual ~SVGSymbolElement() override = default;
@ -28,7 +28,7 @@ public:
return {};
}
JS::NonnullGCPtr<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
GC::Ref<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
private:
SVGSymbolElement(DOM::Document&, DOM::QualifiedName);
@ -36,7 +36,7 @@ private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
bool is_direct_child_of_use_shadow_tree() const;
@ -44,7 +44,7 @@ private:
Optional<ViewBox> m_view_box;
JS::GCPtr<SVGAnimatedRect> m_view_box_for_bindings;
GC::Ptr<SVGAnimatedRect> m_view_box_for_bindings;
};
}

View file

@ -11,7 +11,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTSpanElement);
GC_DEFINE_ALLOCATOR(SVGTSpanElement);
SVGTSpanElement::SVGTSpanElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGTextPositioningElement(document, move(qualified_name))
@ -24,7 +24,7 @@ void SVGTSpanElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTSpanElement);
}
JS::GCPtr<Layout::Node> SVGTSpanElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGTSpanElement::create_layout_node(CSS::StyleProperties style)
{
// Text must be within an SVG <text> element.
if (shadow_including_first_ancestor_of_type<SVGTextElement>())

View file

@ -14,10 +14,10 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/text.html#InterfaceSVGTSpanElement
class SVGTSpanElement : public SVGTextPositioningElement {
WEB_PLATFORM_OBJECT(SVGTSpanElement, SVGTextPositioningElement);
JS_DECLARE_ALLOCATOR(SVGTSpanElement);
GC_DECLARE_ALLOCATOR(SVGTSpanElement);
public:
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
protected:
SVGTSpanElement(DOM::Document&, DOM::QualifiedName);

View file

@ -58,7 +58,7 @@ WebIDL::ExceptionOr<WebIDL::Long> SVGTextContentElement::get_number_of_chars() c
return static_cast<WebIDL::Long>(chars.size());
}
JS::NonnullGCPtr<Geometry::DOMPoint> SVGTextContentElement::get_start_position_of_char(WebIDL::UnsignedLong charnum)
GC::Ref<Geometry::DOMPoint> SVGTextContentElement::get_start_position_of_char(WebIDL::UnsignedLong charnum)
{
dbgln("(STUBBED) SVGTextContentElement::get_start_position_of_char(charnum={}). Called on: {}", charnum, debug_description());
return Geometry::DOMPoint::from_point(vm(), Geometry::DOMPointInit {});

View file

@ -25,7 +25,7 @@ public:
ByteString text_contents() const;
JS::NonnullGCPtr<Geometry::DOMPoint> get_start_position_of_char(WebIDL::UnsignedLong charnum);
GC::Ref<Geometry::DOMPoint> get_start_position_of_char(WebIDL::UnsignedLong charnum);
protected:
SVGTextContentElement(DOM::Document&, DOM::QualifiedName);

View file

@ -10,7 +10,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTextElement);
GC_DEFINE_ALLOCATOR(SVGTextElement);
SVGTextElement::SVGTextElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGTextPositioningElement(document, move(qualified_name))
@ -23,7 +23,7 @@ void SVGTextElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextElement);
}
JS::GCPtr<Layout::Node> SVGTextElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGTextElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGTextBox>(document(), *this, move(style));
}

View file

@ -14,10 +14,10 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/text.html#InterfaceSVGTextElement
class SVGTextElement : public SVGTextPositioningElement {
WEB_PLATFORM_OBJECT(SVGTextElement, SVGTextPositioningElement);
JS_DECLARE_ALLOCATOR(SVGTextElement);
GC_DECLARE_ALLOCATOR(SVGTextElement);
public:
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
protected:
SVGTextElement(DOM::Document&, DOM::QualifiedName);

View file

@ -12,14 +12,14 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTextPathElement);
GC_DEFINE_ALLOCATOR(SVGTextPathElement);
SVGTextPathElement::SVGTextPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGTextContentElement(document, move(qualified_name))
{
}
JS::GCPtr<SVGGeometryElement const> SVGTextPathElement::path_or_shape() const
GC::Ptr<SVGGeometryElement const> SVGTextPathElement::path_or_shape() const
{
auto href = get_attribute(AttributeNames::href);
if (!href.has_value())
@ -40,7 +40,7 @@ void SVGTextPathElement::visit_edges(Cell::Visitor& visitor)
SVGURIReferenceMixin::visit_edges(visitor);
}
JS::GCPtr<Layout::Node> SVGTextPathElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGTextPathElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGTextPathBox>(document(), *this, move(style));
}

View file

@ -17,12 +17,12 @@ class SVGTextPathElement
: public SVGTextContentElement
, public SVGURIReferenceMixin<SupportsXLinkHref::Yes> {
WEB_PLATFORM_OBJECT(SVGTextPathElement, SVGTextContentElement);
JS_DECLARE_ALLOCATOR(SVGTextPathElement);
GC_DECLARE_ALLOCATOR(SVGTextPathElement);
public:
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
JS::GCPtr<SVGGeometryElement const> path_or_shape() const;
GC::Ptr<SVGGeometryElement const> path_or_shape() const;
protected:
SVGTextPathElement(DOM::Document&, DOM::QualifiedName);

View file

@ -20,10 +20,10 @@ public:
Gfx::FloatPoint get_offset(CSSPixelSize const& viewport_size) const;
JS::NonnullGCPtr<SVGAnimatedLength> x() const;
JS::NonnullGCPtr<SVGAnimatedLength> y() const;
JS::NonnullGCPtr<SVGAnimatedLength> dx() const;
JS::NonnullGCPtr<SVGAnimatedLength> dy() const;
GC::Ref<SVGAnimatedLength> x() const;
GC::Ref<SVGAnimatedLength> y() const;
GC::Ref<SVGAnimatedLength> dx() const;
GC::Ref<SVGAnimatedLength> dy() const;
protected:
SVGTextPositioningElement(DOM::Document&, DOM::QualifiedName);

View file

@ -12,7 +12,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTitleElement);
GC_DEFINE_ALLOCATOR(SVGTitleElement);
SVGTitleElement::SVGTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))
@ -25,7 +25,7 @@ void SVGTitleElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTitleElement);
}
JS::GCPtr<Layout::Node> SVGTitleElement::create_layout_node(CSS::StyleProperties)
GC::Ptr<Layout::Node> SVGTitleElement::create_layout_node(CSS::StyleProperties)
{
return nullptr;
}

View file

@ -12,14 +12,14 @@ namespace Web::SVG {
class SVGTitleElement final : public SVGElement {
WEB_PLATFORM_OBJECT(SVGTitleElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGTitleElement);
GC_DECLARE_ALLOCATOR(SVGTitleElement);
private:
SVGTitleElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual void children_changed() override;
};

View file

@ -11,9 +11,9 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTransform);
GC_DEFINE_ALLOCATOR(SVGTransform);
JS::NonnullGCPtr<SVGTransform> SVGTransform::create(JS::Realm& realm)
GC::Ref<SVGTransform> SVGTransform::create(JS::Realm& realm)
{
return realm.create<SVGTransform>(realm);
}

View file

@ -15,10 +15,10 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/single-page.html#coords-InterfaceSVGTransform
class SVGTransform final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGTransform, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGTransform);
GC_DECLARE_ALLOCATOR(SVGTransform);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGTransform> create(JS::Realm& realm);
[[nodiscard]] static GC::Ref<SVGTransform> create(JS::Realm& realm);
virtual ~SVGTransform() override;
enum class Type : u16 {

View file

@ -11,9 +11,9 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGTransformList);
GC_DEFINE_ALLOCATOR(SVGTransformList);
JS::NonnullGCPtr<SVGTransformList> SVGTransformList::create(JS::Realm& realm)
GC::Ref<SVGTransformList> SVGTransformList::create(JS::Realm& realm)
{
return realm.create<SVGTransformList>(realm);
}
@ -40,7 +40,7 @@ WebIDL::UnsignedLong SVGTransformList::number_of_items()
}
// https://svgwg.org/svg2-draft/single-page.html#types-__svg__SVGNameList__getItem
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGTransform>> SVGTransformList::get_item(WebIDL::UnsignedLong index)
WebIDL::ExceptionOr<GC::Ref<SVGTransform>> SVGTransformList::get_item(WebIDL::UnsignedLong index)
{
// 1. If index is greater than or equal to the length of the list, then throw an IndexSizeError.
if (index >= m_transforms.size())
@ -50,7 +50,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGTransform>> SVGTransformList::get_item(W
}
// https://svgwg.org/svg2-draft/single-page.html#types-__svg__SVGNameList__appendItem
JS::NonnullGCPtr<SVGTransform> SVGTransformList::append_item(JS::NonnullGCPtr<SVGTransform> new_item)
GC::Ref<SVGTransform> SVGTransformList::append_item(GC::Ref<SVGTransform> new_item)
{
// FIXME: This does not implement the steps from the specification.
m_transforms.append(new_item);

View file

@ -16,18 +16,18 @@ namespace Web::SVG {
// https://svgwg.org/svg2-draft/single-page.html#coords-InterfaceSVGTransformList
class SVGTransformList final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGTransformList, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGTransformList);
GC_DECLARE_ALLOCATOR(SVGTransformList);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGTransformList> create(JS::Realm& realm);
[[nodiscard]] static GC::Ref<SVGTransformList> create(JS::Realm& realm);
virtual ~SVGTransformList() override;
WebIDL::UnsignedLong length();
WebIDL::UnsignedLong number_of_items();
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGTransform>> get_item(WebIDL::UnsignedLong index);
WebIDL::ExceptionOr<GC::Ref<SVGTransform>> get_item(WebIDL::UnsignedLong index);
JS::NonnullGCPtr<SVGTransform> append_item(JS::NonnullGCPtr<SVGTransform> new_item);
GC::Ref<SVGTransform> append_item(GC::Ref<SVGTransform> new_item);
private:
SVGTransformList(JS::Realm& realm);
@ -35,7 +35,7 @@ private:
virtual void initialize(JS::Realm& realm) override;
virtual void visit_edges(Cell::Visitor& visitor) override;
Vector<JS::NonnullGCPtr<SVGTransform>> m_transforms;
Vector<GC::Ref<SVGTransform>> m_transforms;
};
}

View file

@ -22,7 +22,7 @@ class SVGURIReferenceMixin {
public:
virtual ~SVGURIReferenceMixin() = default;
JS::NonnullGCPtr<SVGAnimatedString> href()
GC::Ref<SVGAnimatedString> href()
{
// The href IDL attribute represents the value of the href attribute, and, on elements that are defined to support
// it, the deprecated xlink:href attribute. On getting href, an SVGAnimatedString object is returned that:
@ -44,7 +44,7 @@ protected:
}
private:
JS::GCPtr<SVGAnimatedString> m_href_animated_string;
GC::Ptr<SVGAnimatedString> m_href_animated_string;
};
}

View file

@ -23,7 +23,7 @@
namespace Web::SVG {
JS_DEFINE_ALLOCATOR(SVGUseElement);
GC_DEFINE_ALLOCATOR(SVGUseElement);
SVGUseElement::SVGUseElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGGraphicsElement(document, qualified_name)
@ -131,7 +131,7 @@ void SVGUseElement::svg_element_removed(SVGElement& svg_element)
}
// https://svgwg.org/svg2-draft/linking.html#processingURL-target
JS::GCPtr<DOM::Element> SVGUseElement::referenced_element()
GC::Ptr<DOM::Element> SVGUseElement::referenced_element()
{
if (!m_href.is_valid())
return nullptr;
@ -193,7 +193,7 @@ bool SVGUseElement::is_valid_reference_element(Element const& reference_element)
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementXAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::x() const
GC::Ref<SVGAnimatedLength> SVGUseElement::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.
@ -203,7 +203,7 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::x() const
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementYAttribute
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::y() const
GC::Ref<SVGAnimatedLength> SVGUseElement::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.
@ -212,30 +212,30 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::y() const
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::width() const
GC::Ref<SVGAnimatedLength> SVGUseElement::width() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::height() const
GC::Ref<SVGAnimatedLength> SVGUseElement::height() const
{
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
// https://svgwg.org/svg2-draft/struct.html#TermInstanceRoot
JS::GCPtr<SVGElement> SVGUseElement::instance_root() const
GC::Ptr<SVGElement> SVGUseElement::instance_root() const
{
return const_cast<DOM::ShadowRoot&>(*shadow_root()).first_child_of_type<SVGElement>();
}
JS::GCPtr<SVGElement> SVGUseElement::animated_instance_root() const
GC::Ptr<SVGElement> SVGUseElement::animated_instance_root() const
{
return instance_root();
}
JS::GCPtr<Layout::Node> SVGUseElement::create_layout_node(CSS::StyleProperties style)
GC::Ptr<Layout::Node> SVGUseElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::SVGGraphicsBox>(document(), *this, move(style));
}

View file

@ -19,7 +19,7 @@ class SVGUseElement final
: public SVGGraphicsElement
, public SVGURIReferenceMixin<SupportsXLinkHref::Yes> {
WEB_PLATFORM_OBJECT(SVGUseElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGUseElement);
GC_DECLARE_ALLOCATOR(SVGUseElement);
public:
virtual ~SVGUseElement() override = default;
@ -31,13 +31,13 @@ public:
void svg_element_changed(SVGElement&);
void svg_element_removed(SVGElement&);
JS::NonnullGCPtr<SVGAnimatedLength> x() const;
JS::NonnullGCPtr<SVGAnimatedLength> y() const;
JS::NonnullGCPtr<SVGAnimatedLength> width() const;
JS::NonnullGCPtr<SVGAnimatedLength> height() const;
GC::Ref<SVGAnimatedLength> x() const;
GC::Ref<SVGAnimatedLength> y() const;
GC::Ref<SVGAnimatedLength> width() const;
GC::Ref<SVGAnimatedLength> height() const;
JS::GCPtr<SVGElement> instance_root() const;
JS::GCPtr<SVGElement> animated_instance_root() const;
GC::Ptr<SVGElement> instance_root() const;
GC::Ptr<SVGElement> animated_instance_root() const;
virtual Gfx::AffineTransform element_transform() const override;
@ -49,13 +49,13 @@ private:
virtual bool is_svg_use_element() const override { return true; }
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
void process_the_url(Optional<String> const& href);
static Optional<FlyString> parse_id_from_href(StringView);
JS::GCPtr<DOM::Element> referenced_element();
GC::Ptr<DOM::Element> referenced_element();
void fetch_the_document(URL::URL const& url);
bool is_referrenced_element_same_document() const;
@ -68,8 +68,8 @@ private:
URL::URL m_href;
JS::GCPtr<DOM::DocumentObserver> m_document_observer;
JS::GCPtr<HTML::SharedResourceRequest> m_resource_request;
GC::Ptr<DOM::DocumentObserver> m_document_observer;
GC::Ptr<HTML::SharedResourceRequest> m_resource_request;
Optional<DOM::DocumentLoadEventDelayer> m_load_event_delayer;
};