Per-style CSS origin option
Lifting this out of https://github.com/openstyles/stylus/issues/248 which is also a dependency for this issue.
tabs.insertCSS features a cssOrigin option with values 'author' (default) and 'user'. I think it makes sense to expose this option to style authors via a new usercss option as well as adding a select box in the style options to change the CSS origin.
The option is implemented in Firefox since version 53 and will likely be in Chromium 66 pending review.
Let's see how the implementation will actually fare. I'm quite sure it'll have its own issues. Maybe it'll be even inferior to the one we currently use in some aspects due to the inherent limitations of WebExtensions API. Also, what makes sense to a style author doesn't necessarily make sense to a user. We could add dozens of arcane options that will be used by 1 user out of 10k once a year. Maybe a better solution would be to have only a global option. Or maybe we could use a comment like the infamous AGENT_SHEET. Or maybe we should expose this option only for usercss styles and add a meta key like @css-origin.
In my opinion user styles should always outweight page styles, but the CSS cascade spec is broken in this regard. It currently goes
-
user normal->author normal->author !important->user !imporant
We wouldn't even have this issue in first place if it were the more sane
-
author normal->user normal->author !important->user !imporant
With such a cascade, you could insert all styles as user. But I guess this can't possibly be changed by browser vendors.
In my opinion user styles should always outweight page styles, but the CSS cascade spec is broken in this regard. It currently goes
* `user normal` -> `author normal` -> `author !important` -> `user !imporant`We wouldn't even have this issue in first place if it were the more sane
* `author normal` -> `user normal` -> `author !important` -> `user !imporant`With such a cascade, you could insert all styles as
user. But I guess this can't possibly be changed by browser vendors.
The thing is, you should use user !important for that, whereas user normal is for overriding the browser’s default styles.
This is covered by #827.