Closed Bug 626776 Opened 14 years ago Closed 6 years ago

slap an id on standalone video so third parties can have fun

Categories

(Core :: Audio/Video: Playback, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: asa, Unassigned)

References

(Blocks 1 open bug)

Details

I believe we create a synthetic document to hold videos when they're opened "stand alone". It would be really awesome if there was a way for third parties (user styles, scripts, extensions, etc) to modify the "standalone" video. I think adding an ID to the video when we create that synthetic document would probably be sufficient. 

(it would also let us do things in the future like center the video just by tweaking Firefox's default style sheet.)
Same id for all media documents?
Yes, I think maybe even just on the media document body would be sufficient. Would need something that's not likely to collide with real-world ids.
Well, that's the problem...  Colliding.

As I see it, there are a few things extensions would want to do:

1)  Style media documents.  I'd rather support this with a new function for
    @-moz-document.
2)  Be able to tell from looking at a document object that it's a media
    document.  We should be able to expose this via windowutils or some such, I
    think.  Less annoying ways to expose it run the risk of polluting the web
    namespace, sadly.

Are there other use cases?
Blocks: 626778
For video, I'd like for an extension to be able to restyle or even replace the default player if that's possible. I could also imagine resizers for standalone images.
That's just a combination of #1 and #2 above, right?
(In reply to comment #5)
> That's just a combination of #1 and #2 above, right?

I think so, but I don't really know how the built-in video controls work.
This is partially my fault for trolling Asa into reporting this enhancement request :)

Use cases are being able to style / (do something interesting with) the synthetic views of standalone images, video, audio, .swf etc.

E.g. centering standalone images instead of pinning them to the top left.


With a bit of reflection, I think we should do this via a class (more extensible) on the body element.

Collision problem is easy enough to sufficiently probabilistically solve (you might say I've thought about / have some experience with the global class names collisions problem ;)

Implied convention through example:

com-firefox-synthetic

so change the synthetic/media document create code to create:

<body class="com-firefox-synthetic">

instead of the current

<body>



For now a single new class name should be sufficient (handles above use cases), since you can write different style rules for the specific elements.


body.com-firefox-synthetic audio { /* handle audio views here */ }

body.com-firefox-synthetic embed { /* handle plugin views here */ }

body.com-firefox-synthetic img { /* handle image views here */ }

body.com-firefox-synthetic video { /* handle video views here */ }


That should be enough rope for now. We can do more later if more needs are demonstrated.
I'm really not happy with doing that.  In particular, you're assuming only accidental collisions.  I'm worried about malicious collisions: web pages explicitly adding that class so as to trick either extension script or the user/ua stylesheet into something to that page.  Depending on what the scripts or stylesheets do, this could be more or less of a problem.  But I'd rather not create the rope in the first place, if it's easy enough to avoid.

Note that the CSS rules proposed in comment 7 would be a performance hit on all web pages, by the way; something that using @-moz-document avoids.
All good points Boris. Your suggestion of an @-rule instead (e.g. @-moz-document) makes more sense and satisfies the use cases.

Perhaps consider conveying the "synthetic" document aspect? e.g. 

@-moz-synthetic-document (naming bikeshed delegated to implementer).
I was thinking |@-moz-document synthetic("image")| and |@-moz-document synthetic("video")| and the like.
Blocks: 369301
This would also be a possible fix for bug 247848.

Making standalone image documents easily CSS stylable (e.g. via userContent.css)  could also end the discussion in bug 713230.
At the moment it is only possible to style the image inside the document and even that only with the risk of false positives, see bug 713230 comment 67.
Component: Audio/Video → Audio/Video: Playback
Mass closing do to inactivity.
Feel free to re-open if still needed.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
(In reply to Nils Ohlmeier [:drno] from comment #12)
> Mass closing do to inactivity.
> Feel free to re-open if still needed.

Then bug 626778 should be closed as well.

(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #3)
> I'd rather support this with a new function for @-moz-document.

Filed bug 1475511.
You need to log in before you can comment on or make changes to this bug.