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

Side by Side Diff: Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 676193002: Navigate between individual search matches in DevTools console (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Add tests Created 6 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 } 930 }
931 a.appendChild(toAppend); 931 a.appendChild(toAppend);
932 } 932 }
933 return a; 933 return a;
934 } 934 }
935 935
936 // String.format does treat formattedResult like a Builder, result is an object. 936 // String.format does treat formattedResult like a Builder, result is an object.
937 return String.format(format, parameters, formatters, formattedResult, ap pend); 937 return String.format(format, parameters, formatters, formattedResult, ap pend);
938 }, 938 },
939 939
940 clearHighlight: function() 940 clearHighlights: function()
941 { 941 {
942 if (!this._formattedMessage) 942 if (!this._formattedMessage)
943 return; 943 return;
944 944
945 WebInspector.removeSearchResultsHighlight(this._formattedMessage); 945 WebInspector.removeSearchResultsHighlight(this._formattedMessage);
946 }, 946 },
947 947
948 // XXX: Can we remove this?
lushnikov 2014/11/07 16:27:19 yes!
aknudsen 2014/11/09 00:02:13 Done.
948 highlightSearchResults: function(regexObject) 949 highlightSearchResults: function(regexObject)
949 { 950 {
950 if (!this._formattedMessage) 951 if (!this._formattedMessage)
951 return; 952 return;
952 953
953 this._highlightSearchResultsInElement(regexObject, this._messageElement) ; 954 this._highlightSearchResultsInElement(regexObject, this._messageElement) ;
954 if (this._anchorElement) 955 if (this._anchorElement)
955 this._highlightSearchResultsInElement(regexObject, this._anchorEleme nt); 956 this._highlightSearchResultsInElement(regexObject, this._anchorEleme nt);
956 }, 957 },
957 958
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 break; 1260 break;
1260 } 1261 }
1261 1262
1262 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line; 1263 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line;
1263 }, 1264 },
1264 1265
1265 get text() 1266 get text()
1266 { 1267 {
1267 return this._message.messageText; 1268 return this._message.messageText;
1268 }, 1269 },
1270
1271 /**
1272 * @return {!string}
lushnikov 2014/11/07 16:27:19 no need for an exclamation mark - string is non-nu
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:14 Done.
1273 */
lushnikov 2014/11/07 16:27:17 wrong comment alining regarding asterisks
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:13 Done.
1274 getText: function () {
lushnikov 2014/11/07 16:27:19 brace on a new line
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:13 Done.
1275 if (!this._messageElement)
1276 return '';
lushnikov 2014/11/07 16:27:19 we use only double-quotes for strings
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:13 Done.
1277 return this._messageElement.textContent;
1278 },
1279
1280 /**
1281 * @return {!Array.<!Element>}
lushnikov 2014/11/07 16:27:19 comment aligning + annotation for arguments
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:13 Done.
1282 */
1283 highlightMatch: function(start, end)
1284 {
1285 var highlightNodes = [];
1286 if (this._formattedMessage)
1287 highlightNodes = WebInspector.highlightSearchResults(this._messageEl ement,
lushnikov 2014/11/07 16:27:19 no wrap
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:13 Done.
1288 [new WebInspector.SourceRange(start, end - start + 1)]);
1289 return highlightNodes;
1290 },
lushnikov 2014/11/07 16:27:19 no trailing comma
aknudsen 2014/11/08 12:00:52 Acknowledged.
aknudsen 2014/11/09 00:02:13 Done.
1269 } 1291 }
1270 1292
1271 /** 1293 /**
1272 * @constructor 1294 * @constructor
1273 * @extends {WebInspector.ConsoleViewMessage} 1295 * @extends {WebInspector.ConsoleViewMessage}
1274 * @param {!WebInspector.ConsoleMessage} consoleMessage 1296 * @param {!WebInspector.ConsoleMessage} consoleMessage
1275 * @param {!WebInspector.Linkifier} linkifier 1297 * @param {!WebInspector.Linkifier} linkifier
1276 * @param {number} nestingLevel 1298 * @param {number} nestingLevel
1277 */ 1299 */
1278 WebInspector.ConsoleGroupViewMessage = function(consoleMessage, linkifier, nesti ngLevel) 1300 WebInspector.ConsoleGroupViewMessage = function(consoleMessage, linkifier, nesti ngLevel)
(...skipping 29 matching lines...) Expand all
1308 { 1330 {
1309 if (!this._wrapperElement) { 1331 if (!this._wrapperElement) {
1310 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); 1332 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this );
1311 this._wrapperElement.classList.toggle("collapsed", this._collapsed); 1333 this._wrapperElement.classList.toggle("collapsed", this._collapsed);
1312 } 1334 }
1313 return this._wrapperElement; 1335 return this._wrapperElement;
1314 }, 1336 },
1315 1337
1316 __proto__: WebInspector.ConsoleViewMessage.prototype 1338 __proto__: WebInspector.ConsoleViewMessage.prototype
1317 } 1339 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698