Bug 136870 - Improve fullscreen video rotation animation.
Summary: Improve fullscreen video rotation animation.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Jeremy Jones
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-09-16 14:41 PDT by Jeremy Jones
Modified: 2014-09-19 11:26 PDT (History)
5 users (show)

See Also:


Attachments
Patch (12.72 KB, patch)
2014-09-16 14:55 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (15.58 KB, patch)
2014-09-17 13:55 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (16.23 KB, patch)
2014-09-17 19:57 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (25.01 KB, patch)
2014-09-17 20:24 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (16.93 KB, patch)
2014-09-17 21:17 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (16.86 KB, patch)
2014-09-18 12:14 PDT, Jeremy Jones
simon.fraser: review+
Details | Formatted Diff | Diff
Patch for landing. (16.85 KB, patch)
2014-09-18 15:58 PDT, 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 2014-09-16 14:41:22 PDT
Improve fullscreen video rotation animation.
Comment 1 Jeremy Jones 2014-09-16 14:55:40 PDT
Created attachment 238213 [details]
Patch
Comment 2 Jeremy Jones 2014-09-16 14:58:15 PDT
rdar://problem/17950149
Comment 3 Simon Fraser (smfr) 2014-09-16 15:42:16 PDT
Comment on attachment 238213 [details]
Patch

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

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:486
> +    RetainPtr<CALayer> _videoSublayer;

WebAVVideoLayer has a videoSublayer? Needs some comments so we know which layers are which.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:538
> +    [CATransaction setAnimationDuration:[self animationForKey:@"bounds"].duration ?:0.0001];

