Add a new type of Stylesheet to use with nsIStyleSheetService that always overrides the Author Stylesheet by default

RESOLVED DUPLICATE of bug 676054

Status

()

Core
CSS Parsing and Computation
RESOLVED DUPLICATE of bug 676054
6 years ago
6 years ago

People

(Reporter: zer0, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
Currently we use `nsIStyleSheetService` to register `User Stylesheet` in Add-on SDK for the `contentStyle*` options in `Page-Mod`, as described in the bug 634764.

But add-on developers expected that their stylesheet added via Add-on will *always* override the document stylesheets by default; where User Stylesheet can do that only with `!important`.

Basically they want a consistent behaviors between the Style Editor and the `contentStyle` (see 755606).

Unfortunately we can't use the same approach of the Style Editor, that basically add dynamycally a `<style>` tag at the end of the document, because we need to be protected from introspection by the page itself.

So what is needed, is another type of Stylesheet ("Add-on Stylesheet"?) that behaves like the User Stylesheet but where the css rules have more "weight" than the author's stylesheet by default (without the need to have `!important`).

I'm aware this is not following the standard, so I'm open to any other suggestion that could solve nicely the issue.

If you're interested, here there is the explanation of the big picture: https://github.com/mozilla/addon-sdk/wiki/contentStyle-issues
So this is subtly different from bug 676054 in that you want these sheets to go into the override sheet cascade level, not the author cascade level?
(Reporter)

Comment 2

6 years ago
I admit I'm a bit confused :) But after read the bug and the discussion on google groups, I believe we could also use the approach suggested in the bug 676054; my only concern is if the author stylesheet registered in that way will be always applied over any other author stylesheet defined from the page, even the ones created and added dynamically from the page itself later on.

In that scenario our author stylesheet won't be able to override the inline stylesheet – especially if they are added with `!important` rules – but I guess it's a good trade off – add-on developers could always manipulate that with `contentScript`; and we're not introducing new stylesheet type.

If I understood correctly, we could close this bug.
(Reporter)

Updated

6 years ago
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 676054
You need to log in before you can comment on or make changes to this bug.