Closed
Bug 804120
Opened 13 years ago
Closed 13 years ago
Offer a way to apply author stylesheet on a given document
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: zer0, Assigned: gkrizsanits)
References
Details
Attachments
(1 file, 1 obsolete file)
|
24.17 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
With bug 737003 and bug 676054 fixed, this is a natural consequences.
We should be able to use the new method provided by bug 737003 with the new AUTHOR style type.
That will permit to us to register author stylesheet to specific document that won't result in the DOM of the page itself, and will give to us the capability to override the author stylesheet of the page, and solving all the issues that we currently have in Add-on SDK with `contentStyle`, described here:
https://github.com/mozilla/addon-sdk/wiki/contentStyle-issues
Notice that the AUTHOR sheet registered in this way should be applied always after all the AUTHOR sheet defined in the page (at loading time and created dynamically) in order to always override them.
Plus, if a global AUTHOR sheet is registered, the AUTHOR sheet per document should be able to override it.
| Reporter | ||
Updated•13 years ago
|
| Assignee | ||
Comment 1•13 years ago
|
||
(In reply to Matteo Ferretti [:matteo] [:zer0] from comment #0)
> Plus, if a global AUTHOR sheet is registered, the AUTHOR sheet per document
> should be able to override it.
To meet this requirement, I really needed those tricks with INT32_MAX... so AddDocStyleSheet got bit more complex than it was... Shall I use some #defines for these special indexes? This is the reason for changing PresShell::AddAuthorSheet which belongs to the StyleSheetManager based AUTHOR_SHEETS which can now be overridden by document specific AUTHOR_SHEETS (added via DOMWinowUtils...).
I realized that it's easier to use the SheetTypeCount for defining the length of mAdditionalSheets with it than later assert it, if they are the same.
Attachment #675093 -
Flags: review?(bzbarsky)
| Assignee | ||
Updated•13 years ago
|
Assignee: nobody → gkrizsanits
OS: Mac OS X → All
Comment 2•13 years ago
|
||
Comment on attachment 675093 [details] [diff] [review]
Offer a way to apply author stylesheet on a given document
The only reason you need the extra complexity is because you're reusing AddDocStyleSheet in PresShell::AddAuthorSheet, right?
I think it would be better to just have that explicitly ask the document which sheet to insert before in the list (so just ask it for the pointer to the first additional stylesheet) and add an API on style set to insert a stylesheet before a given other stylesheet.
| Assignee | ||
Comment 3•13 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #2)
> Comment on attachment 675093 [details] [diff] [review]
> I think it would be better to just have that explicitly ask the document
> which sheet to insert before in the list (so just ask it for the pointer to
> the first additional stylesheet) and add an API on style set to insert a
> stylesheet before a given other stylesheet.
I like that. Thanks for the idea! I'll file another patch with that change.
| Assignee | ||
Comment 4•13 years ago
|
||
Attachment #675093 -
Attachment is obsolete: true
Attachment #675093 -
Flags: review?(bzbarsky)
Attachment #675545 -
Flags: review?(bzbarsky)
Comment 5•13 years ago
|
||
Comment on attachment 675545 [details] [diff] [review]
Offer a way to apply author stylesheet on a given document
Do you still need the change to nsDocument::GetIndexOfStyleSheet? Seems like it might be better to remove it and make the sheetDocIndex < 0 case in AddDocStyleSheet check whether "sheet" is the first additional sheet. That would make the common case of no weird sheets fast...
>+ if (!mAdditionalSheets[eAuthorSheet].Count())
>+ return nullptr;
>+
>+ return mAdditionalSheets[eAuthorSheet][0];
return mAdditionalSheets[eAuthorSheet].SafeObjectAt(0);
>+ // added with the StyleSheetManager
You mean StyleSheetService?
>+nsStyleSet::InsertBeforeStyleSheet(sheetType aType, nsIStyleSheet *aNewSheet,
How about InsertStyleSheetBefore?
You have a stray whitespace change in AddDocStyleSheet.
r=me with those fixed.
Attachment #675545 -
Flags: review?(bzbarsky) → review+
| Assignee | ||
Comment 6•13 years ago
|
||
Comment 7•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•