Bug 40069 - Web Inspector: Eliminate direct dependency of StylesSidebarPane on InspectorBackend
Summary: Web Inspector: Eliminate direct dependency of StylesSidebarPane on InspectorB...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-02 10:45 PDT by Alexander Pavlov (apavlov)
Modified: 2010-06-04 08:14 PDT (History)
7 users (show)

See Also:


Attachments
[PATCH] Suggested solution (22.97 KB, patch)
2010-06-03 09:29 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Comments addressed (18.29 KB, patch)
2010-06-04 03:56 PDT, Alexander Pavlov (apavlov)
pfeldman: review-
Details | Formatted Diff | Diff
[PATCH] pfeldman's comments addressed (17.27 KB, patch)
2010-06-04 07:02 PDT, Alexander Pavlov (apavlov)
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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