mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Avoid including Navigable.h in headers
This greatly reduces how much is recompiled when changing Navigable.h, from >1000 to 82.
This commit is contained in:
parent
7bccd65b4a
commit
eeb5446c1b
Notes:
github-actions[bot]
2025-10-20 09:18:20 +00:00
Author: https://github.com/Lubrsi
Commit: eeb5446c1b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6491
Reviewed-by: https://github.com/AtkinsSJ ✅
55 changed files with 170 additions and 64 deletions
|
|
@ -654,6 +654,7 @@ set(SOURCES
|
|||
HTML/TraversableNavigable.cpp
|
||||
HTML/UniversalGlobalScope.cpp
|
||||
HTML/UserActivation.cpp
|
||||
HTML/UserNavigationInvolvement.cpp
|
||||
HTML/ValidityState.cpp
|
||||
HTML/VideoTrack.cpp
|
||||
HTML/VideoTrackList.cpp
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/Painting/BoxModelMetrics.h>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/URLStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/UnicodeRangeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <LibWeb/HTML/HTMLScriptElement.h>
|
||||
#include <LibWeb/HTML/History.h>
|
||||
#include <LibWeb/HTML/NavigationType.h>
|
||||
#include <LibWeb/HTML/PaintConfig.h>
|
||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/VisibilityState.h>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/UserNavigationInvolvement.h>
|
||||
|
||||
namespace Web {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <LibWeb/Fetch/Body.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Bodies.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
|
||||
#include <LibWeb/FileAPI/Blob.h>
|
||||
#include <LibWeb/FileAPI/File.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include <LibWeb/FileAPI/Blob.h>
|
||||
#include <LibWeb/FileAPI/BlobURLStore.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
|
|
|||
|
|
@ -781,6 +781,7 @@ struct EnvironmentSettingsObject;
|
|||
struct NavigationParams;
|
||||
struct OpenerPolicy;
|
||||
struct OpenerPolicyEnforcementResult;
|
||||
struct PaintConfig;
|
||||
struct PolicyContainer;
|
||||
struct POSTResource;
|
||||
struct ScrollOptions;
|
||||
|
|
@ -788,6 +789,7 @@ struct ScrollToOptions;
|
|||
struct SerializedFormData;
|
||||
struct SerializedPolicyContainer;
|
||||
struct SerializedTransferRecord;
|
||||
struct SourceSnapshotParams;
|
||||
struct StructuredSerializeOptions;
|
||||
struct SyntheticRealmSettings;
|
||||
struct ToggleTaskTracker;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <LibWeb/HTML/CloseWatcherManager.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/Reporting.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/HTML/Focus.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/Navigation.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/UIEvents/FocusEvent.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Gamepad/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLBodyElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <LibWeb/HTML/HTMLOutputElement.h>
|
||||
#include <LibWeb/HTML/HTMLSelectElement.h>
|
||||
#include <LibWeb/HTML/HTMLTextAreaElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/RadioNodeList.h>
|
||||
#include <LibWeb/HTML/SubmitEvent.h>
|
||||
#include <LibWeb/Infra/CharacterTypes.h>
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@
|
|||
|
||||
#include <AK/Time.h>
|
||||
#include <LibWeb/ARIA/Roles.h>
|
||||
#include <LibWeb/Bindings/NavigationPrototype.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/UserNavigationInvolvement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/TokenizedFeatures.h>
|
||||
#include <LibWeb/HTML/UserNavigationInvolvement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
#include <LibWeb/HTML/HTMLObjectElement.h>
|
||||
#include <LibWeb/HTML/ImageRequest.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/PotentialCORSRequest.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <LibWeb/HTML/HTMLOptGroupElement.h>
|
||||
#include <LibWeb/HTML/HTMLOptionElement.h>
|
||||
#include <LibWeb/HTML/HTMLSelectElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchController.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Statuses.h>
|
||||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
#include <LibWeb/HTML/HTMLTrackElement.h>
|
||||
#include <LibWeb/HTML/PotentialCORSRequest.h>
|
||||
|
|
|
|||
16
Libraries/LibWeb/HTML/InitialInsertion.h
Normal file
16
Libraries/LibWeb/HTML/InitialInsertion.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
enum class InitialInsertion : u8 {
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
|
||||
#include <LibWeb/HTML/Location.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Navigation.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/WebIDL/DOMException.h>
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@
|
|||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Bindings/NavigationPrototype.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
|
|||
|
|
@ -2503,20 +2503,6 @@ void Navigable::inform_the_navigation_api_about_aborting_navigation()
|
|||
}));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#event-uni
|
||||
UserNavigationInvolvement user_navigation_involvement(DOM::Event const& event)
|
||||
{
|
||||
// For convenience at certain call sites, the user navigation involvement for an Event event is defined as follows:
|
||||
|
||||
// 1. Assert: this algorithm is being called as part of an activation behavior definition.
|
||||
// 2. Assert: event's type is "click".
|
||||
VERIFY(event.type() == "click"_fly_string);
|
||||
|
||||
// 3. If event's isTrusted is initialized to true, then return "activation".
|
||||
// 4. Return "none".
|
||||
return event.is_trusted() ? UserNavigationInvolvement::Activation : UserNavigationInvolvement::None;
|
||||
}
|
||||
|
||||
bool Navigable::is_focused() const
|
||||
{
|
||||
return &m_page->focused_navigable() == this;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/ActivateTab.h>
|
||||
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
||||
#include <LibWeb/HTML/InitialInsertion.h>
|
||||
#include <LibWeb/HTML/NavigationParams.h>
|
||||
#include <LibWeb/HTML/POSTResource.h>
|
||||
#include <LibWeb/HTML/RenderingThread.h>
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
#include <LibWeb/HTML/SourceSnapshotParams.h>
|
||||
#include <LibWeb/HTML/StructuredSerializeTypes.h>
|
||||
#include <LibWeb/HTML/TokenizedFeatures.h>
|
||||
#include <LibWeb/HTML/WindowType.h>
|
||||
#include <LibWeb/InvalidateDisplayList.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
#include <LibWeb/Painting/BackingStoreManager.h>
|
||||
|
|
@ -32,24 +34,11 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
enum class InitialInsertion : u8 {
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#target-snapshot-params
|
||||
struct TargetSnapshotParams {
|
||||
SandboxingFlagSet sandboxing_flags {};
|
||||
};
|
||||
|
||||
struct PaintConfig {
|
||||
bool paint_overlay { false };
|
||||
bool should_show_line_box_borders { false };
|
||||
Optional<Gfx::IntRect> canvas_fill_rect {};
|
||||
|
||||
bool operator==(PaintConfig const& other) const = default;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#navigable
|
||||
class WEB_API Navigable : public JS::Cell {
|
||||
GC_CELL(Navigable, JS::Cell);
|
||||
|
|
@ -111,12 +100,6 @@ public:
|
|||
|
||||
[[nodiscard]] bool is_focused() const;
|
||||
|
||||
enum class WindowType {
|
||||
ExistingOrNone,
|
||||
NewAndUnrestricted,
|
||||
NewWithNoOpener,
|
||||
};
|
||||
|
||||
struct ChosenNavigable {
|
||||
GC::Ptr<Navigable> navigable;
|
||||
WindowType window_type;
|
||||
|
|
@ -306,6 +289,5 @@ WEB_API HashTable<GC::RawRef<Navigable>>& all_navigables();
|
|||
bool navigation_must_be_a_replace(URL::URL const& url, DOM::Document const& document);
|
||||
void finalize_a_cross_document_navigation(GC::Ref<Navigable>, HistoryHandlingBehavior, UserNavigationInvolvement, GC::Ref<SessionHistoryEntry>);
|
||||
void perform_url_and_history_update_steps(DOM::Document& document, URL::URL new_url, Optional<SerializationRecord> = {}, HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Replace);
|
||||
UserNavigationInvolvement user_navigation_involvement(DOM::Event const&);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,4 +351,18 @@ bool NavigableContainer::currently_delays_the_load_event() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool NavigableContainer::content_navigable_has_session_history_entry_and_ready_for_navigation() const
|
||||
{
|
||||
if (!content_navigable())
|
||||
return false;
|
||||
return m_content_navigable->has_session_history_entry_and_ready_for_navigation();
|
||||
}
|
||||
|
||||
void NavigableContainer::set_content_navigable_has_session_history_entry_and_ready_for_navigation()
|
||||
{
|
||||
if (!content_navigable())
|
||||
return;
|
||||
content_navigable()->set_has_session_history_entry_and_ready_for_navigation();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <LibWeb/Export.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/InitialInsertion.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
@ -39,12 +39,7 @@ public:
|
|||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#potentially-delays-the-load-event
|
||||
bool currently_delays_the_load_event() const;
|
||||
|
||||
bool content_navigable_has_session_history_entry_and_ready_for_navigation() const
|
||||
{
|
||||
if (!content_navigable())
|
||||
return false;
|
||||
return m_content_navigable->has_session_history_entry_and_ready_for_navigation();
|
||||
}
|
||||
bool content_navigable_has_session_history_entry_and_ready_for_navigation() const;
|
||||
|
||||
protected:
|
||||
NavigableContainer(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
@ -64,12 +59,7 @@ protected:
|
|||
|
||||
void set_potentially_delays_the_load_event(bool value) { m_potentially_delays_the_load_event = value; }
|
||||
|
||||
void set_content_navigable_has_session_history_entry_and_ready_for_navigation()
|
||||
{
|
||||
if (!content_navigable())
|
||||
return;
|
||||
content_navigable()->set_has_session_history_entry_and_ready_for_navigation();
|
||||
}
|
||||
void set_content_navigable_has_session_history_entry_and_ready_for_navigation();
|
||||
|
||||
private:
|
||||
virtual bool is_navigable_container() const override { return true; }
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
#include <LibWeb/Bindings/NavigationPrototype.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/NavigationType.h>
|
||||
#include <LibWeb/HTML/StructuredSerializeTypes.h>
|
||||
#include <LibWeb/HTML/UserNavigationInvolvement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,10 @@
|
|||
#include <LibWeb/HTML/CrossOrigin/OpenerPolicyEnforcementResult.h>
|
||||
#include <LibWeb/HTML/PolicyContainers.h>
|
||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||
#include <LibWeb/HTML/UserNavigationInvolvement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#user-navigation-involvement
|
||||
enum class UserNavigationInvolvement {
|
||||
BrowserUI,
|
||||
Activation,
|
||||
None,
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigation-params
|
||||
struct NavigationParams : GC::Cell {
|
||||
GC_CELL(NavigationParams, GC::Cell);
|
||||
|
|
|
|||
19
Libraries/LibWeb/HTML/PaintConfig.h
Normal file
19
Libraries/LibWeb/HTML/PaintConfig.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
struct PaintConfig {
|
||||
bool paint_overlay { false };
|
||||
bool should_show_line_box_borders { false };
|
||||
Optional<Gfx::IntRect> canvas_fill_rect {};
|
||||
|
||||
bool operator==(PaintConfig const& other) const = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/PrincipalHostDefined.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibGC/RootVector.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/StoragePrototype.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Storage.h>
|
||||
#include <LibWeb/HTML/StorageEvent.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
|
|
|||
26
Libraries/LibWeb/HTML/UserNavigationInvolvement.cpp
Normal file
26
Libraries/LibWeb/HTML/UserNavigationInvolvement.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Andrew Kaster <andrew@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/HTML/UserNavigationInvolvement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#event-uni
|
||||
UserNavigationInvolvement user_navigation_involvement(DOM::Event const& event)
|
||||
{
|
||||
// For convenience at certain call sites, the user navigation involvement for an Event event is defined as follows:
|
||||
|
||||
// 1. Assert: this algorithm is being called as part of an activation behavior definition.
|
||||
// 2. Assert: event's type is "click".
|
||||
VERIFY(event.type() == "click"_fly_string);
|
||||
|
||||
// 3. If event's isTrusted is initialized to true, then return "activation".
|
||||
// 4. Return "none".
|
||||
return event.is_trusted() ? UserNavigationInvolvement::Activation : UserNavigationInvolvement::None;
|
||||
}
|
||||
|
||||
}
|
||||
22
Libraries/LibWeb/HTML/UserNavigationInvolvement.h
Normal file
22
Libraries/LibWeb/HTML/UserNavigationInvolvement.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Andrew Kaster <andrew@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#user-navigation-involvement
|
||||
enum class UserNavigationInvolvement {
|
||||
BrowserUI,
|
||||
Activation,
|
||||
None,
|
||||
};
|
||||
|
||||
UserNavigationInvolvement user_navigation_involvement(DOM::Event const&);
|
||||
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ WebIDL::ExceptionOr<GC::Ptr<WindowProxy>> Window::window_open_steps(StringView u
|
|||
return nullptr;
|
||||
|
||||
// 17. If noopener is true or windowType is "new with no opener", then return null.
|
||||
if (no_opener == TokenizedFeature::NoOpener::Yes || window_type == Navigable::WindowType::NewWithNoOpener)
|
||||
if (no_opener == TokenizedFeature::NoOpener::Yes || window_type == WindowType::NewWithNoOpener)
|
||||
return nullptr;
|
||||
|
||||
// 18. Return targetNavigable's active WindowProxy.
|
||||
|
|
@ -254,7 +254,7 @@ WebIDL::ExceptionOr<Window::OpenedWindow> Window::window_open_steps_internal(Str
|
|||
return OpenedWindow {};
|
||||
|
||||
// 15. If windowType is either "new and unrestricted" or "new with no opener", then:
|
||||
if (window_type == Navigable::WindowType::NewAndUnrestricted || window_type == Navigable::WindowType::NewWithNoOpener) {
|
||||
if (window_type == WindowType::NewAndUnrestricted || window_type == WindowType::NewWithNoOpener) {
|
||||
// 1. Set targetNavigable's active browsing context's is popup to the result of checking if a popup window is requested, given tokenizedFeatures.
|
||||
target_navigable->active_browsing_context()->set_is_popup(check_if_a_popup_window_is_requested(tokenized_features));
|
||||
|
||||
|
|
|
|||
|
|
@ -19,14 +19,13 @@
|
|||
#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
|
||||
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
||||
#include <LibWeb/HTML/MimeType.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Navigation.h>
|
||||
#include <LibWeb/HTML/Plugin.h>
|
||||
#include <LibWeb/HTML/ScrollOptions.h>
|
||||
#include <LibWeb/HTML/StructuredSerializeOptions.h>
|
||||
#include <LibWeb/HTML/UniversalGlobalScope.h>
|
||||
#include <LibWeb/HTML/WindowEventHandlers.h>
|
||||
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
|
||||
#include <LibWeb/HTML/WindowType.h>
|
||||
#include <LibWeb/RequestIdleCallback/IdleRequest.h>
|
||||
#include <LibWeb/WebIDL/Types.h>
|
||||
|
||||
|
|
@ -123,7 +122,7 @@ public:
|
|||
struct OpenedWindow {
|
||||
GC::Ptr<Navigable> navigable;
|
||||
TokenizedFeature::NoOpener no_opener { TokenizedFeature::NoOpener::No };
|
||||
Navigable::WindowType window_type { Navigable::WindowType::ExistingOrNone };
|
||||
WindowType window_type { WindowType::ExistingOrNone };
|
||||
};
|
||||
WebIDL::ExceptionOr<OpenedWindow> window_open_steps_internal(StringView url, StringView target, StringView features);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/Reporting.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HTML/WindowProxy.h>
|
||||
|
|
|
|||
17
Libraries/LibWeb/HTML/WindowType.h
Normal file
17
Libraries/LibWeb/HTML/WindowType.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
enum class WindowType {
|
||||
ExistingOrNone,
|
||||
NewAndUnrestricted,
|
||||
NewWithNoOpener,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
#include <LibWeb/DOM/NodeList.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Internals/InternalGamepad.h>
|
||||
#include <LibWeb/Internals/Internals.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/HTMLObjectElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/NavigableContainerViewport.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Painting/NavigableContainerViewportPaintable.h>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||
#include <LibWeb/HTML/HTMLHtmlElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/BlockContainer.h>
|
||||
#include <LibWeb/Layout/FormattingContext.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Fetch/Response.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/MixedContent/AbstractOperations.h>
|
||||
#include <LibWeb/SecureContexts/AbstractOperations.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
#include <LibWeb/HTML/HTMLVideoElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Navigator.h>
|
||||
#include <LibWeb/Layout/Label.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/CSS/Sizing.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibWeb/Export.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/Label.h>
|
||||
#include <LibWeb/Painting/LabelablePaintable.h>
|
||||
#include <LibWeb/UIEvents/MouseButton.h>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/HTMLAudioElement.h>
|
||||
#include <LibWeb/HTML/HTMLVideoElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/ReplacedBox.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/NavigableContainer.h>
|
||||
#include <LibWeb/Layout/NavigableContainerViewport.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <LibWeb/DOM/Position.h>
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/HTML/HTMLHtmlElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/BlockContainer.h>
|
||||
#include <LibWeb/Layout/InlineNode.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/Layout/Label.h>
|
||||
#include <LibWeb/Layout/LabelableNode.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/URL.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/ReferrerPolicy/AbstractOperations.h>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/SVGScriptElementPrototype.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Bindings/PointerEventPrototype.h>
|
||||
#include <LibWeb/UIEvents/MouseButton.h>
|
||||
#include <LibWeb/UIEvents/PointerEvent.h>
|
||||
|
||||
namespace Web::UIEvents {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/CSS/CSSKeyframesRule.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue