Changeset 213000 in webkit


Ignore:
Timestamp:
Feb 25, 2017 12:29:59 AM (7 years ago)
Author:
commit-queue@webkit.org
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 <Devin Rousso> 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}.

Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r212999 r213000  
     12017-02-25  Devin Rousso  <dcrousso+webkit@gmail.com>
     2
     3        Web Inspector: copying a search result out of Search Tab navigation sidebar does nothing
     4        https://bugs.webkit.org/show_bug.cgi?id=167074
     5
     6        Reviewed by Brian Burg.
     7
     8        * UserInterface/Base/Main.js:
     9        (WebInspector._copy):
     10        * UserInterface/Views/SearchTabContentView.js:
     11        (WebInspector.SearchTabContentView.prototype.handleCopyEvent):
     12        Provide the container TabContentView with the opportunity to intercept the copy event.
     13
     14        * UserInterface/Models/SourceCodeTextRange.js:
     15        (WebInspector.SourceCodeTextRange.prototype.get synthesizedTextValue):
     16        * UserInterface/Views/SearchResultTreeElement.js:
     17        (WebInspector.SearchResultTreeElement.prototype.get synthesizedTextValue):
     18        Generate a string with the format `${url}:${lineNumber}:${resultLine}`.
     19
    1202017-02-25  Devin Rousso  <dcrousso+webkit@gmail.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r212761 r213000  
    21092109        }
    21102110
     2111        let tabContentView = this.tabBrowser.selectedTabContentView;
     2112        if (tabContentView && typeof tabContentView.handleCopyEvent === "function") {
     2113            tabContentView.handleCopyEvent(event);
     2114            return;
     2115        }
     2116
    21112117        return;
    21122118    }
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js

    r181769 r213000  
    106106    }
    107107
     108    get synthesizedTextValue()
     109    {
     110        // Must add 1 to the lineNumber since it starts counting at 0.
     111        return this._sourceCode.url + ":" + (this._startLocation.lineNumber + 1);
     112    }
     113
    108114    // Private
    109115
  • trunk/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js

    r196275 r213000  
    8181        return {text: [this.representedObject.title]};
    8282    }
     83
     84    get synthesizedTextValue()
     85    {
     86        return this.representedObject.sourceCodeTextRange.synthesizedTextValue + ":" + this.representedObject.title;
     87    }
    8388};
    8489
  • trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js

    r211010 r213000  
    8686    }
    8787
     88    handleCopyEvent(event)
     89    {
     90        let selectedTreeElement = this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement;
     91        if (!selectedTreeElement)
     92            return;
     93
     94        event.clipboardData.setData("text/plain", selectedTreeElement.synthesizedTextValue);
     95        event.stopPropagation();
     96        event.preventDefault();
     97    }
     98
    8899    // Protected
    89100
Note: See TracChangeset for help on using the changeset viewer.