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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js

Issue 2693383003: [DevTools] Refactor CSS live locations. (Closed)
Patch Set: rebased Created 3 years, 10 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SDK.ResourceTreeModel.fromTarget(cssModel.target()) 56 SDK.ResourceTreeModel.fromTarget(cssModel.target())
57 .addEventListener(SDK.ResourceTreeModel.Events.MainFrameNavigated, thi s._unbindAllUISourceCodes, this) 57 .addEventListener(SDK.ResourceTreeModel.Events.MainFrameNavigated, thi s._unbindAllUISourceCodes, this)
58 ]; 58 ];
59 } 59 }
60 60
61 /** 61 /**
62 * @param {!SDK.CSSLocation} rawLocation 62 * @param {!SDK.CSSLocation} rawLocation
63 * @return {?Workspace.UILocation} 63 * @return {?Workspace.UILocation}
64 */ 64 */
65 rawLocationToUILocation(rawLocation) { 65 rawLocationToUILocation(rawLocation) {
66 var uiSourceCode = 66 var header = rawLocation.header();
67 Bindings.NetworkProject.uiSourceCodeForStyleURL(this._workspace, rawLoca tion.url, rawLocation.header()); 67 if (!header)
68 return null;
69 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForStyleURL(this._wor kspace, rawLocation.url, header);
68 if (!uiSourceCode) 70 if (!uiSourceCode)
69 return null; 71 return null;
70 var lineNumber = rawLocation.lineNumber; 72 var lineNumber = rawLocation.lineNumber;
71 var columnNumber = rawLocation.columnNumber; 73 var columnNumber = rawLocation.columnNumber;
72 var header = this._cssModel.styleSheetHeaderForId(rawLocation.styleSheetId);
73 if (header && header.isInline && header.hasSourceURL) { 74 if (header && header.isInline && header.hasSourceURL) {
74 lineNumber -= header.lineNumberInSource(0); 75 lineNumber -= header.lineNumberInSource(0);
75 columnNumber -= header.columnNumberInSource(lineNumber, 0); 76 columnNumber -= header.columnNumberInSource(lineNumber, 0);
76 } 77 }
77 return uiSourceCode.uiLocation(lineNumber, columnNumber); 78 return uiSourceCode.uiLocation(lineNumber, columnNumber);
78 } 79 }
79 80
80 /** 81 /**
81 * @param {!Common.Event} event 82 * @param {!Common.Event} event
82 */ 83 */
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 353
353 dispose() { 354 dispose() {
354 if (this._terminated) 355 if (this._terminated)
355 return; 356 return;
356 this._terminated = true; 357 this._terminated = true;
357 Common.EventTarget.removeEventListeners(this._eventListeners); 358 Common.EventTarget.removeEventListeners(this._eventListeners);
358 } 359 }
359 }; 360 };
360 361
361 Bindings.StyleFile.updateTimeout = 200; 362 Bindings.StyleFile.updateTimeout = 200;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698