Title: [121984] trunk/Source/WebCore
Revision
121984
Author
[email protected]
Date
2012-07-06 10:19:25 -0700 (Fri, 06 Jul 2012)

Log Message

Web Inspector: get rid of this._lastMarkedRange in TextEditor.
https://bugs.webkit.org/show_bug.cgi?id=90691

Reviewed by Vsevolod Vlasov.

We don't need it, should use setSelection instead.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121983 => 121984)


--- trunk/Source/WebCore/ChangeLog	2012-07-06 17:08:12 UTC (rev 121983)
+++ trunk/Source/WebCore/ChangeLog	2012-07-06 17:19:25 UTC (rev 121984)
@@ -1,3 +1,18 @@
+2012-07-06  Pavel Feldman  <[email protected]>
+
+        Web Inspector: get rid of this._lastMarkedRange in TextEditor.
+        https://bugs.webkit.org/show_bug.cgi?id=90691
+
+        Reviewed by Vsevolod Vlasov.
+
+        We don't need it, should use setSelection instead.
+
+        * inspector/front-end/TextEditor.js:
+        (WebInspector.TextEditor.prototype.markAndRevealRange):
+        (WebInspector.TextEditor.prototype._handleSelectionChange):
+        (WebInspector.TextEditor.prototype.setSelection):
+        (WebInspector.TextEditor.prototype._handleFocused):
+
 2012-07-06  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Snippet renaming behavior is not correct.

Modified: trunk/Source/WebCore/inspector/front-end/TextEditor.js (121983 => 121984)


--- trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-07-06 17:08:12 UTC (rev 121983)
+++ trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-07-06 17:19:25 UTC (rev 121984)
@@ -159,7 +159,7 @@
     markAndRevealRange: function(range)
     {
         if (range)
-            this._lastMarkedRange = range;
+            this.setSelection(range);
         this._mainPanel.markAndRevealRange(range);
     },
 
@@ -379,8 +379,11 @@
     _handleSelectionChange: function(event)
     {
         var textRange = this._mainPanel._getSelection();
-        if (textRange)
-            this._lastSelection = textRange;
+        if (textRange) {
+            // 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.
+            this._lastSelection = WebInspector.TextRange.createFromLocation(textRange.endLine, textRange.endColumn);
+        }
         this._delegate.selectionChanged(textRange);
     },
 
@@ -406,7 +409,8 @@
     setSelection: function(textRange)
     {
         this._lastSelection = textRange;
-        this._mainPanel._restoreSelection(textRange);
+        if (this.element.isAncestor(document.activeElement))
+            this._mainPanel._restoreSelection(textRange);
     },
 
     wasShown: function()
@@ -420,19 +424,8 @@
 
     _handleFocused: function()
     {
-        // Convert last marked range into a selection upon focus. This is needed to focus the search result.
-        if (this._lastMarkedRange) {
-            this.setSelection(this._lastMarkedRange);
-            delete this._lastMarkedRange;
-            return;
-        }
-
-        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.
-            var newSelection = WebInspector.TextRange.createFromLocation(this._lastSelection.endLine, this._lastSelection.endColumn);
-            this.setSelection(newSelection);
-        }
+        if (this._lastSelection)
+            this.setSelection(this._lastSelection);
     },
 
     willHide: function()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to