https://bugs.webkit.org/show_bug.cgi?id=90677
Reviewed by Vsevolod Vlasov.
Web Inspector: start searching from the cursor position in the Sources panel.
Drive-by: select whole match upon search cancel.
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
(WebInspector.ScriptsPanel.prototype.performSearch):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
(WebInspector.SourceFrame.prototype.performSearch):
* inspector/front-end/TextEditor.js:
(WebInspector.TextEditor.prototype.lastSelection):
(WebInspector.TextEditor.prototype._handleFocused):
* inspector/front-end/TextEditorModel.js:
(WebInspector.TextRange.prototype.serializeToObject):
(WebInspector.TextRange.prototype.compareTo):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121957
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-07-06 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: start searching from the cursor position in the Sources panel.
+ https://bugs.webkit.org/show_bug.cgi?id=90677
+
+ Reviewed by Vsevolod Vlasov.
+
+ Web Inspector: start searching from the cursor position in the Sources panel.
+ Drive-by: select whole match upon search cancel.
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
+ (WebInspector.ScriptsPanel.prototype.performSearch):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
+ (WebInspector.SourceFrame.prototype.performSearch):
+ * inspector/front-end/TextEditor.js:
+ (WebInspector.TextEditor.prototype.lastSelection):
+ (WebInspector.TextEditor.prototype._handleFocused):
+ * inspector/front-end/TextEditorModel.js:
+ (WebInspector.TextRange.prototype.serializeToObject):
+ (WebInspector.TextRange.prototype.compareTo):
+
2012-07-06 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Snippets should be correctly (re)loaded when inspector is open and on navigation.
return;
WebInspector.searchController.updateSearchMatchesCount(searchMatches, this);
- view.jumpToFirstSearchResult();
+ view.jumpToNextSearchResult();
WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex, this);
}
var regex = WebInspector.SourceFrame.createSearchRegex(query);
this._searchResults = this._collectRegexMatches(regex);
+ var selection = this._textEditor.lastSelection();
+ for (var i = 0; selection && i < this._searchResults.length; ++i) {
+ if (this._searchResults[i].compareTo(selection) > 0) {
+ this._currentSearchResultIndex = i - 1;
+ break;
+ }
+ }
callback(this, this._searchResults.length);
}
},
/**
+ * @return {WebInspector.TextRange?}
+ */
+ lastSelection: function()
+ {
+ return this._lastSelection;
+ },
+
+ /**
* @param {WebInspector.TextRange} textRange
*/
setSelection: function(textRange)
{
// 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;
+ this.setSelection(this._lastMarkedRange);
+ delete this._lastMarkedRange;
+ return;
}
if (this._lastSelection) {
serializedTextRange.endLine = this.endLine;
serializedTextRange.endColumn = this.endColumn;
return serializedTextRange;
+ },
+
+ /**
+ * @param {WebInspector.TextRange} other
+ * @return {number}
+ */
+ compareTo: function(other)
+ {
+ if (this.startLine > other.startLine)
+ return 1;
+ if (this.startLine < other.startLine)
+ return -1;
+ if (this.startColumn > other.startColumn)
+ return 1;
+ if (this.startColumn < other.startColumn)
+ return -1;
+ return 0;
}
}