Bug 1321516 - Take shadow DOM into account when getting paint tree draft
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 17 Apr 2017 17:51:13 +0100
changeset 567220 3711864cedcec8cd802c3b00f611d9ab3db33013
parent 567219 4afe4a7cd8109b152ac38ece639a7d5262e0b225
child 567221 0d77d54cd18cf9788693525f55bbd985d8451333
push id55475
push userbmo:ato@mozilla.com
push dateMon, 24 Apr 2017 14:23:53 +0000
bugs1321516
milestone55.0a1
Bug 1321516 - Take shadow DOM into account when getting paint tree MozReview-Commit-ID: 3HXEnVD1u89
testing/marionette/element.js
--- 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 [];
   }