?:0.0001 is weird, both the magic number and the ?: This needs an explanatory comment.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:539
> +    [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

Do you want to explicitly end the transaction after setting the properties?

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:116
> +    WKCAContextSetFencePort(m_context.get(), fencePort);

I don't see WKCAContextSetFencePort anywhere. I assume this depends on other changes?

> Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm:43
> +SOFT_LINK_FRAMEWORK(UIKit)
> +SOFT_LINK_CLASS(UIKit, UIWindow)

WebKit2 doesn't need to soft link with UIKit.
Comment 4 Jeremy Jones 2014-09-17 13:55:14 PDT
Created attachment 238263 [details]
Patch
Comment 5 Jeremy Jones 2014-09-17 13:58:01 PDT
(In reply to comment #3)
> (From update of attachment 238213 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=238213&action=review
> 
> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:486
> > +    RetainPtr<CALayer> _videoSublayer;
> 
> WebAVVideoLayer has a videoSublayer? Needs some comments so we know which layers are which.

Not sure what to say here. This just formalized the relationship that already existed. See the change from addSublayer: to setVideoSublayer:

> 
> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:538
> > +    [CATransaction setAnimationDuration:[self animationForKey:@"bounds"].duration ?:0.0001];
> 
> ?:0.0001 is weird, both the magic number and the ?: This needs an explanatory comment.
> 

Comment added.

> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:539
> > +    [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
> 
> Do you want to explicitly end the transaction after setting the properties?

Added transaction begin/commit.

> 
> > Source/WebKit2/Platform/mac/LayerHostingContext.mm:116
> > +    WKCAContextSetFencePort(m_context.get(), fencePort);
> 
> I don't see WKCAContextSetFencePort anywhere. I assume this depends on other changes?

I removed this and moved LayerHostingContext off of WKCAContext per AVSystemInterface guidelines.

> 
> > Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm:43
> > +SOFT_LINK_FRAMEWORK(UIKit)
> > +SOFT_LINK_CLASS(UIKit, UIWindow)
> 
> WebKit2 doesn't need to soft link with UIKit.

Removed.
Comment 6 Simon Fraser (smfr) 2014-09-17 14:05:58 PDT
Comment on attachment 238263 [details]
Patch

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

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:51
> +    layerHostingContext->m_context = (CAContext*)WKCAContextMakeRemoteWithServerPort(serverPort);

CAContext *

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:86
> +    return [m_context setLayer:rootLayer];

no return.

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:102
> +    return [m_context invalidate];

no return

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:107
> +    return [m_context setColorSpace:colorSpace];

no return

> Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm:37
> +#include <UIKit/UIWindow_Private.h>

This will annoy dbates who is trying to make us build with the public SDK. You should do the platform/spi thing.
Comment 7 Jeremy Jones 2014-09-17 19:57:47 PDT
Created attachment 238283 [details]
Patch
Comment 8 Simon Fraser (smfr) 2014-09-17 20:07:57 PDT
Comment on attachment 238283 [details]
Patch

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

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:41
> +@interface CAContext : NSObject (Details)
> +- (void)invalidate;
> +@property (readonly) uint32_t contextId;
> +@property (strong) CALayer *layer;
> +@property CGColorSpaceRef colorSpace;
> +- (void)setFencePort:(mach_port_t)port;
>  + (CAContext *)remoteContextWithOptions:(NSDictionary *)dict;
>  @end

This should really go into its own spi header, but that can happen in a later commit.

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:88
> +    return [m_context setLayer:rootLayer];

No return.

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:104
> +    return [m_context invalidate];

No return.

> Source/WebKit2/Platform/mac/LayerHostingContext.mm:109
> +    return [m_context setColorSpace:colorSpace];

No return.
Comment 9 Jeremy Jones 2014-09-17 20:24:27 PDT
Created attachment 238284 [details]
Patch
Comment 10 Simon Fraser (smfr) 2014-09-17 20:31:21 PDT
Comment on attachment 238284 [details]
Patch

Patch doesn't apply to TOT!
Comment 11 Jeremy Jones 2014-09-17 21:05:46 PDT
(In reply to comment #10)
> (From update of attachment 238284 [details])
> Patch doesn't apply to TOT!

dbates backed out his changes for platform/spi. So I'm removing mine also.
Comment 12 Jeremy Jones 2014-09-17 21:17:18 PDT
Created attachment 238285 [details]
Patch
Comment 13 Jeremy Jones 2014-09-18 12:14:25 PDT
Created attachment 238318 [details]
Patch
Comment 14 Simon Fraser (smfr) 2014-09-18 13:17:23 PDT
Comment on attachment 238318 [details]
Patch

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

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:540
> +    if (animationDuration == 0.0) // a duration of 0 for CA means 0.25. This is a way to approximate 0.

We normally write this as if (!animationDuration)
Comment 15 Jeremy Jones 2014-09-18 15:58:05 PDT
Created attachment 238330 [details]
Patch for landing.
Comment 16 Jeremy Jones 2014-09-18 16:09:13 PDT
(In reply to comment #14)
> (From update of attachment 238318 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=238318&action=review
> 
> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:540
> > +    if (animationDuration == 0.0) // a duration of 0 for CA means 0.25. This is a way to approximate 0.
> 
> We normally write this as if (!animationDuration)

Fixed.
Comment 17 WebKit Commit Bot 2014-09-18 16:40:55 PDT
Comment on attachment 238330 [details]
Patch for landing.

Clearing flags on attachment: 238330

Committed r173741: <http://trac.webkit.org/changeset/173741>
Comment 18 Chris Dumez 2014-09-19 09:44:12 PDT
I get the following build error after this change (but the bots seem fine):
Source/WebKit2/Platform/mac/LayerHostingContext.mm:121:16: error: instance method '-setFencePort:' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access]
    [m_context setFencePort:fencePort];
               ^~~~~~~~~~~~

Anyone knows what I am missing?
Comment 19 Simon Fraser (smfr) 2014-09-19 11:05:40 PDT
Mac build fixed in https://trac.webkit.org/r173762.
Comment 20 Chris Dumez 2014-09-19 11:26:44 PDT
(In reply to comment #19)
> Mac build fixed in https://trac.webkit.org/r173762.

You rock Simon :) Thanks.