Bug 1465873 - part6: Rename isDirectShadowHostChild to isShadowHostChild;r=bgrins draft
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 28 Jun 2018 11:24:31 +0200
changeset 812709 2231c77a6db2ca9cf32c596b0d82e8c606c0112a
parent 812708 57bbe607b7f1a465c6ba7c9a99a3eac0d3bb49a8
child 812710 a641c1f0e84f86f7d62c8a9f6dfb6ea308f5f198
push id114658
push userjdescottes@mozilla.com
push dateFri, 29 Jun 2018 22:24:22 +0000
reviewersbgrins
bugs1465873
milestone63.0a1
Bug 1465873 - part6: Rename isDirectShadowHostChild to isShadowHostChild;r=bgrins MozReview-Commit-ID: IaUyuJVQ0ta
devtools/client/inspector/markup/markup.js
devtools/server/actors/inspector/node.js
devtools/server/actors/inspector/walker.js
devtools/shared/fronts/node.js
devtools/shared/layout/utils.js
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -1781,17 +1781,17 @@ MarkupView.prototype = {
         // while the request was in progress, we need to do it again.
         if (container.childrenDirty) {
           return this._updateChildren(container, {expand: centered || expand});
         }
 
         const fragment = this.doc.createDocumentFragment();
 
         for (const child of children.nodes) {
-          const slotted = !isShadowHost && child.isDirectShadowHostChild;
+          const slotted = !isShadowHost && child.isShadowHostChild;
           const childContainer = this.importNode(child, flash, slotted);
           fragment.appendChild(childContainer.elt);
         }
 
         while (container.children.firstChild) {
           container.children.firstChild.remove();
         }
 
--- a/devtools/server/actors/inspector/node.js
+++ b/devtools/server/actors/inspector/node.js
@@ -14,20 +14,20 @@ loader.lazyRequireGetter(this, "colorUti
 
 loader.lazyRequireGetter(this, "getCssPath", "devtools/shared/inspector/css-logic", true);
 loader.lazyRequireGetter(this, "getXPath", "devtools/shared/inspector/css-logic", true);
 loader.lazyRequireGetter(this, "findCssSelector", "devtools/shared/inspector/css-logic", true);
 
 loader.lazyRequireGetter(this, "isAfterPseudoElement", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isAnonymous", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isBeforePseudoElement", "devtools/shared/layout/utils", true);
-loader.lazyRequireGetter(this, "isDirectShadowHostChild", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isNativeAnonymous", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isShadowAnonymous", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isShadowHost", "devtools/shared/layout/utils", true);
+loader.lazyRequireGetter(this, "isShadowHostChild", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isShadowRoot", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isXBLAnonymous", "devtools/shared/layout/utils", true);
 
 loader.lazyRequireGetter(this, "InspectorActorUtils", "devtools/server/actors/inspector/utils");
 loader.lazyRequireGetter(this, "LongStringActor", "devtools/server/actors/string", true);
 loader.lazyRequireGetter(this, "getFontPreviewData", "devtools/server/actors/styles", true);
 loader.lazyRequireGetter(this, "CssLogic", "devtools/server/actors/inspector/css-logic", true);
 loader.lazyRequireGetter(this, "EventParsers", "devtools/server/actors/inspector/event-parsers", true);
@@ -125,17 +125,17 @@ const NodeActor = protocol.ActorClassWit
       isBeforePseudoElement: isBeforePseudoElement(this.rawNode),
       isAfterPseudoElement: isAfterPseudoElement(this.rawNode),
       isAnonymous: isAnonymous(this.rawNode),
       isNativeAnonymous: isNativeAnonymous(this.rawNode),
       isXBLAnonymous: isXBLAnonymous(this.rawNode),
       isShadowAnonymous: isShadowAnonymous(this.rawNode),
       isShadowRoot: isShadowRoot(this.rawNode),
       isShadowHost: isShadowHost(this.rawNode),
-      isDirectShadowHostChild: isDirectShadowHostChild(this.rawNode),
+      isShadowHostChild: isShadowHostChild(this.rawNode),
       pseudoClassLocks: this.writePseudoClassLocks(),
 
       isDisplayed: this.isDisplayed,
       isInHTMLDocument: this.rawNode.ownerDocument &&
         this.rawNode.ownerDocument.contentType === "text/html",
       hasEventListeners: this._hasEventListeners,
     };
 
--- a/devtools/server/actors/inspector/walker.js
+++ b/devtools/server/actors/inspector/walker.js
@@ -11,18 +11,18 @@ const protocol = require("devtools/share
 const {walkerSpec} = require("devtools/shared/specs/inspector");
 const {LongStringActor} = require("devtools/server/actors/string");
 const InspectorUtils = require("InspectorUtils");
 
 loader.lazyRequireGetter(this, "getFrameElement", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isAfterPseudoElement", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isAnonymous", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isBeforePseudoElement", "devtools/shared/layout/utils", true);
-loader.lazyRequireGetter(this, "isDirectShadowHostChild", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isShadowHost", "devtools/shared/layout/utils", true);
+loader.lazyRequireGetter(this, "isShadowHostChild", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isShadowRoot", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isTemplateElement", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "loadSheet", "devtools/shared/layout/utils", true);
 
 loader.lazyRequireGetter(this, "throttle", "devtools/shared/throttle", true);
 
 loader.lazyRequireGetter(this, "allAnonymousContentTreeWalkerFilter", "devtools/server/actors/inspector/utils", true);
 loader.lazyRequireGetter(this, "isNodeDead", "devtools/server/actors/inspector/utils", true);
@@ -438,17 +438,17 @@ var WalkerActor = protocol.ActorClassWit
     return null;
   },
 
   rawParentNode: function(node) {
     let parent;
     try {
       // If the node is the child of a shadow host, we can not use an anonymous walker to
       // get the shadow host parent.
-      const walker = isDirectShadowHostChild(node.rawNode)
+      const walker = isShadowHostChild(node.rawNode)
         ? this.getNonAnonymousWalker(node.rawNode)
         : this.getDocumentWalker(node.rawNode);
       parent = walker.parentNode();
     } catch (e) {
       // When getting the parent node for a child of a non-slotted shadow host child,
       // walker.parentNode() will throw if the walker is anonymous, because non-slotted
       // shadow host children are not accessible anywhere in the anonymous tree.
       const walker = this.getNonAnonymousWalker(node.rawNode);
@@ -468,17 +468,17 @@ var WalkerActor = protocol.ActorClassWit
     // Quick checks to prevent creating a new walker if possible.
     if (isBeforePseudoElement(node.rawNode) ||
         isAfterPseudoElement(node.rawNode) ||
         node.rawNode.nodeType != Node.ELEMENT_NODE ||
         node.rawNode.children.length > 0) {
       return undefined;
     }
 
-    const walker = isDirectShadowHostChild(node.rawNode)
+    const walker = isShadowHostChild(node.rawNode)
       ? this.getNonAnonymousWalker(node.rawNode)
       : this.getDocumentWalker(node.rawNode);
     const firstChild = walker.firstChild();
 
     // Bail out if:
     // - more than one child
     // - unique child is not a text node
     // - unique child is a text node, but is too long to be inlined
@@ -635,17 +635,17 @@ var WalkerActor = protocol.ActorClassWit
     if (options.center && options.start) {
       throw Error("Can't specify both 'center' and 'start' options.");
     }
     let maxNodes = options.maxNodes || -1;
     if (maxNodes == -1) {
       maxNodes = Number.MAX_VALUE;
     }
 
-    const directShadowHostChild = isDirectShadowHostChild(node.rawNode);
+    const directShadowHostChild = isShadowHostChild(node.rawNode);
     const shadowHost = isShadowHost(node.rawNode);
     const shadowRoot = isShadowRoot(node.rawNode);
     const templateElement = isTemplateElement(node.rawNode);
 
     if (templateElement) {
       // <template> tags should have a single child pointing to the element's template
       // content.
       const documentFragment = node.rawNode.content;
--- a/devtools/shared/fronts/node.js
+++ b/devtools/shared/fronts/node.js
@@ -298,18 +298,18 @@ const NodeFront = FrontClassWithSpec(nod
   get isShadowRoot() {
     return this._form.isShadowRoot;
   },
 
   get isShadowHost() {
     return this._form.isShadowHost;
   },
 
-  get isDirectShadowHostChild() {
-    return this._form.isDirectShadowHostChild;
+  get isShadowHostChild() {
+    return this._form.isShadowHostChild;
   },
 
   // doctype properties
   get name() {
     return this._form.name;
   },
   get publicId() {
     return this._form.publicId;
--- a/devtools/shared/layout/utils.js
+++ b/devtools/shared/layout/utils.js
@@ -625,26 +625,26 @@ exports.isShadowHost = isShadowHost;
 /**
  * Determine whether a node is a child of a shadow host. Even if the element has been
  * assigned to a slot in the attached shadow DOM, the parent node for this element is
  * still considered to be the "host" element, and we need to walk them differently.
  *
  * @param {DOMNode} node
  * @return {Boolean}
  */
-function isDirectShadowHostChild(node) {
+function isShadowHostChild(node) {
   // Pseudo elements are always part of the anonymous tree.
   if (isBeforePseudoElement(node) || isAfterPseudoElement(node)) {
     return false;
   }
 
   const parentNode = node.parentNode;
   return parentNode && !!parentNode.openOrClosedShadowRoot;
 }
-exports.isDirectShadowHostChild = isDirectShadowHostChild;
+exports.isShadowHostChild = isShadowHostChild;
 
 /**
  * Determine whether a node is a ::before pseudo.
  *
  * @param {DOMNode} node
  * @return {Boolean}
  */
 function isBeforePseudoElement(node) {