Title: [213000] trunk/Source/WebInspectorUI
Revision
213000
Author
[email protected]
Date
2017-02-25 00:29:59 -0800 (Sat, 25 Feb 2017)

Log Message

Web Inspector: copying a search result out of Search Tab navigation sidebar does nothing
https://bugs.webkit.org/show_bug.cgi?id=167074

Patch by Devin Rousso <[email protected]> on 2017-02-25
Reviewed by Brian Burg.

* UserInterface/Base/Main.js:
(WebInspector._copy):
* UserInterface/Views/SearchTabContentView.js:
(WebInspector.SearchTabContentView.prototype.handleCopyEvent):
Provide the container TabContentView with the opportunity to intercept the copy event.

* UserInterface/Models/SourceCodeTextRange.js:
(WebInspector.SourceCodeTextRange.prototype.get synthesizedTextValue):
* UserInterface/Views/SearchResultTreeElement.js:
(WebInspector.SearchResultTreeElement.prototype.get synthesizedTextValue):
Generate a string with the format `${url}:${lineNumber}:${resultLine}`.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (212999 => 213000)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-02-25 08:08:27 UTC (rev 212999)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-02-25 08:29:59 UTC (rev 213000)
@@ -1,5 +1,24 @@
 2017-02-25  Devin Rousso  <[email protected]>
 
+        Web Inspector: copying a search result out of Search Tab navigation sidebar does nothing
+        https://bugs.webkit.org/show_bug.cgi?id=167074
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector._copy):
+        * UserInterface/Views/SearchTabContentView.js:
+        (WebInspector.SearchTabContentView.prototype.handleCopyEvent):
+        Provide the container TabContentView with the opportunity to intercept the copy event.
+
+        * UserInterface/Models/SourceCodeTextRange.js:
+        (WebInspector.SourceCodeTextRange.prototype.get synthesizedTextValue):
+        * UserInterface/Views/SearchResultTreeElement.js:
+        (WebInspector.SearchResultTreeElement.prototype.get synthesizedTextValue):
+        Generate a string with the format `${url}:${lineNumber}:${resultLine}`.
+
+2017-02-25  Devin Rousso  <[email protected]>
+
         Web Inspector: RTL: Styles - Rules sidebar icons are misaligned
         https://bugs.webkit.org/show_bug.cgi?id=168807
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (212999 => 213000)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2017-02-25 08:08:27 UTC (rev 212999)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2017-02-25 08:29:59 UTC (rev 213000)
@@ -2108,6 +2108,12 @@
             return;
         }
 
+        let tabContentView = this.tabBrowser.selectedTabContentView;
+        if (tabContentView && typeof tabContentView.handleCopyEvent === "function") {
+            tabContentView.handleCopyEvent(event);
+            return;
+        }
+
         return;
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js (212999 => 213000)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js	2017-02-25 08:08:27 UTC (rev 212999)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js	2017-02-25 08:29:59 UTC (rev 213000)
@@ -105,6 +105,12 @@
         return new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
     }
 
+    get synthesizedTextValue()
+    {
+        // Must add 1 to the lineNumber since it starts counting at 0.
+        return this._sourceCode.url + ":" + (this._startLocation.lineNumber + 1);
+    }
+
     // Private
 
     _startAndEndLocationsInSameMappedResource()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js (212999 => 213000)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js	2017-02-25 08:08:27 UTC (rev 212999)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js	2017-02-25 08:29:59 UTC (rev 213000)
@@ -80,6 +80,11 @@
     {
         return {text: [this.representedObject.title]};
     }
+
+    get synthesizedTextValue()
+    {
+        return this.representedObject.sourceCodeTextRange.synthesizedTextValue + ":" + this.representedObject.title;
+    }
 };
 
 WebInspector.SearchResultTreeElement.CharactersToShowBeforeSearchMatch = 15;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js (212999 => 213000)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js	2017-02-25 08:08:27 UTC (rev 212999)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js	2017-02-25 08:29:59 UTC (rev 213000)
@@ -85,6 +85,17 @@
         this.navigationSidebarPanel.performSearch(searchQuery);
     }
 
+    handleCopyEvent(event)
+    {
+        let selectedTreeElement = this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement;
+        if (!selectedTreeElement)
+            return;
+
+        event.clipboardData.setData("text/plain", selectedTreeElement.synthesizedTextValue);
+        event.stopPropagation();
+        event.preventDefault();
+    }
+
     // Protected
 
     initialLayout()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to