Web Inspector: Clicking DOM breakpoint marker should enable/disable breakpoints
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 17:41:11 +0000 (17:41 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 17:41:11 +0000 (17:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169856
<rdar://problem/31133090>

Reviewed by Joseph Pecoraro.

Clicking DOM breakpoint marker should enable/disable breakpoints,
matching the behavior of the marker's context menu:

- If one or more breakpoints are disabled, click enables all
- If all breakpoints are enabled, click disables all

* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._updateBreakpointStatus):
(WebInspector.DOMTreeElement.prototype._statusImageClicked):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214256 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

index 57cfca7..da02720 100644 (file)
@@ -1,3 +1,21 @@
+2017-03-22  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: Clicking DOM breakpoint marker should enable/disable breakpoints
+        https://bugs.webkit.org/show_bug.cgi?id=169856
+        <rdar://problem/31133090>
+
+        Reviewed by Joseph Pecoraro.
+
+        Clicking DOM breakpoint marker should enable/disable breakpoints,
+        matching the behavior of the marker's context menu:
+
+        - If one or more breakpoints are disabled, click enables all
+        - If all breakpoints are enabled, click disables all
+
+        * UserInterface/Views/DOMTreeElement.js:
+        (WebInspector.DOMTreeElement.prototype._updateBreakpointStatus):
+        (WebInspector.DOMTreeElement.prototype._statusImageClicked):
+
 2017-03-20  Devin Rousso  <webkit@devinrousso.com>
 
         Web Inspector: RTL: minor layout issues in Breakpoint Editor popover
index ea2fa70..59c41a3 100644 (file)
@@ -1684,6 +1684,7 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
         if (!this._statusImageElement) {
             this._statusImageElement = useSVGSymbol("Images/DOMBreakpoint.svg", "status-image");
             this._statusImageElement.classList.add("breakpoint");
+            this._statusImageElement.addEventListener("click", this._statusImageClicked.bind(this));
             this._statusImageElement.addEventListener("contextmenu", this._statusImageContextmenu.bind(this));
             this._statusImageElement.addEventListener("mousedown", (event) => { event.stopPropagation(); });
         }
@@ -1694,6 +1695,19 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
         this._statusImageElement.classList.toggle("disabled", disabled);
     }
 
+    _statusImageClicked(event)
+    {
+        if (event.button !== 0 || event.ctrlKey)
+            return;
+
+        let breakpoints = WebInspector.domDebuggerManager.domBreakpointsForNode(this.representedObject);
+        if (!breakpoints || !breakpoints.length)
+            return;
+
+        let shouldEnable = breakpoints.some((breakpoint) => breakpoint.disabled);
+        breakpoints.forEach((breakpoint) => breakpoint.disabled = !shouldEnable);
+    }
+
     _statusImageContextmenu(event)
     {
         const allowEditing = true;