Changeset 181386 in webkit


Ignore:
Timestamp:
Mar 11, 2015 7:09:29 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: SearchResultTreeElement.representedObject is missing a saveIdentityToCookie implementation
https://bugs.webkit.org/show_bug.cgi?id=134698

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-03-11
Reviewed by Timothy Hatcher.

This will restore selection of a global search tree element if you
close and reopen the inspector in such a case.

  • UserInterface/Models/DOMSearchMatchObject.js:

(WebInspector.DOMSearchMatchObject.prototype.get resource):
(WebInspector.DOMSearchMatchObject.titleForDOMNode):
Cookie has the resource URL, DOM Node title, and text range.

  • UserInterface/Models/SourceCodeSearchMatchObject.js:

(WebInspector.SourceCodeSearchMatchObject.prototype.get sourceCodeTextRange):
Cookie has the source code URL and text range.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r181367 r181386  
     12015-03-11  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: SearchResultTreeElement.representedObject is missing a saveIdentityToCookie implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=134698
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        This will restore selection of a global search tree element if you
     9        close and reopen the inspector in such a case.
     10
     11        * UserInterface/Models/DOMSearchMatchObject.js:
     12        (WebInspector.DOMSearchMatchObject.prototype.get resource):
     13        (WebInspector.DOMSearchMatchObject.titleForDOMNode):
     14        Cookie has the resource URL, DOM Node title, and text range.
     15
     16        * UserInterface/Models/SourceCodeSearchMatchObject.js:
     17        (WebInspector.SourceCodeSearchMatchObject.prototype.get sourceCodeTextRange):
     18        Cookie has the source code URL and text range.
     19
    1202015-03-10  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js

    r174687 r181386  
    4545WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName = "dom-match-node-icon";
    4646
     47WebInspector.DOMSearchMatchObject.TypeIdentifier = "dom-search-match-object";
     48WebInspector.DOMSearchMatchObject.URLCookieKey = "resource-url";
     49WebInspector.DOMSearchMatchObject.TitleKey = "title";
     50WebInspector.DOMSearchMatchObject.TextRangeKey = "text-range";
     51
    4752WebInspector.DOMSearchMatchObject.prototype = {
    4853    constructor: WebInspector.DOMSearchMatchObject,
     54    __proto__: WebInspector.Object.prototype,
    4955
    5056    // Public
     57
     58    get resource()
     59    {
     60        return this._resource;
     61    },
    5162
    5263    get domNode()
     
    7889    },
    7990
     91    saveIdentityToCookie(cookie)
     92    {
     93        cookie[WebInspector.DOMSearchMatchObject.URLCookieKey] = this._resource.url.hash;
     94        cookie[WebInspector.DOMSearchMatchObject.TitleKey] = this._title;
     95        var textRange = this._sourceCodeTextRange.textRange;
     96        cookie[WebInspector.DOMSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
     97    },
     98
    8099    // Private
    81100
    82     _generateClassName: function()
     101    _generateClassName()
    83102    {
    84103        switch (this._domNode.nodeType()) {
     
    155174    }
    156175};
    157 
    158 WebInspector.DOMSearchMatchObject.prototype.__proto__ = WebInspector.Object.prototype;
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js

    r176358 r181386  
    3838WebInspector.SourceCodeSearchMatchObject.SourceCodeMatchIconStyleClassName = "source-code-match-icon";
    3939
     40WebInspector.SourceCodeSearchMatchObject.TypeIdentifier = "source-code-search-match-object";
     41WebInspector.SourceCodeSearchMatchObject.URLCookieKey = "source-code-url";
     42WebInspector.SourceCodeSearchMatchObject.TextRangeKey = "text-range";
     43
    4044WebInspector.SourceCodeSearchMatchObject.prototype = {
    4145    constructor: WebInspector.SourceCodeSearchMatchObject,
     46    __proto__: WebInspector.Object.prototype,
    4247
    4348    get sourceCode()
     
    6469    {
    6570        return this._sourceCodeTextRange;
     71    },
     72
     73    saveIdentityToCookie(cookie)
     74    {
     75        if (this._sourceCode.url)
     76            cookie[WebInspector.SourceCodeSearchMatchObject.URLCookieKey] = this._sourceCode.url.hash;
     77
     78        var textRange = this._sourceCodeTextRange.textRange;
     79        cookie[WebInspector.SourceCodeSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
    6680    }
    6781};
    68 
    69 WebInspector.SourceCodeSearchMatchObject.prototype.__proto__ = WebInspector.Object.prototype;
Note: See TracChangeset for help on using the changeset viewer.