mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
LibWeb: Fix a few const-ness issues
This commit is contained in:
parent
70a2ca7fc0
commit
c0b2fa74ac
36 changed files with 123 additions and 121 deletions
|
@ -18,7 +18,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<AccessibilityTreeNode>> AccessibilityTreeNo
|
|||
return MUST_OR_THROW_OOM(document->heap().allocate<AccessibilityTreeNode>(document->realm(), value));
|
||||
}
|
||||
|
||||
AccessibilityTreeNode::AccessibilityTreeNode(JS::GCPtr<DOM::Node> value)
|
||||
AccessibilityTreeNode::AccessibilityTreeNode(JS::GCPtr<DOM::Node const> value)
|
||||
: m_value(value)
|
||||
{
|
||||
m_children = {};
|
||||
|
@ -29,7 +29,7 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
|||
if (value()->is_document()) {
|
||||
VERIFY_NOT_REACHED();
|
||||
} else if (value()->is_element()) {
|
||||
auto const* element = static_cast<DOM::Element*>(value().ptr());
|
||||
auto const* element = static_cast<DOM::Element const*>(value().ptr());
|
||||
|
||||
if (element->include_in_accessibility_tree()) {
|
||||
MUST(object.add("type"sv, "element"sv));
|
||||
|
@ -53,7 +53,7 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
|||
} else if (value()->is_text()) {
|
||||
MUST(object.add("type"sv, "text"sv));
|
||||
|
||||
auto const* text_node = static_cast<DOM::Text*>(value().ptr());
|
||||
auto const* text_node = static_cast<DOM::Text const*>(value().ptr());
|
||||
MUST(object.add("text"sv, text_node->data()));
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
|||
void AccessibilityTreeNode::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(*value());
|
||||
visitor.visit(value());
|
||||
for (auto child : children())
|
||||
child->visit_edges(visitor);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<AccessibilityTreeNode>> create(Document*, DOM::Node const*);
|
||||
virtual ~AccessibilityTreeNode() override = default;
|
||||
|
||||
JS::GCPtr<DOM::Node> value() const { return m_value; }
|
||||
void set_value(JS::GCPtr<DOM::Node> value) { m_value = value; }
|
||||
JS::GCPtr<DOM::Node const> value() const { return m_value; }
|
||||
void set_value(JS::GCPtr<DOM::Node const> value) { m_value = value; }
|
||||
Vector<AccessibilityTreeNode*> children() const { return m_children; }
|
||||
void append_child(AccessibilityTreeNode* child) { m_children.append(child); }
|
||||
|
||||
|
@ -31,9 +31,9 @@ protected:
|
|||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
explicit AccessibilityTreeNode(JS::GCPtr<DOM::Node>);
|
||||
explicit AccessibilityTreeNode(JS::GCPtr<DOM::Node const>);
|
||||
|
||||
JS::GCPtr<DOM::Node> m_value;
|
||||
JS::GCPtr<DOM::Node const> m_value;
|
||||
Vector<AccessibilityTreeNode*> m_children;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,11 +45,6 @@ void Attr::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_owner_element.ptr());
|
||||
}
|
||||
|
||||
Element* Attr::owner_element()
|
||||
{
|
||||
return m_owner_element.ptr();
|
||||
}
|
||||
|
||||
Element const* Attr::owner_element() const
|
||||
{
|
||||
return m_owner_element.ptr();
|
||||
|
@ -79,7 +74,7 @@ void Attr::set_value(DeprecatedString value)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#handle-attribute-changes
|
||||
void Attr::handle_attribute_changes(Element& element, DeprecatedString const& old_value, [[maybe_unused]] DeprecatedString const& new_value)
|
||||
void Attr::handle_attribute_changes(Element const& element, DeprecatedString const& old_value, [[maybe_unused]] DeprecatedString const& new_value)
|
||||
{
|
||||
// 1. Queue a mutation record of "attributes" for element with attribute’s local name, attribute’s namespace, oldValue, « », « », null, and null.
|
||||
auto added_node_list = StaticNodeList::create(realm(), {}).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -33,14 +33,13 @@ public:
|
|||
DeprecatedString const& value() const { return m_value; }
|
||||
void set_value(DeprecatedString value);
|
||||
|
||||
Element* owner_element();
|
||||
Element const* owner_element() const;
|
||||
void set_owner_element(Element const* owner_element);
|
||||
|
||||
// Always returns true: https://dom.spec.whatwg.org/#dom-attr-specified
|
||||
constexpr bool specified() const { return true; }
|
||||
|
||||
void handle_attribute_changes(Element&, DeprecatedString const& old_value, DeprecatedString const& new_value);
|
||||
void handle_attribute_changes(Element const&, DeprecatedString const& old_value, DeprecatedString const& new_value);
|
||||
|
||||
private:
|
||||
Attr(Document&, QualifiedName, DeprecatedString value, Element const*);
|
||||
|
@ -50,7 +49,7 @@ private:
|
|||
|
||||
QualifiedName m_qualified_name;
|
||||
DeprecatedString m_value;
|
||||
JS::GCPtr<Element> m_owner_element;
|
||||
JS::GCPtr<Element const> m_owner_element;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -117,9 +117,9 @@ protected:
|
|||
ChildNode() = default;
|
||||
|
||||
private:
|
||||
JS::GCPtr<Node> viable_previous_sibling_for_insertion(Vector<Variant<JS::Handle<Node>, DeprecatedString>> const& nodes) const
|
||||
JS::GCPtr<Node> viable_previous_sibling_for_insertion(Vector<Variant<JS::Handle<Node>, DeprecatedString>> const& nodes)
|
||||
{
|
||||
auto* node = static_cast<NodeType const*>(this);
|
||||
auto* node = static_cast<NodeType*>(this);
|
||||
|
||||
while (auto* previous_sibling = node->previous_sibling()) {
|
||||
bool contained_in_nodes = false;
|
||||
|
@ -142,9 +142,9 @@ private:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
JS::GCPtr<Node> viable_nest_sibling_for_insertion(Vector<Variant<JS::Handle<Node>, DeprecatedString>> const& nodes) const
|
||||
JS::GCPtr<Node> viable_nest_sibling_for_insertion(Vector<Variant<JS::Handle<Node>, DeprecatedString>> const& nodes)
|
||||
{
|
||||
auto* node = static_cast<NodeType const*>(this);
|
||||
auto* node = static_cast<NodeType*>(this);
|
||||
|
||||
while (auto* next_sibling = node->next_sibling()) {
|
||||
bool contained_in_nodes = false;
|
||||
|
|
|
@ -52,14 +52,14 @@ inline void replace_in_ordered_set(Vector<DeprecatedString>& set, StringView ite
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMTokenList>> DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMTokenList>> DOMTokenList::create(Element& associated_element, DeprecatedFlyString associated_attribute)
|
||||
{
|
||||
auto& realm = associated_element.realm();
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute)));
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A2
|
||||
DOMTokenList::DOMTokenList(Element const& associated_element, DeprecatedFlyString associated_attribute)
|
||||
DOMTokenList::DOMTokenList(Element& associated_element, DeprecatedFlyString associated_attribute)
|
||||
: Bindings::LegacyPlatformObject(associated_element.realm())
|
||||
, m_associated_element(associated_element)
|
||||
, m_associated_attribute(move(associated_attribute))
|
||||
|
|
|
@ -24,7 +24,7 @@ class DOMTokenList final : public Bindings::LegacyPlatformObject {
|
|||
WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMTokenList>> create(Element const& associated_element, DeprecatedFlyString associated_attribute);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMTokenList>> create(Element& associated_element, DeprecatedFlyString associated_attribute);
|
||||
~DOMTokenList() = default;
|
||||
|
||||
void associated_attribute_changed(StringView value);
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
void set_value(DeprecatedString value);
|
||||
|
||||
private:
|
||||
DOMTokenList(Element const& associated_element, DeprecatedFlyString associated_attribute);
|
||||
DOMTokenList(Element& associated_element, DeprecatedFlyString associated_attribute);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
|
|
@ -754,7 +754,7 @@ Vector<CSS::BackgroundLayerData> const* Document::background_layers() const
|
|||
|
||||
void Document::update_base_element(Badge<HTML::HTMLBaseElement>)
|
||||
{
|
||||
JS::GCPtr<HTML::HTMLBaseElement> base_element;
|
||||
JS::GCPtr<HTML::HTMLBaseElement const> base_element;
|
||||
|
||||
for_each_in_subtree_of_type<HTML::HTMLBaseElement>([&base_element](HTML::HTMLBaseElement const& base_element_in_tree) {
|
||||
if (base_element_in_tree.has_attribute(HTML::AttributeNames::href)) {
|
||||
|
@ -768,7 +768,7 @@ void Document::update_base_element(Badge<HTML::HTMLBaseElement>)
|
|||
m_first_base_element_with_href_in_tree_order = base_element;
|
||||
}
|
||||
|
||||
JS::GCPtr<HTML::HTMLBaseElement> Document::first_base_element_with_href_in_tree_order() const
|
||||
JS::GCPtr<HTML::HTMLBaseElement const> Document::first_base_element_with_href_in_tree_order() const
|
||||
{
|
||||
return m_first_base_element_with_href_in_tree_order;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
AK::URL base_url() const;
|
||||
|
||||
void update_base_element(Badge<HTML::HTMLBaseElement>);
|
||||
JS::GCPtr<HTML::HTMLBaseElement> first_base_element_with_href_in_tree_order() const;
|
||||
JS::GCPtr<HTML::HTMLBaseElement const> first_base_element_with_href_in_tree_order() const;
|
||||
|
||||
DeprecatedString url_string() const { return m_url.to_deprecated_string(); }
|
||||
DeprecatedString document_uri() const { return m_url.to_deprecated_string(); }
|
||||
|
@ -611,7 +611,7 @@ private:
|
|||
JS::GCPtr<Selection::Selection> m_selection;
|
||||
|
||||
// NOTE: This is a cache to make finding the first <base href> element O(1).
|
||||
JS::GCPtr<HTML::HTMLBaseElement> m_first_base_element_with_href_in_tree_order;
|
||||
JS::GCPtr<HTML::HTMLBaseElement const> m_first_base_element_with_href_in_tree_order;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationRecord>> MutationRecord::create(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationRecord>> MutationRecord::create(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<MutationRecord>(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value));
|
||||
}
|
||||
|
||||
MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
|
||||
MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
|
||||
: PlatformObject(realm)
|
||||
, m_type(type)
|
||||
, m_target(JS::make_handle(target))
|
||||
|
|
|
@ -15,7 +15,7 @@ class MutationRecord : public Bindings::PlatformObject {
|
|||
WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationRecord>> create(JS::Realm&, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationRecord>> create(JS::Realm&, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
||||
|
||||
virtual ~MutationRecord() override;
|
||||
|
||||
|
@ -30,13 +30,13 @@ public:
|
|||
DeprecatedString const& old_value() const { return m_old_value; }
|
||||
|
||||
private:
|
||||
MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
||||
MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
DeprecatedFlyString m_type;
|
||||
JS::GCPtr<Node> m_target;
|
||||
JS::GCPtr<Node const> m_target;
|
||||
JS::GCPtr<NodeList> m_added_nodes;
|
||||
JS::GCPtr<NodeList> m_removed_nodes;
|
||||
JS::GCPtr<Node> m_previous_sibling;
|
||||
|
|
|
@ -1390,7 +1390,7 @@ Painting::PaintableBox const* Node::paint_box() const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#queue-a-mutation-record
|
||||
void Node::queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling)
|
||||
void Node::queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling) const
|
||||
{
|
||||
// NOTE: We defer garbage collection until the end of the scope, since we can't safely use MutationObserver* as a hashmap key otherwise.
|
||||
// FIXME: This is a total hack.
|
||||
|
@ -1401,7 +1401,7 @@ void Node::queue_mutation_record(DeprecatedFlyString const& type, DeprecatedStri
|
|||
OrderedHashMap<MutationObserver*, DeprecatedString> interested_observers;
|
||||
|
||||
// 2. Let nodes be the inclusive ancestors of target.
|
||||
Vector<JS::Handle<Node>> nodes;
|
||||
Vector<JS::Handle<Node const>> nodes;
|
||||
nodes.append(JS::make_handle(*this));
|
||||
|
||||
for (auto* parent_node = parent(); parent_node; parent_node = parent_node->parent())
|
||||
|
@ -1558,18 +1558,18 @@ bool Node::is_following(Node const& other) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void Node::build_accessibility_tree(AccessibilityTreeNode& parent) const
|
||||
void Node::build_accessibility_tree(AccessibilityTreeNode& parent)
|
||||
{
|
||||
if (is_uninteresting_whitespace_node())
|
||||
return;
|
||||
|
||||
if (is_document()) {
|
||||
auto const* document = static_cast<DOM::Document const*>(this);
|
||||
auto const* document_element = document->document_element();
|
||||
auto* document = static_cast<DOM::Document*>(this);
|
||||
auto* document_element = document->document_element();
|
||||
if (document_element) {
|
||||
parent.set_value(document_element);
|
||||
if (document_element->has_child_nodes())
|
||||
document_element->for_each_child([&parent](DOM::Node const& child) {
|
||||
document_element->for_each_child([&parent](DOM::Node& child) {
|
||||
child.build_accessibility_tree(parent);
|
||||
});
|
||||
}
|
||||
|
@ -1580,7 +1580,7 @@ void Node::build_accessibility_tree(AccessibilityTreeNode& parent) const
|
|||
return;
|
||||
|
||||
if (element->include_in_accessibility_tree()) {
|
||||
auto current_node = AccessibilityTreeNode::create(const_cast<Document*>(&this->document()), this).release_value_but_fixme_should_propagate_errors();
|
||||
auto current_node = AccessibilityTreeNode::create(&document(), this).release_value_but_fixme_should_propagate_errors();
|
||||
parent.append_child(current_node);
|
||||
if (has_child_nodes()) {
|
||||
for_each_child([¤t_node](DOM::Node& child) {
|
||||
|
@ -1593,7 +1593,7 @@ void Node::build_accessibility_tree(AccessibilityTreeNode& parent) const
|
|||
});
|
||||
}
|
||||
} else if (is_text()) {
|
||||
parent.append_child(AccessibilityTreeNode::create(const_cast<Document*>(&this->document()), this).release_value_but_fixme_should_propagate_errors());
|
||||
parent.append_child(AccessibilityTreeNode::create(&document(), this).release_value_but_fixme_should_propagate_errors());
|
||||
if (has_child_nodes()) {
|
||||
for_each_child([&parent](DOM::Node& child) {
|
||||
child.build_accessibility_tree(parent);
|
||||
|
|
|
@ -224,7 +224,7 @@ public:
|
|||
|
||||
void add_registered_observer(RegisteredObserver& registered_observer) { m_registered_observer_list.append(registered_observer); }
|
||||
|
||||
void queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
|
||||
void queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling) const;
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-shadow-including-descendant
|
||||
template<typename Callback>
|
||||
|
@ -434,7 +434,7 @@ public:
|
|||
template<typename U, typename Callback>
|
||||
IterationDecision for_each_in_inclusive_subtree_of_type(Callback callback)
|
||||
{
|
||||
if (is<U>(static_cast<Node const&>(*this))) {
|
||||
if (is<U>(static_cast<Node&>(*this))) {
|
||||
if (callback(static_cast<U&>(*this)) == IterationDecision::Break)
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ protected:
|
|||
// "Nodes have a strong reference to registered observers in their registered observer list." https://dom.spec.whatwg.org/#garbage-collection
|
||||
Vector<RegisteredObserver&> m_registered_observer_list;
|
||||
|
||||
void build_accessibility_tree(AccessibilityTreeNode& parent) const;
|
||||
void build_accessibility_tree(AccessibilityTreeNode& parent);
|
||||
|
||||
ErrorOr<String> name_or_description(NameOrDescription, Document const&, HashTable<i32>&) const;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace Web::DOM {
|
|||
template<typename NodeType>
|
||||
class NonElementParentNode {
|
||||
public:
|
||||
JS::GCPtr<Element> get_element_by_id(DeprecatedFlyString const& id) const
|
||||
JS::GCPtr<Element const> get_element_by_id(DeprecatedFlyString const& id) const
|
||||
{
|
||||
JS::GCPtr<Element> found_element;
|
||||
JS::GCPtr<Element const> found_element;
|
||||
static_cast<NodeType const*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
if (element.attribute(HTML::AttributeNames::id) == id) {
|
||||
found_element = &element;
|
||||
|
@ -29,9 +29,18 @@ public:
|
|||
});
|
||||
return found_element;
|
||||
}
|
||||
|
||||
JS::GCPtr<Element> get_element_by_id(DeprecatedFlyString const& id)
|
||||
{
|
||||
return const_cast<NonElementParentNode const*>(this)->get_element_by_id(id);
|
||||
JS::GCPtr<Element> found_element;
|
||||
static_cast<NodeType*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
if (element.attribute(HTML::AttributeNames::id) == id) {
|
||||
found_element = &element;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return found_element;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -139,7 +139,7 @@ RelativeBoundaryPointPosition position_of_boundary_point_relative_to_other_bound
|
|||
// 4. If nodeA is an ancestor of nodeB:
|
||||
if (node_a.is_ancestor_of(node_b)) {
|
||||
// 1. Let child be nodeB.
|
||||
JS::NonnullGCPtr<Node> child = node_b;
|
||||
JS::NonnullGCPtr<Node const> child = node_b;
|
||||
|
||||
// 2. While child is not a child of nodeA, set child to its parent.
|
||||
while (!node_a.is_parent_of(child)) {
|
||||
|
@ -405,7 +405,7 @@ void Range::collapse(bool to_start)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-range-selectnodecontents
|
||||
WebIDL::ExceptionOr<void> Range::select_node_contents(Node const& node)
|
||||
WebIDL::ExceptionOr<void> Range::select_node_contents(Node& node)
|
||||
{
|
||||
// 1. If node is a doctype, throw an "InvalidNodeTypeError" DOMException.
|
||||
if (is<DocumentType>(node))
|
||||
|
@ -657,7 +657,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::extract()
|
|||
|
||||
// 11. Let contained children be a list of all children of common ancestor that are contained in range, in tree order.
|
||||
Vector<JS::NonnullGCPtr<Node>> contained_children;
|
||||
for (Node const* node = common_ancestor->first_child(); node; node = node->next_sibling()) {
|
||||
for (Node* node = common_ancestor->first_child(); node; node = node->next_sibling()) {
|
||||
if (contains_node(*node))
|
||||
contained_children.append(*node);
|
||||
}
|
||||
|
@ -983,7 +983,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::clone_the_content
|
|||
|
||||
// 11. Let contained children be a list of all children of common ancestor that are contained in range, in tree order.
|
||||
Vector<JS::NonnullGCPtr<Node>> contained_children;
|
||||
for (Node const* node = common_ancestor->first_child(); node; node = node->next_sibling()) {
|
||||
for (Node* node = common_ancestor->first_child(); node; node = node->next_sibling()) {
|
||||
if (contains_node(*node))
|
||||
contained_children.append(*node);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
WebIDL::ExceptionOr<void> set_end_after(Node& node);
|
||||
WebIDL::ExceptionOr<void> select_node(Node& node);
|
||||
void collapse(bool to_start);
|
||||
WebIDL::ExceptionOr<void> select_node_contents(Node const&);
|
||||
WebIDL::ExceptionOr<void> select_node_contents(Node&);
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-range-start_to_start
|
||||
enum HowToCompareBoundaryPoints : u16 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue