Web Inspector: move cursor to the current search match.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jul 2012 19:44:04 +0000 (19:44 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jul 2012 19:44:04 +0000 (19:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90621

Reviewed by Vsevolod Vlasov.

After closing the search dialog, the cursor should be at the latest search match location.

* inspector/front-end/TextEditor.js:
(WebInspector.TextEditor.prototype.markAndRevealRange):
(WebInspector.TextEditor.prototype._handleFocused):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/TextEditor.js

index 1ca39a0..2d68195 100644 (file)
@@ -1,3 +1,16 @@
+2012-07-05  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: move cursor to the current search match.
+        https://bugs.webkit.org/show_bug.cgi?id=90621
+
+        Reviewed by Vsevolod Vlasov.
+
+        After closing the search dialog, the cursor should be at the latest search match location.
+
+        * inspector/front-end/TextEditor.js:
+        (WebInspector.TextEditor.prototype.markAndRevealRange):
+        (WebInspector.TextEditor.prototype._handleFocused):
+
 2012-07-05  Behdad Esfahbod  <behdad@behdad.org>
 
         Subpixel layout broken with spans with CSS position other than static
index 00e2380..259639d 100644 (file)
@@ -158,6 +158,8 @@ WebInspector.TextEditor.prototype = {
      */
     markAndRevealRange: function(range)
     {
+        if (range)
+            this._lastMarkedRange = range;
         this._mainPanel.markAndRevealRange(range);
     },
 
@@ -410,6 +412,12 @@ WebInspector.TextEditor.prototype = {
 
     _handleFocused: function()
     {
+        // Convert last marked range into a selection upon focus. This is needed to focus the search result.
+        if (this._lastMarkedRange) {
+            this._lastSelection = this._lastMarkedRange;
+            delete this._lastMarkedRange; 
+        }
+
         if (this._lastSelection) {
             // We do not restore selection after focus lost to avoid selection blinking. We restore only cursor position instead.
             // FIXME: consider adding selection decoration to blurred editor.