Summary: | [iOS] Animate AVPlayerLayer into and out of full screen | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jer Noble <jer.noble> | ||||||
Component: | New Bugs | Assignee: | Jer Noble <jer.noble> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, eric.carlson, glenn, jeremyj-wk, philipj, sergio, simon.fraser | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Jer Noble
2014-05-06 02:06:21 PDT
Created attachment 230893 [details]
Patch
Comment on attachment 230893 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=230893&action=review > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:354 > +- (id)init instancetype? > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:359 > + self.masksToBounds = YES; > + self.videoLayerGravity = AVVideoLayerGravityResizeAspect; Shouldn't use property syntax in the init method. > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:380 > +static FloatRect largestRectWithAspectRatioInsideRect(float aspectRatio, FloatRect rect) > +{ > + if (aspectRatio > rect.size().aspectRatio()) { > + float dy = rect.width() / aspectRatio - rect.height(); > + rect.inflateY(dy / 2); > + } else { > + float dx = rect.height() * aspectRatio - rect.width(); > + rect.inflateX(dx / 2); > + } > + return rect; > +} Pretty sure we have code elsewhere that does aspect-ratio sizing. > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:392 > + FloatRect rootBounds; > + CALayer *parent = self; > + while ((parent = [parent superlayer])) > + rootBounds = [parent bounds]; This is weird. How do you know how far up you're walking? Which rect do you actually want? (In reply to comment #3) > (From update of attachment 230893 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=230893&action=review > > > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:354 > > +- (id)init > > instancetype? Changed. > > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:359 > > + self.masksToBounds = YES; > > + self.videoLayerGravity = AVVideoLayerGravityResizeAspect; > > Shouldn't use property syntax in the init method. Changed. > > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:380 > > +static FloatRect largestRectWithAspectRatioInsideRect(float aspectRatio, FloatRect rect) > > +{ > > + if (aspectRatio > rect.size().aspectRatio()) { > > + float dy = rect.width() / aspectRatio - rect.height(); > > + rect.inflateY(dy / 2); > > + } else { > > + float dx = rect.height() * aspectRatio - rect.width(); > > + rect.inflateX(dx / 2); > > + } > > + return rect; > > +} > > Pretty sure we have code elsewhere that does aspect-ratio sizing. We do (in RenderReplaced), but it's not generic. I'll add this to GeometryUtils.h. > > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:392 > > + FloatRect rootBounds; > > + CALayer *parent = self; > > + while ((parent = [parent superlayer])) > > + rootBounds = [parent bounds]; > > This is weird. How do you know how far up you're walking? Which rect do you actually want? We're looking for our window's root UIViewController's view's bounds. I'll change this to pass in the view controller, and query it directly. Created attachment 230931 [details]
Patch for landing.
Committed r168392: <http://trac.webkit.org/changeset/168392> |