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

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

Issue 471433004: DevTools: Split out the "workspace" and "bindings" modules from "sdk" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove marker interfaces and WI.SourceMapping Created 6 years, 4 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) 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.SourceMapping} 33 * @implements {WebInspector.CSSSourceMapping}
34 * @param {!WebInspector.CSSStyleModel} cssModel 34 * @param {!WebInspector.CSSStyleModel} cssModel
35 * @param {!WebInspector.Workspace} workspace 35 * @param {!WebInspector.Workspace} workspace
36 */ 36 */
37 WebInspector.StylesSourceMapping = function(cssModel, workspace) 37 WebInspector.StylesSourceMapping = function(cssModel, workspace)
38 { 38 {
39 this._cssModel = cssModel; 39 this._cssModel = cssModel;
40 this._workspace = workspace; 40 this._workspace = workspace;
41 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove d, this._projectRemoved, this); 41 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove d, this._projectRemoved, this);
42 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAddedToWorkspace, this); 42 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAddedToWorkspace, this);
43 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR emoved, this._uiSourceCodeRemoved, this); 43 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR emoved, this._uiSourceCodeRemoved, this);
44 44
45 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); 45 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this);
46 46
47 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheet Changed, this._styleSheetChanged, this); 47 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheet Changed, this._styleSheetChanged, this);
48 this._initialize(); 48 this._initialize();
49 } 49 }
50 50
51 WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs = 1000; 51 WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs = 1000;
52 52
53 WebInspector.StylesSourceMapping.prototype = { 53 WebInspector.StylesSourceMapping.prototype = {
54 /** 54 /**
55 * @param {!WebInspector.RawLocation} rawLocation 55 * @param {!WebInspector.CSSLocation} rawLocation
56 * @return {?WebInspector.UILocation} 56 * @return {?WebInspector.UILocation}
57 */ 57 */
58 rawLocationToUILocation: function(rawLocation) 58 rawLocationToUILocation: function(rawLocation)
59 { 59 {
60 var location = /** @type WebInspector.CSSLocation */ (rawLocation); 60 var location = /** @type WebInspector.CSSLocation */ (rawLocation);
61 var uiSourceCode = this._workspace.uiSourceCodeForURL(location.url); 61 var uiSourceCode = this._workspace.uiSourceCodeForURL(location.url);
62 if (!uiSourceCode) 62 if (!uiSourceCode)
63 return null; 63 return null;
64 return uiSourceCode.uiLocation(location.lineNumber, location.columnNumbe r); 64 return uiSourceCode.uiLocation(location.lineNumber, location.columnNumbe r);
65 }, 65 },
66 66
67 /** 67 /**
68 * @param {!WebInspector.UISourceCode} uiSourceCode 68 * @param {!WebInspector.UISourceCode} uiSourceCode
69 * @param {number} lineNumber 69 * @param {number} lineNumber
70 * @param {number} columnNumber 70 * @param {number} columnNumber
71 * @return {!WebInspector.RawLocation} 71 * @return {!WebInspector.CSSLocation}
72 */ 72 */
73 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) 73 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
74 { 74 {
75 return new WebInspector.CSSLocation(this._cssModel.target(), null, uiSou rceCode.url || "", lineNumber, columnNumber); 75 return new WebInspector.CSSLocation(this._cssModel.target(), null, uiSou rceCode.url || "", lineNumber, columnNumber);
76 }, 76 },
77 77
78 /** 78 /**
79 * @return {boolean} 79 * @return {boolean}
80 */ 80 */
81 isIdentity: function() 81 isIdentity: function()
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 this._uiSourceCode.addRevision(content); 391 this._uiSourceCode.addRevision(content);
392 delete this._isAddingRevision; 392 delete this._isAddingRevision;
393 }, 393 },
394 394
395 dispose: function() 395 dispose: function()
396 { 396 {
397 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); 397 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this);
398 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 398 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
399 } 399 }
400 } 400 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/bindings/ScriptSnippetModel.js ('k') | Source/devtools/front_end/bindings/TempFile.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698