Open Bug 503007 Opened 15 years ago Updated 2 years ago

Provide Javascript Access to User Agent Style Sheets.

Categories

(Core :: CSS Parsing and Computation, defect)

1.9.1 Branch
x86
Windows XP
defect

Tracking

()

Tracking Status
status1.9.1 --- ?

People

(Reporter: johnjbarton, Unassigned)

References

Details

(Keywords: helpwanted, student-project, Whiteboard: [firebug-p2])

Firebug wants to apply the same workaround to User Agent Style sheets as we applied to page sheets in Bug 500365
	
Unfortunately we have no way to access the User Agent Sheets.

CSS editing is one of Firebug's top features and revealing the User Agent Sheets is a great way to help users understand CSS results. Currently editing User Agent sheets breaks Firefox, either making its UI fall apart or crash.

Firebug could try to implement read-only for the User Agent Sheet, but just then we will want the edit capability for Chromebug.
Boris, please set blocking/wanting flags according to your estimate of how hard this would be to implement.
Whiteboard: [firebug-p1]
Probably pretty easy, actually, via nsIDOMWindowUtils.  Could add a method that just returns a non-live array of user or UA sheets.

If someone wants to implement, I'm happy to point you to the relevant pieces.
Flags: wanted1.9.1.x?
Flags: blocking1.9.2?
Hi,
I've noticed this bug on http://blog.getfirebug.com/?p=265 and because I have some free time and I wanted to improve my C++ skills I see this as a great opportunity how to start.
I've currently have the latest trunk and prepared build environment so I'll start with it this night.
I have only question if there is any other what I need to know - but the previous post is pretty clear.
Regards,
Ondrej Donek
You'll need test cases to succeed and test cases will illustrate the proposed API, so I encourage you to start there.
I would rather prefer having this exposed via nsIStyleSheetService - so that user stylesheets are exposed as well.
John wants access to both, I think.

That said, this needs to be done per-document, so I'm not sure hanging it off of nsIStyleSheetService is a good approach; you'd have to have an API on there that takes a document or something.
That's assuming I diagnosed John's problem correctly, of course.  I looked again, and we only clone the quirks sheet; the other user/ua sheets are used as-is (we used to clone them, though).  So I'm not quite sure whether the issue John's seeing would be fixed by touching those sheets....
(In reply to comment #5)
> I would rather prefer having this exposed via nsIStyleSheetService - so that
> user stylesheets are exposed as well.

I can already get these from window.document.styleSheets.
No, you can get the document sheets.  User sheets are not in that collection.
Flags: blocking1.9.2? → wanted1.9.2+
status1.9.1: --- → ?
Flags: wanted1.9.1.x?
In order to make it ok for Firebug to mutate the UA sheets, we need to (1) ensure that the UA sheets get cloned in DocumentViewerImpl::CreateStyleSet or somewhere else and (2) ensure that they get unique inners before they're mutated (which bug 536379 should do for the get-style-rules case, and make it easy to do in other cases)
Whiteboard: [firebug-p1] → [firebug-p2]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.