Bug 40069

Summary: Web Inspector: Eliminate direct dependency of StylesSidebarPane on InspectorBackend
Product: WebKit Reporter: Alexander Pavlov (apavlov) <apavlov>
Component: Web Inspector (Deprecated)Assignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED FIXED    
Severity: Enhancement CC: bweinstein, joepeck, keishi, pfeldman, pmuellr, rik, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Suggested solution
none
[PATCH] Comments addressed
pfeldman: review-
[PATCH] pfeldman's comments addressed pfeldman: review+

Description Alexander Pavlov (apavlov) 2010-06-02 10:45:03 PDT
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.
Comment 1 Alexander Pavlov (apavlov) 2010-06-03 09:29:48 PDT
Created attachment 57778 [details]
[PATCH] Suggested solution
Comment 2 Yury Semikhatsky 2010-06-04 02:10:37 PDT
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.
Comment 3 Alexander Pavlov (apavlov) 2010-06-04 03:56:20 PDT
Created attachment 57863 [details]
[PATCH] Comments addressed
Comment 4 Yury Semikhatsky 2010-06-04 04:54:38 PDT
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 5 Pavel Feldman 2010-06-04 06:12:20 PDT
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
Comment 6 Alexander Pavlov (apavlov) 2010-06-04 07:02:14 PDT
Created attachment 57870 [details]
[PATCH] pfeldman's comments addressed
Comment 7 Alexander Pavlov (apavlov) 2010-06-04 08:14:13 PDT
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