OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 this._eventListeners = [ | 48 this._eventListeners = [ |
49 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRe
moved, this._projectRemoved, this), | 49 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRe
moved, this._projectRemoved, this), |
50 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeAdded, this._uiSourceCodeAddedToWorkspace, this), | 50 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeAdded, this._uiSourceCodeAddedToWorkspace, this), |
51 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeRemoved, this._uiSourceCodeRemoved, this), | 51 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeRemoved, this._uiSourceCodeRemoved, this), |
52 this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetA
dded, this._styleSheetAdded, this), | 52 this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetA
dded, this._styleSheetAdded, this), |
53 this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetR
emoved, this._styleSheetRemoved, this), | 53 this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetR
emoved, this._styleSheetRemoved, this), |
54 this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetC
hanged, this._styleSheetChanged, this), | 54 this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetC
hanged, this._styleSheetChanged, this), |
55 WebInspector.ResourceTreeModel.fromTarget(cssModel.target()).addEventLis
tener( | 55 WebInspector.ResourceTreeModel.fromTarget(cssModel.target()).addEventLis
tener( |
56 WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._unbi
ndAllUISourceCodes, this) | 56 WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._unbi
ndAllUISourceCodes, this) |
57 ]; | 57 ]; |
58 } | 58 }; |
59 | 59 |
60 WebInspector.StylesSourceMapping.ChangeUpdateTimeoutMs = 200; | 60 WebInspector.StylesSourceMapping.ChangeUpdateTimeoutMs = 200; |
61 | 61 |
62 WebInspector.StylesSourceMapping.prototype = { | 62 WebInspector.StylesSourceMapping.prototype = { |
63 /** | 63 /** |
64 * @param {!WebInspector.CSSLocation} rawLocation | 64 * @param {!WebInspector.CSSLocation} rawLocation |
65 * @return {?WebInspector.UILocation} | 65 * @return {?WebInspector.UILocation} |
66 */ | 66 */ |
67 rawLocationToUILocation: function(rawLocation) | 67 rawLocationToUILocation: function(rawLocation) |
68 { | 68 { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 var styleFile = this._styleFiles.get(uiSourceCode); | 285 var styleFile = this._styleFiles.get(uiSourceCode); |
286 if (styleFile) | 286 if (styleFile) |
287 styleFile.addRevision(content || ""); | 287 styleFile.addRevision(content || ""); |
288 } | 288 } |
289 }, | 289 }, |
290 | 290 |
291 dispose: function() | 291 dispose: function() |
292 { | 292 { |
293 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 293 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
294 } | 294 } |
295 } | 295 }; |
296 | 296 |
297 /** | 297 /** |
298 * @constructor | 298 * @constructor |
299 * @param {!WebInspector.UISourceCode} uiSourceCode | 299 * @param {!WebInspector.UISourceCode} uiSourceCode |
300 * @param {!WebInspector.StylesSourceMapping} mapping | 300 * @param {!WebInspector.StylesSourceMapping} mapping |
301 */ | 301 */ |
302 WebInspector.StyleFile = function(uiSourceCode, mapping) | 302 WebInspector.StyleFile = function(uiSourceCode, mapping) |
303 { | 303 { |
304 this._uiSourceCode = uiSourceCode; | 304 this._uiSourceCode = uiSourceCode; |
305 this._mapping = mapping; | 305 this._mapping = mapping; |
306 this._eventListeners = [ | 306 this._eventListeners = [ |
307 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Wor
kingCopyChanged, this._workingCopyChanged, this), | 307 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Wor
kingCopyChanged, this._workingCopyChanged, this), |
308 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Wor
kingCopyCommitted, this._workingCopyCommitted, this) | 308 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Wor
kingCopyCommitted, this._workingCopyCommitted, this) |
309 ]; | 309 ]; |
310 this._commitThrottler = new WebInspector.Throttler(WebInspector.StyleFile.up
dateTimeout); | 310 this._commitThrottler = new WebInspector.Throttler(WebInspector.StyleFile.up
dateTimeout); |
311 this._terminated = false; | 311 this._terminated = false; |
312 } | 312 }; |
313 | 313 |
314 WebInspector.StyleFile.updateTimeout = 200; | 314 WebInspector.StyleFile.updateTimeout = 200; |
315 | 315 |
316 WebInspector.StyleFile.prototype = { | 316 WebInspector.StyleFile.prototype = { |
317 /** | 317 /** |
318 * @param {!WebInspector.Event} event | 318 * @param {!WebInspector.Event} event |
319 */ | 319 */ |
320 _workingCopyCommitted: function(event) | 320 _workingCopyCommitted: function(event) |
321 { | 321 { |
322 if (this._isAddingRevision) | 322 if (this._isAddingRevision) |
(...skipping 12 matching lines...) Expand all Loading... |
335 return; | 335 return; |
336 | 336 |
337 this._commitThrottler.schedule(this._commitIncrementalEdit.bind(this), f
alse); | 337 this._commitThrottler.schedule(this._commitIncrementalEdit.bind(this), f
alse); |
338 }, | 338 }, |
339 | 339 |
340 _commitIncrementalEdit: function() | 340 _commitIncrementalEdit: function() |
341 { | 341 { |
342 if (this._terminated) | 342 if (this._terminated) |
343 return; | 343 return; |
344 var promise = this._mapping._setStyleContent(this._uiSourceCode, this._u
iSourceCode.workingCopy(), this._isMajorChangePending) | 344 var promise = this._mapping._setStyleContent(this._uiSourceCode, this._u
iSourceCode.workingCopy(), this._isMajorChangePending) |
345 .then(this._styleContentSet.bind(this)) | 345 .then(this._styleContentSet.bind(this)); |
346 this._isMajorChangePending = false; | 346 this._isMajorChangePending = false; |
347 return promise; | 347 return promise; |
348 }, | 348 }, |
349 | 349 |
350 /** | 350 /** |
351 * @param {?string} error | 351 * @param {?string} error |
352 */ | 352 */ |
353 _styleContentSet: function(error) | 353 _styleContentSet: function(error) |
354 { | 354 { |
355 if (error) | 355 if (error) |
(...skipping 10 matching lines...) Expand all Loading... |
366 delete this._isAddingRevision; | 366 delete this._isAddingRevision; |
367 }, | 367 }, |
368 | 368 |
369 dispose: function() | 369 dispose: function() |
370 { | 370 { |
371 if (this._terminated) | 371 if (this._terminated) |
372 return; | 372 return; |
373 this._terminated = true; | 373 this._terminated = true; |
374 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 374 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
375 } | 375 } |
376 } | 376 }; |
OLD | NEW |