Bug 1321516 - Take shadow DOM into account when getting paint tree
MozReview-Commit-ID: 3HXEnVD1u89
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -995,19 +995,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 [];
}