mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Move Window from DOM directory & namespace to HTML
The Window object is part of the HTML spec. :^) https://html.spec.whatwg.org/multipage/window-object.html
This commit is contained in:
parent
2dfb617c5b
commit
1422bd45eb
Notes:
sideshowbarker
2024-07-17 17:48:56 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/1422bd45eb Pull-request: https://github.com/SerenityOS/serenity/pull/12936 Reviewed-by: https://github.com/awesomekling ✅
@ -2804,8 +2804,8 @@ void generate_prototype_implementation(IDL::Interface const& interface)
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/IDLEventListener.h>
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Origin.h>
|
||||
|
||||
#if __has_include(<LibWeb/Bindings/@prototype_base_class@.h>)
|
||||
|
@ -45,7 +45,7 @@ struct TestWebGlobalObject : public Web::Bindings::WindowObject {
|
||||
JS_OBJECT(TestWebGlobalObject, Web::Bindings::WindowObject);
|
||||
|
||||
public:
|
||||
TestWebGlobalObject(Web::DOM::Window& window)
|
||||
TestWebGlobalObject(Web::HTML::Window& window)
|
||||
: Web::Bindings::WindowObject(window)
|
||||
{
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <LibWeb/Bindings/HTMLAudioElementWrapper.h>
|
||||
#include <LibWeb/Bindings/NodeWrapperFactory.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <LibWeb/Bindings/ImageConstructor.h>
|
||||
#include <LibWeb/Bindings/NodeWrapperFactory.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/DOMException.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/PromiseRejectionEvent.h>
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -38,18 +38,18 @@
|
||||
#include <LibWeb/Crypto/Crypto.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Storage.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Origin.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/WebAssembly/WebAssemblyObject.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
WindowObject::WindowObject(DOM::Window& impl)
|
||||
WindowObject::WindowObject(HTML::Window& impl)
|
||||
: m_impl(impl)
|
||||
{
|
||||
impl.set_wrapper({}, *this);
|
||||
@ -164,7 +164,7 @@ JS::ThrowCompletionOr<bool> WindowObject::internal_set_prototype_of(JS::Object*
|
||||
return set_immutable_prototype(prototype);
|
||||
}
|
||||
|
||||
static JS::ThrowCompletionOr<DOM::Window*> impl_from(JS::VM& vm, JS::GlobalObject& global_object)
|
||||
static JS::ThrowCompletionOr<HTML::Window*> impl_from(JS::VM& vm, JS::GlobalObject& global_object)
|
||||
{
|
||||
// Since this is a non built-in function we must treat it as non-strict mode
|
||||
// this means that a nullish this_value should be converted to the
|
||||
|
@ -30,12 +30,12 @@ class WindowObject
|
||||
JS_OBJECT(WindowObject, JS::GlobalObject);
|
||||
|
||||
public:
|
||||
explicit WindowObject(DOM::Window&);
|
||||
explicit WindowObject(HTML::Window&);
|
||||
virtual void initialize_global_object() override;
|
||||
virtual ~WindowObject() override;
|
||||
|
||||
DOM::Window& impl() { return *m_impl; }
|
||||
const DOM::Window& impl() const { return *m_impl; }
|
||||
HTML::Window& impl() { return *m_impl; }
|
||||
const HTML::Window& impl() const { return *m_impl; }
|
||||
|
||||
Origin origin() const;
|
||||
|
||||
@ -135,7 +135,7 @@ private:
|
||||
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE);
|
||||
#undef __ENUMERATE
|
||||
|
||||
NonnullRefPtr<DOM::Window> m_impl;
|
||||
NonnullRefPtr<HTML::Window> m_impl;
|
||||
|
||||
LocationObject* m_location_object { nullptr };
|
||||
|
||||
|
@ -99,7 +99,6 @@ set(SOURCES
|
||||
DOM/Text.cpp
|
||||
DOM/Text.idl
|
||||
DOM/Timer.cpp
|
||||
DOM/Window.cpp
|
||||
DOMParsing/InnerHTML.cpp
|
||||
DOMTreeModel.cpp
|
||||
Dump.cpp
|
||||
@ -214,6 +213,7 @@ set(SOURCES
|
||||
HTML/SyntaxHighlighter/SyntaxHighlighter.cpp
|
||||
HTML/TagNames.cpp
|
||||
HTML/TextMetrics.cpp
|
||||
HTML/Window.cpp
|
||||
HTML/Worker.cpp
|
||||
HTML/WorkerDebugConsoleClient.cpp
|
||||
HTML/WorkerGlobalScope.cpp
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
NonnullRefPtr<MediaList> const& media() const { return m_media; }
|
||||
|
||||
bool evaluate(DOM::Window const& window) { return m_media->evaluate(window); }
|
||||
bool evaluate(HTML::Window const& window) { return m_media->evaluate(window); }
|
||||
|
||||
private:
|
||||
explicit CSSMediaRule(NonnullRefPtr<MediaList>&&, NonnullRefPtrVector<CSSRule>&&);
|
||||
|
@ -103,7 +103,7 @@ void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const
|
||||
}
|
||||
}
|
||||
|
||||
bool CSSRuleList::evaluate_media_queries(DOM::Window const& window)
|
||||
bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
|
||||
{
|
||||
bool any_media_queries_changed_match_state = false;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const;
|
||||
// Returns whether the match state of any media queries changed after evaluation.
|
||||
bool evaluate_media_queries(DOM::Window const&);
|
||||
bool evaluate_media_queries(HTML::Window const&);
|
||||
|
||||
private:
|
||||
explicit CSSRuleList(NonnullRefPtrVector<CSSRule>&&);
|
||||
|
@ -62,7 +62,7 @@ void CSSStyleSheet::for_each_effective_style_rule(Function<void(CSSStyleRule con
|
||||
m_rules->for_each_effective_style_rule(callback);
|
||||
}
|
||||
|
||||
bool CSSStyleSheet::evaluate_media_queries(DOM::Window const& window)
|
||||
bool CSSStyleSheet::evaluate_media_queries(HTML::Window const& window)
|
||||
{
|
||||
return m_rules->evaluate_media_queries(window);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const;
|
||||
// Returns whether the match state of any media queries changed after evaluation.
|
||||
bool evaluate_media_queries(DOM::Window const&);
|
||||
bool evaluate_media_queries(HTML::Window const&);
|
||||
|
||||
private:
|
||||
explicit CSSStyleSheet(NonnullRefPtrVector<CSSRule>);
|
||||
|
@ -65,7 +65,7 @@ void MediaList::delete_medium(String medium)
|
||||
// FIXME: If nothing was removed, then throw a NotFoundError exception.
|
||||
}
|
||||
|
||||
bool MediaList::evaluate(DOM::Window const& window)
|
||||
bool MediaList::evaluate(HTML::Window const& window)
|
||||
{
|
||||
for (auto& media : m_media)
|
||||
media.evaluate(window);
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
void append_medium(String);
|
||||
void delete_medium(String);
|
||||
|
||||
bool evaluate(DOM::Window const&);
|
||||
bool evaluate(HTML::Window const&);
|
||||
bool matches() const;
|
||||
|
||||
private:
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <LibWeb/CSS/MediaQuery.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
@ -77,7 +77,7 @@ String MediaFeature::to_string() const
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool MediaFeature::evaluate(DOM::Window const& window) const
|
||||
bool MediaFeature::evaluate(HTML::Window const& window) const
|
||||
{
|
||||
auto maybe_queried_value = window.query_media_feature(m_name);
|
||||
if (!maybe_queried_value.has_value())
|
||||
@ -122,7 +122,7 @@ bool MediaFeature::evaluate(DOM::Window const& window) const
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool MediaFeature::compare(DOM::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right)
|
||||
bool MediaFeature::compare(HTML::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right)
|
||||
{
|
||||
if (!left.is_same_type(right))
|
||||
return false;
|
||||
@ -298,7 +298,7 @@ String MediaCondition::to_string() const
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
MatchResult MediaCondition::evaluate(DOM::Window const& window) const
|
||||
MatchResult MediaCondition::evaluate(HTML::Window const& window) const
|
||||
{
|
||||
switch (type) {
|
||||
case Type::Single:
|
||||
@ -369,7 +369,7 @@ String MediaQuery::to_string() const
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
bool MediaQuery::evaluate(DOM::Window const& window)
|
||||
bool MediaQuery::evaluate(HTML::Window const& window)
|
||||
{
|
||||
auto matches_media = [](MediaType media) -> MatchResult {
|
||||
switch (media) {
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
return feature;
|
||||
}
|
||||
|
||||
bool evaluate(DOM::Window const&) const;
|
||||
bool evaluate(HTML::Window const&) const;
|
||||
String to_string() const;
|
||||
|
||||
private:
|
||||
@ -159,7 +159,7 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
static bool compare(DOM::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right);
|
||||
static bool compare(HTML::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right);
|
||||
|
||||
struct Range {
|
||||
MediaFeatureValue left_value;
|
||||
@ -196,7 +196,7 @@ struct MediaCondition {
|
||||
static NonnullOwnPtr<MediaCondition> from_and_list(NonnullOwnPtrVector<MediaCondition>&&);
|
||||
static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&);
|
||||
|
||||
MatchResult evaluate(DOM::Window const&) const;
|
||||
MatchResult evaluate(HTML::Window const&) const;
|
||||
String to_string() const;
|
||||
|
||||
private:
|
||||
@ -234,7 +234,7 @@ public:
|
||||
static NonnullRefPtr<MediaQuery> create() { return adopt_ref(*new MediaQuery); }
|
||||
|
||||
bool matches() const { return m_matches; }
|
||||
bool evaluate(DOM::Window const&);
|
||||
bool evaluate(HTML::Window const&);
|
||||
String to_string() const;
|
||||
|
||||
private:
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
Screen::Screen(DOM::Window& window)
|
||||
Screen::Screen(HTML::Window& window)
|
||||
: RefCountForwarder(window)
|
||||
{
|
||||
}
|
||||
|
@ -9,20 +9,20 @@
|
||||
#include <AK/RefCountForwarder.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class Screen final
|
||||
: public RefCountForwarder<DOM::Window>
|
||||
: public RefCountForwarder<HTML::Window>
|
||||
, public Bindings::Wrappable {
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::ScreenWrapper;
|
||||
using AllowOwnPtr = TrueType;
|
||||
|
||||
static NonnullOwnPtr<Screen> create(Badge<DOM::Window>, DOM::Window& window)
|
||||
static NonnullOwnPtr<Screen> create(Badge<HTML::Window>, HTML::Window& window)
|
||||
{
|
||||
return adopt_own(*new Screen(window));
|
||||
}
|
||||
@ -35,9 +35,9 @@ public:
|
||||
u32 pixel_depth() const { return 24; }
|
||||
|
||||
private:
|
||||
explicit Screen(DOM::Window&);
|
||||
explicit Screen(HTML::Window&);
|
||||
|
||||
DOM::Window const& window() const { return ref_count_target(); }
|
||||
HTML::Window const& window() const { return ref_count_target(); }
|
||||
|
||||
Gfx::IntRect screen_rect() const;
|
||||
};
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/AbortSignal.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/Comment.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/AttributeNames.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
@ -56,6 +55,7 @@
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
|
||||
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/BlockFormattingContext.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Layout/TreeBuilder.h>
|
||||
@ -75,7 +75,7 @@ Document::Document(const AK::URL& url)
|
||||
, m_style_computer(make<CSS::StyleComputer>(*this))
|
||||
, m_style_sheets(CSS::StyleSheetList::create(*this))
|
||||
, m_url(url)
|
||||
, m_window(Window::create_with_document(*this))
|
||||
, m_window(HTML::Window::create_with_document(*this))
|
||||
, m_implementation(DOMImplementation::create({}, *this))
|
||||
, m_history(HTML::History::create(*this))
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ public:
|
||||
|
||||
void removed_last_ref();
|
||||
|
||||
Window& window() { return *m_window; }
|
||||
HTML::Window& window() { return *m_window; }
|
||||
|
||||
ExceptionOr<void> write(Vector<String> const& strings);
|
||||
ExceptionOr<void> writeln(Vector<String> const& strings);
|
||||
@ -250,7 +250,7 @@ public:
|
||||
ExceptionOr<Document*> open(String const& = "", String const& = "");
|
||||
ExceptionOr<void> close();
|
||||
|
||||
Window* default_view() { return m_window; }
|
||||
HTML::Window* default_view() { return m_window; }
|
||||
|
||||
const String& content_type() const { return m_content_type; }
|
||||
void set_content_type(const String& content_type) { m_content_type = content_type; }
|
||||
@ -360,7 +360,7 @@ private:
|
||||
WeakPtr<HTML::BrowsingContext> m_browsing_context;
|
||||
AK::URL m_url;
|
||||
|
||||
RefPtr<Window> m_window;
|
||||
RefPtr<HTML::Window> m_window;
|
||||
|
||||
RefPtr<Layout::InitialContainingBlock> m_layout_root;
|
||||
|
||||
|
@ -33,7 +33,7 @@ interface Document : Node {
|
||||
readonly attribute Window? defaultView;
|
||||
|
||||
[CEReactions] Document open(optional DOMString unused1, optional DOMString unused2);
|
||||
// FIXME: implement ExceptionOr<Window> Document::open(...)
|
||||
// FIXME: implement ExceptionOr<HTML::Window> Document::open(...)
|
||||
// WindowProxy? open(USVString url, DOMString name, DOMString features);
|
||||
[CEReactions] undefined close();
|
||||
[CEReactions] undefined write(DOMString... text);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/DocumentFragment.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include <LibWeb/DOM/IDLEventListener.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/UIEvents/MouseEvent.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
@ -190,7 +190,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).associated_document();
|
||||
target_override = verify_cast<HTML::Window>(*target).associated_document();
|
||||
}
|
||||
|
||||
RefPtr<EventTarget> activation_target;
|
||||
@ -229,7 +229,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
|
||||
touch_targets.append(retarget(touch_target, parent));
|
||||
}
|
||||
|
||||
if (is<Window>(parent)
|
||||
if (is<HTML::Window>(parent)
|
||||
|| (is<Node>(parent) && verify_cast<Node>(*target).root().is_shadow_including_inclusive_ancestor_of(verify_cast<Node>(*parent)))) {
|
||||
if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behavior)
|
||||
activation_target = parent;
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/DOM/IDLEventListener.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/ErrorEvent.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
@ -33,6 +32,7 @@
|
||||
#include <LibWeb/HTML/HTMLBodyElement.h>
|
||||
#include <LibWeb/HTML/HTMLFormElement.h>
|
||||
#include <LibWeb/HTML/HTMLFrameSetElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/UIEvents/EventNames.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
@ -315,8 +315,8 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin
|
||||
element = element_event_target;
|
||||
document = element_event_target->document();
|
||||
} else {
|
||||
VERIFY(is<Window>(this));
|
||||
auto* window_event_target = verify_cast<Window>(this);
|
||||
VERIFY(is<HTML::Window>(this));
|
||||
auto* window_event_target = verify_cast<HTML::Window>(this);
|
||||
document = window_event_target->associated_document();
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin
|
||||
StringBuilder builder;
|
||||
|
||||
// sourceText
|
||||
if (name == HTML::EventNames::error && is<Window>(this)) {
|
||||
if (name == HTML::EventNames::error && is<HTML::Window>(this)) {
|
||||
// -> If name is onerror and eventTarget is a Window object
|
||||
// The string formed by concatenating "function ", name, "(event, source, lineno, colno, error) {", U+000A LF, body, U+000A LF, and "}".
|
||||
builder.appendff("function {}(event, source, lineno, colno, error) {{\n{}\n}}", name, body);
|
||||
@ -511,14 +511,14 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
|
||||
|
||||
// FIXME: This is guess work on what global object the NativeFunction should be allocated on.
|
||||
// For <body> or <frameset> elements who just had an element attribute set, it will be this's wrapper, as `this` is the result of determine_target_of_event_handler
|
||||
// returning the element's document's global object, which is the DOM::Window object.
|
||||
// returning the element's document's global object, which is the HTML::Window object.
|
||||
// For any other HTMLElement who just had an element attribute set, `this` will be that HTMLElement, so the global object is this's document's realm's global object.
|
||||
// For anything else, it came from JavaScript, so use the global object of the provided callback function.
|
||||
// Sadly, this doesn't work if an element attribute is set on a <body> element before any script is run, as Window::wrapper() will be null.
|
||||
JS::GlobalObject* global_object = nullptr;
|
||||
if (is_attribute == IsAttribute::Yes) {
|
||||
if (is<Window>(this)) {
|
||||
auto* window_global_object = verify_cast<Window>(this)->wrapper();
|
||||
if (is<HTML::Window>(this)) {
|
||||
auto* window_global_object = verify_cast<HTML::Window>(this)->wrapper();
|
||||
global_object = static_cast<JS::GlobalObject*>(window_global_object);
|
||||
} else {
|
||||
auto* html_element = verify_cast<HTML::HTMLElement>(this);
|
||||
@ -606,7 +606,7 @@ JS::ThrowCompletionOr<void> EventTarget::process_event_handler_for_event(FlyStri
|
||||
// 3. Let special error event handling be true if event is an ErrorEvent object, event's type is error, and event's currentTarget implements the WindowOrWorkerGlobalScope mixin.
|
||||
// Otherwise, let special error event handling be false.
|
||||
// FIXME: This doesn't check for WorkerGlobalScape as we don't currently have it.
|
||||
bool special_error_event_handling = is<HTML::ErrorEvent>(event) && event.type() == HTML::EventNames::error && is<Window>(event.current_target().ptr());
|
||||
bool special_error_event_handling = is<HTML::ErrorEvent>(event) && event.type() == HTML::EventNames::error && is<HTML::Window>(event.current_target().ptr());
|
||||
|
||||
// 4. Process the Event object event as follows:
|
||||
JS::Completion return_value_or_error;
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include <LibWeb/DOM/DocumentType.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
NonnullRefPtr<Range> Range::create(Window& window)
|
||||
NonnullRefPtr<Range> Range::create(HTML::Window& window)
|
||||
{
|
||||
return Range::create(window.associated_document());
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
virtual ~Range() override;
|
||||
|
||||
static NonnullRefPtr<Range> create(Document&);
|
||||
static NonnullRefPtr<Range> create(Window&);
|
||||
static NonnullRefPtr<Range> create(HTML::Window&);
|
||||
static NonnullRefPtr<Range> create(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
|
||||
static NonnullRefPtr<Range> create_with_global_object(Bindings::WindowObject&);
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
@ -6,16 +6,16 @@
|
||||
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibWeb/DOM/Timer.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
NonnullRefPtr<Timer> Timer::create(Window& window, i32 milliseconds, Function<void()> callback, i32 id)
|
||||
NonnullRefPtr<Timer> Timer::create(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id)
|
||||
{
|
||||
return adopt_ref(*new Timer(window, milliseconds, move(callback), id));
|
||||
}
|
||||
|
||||
Timer::Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id)
|
||||
Timer::Timer(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id)
|
||||
: m_window(window)
|
||||
, m_id(id)
|
||||
{
|
||||
|
@ -15,16 +15,16 @@ namespace Web::DOM {
|
||||
|
||||
class Timer final : public RefCounted<Timer> {
|
||||
public:
|
||||
static NonnullRefPtr<Timer> create(Window& window, i32 milliseconds, Function<void()> callback, i32 id);
|
||||
static NonnullRefPtr<Timer> create(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id);
|
||||
~Timer();
|
||||
|
||||
void start();
|
||||
|
||||
private:
|
||||
Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id);
|
||||
Timer(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id);
|
||||
|
||||
RefPtr<Core::Timer> m_timer;
|
||||
Window& m_window;
|
||||
HTML::Window& m_window;
|
||||
i32 m_id { 0 };
|
||||
};
|
||||
|
||||
|
@ -120,7 +120,6 @@ class StaticNodeList;
|
||||
class StaticRange;
|
||||
class Text;
|
||||
class Timer;
|
||||
class Window;
|
||||
enum class QuirksMode;
|
||||
struct EventListenerOptions;
|
||||
struct AddEventListenerOptions;
|
||||
@ -235,6 +234,7 @@ class WorkerDebugConsoleClient;
|
||||
class Storage;
|
||||
class SubmitEvent;
|
||||
class TextMetrics;
|
||||
class Window;
|
||||
class WindowEnvironmentSettingsObject;
|
||||
class Worker;
|
||||
class WorkerEnvironmentSettingsObject;
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/HTMLCollection.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/BrowsingContextContainer.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/BreakNode.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/CanvasRenderingContext2D.h>
|
||||
#include <LibWeb/HTML/HTMLCanvasElement.h>
|
||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
#include <LibWeb/HTML/ImageData.h>
|
||||
#include <LibWeb/HTML/TextMetrics.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
|
||||
protected:
|
||||
CloseEvent(FlyString const& event_name, CloseEventInit const& event_init)
|
||||
: Event(event_name, event_init)
|
||||
: DOM::Event(event_name, event_init)
|
||||
, m_was_clean(event_init.was_clean)
|
||||
, m_code(event_init.code)
|
||||
, m_reason(event_init.reason)
|
||||
|
@ -9,10 +9,10 @@
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/HTMLBodyElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
#include <LibWeb/DOM/IDLEventListener.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/BrowsingContextContainer.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/HTML/HTMLBodyElement.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/Box.h>
|
||||
#include <LibWeb/Layout/BreakNode.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
|
||||
private:
|
||||
// ^HTML::GlobalEventHandlers
|
||||
virtual EventTarget& global_event_handlers_to_event_target() override { return *this; }
|
||||
virtual DOM::EventTarget& global_event_handlers_to_event_target() override { return *this; }
|
||||
|
||||
enum class ContentEditableState {
|
||||
True,
|
||||
|
@ -11,10 +11,10 @@
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLScriptElement.h>
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/ProcessingInstruction.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLFormElement.h>
|
||||
@ -27,6 +26,7 @@
|
||||
#include <LibWeb/HTML/Parser/HTMLEncodingDetection.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLToken.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/SVG/TagNames.h>
|
||||
|
||||
@ -276,7 +276,7 @@ void HTMLParser::the_end()
|
||||
return;
|
||||
|
||||
// 3. Let window be the Document's relevant global object.
|
||||
NonnullRefPtr<DOM::Window> window = document->window();
|
||||
NonnullRefPtr<Window> window = document->window();
|
||||
|
||||
// FIXME: 4. Set the Document's load timing info's load event start time to the current high resolution time given window.
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/PromiseRejectionEvent.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(DOM::Window& window, JS::ExecutionContext& execution_context)
|
||||
WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(Window& window, JS::ExecutionContext& execution_context)
|
||||
: EnvironmentSettingsObject(execution_context)
|
||||
, m_window(window)
|
||||
{
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
@ -24,9 +24,9 @@ public:
|
||||
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
||||
|
||||
private:
|
||||
WindowEnvironmentSettingsObject(DOM::Window&, JS::ExecutionContext& execution_context);
|
||||
WindowEnvironmentSettingsObject(Window&, JS::ExecutionContext& execution_context);
|
||||
|
||||
NonnullRefPtr<DOM::Window> m_window;
|
||||
NonnullRefPtr<Window> m_window;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace Web::HTML {
|
||||
|
||||
// FIXME: This is a bit ugly, this implementation is basically a 1:1 copy of what is in ESO
|
||||
// just modified to use DOM::Document instead of DOM::Window since workers have no window
|
||||
// just modified to use DOM::Document instead of HTML::Window since workers have no window
|
||||
class WorkerEnvironmentSettingsObject final
|
||||
: public EnvironmentSettingsObject
|
||||
, public Weakable<WorkerEnvironmentSettingsObject> {
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/Timer.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/MessageEvent.h>
|
||||
@ -24,12 +23,13 @@
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
|
||||
#include <LibWeb/HTML/Storage.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Selection/Selection.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
namespace Web::HTML {
|
||||
|
||||
class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> {
|
||||
public:
|
||||
@ -107,13 +107,13 @@ void run_animation_frame_callbacks(DOM::Document&, double)
|
||||
request_animation_frame_driver().run();
|
||||
}
|
||||
|
||||
NonnullRefPtr<Window> Window::create_with_document(Document& document)
|
||||
NonnullRefPtr<Window> Window::create_with_document(DOM::Document& document)
|
||||
{
|
||||
return adopt_ref(*new Window(document));
|
||||
}
|
||||
|
||||
Window::Window(Document& document)
|
||||
: EventTarget()
|
||||
Window::Window(DOM::Document& document)
|
||||
: DOM::EventTarget()
|
||||
, m_associated_document(document)
|
||||
, m_performance(make<HighResolutionTime::Performance>(*this))
|
||||
, m_crypto(Crypto::Crypto::create())
|
||||
@ -174,7 +174,7 @@ void Window::clear_interval(i32 id)
|
||||
m_timers.remove(id);
|
||||
}
|
||||
|
||||
void Window::deallocate_timer_id(Badge<Timer>, i32 id)
|
||||
void Window::deallocate_timer_id(Badge<DOM::Timer>, i32 id)
|
||||
{
|
||||
m_timer_id_allocator.deallocate(id);
|
||||
}
|
||||
@ -262,7 +262,7 @@ i32 Window::run_timer_initialization_steps(Bindings::TimerHandler handler, i32 t
|
||||
};
|
||||
|
||||
// 13. Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and id.
|
||||
auto timer = Timer::create(*this, timeout, move(completion_step), id);
|
||||
auto timer = DOM::Timer::create(*this, timeout, move(completion_step), id);
|
||||
m_timers.set(id, timer);
|
||||
timer->start();
|
||||
|
||||
@ -320,9 +320,9 @@ void Window::did_call_location_replace(Badge<Bindings::LocationObject>, String u
|
||||
browsing_context->loader().load(move(new_url), FrameLoader::Type::Navigation);
|
||||
}
|
||||
|
||||
bool Window::dispatch_event(NonnullRefPtr<Event> event)
|
||||
bool Window::dispatch_event(NonnullRefPtr<DOM::Event> event)
|
||||
{
|
||||
return EventDispatcher::dispatch(*this, event, true);
|
||||
return DOM::EventDispatcher::dispatch(*this, event, true);
|
||||
}
|
||||
|
||||
JS::Object* Window::create_wrapper(JS::GlobalObject& global_object)
|
@ -20,16 +20,16 @@
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
namespace Web::HTML {
|
||||
|
||||
class RequestAnimationFrameCallback;
|
||||
|
||||
class Window final
|
||||
: public RefCounted<Window>
|
||||
, public EventTarget
|
||||
, public DOM::EventTarget
|
||||
, public HTML::GlobalEventHandlers {
|
||||
public:
|
||||
static NonnullRefPtr<Window> create_with_document(Document&);
|
||||
static NonnullRefPtr<Window> create_with_document(DOM::Document&);
|
||||
~Window();
|
||||
|
||||
using RefCounted::ref;
|
||||
@ -37,15 +37,15 @@ public:
|
||||
|
||||
virtual void ref_event_target() override { RefCounted::ref(); }
|
||||
virtual void unref_event_target() override { RefCounted::unref(); }
|
||||
virtual bool dispatch_event(NonnullRefPtr<Event>) override;
|
||||
virtual bool dispatch_event(NonnullRefPtr<DOM::Event>) override;
|
||||
virtual JS::Object* create_wrapper(JS::GlobalObject&) override;
|
||||
|
||||
Page* page();
|
||||
Page const* page() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
||||
Document const& associated_document() const { return *m_associated_document; }
|
||||
Document& associated_document() { return *m_associated_document; }
|
||||
DOM::Document const& associated_document() const { return *m_associated_document; }
|
||||
DOM::Document& associated_document() { return *m_associated_document; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#window-bc
|
||||
HTML::BrowsingContext const* browsing_context() const { return m_associated_document->browsing_context(); }
|
||||
@ -76,7 +76,7 @@ public:
|
||||
|
||||
void set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&);
|
||||
|
||||
void deallocate_timer_id(Badge<Timer>, i32);
|
||||
void deallocate_timer_id(Badge<DOM::Timer>, i32);
|
||||
|
||||
HighResolutionTime::Performance& performance() { return *m_performance; }
|
||||
|
||||
@ -84,8 +84,8 @@ public:
|
||||
|
||||
CSS::Screen& screen() { return *m_screen; }
|
||||
|
||||
Event const* current_event() const { return m_current_event; }
|
||||
void set_current_event(Event* event) { m_current_event = event; }
|
||||
DOM::Event const* current_event() const { return m_current_event; }
|
||||
void set_current_event(DOM::Event* event) { m_current_event = event; }
|
||||
|
||||
NonnullRefPtr<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&) const;
|
||||
NonnullRefPtr<CSS::MediaQueryList> match_media(String);
|
||||
@ -110,7 +110,7 @@ public:
|
||||
DOM::ExceptionOr<void> post_message(JS::Value, String const& target_origin);
|
||||
|
||||
private:
|
||||
explicit Window(Document&);
|
||||
explicit Window(DOM::Document&);
|
||||
|
||||
// ^HTML::GlobalEventHandlers
|
||||
virtual DOM::EventTarget& global_event_handlers_to_event_target() override { return *this; }
|
||||
@ -122,17 +122,17 @@ private:
|
||||
i32 run_timer_initialization_steps(Bindings::TimerHandler handler, i32 timeout, JS::MarkedVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id = {});
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
||||
WeakPtr<Document> m_associated_document;
|
||||
WeakPtr<DOM::Document> m_associated_document;
|
||||
|
||||
WeakPtr<Bindings::WindowObject> m_wrapper;
|
||||
|
||||
IDAllocator m_timer_id_allocator;
|
||||
HashMap<int, NonnullRefPtr<Timer>> m_timers;
|
||||
HashMap<int, NonnullRefPtr<DOM::Timer>> m_timers;
|
||||
|
||||
NonnullOwnPtr<HighResolutionTime::Performance> m_performance;
|
||||
NonnullRefPtr<Crypto::Crypto> m_crypto;
|
||||
NonnullOwnPtr<CSS::Screen> m_screen;
|
||||
RefPtr<Event> m_current_event;
|
||||
RefPtr<DOM::Event> m_current_event;
|
||||
|
||||
HashMap<i32, NonnullRefPtr<RequestAnimationFrameCallback>> m_request_animation_frame_callbacks;
|
||||
};
|
@ -8,12 +8,12 @@
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
|
||||
namespace Web::HighResolutionTime {
|
||||
|
||||
Performance::Performance(DOM::Window& window)
|
||||
Performance::Performance(HTML::Window& window)
|
||||
: DOM::EventTarget()
|
||||
, m_window(window)
|
||||
, m_timing(make<NavigationTiming::PerformanceTiming>(window))
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
using WrapperType = Bindings::PerformanceWrapper;
|
||||
using AllowOwnPtr = TrueType;
|
||||
|
||||
explicit Performance(DOM::Window&);
|
||||
explicit Performance(HTML::Window&);
|
||||
~Performance();
|
||||
|
||||
double now() const { return m_timer.elapsed(); }
|
||||
@ -35,7 +35,7 @@ public:
|
||||
virtual JS::Object* create_wrapper(JS::GlobalObject&) override;
|
||||
|
||||
private:
|
||||
DOM::Window& m_window;
|
||||
HTML::Window& m_window;
|
||||
Core::ElapsedTimer m_timer;
|
||||
|
||||
OwnPtr<NavigationTiming::PerformanceTiming> m_timing;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace Web::NavigationTiming {
|
||||
|
||||
PerformanceTiming::PerformanceTiming(DOM::Window& window)
|
||||
PerformanceTiming::PerformanceTiming(HTML::Window& window)
|
||||
: RefCountForwarder(window)
|
||||
{
|
||||
}
|
||||
|
@ -9,18 +9,18 @@
|
||||
#include <AK/RefCountForwarder.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::NavigationTiming {
|
||||
|
||||
class PerformanceTiming final
|
||||
: public RefCountForwarder<DOM::Window>
|
||||
: public RefCountForwarder<HTML::Window>
|
||||
, public Bindings::Wrappable {
|
||||
public:
|
||||
using WrapperType = Bindings::PerformanceTimingWrapper;
|
||||
using AllowOwnPtr = TrueType;
|
||||
|
||||
explicit PerformanceTiming(DOM::Window&);
|
||||
explicit PerformanceTiming(HTML::Window&);
|
||||
~PerformanceTiming();
|
||||
|
||||
u32 navigation_start() { return 0; }
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
struct UIEventInit : public DOM::EventInit {
|
||||
RefPtr<DOM::Window> view { nullptr };
|
||||
RefPtr<HTML::Window> view { nullptr };
|
||||
int detail { 0 };
|
||||
};
|
||||
|
||||
@ -33,10 +33,10 @@ public:
|
||||
|
||||
virtual ~UIEvent() override { }
|
||||
|
||||
DOM::Window const* view() const { return m_view; }
|
||||
HTML::Window const* view() const { return m_view; }
|
||||
int detail() const { return m_detail; }
|
||||
|
||||
void init_ui_event(String const& type, bool bubbles, bool cancelable, DOM::Window* view, int detail)
|
||||
void init_ui_event(String const& type, bool bubbles, bool cancelable, HTML::Window* view, int detail)
|
||||
{
|
||||
init_event(type, bubbles, cancelable);
|
||||
m_view = view;
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
RefPtr<DOM::Window> m_view;
|
||||
RefPtr<HTML::Window> m_view;
|
||||
int m_detail { 0 };
|
||||
};
|
||||
|
||||
|
@ -18,11 +18,11 @@
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
#include <LibWeb/DOM/IDLEventListener.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/CloseEvent.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/MessageEvent.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Origin.h>
|
||||
#include <LibWeb/WebSockets/WebSocket.h>
|
||||
|
||||
@ -67,7 +67,7 @@ DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(
|
||||
return WebSocket::create(window.impl(), url_record);
|
||||
}
|
||||
|
||||
WebSocket::WebSocket(DOM::Window& window, AK::URL& url)
|
||||
WebSocket::WebSocket(HTML::Window& window, AK::URL& url)
|
||||
: EventTarget()
|
||||
, m_window(window)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
using WrapperType = Bindings::WebSocketWrapper;
|
||||
|
||||
static NonnullRefPtr<WebSocket> create(DOM::Window& window, AK::URL& url)
|
||||
static NonnullRefPtr<WebSocket> create(HTML::Window& window, AK::URL& url)
|
||||
{
|
||||
return adopt_ref(*new WebSocket(window, url));
|
||||
}
|
||||
@ -100,9 +100,9 @@ private:
|
||||
void on_error();
|
||||
void on_close(u16 code, String reason, bool was_clean);
|
||||
|
||||
explicit WebSocket(DOM::Window&, AK::URL&);
|
||||
explicit WebSocket(HTML::Window&, AK::URL&);
|
||||
|
||||
NonnullRefPtr<DOM::Window> m_window;
|
||||
NonnullRefPtr<HTML::Window> m_window;
|
||||
|
||||
AK::URL m_url;
|
||||
String m_binary_type { "blob" };
|
||||
|
@ -22,10 +22,10 @@
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
#include <LibWeb/DOM/IDLEventListener.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Fetch/AbstractOperations.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Origin.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
namespace Web::XHR {
|
||||
|
||||
XMLHttpRequest::XMLHttpRequest(DOM::Window& window)
|
||||
XMLHttpRequest::XMLHttpRequest(HTML::Window& window)
|
||||
: XMLHttpRequestEventTarget()
|
||||
, m_window(window)
|
||||
, m_response_type(Bindings::XMLHttpRequestResponseType::Empty)
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
using WrapperType = Bindings::XMLHttpRequestWrapper;
|
||||
|
||||
static NonnullRefPtr<XMLHttpRequest> create(DOM::Window& window)
|
||||
static NonnullRefPtr<XMLHttpRequest> create(HTML::Window& window)
|
||||
{
|
||||
return adopt_ref(*new XMLHttpRequest(window));
|
||||
}
|
||||
@ -86,9 +86,9 @@ private:
|
||||
Optional<Vector<String>> get_decode_and_split(String const& header_name, HashMap<String, String, CaseInsensitiveStringTraits> const& header_list) const;
|
||||
Optional<MimeSniff::MimeType> extract_mime_type(HashMap<String, String, CaseInsensitiveStringTraits> const& header_list) const;
|
||||
|
||||
explicit XMLHttpRequest(DOM::Window&);
|
||||
explicit XMLHttpRequest(HTML::Window&);
|
||||
|
||||
NonnullRefPtr<DOM::Window> m_window;
|
||||
NonnullRefPtr<HTML::Window> m_window;
|
||||
|
||||
ReadyState m_ready_state { ReadyState::Unsent };
|
||||
unsigned m_status { 0 };
|
||||
|
@ -17,11 +17,11 @@
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
#include <LibWeb/HTML/Storage.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Loader/ContentFilter.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <LibWeb/Bindings/NodeWrapperFactory.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace WebContent {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user