mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:27:35 +00:00
LibWeb: Rename DOM::Window::document() => associated_document()
Match the spec nomenclature.
This commit is contained in:
parent
8f72729f0e
commit
90cdeebfb3
16 changed files with 44 additions and 42 deletions
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<AbortController> create_with_global_object(Bindings::WindowObject& window_object)
|
||||
{
|
||||
return AbortController::create(window_object.impl().document());
|
||||
return AbortController::create(window_object.impl().associated_document());
|
||||
}
|
||||
|
||||
virtual ~AbortController() override;
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<AbortSignal> create_with_global_object(Bindings::WindowObject& window_object)
|
||||
{
|
||||
return AbortSignal::create(window_object.impl().document());
|
||||
return AbortSignal::create(window_object.impl().associated_document());
|
||||
}
|
||||
|
||||
virtual ~AbortSignal() override;
|
||||
|
|
|
@ -22,7 +22,7 @@ Comment::~Comment()
|
|||
// https://dom.spec.whatwg.org/#dom-comment-comment
|
||||
NonnullRefPtr<Comment> Comment::create_with_global_object(Bindings::WindowObject& window, String const& data)
|
||||
{
|
||||
return make_ref_counted<Comment>(window.impl().document(), data);
|
||||
return make_ref_counted<Comment>(window.impl().associated_document(), data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ DocumentFragment::~DocumentFragment()
|
|||
// https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment
|
||||
NonnullRefPtr<DocumentFragment> DocumentFragment::create_with_global_object(Bindings::WindowObject& window)
|
||||
{
|
||||
return make_ref_counted<DocumentFragment>(window.impl().document());
|
||||
return make_ref_counted<DocumentFragment>(window.impl().associated_document());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
|
|||
target_override = target;
|
||||
} else {
|
||||
// NOTE: This can be done because legacy_target_override is only set for events targeted at Window.
|
||||
target_override = verify_cast<Window>(*target).document();
|
||||
target_override = verify_cast<Window>(*target).associated_document();
|
||||
}
|
||||
|
||||
RefPtr<EventTarget> activation_target;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::DOM {
|
|||
|
||||
NonnullRefPtr<Range> Range::create(Window& window)
|
||||
{
|
||||
return Range::create(window.document());
|
||||
return Range::create(window.associated_document());
|
||||
}
|
||||
|
||||
NonnullRefPtr<Range> Range::create(Document& document)
|
||||
|
|
|
@ -27,7 +27,7 @@ RefPtr<Layout::Node> Text::create_layout_node()
|
|||
// https://dom.spec.whatwg.org/#dom-text-text
|
||||
NonnullRefPtr<Text> Text::create_with_global_object(Bindings::WindowObject& window, String const& data)
|
||||
{
|
||||
return make_ref_counted<Text>(window.impl().document(), data);
|
||||
return make_ref_counted<Text>(window.impl().associated_document(), data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ NonnullRefPtr<Window> Window::create_with_document(Document& document)
|
|||
|
||||
Window::Window(Document& document)
|
||||
: EventTarget(static_cast<Bindings::ScriptExecutionContext&>(document))
|
||||
, m_document(document)
|
||||
, m_associated_document(document)
|
||||
, m_performance(make<HighResolutionTime::Performance>(*this))
|
||||
, m_screen(CSS::Screen::create(*this))
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ void Window::cancel_animation_frame(i32 id)
|
|||
|
||||
void Window::did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href)
|
||||
{
|
||||
auto* frame = document().browsing_context();
|
||||
auto* frame = associated_document().browsing_context();
|
||||
if (!frame)
|
||||
return;
|
||||
frame->loader().load(new_href, FrameLoader::Type::Navigation);
|
||||
|
@ -147,10 +147,10 @@ void Window::did_set_location_href(Badge<Bindings::LocationObject>, URL const& n
|
|||
|
||||
void Window::did_call_location_reload(Badge<Bindings::LocationObject>)
|
||||
{
|
||||
auto* frame = document().browsing_context();
|
||||
auto* frame = associated_document().browsing_context();
|
||||
if (!frame)
|
||||
return;
|
||||
frame->loader().load(document().url(), FrameLoader::Type::Reload);
|
||||
frame->loader().load(associated_document().url(), FrameLoader::Type::Reload);
|
||||
}
|
||||
|
||||
bool Window::dispatch_event(NonnullRefPtr<Event> event)
|
||||
|
@ -165,26 +165,26 @@ JS::Object* Window::create_wrapper(JS::GlobalObject& global_object)
|
|||
|
||||
int Window::inner_width() const
|
||||
{
|
||||
if (!document().layout_node())
|
||||
if (!associated_document().layout_node())
|
||||
return 0;
|
||||
return document().layout_node()->width();
|
||||
return associated_document().layout_node()->width();
|
||||
}
|
||||
|
||||
int Window::inner_height() const
|
||||
{
|
||||
if (!document().layout_node())
|
||||
if (!associated_document().layout_node())
|
||||
return 0;
|
||||
return document().layout_node()->height();
|
||||
return associated_document().layout_node()->height();
|
||||
}
|
||||
|
||||
Page* Window::page()
|
||||
{
|
||||
return document().page();
|
||||
return associated_document().page();
|
||||
}
|
||||
|
||||
Page const* Window::page() const
|
||||
{
|
||||
return document().page();
|
||||
return associated_document().page();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ public:
|
|||
Page* page();
|
||||
Page const* page() const;
|
||||
|
||||
Document const& document() const { return m_document; }
|
||||
Document& document() { return m_document; }
|
||||
Document const& associated_document() const { return m_associated_document; }
|
||||
Document& associated_document() { return m_associated_document; }
|
||||
|
||||
void alert(String const&);
|
||||
bool confirm(String const&);
|
||||
|
@ -75,7 +75,9 @@ public:
|
|||
private:
|
||||
explicit Window(Document&);
|
||||
|
||||
Document& m_document;
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
||||
Document& m_associated_document;
|
||||
|
||||
WeakPtr<Bindings::WindowObject> m_wrapper;
|
||||
|
||||
IDAllocator m_timer_id_allocator;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue