mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-27 04:31:58 +00:00
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:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibGC/Root.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/IntersectionObserver/IntersectionObserverEntry.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
@ -14,7 +14,7 @@
|
|||
namespace Web::IntersectionObserver {
|
||||
|
||||
struct IntersectionObserverInit {
|
||||
Optional<Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>>> root;
|
||||
Optional<Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>>> root;
|
||||
String root_margin { "0px"_string };
|
||||
Variant<double, Vector<double>> threshold { 0 };
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ struct IntersectionObserverInit {
|
|||
struct IntersectionObserverRegistration {
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserverregistration-observer
|
||||
// [A]n observer property holding an IntersectionObserver.
|
||||
JS::NonnullGCPtr<IntersectionObserver> observer;
|
||||
GC::Ref<IntersectionObserver> observer;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserverregistration-observer
|
||||
// NOTE: Optional is used in place of the spec using -1 to indicate no previous index.
|
||||
|
@ -38,51 +38,51 @@ struct IntersectionObserverRegistration {
|
|||
// https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
|
||||
class IntersectionObserver final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(IntersectionObserver, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(IntersectionObserver);
|
||||
GC_DECLARE_ALLOCATOR(IntersectionObserver);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<IntersectionObserver>> construct_impl(JS::Realm&, JS::GCPtr<WebIDL::CallbackType> callback, IntersectionObserverInit const& options = {});
|
||||
static WebIDL::ExceptionOr<GC::Ref<IntersectionObserver>> construct_impl(JS::Realm&, GC::Ptr<WebIDL::CallbackType> callback, IntersectionObserverInit const& options = {});
|
||||
|
||||
virtual ~IntersectionObserver() override;
|
||||
|
||||
void observe(DOM::Element& target);
|
||||
void unobserve(DOM::Element& target);
|
||||
void disconnect();
|
||||
Vector<JS::Handle<IntersectionObserverEntry>> take_records();
|
||||
Vector<GC::Root<IntersectionObserverEntry>> take_records();
|
||||
|
||||
Vector<JS::NonnullGCPtr<DOM::Element>> const& observation_targets() const { return m_observation_targets; }
|
||||
Vector<GC::Ref<DOM::Element>> const& observation_targets() const { return m_observation_targets; }
|
||||
|
||||
Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>, Empty> root() const;
|
||||
Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>, Empty> root() const;
|
||||
Vector<double> const& thresholds() const { return m_thresholds; }
|
||||
|
||||
Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>> intersection_root() const;
|
||||
Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>> intersection_root() const;
|
||||
CSSPixelRect root_intersection_rectangle() const;
|
||||
|
||||
void queue_entry(Badge<DOM::Document>, JS::NonnullGCPtr<IntersectionObserverEntry>);
|
||||
void queue_entry(Badge<DOM::Document>, GC::Ref<IntersectionObserverEntry>);
|
||||
|
||||
WebIDL::CallbackType& callback() { return *m_callback; }
|
||||
|
||||
private:
|
||||
explicit IntersectionObserver(JS::Realm&, JS::GCPtr<WebIDL::CallbackType> callback, Optional<Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>>> const& root, Vector<double>&& thresholds);
|
||||
explicit IntersectionObserver(JS::Realm&, GC::Ptr<WebIDL::CallbackType> callback, Optional<Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>>> const& root, Vector<double>&& thresholds);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-callback-slot
|
||||
JS::GCPtr<WebIDL::CallbackType> m_callback;
|
||||
GC::Ptr<WebIDL::CallbackType> m_callback;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-root
|
||||
JS::GCPtr<DOM::Node> m_root;
|
||||
GC::Ptr<DOM::Node> m_root;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-thresholds
|
||||
Vector<double> m_thresholds;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-queuedentries-slot
|
||||
Vector<JS::NonnullGCPtr<IntersectionObserverEntry>> m_queued_entries;
|
||||
Vector<GC::Ref<IntersectionObserverEntry>> m_queued_entries;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-observationtargets-slot
|
||||
Vector<JS::NonnullGCPtr<DOM::Element>> m_observation_targets;
|
||||
Vector<GC::Ref<DOM::Element>> m_observation_targets;
|
||||
|
||||
// AD-HOC: This is the document where we've registered the IntersectionObserver.
|
||||
WeakPtr<DOM::Document> m_document;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue