mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Make DOM Node unique IDs strongly typed (and 64 bit)
This is strictly nicer than passing them around as i32 everywhere, and by switching to i64 as the underlying type, ID allocation becomes as simple as incrementing an integer.
This commit is contained in:
parent
eca2318390
commit
4fdb266077
Notes:
github-actions[bot]
2024-10-20 11:43:23 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/4fdb266077d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1878
28 changed files with 227 additions and 189 deletions
|
@ -11,7 +11,7 @@
|
|||
namespace Web::CSS {
|
||||
|
||||
// https://drafts.csswg.org/css-lists-3/#instantiate-counter
|
||||
Counter& CountersSet::instantiate_a_counter(FlyString name, i32 originating_element_id, bool reversed, Optional<CounterValue> value)
|
||||
Counter& CountersSet::instantiate_a_counter(FlyString name, UniqueNodeID originating_element_id, bool reversed, Optional<CounterValue> value)
|
||||
{
|
||||
// 1. Let counters be element’s CSS counters set.
|
||||
auto* element = DOM::Node::from_unique_id(originating_element_id);
|
||||
|
@ -48,7 +48,7 @@ Counter& CountersSet::instantiate_a_counter(FlyString name, i32 originating_elem
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/css-lists-3/#propdef-counter-set
|
||||
void CountersSet::set_a_counter(FlyString name, i32 originating_element_id, CounterValue value)
|
||||
void CountersSet::set_a_counter(FlyString name, UniqueNodeID originating_element_id, CounterValue value)
|
||||
{
|
||||
if (auto existing_counter = last_counter_with_name(name); existing_counter.has_value()) {
|
||||
existing_counter->value = value;
|
||||
|
@ -63,7 +63,7 @@ void CountersSet::set_a_counter(FlyString name, i32 originating_element_id, Coun
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/css-lists-3/#propdef-counter-increment
|
||||
void CountersSet::increment_a_counter(FlyString name, i32 originating_element_id, CounterValue amount)
|
||||
void CountersSet::increment_a_counter(FlyString name, UniqueNodeID originating_element_id, CounterValue amount)
|
||||
{
|
||||
if (auto existing_counter = last_counter_with_name(name); existing_counter.has_value()) {
|
||||
// FIXME: How should we handle existing counters with no value? Can that happen?
|
||||
|
@ -88,7 +88,7 @@ Optional<Counter&> CountersSet::last_counter_with_name(FlyString const& name)
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<Counter&> CountersSet::counter_with_same_name_and_creator(FlyString const& name, i32 originating_element_id)
|
||||
Optional<Counter&> CountersSet::counter_with_same_name_and_creator(FlyString const& name, UniqueNodeID originating_element_id)
|
||||
{
|
||||
return m_counters.first_matching([&](auto& it) {
|
||||
return it.name == name && it.originating_element_id == originating_element_id;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Checked.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -21,7 +22,7 @@ using CounterValue = Checked<i32>;
|
|||
// https://drafts.csswg.org/css-lists-3/#counter
|
||||
struct Counter {
|
||||
FlyString name;
|
||||
i32 originating_element_id; // "creator"
|
||||
UniqueNodeID originating_element_id; // "creator"
|
||||
bool reversed { false };
|
||||
Optional<CounterValue> value;
|
||||
};
|
||||
|
@ -32,13 +33,13 @@ public:
|
|||
CountersSet() = default;
|
||||
~CountersSet() = default;
|
||||
|
||||
Counter& instantiate_a_counter(FlyString name, i32 originating_element_id, bool reversed, Optional<CounterValue>);
|
||||
void set_a_counter(FlyString name, i32 originating_element_id, CounterValue value);
|
||||
void increment_a_counter(FlyString name, i32 originating_element_id, CounterValue amount);
|
||||
Counter& instantiate_a_counter(FlyString name, UniqueNodeID originating_element_id, bool reversed, Optional<CounterValue>);
|
||||
void set_a_counter(FlyString name, UniqueNodeID originating_element_id, CounterValue value);
|
||||
void increment_a_counter(FlyString name, UniqueNodeID originating_element_id, CounterValue amount);
|
||||
void append_copy(Counter const&);
|
||||
|
||||
Optional<Counter&> last_counter_with_name(FlyString const& name);
|
||||
Optional<Counter&> counter_with_same_name_and_creator(FlyString const& name, i32 originating_element_id);
|
||||
Optional<Counter&> counter_with_same_name_and_creator(FlyString const& name, UniqueNodeID originating_element_id);
|
||||
|
||||
Vector<Counter> const& counters() const { return m_counters; }
|
||||
bool is_empty() const { return m_counters.is_empty(); }
|
||||
|
|
|
@ -50,7 +50,8 @@ template<>
|
|||
ErrorOr<void> encode(Encoder& encoder, Web::CSS::StyleSheetIdentifier const& style_sheet_source)
|
||||
{
|
||||
TRY(encoder.encode(style_sheet_source.type));
|
||||
TRY(encoder.encode(style_sheet_source.dom_element_unique_id));
|
||||
Optional<i64> dom_element_unique_id = style_sheet_source.dom_element_unique_id.has_value() ? Optional<i64>(style_sheet_source.dom_element_unique_id.value()) : Optional<i64> {};
|
||||
TRY(encoder.encode(dom_element_unique_id));
|
||||
TRY(encoder.encode(style_sheet_source.url));
|
||||
|
||||
return {};
|
||||
|
@ -60,12 +61,12 @@ template<>
|
|||
ErrorOr<Web::CSS::StyleSheetIdentifier> decode(Decoder& decoder)
|
||||
{
|
||||
auto type = TRY(decoder.decode<Web::CSS::StyleSheetIdentifier::Type>());
|
||||
auto dom_element_unique_id = TRY(decoder.decode<Optional<i32>>());
|
||||
auto dom_element_unique_id = TRY(decoder.decode<Optional<i64>>());
|
||||
auto url = TRY(decoder.decode<Optional<String>>());
|
||||
|
||||
return Web::CSS::StyleSheetIdentifier {
|
||||
.type = type,
|
||||
.dom_element_unique_id = move(dom_element_unique_id),
|
||||
.dom_element_unique_id = dom_element_unique_id.has_value() ? Web::UniqueNodeID(dom_element_unique_id.value()) : Optional<Web::UniqueNodeID> {},
|
||||
.url = move(url),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -19,7 +20,7 @@ struct StyleSheetIdentifier {
|
|||
UserAgent,
|
||||
UserStyle,
|
||||
} type;
|
||||
Optional<i32> dom_element_unique_id {};
|
||||
Optional<UniqueNodeID> dom_element_unique_id {};
|
||||
Optional<String> url {};
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
|||
MUST(object.add("name"sv, name));
|
||||
auto description = MUST(element->accessible_description(document));
|
||||
MUST(object.add("description"sv, description));
|
||||
MUST(object.add("id"sv, element->unique_id()));
|
||||
MUST(object.add("id"sv, element->unique_id().value()));
|
||||
|
||||
if (has_role)
|
||||
MUST(object.add("role"sv, ARIA::role_name(*role)));
|
||||
|
|
|
@ -1169,7 +1169,7 @@ void Element::serialize_pseudo_elements_as_json(JsonArraySerializer<StringBuilde
|
|||
auto object = MUST(children_array.add_object());
|
||||
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::Selector::PseudoElement::name(static_cast<CSS::Selector::PseudoElement::Type>(i))))));
|
||||
MUST(object.add("type"sv, "pseudo-element"));
|
||||
MUST(object.add("parent-id"sv, unique_id()));
|
||||
MUST(object.add("parent-id"sv, unique_id().value()));
|
||||
MUST(object.add("pseudo-element"sv, i));
|
||||
MUST(object.finish());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2023, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/IDAllocator.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibJS/Heap/DeferGC.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
|
@ -50,24 +49,24 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
static IDAllocator s_unique_id_allocator;
|
||||
static HashMap<i32, Node*> s_node_directory;
|
||||
static UniqueNodeID s_next_unique_id;
|
||||
static HashMap<UniqueNodeID, Node*> s_node_directory;
|
||||
|
||||
static i32 allocate_unique_id(Node* node)
|
||||
static UniqueNodeID allocate_unique_id(Node* node)
|
||||
{
|
||||
i32 id = s_unique_id_allocator.allocate();
|
||||
auto id = s_next_unique_id;
|
||||
++s_next_unique_id;
|
||||
s_node_directory.set(id, node);
|
||||
return id;
|
||||
}
|
||||
|
||||
static void deallocate_unique_id(i32 node_id)
|
||||
static void deallocate_unique_id(UniqueNodeID node_id)
|
||||
{
|
||||
if (!s_node_directory.remove(node_id))
|
||||
VERIFY_NOT_REACHED();
|
||||
s_unique_id_allocator.deallocate(node_id);
|
||||
}
|
||||
|
||||
Node* Node::from_unique_id(i32 unique_id)
|
||||
Node* Node::from_unique_id(UniqueNodeID unique_id)
|
||||
{
|
||||
return s_node_directory.get(unique_id).value_or(nullptr);
|
||||
}
|
||||
|
@ -1386,7 +1385,7 @@ bool Node::is_uninteresting_whitespace_node() const
|
|||
void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) const
|
||||
{
|
||||
MUST(object.add("name"sv, node_name()));
|
||||
MUST(object.add("id"sv, unique_id()));
|
||||
MUST(object.add("id"sv, unique_id().value()));
|
||||
if (is_document()) {
|
||||
MUST(object.add("type"sv, "document"));
|
||||
} else if (is_element()) {
|
||||
|
@ -2184,7 +2183,7 @@ void Node::build_accessibility_tree(AccessibilityTreeNode& parent)
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_te
|
||||
ErrorOr<String> Node::name_or_description(NameOrDescription target, Document const& document, HashTable<i32>& visited_nodes) const
|
||||
ErrorOr<String> Node::name_or_description(NameOrDescription target, Document const& document, HashTable<UniqueNodeID>& visited_nodes) const
|
||||
{
|
||||
// The text alternative for a given element is computed as follows:
|
||||
// 1. Set the root node to the given element, the current node to the root node, and the total accumulated text to the empty string (""). If the root node's role prohibits naming, return the empty string ("").
|
||||
|
@ -2321,7 +2320,7 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
|
|||
// https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_name
|
||||
ErrorOr<String> Node::accessible_name(Document const& document) const
|
||||
{
|
||||
HashTable<i32> visited_nodes;
|
||||
HashTable<UniqueNodeID> visited_nodes;
|
||||
// User agents MUST compute an accessible name using the rules outlined below in the section titled Accessible Name and Description Computation.
|
||||
return name_or_description(NameOrDescription::Name, document, visited_nodes);
|
||||
}
|
||||
|
@ -2339,7 +2338,7 @@ ErrorOr<String> Node::accessible_description(Document const& document) const
|
|||
if (!described_by.has_value())
|
||||
return String {};
|
||||
|
||||
HashTable<i32> visited_nodes;
|
||||
HashTable<UniqueNodeID> visited_nodes;
|
||||
StringBuilder builder;
|
||||
auto id_list = described_by->bytes_as_string_view().split_view_if(Infra::is_ascii_whitespace);
|
||||
for (auto const& id : id_list) {
|
||||
|
@ -2434,3 +2433,20 @@ void Node::add_registered_observer(RegisteredObserver& registered_observer)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder& encoder, Web::UniqueNodeID const& value)
|
||||
{
|
||||
return encode(encoder, value.value());
|
||||
}
|
||||
|
||||
template<>
|
||||
ErrorOr<Web::UniqueNodeID> decode(Decoder& decoder)
|
||||
{
|
||||
auto value = TRY(decoder.decode<i64>());
|
||||
return Web::UniqueNodeID(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2023, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/DistinctNumeric.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/GenericShorthands.h>
|
||||
#include <AK/JsonObjectSerializer.h>
|
||||
|
@ -287,8 +288,8 @@ public:
|
|||
bool is_shadow_including_ancestor_of(Node const&) const;
|
||||
bool is_shadow_including_inclusive_ancestor_of(Node const&) const;
|
||||
|
||||
i32 unique_id() const { return m_unique_id; }
|
||||
static Node* from_unique_id(i32);
|
||||
[[nodiscard]] UniqueNodeID unique_id() const { return m_unique_id; }
|
||||
static Node* from_unique_id(UniqueNodeID);
|
||||
|
||||
WebIDL::ExceptionOr<String> serialize_fragment(DOMParsing::RequireWellFormed, FragmentSerializationMode = FragmentSerializationMode::Inner) const;
|
||||
|
||||
|
@ -752,7 +753,7 @@ protected:
|
|||
bool m_needs_style_update { false };
|
||||
bool m_child_needs_style_update { false };
|
||||
|
||||
i32 m_unique_id {};
|
||||
UniqueNodeID m_unique_id;
|
||||
|
||||
// https://dom.spec.whatwg.org/#registered-observer-list
|
||||
// "Nodes have a strong reference to registered observers in their registered observer list." https://dom.spec.whatwg.org/#garbage-collection
|
||||
|
@ -760,7 +761,7 @@ protected:
|
|||
|
||||
void build_accessibility_tree(AccessibilityTreeNode& parent);
|
||||
|
||||
ErrorOr<String> name_or_description(NameOrDescription, Document const&, HashTable<i32>&) const;
|
||||
ErrorOr<String> name_or_description(NameOrDescription, Document const&, HashTable<UniqueNodeID>&) const;
|
||||
|
||||
private:
|
||||
void queue_tree_mutation_record(Vector<JS::Handle<Node>> added_nodes, Vector<JS::Handle<Node>> removed_nodes, Node* previous_sibling, Node* next_sibling);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2023, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2020-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2023, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -7,7 +7,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DistinctNumeric.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <LibJS/Forward.h>
|
||||
|
||||
namespace Web {
|
||||
|
@ -24,6 +26,8 @@ class XMLDocumentBuilder;
|
|||
|
||||
enum class InvalidateDisplayList;
|
||||
enum class TraversalDecision;
|
||||
|
||||
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(i64, UniqueNodeID, Comparison, Increment, CastToUnderlying);
|
||||
}
|
||||
|
||||
namespace Web::Painting {
|
||||
|
@ -829,3 +833,13 @@ class XMLHttpRequestUpload;
|
|||
|
||||
struct FormDataEntry;
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, Web::UniqueNodeID const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<Web::UniqueNodeID> decode(Decoder&);
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ void Inspector::inspector_loaded()
|
|||
inspector_page_client().inspector_did_load();
|
||||
}
|
||||
|
||||
void Inspector::inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_element)
|
||||
void Inspector::inspect_dom_node(i64 node_id, Optional<i32> const& pseudo_element)
|
||||
{
|
||||
inspector_page_client().inspector_did_select_dom_node(node_id, pseudo_element.map([](auto value) {
|
||||
VERIFY(value < to_underlying(Web::CSS::Selector::PseudoElement::Type::KnownPseudoElementCount));
|
||||
|
@ -49,27 +49,27 @@ void Inspector::inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_elemen
|
|||
}));
|
||||
}
|
||||
|
||||
void Inspector::set_dom_node_text(i32 node_id, String const& text)
|
||||
void Inspector::set_dom_node_text(i64 node_id, String const& text)
|
||||
{
|
||||
inspector_page_client().inspector_did_set_dom_node_text(node_id, text);
|
||||
}
|
||||
|
||||
void Inspector::set_dom_node_tag(i32 node_id, String const& tag)
|
||||
void Inspector::set_dom_node_tag(i64 node_id, String const& tag)
|
||||
{
|
||||
inspector_page_client().inspector_did_set_dom_node_tag(node_id, tag);
|
||||
}
|
||||
|
||||
void Inspector::add_dom_node_attributes(i32 node_id, JS::NonnullGCPtr<DOM::NamedNodeMap> attributes)
|
||||
void Inspector::add_dom_node_attributes(i64 node_id, JS::NonnullGCPtr<DOM::NamedNodeMap> attributes)
|
||||
{
|
||||
inspector_page_client().inspector_did_add_dom_node_attributes(node_id, attributes);
|
||||
}
|
||||
|
||||
void Inspector::replace_dom_node_attribute(i32 node_id, WebIDL::UnsignedLongLong attribute_index, JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes)
|
||||
void Inspector::replace_dom_node_attribute(i64 node_id, WebIDL::UnsignedLongLong attribute_index, JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes)
|
||||
{
|
||||
inspector_page_client().inspector_did_replace_dom_node_attribute(node_id, static_cast<size_t>(attribute_index), replacement_attributes);
|
||||
}
|
||||
|
||||
void Inspector::request_dom_tree_context_menu(i32 node_id, i32 client_x, i32 client_y, String const& type, Optional<String> const& tag, Optional<WebIDL::UnsignedLongLong> const& attribute_index)
|
||||
void Inspector::request_dom_tree_context_menu(i64 node_id, i32 client_x, i32 client_y, String const& type, Optional<String> const& tag, Optional<WebIDL::UnsignedLongLong> const& attribute_index)
|
||||
{
|
||||
inspector_page_client().inspector_did_request_dom_tree_context_menu(node_id, { client_x, client_y }, type, tag, attribute_index.map([](auto index) { return static_cast<size_t>(index); }));
|
||||
}
|
||||
|
@ -79,14 +79,18 @@ void Inspector::request_cookie_context_menu(WebIDL::UnsignedLongLong cookie_inde
|
|||
inspector_page_client().inspector_did_request_cookie_context_menu(cookie_index, { client_x, client_y });
|
||||
}
|
||||
|
||||
void Inspector::request_style_sheet_source(String const& type_string, Optional<i32> const& dom_node_unique_id, Optional<String> const& url)
|
||||
void Inspector::request_style_sheet_source(String const& type_string, Optional<i64> const& dom_node_unique_id, Optional<String> const& url)
|
||||
{
|
||||
auto type = CSS::style_sheet_identifier_type_from_string(type_string);
|
||||
VERIFY(type.has_value());
|
||||
|
||||
Optional<UniqueNodeID> dom_node_unique_id_opt;
|
||||
if (dom_node_unique_id.has_value())
|
||||
dom_node_unique_id_opt = dom_node_unique_id.value();
|
||||
|
||||
inspector_page_client().inspector_did_request_style_sheet_source({
|
||||
.type = type.value(),
|
||||
.dom_element_unique_id = dom_node_unique_id,
|
||||
.dom_element_unique_id = dom_node_unique_id_opt,
|
||||
.url = url,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,18 +20,18 @@ public:
|
|||
virtual ~Inspector() override;
|
||||
|
||||
void inspector_loaded();
|
||||
void inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_element);
|
||||
void inspect_dom_node(i64 node_id, Optional<i32> const& pseudo_element);
|
||||
|
||||
void set_dom_node_text(i32 node_id, String const& text);
|
||||
void set_dom_node_tag(i32 node_id, String const& tag);
|
||||
void add_dom_node_attributes(i32 node_id, JS::NonnullGCPtr<DOM::NamedNodeMap> attributes);
|
||||
void replace_dom_node_attribute(i32 node_id, WebIDL::UnsignedLongLong attribute_index, JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes);
|
||||
void set_dom_node_text(i64 node_id, String const& text);
|
||||
void set_dom_node_tag(i64 node_id, String const& tag);
|
||||
void add_dom_node_attributes(i64 node_id, JS::NonnullGCPtr<DOM::NamedNodeMap> attributes);
|
||||
void replace_dom_node_attribute(i64 node_id, WebIDL::UnsignedLongLong attribute_index, JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes);
|
||||
|
||||
void request_dom_tree_context_menu(i32 node_id, i32 client_x, i32 client_y, String const& type, Optional<String> const& tag, Optional<WebIDL::UnsignedLongLong> const& attribute_index);
|
||||
void request_dom_tree_context_menu(i64 node_id, i32 client_x, i32 client_y, String const& type, Optional<String> const& tag, Optional<WebIDL::UnsignedLongLong> const& attribute_index);
|
||||
|
||||
void request_cookie_context_menu(WebIDL::UnsignedLongLong cookie_index, i32 client_x, i32 client_y);
|
||||
|
||||
void request_style_sheet_source(String const& type, Optional<i32> const& dom_node_unique_id, Optional<String> const& url);
|
||||
void request_style_sheet_source(String const& type, Optional<i64> const& dom_node_unique_id, Optional<String> const& url);
|
||||
|
||||
void execute_console_script(String const& script);
|
||||
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
[Exposed=Nobody] interface Inspector {
|
||||
|
||||
undefined inspectorLoaded();
|
||||
undefined inspectDOMNode(long nodeID, optional long pseudoElement);
|
||||
undefined inspectDOMNode(long long nodeID, optional long pseudoElement);
|
||||
|
||||
undefined setDOMNodeText(long nodeID, DOMString text);
|
||||
undefined setDOMNodeTag(long nodeID, DOMString tag);
|
||||
undefined addDOMNodeAttributes(long nodeID, NamedNodeMap attributes);
|
||||
undefined replaceDOMNodeAttribute(long nodeID, unsigned long long attributeIndex, NamedNodeMap replacementAttributes);
|
||||
undefined setDOMNodeText(long long nodeID, DOMString text);
|
||||
undefined setDOMNodeTag(long long nodeID, DOMString tag);
|
||||
undefined addDOMNodeAttributes(long long nodeID, NamedNodeMap attributes);
|
||||
undefined replaceDOMNodeAttribute(long long nodeID, unsigned long long attributeIndex, NamedNodeMap replacementAttributes);
|
||||
|
||||
undefined requestDOMTreeContextMenu(long nodeID, long clientX, long clientY, DOMString type, DOMString? tag, unsigned long long? attributeIndex);
|
||||
undefined requestDOMTreeContextMenu(long long nodeID, long clientX, long clientY, DOMString type, DOMString? tag, unsigned long long? attributeIndex);
|
||||
|
||||
undefined requestCookieContextMenu(unsigned long long cookieIndex, long clientX, long clientY);
|
||||
|
||||
undefined requestStyleSheetSource(DOMString type, long? domNodeID, DOMString? url);
|
||||
undefined requestStyleSheetSource(DOMString type, long long? domNodeID, DOMString? url);
|
||||
|
||||
undefined executeConsoleScript(DOMString script);
|
||||
|
||||
|
|
|
@ -432,19 +432,19 @@ void Page::select_dropdown_closed(Optional<u32> const& selected_item_id)
|
|||
}
|
||||
}
|
||||
|
||||
void Page::register_media_element(Badge<HTML::HTMLMediaElement>, int media_id)
|
||||
void Page::register_media_element(Badge<HTML::HTMLMediaElement>, UniqueNodeID media_id)
|
||||
{
|
||||
m_media_elements.append(media_id);
|
||||
}
|
||||
|
||||
void Page::unregister_media_element(Badge<HTML::HTMLMediaElement>, int media_id)
|
||||
void Page::unregister_media_element(Badge<HTML::HTMLMediaElement>, UniqueNodeID media_id)
|
||||
{
|
||||
m_media_elements.remove_all_matching([&](auto candidate_id) {
|
||||
return candidate_id == media_id;
|
||||
});
|
||||
}
|
||||
|
||||
void Page::did_request_media_context_menu(i32 media_id, CSSPixelPoint position, ByteString const& target, unsigned modifiers, MediaContextMenu menu)
|
||||
void Page::did_request_media_context_menu(UniqueNodeID media_id, CSSPixelPoint position, ByteString const& target, unsigned modifiers, MediaContextMenu menu)
|
||||
{
|
||||
m_media_context_menu_element_id = media_id;
|
||||
client().page_did_request_media_context_menu(position, target, modifiers, move(menu));
|
||||
|
|
|
@ -164,8 +164,8 @@ public:
|
|||
Select,
|
||||
};
|
||||
|
||||
void register_media_element(Badge<HTML::HTMLMediaElement>, int media_id);
|
||||
void unregister_media_element(Badge<HTML::HTMLMediaElement>, int media_id);
|
||||
void register_media_element(Badge<HTML::HTMLMediaElement>, UniqueNodeID media_id);
|
||||
void unregister_media_element(Badge<HTML::HTMLMediaElement>, UniqueNodeID media_id);
|
||||
|
||||
struct MediaContextMenu {
|
||||
URL::URL media_url;
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
bool has_user_agent_controls { false };
|
||||
bool is_looping { false };
|
||||
};
|
||||
void did_request_media_context_menu(i32 media_id, CSSPixelPoint, ByteString const& target, unsigned modifiers, MediaContextMenu);
|
||||
void did_request_media_context_menu(UniqueNodeID media_id, CSSPixelPoint, ByteString const& target, unsigned modifiers, MediaContextMenu);
|
||||
WebIDL::ExceptionOr<void> toggle_media_play_state();
|
||||
void toggle_media_mute_state();
|
||||
WebIDL::ExceptionOr<void> toggle_media_loop_state();
|
||||
|
@ -253,8 +253,8 @@ private:
|
|||
PendingNonBlockingDialog m_pending_non_blocking_dialog { PendingNonBlockingDialog::None };
|
||||
WeakPtr<HTML::HTMLElement> m_pending_non_blocking_dialog_target;
|
||||
|
||||
Vector<int> m_media_elements;
|
||||
Optional<int> m_media_context_menu_element_id;
|
||||
Vector<UniqueNodeID> m_media_elements;
|
||||
Optional<UniqueNodeID> m_media_context_menu_element_id;
|
||||
|
||||
Web::HTML::MuteState m_mute_state { Web::HTML::MuteState::Unmuted };
|
||||
|
||||
|
@ -373,12 +373,12 @@ public:
|
|||
virtual IPC::File request_worker_agent() { return IPC::File {}; }
|
||||
|
||||
virtual void inspector_did_load() { }
|
||||
virtual void inspector_did_select_dom_node([[maybe_unused]] i32 node_id, [[maybe_unused]] Optional<CSS::Selector::PseudoElement::Type> const& pseudo_element) { }
|
||||
virtual void inspector_did_set_dom_node_text([[maybe_unused]] i32 node_id, [[maybe_unused]] String const& text) { }
|
||||
virtual void inspector_did_set_dom_node_tag([[maybe_unused]] i32 node_id, [[maybe_unused]] String const& tag) { }
|
||||
virtual void inspector_did_add_dom_node_attributes([[maybe_unused]] i32 node_id, [[maybe_unused]] JS::NonnullGCPtr<DOM::NamedNodeMap> attributes) { }
|
||||
virtual void inspector_did_replace_dom_node_attribute([[maybe_unused]] i32 node_id, [[maybe_unused]] size_t attribute_index, [[maybe_unused]] JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes) { }
|
||||
virtual void inspector_did_request_dom_tree_context_menu([[maybe_unused]] i32 node_id, [[maybe_unused]] CSSPixelPoint position, [[maybe_unused]] String const& type, [[maybe_unused]] Optional<String> const& tag, [[maybe_unused]] Optional<size_t> const& attribute_index) { }
|
||||
virtual void inspector_did_select_dom_node([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] Optional<CSS::Selector::PseudoElement::Type> const& pseudo_element) { }
|
||||
virtual void inspector_did_set_dom_node_text([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] String const& text) { }
|
||||
virtual void inspector_did_set_dom_node_tag([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] String const& tag) { }
|
||||
virtual void inspector_did_add_dom_node_attributes([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] JS::NonnullGCPtr<DOM::NamedNodeMap> attributes) { }
|
||||
virtual void inspector_did_replace_dom_node_attribute([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] size_t attribute_index, [[maybe_unused]] JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes) { }
|
||||
virtual void inspector_did_request_dom_tree_context_menu([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] CSSPixelPoint position, [[maybe_unused]] String const& type, [[maybe_unused]] Optional<String> const& tag, [[maybe_unused]] Optional<size_t> const& attribute_index) { }
|
||||
virtual void inspector_did_request_cookie_context_menu([[maybe_unused]] size_t cookie_index, [[maybe_unused]] CSSPixelPoint position) { }
|
||||
virtual void inspector_did_request_style_sheet_source([[maybe_unused]] CSS::StyleSheetIdentifier const& identifier) { }
|
||||
virtual void inspector_did_execute_console_script([[maybe_unused]] String const& script) { }
|
||||
|
|
|
@ -35,7 +35,7 @@ ByteString get_or_create_a_web_element_reference(Web::DOM::Node const& element)
|
|||
// FIXME: 2. Add element to the list of known elements of the current browsing context.
|
||||
// FIXME: 3. Return success with the element’s web element reference.
|
||||
|
||||
return ByteString::number(element.unique_id());
|
||||
return ByteString::number(element.unique_id().value());
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-web-element-reference-object
|
||||
|
@ -104,12 +104,12 @@ ErrorOr<JS::NonnullGCPtr<Web::DOM::Element>, Web::WebDriver::Error> get_known_el
|
|||
|
||||
// 1. If not node reference is known with session, session's current browsing context, and reference return error
|
||||
// with error code no such element.
|
||||
auto element = element_id.to_number<int>();
|
||||
auto element = element_id.to_number<i64>();
|
||||
if (!element.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, "Element ID is not an integer");
|
||||
|
||||
// 2. Let node be the result of get a node with session, session's current browsing context, and reference.
|
||||
auto* node = Web::DOM::Node::from_unique_id(*element);
|
||||
auto* node = Web::DOM::Node::from_unique_id(UniqueNodeID(*element));
|
||||
|
||||
// 3. If node is not null and node does not implement Element return error with error code no such element.
|
||||
if (node && !node->is_element())
|
||||
|
@ -264,7 +264,7 @@ ByteString get_or_create_a_shadow_root_reference(Web::DOM::ShadowRoot const& sha
|
|||
// FIXME: 2. Add shadow to the list of known shadow roots of the current browsing context.
|
||||
// FIXME: 3. Return success with the shadow’s shadow root reference.
|
||||
|
||||
return ByteString::number(shadow_root.unique_id());
|
||||
return ByteString::number(shadow_root.unique_id().value());
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-shadow-root-reference-object
|
||||
|
@ -287,11 +287,11 @@ ErrorOr<JS::NonnullGCPtr<Web::DOM::ShadowRoot>, Web::WebDriver::Error> get_known
|
|||
{
|
||||
// NOTE: The whole concept of "known shadow roots" is not implemented yet. See get_or_create_a_shadow_root_reference().
|
||||
// For now the shadow root is only represented by its ID.
|
||||
auto shadow_root = shadow_id.to_number<int>();
|
||||
auto shadow_root = shadow_id.to_number<i64>();
|
||||
if (!shadow_root.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Shadow ID is not an integer");
|
||||
|
||||
auto* node = Web::DOM::Node::from_unique_id(*shadow_root);
|
||||
auto* node = Web::DOM::Node::from_unique_id(UniqueNodeID(*shadow_root));
|
||||
|
||||
if (!node || !node->is_shadow_root())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, ByteString::formatted("Could not find shadow root with ID: {}", shadow_id));
|
||||
|
|
|
@ -40,7 +40,7 @@ static String style_sheet_identifier_to_json(Web::CSS::StyleSheetIdentifier cons
|
|||
{
|
||||
return MUST(String::formatted("{{ type: '{}', domNodeId: {}, url: '{}' }}"sv,
|
||||
Web::CSS::style_sheet_identifier_type_to_string(identifier.type),
|
||||
identifier.dom_element_unique_id.map([](auto& it) { return String::number(it); }).value_or("undefined"_string),
|
||||
identifier.dom_element_unique_id.map([](auto& it) { return String::number(it.value()); }).value_or("undefined"_string),
|
||||
identifier.url.value_or("undefined"_string)));
|
||||
}
|
||||
|
||||
|
@ -343,14 +343,14 @@ void InspectorClient::clear_selection()
|
|||
m_inspector_web_view.run_javascript(script);
|
||||
}
|
||||
|
||||
void InspectorClient::select_node(i32 node_id)
|
||||
void InspectorClient::select_node(Web::UniqueNodeID node_id)
|
||||
{
|
||||
if (!m_dom_tree_loaded) {
|
||||
m_pending_selection = node_id;
|
||||
return;
|
||||
}
|
||||
|
||||
auto script = MUST(String::formatted("inspector.inspectDOMNodeID({});", node_id));
|
||||
auto script = MUST(String::formatted("inspector.inspectDOMNodeID({});", node_id.value()));
|
||||
m_inspector_web_view.run_javascript(script);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
|
||||
String generate_dom_tree(JsonObject const&);
|
||||
String generate_accessibility_tree(JsonObject const&);
|
||||
void select_node(i32 node_id);
|
||||
void select_node(Web::UniqueNodeID);
|
||||
|
||||
void load_cookies();
|
||||
|
||||
|
@ -72,20 +72,20 @@ private:
|
|||
ViewImplementation& m_content_web_view;
|
||||
ViewImplementation& m_inspector_web_view;
|
||||
|
||||
Optional<i32> m_body_node_id;
|
||||
Optional<i32> m_pending_selection;
|
||||
Optional<Web::UniqueNodeID> m_body_node_id;
|
||||
Optional<Web::UniqueNodeID> m_pending_selection;
|
||||
|
||||
bool m_inspector_loaded { false };
|
||||
bool m_dom_tree_loaded { false };
|
||||
|
||||
struct ContextMenuData {
|
||||
i32 dom_node_id { 0 };
|
||||
Web::UniqueNodeID dom_node_id;
|
||||
Optional<String> tag;
|
||||
Optional<Attribute> attribute;
|
||||
};
|
||||
Optional<ContextMenuData> m_context_menu_data;
|
||||
|
||||
HashMap<int, Vector<Attribute>> m_dom_node_attributes;
|
||||
HashMap<Web::UniqueNodeID, Vector<Attribute>> m_dom_node_attributes;
|
||||
|
||||
Vector<Web::Cookie::Cookie> m_cookies;
|
||||
Optional<size_t> m_cookie_context_menu_index;
|
||||
|
|
|
@ -250,7 +250,7 @@ void ViewImplementation::inspect_dom_tree()
|
|||
client().async_inspect_dom_tree(page_id());
|
||||
}
|
||||
|
||||
void ViewImplementation::inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
void ViewImplementation::inspect_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
|
||||
{
|
||||
client().async_inspect_dom_node(page_id(), node_id, move(pseudo_element));
|
||||
}
|
||||
|
@ -270,47 +270,47 @@ void ViewImplementation::get_hovered_node_id()
|
|||
client().async_get_hovered_node_id(page_id());
|
||||
}
|
||||
|
||||
void ViewImplementation::set_dom_node_text(i32 node_id, String text)
|
||||
void ViewImplementation::set_dom_node_text(Web::UniqueNodeID node_id, String text)
|
||||
{
|
||||
client().async_set_dom_node_text(page_id(), node_id, move(text));
|
||||
}
|
||||
|
||||
void ViewImplementation::set_dom_node_tag(i32 node_id, String name)
|
||||
void ViewImplementation::set_dom_node_tag(Web::UniqueNodeID node_id, String name)
|
||||
{
|
||||
client().async_set_dom_node_tag(page_id(), node_id, move(name));
|
||||
}
|
||||
|
||||
void ViewImplementation::add_dom_node_attributes(i32 node_id, Vector<Attribute> attributes)
|
||||
void ViewImplementation::add_dom_node_attributes(Web::UniqueNodeID node_id, Vector<Attribute> attributes)
|
||||
{
|
||||
client().async_add_dom_node_attributes(page_id(), node_id, move(attributes));
|
||||
}
|
||||
|
||||
void ViewImplementation::replace_dom_node_attribute(i32 node_id, String name, Vector<Attribute> replacement_attributes)
|
||||
void ViewImplementation::replace_dom_node_attribute(Web::UniqueNodeID node_id, String name, Vector<Attribute> replacement_attributes)
|
||||
{
|
||||
client().async_replace_dom_node_attribute(page_id(), node_id, move(name), move(replacement_attributes));
|
||||
}
|
||||
|
||||
void ViewImplementation::create_child_element(i32 node_id)
|
||||
void ViewImplementation::create_child_element(Web::UniqueNodeID node_id)
|
||||
{
|
||||
client().async_create_child_element(page_id(), node_id);
|
||||
}
|
||||
|
||||
void ViewImplementation::create_child_text_node(i32 node_id)
|
||||
void ViewImplementation::create_child_text_node(Web::UniqueNodeID node_id)
|
||||
{
|
||||
client().async_create_child_text_node(page_id(), node_id);
|
||||
}
|
||||
|
||||
void ViewImplementation::clone_dom_node(i32 node_id)
|
||||
void ViewImplementation::clone_dom_node(Web::UniqueNodeID node_id)
|
||||
{
|
||||
client().async_clone_dom_node(page_id(), node_id);
|
||||
}
|
||||
|
||||
void ViewImplementation::remove_dom_node(i32 node_id)
|
||||
void ViewImplementation::remove_dom_node(Web::UniqueNodeID node_id)
|
||||
{
|
||||
client().async_remove_dom_node(page_id(), node_id);
|
||||
}
|
||||
|
||||
void ViewImplementation::get_dom_node_html(i32 node_id)
|
||||
void ViewImplementation::get_dom_node_html(Web::UniqueNodeID node_id)
|
||||
{
|
||||
client().async_get_dom_node_html(page_id(), node_id);
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ NonnullRefPtr<Core::Promise<LexicalPath>> ViewImplementation::take_screenshot(Sc
|
|||
return promise;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> ViewImplementation::take_dom_node_screenshot(i32 node_id)
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> ViewImplementation::take_dom_node_screenshot(Web::UniqueNodeID node_id)
|
||||
{
|
||||
auto promise = Core::Promise<LexicalPath>::construct();
|
||||
|
||||
|
|
|
@ -86,20 +86,20 @@ public:
|
|||
void get_source();
|
||||
|
||||
void inspect_dom_tree();
|
||||
void inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element);
|
||||
void inspect_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element);
|
||||
void inspect_accessibility_tree();
|
||||
void clear_inspected_dom_node();
|
||||
void get_hovered_node_id();
|
||||
|
||||
void set_dom_node_text(i32 node_id, String text);
|
||||
void set_dom_node_tag(i32 node_id, String name);
|
||||
void add_dom_node_attributes(i32 node_id, Vector<Attribute> attributes);
|
||||
void replace_dom_node_attribute(i32 node_id, String name, Vector<Attribute> replacement_attributes);
|
||||
void create_child_element(i32 node_id);
|
||||
void create_child_text_node(i32 node_id);
|
||||
void clone_dom_node(i32 node_id);
|
||||
void remove_dom_node(i32 node_id);
|
||||
void get_dom_node_html(i32 node_id);
|
||||
void set_dom_node_text(Web::UniqueNodeID node_id, String text);
|
||||
void set_dom_node_tag(Web::UniqueNodeID node_id, String name);
|
||||
void add_dom_node_attributes(Web::UniqueNodeID node_id, Vector<Attribute> attributes);
|
||||
void replace_dom_node_attribute(Web::UniqueNodeID node_id, String name, Vector<Attribute> replacement_attributes);
|
||||
void create_child_element(Web::UniqueNodeID node_id);
|
||||
void create_child_text_node(Web::UniqueNodeID node_id);
|
||||
void clone_dom_node(Web::UniqueNodeID node_id);
|
||||
void remove_dom_node(Web::UniqueNodeID node_id);
|
||||
void get_dom_node_html(Web::UniqueNodeID node_id);
|
||||
|
||||
void list_style_sheets();
|
||||
void request_style_sheet_source(Web::CSS::StyleSheetIdentifier const&);
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
Full,
|
||||
};
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> take_screenshot(ScreenshotType);
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> take_dom_node_screenshot(i32);
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> take_dom_node_screenshot(Web::UniqueNodeID);
|
||||
virtual void did_receive_screenshot(Badge<WebContentClient>, Gfx::ShareableBitmap const&);
|
||||
|
||||
NonnullRefPtr<Core::Promise<String>> request_internal_page_info(PageInfoType);
|
||||
|
@ -192,8 +192,8 @@ public:
|
|||
Function<void(Vector<Web::CSS::StyleSheetIdentifier>)> on_received_style_sheet_list;
|
||||
Function<void(Web::CSS::StyleSheetIdentifier const&)> on_inspector_requested_style_sheet_source;
|
||||
Function<void(Web::CSS::StyleSheetIdentifier const&, URL::URL const&, String const&)> on_received_style_sheet_source;
|
||||
Function<void(i32 node_id)> on_received_hovered_node_id;
|
||||
Function<void(Optional<i32> const& node_id)> on_finshed_editing_dom_node;
|
||||
Function<void(Web::UniqueNodeID)> on_received_hovered_node_id;
|
||||
Function<void(Optional<Web::UniqueNodeID> const& node_id)> on_finshed_editing_dom_node;
|
||||
Function<void(String const&)> on_received_dom_node_html;
|
||||
Function<void(i32 message_id)> on_received_console_message;
|
||||
Function<void(i32 start_index, Vector<ByteString> const& message_types, Vector<ByteString> const& messages)> on_received_console_messages;
|
||||
|
@ -216,12 +216,12 @@ public:
|
|||
Function<void(Web::HTML::AudioPlayState)> on_audio_play_state_changed;
|
||||
Function<void(bool, bool)> on_navigation_buttons_state_changed;
|
||||
Function<void()> on_inspector_loaded;
|
||||
Function<void(i32, Optional<Web::CSS::Selector::PseudoElement::Type> const&)> on_inspector_selected_dom_node;
|
||||
Function<void(i32, String const&)> on_inspector_set_dom_node_text;
|
||||
Function<void(i32, String const&)> on_inspector_set_dom_node_tag;
|
||||
Function<void(i32, Vector<Attribute> const&)> on_inspector_added_dom_node_attributes;
|
||||
Function<void(i32, size_t, Vector<Attribute> const&)> on_inspector_replaced_dom_node_attribute;
|
||||
Function<void(i32, Gfx::IntPoint, String const&, Optional<String> const&, Optional<size_t> const&)> on_inspector_requested_dom_tree_context_menu;
|
||||
Function<void(Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type> const&)> on_inspector_selected_dom_node;
|
||||
Function<void(Web::UniqueNodeID, String const&)> on_inspector_set_dom_node_text;
|
||||
Function<void(Web::UniqueNodeID, String const&)> on_inspector_set_dom_node_tag;
|
||||
Function<void(Web::UniqueNodeID, Vector<Attribute> const&)> on_inspector_added_dom_node_attributes;
|
||||
Function<void(Web::UniqueNodeID, size_t, Vector<Attribute> const&)> on_inspector_replaced_dom_node_attribute;
|
||||
Function<void(Web::UniqueNodeID, Gfx::IntPoint, String const&, Optional<String> const&, Optional<size_t> const&)> on_inspector_requested_dom_tree_context_menu;
|
||||
Function<void(size_t, Gfx::IntPoint)> on_inspector_requested_cookie_context_menu;
|
||||
Function<void(String const&)> on_inspector_executed_console_script;
|
||||
Function<void(String const&)> on_inspector_exported_inspector_html;
|
||||
|
|
|
@ -307,7 +307,7 @@ void WebContentClient::did_inspect_accessibility_tree(u64 page_id, ByteString co
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_get_hovered_node_id(u64 page_id, i32 node_id)
|
||||
void WebContentClient::did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_received_hovered_node_id)
|
||||
|
@ -315,7 +315,7 @@ void WebContentClient::did_get_hovered_node_id(u64 page_id, i32 node_id)
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_finish_editing_dom_node(u64 page_id, Optional<i32> const& node_id)
|
||||
void WebContentClient::did_finish_editing_dom_node(u64 page_id, Optional<Web::UniqueNodeID> const& node_id)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_finshed_editing_dom_node)
|
||||
|
@ -622,7 +622,7 @@ void WebContentClient::inspector_did_load(u64 page_id)
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_select_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
void WebContentClient::inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_selected_dom_node)
|
||||
|
@ -630,7 +630,7 @@ void WebContentClient::inspector_did_select_dom_node(u64 page_id, i32 node_id, O
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_set_dom_node_text(u64 page_id, i32 node_id, String const& text)
|
||||
void WebContentClient::inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_set_dom_node_text)
|
||||
|
@ -638,7 +638,7 @@ void WebContentClient::inspector_did_set_dom_node_text(u64 page_id, i32 node_id,
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_set_dom_node_tag(u64 page_id, i32 node_id, String const& tag)
|
||||
void WebContentClient::inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& tag)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_set_dom_node_tag)
|
||||
|
@ -646,7 +646,7 @@ void WebContentClient::inspector_did_set_dom_node_tag(u64 page_id, i32 node_id,
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, i32 node_id, Vector<Attribute> const& attributes)
|
||||
void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector<Attribute> const& attributes)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_added_dom_node_attributes)
|
||||
|
@ -654,7 +654,7 @@ void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, i32 no
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, i32 node_id, size_t attribute_index, Vector<Attribute> const& replacement_attributes)
|
||||
void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, size_t attribute_index, Vector<Attribute> const& replacement_attributes)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_replaced_dom_node_attribute)
|
||||
|
@ -662,7 +662,7 @@ void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, i32
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::inspector_did_request_dom_tree_context_menu(u64 page_id, i32 node_id, Gfx::IntPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index)
|
||||
void WebContentClient::inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID const& node_id, Gfx::IntPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_inspector_requested_dom_tree_context_menu)
|
||||
|
|
|
@ -74,8 +74,8 @@ private:
|
|||
virtual void did_inspect_dom_tree(u64 page_id, ByteString const&) override;
|
||||
virtual void did_inspect_dom_node(u64 page_id, bool has_style, ByteString const& computed_style, ByteString const& resolved_style, ByteString const& custom_properties, ByteString const& node_box_sizing, ByteString const& aria_properties_state, ByteString const& fonts) override;
|
||||
virtual void did_inspect_accessibility_tree(u64 page_id, ByteString const&) override;
|
||||
virtual void did_get_hovered_node_id(u64 page_id, i32 node_id) override;
|
||||
virtual void did_finish_editing_dom_node(u64 page_id, Optional<i32> const& node_id) override;
|
||||
virtual void did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
virtual void did_finish_editing_dom_node(u64 page_id, Optional<Web::UniqueNodeID> const& node_id) override;
|
||||
virtual void did_get_dom_node_html(u64 page_id, String const& html) override;
|
||||
virtual void did_take_screenshot(u64 page_id, Gfx::ShareableBitmap const& screenshot) override;
|
||||
virtual void did_get_internal_page_info(u64 page_id, PageInfoType, String const&) override;
|
||||
|
@ -117,12 +117,12 @@ private:
|
|||
virtual void did_update_navigation_buttons_state(u64 page_id, bool back_enabled, bool forward_enabled) override;
|
||||
virtual void did_allocate_backing_stores(u64 page_id, i32 front_bitmap_id, Gfx::ShareableBitmap const&, i32 back_bitmap_id, Gfx::ShareableBitmap const&) override;
|
||||
virtual void inspector_did_load(u64 page_id) override;
|
||||
virtual void inspector_did_select_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
|
||||
virtual void inspector_did_set_dom_node_text(u64 page_id, i32 node_id, String const& text) override;
|
||||
virtual void inspector_did_set_dom_node_tag(u64 page_id, i32 node_id, String const& tag) override;
|
||||
virtual void inspector_did_add_dom_node_attributes(u64 page_id, i32 node_id, Vector<Attribute> const& attributes) override;
|
||||
virtual void inspector_did_replace_dom_node_attribute(u64 page_id, i32 node_id, size_t attribute_index, Vector<Attribute> const& replacement_attributes) override;
|
||||
virtual void inspector_did_request_dom_tree_context_menu(u64 page_id, i32 node_id, Gfx::IntPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index) override;
|
||||
virtual void inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
|
||||
virtual void inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text) override;
|
||||
virtual void inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& tag) override;
|
||||
virtual void inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector<Attribute> const& attributes) override;
|
||||
virtual void inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, size_t attribute_index, Vector<Attribute> const& replacement_attributes) override;
|
||||
virtual void inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID const& node_id, Gfx::IntPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index) override;
|
||||
virtual void inspector_did_request_cookie_context_menu(u64 page_id, size_t cookie_index, Gfx::IntPoint position) override;
|
||||
virtual void inspector_did_execute_console_script(u64 page_id, String const& script) override;
|
||||
virtual void inspector_did_export_inspector_html(u64 page_id, String const& html) override;
|
||||
|
|
|
@ -444,7 +444,7 @@ void ConnectionFromClient::inspect_dom_tree(u64 page_id)
|
|||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::inspect_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
{
|
||||
auto page = this->page(page_id);
|
||||
if (!page.has_value())
|
||||
|
@ -459,7 +459,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, i32 node_id, Optional<W
|
|||
return Web::TraversalDecision::Continue;
|
||||
});
|
||||
|
||||
Web::DOM::Node* node = Web::DOM::Node::from_unique_id(node_id);
|
||||
auto* node = Web::DOM::Node::from_unique_id(node_id);
|
||||
// Note: Nodes without layout (aka non-visible nodes, don't have style computed)
|
||||
if (!node || !node->layout_node()) {
|
||||
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
||||
|
@ -618,7 +618,7 @@ void ConnectionFromClient::get_hovered_node_id(u64 page_id)
|
|||
if (!page.has_value())
|
||||
return;
|
||||
|
||||
i32 node_id = 0;
|
||||
Web::UniqueNodeID node_id = 0;
|
||||
|
||||
if (auto* document = page->page().top_level_browsing_context().active_document()) {
|
||||
if (auto* hovered_node = document->hovered_node())
|
||||
|
@ -649,7 +649,7 @@ void ConnectionFromClient::request_style_sheet_source(u64 page_id, Web::CSS::Sty
|
|||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_dom_node_text(u64 page_id, i32 node_id, String const& text)
|
||||
void ConnectionFromClient::set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node || (!dom_node->is_text() && !dom_node->is_comment())) {
|
||||
|
@ -663,7 +663,7 @@ void ConnectionFromClient::set_dom_node_text(u64 page_id, i32 node_id, String co
|
|||
async_did_finish_editing_dom_node(page_id, character_data.unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_dom_node_tag(u64 page_id, i32 node_id, String const& name)
|
||||
void ConnectionFromClient::set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& name)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node || !dom_node->is_element() || !dom_node->parent()) {
|
||||
|
@ -687,7 +687,7 @@ void ConnectionFromClient::set_dom_node_tag(u64 page_id, i32 node_id, String con
|
|||
async_did_finish_editing_dom_node(page_id, new_element->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::add_dom_node_attributes(u64 page_id, i32 node_id, Vector<WebView::Attribute> const& attributes)
|
||||
void ConnectionFromClient::add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector<WebView::Attribute> const& attributes)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node || !dom_node->is_element()) {
|
||||
|
@ -705,7 +705,7 @@ void ConnectionFromClient::add_dom_node_attributes(u64 page_id, i32 node_id, Vec
|
|||
async_did_finish_editing_dom_node(page_id, element.unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, i32 node_id, String const& name, Vector<WebView::Attribute> const& replacement_attributes)
|
||||
void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, String const& name, Vector<WebView::Attribute> const& replacement_attributes)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node || !dom_node->is_element()) {
|
||||
|
@ -730,7 +730,7 @@ void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, i32 node_id,
|
|||
async_did_finish_editing_dom_node(page_id, element.unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::create_child_element(u64 page_id, i32 node_id)
|
||||
void ConnectionFromClient::create_child_element(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node) {
|
||||
|
@ -744,7 +744,7 @@ void ConnectionFromClient::create_child_element(u64 page_id, i32 node_id)
|
|||
async_did_finish_editing_dom_node(page_id, element->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::create_child_text_node(u64 page_id, i32 node_id)
|
||||
void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node) {
|
||||
|
@ -758,7 +758,7 @@ void ConnectionFromClient::create_child_text_node(u64 page_id, i32 node_id)
|
|||
async_did_finish_editing_dom_node(page_id, text_node->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::clone_dom_node(u64 page_id, i32 node_id)
|
||||
void ConnectionFromClient::clone_dom_node(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node || !dom_node->parent_node()) {
|
||||
|
@ -772,7 +772,7 @@ void ConnectionFromClient::clone_dom_node(u64 page_id, i32 node_id)
|
|||
async_did_finish_editing_dom_node(page_id, dom_node_clone->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::remove_dom_node(u64 page_id, i32 node_id)
|
||||
void ConnectionFromClient::remove_dom_node(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
auto page = this->page(page_id);
|
||||
if (!page.has_value())
|
||||
|
@ -799,7 +799,7 @@ void ConnectionFromClient::remove_dom_node(u64 page_id, i32 node_id)
|
|||
async_did_finish_editing_dom_node(page_id, previous_dom_node->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::get_dom_node_html(u64 page_id, i32 node_id)
|
||||
void ConnectionFromClient::get_dom_node_html(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!dom_node)
|
||||
|
@ -829,7 +829,7 @@ void ConnectionFromClient::take_document_screenshot(u64 page_id)
|
|||
page->queue_screenshot_task({});
|
||||
}
|
||||
|
||||
void ConnectionFromClient::take_dom_node_screenshot(u64 page_id, i32 node_id)
|
||||
void ConnectionFromClient::take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID const& node_id)
|
||||
{
|
||||
auto page = this->page(page_id);
|
||||
if (!page.has_value())
|
||||
|
|
|
@ -74,22 +74,22 @@ private:
|
|||
virtual void debug_request(u64 page_id, ByteString const&, ByteString const&) override;
|
||||
virtual void get_source(u64 page_id) override;
|
||||
virtual void inspect_dom_tree(u64 page_id) override;
|
||||
virtual void inspect_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
|
||||
virtual void inspect_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
|
||||
virtual void inspect_accessibility_tree(u64 page_id) override;
|
||||
virtual void get_hovered_node_id(u64 page_id) override;
|
||||
|
||||
virtual void list_style_sheets(u64 page_id) override;
|
||||
virtual void request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier) override;
|
||||
|
||||
virtual void set_dom_node_text(u64 page_id, i32 node_id, String const& text) override;
|
||||
virtual void set_dom_node_tag(u64 page_id, i32 node_id, String const& name) override;
|
||||
virtual void add_dom_node_attributes(u64 page_id, i32 node_id, Vector<WebView::Attribute> const& attributes) override;
|
||||
virtual void replace_dom_node_attribute(u64 page_id, i32 node_id, String const& name, Vector<WebView::Attribute> const& replacement_attributes) override;
|
||||
virtual void create_child_element(u64 page_id, i32 node_id) override;
|
||||
virtual void create_child_text_node(u64 page_id, i32 node_id) override;
|
||||
virtual void clone_dom_node(u64 page_id, i32 node_id) override;
|
||||
virtual void remove_dom_node(u64 page_id, i32 node_id) override;
|
||||
virtual void get_dom_node_html(u64 page_id, i32 node_id) override;
|
||||
virtual void set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text) override;
|
||||
virtual void set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& name) override;
|
||||
virtual void add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector<WebView::Attribute> const& attributes) override;
|
||||
virtual void replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, String const& name, Vector<WebView::Attribute> const& replacement_attributes) override;
|
||||
virtual void create_child_element(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
virtual void create_child_text_node(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
virtual void clone_dom_node(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
virtual void remove_dom_node(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
virtual void get_dom_node_html(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
|
||||
virtual void set_content_filters(u64 page_id, Vector<String> const&) override;
|
||||
virtual void set_autoplay_allowed_on_all_websites(u64 page_id) override;
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
virtual void enable_inspector_prototype(u64 page_id) override;
|
||||
|
||||
virtual void take_document_screenshot(u64 page_id) override;
|
||||
virtual void take_dom_node_screenshot(u64 page_id, i32 node_id) override;
|
||||
virtual void take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID const& node_id) override;
|
||||
|
||||
virtual void request_internal_page_info(u64 page_id, WebView::PageInfoType) override;
|
||||
|
||||
|
|
|
@ -612,17 +612,17 @@ void PageClient::inspector_did_load()
|
|||
client().async_inspector_did_load(m_id);
|
||||
}
|
||||
|
||||
void PageClient::inspector_did_select_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
void PageClient::inspector_did_select_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
{
|
||||
client().async_inspector_did_select_dom_node(m_id, node_id, pseudo_element);
|
||||
}
|
||||
|
||||
void PageClient::inspector_did_set_dom_node_text(i32 node_id, String const& text)
|
||||
void PageClient::inspector_did_set_dom_node_text(Web::UniqueNodeID node_id, String const& text)
|
||||
{
|
||||
client().async_inspector_did_set_dom_node_text(m_id, node_id, text);
|
||||
}
|
||||
|
||||
void PageClient::inspector_did_set_dom_node_tag(i32 node_id, String const& tag)
|
||||
void PageClient::inspector_did_set_dom_node_tag(Web::UniqueNodeID node_id, String const& tag)
|
||||
{
|
||||
client().async_inspector_did_set_dom_node_tag(m_id, node_id, tag);
|
||||
}
|
||||
|
@ -642,17 +642,17 @@ static Vector<WebView::Attribute> named_node_map_to_vector(JS::NonnullGCPtr<Web:
|
|||
return attributes;
|
||||
}
|
||||
|
||||
void PageClient::inspector_did_add_dom_node_attributes(i32 node_id, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> attributes)
|
||||
void PageClient::inspector_did_add_dom_node_attributes(Web::UniqueNodeID node_id, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> attributes)
|
||||
{
|
||||
client().async_inspector_did_add_dom_node_attributes(m_id, node_id, named_node_map_to_vector(attributes));
|
||||
}
|
||||
|
||||
void PageClient::inspector_did_replace_dom_node_attribute(i32 node_id, size_t attribute_index, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> replacement_attributes)
|
||||
void PageClient::inspector_did_replace_dom_node_attribute(Web::UniqueNodeID node_id, size_t attribute_index, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> replacement_attributes)
|
||||
{
|
||||
client().async_inspector_did_replace_dom_node_attribute(m_id, node_id, attribute_index, named_node_map_to_vector(replacement_attributes));
|
||||
}
|
||||
|
||||
void PageClient::inspector_did_request_dom_tree_context_menu(i32 node_id, Web::CSSPixelPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index)
|
||||
void PageClient::inspector_did_request_dom_tree_context_menu(Web::UniqueNodeID node_id, Web::CSSPixelPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index)
|
||||
{
|
||||
client().async_inspector_did_request_dom_tree_context_menu(m_id, node_id, page().css_to_device_point(position).to_type<int>(), type, tag, attribute_index);
|
||||
}
|
||||
|
@ -846,7 +846,7 @@ Web::DisplayListPlayerType PageClient::display_list_player_type() const
|
|||
}
|
||||
}
|
||||
|
||||
void PageClient::queue_screenshot_task(Optional<i32> node_id)
|
||||
void PageClient::queue_screenshot_task(Optional<Web::UniqueNodeID> node_id)
|
||||
{
|
||||
m_screenshot_tasks.enqueue({ node_id });
|
||||
page().top_level_traversable()->set_needs_display();
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
|
||||
virtual Web::DisplayListPlayerType display_list_player_type() const override;
|
||||
|
||||
void queue_screenshot_task(Optional<i32> node_id);
|
||||
void queue_screenshot_task(Optional<Web::UniqueNodeID> node_id);
|
||||
|
||||
friend class BackingStoreManager;
|
||||
|
||||
|
@ -163,12 +163,12 @@ private:
|
|||
virtual void page_did_allocate_backing_stores(i32 front_bitmap_id, Gfx::ShareableBitmap front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap back_bitmap) override;
|
||||
virtual IPC::File request_worker_agent() override;
|
||||
virtual void inspector_did_load() override;
|
||||
virtual void inspector_did_select_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
|
||||
virtual void inspector_did_set_dom_node_text(i32 node_id, String const& text) override;
|
||||
virtual void inspector_did_set_dom_node_tag(i32 node_id, String const& tag) override;
|
||||
virtual void inspector_did_add_dom_node_attributes(i32 node_id, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> attributes) override;
|
||||
virtual void inspector_did_replace_dom_node_attribute(i32 node_id, size_t attribute_index, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> replacement_attributes) override;
|
||||
virtual void inspector_did_request_dom_tree_context_menu(i32 node_id, Web::CSSPixelPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index) override;
|
||||
virtual void inspector_did_select_dom_node(Web::UniqueNodeID, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
|
||||
virtual void inspector_did_set_dom_node_text(Web::UniqueNodeID, String const& text) override;
|
||||
virtual void inspector_did_set_dom_node_tag(Web::UniqueNodeID, String const& tag) override;
|
||||
virtual void inspector_did_add_dom_node_attributes(Web::UniqueNodeID, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> attributes) override;
|
||||
virtual void inspector_did_replace_dom_node_attribute(Web::UniqueNodeID, size_t attribute_index, JS::NonnullGCPtr<Web::DOM::NamedNodeMap> replacement_attributes) override;
|
||||
virtual void inspector_did_request_dom_tree_context_menu(Web::UniqueNodeID, Web::CSSPixelPoint position, String const& type, Optional<String> const& tag, Optional<size_t> const& attribute_index) override;
|
||||
virtual void inspector_did_request_cookie_context_menu(size_t cookie_index, Web::CSSPixelPoint position) override;
|
||||
virtual void inspector_did_request_style_sheet_source(Web::CSS::StyleSheetIdentifier const& stylesheet_source) override;
|
||||
virtual void inspector_did_execute_console_script(String const& script) override;
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
PaintState m_paint_state { PaintState::Ready };
|
||||
|
||||
struct ScreenshotTask {
|
||||
Optional<i32> node_id;
|
||||
Optional<Web::UniqueNodeID> node_id;
|
||||
};
|
||||
Queue<ScreenshotTask> m_screenshot_tasks;
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ endpoint WebContentClient
|
|||
did_inspect_dom_tree(u64 page_id, ByteString dom_tree) =|
|
||||
did_inspect_dom_node(u64 page_id, bool has_style, ByteString computed_style, ByteString resolved_style, ByteString custom_properties, ByteString node_box_sizing, ByteString aria_properties_state, ByteString fonts) =|
|
||||
did_inspect_accessibility_tree(u64 page_id, ByteString accessibility_tree) =|
|
||||
did_get_hovered_node_id(u64 page_id, i32 node_id) =|
|
||||
did_finish_editing_dom_node(u64 page_id, Optional<i32> node_id) =|
|
||||
did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
did_finish_editing_dom_node(u64 page_id, Optional<Web::UniqueNodeID> node_id) =|
|
||||
did_get_dom_node_html(u64 page_id, String html) =|
|
||||
|
||||
inspector_did_list_style_sheets(u64 page_id, Vector<Web::CSS::StyleSheetIdentifier> style_sheets) =|
|
||||
|
@ -104,12 +104,12 @@ endpoint WebContentClient
|
|||
request_worker_agent(u64 page_id) => (IPC::File socket) // FIXME: Add required attributes to select a SharedWorker Agent
|
||||
|
||||
inspector_did_load(u64 page_id) =|
|
||||
inspector_did_select_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) =|
|
||||
inspector_did_set_dom_node_text(u64 page_id, i32 node_id, String text) =|
|
||||
inspector_did_set_dom_node_tag(u64 page_id, i32 node_id, String tag) =|
|
||||
inspector_did_add_dom_node_attributes(u64 page_id, i32 node_id, Vector<WebView::Attribute> attributes) =|
|
||||
inspector_did_replace_dom_node_attribute(u64 page_id, i32 node_id, size_t attribute_index, Vector<WebView::Attribute> replacement_attributes) =|
|
||||
inspector_did_request_dom_tree_context_menu(u64 page_id, i32 node_id, Gfx::IntPoint position, String type, Optional<String> tag, Optional<size_t> attribute_index) =|
|
||||
inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) =|
|
||||
inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID node_id, String text) =|
|
||||
inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID node_id, String tag) =|
|
||||
inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector<WebView::Attribute> attributes) =|
|
||||
inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, size_t attribute_index, Vector<WebView::Attribute> replacement_attributes) =|
|
||||
inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID node_id, Gfx::IntPoint position, String type, Optional<String> tag, Optional<size_t> attribute_index) =|
|
||||
inspector_did_request_cookie_context_menu(u64 page_id, size_t cookie_index, Gfx::IntPoint position) =|
|
||||
inspector_did_execute_console_script(u64 page_id, String script) =|
|
||||
inspector_did_export_inspector_html(u64 page_id, String html) =|
|
||||
|
|
|
@ -42,7 +42,7 @@ endpoint WebContentServer
|
|||
debug_request(u64 page_id, ByteString request, ByteString argument) =|
|
||||
get_source(u64 page_id) =|
|
||||
inspect_dom_tree(u64 page_id) =|
|
||||
inspect_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) =|
|
||||
inspect_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) =|
|
||||
inspect_accessibility_tree(u64 page_id) =|
|
||||
get_hovered_node_id(u64 page_id) =|
|
||||
js_console_input(u64 page_id, ByteString js_source) =|
|
||||
|
@ -50,18 +50,18 @@ endpoint WebContentServer
|
|||
list_style_sheets(u64 page_id) =|
|
||||
request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier) =|
|
||||
|
||||
set_dom_node_text(u64 page_id, i32 node_id, String text) =|
|
||||
set_dom_node_tag(u64 page_id, i32 node_id, String name) =|
|
||||
add_dom_node_attributes(u64 page_id, i32 node_id, Vector<WebView::Attribute> attributes) =|
|
||||
replace_dom_node_attribute(u64 page_id, i32 node_id, String name, Vector<WebView::Attribute> replacement_attributes) =|
|
||||
create_child_element(u64 page_id, i32 node_id) =|
|
||||
create_child_text_node(u64 page_id, i32 node_id) =|
|
||||
clone_dom_node(u64 page_id, i32 node_id) =|
|
||||
remove_dom_node(u64 page_id, i32 node_id) =|
|
||||
get_dom_node_html(u64 page_id, i32 node_id) =|
|
||||
set_dom_node_text(u64 page_id, Web::UniqueNodeID node_id, String text) =|
|
||||
set_dom_node_tag(u64 page_id, Web::UniqueNodeID node_id, String name) =|
|
||||
add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector<WebView::Attribute> attributes) =|
|
||||
replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, String name, Vector<WebView::Attribute> replacement_attributes) =|
|
||||
create_child_element(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
create_child_text_node(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
clone_dom_node(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
remove_dom_node(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
get_dom_node_html(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
|
||||
take_document_screenshot(u64 page_id) =|
|
||||
take_dom_node_screenshot(u64 page_id, i32 node_id) =|
|
||||
take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID node_id) =|
|
||||
|
||||
request_internal_page_info(u64 page_id, WebView::PageInfoType type) =|
|
||||
|
||||
|
|
|
@ -1018,7 +1018,7 @@ Messages::WebDriverClient::GetActiveElementResponse WebDriverConnection::get_act
|
|||
// 4. If active element is a non-null element, return success with data set to web element reference object for active element.
|
||||
// Otherwise, return error with error code no such element.
|
||||
if (active_element)
|
||||
return ByteString::number(active_element->unique_id());
|
||||
return ByteString::number(active_element->unique_id().value());
|
||||
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, "The current document does not have an active element"sv);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue