diff options
author | Linus Groh <mail@linusgroh.de> | 2022-09-21 17:45:18 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-21 21:12:24 +0100 |
commit | 6055b0e8500a1c09cf478f660cf88ff3fc3bb773 (patch) | |
tree | ed4fb09e254f8273e0e8f57d088771dc99b35d2c /Userland/Libraries | |
parent | 2cab2a8e8f275f5cfc2fb9305e63234d46723ba6 (diff) | |
download | serenity-6055b0e8500a1c09cf478f660cf88ff3fc3bb773.zip |
LibWeb: Remove no-op impl() methods from the WEB_PLATFORM_OBJECT macro
These are leftovers from when wrapper objects still had an internal
implementation, which is no longer the case.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/LocationObject.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/PlatformObject.h | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/EventTarget.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Range.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Window.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Worker.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp | 2 |
12 files changed, 21 insertions, 32 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp index 914f91d9eb..aa3b0e34ba 100644 --- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp @@ -40,7 +40,7 @@ JS::ThrowCompletionOr<JS::Object*> AudioConstructor::construct(FunctionObject&) // 1. Let document be the current global object's associated Document. auto& window = verify_cast<HTML::Window>(HTML::current_global_object()); - auto& document = window.impl().associated_document(); + auto& document = window.associated_document(); // 2. Let audio be the result of creating an element given document, audio, and the HTML namespace. auto audio = DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML); diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index 04a86908b0..15851ee259 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -108,12 +108,12 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter) // 2. Parse the given value relative to the entry settings object. If that failed, throw a TypeError exception. auto new_href = TRY(vm.argument(0).to_string(vm)); - auto href_url = window.impl().associated_document().parse_url(new_href); + auto href_url = window.associated_document().parse_url(new_href); if (!href_url.is_valid()) return vm.throw_completion<JS::URIError>(String::formatted("Invalid URL '{}'", new_href)); // 3. Location-object navigate given the resulting URL record. - window.impl().did_set_location_href({}, href_url); + window.did_set_location_href({}, href_url); return JS::js_undefined(); } @@ -226,7 +226,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::port_getter) JS_DEFINE_NATIVE_FUNCTION(LocationObject::reload) { auto& window = verify_cast<HTML::Window>(HTML::current_global_object()); - window.impl().did_call_location_reload({}); + window.did_call_location_reload({}); return JS::js_undefined(); } @@ -236,7 +236,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::replace) auto& window = verify_cast<HTML::Window>(HTML::current_global_object()); auto url = TRY(vm.argument(0).to_string(vm)); // FIXME: This needs spec compliance work. - window.impl().did_call_location_replace({}, move(url)); + window.did_call_location_replace({}, move(url)); return JS::js_undefined(); } diff --git a/Userland/Libraries/LibWeb/Bindings/PlatformObject.h b/Userland/Libraries/LibWeb/Bindings/PlatformObject.h index c0e6cf76b1..d98b6053ba 100644 --- a/Userland/Libraries/LibWeb/Bindings/PlatformObject.h +++ b/Userland/Libraries/LibWeb/Bindings/PlatformObject.h @@ -14,15 +14,7 @@ namespace Web::Bindings { #define WEB_PLATFORM_OBJECT(class_, base_class) \ - JS_OBJECT(class_, base_class) \ - auto& impl() \ - { \ - return *this; \ - } \ - auto const& impl() const \ - { \ - return *this; \ - } + JS_OBJECT(class_, base_class) #define WRAPPER_HACK(class_, namespace_) \ namespace Web::Bindings { \ diff --git a/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp b/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp index 8b535cff14..98e42cf524 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp @@ -151,7 +151,7 @@ JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const // 1. Let W be the value of the [[Window]] internal slot of this. // 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current settings object. - HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).impl().browsing_context(), *m_window->browsing_context(), property_key, HTML::current_settings_object()); + HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).browsing_context(), *m_window->browsing_context(), property_key, HTML::current_settings_object()); // 3. If IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver). // NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method. @@ -171,7 +171,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& pro // 1. Let W be the value of the [[Window]] internal slot of this. // 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current settings object. - HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).browsing_context(), *m_window->impl().browsing_context(), property_key, HTML::current_settings_object()); + HTML::check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<HTML::Window>(HTML::current_global_object()).browsing_context(), *m_window->browsing_context(), property_key, HTML::current_settings_object()); // 3. If IsPlatformObjectSameOrigin(W) is true, then: if (is_platform_object_same_origin(*m_window)) { diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp index 2d3671f5c8..8620d761af 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp @@ -353,7 +353,7 @@ JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_set(JS::PropertyKey co auto css_text = TRY(value.to_string(vm())); - impl().set_property(property_id, css_text); + set_property(property_id, css_text); return true; } diff --git a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp index 19a9bb9da3..9c473374f4 100644 --- a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -91,15 +91,14 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<JS::Handle<DOM::DOMEvent // 8. If global is a Window object, then: if (is<HTML::Window>(global)) { - auto& bindings_window_global = verify_cast<HTML::Window>(global); - auto& window_impl = bindings_window_global.impl(); + auto& window = verify_cast<HTML::Window>(global); // 1. Set currentEvent to global’s current event. - current_event = window_impl.current_event(); + current_event = window.current_event(); // 2. If invocationTargetInShadowTree is false, then set global’s current event to event. if (!invocation_target_in_shadow_tree) - window_impl.set_current_event(&event); + window.set_current_event(&event); } // 9. If listener’s passive is true, then set event’s in passive listener flag. @@ -125,9 +124,8 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<JS::Handle<DOM::DOMEvent // 12. If global is a Window object, then set global’s current event to currentEvent. if (is<HTML::Window>(global)) { - auto& bindings_window_global = verify_cast<HTML::Window>(global); - auto& window_impl = bindings_window_global.impl(); - window_impl.set_current_event(current_event); + auto& window = verify_cast<HTML::Window>(global); + window.set_current_event(current_event); } // 13. If event’s stop immediate propagation flag is set, then return found. diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp index 5b4167715a..0565f62eb3 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp @@ -548,8 +548,7 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl // The argument must be an object and it must be an Event. auto event_wrapper_argument = vm.argument(0); VERIFY(event_wrapper_argument.is_object()); - auto& event_wrapper = verify_cast<DOM::Event>(event_wrapper_argument.as_object()); - auto& event = event_wrapper.impl(); + auto& event = verify_cast<DOM::Event>(event_wrapper_argument.as_object()); TRY(event_target->process_event_handler_for_event(name, event)); return JS::js_undefined(); diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index ccb99cd301..c44ab7c25c 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -43,7 +43,7 @@ JS::NonnullGCPtr<Range> Range::create(Node& start_container, u32 start_offset, N JS::NonnullGCPtr<Range> Range::create_with_global_object(HTML::Window& window) { - return Range::create(window.impl()); + return Range::create(window); } Range::Range(Document& document) diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index 3d61816132..d30284a265 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -247,7 +247,7 @@ void queue_global_task(HTML::Task::Source source, JS::Object& global_object, Fun DOM::Document* document { nullptr }; if (is<HTML::Window>(global_object)) { auto& window_object = verify_cast<HTML::Window>(global_object); - document = &window_object.impl().associated_document(); + document = &window_object.associated_document(); } // 3. Queue a task given source, event loop, document, and steps. diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index b6cd397fbf..8a8d32db26 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -844,7 +844,7 @@ void Window::initialize(JS::Realm& realm) HTML::Origin Window::origin() const { - return impl().associated_document().origin(); + return associated_document().origin(); } // https://webidl.spec.whatwg.org/#platform-object-setprototypeof @@ -870,7 +870,7 @@ static JS::ThrowCompletionOr<HTML::Window*> impl_from(JS::VM& vm) if (!is<Window>(*this_object)) return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Window"); - return &static_cast<Window*>(this_object)->impl(); + return static_cast<Window*>(this_object); } JS_DEFINE_NATIVE_FUNCTION(Window::alert) diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h index 5f7b892841..f69978bb41 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.h +++ b/Userland/Libraries/LibWeb/HTML/Worker.h @@ -39,7 +39,7 @@ public: static DOM::ExceptionOr<JS::NonnullGCPtr<Worker>> create(FlyString const& script_url, WorkerOptions const options, DOM::Document& document); static DOM::ExceptionOr<JS::NonnullGCPtr<Worker>> create_with_global_object(HTML::Window& window, FlyString const& script_url, WorkerOptions const options) { - return Worker::create(script_url, options, window.impl().associated_document()); + return Worker::create(script_url, options, window.associated_document()); } DOM::ExceptionOr<void> terminate(); diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index f17346da06..1449d1de72 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -58,7 +58,7 @@ DOM::ExceptionOr<JS::NonnullGCPtr<WebSocket>> WebSocket::create_with_global_obje return DOM::SyntaxError::create(window, "Presence of URL fragment is invalid"); // 5. If `protocols` is a string, set `protocols` to a sequence consisting of just that string // 6. If any of the values in `protocols` occur more than once or otherwise fail to match the requirements, throw SyntaxError - return JS::NonnullGCPtr(*window.heap().allocate<WebSocket>(window.realm(), window.impl(), url_record)); + return JS::NonnullGCPtr(*window.heap().allocate<WebSocket>(window.realm(), window, url_record)); } WebSocket::WebSocket(HTML::Window& window, AK::URL& url) |