Title: [181386] trunk/Source/WebInspectorUI
Revision
181386
Author
commit-qu...@webkit.org
Date
2015-03-11 07:09:29 -0700 (Wed, 11 Mar 2015)

Log Message

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

Patch by Joseph Pecoraro <pecor...@apple.com> 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (181385 => 181386)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-03-11 14:00:15 UTC (rev 181385)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-03-11 14:09:29 UTC (rev 181386)
@@ -1,3 +1,22 @@
+2015-03-11  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: SearchResultTreeElement.representedObject is missing a saveIdentityToCookie implementation
+        https://bugs.webkit.org/show_bug.cgi?id=134698
+
+        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.
+
 2015-03-10  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: CSS parser errors in the console should include column numbers

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js (181385 => 181386)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js	2015-03-11 14:00:15 UTC (rev 181385)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js	2015-03-11 14:09:29 UTC (rev 181386)
@@ -44,11 +44,22 @@
 WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName = "dom-match-character-data-icon";
 WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName = "dom-match-node-icon";
 
+WebInspector.DOMSearchMatchObject.TypeIdentifier = "dom-search-match-object";
+WebInspector.DOMSearchMatchObject.URLCookieKey = "resource-url";
+WebInspector.DOMSearchMatchObject.TitleKey = "title";
+WebInspector.DOMSearchMatchObject.TextRangeKey = "text-range";
+
 WebInspector.DOMSearchMatchObject.prototype = {
     constructor: WebInspector.DOMSearchMatchObject,
+    __proto__: WebInspector.Object.prototype,
 
     // Public
 
+    get resource()
+    {
+        return this._resource;
+    },
+
     get domNode()
     {
         return this._domNode;
@@ -77,9 +88,17 @@
         return this._sourceCodeTextRange;
     },
 
+    saveIdentityToCookie(cookie)
+    {
+        cookie[WebInspector.DOMSearchMatchObject.URLCookieKey] = this._resource.url.hash;
+        cookie[WebInspector.DOMSearchMatchObject.TitleKey] = this._title;
+        var textRange = this._sourceCodeTextRange.textRange;
+        cookie[WebInspector.DOMSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
+    },
+
     // Private
 
-    _generateClassName: function()
+    _generateClassName()
     {
         switch (this._domNode.nodeType()) {
         case Node.ELEMENT_NODE:
@@ -154,5 +173,3 @@
         return domNode.nodeNameInCorrectCase();
     }
 };
-
-WebInspector.DOMSearchMatchObject.prototype.__proto__ = WebInspector.Object.prototype;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js (181385 => 181386)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js	2015-03-11 14:00:15 UTC (rev 181385)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js	2015-03-11 14:09:29 UTC (rev 181386)
@@ -37,8 +37,13 @@
 
 WebInspector.SourceCodeSearchMatchObject.SourceCodeMatchIconStyleClassName = "source-code-match-icon";
 
+WebInspector.SourceCodeSearchMatchObject.TypeIdentifier = "source-code-search-match-object";
+WebInspector.SourceCodeSearchMatchObject.URLCookieKey = "source-code-url";
+WebInspector.SourceCodeSearchMatchObject.TextRangeKey = "text-range";
+
 WebInspector.SourceCodeSearchMatchObject.prototype = {
     constructor: WebInspector.SourceCodeSearchMatchObject,
+    __proto__: WebInspector.Object.prototype,
 
     get sourceCode()
     {
@@ -63,7 +68,14 @@
     get sourceCodeTextRange()
     {
         return this._sourceCodeTextRange;
+    },
+
+    saveIdentityToCookie(cookie)
+    {
+        if (this._sourceCode.url)
+            cookie[WebInspector.SourceCodeSearchMatchObject.URLCookieKey] = this._sourceCode.url.hash;
+
+        var textRange = this._sourceCodeTextRange.textRange;
+        cookie[WebInspector.SourceCodeSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
     }
 };
-
-WebInspector.SourceCodeSearchMatchObject.prototype.__proto__ = WebInspector.Object.prototype;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to