Title: [224651] trunk/Source/WebInspectorUI
Revision
224651
Author
nvasil...@apple.com
Date
2017-11-09 15:40:51 -0800 (Thu, 09 Nov 2017)

Log Message

Web Inspector: Styles Redesign: clicking on inline swatches and property checkboxes should not add a new property
https://bugs.webkit.org/show_bug.cgi?id=179507
<rdar://problem/35452204>

Reviewed by Brian Burg.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleClick):
Don't add new properties when clicking on selector fields, source links, and property checkboxes.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._update):
It is safe to replace "change" event with "click" since it fires even when pressing Space key when the checkbox is focused.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (224650 => 224651)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-11-09 23:35:34 UTC (rev 224650)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-11-09 23:40:51 UTC (rev 224651)
@@ -1,3 +1,20 @@
+2017-11-09  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Styles Redesign: clicking on inline swatches and property checkboxes should not add a new property
+        https://bugs.webkit.org/show_bug.cgi?id=179507
+        <rdar://problem/35452204>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
+        (WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
+        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleClick):
+        Don't add new properties when clicking on selector fields, source links, and property checkboxes.
+
+        * UserInterface/Views/SpreadsheetStyleProperty.js:
+        (WI.SpreadsheetStyleProperty.prototype._update):
+        It is safe to replace "change" event with "click" since it fires even when pressing Space key when the checkbox is focused.
+
 2017-11-09  Devin Rousso  <web...@devinrousso.com>
 
         Web Inspector: support undo/redo of insertAdjacentHTML

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js (224650 => 224651)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js	2017-11-09 23:35:34 UTC (rev 224650)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js	2017-11-09 23:40:51 UTC (rev 224651)
@@ -68,10 +68,10 @@
         this._selectorElement.addEventListener("mouseleave", this._hideDOMNodeHighlight.bind(this));
         this._headerElement.append(this._selectorElement);
 
-        let openBrace = document.createElement("span");
-        openBrace.classList.add("open-brace");
-        openBrace.textContent = " {";
-        this._headerElement.append(openBrace);
+        this._openBrace = document.createElement("span");
+        this._openBrace.classList.add("open-brace");
+        this._openBrace.textContent = " {";
+        this._headerElement.append(this._openBrace);
 
         if (this._style.selectorEditable) {
             this._selectorTextField = new WI.SpreadsheetSelectorField(this, this._selectorElement);
@@ -81,14 +81,14 @@
         this._propertiesEditor = new WI.SpreadsheetCSSStyleDeclarationEditor(this, this._style);
         this._propertiesEditor.element.classList.add("properties");
 
-        let closeBrace = document.createElement("span");
-        closeBrace.classList.add("close-brace");
-        closeBrace.textContent = "}";
+        this._closeBrace = document.createElement("span");
+        this._closeBrace.classList.add("close-brace");
+        this._closeBrace.textContent = "}";
 
         this._element.append(this._createMediaHeader(), this._headerElement);
         this.addSubview(this._propertiesEditor);
         this._propertiesEditor.needsLayout();
-        this._element.append(closeBrace);
+        this._element.append(this._closeBrace);
 
         if (!this._style.editable)
             this._element.classList.add("locked");
@@ -363,13 +363,15 @@
             return;
         }
 
-        if (event.target.isSelfOrDescendant(this._headerElement)) {
+        if (event.target === this._headerElement || event.target === this._openBrace) {
             this._propertiesEditor.addBlankProperty(0);
             return;
         }
 
-        const appendAfterLast = -1;
-        this._propertiesEditor.addBlankProperty(appendAfterLast);
+        if (event.target === this._element || event.target === this._closeBrace) {
+            const appendAfterLast = -1;
+            this._propertiesEditor.addBlankProperty(appendAfterLast);
+        }
     }
 
     _highlightNodesWithSelector()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (224650 => 224651)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js	2017-11-09 23:35:34 UTC (rev 224650)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js	2017-11-09 23:40:51 UTC (rev 224651)
@@ -150,7 +150,8 @@
             this._checkboxElement.type = "checkbox";
             this._checkboxElement.checked = this._property.enabled;
             this._checkboxElement.tabIndex = -1;
-            this._checkboxElement.addEventListener("change", () => {
+            this._checkboxElement.addEventListener("click", (event) => {
+                event.stopPropagation();
                 let disabled = !this._checkboxElement.checked;
                 this._property.commentOut(disabled);
                 this._update();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to