Closed
Bug 369676
Opened 19 years ago
Closed 19 years ago
Shouldn't be possible to style scrollbars in XUL
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
People
(Reporter: sicking, Assigned: sicking)
References
Details
Attachments
(1 file)
|
1.97 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
It is currently possible to write selectors that will style scrollbars. However this only works in XUL documents. For example in a document stylesheet the selector
window.myCool scrollbar { ... }
will apply to all scrollbars in all <window class="myCool">s. This only works inside XUL documents, but shouldn't work anywhere.
You can use the above selector inside UA stylesheets though, which should be enough if anyone wants to create themes or apps with custom scrollbars.
Would be good to get input from the XUL guys if this is a bad idea for some reason.
| Assignee | ||
Comment 1•19 years ago
|
||
Comment 2•19 years ago
|
||
Note that themes are treated as document sheets, not UA sheets....
| Assignee | ||
Comment 3•19 years ago
|
||
Really? How come pinstripe contains stylerules for styling scrollbars then?
Comment 4•19 years ago
|
||
What sort of rules?
chrome://global/skin/xulscrollbars.css and chrome://global/skin/nativescrollbars.css are hardcoded in layout and applied as UA sheets to all documents. So if that's where the skin is putting its rules they'll be fine. If they're putting them in chrome://global/skin/, however, they won't be.
So I guess ignore comment 2. I forgot about the special handling for the scrollbars sheets...
| Assignee | ||
Updated•19 years ago
|
Attachment #254379 -
Flags: superreview?(bzbarsky)
Attachment #254379 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 5•19 years ago
|
||
Ok, so I'm requesting review for this and will land unless someone speaks up.
Comment 6•19 years ago
|
||
which scrollbars does this patch prevent from styling?
Comment 7•19 years ago
|
||
The ones created via nsIAnonymousContentCreator (typically for scrollframes). With this patch, document sheets cannot style them.
Comment 8•19 years ago
|
||
Comment on attachment 254379 [details] [diff] [review]
Patch to fix
The change looks fine; please OK it with enn and/or neil.
Attachment #254379 -
Flags: superreview?(bzbarsky)
Attachment #254379 -
Flags: superreview+
Attachment #254379 -
Flags: review?(bzbarsky)
Attachment #254379 -
Flags: review+
Comment 9•19 years ago
|
||
In that case, this is ok.
| Assignee | ||
Comment 10•19 years ago
|
||
It prevents document authors from styling any scrollbars. I.e. a webpage can not stick
scrollbar { background: green }
in their stylesheet. This has been disabled forever for HTML pages, but with this patch it is also disabled for XUL pages.
You can however still style scrollbars when creating a theme just as before. You could even create a theme with rules like
xul|*[scollbar-style="small"] > scrollbar { ... }
to allow different scrollbars on different elements.
So the difference with this patch is simply that the above rule only works in the theme css, not in page css.
Comment 11•19 years ago
|
||
> It prevents document authors from styling any scrollbars
Not ones that are an actual <scrollbar> tag in the document, though. You can still style those. I think that was enn's worry.
| Assignee | ||
Comment 12•19 years ago
|
||
What's the point of doing that?
Comment 13•19 years ago
|
||
So you can build widgets with a scrollbar in them? We have some code in the tree that does this; see http://lxr.mozilla.org/seamonkey/search?string=%253Cscrollbar
| Assignee | ||
Comment 14•19 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 15•17 years ago
|
||
Why was this changed?
This breaks some extensions (including mine) which relied on applying bindings to scrollbars in order to access them. See Bug 377292 for a bug report.
Can extensions add UA stylesheets?
Comment 16•17 years ago
|
||
Hi John, I put a script here:
http://martijn.martijn.googlepages.com/scrpttest.htm
that perhaps can serve as an example for what you want.
Comment 17•17 years ago
|
||
Thanks Martijn, by using that code to set my stylesheet as a UA stylesheet I can apply bindings to the scrollbar again. I'm still not certain this is a useful change, but at least extensions can work around it (it still makes unprivileged XUL pages unable to script their overflow:auto scrollbars without wrapping them in a scrollbox though).
Comment 18•17 years ago
|
||
> Why was this changed?
Because it was a rather pointless inconsistency between XUL and non-XUL documents and had security and code complexity implications that were a bit troubling.
You need to log in
before you can comment on or make changes to this bug.
Description
•