Bug 35374 - MediaPlayer has no reliable method of accessing it's owning document
Summary: MediaPlayer has no reliable method of accessing it's owning document
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Blocks: 35328
  Show dependency treegraph
Reported: 2010-02-24 18:13 PST by Nick Young
Modified: 2010-02-25 07:44 PST (History)
2 users (show)

See Also:

Initial Patch (2.54 KB, patch)
2010-02-24 18:19 PST, Nick Young
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Young 2010-02-24 18:13:47 PST
It is sometimes desirable for the MediaPlayer to access information about its owning document.

Currently there is a method MediaPlayer::frameView(), which returns the FrameView which renders the MediaPlayer.
However, there are some situations where a renderer is not created for a Media element, and as such there is no way for the MediaPlayer to access its owning document.

An example of one of these situations can be seen here: http://people.freedesktop.org/~company/stuff/video-demo.html
(Credit goes to Bug 30679 for this link)

In this demonstration, the video elements are never added to the DOM, so a renderer is never created.

As discussed in Bug 35328, the proposed solution is to add a MediaPlayerClient::mediaPlayerOwningDocument().

A patch is coming.
Comment 1 Nick Young 2010-02-24 18:19:02 PST
Created attachment 49458 [details]
Initial Patch
Comment 2 WebKit Commit Bot 2010-02-24 23:14:14 PST
Comment on attachment 49458 [details]
Initial Patch

Clearing flags on attachment: 49458

Committed r55225: <http://trac.webkit.org/changeset/55225>
Comment 3 WebKit Commit Bot 2010-02-24 23:14:18 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2010-02-25 07:44:31 PST
Comment on attachment 49458 [details]
Initial Patch

> +Document* HTMLMediaElement::mediaPlayerOwningDocument()
> +{
> +    Document* d = document();
> +    
> +    if (!d)
> +        d = ownerDocument();
> +    
> +    return d;
> +}

The implementation of this function is needlessly complex. The Node::document() function never returns 0 for an element, and ownerDocument() always returns the same thing as document() except when ownerDocument() returns 0.