Bug 1359054 - Take shadow DOM into account when getting paint tree; r?maja_zf
We want to take shadow DOM into account when getting an element's
pointer-interactable paint tree.
Marionette is currently unable to determine if an element inside a shadow
DOM host is disconnected from the document because we are constructing
the frame container with only the main document.
MozReview-Commit-ID: IPDi8fQZYRP
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -990,19 +990,27 @@ element.getInViewCentrePoint = function
* Element to determine if is pointer-interactable.
*
* @return {Array.<DOMElement>}
* Sequence of elements in paint order.
*/
element.getPointerInteractablePaintTree = function (el) {
const doc = el.ownerDocument;
const win = doc.defaultView;
+ const container = {frame: win};
+ const rootNode = el.getRootNode();
+
+ // Include shadow DOM host only if the element's root node is not the
+ // owner document.
+ if (rootNode !== doc) {
+ container.shadowRoot = rootNode;
+ }
// pointer-interactable elements tree, step 1
- if (element.isDisconnected(el, {frame: win})) {
+ if (element.isDisconnected(el, container)) {
return [];
}
// steps 2-3
let rects = el.getClientRects();
if (rects.length == 0) {
return [];
}