Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: Source/devtools/blink/chromeServerProfile/Default/Cache/f_000057

Issue 242263007: Add <label> to items in Event Listener Breakpoint of Chrome Dev Tools Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/blink/chromeServerProfile/Default/Cache/f_000057
diff --git a/Source/devtools/front_end/SourceFrame.js b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000057
similarity index 91%
copy from Source/devtools/front_end/SourceFrame.js
copy to Source/devtools/blink/chromeServerProfile/Default/Cache/f_000057
index 937d52e22e8df9fac3a19e6336c78716f4789b16..62a91cf0a38847412bec03452cd05e0ad7afb04d 100644
--- a/Source/devtools/front_end/SourceFrame.js
+++ b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000057
@@ -381,12 +381,11 @@ WebInspector.SourceFrame.prototype = {
/**
* @param {string} query
* @param {boolean} shouldJump
- * @param {boolean} jumpBackwards
* @param {function(!WebInspector.View, number)} callback
* @param {function(number)} currentMatchChangedCallback
* @param {function()} searchResultsChangedCallback
*/
- performSearch: function(query, shouldJump, jumpBackwards, callback, currentMatchChangedCallback, searchResultsChangedCallback)
+ performSearch: function(query, shouldJump, callback, currentMatchChangedCallback, searchResultsChangedCallback)
{
/**
* @param {string} query
@@ -402,8 +401,6 @@ WebInspector.SourceFrame.prototype = {
this._searchResults = this._collectRegexMatches(regex);
if (!this._searchResults.length)
this._textEditor.cancelSearchResultsHighlight();
- else if (shouldJump && jumpBackwards)
- this.jumpToPreviousSearchResult();
else if (shouldJump)
this.jumpToNextSearchResult();
else
@@ -424,11 +421,6 @@ WebInspector.SourceFrame.prototype = {
_editorFocused: function()
{
- this._resetCurrentSearchResultIndex();
- },
-
- _resetCurrentSearchResultIndex: function()
- {
if (!this._searchResults.length)
return;
this._currentSearchResultIndex = -1;
@@ -437,6 +429,17 @@ WebInspector.SourceFrame.prototype = {
this._textEditor.highlightSearchResults(this._searchRegex, null);
},
+ _searchResultAfterSelectionIndex: function(selection)
+ {
+ if (!selection)
+ return 0;
+ for (var i = 0; i < this._searchResults.length; ++i) {
+ if (this._searchResults[i].compareTo(selection) >= 0)
+ return i;
+ }
+ return 0;
+ },
+
_resetSearch: function()
{
delete this._delayedFindSearchMatches;
@@ -476,24 +479,16 @@ WebInspector.SourceFrame.prototype = {
this.jumpToSearchResult(this._searchResults.length - 1);
},
- /**
- * @return {number}
- */
- _searchResultIndexForCurrentSelection: function()
- {
- return insertionIndexForObjectInListSortedByFunction(this._textEditor.selection(), this._searchResults, WebInspector.TextRange.comparator);
- },
-
jumpToNextSearchResult: function()
{
- var currentIndex = this._searchResultIndexForCurrentSelection();
+ var currentIndex = this._searchResultAfterSelectionIndex(this._textEditor.selection());
var nextIndex = this._currentSearchResultIndex === -1 ? currentIndex : currentIndex + 1;
this.jumpToSearchResult(nextIndex);
},
jumpToPreviousSearchResult: function()
{
- var currentIndex = this._searchResultIndexForCurrentSelection();
+ var currentIndex = this._searchResultAfterSelectionIndex(this._textEditor.selection());
this.jumpToSearchResult(currentIndex - 1);
},
@@ -551,7 +546,7 @@ WebInspector.SourceFrame.prototype = {
*/
replaceAllWith: function(query, replacement)
{
- this._resetCurrentSearchResultIndex();
+ this._textEditor.highlightSearchResults(this._searchRegex, null);
var text = this._textEditor.text();
var range = this._textEditor.range();
@@ -561,25 +556,8 @@ WebInspector.SourceFrame.prototype = {
else
text = text.replace(regex, function() { return replacement; });
- var ranges = this._collectRegexMatches(regex);
- if (!ranges.length)
- return;
-
- // Calculate the position of the end of the last range to be edited.
- var currentRangeIndex = insertionIndexForObjectInListSortedByFunction(this._textEditor.selection(), ranges, WebInspector.TextRange.comparator);
- var lastRangeIndex = mod(currentRangeIndex - 1, ranges.length);
- var lastRange = ranges[lastRangeIndex];
- var replacementLineEndings = replacement.lineEndings();
- var replacementLineCount = replacementLineEndings.length;
- var lastLineNumber = lastRange.startLine + replacementLineEndings.length - 1;
- var lastColumnNumber = lastRange.startColumn;
- if (replacementLineEndings.length > 1)
- lastColumnNumber = replacementLineEndings[replacementLineCount - 1] - replacementLineEndings[replacementLineCount - 2] - 1;
-
this._isReplacing = true;
this._textEditor.editRange(range, text);
- this._textEditor.revealPosition(lastLineNumber, lastColumnNumber);
- this._textEditor.setSelection(WebInspector.TextRange.createFromLocation(lastLineNumber, lastColumnNumber));
delete this._isReplacing;
},
@@ -755,21 +733,19 @@ WebInspector.SourceFrame.prototype = {
*/
selectionChanged: function(textRange)
{
- this._updateSourcePosition();
+ this._updateSourcePosition(textRange);
this.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged, textRange);
WebInspector.notifications.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged, textRange);
},
- _updateSourcePosition: function()
+ /**
+ * @param {!WebInspector.TextRange} textRange
+ */
+ _updateSourcePosition: function(textRange)
{
- var selections = this._textEditor.selections();
- if (!selections.length)
- return;
- if (selections.length > 1) {
- this._sourcePosition.setText(WebInspector.UIString("%d selection regions", selections.length));
+ if (!textRange)
return;
- }
- var textRange = selections[0];
+
if (textRange.isEmpty()) {
this._sourcePosition.setText(WebInspector.UIString("Line %d, Column %d", textRange.endLine + 1, textRange.endColumn + 1));
return;

Powered by Google App Engine
This is Rietveld 408576698