Bug 1450526 - Part 2: Modify Reps component to show pseudo element name. r?pbro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Wed, 04 Apr 2018 01:07:53 +0900
changeset 776710 a83e8f932ff1fdc383bc61cfac525a54fe28a9d6
parent 776709 2f8deb59c0430dd3f16ee32693519009d098b0c3
child 776711 d64012cb619c2d1722d8f95486e92be120aaaee7
push id104964
push userbmo:dakatsuka@mozilla.com
push dateTue, 03 Apr 2018 16:22:15 +0000
reviewerspbro
bugs1450526
milestone61.0a1
Bug 1450526 - Part 2: Modify Reps component to show pseudo element name. r?pbro MozReview-Commit-ID: LiBs5WyJZFL
devtools/client/inspector/shared/utils.js
devtools/client/shared/components/reps/reps.js
--- a/devtools/client/inspector/shared/utils.js
+++ b/devtools/client/inspector/shared/utils.js
@@ -140,16 +140,18 @@ function translateNodeFrontToGrip(nodeFr
     attributesMap[name] = value;
   }
 
   return {
     actor: nodeFront.actorID,
     preview: {
       attributes: attributesMap,
       attributesLength: attributes.length,
+      isAfterPseudoElement: nodeFront.isAfterPseudoElement,
+      isBeforePseudoElement: nodeFront.isBeforePseudoElement,
       // All the grid containers are assumed to be in the DOM tree.
       isConnected: true,
       // nodeName is already lowerCased in Node grips
       nodeName: nodeFront.nodeName.toLowerCase(),
       nodeType: nodeFront.nodeType,
     }
   };
 }
--- a/devtools/client/shared/components/reps/reps.js
+++ b/devtools/client/shared/components/reps/reps.js
@@ -4420,22 +4420,31 @@ function ElementNode(props) {
       });
     }
   }
 
   return span(baseConfig, ...elements, inspectIcon);
 }
 
 function getElements(grip, mode) {
-  let { attributes, nodeName } = grip.preview;
+  let {
+    attributes,
+    nodeName,
+    isAfterPseudoElement,
+    isBeforePseudoElement
+  } = grip.preview;
   const nodeNameElement = span({
     className: "tag-name"
   }, nodeName);
 
   if (mode === MODE.TINY) {
+    if (isAfterPseudoElement || isBeforePseudoElement) {
+      return [span({ className: "attrName" }, `::${ isAfterPseudoElement ? "after" : "before" }`)];
+    }
+
     let elements = [nodeNameElement];
     if (attributes.id) {
       elements.push(span({ className: "attrName" }, `#${attributes.id}`));
     }
     if (attributes.class) {
       elements.push(span({ className: "attrName" }, attributes.class.trim().split(/\s+/).map(cls => `.${cls}`).join("")));
     }
     return elements;
@@ -6626,9 +6635,9 @@ function mergeResponses(responses) {
 
   return data;
 }
 
 module.exports = reducer;
 
 /***/ })
 /******/ ]);
-});
\ No newline at end of file
+});