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

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

Issue 2856233002: DevTools: support uiLocationToRawLocations for CSS (Closed)
Patch Set: 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 mappingsForLine(sourceURL, lineNumber) { 350 mappingsForLine(sourceURL, lineNumber) {
351 var mappings = this._reversedMappings(sourceURL); 351 var mappings = this._reversedMappings(sourceURL);
352 var startIndex = mappings.lowerBound(lineNumber, (lineNumber, mapping) => li neNumber - mapping.sourceLineNumber); 352 var startIndex = mappings.lowerBound(lineNumber, (lineNumber, mapping) => li neNumber - mapping.sourceLineNumber);
353 var endIndex = startIndex; 353 var endIndex = startIndex;
354 while (endIndex < mappings.length && mappings[endIndex].sourceLineNumber === lineNumber) 354 while (endIndex < mappings.length && mappings[endIndex].sourceLineNumber === lineNumber)
355 ++endIndex; 355 ++endIndex;
356 return mappings.slice(startIndex, endIndex); 356 return mappings.slice(startIndex, endIndex);
357 } 357 }
358 358
359 /** 359 /**
360 * @param {string} sourceURL
361 * @param {number} lineNumber
362 * @param {number} columnNumber
363 * @return {?SDK.SourceMapEntry}
364 */
365 findReverseEntry(sourceURL, lineNumber, columnNumber) {
dgozman 2017/05/04 00:04:56 Why this is not similar to JS? Which one is the co
366 var mappings = this._reversedMappings(sourceURL);
367 var index = mappings.lowerBound(
368 [lineNumber, columnNumber],
369 (position, mapping) => position[0] - mapping.sourceLineNumber || positio n[1] - mapping.sourceColumnNumber);
370 return index < mappings.length ? mappings[index] : null;
371 }
372
373 /**
360 * @return {!Array<!SDK.SourceMapEntry>} 374 * @return {!Array<!SDK.SourceMapEntry>}
361 */ 375 */
362 mappings() { 376 mappings() {
363 if (this._mappings === null) { 377 if (this._mappings === null) {
364 this._mappings = []; 378 this._mappings = [];
365 this._eachSection(this._parseMap.bind(this)); 379 this._eachSection(this._parseMap.bind(this));
366 this._json = null; 380 this._json = null;
367 } 381 }
368 return /** @type {!Array<!SDK.SourceMapEntry>} */ (this._mappings); 382 return /** @type {!Array<!SDK.SourceMapEntry>} */ (this._mappings);
369 } 383 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 * @param {?string} content 608 * @param {?string} content
595 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings 609 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings
596 */ 610 */
597 constructor(content, reverseMappings) { 611 constructor(content, reverseMappings) {
598 this.content = content; 612 this.content = content;
599 this.reverseMappings = reverseMappings; 613 this.reverseMappings = reverseMappings;
600 } 614 }
601 }; 615 };
602 616
603 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList'); 617 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698