From 0d5257a47a0909396b72ab82a69de3341f0ddf66 Mon Sep 17 00:00:00 2001 From: "podivilov@chromium.org" Date: Wed, 28 Sep 2011 13:53:31 +0000 Subject: [PATCH] Web Inspector: live edit cursor always appears at the beginning of the file. https://bugs.webkit.org/show_bug.cgi?id=68900 Reviewed by Pavel Feldman. * inspector/front-end/TextViewer.js: (WebInspector.TextEditorMainPanel.prototype._updateSelectionOnStartEditing): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96219 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 10 ++++++++++ Source/WebCore/inspector/front-end/TextViewer.js | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 613b408..7ed06c9 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,13 @@ +2011-09-27 Pavel Podivilov + + Web Inspector: live edit cursor always appears at the beginning of the file. + https://bugs.webkit.org/show_bug.cgi?id=68900 + + Reviewed by Pavel Feldman. + + * inspector/front-end/TextViewer.js: + (WebInspector.TextEditorMainPanel.prototype._updateSelectionOnStartEditing): + 2011-09-28 Vsevolod Vlasov Web Inspector: Refactor searching in inspector, add test (fixed non regex search). diff --git a/Source/WebCore/inspector/front-end/TextViewer.js b/Source/WebCore/inspector/front-end/TextViewer.js index da0ad1a..c39fd4e 100644 --- a/Source/WebCore/inspector/front-end/TextViewer.js +++ b/Source/WebCore/inspector/front-end/TextViewer.js @@ -919,14 +919,17 @@ WebInspector.TextEditorMainPanel.prototype = { _updateSelectionOnStartEditing: function() { - // focust() needs to go first for the case when the last selection was inside the editor and + // focus() needs to go first for the case when the last selection was inside the editor and // the "Edit" button was clicked. In this case we bail at the check below, but the // editor does not receive the focus, thus "Esc" does not cancel editing until at least // one change has been made to the editor contents. this._container.focus(); var selection = window.getSelection(); - if (selection.rangeCount && this._container.isAncestor(selection.getRangeAt(0).commonAncestorContainer)) - return; + if (selection.rangeCount) { + var commonAncestorContainer = selection.getRangeAt(0).commonAncestorContainer; + if (this._container === commonAncestorContainer || this._container.isAncestor(commonAncestorContainer)) + return; + } selection.removeAllRanges(); var range = document.createRange(); -- 2.7.4