Allow @media queries, @-moz-document and content styling in theme_experiments
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement)
Tracking
(Not tracked)
People
(Reporter: TbSync, Assigned: TbSync)
Details
Attachments
(2 files, 2 obsolete files)
8.75 KB,
patch
|
TbSync
:
review-
|
Details | Diff | Splinter Review |
1.66 KB,
application/x-xpinstall
|
Details |
Bug 1691560 is only a fallback solution. What I really want is to be able to use @media
queries again: They can be used to identify win, linux and mac, but also what system theme is running. We use that in our css files as well:
@media (-moz-windows-default-theme)
I also want to be able to propose styles per document:
@-moz-document url(chrome://messenger/content/messenger.xhtml)
Furthermore, theme developers should be able to propose styles for content areas, like settings and add-on manager.
All this is currently not possible, because the theme_experiment CSS file is treated as content (because it has a moz-extension
URL).
I found a few ways to fix this:
- Enable
layout.css.moz-document.content.enabled
in Thunderbird
- @media: -
- @-moz-document: +
- content: -
- Enables this also in emails and real content, might be not desired
- Setup a
chrome://
orresoure://
URL for the css files of the theme:
- @media: +
- @-moz-document: +
- content: -
- Could be deemed to powerful as an entire folder has to be made accessible via
chrome://
orresource://
. Use random short-name suffix?
- use
nsIStyleSheetService
- @media: +
- @-moz-document: +
- content: +
- Is this on death row? Not used in m-c.
This patch goes for option 3. Instead of changing the behavior of the CSS file defined via
the stylesheet
manifest entry, I added a new one (thunderbird_stylesheet
). Only if stylesheet
is not set, the other one is used.
I do not really know the difference between AGENT_SHEET, USER_SHEET and AUTHOR_SHEET, or which one we should use. It looks like AUTHOR_SHEET does not support @media and @-moz-document. But what is the difference between the other two?
Are there other options to get this done?
Assignee | ||
Comment 1•4 years ago
|
||
@Mark: Do you know if nsIStyleSheetService
should not be used anymore?
@Richard: What do you think? This should also allow tree theming.
Assignee | ||
Comment 2•4 years ago
•
|
||
A simple theme using the new features.
Standard text color is purple, on windows (-moz-windows-default-theme) green.
For mail3pane it's blue.
Comment 3•4 years ago
|
||
Comment on attachment 9202620 [details] [diff] [review]
bug1692243_empower_theme_experiments.patch
Looks good. But I'm not sure with the limitation to not use thunderbird_stylesheet
when a normal stylesheet
is present as this makes it impossible to create themes that work under FX and TB and additionally use the special power for TB.
Assignee | ||
Comment 4•4 years ago
•
|
||
Themes using thunderbird_stylesheet
will not work at all in Firefox (throws error on install), as that does not know the new manifest key.
To get around this, we could clone theme_experiment
and add a full new manifest entrythunderbird_theme_experiment
which then uses the default stylesheet
key but gives the advanced power to it. Thunderbird will ignore theme_experiment
if thunderbird_theme_experiment
is given. Firefox will throw a warning about the unknown manifest entry but will work as before using the theme_experiment
.
The other option is to simply change the behavior of the standard stylesheet
entry for Thunderbird. But I oppose that, as it may change behavior tested for in toolkit tests which we cannot change and which could cause fails.
Assignee | ||
Comment 5•4 years ago
|
||
It turned out to be not very difficult to implement thunderbird_theme_experiment
. It does feel cleaner.
Assignee | ||
Comment 6•4 years ago
|
||
Updated example theme, using thunderbird_theme_experiment
.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 7•4 years ago
|
||
I will add tests when I know this is ok in general.
Assignee | ||
Updated•4 years ago
|
Comment 8•4 years ago
|
||
I'm not a big fan of this. It feels a bit awkward.
I wonder if we can get moz-extension URLs for stylesheets to be considered "not content", on the grounds that (1) they're not scripts so not a big risk and (2) they're only available where experiments are enabled and in that case the extension can already do whatever it wants. There may be other implications I haven't thought of, but I think it would be worth asking. (I'm not sure who to ask.)
(In reply to John Bieling (:TbSync) from comment #4)
The other option is to simply change the behavior of the standard
stylesheet
entry for Thunderbird. But I oppose that, as it may change behavior tested for in toolkit tests which we cannot change and which could cause fails.
FWIW, we already fail almost all of the toolkit tests for themes on account of differences between Thunderbird and Firefox (in a lot of cases it's just elements the test are looking for that we don't have). However, if you take the change of behaviour and apply it to the toolkit version of ext-themes.js, all of the tests still pass in Firefox. So that's something.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•5 months ago
|
Description
•