Bug 141439 - Scroll to make the video element visible when exiting fullscreen.
Summary: Scroll to make the video element visible when exiting fullscreen.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Jeremy Jones
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-10 11:27 PST by Jeremy Jones
Modified: 2015-05-04 11:14 PDT (History)
4 users (show)

See Also:


Attachments
Patch (23.00 KB, patch)
2015-02-10 11:50 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (23.55 KB, patch)
2015-02-10 12:26 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (22.17 KB, patch)
2015-02-27 15:02 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (22.22 KB, patch)
2015-03-02 16:09 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (20.22 KB, patch)
2015-03-05 10:20 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (15.84 KB, patch)
2015-03-05 14:58 PST, Jeremy Jones
simon.fraser: review+
Details | Formatted Diff | Diff
Patch for landing. (20.68 KB, patch)
2015-03-05 16:54 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch for landing. (20.66 KB, patch)
2015-03-05 18:17 PST, Jeremy Jones
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 2015-02-10 11:27:48 PST
Scroll element visible when exiting fullscreen.
Comment 1 Jeremy Jones 2015-02-10 11:50:19 PST
Created attachment 246333 [details]
Patch
Comment 2 WebKit Commit Bot 2015-02-10 11:52:25 PST
Attachment 246333 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/Cocoa/UIDelegate.h:94:  Please declare enum bitfields as unsigned integral types.  [runtime/enum_bitfields] [5]
Total errors found: 1 in 22 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jeremy Jones 2015-02-10 12:26:31 PST
Created attachment 246335 [details]
Patch
Comment 4 WebKit Commit Bot 2015-02-10 12:28:44 PST
Attachment 246335 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/Cocoa/UIDelegate.h:94:  Please declare enum bitfields as unsigned integral types.  [runtime/enum_bitfields] [5]
Total errors found: 1 in 22 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Simon Fraser (smfr) 2015-02-11 11:56:05 PST
"Scroll element visible when exiting fullscreen." is so hard to parse.

