mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:57:36 +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
|
@ -43,7 +43,7 @@ JS::Value ImageConstructor::call()
|
|||
JS::Value ImageConstructor::construct(FunctionObject&)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object());
|
||||
auto& document = window.impl().document();
|
||||
auto& document = window.impl().associated_document();
|
||||
auto image_element = DOM::create_element(document, HTML::TagNames::img, Namespace::HTML);
|
||||
|
||||
if (vm().argument_count() > 0) {
|
||||
|
|
|
@ -41,7 +41,7 @@ LocationObject::~LocationObject()
|
|||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_getter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
return JS::js_string(vm, window.impl().document().url().to_string());
|
||||
return JS::js_string(vm, window.impl().associated_document().url().to_string());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter)
|
||||
|
@ -50,7 +50,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter)
|
|||
auto new_href = vm.argument(0).to_string(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto href_url = window.impl().document().complete_url(new_href);
|
||||
auto href_url = window.impl().associated_document().complete_url(new_href);
|
||||
if (!href_url.is_valid()) {
|
||||
vm.throw_exception<JS::URIError>(global_object, String::formatted("Invalid URL '{}'", new_href));
|
||||
return {};
|
||||
|
@ -62,26 +62,26 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter)
|
|||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::pathname_getter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
return JS::js_string(vm, window.impl().document().url().path());
|
||||
return JS::js_string(vm, window.impl().associated_document().url().path());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::hostname_getter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
return JS::js_string(vm, window.impl().document().url().host());
|
||||
return JS::js_string(vm, window.impl().associated_document().url().host());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::host_getter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto url = window.impl().document().url();
|
||||
auto url = window.impl().associated_document().url();
|
||||
return JS::js_string(vm, String::formatted("{}:{}", url.host(), url.port()));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::hash_getter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto fragment = window.impl().document().url().fragment();
|
||||
auto fragment = window.impl().associated_document().url().fragment();
|
||||
if (!fragment.length())
|
||||
return JS::js_string(vm, "");
|
||||
StringBuilder builder;
|
||||
|
@ -93,7 +93,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::hash_getter)
|
|||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::search_getter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto query = window.impl().document().url().query();
|
||||
auto query = window.impl().associated_document().url().query();
|
||||
if (!query.length())
|
||||
return JS::js_string(vm, "");
|
||||
StringBuilder builder;
|
||||
|
@ -106,7 +106,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::protocol_getter)
|
|||
{
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
StringBuilder builder;
|
||||
builder.append(window.impl().document().url().protocol());
|
||||
builder.append(window.impl().associated_document().url().protocol());
|
||||
builder.append(':');
|
||||
return JS::js_string(vm, builder.to_string());
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void WindowObject::visit_edges(Visitor& visitor)
|
|||
|
||||
Origin WindowObject::origin() const
|
||||
{
|
||||
return impl().document().origin();
|
||||
return impl().associated_document().origin();
|
||||
}
|
||||
|
||||
static DOM::Window* impl_from(JS::VM& vm, JS::GlobalObject& global_object)
|
||||
|
@ -358,7 +358,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::top_getter)
|
|||
if (!impl)
|
||||
return {};
|
||||
|
||||
auto* this_browsing_context = impl->document().browsing_context();
|
||||
auto* this_browsing_context = impl->associated_document().browsing_context();
|
||||
if (!this_browsing_context)
|
||||
return JS::js_null();
|
||||
|
||||
|
@ -374,7 +374,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::parent_getter)
|
|||
if (!impl)
|
||||
return {};
|
||||
|
||||
auto* this_browsing_context = impl->document().browsing_context();
|
||||
auto* this_browsing_context = impl->associated_document().browsing_context();
|
||||
if (!this_browsing_context)
|
||||
return JS::js_null();
|
||||
|
||||
|
@ -392,7 +392,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::document_getter)
|
|||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
return {};
|
||||
return wrap(global_object, impl->document());
|
||||
return wrap(global_object, impl->associated_document());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WindowObject::performance_getter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue