Bug 60142 - Exiting full screen causes <video> element inline controls to become visible
Summary: Exiting full screen causes <video> element inline controls to become visible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-05-03 23:47 PDT by Jer Noble
Modified: 2011-06-03 14:07 PDT (History)
4 users (show)

See Also:


Attachments
Patch (7.65 KB, patch)
2011-05-10 15:31 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (7.73 KB, patch)
2011-05-10 16:02 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-03 (1.17 MB, application/zip)
2011-05-10 17:10 PDT, WebKit Review Bot
no flags Details
Patch (7.98 KB, patch)
2011-05-11 01:25 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (8.13 KB, patch)
2011-05-11 13:30 PDT, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2011-05-03 23:47:44 PDT
For elements whose "controls" attribute is not set, entering full screen mode will force the controls to become visible.  The controls (erroneously) remain visible after exiting full screen mode.
Comment 1 Jer Noble 2011-05-03 23:48:13 PDT
<rdar://problem/9380592>
Comment 2 Jer Noble 2011-05-10 08:50:58 PDT
When full screen mode is exited, the current full screen element is set to 0, then the event is dispatched.  The proposed Mozilla API requires: "When a Document enters or leaves the full-screen state, the user agent must queue a task to dispatch this event. When the event is dispatched, if the document's current full-screen element is an element in the document, then the event target is that element, otherwise the event target is the document."  So we dispatch the event at the document element, and not at the previous full screen element.

HTMLMediaElement uses preDispatchMessage() to catch these events and set the control states accordingly.  And since the event after exiting is dispatched at the document element, it never goes through preDispatchMessage().
Comment 3 Jer Noble 2011-05-10 15:31:33 PDT
Created attachment 93029 [details]
Patch
Comment 4 Darin Adler 2011-05-10 15:37:13 PDT
Comment on attachment 93029 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=93029&action=review

It seems like if you quickly enter and then exit fullscreen you might get two fullscreenchange events, both after you are out of fullscreen. A little strange.

Also, it seems this patch doesn’t apply, so you are not getting any EWS testing.

> Source/WebCore/dom/Document.cpp:4921
> +    m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement);
>      m_fullScreenElement = 0;

It should be more efficient to call m_fullScreenElement.release() here and then you don’t need to set m_fullScreenElement to 0 on the next line.

> Source/WebCore/dom/Document.cpp:4992
> +    m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement);

It should be more efficient to call m_fullScreenElement.release() here.
Comment 5 Jer Noble 2011-05-10 15:51:28 PDT
(In reply to comment #4)
> (From update of attachment 93029 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93029&action=review
> 
> It seems like if you quickly enter and then exit fullscreen you might get two fullscreenchange events, both after you are out of fullscreen. A little strange.

It is a little strange.  But I thought it was better to send one too many events than one too few.  These events don't carry any state, so they're essentially telling their handlers to clear their cached values and query for new data, so the danger of too many events should be minimal.

> Also, it seems this patch doesn’t apply, so you are not getting any EWS testing.

Okay, I'll rebase and re-upload.

> > Source/WebCore/dom/Document.cpp:4921
> > +    m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement);
> >      m_fullScreenElement = 0;
> 
> It should be more efficient to call m_fullScreenElement.release() here and then you don’t need to set m_fullScreenElement to 0 on the next line.

Will do.

> > Source/WebCore/dom/Document.cpp:4992
> > +    m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement);
> 
> It should be more efficient to call m_fullScreenElement.release() here.

Here too.
Comment 6 Jer Noble 2011-05-10 16:02:14 PDT
Created attachment 93032 [details]
Patch

Uploading updated and rebased patch so that ews bots can chew on it.
Comment 7 WebKit Review Bot 2011-05-10 17:10:04 PDT
Comment on attachment 93032 [details]
Patch

Attachment 93032 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/8685160

New failing tests:
fullscreen/full-screen-remove.html
fullscreen/full-screen-remove-children.html
fullscreen/full-screen-remove-ancestor.html
Comment 8 WebKit Review Bot 2011-05-10 17:10:09 PDT
Created attachment 93052 [details]
Archive of layout-test-results from ec2-cr-linux-03

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-03  Port: Chromium  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 9 Jer Noble 2011-05-11 01:25:00 PDT
Created attachment 93087 [details]
Patch

Addressed the EWS LayoutTest failure.  Upon removal, the old patch attempted to dispatch an event at the removed element.  This failed, because events will not be cascaded to the element's document if the element has been removed from the DOM.  This patch directs an event at the document element in the case of full screen element removal.
Comment 10 Jer Noble 2011-05-11 11:37:16 PDT
(In reply to comment #9)
> Created an attachment (id=93087) [details]
> Patch
> 
> Addressed the EWS LayoutTest failure.  Upon removal, the old patch attempted to dispatch an event at the removed element.  This failed, because events will not be cascaded to the element's document if the element has been removed from the DOM.  This patch directs an event at the document element in the case of full screen element removal.

After sleeping on it, I don't think I like this approach.  Instead, I think we should dispatch the event at the full screen element /before/ it is removed from the dom, so all the cascading happens as expected.
Comment 11 Jer Noble 2011-05-11 13:30:50 PDT
Created attachment 93169 [details]
Patch
Comment 12 WebKit Commit Bot 2011-05-14 10:29:34 PDT
Comment on attachment 93169 [details]
Patch

Clearing flags on attachment: 93169

Committed r86488: <http://trac.webkit.org/changeset/86488>
Comment 13 WebKit Commit Bot 2011-05-14 10:29:41 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Ademar Reis 2011-06-03 14:07:44 PDT
Revision r86488 cherry-picked into qtwebkit-2.2 with commit c02b89c <http://gitorious.org/webkit/qtwebkit/commit/c02b89c>