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

Side by Side Diff: Source/devtools/front_end/DefaultTextEditor.js

Issue 18828002: DevTools: Replace binarySearch with lowerBound and upperBound functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 return null; 1422 return null;
1423 var highlight = this._textModel.getAttribute(lineNumber, "highlight"); 1423 var highlight = this._textModel.getAttribute(lineNumber, "highlight");
1424 if (!highlight) 1424 if (!highlight)
1425 return this._tokenAtUnhighlightedLine(line, column); 1425 return this._tokenAtUnhighlightedLine(line, column);
1426 function compare(value, object) 1426 function compare(value, object)
1427 { 1427 {
1428 if (value >= object.startColumn && value <= object.endColumn) 1428 if (value >= object.startColumn && value <= object.endColumn)
1429 return 0; 1429 return 0;
1430 return value - object.startColumn; 1430 return value - object.startColumn;
1431 } 1431 }
1432 var index = binarySearch(column, highlight.ranges, compare); 1432 var index = highlight.ranges.binaryIndexOf(column, compare);
1433 if (index >= 0) { 1433 if (index >= 0) {
1434 var range = highlight.ranges[index]; 1434 var range = highlight.ranges[index];
1435 return { 1435 return {
1436 startColumn: range.startColumn, 1436 startColumn: range.startColumn,
1437 endColumn: range.endColumn, 1437 endColumn: range.endColumn,
1438 type: range.token 1438 type: range.token
1439 }; 1439 };
1440 } 1440 }
1441 return null; 1441 return null;
1442 }, 1442 },
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3773 var braces = this._braceMatcher.enclosingBraces(lineNumber, column); 3773 var braces = this._braceMatcher.enclosingBraces(lineNumber, column);
3774 if (braces && braces.rightBrace.lineNumber === lineNumber && braces.righ tBrace.column === column) { 3774 if (braces && braces.rightBrace.lineNumber === lineNumber && braces.righ tBrace.column === column) {
3775 this._mainPanel.setSelection(WebInspector.TextRange.createFromLocati on(lineNumber, column + 1)); 3775 this._mainPanel.setSelection(WebInspector.TextRange.createFromLocati on(lineNumber, column + 1));
3776 return true; 3776 return true;
3777 } else 3777 } else
3778 return false; 3778 return false;
3779 }, 3779 },
3780 } 3780 }
3781 3781
3782 WebInspector.debugDefaultTextEditor = false; 3782 WebInspector.debugDefaultTextEditor = false;
OLDNEW
« no previous file with comments | « LayoutTests/inspector/utilities-expected.txt ('k') | Source/devtools/front_end/MemoryStatistics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698