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

Unified Diff: Source/devtools/front_end/sources/FilteredItemSelectionDialog.js

Issue 1336803005: DevTools: use diff_match_patch instead of jsdifflib for text diffing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix file permissions Created 5 years, 3 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
« no previous file with comments | « Source/devtools/front_end/inspector.json ('k') | Source/devtools/front_end/sources/RevisionHistoryView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sources/FilteredItemSelectionDialog.js
diff --git a/Source/devtools/front_end/sources/FilteredItemSelectionDialog.js b/Source/devtools/front_end/sources/FilteredItemSelectionDialog.js
index 30e0333e0c791f9830d4e786c4d29cdb7ecceb56..4d8861182a57d469986b375ae70e4704759328c9 100644
--- a/Source/devtools/front_end/sources/FilteredItemSelectionDialog.js
+++ b/Source/devtools/front_end/sources/FilteredItemSelectionDialog.js
@@ -467,16 +467,16 @@ WebInspector.SelectionDialogContentProvider.prototype = {
*/
function rangesForMatch(text, query)
{
- var sm = new difflib.SequenceMatcher(query, text);
- var opcodes = sm.get_opcodes();
+ var opcodes = WebInspector.Diff.charDiff(query, text);
+ var offset = 0;
var ranges = [];
-
for (var i = 0; i < opcodes.length; ++i) {
var opcode = opcodes[i];
- if (opcode[0] === "equal")
- ranges.push(new WebInspector.SourceRange(opcode[3], opcode[4] - opcode[3]));
- else if (opcode[0] !== "insert")
+ if (opcode[0] === WebInspector.Diff.Operation.Equal)
+ ranges.push(new WebInspector.SourceRange(offset, opcode[1].length));
+ else if (opcode[0] !== WebInspector.Diff.Operation.Insert)
return null;
+ offset += opcode[1].length;
}
return ranges;
}
« no previous file with comments | « Source/devtools/front_end/inspector.json ('k') | Source/devtools/front_end/sources/RevisionHistoryView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698