Bug 1449954 - Slotted node reveal ux. r=bgrins draft
authorBelén Albeza <balbeza@mozilla.com>
Tue, 10 Jul 2018 12:20:19 +0200
changeset 818655 eec751376e654d80355fd46359a65722b4f8ffdf
parent 815985 a675c5d7eb76887a3e4b24548d621c9cc05a1545
child 819728 8224139424071482954b5354e15179ec2aa761bc
push id116314
push userbmo:balbeza@mozilla.com
push dateMon, 16 Jul 2018 10:26:58 +0000
reviewersbgrins
bugs1449954
milestone63.0a1
Bug 1449954 - Slotted node reveal ux. r=bgrins Merged the arrow icon and the "reveal" text link in a single icon. MozReview-Commit-ID: ELANKmAKACs
devtools/client/inspector/markup/views/slotted-node-editor.js
devtools/client/jar.mn
devtools/client/locales/en-US/inspector.properties
devtools/client/themes/images/reveal.svg
devtools/client/themes/markup.css
--- a/devtools/client/inspector/markup/views/slotted-node-editor.js
+++ b/devtools/client/inspector/markup/views/slotted-node-editor.js
@@ -7,17 +7,17 @@
 const {LocalizationHelper} = require("devtools/shared/l10n");
 const INSPECTOR_L10N =
       new LocalizationHelper("devtools/client/locales/inspector.properties");
 
 function SlottedNodeEditor(container, node) {
   this.container = container;
   this.markup = this.container.markup;
   this.buildMarkup();
-  this.tag.textContent = "→ <" + node.nodeName.toLowerCase() + ">";
+  this.tag.textContent = "<" + node.nodeName.toLowerCase() + ">";
 
   // Make the "tag" part of this editor focusable.
   this.tag.setAttribute("tabindex", "-1");
 }
 
 SlottedNodeEditor.prototype = {
   buildMarkup: function() {
     const doc = this.markup.doc;
@@ -26,17 +26,17 @@ SlottedNodeEditor.prototype = {
     this.elt.classList.add("editor");
 
     this.tag = doc.createElement("span");
     this.tag.classList.add("tag");
     this.elt.appendChild(this.tag);
 
     this.revealLink = doc.createElement("span");
     this.revealLink.classList.add("reveal-link");
-    this.revealLink.textContent = INSPECTOR_L10N.getStr("markupView.revealLink.label");
+    this.revealLink.title = INSPECTOR_L10N.getStr("markupView.revealLink.tooltip");
     this.elt.appendChild(this.revealLink);
   },
 
   destroy: function() {
     // We might be already destroyed.
     if (!this.elt) {
       return;
     }
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -252,16 +252,17 @@ devtools.jar:
     skin/images/security-state-secure.svg (themes/images/security-state-secure.svg)
     skin/images/security-state-weak.svg (themes/images/security-state-weak.svg)
     skin/images/diff.svg (themes/images/diff.svg)
     skin/images/import.svg (themes/images/import.svg)
     skin/images/pane-collapse.svg (themes/images/pane-collapse.svg)
     skin/images/pane-expand.svg (themes/images/pane-expand.svg)
     skin/images/help.svg (themes/images/help.svg)
     skin/images/read-only.svg (themes/images/read-only.svg)
+    skin/images/reveal.svg (themes/images/reveal.svg)
 
     # Debugger
     skin/images/debugger/angular.svg (themes/images/debugger/angular.svg)
     skin/images/debugger/arrow.svg (themes/images/debugger/arrow.svg)
     skin/images/debugger/back.svg (themes/images/debugger/back.svg)
     skin/images/debugger/blackBox.svg (themes/images/debugger/blackBox.svg)
     skin/images/debugger/breakpoint.svg (themes/images/debugger/breakpoint.svg)
     skin/images/debugger/close.svg (themes/images/debugger/close.svg)
--- a/devtools/client/locales/en-US/inspector.properties
+++ b/devtools/client/locales/en-US/inspector.properties
@@ -78,21 +78,22 @@ markupView.display.contents.tooltiptext2=This element doesn’t produce a specific box by itself, but renders its contents.
 # the markup view.
 markupView.event.tooltiptext=Event listener
 
 # LOCALIZATION NOTE (markupView.newAttribute.label)
 # This is used to speak the New Attribute button when editing a tag
 # and a screen reader user tabs to it. This string is not visible onscreen.
 markupView.newAttribute.label=New attribute
 
-# LOCALIZATION NOTE (markupView.revealLink.label)
-# Used in the markup view when displaying elements inserted in <slot> nodes in a custom
-# component. On hover, a link with this label will be shown to select the corresponding
-# non-slotted container. (test with dom.webcomponents.shadowdom.enabled set to true)
-markupView.revealLink.label=reveal
+# LOCALIZATION NOTE (markupView.revealLink.tooltip)
+# Used as a tooltip for an icon in the markup view when displaying elements inserted in
+# <slot> nodes in a custom  component. When clicking on the icon, the corresponding
+# non-slotted container will be selected
+# (test with dom.webcomponents.shadowdom.enabled set to true)
+markupView.revealLink.tooltip=Reveal
 
 #LOCALIZATION NOTE: Used in the image preview tooltip when the image could not be loaded
 previewTooltip.image.brokenImage=Could not load the image
 
 # LOCALIZATION NOTE: Used in color picker tooltip when the eyedropper is disabled for
 # non-HTML documents
 eyedropper.disabled.title=Unavailable in non-HTML documents
 
new file mode 100644
--- /dev/null
+++ b/devtools/client/themes/images/reveal.svg
@@ -0,0 +1,10 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<svg width="16" height="8" xmlns="http://www.w3.org/2000/svg" stroke="context-stroke" fill="none" stroke-linecap="round">
+  <g transform="rotate(90 8,8)">
+    <path d="M5.5 3.5l2 2M5.5 7.5l2-2"/>
+    <path d="M7 5.5H4.006c-1.012 0-1.995 1.017-2.011 2.024-.005.023-.005 1.347 0 3.971" stroke-linejoin="round"/>
+  </g>
+</svg>
\ No newline at end of file
--- a/devtools/client/themes/markup.css
+++ b/devtools/client/themes/markup.css
@@ -327,27 +327,24 @@ ul.children + .tag-line::before {
   padding-left: 16px;
 }
 
 .styleinspector-propertyeditor {
   border: 1px solid #CCC;
 }
 
 .reveal-link {
-  margin-inline-start: 10px;
   cursor: pointer;
-  display: none;
-}
+  background: url("chrome://devtools/skin/images/reveal.svg") no-repeat;
+  display: inline-block;
+  width: 16px;
+  height: 8px;
 
-.reveal-link:hover {
-  text-decoration: underline
-}
-
-.tag-line:hover .reveal-link {
-  display: inline;
+  -moz-context-properties: stroke;
+  stroke: currentColor;
 }
 
 /* Draw a circle next to nodes that have a pseudo class lock.
    Center vertically with the 1.4em line height on .tag-line */
 .child.pseudoclass-locked::before {
   content: "";
   background: var(--theme-highlight-lightorange);
   border-radius: 50%;