[MediaStream] Sync video preview layer and parent layer sizes
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 19:20:32 +0000 (19:20 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 19:20:32 +0000 (19:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165139

Reviewed by Jer Noble.

CALayer auto-resizing doesn't work on iOS, so manually reize the video capture preview layer
whenever the background layer's bounds change.

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Create layer observer.
(WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Sync preview layer and background
  layer sizes.
(WebCore::AVVideoSourcePreview::invalidate): Invalidate and clear observer.
(-[WebCoreAVVideoCaptureSourceObserver initWithParent:]):
(-[WebCoreAVVideoCaptureSourceObserver setParent:]): Add KVO bounds observer.
(-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Call
parent when "bounds" changes.
(-[WebCoreAVVideoCaptureSourceObserver actionForKey:]): Return nil to disable all animations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209141 268f45cc-cd09-0410-ab3c-d52691b4dbfc


No differences found