mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:48:11 +00:00
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.
This commit is contained in:
parent
9a7f786262
commit
2cc108a15e
7 changed files with 8 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue