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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js

Issue 2856233002: DevTools: support uiLocationToRawLocations for CSS (Closed)
Patch Set: review comments addressed Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 * @param {number} lineNumber 358 * @param {number} lineNumber
359 * @param {!SDK.SourceMapEntry} mapping 359 * @param {!SDK.SourceMapEntry} mapping
360 * @return {number} 360 * @return {number}
361 */ 361 */
362 function lineComparator(lineNumber, mapping) { 362 function lineComparator(lineNumber, mapping) {
363 return lineNumber - mapping.sourceLineNumber; 363 return lineNumber - mapping.sourceLineNumber;
364 } 364 }
365 } 365 }
366 366
367 /** 367 /**
368 * @param {string} sourceURL
369 * @param {number} lineNumber
370 * @param {number} columnNumber
371 * @return {!Array<!SDK.SourceMapEntry>}
372 */
373 findReverseEntries(sourceURL, lineNumber, columnNumber) {
374 var mappings = this._reversedMappings(sourceURL);
375 var endIndex = mappings.upperBound(
376 undefined, (unused, entry) => lineNumber - entry.sourceLineNumber || col umnNumber - entry.sourceColumnNumber);
377 var startIndex = endIndex;
378 while (startIndex > 0 && mappings[startIndex - 1].sourceLineNumber === mappi ngs[endIndex - 1].sourceLineNumber &&
379 mappings[startIndex - 1].sourceColumnNumber === mappings[endIndex - 1 ].sourceColumnNumber)
380 --startIndex;
381
382 return mappings.slice(startIndex, endIndex);
383 }
384
385 /**
368 * @return {!Array<!SDK.SourceMapEntry>} 386 * @return {!Array<!SDK.SourceMapEntry>}
369 */ 387 */
370 mappings() { 388 mappings() {
371 if (this._mappings === null) { 389 if (this._mappings === null) {
372 this._mappings = []; 390 this._mappings = [];
373 this._eachSection(this._parseMap.bind(this)); 391 this._eachSection(this._parseMap.bind(this));
374 this._json = null; 392 this._json = null;
375 } 393 }
376 return /** @type {!Array<!SDK.SourceMapEntry>} */ (this._mappings); 394 return /** @type {!Array<!SDK.SourceMapEntry>} */ (this._mappings);
377 } 395 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 * @param {?string} content 620 * @param {?string} content
603 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings 621 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings
604 */ 622 */
605 constructor(content, reverseMappings) { 623 constructor(content, reverseMappings) {
606 this.content = content; 624 this.content = content;
607 this.reverseMappings = reverseMappings; 625 this.reverseMappings = reverseMappings;
608 } 626 }
609 }; 627 };
610 628
611 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList'); 629 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698