diff options
author | Karol Kosek <krkk@serenityos.org> | 2023-01-28 20:22:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-02 14:43:29 +0100 |
commit | 2cc108a15e0ed67841f1c4cc691f7705a301ce91 (patch) | |
tree | a2d5e531702632aab365642e3dec8fe91203cfaf | |
parent | 9a7f786262d5826396ca987e194cb94f72d2c708 (diff) | |
download | serenity-2cc108a15e0ed67841f1c4cc691f7705a301ce91.zip |
LibWeb: Rename DOM::shadow_root() to shadow_root_internal()
The shadowRoot property getter that will be added in subsequent commits
has an additional check that checks whether the shadow root is opened.
I didn't update the function logic to match with the IDL interface,
because it's very likely we don't want that check in the existing code,
so that for example closed shadow root elements can still be updated.
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Element.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Node.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/ShadowRoot.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Focus.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp | 2 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index b5ed5db770..e2730c4d47 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -894,7 +894,7 @@ void Document::update_layout() if (needs_full_style_update || node.child_needs_style_update()) { if (node.is_element()) { - if (auto* shadow_root = static_cast<DOM::Element&>(node).shadow_root()) { + if (auto* shadow_root = static_cast<DOM::Element&>(node).shadow_root_internal()) { if (needs_full_style_update || shadow_root->needs_style_update() || shadow_root->child_needs_style_update()) needs_relayout |= update_style_recursively(*shadow_root); } diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 48356195f3..1fe9b02258 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -131,8 +131,8 @@ public: JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(DeprecatedFlyString const&); - ShadowRoot* shadow_root() { return m_shadow_root.ptr(); } - ShadowRoot const* shadow_root() const { return m_shadow_root.ptr(); } + ShadowRoot* shadow_root_internal() { return m_shadow_root.ptr(); } + ShadowRoot const* shadow_root_internal() const { return m_shadow_root.ptr(); } void set_shadow_root(JS::GCPtr<ShadowRoot>); void set_custom_properties(HashMap<DeprecatedFlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); } diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 8de25502e8..08165a3d9d 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -247,7 +247,7 @@ void Node::invalidate_style() node.m_needs_style_update = true; if (node.has_children()) node.m_child_needs_style_update = true; - if (auto* shadow_root = node.is_element() ? static_cast<DOM::Element&>(node).shadow_root() : nullptr) { + if (auto* shadow_root = node.is_element() ? static_cast<DOM::Element&>(node).shadow_root_internal() : nullptr) { node.m_child_needs_style_update = true; shadow_root->m_needs_style_update = true; if (shadow_root->has_children()) diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h index b4d33a8df4..37e1add258 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h @@ -53,7 +53,7 @@ inline IterationDecision Node::for_each_shadow_including_descendant(Callback cal return IterationDecision::Break; for (auto* child = first_child(); child; child = child->next_sibling()) { if (child->is_element()) { - if (JS::GCPtr<ShadowRoot> shadow_root = static_cast<Element*>(child)->shadow_root()) { + if (JS::GCPtr<ShadowRoot> shadow_root = static_cast<Element*>(child)->shadow_root_internal()) { if (shadow_root->for_each_shadow_including_descendant(callback) == IterationDecision::Break) return IterationDecision::Break; } diff --git a/Userland/Libraries/LibWeb/HTML/Focus.cpp b/Userland/Libraries/LibWeb/HTML/Focus.cpp index 5eeef7f8c0..e74322da62 100644 --- a/Userland/Libraries/LibWeb/HTML/Focus.cpp +++ b/Userland/Libraries/LibWeb/HTML/Focus.cpp @@ -218,7 +218,7 @@ void run_unfocusing_steps(DOM::Node* old_focus_target) // context's DOM anchor, then set old focus target to that currently focused area of a top-level browsing // context. if (is_shadow_host(old_focus_target)) { - auto* shadow_root = static_cast<DOM::Element*>(old_focus_target)->shadow_root(); + auto* shadow_root = static_cast<DOM::Element*>(old_focus_target)->shadow_root_internal(); if (shadow_root->delegates_focus()) { auto& top_level_browsing_context = old_focus_target->document().browsing_context()->top_level_browsing_context(); if (auto currently_focused_area = top_level_browsing_context.currently_focused_area()) { diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 659bff0487..d3f89c4c5e 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -239,7 +239,7 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: insert_node_into_inline_or_block_ancestor(*layout_node, display, AppendOrPrepend::Append); } - auto* shadow_root = is<DOM::Element>(dom_node) ? verify_cast<DOM::Element>(dom_node).shadow_root() : nullptr; + auto* shadow_root = is<DOM::Element>(dom_node) ? verify_cast<DOM::Element>(dom_node).shadow_root_internal() : nullptr; if ((dom_node.has_children() || shadow_root) && layout_node->can_have_children()) { push_parent(verify_cast<NodeWithStyle>(*layout_node)); diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index ec4116072d..2f5310ac43 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -996,7 +996,7 @@ Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get auto* element = TRY(get_known_connected_element(element_id)); // 4. Let shadow root be element's shadow root. - auto* shadow_root = element->shadow_root(); + auto* shadow_root = element->shadow_root_internal(); // 5. If shadow root is null, return error with error code no such shadow root. if (!shadow_root) |