Truly independent web browser
LibWeb: Share hit testing between documents and shadow roots
Andreas Klinge6da89a44246
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txtindex b7c4c9a8a63..a564ee7a19d 100644--- a/Libraries/LibWeb/CMakeLists.txt+++ b/Libraries/LibWeb/CMakeLists.txt@@ -264,6 +264,7 @@ set(SOURCESDOM/DocumentLoadEventDelayer.cppDOM/DocumentLoading.cppDOM/DocumentObserver.cpp+ DOM/DocumentOrShadowRoot.cppDOM/DocumentType.cppDOM/DOMEventListener.cppDOM/DOMImplementation.cppdiff --git a/Libraries/LibWeb/CSS/CSS.idl b/Libraries/LibWeb/CSS/CSS.idlindex eb268bac268..aaf87e01878 100644--- a/Libraries/LibWeb/CSS/CSS.idl+++ b/Libraries/LibWeb/CSS/CSS.idl@@ -94,6 +94,13 @@ partial interface Document {readonly attribute Element? scrollingElement;};+// INTEROP: Chrome and Safari also expose these hit-testing methods on ShadowRoot.+// https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface+partial interface ShadowRoot {+ Element? elementFromPoint(double x, double y);+ sequence<Element> elementsFromPoint(double x, double y);+};+dictionary CaretPositionFromPointOptions {sequence<ShadowRoot> shadowRoots = [];};diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cppindex dd877fe64d9..87ebbda2b2d 100644--- a/Libraries/LibWeb/DOM/Document.cpp+++ b/Libraries/LibWeb/DOM/Document.cpp@@ -9658,86 +9658,14 @@ WebIDL::ExceptionOr<void> Document::set_design_mode(Utf16View design_mode)return {};}-// https://drafts.csswg.org/cssom-view/#dom-document-elementfrompointElement const* Document::element_from_point(double x, double y){- Layout::ForcedReadScope read { *this };- // 1. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll- // bar (if any), or y is greater than the viewport height excluding the size of a rendered scroll bar (if any), or- // there is no viewport associated with the document, return null and terminate these steps.- auto viewport_rect = this->viewport_rect();- CSSPixelPoint position { x, y };- // FIXME: This should account for the size of the scroll bar.- if (x < 0 || y < 0 || position.x() > viewport_rect.width() || position.y() > viewport_rect.height())- return nullptr;-- // Ensure the layout tree exists prior to hit testing.- update_layout(UpdateLayoutReason::DocumentElementFromPoint);-- // 2. If there is a box in the viewport that would be a target for hit testing at coordinates x,y, when applying the transforms- // that apply to the descendants of the viewport, return the associated element and terminate these steps.- GC::Ptr<Element> hit_element;- (void)hit_test_all(read, position, [&](Painting::HitTestResult result) {- if (auto* element = as_if<Element>(result.dom_node())) {- hit_element = element;- return TraversalDecision::Break;- }- return TraversalDecision::Continue;- });- if (hit_element) {- // AD-HOC: If element is inside a UA internal shadow root, retarget to the host.- return retarget_from_ua_internal_shadow_root(*hit_element);- }-- // 3. If the document has a root element, return the root element and terminate these steps.- if (auto const* root_element = document_element())- return root_element;-- // 4. Return null.- return nullptr;+ return calculate_element_from_point(*this, x, y);}-// https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompointGC::RootVector<GC::Ref<Element>> Document::elements_from_point(double x, double y){- Layout::ForcedReadScope read { *this };- // 1. Let sequence be a new empty sequence.- GC::RootVector<GC::Ref<Element>> sequence;-- // 2. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any),- // or y is greater than the viewport height excluding the size of a rendered scroll bar (if any),- // or there is no viewport associated with the document, return sequence and terminate these steps.- auto viewport_rect = this->viewport_rect();- CSSPixelPoint position { x, y };- // FIXME: This should account for the size of the scroll bar.- if (x < 0 || y < 0 || position.x() > viewport_rect.width() || position.y() > viewport_rect.height())- return sequence;-- // Ensure the layout tree exists prior to hit testing.- update_layout(UpdateLayoutReason::DocumentElementsFromPoint);-- // 3. For each box in the viewport, in paint order, starting with the topmost box, that would be a target for- // hit testing at coordinates x,y even if nothing would be overlapping it, when applying the transforms that- // apply to the descendants of the viewport, append the associated element to sequence.- (void)hit_test_all(read, position, [&](Painting::HitTestResult result) {- if (auto* element = as_if<Element>(result.dom_node())) {- // AD-HOC: If element is inside a UA internal shadow root, retarget to the host.- element = retarget_from_ua_internal_shadow_root(*element);- // AD-HOC: Avoid adding duplicates when multiple boxes resolve to the same element, or when multiple- // internal elements retarget to the same host.- if (!sequence.contains_slow(GC::Ref { *element }))- sequence.append(*element);- }- return TraversalDecision::Continue;- });-- // 4. If the document has a root element, and the last item in sequence is not the root element,- // append the root element to sequence.- if (auto* root_element = document_element(); root_element && (sequence.is_empty() || (sequence.last().ptr() != root_element)))- sequence.append(*root_element);-- // 5. Return sequence.- return sequence;+ return calculate_elements_from_point(*this, x, y);}static bool shadow_root_is_allowed_for_caret_position(ShadowRoot const& shadow_root, Document::CaretPositionFromPointOptions const& options)diff --git a/Libraries/LibWeb/DOM/DocumentOrShadowRoot.cpp b/Libraries/LibWeb/DOM/DocumentOrShadowRoot.cppnew file mode 100644index 00000000000..5f6f975cd20--- /dev/null+++ b/Libraries/LibWeb/DOM/DocumentOrShadowRoot.cpp@@ -0,0 +1,109 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#include <LibWeb/DOM/DocumentOrShadowRoot.h>+#include <LibWeb/DOM/Text.h>+#include <LibWeb/Layout/RenderDocument.h>+#include <LibWeb/Painting/HitTestResult.h>++namespace Web::DOM {++static Element* associated_hit_element(Painting::HitTestResult const& result, Node& context)+{+ auto* node = result.dom_node();+ if (!node)+ return nullptr;+ auto* element = as_if<Element>(node);+ // NB: Text fragments use their DOM parent element, or the host when directly under a shadow root.+ if (!element && is<Text>(*node))+ element = node->parent_or_shadow_host_element();+ if (!element)+ return nullptr;+ // INTEROP: Chrome and Safari retarget hit elements against the document or shadow root making the query.+ // https://dom.spec.whatwg.org/#retarget+ return as<Element>(retarget(element, &context));+}++// https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint+Element const* calculate_element_from_point(Node& context, double x, double y)+{+ auto& document = context.document();+ Layout::ForcedReadScope read { document };+ // 1. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll+ // bar (if any), or y is greater than the viewport height excluding the size of a rendered scroll bar (if any), or+ // there is no viewport associated with the document, return null and terminate these steps.+ auto viewport_rect = document.viewport_rect();+ CSSPixelPoint position { x, y };+ // FIXME: This should account for the size of the scroll bar.+ if (x < 0 || y < 0 || position.x() > viewport_rect.width() || position.y() > viewport_rect.height())+ return nullptr;++ // NB: Ensure the layout tree exists prior to hit testing.+ document.update_layout(UpdateLayoutReason::DocumentElementFromPoint);++ // 2. If there is a box in the viewport that would be a target for hit testing at coordinates x,y, when applying the transforms+ // that apply to the descendants of the viewport, return the associated element and terminate these steps.+ GC::Ptr<Element> hit_element;+ (void)document.hit_test_all(read, position, [&](Painting::HitTestResult result) {+ if (auto* element = associated_hit_element(result, context)) {+ hit_element = element;+ return TraversalDecision::Break;+ }+ return TraversalDecision::Continue;+ });+ if (hit_element)+ return hit_element.ptr();++ // 3. If the document has a root element, return the root element and terminate these steps.+ if (auto const* root_element = document.document_element())+ return root_element;++ // 4. Return null.+ return nullptr;+}++// https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint+GC::RootVector<GC::Ref<Element>> calculate_elements_from_point(Node& context, double x, double y)+{+ auto& document = context.document();+ Layout::ForcedReadScope read { document };+ // 1. Let sequence be a new empty sequence.+ GC::RootVector<GC::Ref<Element>> sequence;++ // 2. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any),+ // or y is greater than the viewport height excluding the size of a rendered scroll bar (if any),+ // or there is no viewport associated with the document, return sequence and terminate these steps.+ auto viewport_rect = document.viewport_rect();+ CSSPixelPoint position { x, y };+ // FIXME: This should account for the size of the scroll bar.+ if (x < 0 || y < 0 || position.x() > viewport_rect.width() || position.y() > viewport_rect.height())+ return sequence;++ // NB: Ensure the layout tree exists prior to hit testing.+ document.update_layout(UpdateLayoutReason::DocumentElementsFromPoint);++ // 3. For each box in the viewport, in paint order, starting with the topmost box, that would be a target for+ // hit testing at coordinates x,y even if nothing would be overlapping it, when applying the transforms that+ // apply to the descendants of the viewport, append the associated element to sequence.+ (void)document.hit_test_all(read, position, [&](Painting::HitTestResult result) {+ if (auto* element = associated_hit_element(result, context)) {+ // NB: Avoid duplicates when multiple boxes resolve or retarget to the same element.+ if (!sequence.contains_slow(GC::Ref { *element }))+ sequence.append(*element);+ }+ return TraversalDecision::Continue;+ });++ // 4. If the document has a root element, and the last item in sequence is not the root element,+ // append the root element to sequence.+ if (auto* root_element = document.document_element(); root_element && (sequence.is_empty() || (sequence.last().ptr() != root_element)))+ sequence.append(*root_element);++ // 5. Return sequence.+ return sequence;+}++}diff --git a/Libraries/LibWeb/DOM/DocumentOrShadowRoot.h b/Libraries/LibWeb/DOM/DocumentOrShadowRoot.hindex 4534f779081..abfc037ae2b 100644--- a/Libraries/LibWeb/DOM/DocumentOrShadowRoot.h+++ b/Libraries/LibWeb/DOM/DocumentOrShadowRoot.h@@ -19,6 +19,9 @@ namespace Web::DOM {template<typename T>concept DocumentOrShadowRoot = OneOf<T, Document, ShadowRoot>;+Element const* calculate_element_from_point(Node&, double x, double y);+GC::RootVector<GC::Ref<Element>> calculate_elements_from_point(Node&, double x, double y);+// https://html.spec.whatwg.org/multipage/interaction.html#dom-documentorshadowroot-activeelementtemplate<DocumentOrShadowRoot T>GC::Ptr<Element> calculate_active_element(T& self)diff --git a/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Libraries/LibWeb/DOM/ShadowRoot.cppindex 5bb54f60af3..b807144595f 100644--- a/Libraries/LibWeb/DOM/ShadowRoot.cpp+++ b/Libraries/LibWeb/DOM/ShadowRoot.cpp@@ -230,6 +230,16 @@ GC::Ptr<Element> ShadowRoot::active_element()return calculate_active_element(*this);}+Element const* ShadowRoot::element_from_point(double x, double y)+{+ return calculate_element_from_point(*this, x, y);+}++GC::RootVector<GC::Ref<Element>> ShadowRoot::elements_from_point(double x, double y)+{+ return calculate_elements_from_point(*this, x, y);+}+CSS::StyleSheetList& ShadowRoot::style_sheets(){if (!m_style_sheets)diff --git a/Libraries/LibWeb/DOM/ShadowRoot.h b/Libraries/LibWeb/DOM/ShadowRoot.hindex 43a1c48dc16..b56dac3b2d7 100644--- a/Libraries/LibWeb/DOM/ShadowRoot.h+++ b/Libraries/LibWeb/DOM/ShadowRoot.h@@ -73,6 +73,9 @@ public:GC::Ptr<Element> active_element();+ Element const* element_from_point(double x, double y);+ GC::RootVector<GC::Ref<Element>> elements_from_point(double x, double y);+CSS::StyleSheetList& style_sheets();CSS::StyleSheetList const& style_sheets() const;diff --git a/Tests/LibWeb/Text/expected/hit_testing/inert-toggle-after-paint.txt b/Tests/LibWeb/Text/expected/hit_testing/inert-toggle-after-paint.txtindex 85c3b93fbbd..799a83f341f 100644--- a/Tests/LibWeb/Text/expected/hit_testing/inert-toggle-after-paint.txt+++ b/Tests/LibWeb/Text/expected/hit_testing/inert-toggle-after-paint.txt@@ -1,6 +1,6 @@before inert:text: text-row / #text-contents: contents-row / #text+contents: contents / #textpseudo: pseudo / nullfirst letter: letter-row / #textcontainer inert:@@ -10,7 +10,7 @@ pseudo: pseudo / nullfirst letter: letter-row / nullcontainer inert removed:text: text-row / #text-contents: contents-row / #text+contents: contents / #textpseudo: pseudo / nullfirst letter: letter-row / #textdisplay: contents span inert:@@ -20,6 +20,6 @@ pseudo: pseudo / nullfirst letter: letter-row / #textdisplay: contents span inert removed:text: text-row / #text-contents: contents-row / #text+contents: contents / #textpseudo: pseudo / nullfirst letter: letter-row / #textdiff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.txtindex 00e7bd70004..945521ca5b7 100644--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.txt@@ -2,45 +2,46 @@ Harness status: OKFound 41 tests-41 Fail-Fail document.elementFromPoint and shadow.ElementFromPoint must return the shadow host of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline-Fail document.elementFromPoint and shadow.ElementFromPoint must return the shadow host of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: block-Fail document.elementFromPoint and shadow.ElementFromPoint must return the shadow host of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline-block-Fail document.elementFromPoint and shadowRoot.elementFromPoint must return the shadow host when the hit-tested text node is assigned to a slot and the host has display: inline-Fail document.elementFromPoint and shadowRoot.elementFromPoint must return the shadow host when the hit-tested text node is assigned to a slot and the host has display: block-Fail document.elementFromPoint and shadowRoot.elementFromPoint must return the shadow host when the hit-tested text node is assigned to a slot and the host has display: inline-block-Fail document.elementFromPoint and shadowRoot.elementFromPoint must return the element assigned to a slot when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline-Fail document.elementFromPoint and shadowRoot.elementFromPoint must return the element assigned to a slot when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: block-Fail document.elementFromPoint and shadowRoot.elementFromPoint must return the element assigned to a slot when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline-block-Fail document.elementFromPoint must return the shadow host of the hit-tested element under a shadow root and shadowRoot.elementFromPoint must return the element parent of the hit-tested text node under the point when the shadow host has display: inline-Fail document.elementFromPoint must return the shadow host of the hit-tested element under a shadow root and shadowRoot.elementFromPoint must return the element parent of the hit-tested text node under the point when the shadow host has display: block-Fail document.elementFromPoint must return the shadow host of the hit-tested element under a shadow root and shadowRoot.elementFromPoint must return the element parent of the hit-tested text node under the point when the shadow host has display: inline-block-Fail document.elementFromPoint must return the shadow host and shadowRoot.elementFromPoint must return the slot parent of the fallback text when the hit-tested text node is a fallback content and the host has display: inline-Fail document.elementFromPoint must return the shadow host and shadowRoot.elementFromPoint must return the slot parent of the fallback text when the hit-tested text node is a fallback content and the host has display: block-Fail document.elementFromPoint must return the shadow host and shadowRoot.elementFromPoint must return the slot parent of the fallback text when the hit-tested text node is a fallback content and the host has display: inline-block-Fail document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element assigned to a slot when the hit-tested text node is assigned to a slot in the shadow tree of the child element and the outer shadow host has display: inline-Fail document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element assigned to a slot when the hit-tested text node is assigned to a slot in the shadow tree of the child element and the outer shadow host has display: block-Fail document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element assigned to a slot when the hit-tested text node is assigned to a slot in the shadow tree of the child element and the outer shadow host has display: inline-block-Fail document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is its direct child and the outer shadow host has display: inline-Fail document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is its direct child and the outer shadow host has display: block-Fail document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is its direct child and the outer shadow host has display: inline-block-Fail document.elementFromPoint, shadowRoot.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is a child of another element and innerShadow.elementFromPoint must return the parent element of the hit-tested text node under it when the outer shadow host has display: inline-Fail document.elementFromPoint, shadowRoot.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is a child of another element and innerShadow.elementFromPoint must return the parent element of the hit-tested text node under it when the outer shadow host has display: block-Fail document.elementFromPoint, shadowRoot.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is a child of another element and innerShadow.elementFromPoint must return the parent element of the hit-tested text node under it when the outer shadow host has display: inline-block-Fail document.elementsFromPoint and shadow.elementsFromPoint must return the shadow host and its ancestors of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline-Fail document.elementsFromPoint and shadow.elementsFromPoint must return the shadow host and its ancestors of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: block-Fail document.elementsFromPoint and shadow.elementsFromPoint must return the shadow host and its ancestors of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline-block-Fail document.elementsFromPoint and shadowRoot.elementsFromPoint must return the shadow host and its ancestors when the hit-tested text node is assigned to a slot and the host has display: inline-Fail document.elementsFromPoint and shadowRoot.elementsFromPoint must return the shadow host and its ancestors when the hit-tested text node is assigned to a slot and the host has display: block-Fail document.elementsFromPoint and shadowRoot.elementsFromPoint must return the shadow host and its ancestors when the hit-tested text node is assigned to a slot and the host has display: inline-block+39 Pass+2 Fail+Pass document.elementFromPoint and shadow.ElementFromPoint must return the shadow host of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline+Pass document.elementFromPoint and shadow.ElementFromPoint must return the shadow host of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: block+Pass document.elementFromPoint and shadow.ElementFromPoint must return the shadow host of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline-block+Pass document.elementFromPoint and shadowRoot.elementFromPoint must return the shadow host when the hit-tested text node is assigned to a slot and the host has display: inline+Pass document.elementFromPoint and shadowRoot.elementFromPoint must return the shadow host when the hit-tested text node is assigned to a slot and the host has display: block+Pass document.elementFromPoint and shadowRoot.elementFromPoint must return the shadow host when the hit-tested text node is assigned to a slot and the host has display: inline-block+Pass document.elementFromPoint and shadowRoot.elementFromPoint must return the element assigned to a slot when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline+Pass document.elementFromPoint and shadowRoot.elementFromPoint must return the element assigned to a slot when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: block+Pass document.elementFromPoint and shadowRoot.elementFromPoint must return the element assigned to a slot when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline-block+Pass document.elementFromPoint must return the shadow host of the hit-tested element under a shadow root and shadowRoot.elementFromPoint must return the element parent of the hit-tested text node under the point when the shadow host has display: inline+Pass document.elementFromPoint must return the shadow host of the hit-tested element under a shadow root and shadowRoot.elementFromPoint must return the element parent of the hit-tested text node under the point when the shadow host has display: block+Pass document.elementFromPoint must return the shadow host of the hit-tested element under a shadow root and shadowRoot.elementFromPoint must return the element parent of the hit-tested text node under the point when the shadow host has display: inline-block+Pass document.elementFromPoint must return the shadow host and shadowRoot.elementFromPoint must return the slot parent of the fallback text when the hit-tested text node is a fallback content and the host has display: inline+Pass document.elementFromPoint must return the shadow host and shadowRoot.elementFromPoint must return the slot parent of the fallback text when the hit-tested text node is a fallback content and the host has display: block+Pass document.elementFromPoint must return the shadow host and shadowRoot.elementFromPoint must return the slot parent of the fallback text when the hit-tested text node is a fallback content and the host has display: inline-block+Pass document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element assigned to a slot when the hit-tested text node is assigned to a slot in the shadow tree of the child element and the outer shadow host has display: inline+Pass document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element assigned to a slot when the hit-tested text node is assigned to a slot in the shadow tree of the child element and the outer shadow host has display: block+Pass document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element assigned to a slot when the hit-tested text node is assigned to a slot in the shadow tree of the child element and the outer shadow host has display: inline-block+Pass document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is its direct child and the outer shadow host has display: inline+Pass document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is its direct child and the outer shadow host has display: block+Pass document.elementFromPoint, shadowRoot.elementFromPoint, innerShadow.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is its direct child and the outer shadow host has display: inline-block+Pass document.elementFromPoint, shadowRoot.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is a child of another element and innerShadow.elementFromPoint must return the parent element of the hit-tested text node under it when the outer shadow host has display: inline+Pass document.elementFromPoint, shadowRoot.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is a child of another element and innerShadow.elementFromPoint must return the parent element of the hit-tested text node under it when the outer shadow host has display: block+Pass document.elementFromPoint, shadowRoot.elementFromPoint must return a child element with its own shadow tree assigned to a slot when the hit-tested text node is a child of another element and innerShadow.elementFromPoint must return the parent element of the hit-tested text node under it when the outer shadow host has display: inline-block+Pass document.elementsFromPoint and shadow.elementsFromPoint must return the shadow host and its ancestors of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline+Pass document.elementsFromPoint and shadow.elementsFromPoint must return the shadow host and its ancestors of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: block+Pass document.elementsFromPoint and shadow.elementsFromPoint must return the shadow host and its ancestors of the hit-tested text node when the hit-tested text node is a direct child of the root and the host has display: inline-block+Pass document.elementsFromPoint and shadowRoot.elementsFromPoint must return the shadow host and its ancestors when the hit-tested text node is assigned to a slot and the host has display: inline+Pass document.elementsFromPoint and shadowRoot.elementsFromPoint must return the shadow host and its ancestors when the hit-tested text node is assigned to a slot and the host has display: block+Pass document.elementsFromPoint and shadowRoot.elementsFromPoint must return the shadow host and its ancestors when the hit-tested text node is assigned to a slot and the host has display: inline-blockFail document.elementsFromPoint and shadowRoot.elementsFromPoint must return the element assigned to a slot and its non-shadow ancestors when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline-Fail document.elementsFromPoint and shadowRoot.elementsFromPoint must return the element assigned to a slot and its non-shadow ancestors when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: block-Fail document.elementsFromPoint and shadowRoot.elementsFromPoint must return the element assigned to a slot and its non-shadow ancestors when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline-block-Fail document.elementsFromPoint must return the shadow host and its ancestors of the hit-tested element under a shadow root andshadowRoot.elementsFromPoint must return the element parent and its non-shadow ancestors of the hit-tested text node under the point when the shadow host has display: inline-Fail document.elementsFromPoint must return the shadow host and its ancestors of the hit-tested element under a shadow root andshadowRoot.elementsFromPoint must return the element parent and its non-shadow ancestors of the hit-tested text node under the point when the shadow host has display: block-Fail document.elementsFromPoint must return the shadow host and its ancestors of the hit-tested element under a shadow root andshadowRoot.elementsFromPoint must return the element parent and its non-shadow ancestors of the hit-tested text node under the point when the shadow host has display: inline-block+Pass document.elementsFromPoint and shadowRoot.elementsFromPoint must return the element assigned to a slot and its non-shadow ancestors when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: block+Pass document.elementsFromPoint and shadowRoot.elementsFromPoint must return the element assigned to a slot and its non-shadow ancestors when hit-tested text node under an element is assigned to a slot in the shadow tree and the shadow host of the slot has display: inline-block+Pass document.elementsFromPoint must return the shadow host and its ancestors of the hit-tested element under a shadow root andshadowRoot.elementsFromPoint must return the element parent and its non-shadow ancestors of the hit-tested text node under the point when the shadow host has display: inline+Pass document.elementsFromPoint must return the shadow host and its ancestors of the hit-tested element under a shadow root andshadowRoot.elementsFromPoint must return the element parent and its non-shadow ancestors of the hit-tested text node under the point when the shadow host has display: block+Pass document.elementsFromPoint must return the shadow host and its ancestors of the hit-tested element under a shadow root andshadowRoot.elementsFromPoint must return the element parent and its non-shadow ancestors of the hit-tested text node under the point when the shadow host has display: inline-blockFail document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: inline-Fail document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: block-Fail document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: inline-block-Fail shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element-Fail elementsFromPoint should return all elements under a point, even when context object is not connected\ No newline at end of file+Pass document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: block+Pass document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: inline-block+Pass shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element+Pass elementsFromPoint should return all elements under a point, even when context object is not connected\ No newline at end of file