Bug 58070

Summary: HTMLVideoElement::webkitEnterFullscreen does not use new Full Screen API when available.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: MediaAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dglazkov, eric, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch
none
Patch eric.carlson: review+

Description Jer Noble 2011-04-07 12:40:26 PDT
HTMLVideoElement::webkitEnterFullscreen does not use new Full Screen API when available.
Comment 1 Jer Noble 2011-04-07 12:41:09 PDT
<rdar://problem/9251239>
Comment 2 Jer Noble 2011-04-07 12:45:20 PDT
Created attachment 88674 [details]
Patch
Comment 3 WebKit Review Bot 2011-04-07 12:53:12 PDT
Attachment 88674 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/8346689
Comment 4 Jer Noble 2011-04-07 13:01:17 PDT
Comment on attachment 88674 [details]
Patch

Patch seems to be missing bits and pieces.  Will re-upload.
Comment 5 Jer Noble 2011-04-07 13:12:26 PDT
Created attachment 88676 [details]
Patch
Comment 6 Dimitri Glazkov (Google) 2011-04-07 13:14:14 PDT
Comment on attachment 88676 [details]
Patch

Why are these wired differently from the MediaControlFullscreenButton? Shouldn't we use the same codepaths?
Comment 7 Jer Noble 2011-04-07 13:18:28 PDT
(In reply to comment #6)
> (From update of attachment 88676 [details])
> Why are these wired differently from the MediaControlFullscreenButton? Shouldn't we use the same code paths?

Good point.  I should check to make sure the settings are enabled first.  Thanks!
Comment 8 Dimitri Glazkov (Google) 2011-04-07 13:26:07 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > (From update of attachment 88676 [details] [details])
> > Why are these wired differently from the MediaControlFullscreenButton? Shouldn't we use the same code paths?
> 
> Good point.  I should check to make sure the settings are enabled first.  Thanks!

No worries -- I was just looking at this code :). Sounds like ideally, the code from here: http://codesearch.google.com/codesearch/p#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/rendering/MediaControlElements.cpp&l=950&exact_package=chromium

should just migrate to enterFullScreen.
Comment 9 Jer Noble 2011-04-07 13:26:30 PDT
Created attachment 88681 [details]
Patch
Comment 11 Jer Noble 2011-04-07 13:35:42 PDT
Indeed, that would be ideal.
Comment 12 Eric Carlson 2011-04-07 14:04:36 PDT
Comment on attachment 88681 [details]
Patch

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

> Source/WebCore/html/HTMLMediaElement.cpp:2464
> +#if ENABLE(FULLSCREEN_API)
> +    if (document()->settings() && document()->settings()->fullScreenEnabled()) {
> +        webkitRequestFullScreen(0);
> +        return;
> +    }
> +#else
>      ASSERT(!m_isFullscreen);
>      m_isFullscreen = true;
>      if (document() && document()->page()) {
> +
>          document()->page()->chrome()->client()->enterFullscreenForNode(this);
>          scheduleEvent(eventNames().webkitbeginfullscreenEvent);
>      }
> +#endif

There isn't any need for the #else ... #endif, we want to continue to support the old API even when ENABLE_FULLSCREEN_API is defined.

> Source/WebCore/html/HTMLMediaElement.cpp:2475
> +#if ENABLE(FULLSCREEN_API)
> +    if (document()->settings() && document()->settings()->fullScreenEnabled()) {
> +        document()->webkitCancelFullScreen();
> +        return;
> +    }
> +#else

Same here.
Comment 13 Jer Noble 2011-04-07 14:12:26 PDT
Committed r83208: <http://trac.webkit.org/changeset/83208>
Comment 14 Dimitri Glazkov (Google) 2011-04-07 14:44:43 PDT
(In reply to comment #13)
> Committed r83208: <http://trac.webkit.org/changeset/83208>

Whoops. Don't you do this twice now, since MediaControlFullscreenButtonElement::defaultEventHandler calls enterFullScreen?
Comment 15 Jer Noble 2011-04-07 15:01:06 PDT
(In reply to comment #14)
> (In reply to comment #13)
> > Committed r83208: <http://trac.webkit.org/changeset/83208>
> 
> Whoops. Don't you do this twice now, since MediaControlFullscreenButtonElement::defaultEventHandler calls enterFullScreen?

I filed bug #58087 to get rid of the duplicated code.
Comment 16 WebKit Review Bot 2011-04-07 15:38:51 PDT
http://trac.webkit.org/changeset/83208 might have broken SnowLeopard Intel Release (Tests), GTK Linux 32-bit Release, and GTK Linux 64-bit Debug
The following tests are not passing:
media/context-menu-actions.html
media/media-fullscreen-inline.html
media/media-fullscreen-not-in-document.html