As I’ve said before, an early issue reported against Odysseus was that text looked blurry on Google+, and as it turned out Google was explicitly asking for it via the -webkit-font-smoothing CSS property. So I used a userstyle to largely disable this property everywhere, it mostly just gets misused.

Today I think I’ll describe how userstyles work, and one day I hope to expose this API through my UI.

Once I register UserStyleSheet object against the UserContentManager, it quickly gets bridged over into C++ and then the sandbox. From there it updates it’s internal mappings as requested before telling it’s WebCore superclass to refresh all the styles.

This request then gets dispatched to all the pages and turn all their frames’ document’s stylesheet extensions. The collection of stylesheet extensions then flags itself and dispatches on to the StyleScope.

Those StyleScopes then schedules updates on themselves and any “shadow DOMs” (used largely for form inputs) by setting appropriate dirty flags and using a timer to run the style engine on idle. Then it traverses the DOM (just like you see in JavaScript) for style rules and asks the UserContentManager for the “author” (for which it’ll check all registered stylesheets) and “testing” stylesheets to be mixed in.

Those’ll then get merged together for normal style resolution.