| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 16 matching lines...) Expand all Loading... |
| 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 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 SDK.CSSModel = class extends SDK.SDKModel { | 34 SDK.CSSModel = class extends SDK.SDKModel { |
| 35 /** | 35 /** |
| 36 * @param {!SDK.Target} target | 36 * @param {!SDK.Target} target |
| 37 * @param {!Protocol.Dispatcher} dispatcher |
| 37 */ | 38 */ |
| 38 constructor(target) { | 39 constructor(target, dispatcher) { |
| 39 super(target); | 40 super(target, dispatcher); |
| 40 this._domModel = /** @type {!SDK.DOMModel} */ (target.model(SDK.DOMModel)); | 41 this._domModel = /** @type {!SDK.DOMModel} */ (target.model(SDK.DOMModel)); |
| 41 /** @type {!SDK.SourceMapManager<!SDK.CSSStyleSheetHeader>} */ | 42 /** @type {!SDK.SourceMapManager<!SDK.CSSStyleSheetHeader>} */ |
| 42 this._sourceMapManager = new SDK.SourceMapManager(target); | 43 this._sourceMapManager = new SDK.SourceMapManager(target); |
| 43 this._agent = target.cssAgent(); | 44 this._agent = dispatcher.cssAgent(); |
| 44 this._styleLoader = new SDK.CSSModel.ComputedStyleLoader(this); | 45 this._styleLoader = new SDK.CSSModel.ComputedStyleLoader(this); |
| 45 this._resourceTreeModel = target.model(SDK.ResourceTreeModel); | 46 this._resourceTreeModel = target.model(SDK.ResourceTreeModel); |
| 46 if (this._resourceTreeModel) { | 47 if (this._resourceTreeModel) { |
| 47 this._resourceTreeModel.addEventListener( | 48 this._resourceTreeModel.addEventListener( |
| 48 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._resetStyleSheet
s, this); | 49 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._resetStyleSheet
s, this); |
| 49 } | 50 } |
| 50 target.registerCSSDispatcher(new SDK.CSSDispatcher(this)); | 51 dispatcher.registerCSSDispatcher(new SDK.CSSDispatcher(this)); |
| 51 this._agent.enable().then(this._wasEnabled.bind(this)); | 52 this._agent.enable().then(this._wasEnabled.bind(this)); |
| 52 /** @type {!Map.<string, !SDK.CSSStyleSheetHeader>} */ | 53 /** @type {!Map.<string, !SDK.CSSStyleSheetHeader>} */ |
| 53 this._styleSheetIdToHeader = new Map(); | 54 this._styleSheetIdToHeader = new Map(); |
| 54 /** @type {!Map.<string, !Object.<!Protocol.Page.FrameId, !Array.<!Protocol.
CSS.StyleSheetId>>>} */ | 55 /** @type {!Map.<string, !Object.<!Protocol.Page.FrameId, !Array.<!Protocol.
CSS.StyleSheetId>>>} */ |
| 55 this._styleSheetIdsForURL = new Map(); | 56 this._styleSheetIdsForURL = new Map(); |
| 56 | 57 |
| 57 /** @type {!Map.<!SDK.CSSStyleSheetHeader, !Promise<?string>>} */ | 58 /** @type {!Map.<!SDK.CSSStyleSheetHeader, !Promise<?string>>} */ |
| 58 this._originalStyleSheetText = new Map(); | 59 this._originalStyleSheetText = new Map(); |
| 59 | 60 |
| 60 this._sourceMapManager.setEnabled(Common.moduleSetting('cssSourceMapsEnabled
').get()); | 61 this._sourceMapManager.setEnabled(Common.moduleSetting('cssSourceMapsEnabled
').get()); |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 SDK.CSSModel.InlineStyleResult = class { | 1031 SDK.CSSModel.InlineStyleResult = class { |
| 1031 /** | 1032 /** |
| 1032 * @param {?SDK.CSSStyleDeclaration} inlineStyle | 1033 * @param {?SDK.CSSStyleDeclaration} inlineStyle |
| 1033 * @param {?SDK.CSSStyleDeclaration} attributesStyle | 1034 * @param {?SDK.CSSStyleDeclaration} attributesStyle |
| 1034 */ | 1035 */ |
| 1035 constructor(inlineStyle, attributesStyle) { | 1036 constructor(inlineStyle, attributesStyle) { |
| 1036 this.inlineStyle = inlineStyle; | 1037 this.inlineStyle = inlineStyle; |
| 1037 this.attributesStyle = attributesStyle; | 1038 this.attributesStyle = attributesStyle; |
| 1038 } | 1039 } |
| 1039 }; | 1040 }; |
| OLD | NEW |