Closed Bug 103168 Opened 24 years ago Closed 6 years ago

need a way to serialize userChrome.css and write it back out

Categories

(Core :: General, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Future

People

(Reporter: sspitzer, Unassigned)

References

()

Details

need a way to serialize userChrome.css and write it back out we'd need this feature for our labels feature. the user would be able to change the colors for labels, which would affect the thread pane. the users changes to userChrome.css would override the defaults in threadPane.css according to hyatt, there is already a way to manipulate userChrome.css in memory, we'd need to figure out how to do that, too.
While this would kick ass, this is very very *very* hard. Keep in mind that manipulating a stylesheet in-memory is preposterously expensive and results in your entire frame tree being torn down and reconstructed (i.e., expect it to take seconds to make a change to the user stylesheet). Also, the user stylesheet is not just used by mailnews. It is used by every single chrome window, which means that changing this stylesheet will behave exactly like a dynamic skin switch, which was turned off because of its many many problems. This warrants a lot of consideration before actually trying to write code.
Dave what if we did the usual "your changes will take effect the next time you restart mozilla"? Then we can write out the changes to user.css at shutdown or something. Thereby bypassing the expensive cost of tearing down our frame trees.
A IMO much simpler solution is to just store this in prefs, and then manually alter threadPane.css in memory to add the rules (based off the pref values) right after the stylesheet loads (but before it is attached).
one idea, which I'll throw out there just for --- and giggles is RDF templates in CSS. Just like RDF templates can be used to generate XUL content, why not have a mechanism by which we could generate CSS rules via RDF? Then, the user colors could just be stored in some RDF datasource which you could manipulate at runtime. Poking assertions into the datasource would only change/create rules within stylesheets have templates that reference it, so that mail could poke at their color prefs without affecting every XUL document loaded. Anyway, blue sky..
> A IMO much simpler solution is to just store this in prefs, and then manually > alter threadPane.css in memory to add the rules (based off the pref values) > right after the stylesheet loads (but before it is attached). what if the pref values change after it is attached? (say, they toggle prefs after the 3 pane is up.) worst case: we could make the label color changing feature one that only takes affect after restart.
Don't try to do it live. Make it a change that requires a restart.
Blocks: 81292
wacky idea: in our threadPane.css we define 15 rules, red, blue, green, etc, and in the prefs the user sets up which one they want of the 15. (instead of the color picker, we'd need a special picker / menulist) then, when we return the cell properties, we return one of the 15 colors, based on the user prefs, like "label-color-red" a sample idea for threadPane.css: outlinerbody:-moz-outliner-cell-text(label-color-red) { color: red; }
Yes, that would be even easier and faster too.
that would allow us to do a live change of color, but it would limit us to the hard coded colors (advanced users could add more to userChrome.css). it would also mean more rules in threadPane.css, would that be a perf hit? best case, it's not a big hit, and we do 70 rules, to match the current color picker.
if it is a big hit, we do less (15?) and have a different picker for label color.
Maybe you can create a new stylesheet just for label colors and reference that in threadPane.css. You could write that file using normal file-writing routines (no need to worry about overwriting). You could allow arbitary colors. Disadvantage: Depending on how Gecko works and which features it offers, you might have to restart before the change takes effect. (But maybe Gecko doesn't cache CSS files and you can ask it to redraw the thread pane, in which case a restart shouldn't be necessary.)
It doesn't sound like we need this anymore for labels so I'm removing the dependency.
No longer blocks: 81292
Status: NEW → ASSIGNED
Target Milestone: --- → Future
Product: Browser → Seamonkey
still valid?
Assignee: ssu0262 → nobody
Status: ASSIGNED → NEW
Product: Mozilla Application Suite → Core
QA Contact: doronr → general

(In reply to Wayne Mery (:wsmwk) from comment #13)

still valid?

No.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.