As soon as a CSS differ is introduced, the styles handling will become much more complex, to accommodate CSS source patching in the Resources panel.
Created attachment 57778 [details] [PATCH] Suggested solution
Comment on attachment 57778 [details] [PATCH] Suggested solution WebCore/inspector/front-end/ElementsPanel.js:35 + this.model = new WebInspector.CSSStyleModel(); should be this.styleMode or cssStyleModel WebCore/inspector/front-end/ElementsPanel.js:180 + this.model = new WebInspector.CSSStyleModel(); I'd rather change the model into a singleton as it doesn't depend on the ElementsPanel.
Created attachment 57863 [details] [PATCH] Comments addressed
Comment on attachment 57863 [details] [PATCH] Comments addressed WebCore/inspector/front-end/StylesSidebarPane.js:951 + WebInspector.styleModel.addRule(this.pane.node.id, newContent, callback, this.editingSelectorCancelled.bind(this)); callback -> successCallback ?
Comment on attachment 57863 [details] [PATCH] Comments addressed Overall great first step. Few nits below: WebCore/inspector/front-end/CSSStyleModel.js:36 + styles: function(nodeId, authOnly, userCallback) getStylesAsync WebCore/inspector/front-end/CSSStyleModel.js:48 + computedStyle: function(nodeId, userCallback) getComputedStyleAsync WebCore/inspector/front-end/CSSStyleModel.js:39 + function callback(styles) why wrapping it? WebCore/inspector/front-end/CSSStyleModel.js:50 + function callback(style) ditto WebCore/inspector/front-end/CSSStyleModel.js:95 + toggleStyleEnablement: function(styleId, propertyName, disabled, userCallback) toggleStyleEnabled WebCore/inspector/front-end/CSSStyleModel.js:117 + function callback(success) no need to wrap WebCore/inspector/front-end/CSSStyleModel.js:115 + setStyleText: function(styleId, cssText, userCallback) setCSSText WebCore/inspector/front-end/CSSStyleModel.js:140 + InspectorBackend.applyStyleText(WebInspector.Callback.wrap(callback), styleId, styleText, propertyName); callback.bind(this) WebCore/inspector/front-end/CSSStyleModel.js:127 + var self = this; no 'this' here WebCore/inspector/front-end/StylesSidebarPane.js:1567 + WebInspector.styleModel.applyStyleText(this.style.id, styleText, this.name, successCallback, failureCallback); cssModel
Created attachment 57870 [details] [PATCH] pfeldman's comments addressed
Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebCore/ChangeLog A WebCore/inspector/front-end/CSSStyleModel.js M WebCore/inspector/front-end/StylesSidebarPane.js M WebCore/inspector/front-end/inspector.html M WebCore/inspector/front-end/inspector.js Committed r60680