Changeset 121984 in webkit


Ignore:
Timestamp:
Jul 6, 2012 10:19:25 AM (12 years ago)
Author:
pfeldman@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121983 r121984  
     12012-07-06  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: get rid of this._lastMarkedRange in TextEditor.
     4        https://bugs.webkit.org/show_bug.cgi?id=90691
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        We don't need it, should use setSelection instead.
     9
     10        * inspector/front-end/TextEditor.js:
     11        (WebInspector.TextEditor.prototype.markAndRevealRange):
     12        (WebInspector.TextEditor.prototype._handleSelectionChange):
     13        (WebInspector.TextEditor.prototype.setSelection):
     14        (WebInspector.TextEditor.prototype._handleFocused):
     15
    1162012-07-06  Vsevolod Vlasov  <vsevik@chromium.org>
    217
  • trunk/Source/WebCore/inspector/front-end/TextEditor.js

    r121981 r121984  
    160160    {
    161161        if (range)
    162             this._lastMarkedRange = range;
     162            this.setSelection(range);
    163163        this._mainPanel.markAndRevealRange(range);
    164164    },
     
    380380    {
    381381        var textRange = this._mainPanel._getSelection();
    382         if (textRange)
    383             this._lastSelection = textRange;
     382        if (textRange) {
     383            // We do not restore selection after focus lost to avoid selection blinking. We restore only cursor position instead.
     384            // FIXME: consider adding selection decoration to blurred editor.
     385            this._lastSelection = WebInspector.TextRange.createFromLocation(textRange.endLine, textRange.endColumn);
     386        }
    384387        this._delegate.selectionChanged(textRange);
    385388    },
     
    407410    {
    408411        this._lastSelection = textRange;
    409         this._mainPanel._restoreSelection(textRange);
     412        if (this.element.isAncestor(document.activeElement))
     413            this._mainPanel._restoreSelection(textRange);
    410414    },
    411415
     
    421425    _handleFocused: function()
    422426    {
    423         // Convert last marked range into a selection upon focus. This is needed to focus the search result.
    424         if (this._lastMarkedRange) {
    425             this.setSelection(this._lastMarkedRange);
    426             delete this._lastMarkedRange;
    427             return;
    428         }
    429 
    430         if (this._lastSelection) {
    431             // We do not restore selection after focus lost to avoid selection blinking. We restore only cursor position instead.
    432             // FIXME: consider adding selection decoration to blurred editor.
    433             var newSelection = WebInspector.TextRange.createFromLocation(this._lastSelection.endLine, this._lastSelection.endColumn);
    434             this.setSelection(newSelection);
    435         }
     427        if (this._lastSelection)
     428            this.setSelection(this._lastSelection);
    436429    },
    437430
Note: See TracChangeset for help on using the changeset viewer.