Bug 148502

Summary: Web Inspector: Separate creating a style sheet from adding a new rule in the protocol
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
joepeck: review-
[PATCH] Proposed Fix none

Joseph Pecoraro
Reported 2015-08-26 17:13:42 PDT
* SUMMARY Separate creating a style sheet from adding a new rule. Currently the only way to create a new style from the inspector is by calling "CSSAgent.addRule" this is opaque to the frontend. Also, CSSAgent.addRule takes a contextNode to determine the frame/document to create the new style sheet. Extract createStyleSheet(frameId) => styleSheetId and convert addRule(contextNode, ...) to addRule(styleSheetId, ...). * NOTES - Blink has done the same here. - This will be useful if we want a way to view/edit all inspector added styles for a page, e.g. everything added via the style sidebar - This will be useful if we want the frontend to create arbitrary stylesheets for a page, e.g. in page building - Also, the frontend can use the new addRule to add rules to an existing stylesheet instead of the inspector stylesheet (might be useful for diffs / editing workflows)
Attachments
[PATCH] Proposed Fix (31.71 KB, patch)
2015-08-26 17:52 PDT, Joseph Pecoraro
joepeck: review-
[PATCH] Proposed Fix (42.60 KB, patch)
2015-08-26 23:01 PDT, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2015-08-26 17:14:29 PDT
Joseph Pecoraro
Comment 2 2015-08-26 17:52:01 PDT
Created attachment 260011 [details] [PATCH] Proposed Fix An open question here would be, should we allow creating more than one StyleSheet per-Frame? This patch says no, the backend will only create one. We could change that.
Timothy Hatcher
Comment 3 2015-08-26 18:04:30 PDT
One question I have been wondering is how a playground like feature could use this. It might best to have that create a separate style sheet. But it could also append rules to the existing inspector sheet. It would be easier if it didn't have to worry about mixing with other edits, so deprecate sheets might be more desirable and easier for us to manage.
Joseph Pecoraro
Comment 4 2015-08-26 22:20:41 PDT
(In reply to comment #3) > One question I have been wondering is how a playground like feature could > use this. It might best to have that create a separate style sheet. But it > could also append rules to the existing inspector sheet. It would be easier > if it didn't have to worry about mixing with other edits, so deprecate > sheets might be more desirable and easier for us to manage. Yeah, I'm going to put up a new patch that makes: - CSS.createStyleSheet(frameId) always creates a new style sheet for that frame - CSSManager.preferredInspectorStyleSheetForFrame(frame) returns one, preferred, style sheet for "Web Inspector" added styles.
Joseph Pecoraro
Comment 5 2015-08-26 23:01:37 PDT
Created attachment 260036 [details] [PATCH] Proposed Fix This makes a lot more sense!
WebKit Commit Bot
Comment 6 2015-08-28 10:59:46 PDT
Comment on attachment 260036 [details] [PATCH] Proposed Fix Clearing flags on attachment: 260036 Committed r189104: <http://trac.webkit.org/changeset/189104>
WebKit Commit Bot
Comment 7 2015-08-28 10:59:49 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.