Title: [198690] trunk/Source/WebInspectorUI
Revision
198690
Author
[email protected]
Date
2016-03-25 13:57:04 -0700 (Fri, 25 Mar 2016)

Log Message

Web Inspector: Clicking a result in Quick Open dialog dismisses the dialog, does nothing
https://bugs.webkit.org/show_bug.cgi?id=155892
<rdar://problem/25361220>

Reviewed by Timothy Hatcher.

* UserInterface/Views/OpenResourceDialog.js:
(WebInspector.OpenResourceDialog):
Allow repeat selection so clicking a selected element makes a selection
and dismisses the dialog.

(WebInspector.OpenResourceDialog.prototype._populateResourceTreeOutline):
Suppress select and deselect. Only user clicks should cause a selection event.

(WebInspector.OpenResourceDialog.prototype._handleBlurEvent):
Prevent the dialog from being dismissed before tree item selection occurs.

(WebInspector.OpenResourceDialog.prototype._treeSelectionDidChange):
Set the represented object (dialog result) and dismiss.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (198689 => 198690)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-03-25 20:52:39 UTC (rev 198689)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-03-25 20:57:04 UTC (rev 198690)
@@ -1,3 +1,25 @@
+2016-03-25  Matt Baker  <[email protected]>
+
+        Web Inspector: Clicking a result in Quick Open dialog dismisses the dialog, does nothing
+        https://bugs.webkit.org/show_bug.cgi?id=155892
+        <rdar://problem/25361220>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/OpenResourceDialog.js:
+        (WebInspector.OpenResourceDialog):
+        Allow repeat selection so clicking a selected element makes a selection
+        and dismisses the dialog.
+
+        (WebInspector.OpenResourceDialog.prototype._populateResourceTreeOutline):
+        Suppress select and deselect. Only user clicks should cause a selection event.
+
+        (WebInspector.OpenResourceDialog.prototype._handleBlurEvent):
+        Prevent the dialog from being dismissed before tree item selection occurs.
+
+        (WebInspector.OpenResourceDialog.prototype._treeSelectionDidChange):
+        Set the represented object (dialog result) and dismiss.
+
 2016-03-25  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r198619.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js (198689 => 198690)


--- trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js	2016-03-25 20:52:39 UTC (rev 198689)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js	2016-03-25 20:57:04 UTC (rev 198690)
@@ -49,9 +49,11 @@
         this._clearIconElement.addEventListener("click", this._handleClickEvent.bind(this));
 
         this._treeOutline = new WebInspector.TreeOutline(document.createElement("ol"));
+        this._treeOutline.allowsRepeatSelection = true;
         this._treeOutline.disclosureButtons = false;
         this._treeOutline.large = true;
 
+        this._treeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
         this._treeOutline.element.addEventListener("focus", () => {this._inputElement.focus();});
 
         this.element.appendChild(this._treeOutline.element);
@@ -90,7 +92,7 @@
         }
 
         if (this._treeOutline.children.length)
-            this._treeOutline.children[0].select(true);
+            this._treeOutline.children[0].select(true, false, true, true);
     }
 
     didPresentDialog()
@@ -161,6 +163,10 @@
 
     _handleBlurEvent(event)
     {
+        // Prevent the dialog from being dismissed while handling a tree item click event.
+        if (event.relatedTarget === this._treeOutline.element)
+            return;
+
         this.dismiss();
     }
 
@@ -221,6 +227,18 @@
         if (this._treeOutline.children.length)
             this._treeOutline.hidden = false;
     }
+
+    _treeSelectionDidChange(event)
+    {
+        let treeElement = event.data.selectedElement;
+        if (!treeElement)
+            return;
+
+        if (!event.data.selectedByUser)
+            return;
+
+        this.dismiss(treeElement.representedObject);
+    }
 };
 
 WebInspector.OpenResourceDialog.NonEmptyClassName = "non-empty";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to