[Webkit-unassigned] [Bug 141877] Web Inspector: split out CSSAgent wrapper classes to fix protocol layering violation and cruft

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Feb 21 22:10:50 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=141877

--- Comment #3 from Brian Burg <burg at cs.washington.edu> ---
Yeah, I know, this will be hell to review. Maybe we can do it in person at WebKitCon. The gist of this change: be able to introspect, dump and modify CSS from other backend agents.

Currently, CSSAgent heavily uses a wrapper class InspectorStyleSheet, which represents a stylesheet or an inline style (with subclass InspectorStyleSheetForInlineStyle). These classes hold source range data, raw style text, and have a basic API for mutating properties or entire stylesheets.

These existing classes do not map well to what actually is shared and differs between inline styles and stylesheets. As a result, the code is convoluted and littered with null checks to tell apart the two "modes". There is also a lot of code to maintain up-to-date source data, raw text, and style rules, but each piece of data has a different lifetime. To top it all off, responsibility for protocol encoding is split across CSSAgent and the various wrapper classes. In some cases, a style rule descends through 3 protocol object builder methods to fully construct a protocol object.

I'm proceeding in several steps to clean up this mess:

1. Convert to using a "StyleRuleSet" abstraction.

A StyleRuleSet contains a number of "StyleRule" instances. Inline style rules are represented by InlineStyleRuleSet. Its single rule has no selector. It overrides mutation methods to modify the element's style attribute. Stylesheets are represented by the StylesheetRuleSet subclass.

2. Move all protocol builder classes to CSSAgent

3. Straighten out StyleRule, StyleProperty, etc. Protocol builder methods should walk over a wrapper hierarchy that mirrors the actual CSS stylesheet/rule/property hierarchy.

4. Remove unnecessary wrapper methods that are made obsolete by proper per-style and per-property APIs introduced in (3)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150222/6def4639/attachment-0002.html>


More information about the webkit-unassigned mailing list