Bug 132506 - HTMLMediaElement should exitFullscreen when view is removed from the window.
Summary: HTMLMediaElement should exitFullscreen when view is removed from the window.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jeremy Jones
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-05-02 17:52 PDT by Jeremy Jones
Modified: 2014-05-28 10:59 PDT (History)
14 users (show)

See Also:


Attachments
Patch (6.55 KB, patch)
2014-05-02 18:19 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (6.45 KB, patch)
2014-05-02 20:33 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (7.18 KB, patch)
2014-05-05 18:12 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (6.97 KB, patch)
2014-05-05 19:01 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch for landing. (10.19 KB, patch)
2014-05-07 13:42 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Jones 2014-05-02 17:52:48 PDT
HTMLMediaElement should exitFullscreen when view is removed from the window.
Comment 1 Jeremy Jones 2014-05-02 18:19:02 PDT
Created attachment 230728 [details]
Patch
Comment 2 mitz 2014-05-02 18:27:52 PDT
Comment on attachment 230728 [details]
Patch

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

> Source/WebCore/page/Page.cpp:887
> +#if PLATFORM(IOS)
> +    else {
> +        for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
> +            frame->dismissModalFullscreen();
> +    }
> +#endif

There shouldn’t be (and there currently isn’t) any platform-specific code in Page.cpp.
Comment 3 Jeremy Jones 2014-05-02 20:33:09 PDT
Created attachment 230735 [details]
Patch
Comment 4 Jeremy Jones 2014-05-02 22:11:49 PDT
(In reply to comment #2)
> (From update of attachment 230728 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=230728&action=review
> 
> > Source/WebCore/page/Page.cpp:887
> > +#if PLATFORM(IOS)
> > +    else {
> > +        for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
> > +            frame->dismissModalFullscreen();
> > +    }
> > +#endif
> 
> There shouldn’t be (and there currently isn’t) any platform-specific code in Page.cpp.

Removed #if PLATFORM(IOS) where possible.
Comment 5 Simon Fraser (smfr) 2014-05-03 13:43:07 PDT
Comment on attachment 230735 [details]
Patch

Why doesn't this all happen via an exitFullscreen() code path? Bad to pollute Document with yet more fullscreen gunk.
Comment 6 Jeremy Jones 2014-05-05 18:12:27 PDT
Created attachment 230876 [details]
Patch
Comment 7 Jeremy Jones 2014-05-05 18:58:26 PDT
(In reply to comment #5)
> (From update of attachment 230735 [details])
> Why doesn't this all happen via an exitFullscreen() code path? Bad to pollute Document with yet more fullscreen gunk.

Per our conversation. This is now much simpler. WebView and WebPageProxy request exit-fullscreen from  WebVideoFullscreenController and WebVideoFullscreenManagerProxy respectively.
Comment 8 Jeremy Jones 2014-05-05 19:01:34 PDT
Created attachment 230880 [details]
Patch
Comment 9 Eric Carlson 2014-05-06 07:59:05 PDT
Comment on attachment 230880 [details]
Patch

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

This looks good to me but I am not a WK2 reviewer so someone else will need to r+.

> Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:203
>      WebThreadRun(^{
>          if (m_mediaElement->isFullscreen())

Nit: this can be done in a follow-up patch, but you should NULL-check m_mediaElement here as well.
Comment 10 Tim Horton 2014-05-07 12:17:05 PDT
Comment on attachment 230880 [details]
Patch

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

WK2 part is fine with me, the rest has ericc's review.

> Source/WebKit2/UIProcess/WebPageProxy.cpp:1103
>  #endif
>  
> +#if PLATFORM(IOS)
> +    if ((mayHaveChanged & ViewState::IsInWindow) && !(m_viewState & ViewState::IsInWindow)) {
> +        // When leaving the current page, close the video fullscreen.
> +        if (m_videoFullscreenManager)
> +            m_videoFullscreenManager->requestExitFullscreen();
> +    }
> +#endif
> +
>      updateBackingStoreDiscardableState();

Merge these and put the #ifs inside the conditional, maybe?
Comment 11 Eric Carlson 2014-05-07 13:42:48 PDT
Created attachment 231017 [details]
Patch for landing.
Comment 12 WebKit Commit Bot 2014-05-07 14:19:35 PDT
Comment on attachment 231017 [details]
Patch for landing.

Clearing flags on attachment: 231017

Committed r168439: <http://trac.webkit.org/changeset/168439>
Comment 13 Jon Lee 2014-05-08 21:53:02 PDT
<rdar://problem/16777354>