Do you mean "the scroll element is visible" or "scroll the element to be visible"?
Comment 6 Jeremy Jones 2015-02-16 12:47:02 PST
(In reply to comment #5)
> "Scroll element visible when exiting fullscreen." is so hard to parse.
> 
> Do you mean "the scroll element is visible" or "scroll the element to be
> visible"?

Second one. Scroll is a verb. I'll make that less ambiguous.
Comment 7 Jeremy Jones 2015-02-27 15:02:34 PST
Created attachment 247560 [details]
Patch
Comment 8 WebKit Commit Bot 2015-02-27 15:04:43 PST
Attachment 247560 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/Cocoa/UIDelegate.h:94:  Please declare enum bitfields as unsigned integral types.  [runtime/enum_bitfields] [5]
Total errors found: 1 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Jeremy Jones 2015-03-02 16:09:44 PST
Created attachment 247712 [details]
Patch
Comment 10 WebKit Commit Bot 2015-03-02 16:11:56 PST
Attachment 247712 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/Cocoa/UIDelegate.h:94:  Please declare enum bitfields as unsigned integral types.  [runtime/enum_bitfields] [5]
Total errors found: 1 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Jeremy Jones 2015-03-05 10:20:07 PST
Created attachment 247964 [details]
Patch
Comment 12 Jeremy Jones 2015-03-05 10:37:08 PST
UIDelegate::UIClient::isPageVisible no longer delegates to WKUIDelegatePrivate and instead implements it based on if the WKView is hidden and is in a window.
Comment 13 Simon Fraser (smfr) 2015-03-05 10:49:55 PST
Comment on attachment 247964 [details]
Patch

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

> Source/WebCore/dom/Element.h:194
>      void scrollIntoView(bool alignToTop = true);
>      void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
> +    WEBCORE_EXPORT void scrollIntoViewIfNotVisible(bool centerIfNotVisible = true);

Shame we have all these variants. Maybe one with some bit flags would be better long-term.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:1156
> +void WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline(bool visible, IntRect inlineRect)

const IntRect&

> Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm:260
> +bool UIDelegate::UIClient::isPageVisible(WebKit::WebPageProxy*)
> +{
> +    return ![m_uiDelegate.m_webView isHidden] && [m_uiDelegate.m_webView window] != nil;
> +}

We already have PageClient which has isViewVisible() and isViewInWindow(). Not sure why we need new code here.
Comment 14 Jeremy Jones 2015-03-05 14:58:07 PST
Created attachment 248004 [details]
Patch
Comment 15 Jeremy Jones 2015-03-05 14:59:08 PST
(In reply to comment #13)
> Comment on attachment 247964 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=247964&action=review
> 
> > Source/WebCore/dom/Element.h:194
> >      void scrollIntoView(bool alignToTop = true);
> >      void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
> > +    WEBCORE_EXPORT void scrollIntoViewIfNotVisible(bool centerIfNotVisible = true);
> 
> Shame we have all these variants. Maybe one with some bit flags would be
> better long-term.

I'll file a bug for this.

> 
> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:1156
> > +void WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline(bool visible, IntRect inlineRect)
> 
> const IntRect&

Still need to fix this one....

> 
> > Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm:260
> > +bool UIDelegate::UIClient::isPageVisible(WebKit::WebPageProxy*)
> > +{
> > +    return ![m_uiDelegate.m_webView isHidden] && [m_uiDelegate.m_webView window] != nil;
> > +}
> 
> We already have PageClient which has isViewVisible() and isViewInWindow().
> Not sure why we need new code here.

Removed.
Comment 16 Simon Fraser (smfr) 2015-03-05 15:02:56 PST
Comment on attachment 248004 [details]
Patch

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

> Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h:62
> +    void preparedToReturnToInline(bool visible, WebCore::IntRect inlineRect) override;

const IntRect&

> Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm:126
> +void WebVideoFullscreenManagerProxy::preparedToReturnToInline(bool visible, WebCore::IntRect inlineRect)

const IntRect&

> Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm:265
> +    m_page->send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(true, clientRectForElement(m_videoElement.get())), m_page->pageID());

Not clear what 'true' means here.
Comment 17 Jeremy Jones 2015-03-05 16:53:25 PST
(In reply to comment #16)
> Comment on attachment 248004 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=248004&action=review
> 
> > Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h:62
> > +    void preparedToReturnToInline(bool visible, WebCore::IntRect inlineRect) override;
> 
> const IntRect&

Fixed.

> 
> > Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm:126
> > +void WebVideoFullscreenManagerProxy::preparedToReturnToInline(bool visible, WebCore::IntRect inlineRect)
> 
> const IntRect&

Fixed. And several locations.

> 
> > Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm:265
> > +    m_page->send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(true, clientRectForElement(m_videoElement.get())), m_page->pageID());
> 
> Not clear what 'true' means here.

'true' will be replaced by something more meaningful in a later bug fix.
Comment 18 Jeremy Jones 2015-03-05 16:54:13 PST
Created attachment 248020 [details]
Patch for landing.
Comment 19 Brent Fulgham 2015-03-05 17:41:51 PST
Still breaking Windows:

ScrollBehavior.cpp(50): error C2370: 'alignToEdgeIfNotVisible' : redefinition; different storage class (..\rendering\RenderingAllInOne.cpp)
Comment 20 Brent Fulgham 2015-03-05 17:44:09 PST
(In reply to comment #19)
> Still breaking Windows:
> 
> ScrollBehavior.cpp(50): error C2370: 'alignToEdgeIfNotVisible' :
> redefinition; different storage class (..\rendering\RenderingAllInOne.cpp)

If you declare it as WEBCORE_EXPORT in the implementation file, it needs to have the same declaration in the header file (or else Windows gets mad). I think it's usually sufficient to just add it in the header file and not do so in the implementation file.
Comment 21 Jeremy Jones 2015-03-05 18:17:27 PST
Created attachment 248027 [details]
Patch for landing.
Comment 22 Jeremy Jones 2015-03-06 10:09:06 PST
(In reply to comment #20)
> (In reply to comment #19)
> > Still breaking Windows:
> > 
> > ScrollBehavior.cpp(50): error C2370: 'alignToEdgeIfNotVisible' :
> > redefinition; different storage class (..\rendering\RenderingAllInOne.cpp)
> 
> If you declare it as WEBCORE_EXPORT in the implementation file, it needs to
> have the same declaration in the header file (or else Windows gets mad). I
> think it's usually sufficient to just add it in the header file and not do
> so in the implementation file.

I removed that WEBCORE_EXPORT as it was unnecessary.
Comment 23 WebKit Commit Bot 2015-03-06 11:28:52 PST
Comment on attachment 248027 [details]
Patch for landing.

Clearing flags on attachment: 248027

Committed r181173: <http://trac.webkit.org/changeset/181173>