REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 16:51:06 +0000 (16:51 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 16:51:06 +0000 (16:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187814
<rdar://problem/42391869>

Reviewed by Eric Carlson.

After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
assertion no longer holds true.

* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerLayer layoutSublayers]):
(-[WebAVPlayerLayer resolveBounds]):
(-[WebAVPlayerLayer setVideoGravity:]):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

index 88de84d..abe6c00 100644 (file)
@@ -1,3 +1,20 @@
+2018-07-20  Jer Noble  <jer.noble@apple.com>
+
+        REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
+        https://bugs.webkit.org/show_bug.cgi?id=187814
+        <rdar://problem/42391869>
+
+        Reviewed by Eric Carlson.
+
+        After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
+        VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
+        assertion no longer holds true.
+
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (-[WebAVPlayerLayer layoutSublayers]):
+        (-[WebAVPlayerLayer resolveBounds]):
+        (-[WebAVPlayerLayer setVideoGravity:]):
+
 2018-07-19  Antoine Quint  <graouts@apple.com>
 
         Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
index 065cd62..7db7cb0 100644 (file)
@@ -289,8 +289,8 @@ static VideoFullscreenInterfaceAVKit::ExitFullScreenReason convertToExitFullScre
     } else if ([getAVLayerVideoGravityResizeAspectFill() isEqualToString:self.videoGravity]) {
         sourceVideoFrame = smallestRectWithAspectRatioAroundRect(videoAspectRatio, self.modelVideoLayerFrame);
         self.modelVideoLayerFrame = CGRectMake(0, 0, sourceVideoFrame.width(), sourceVideoFrame.height());
-        ASSERT(_fullscreenInterface->videoFullscreenModel());
-        _fullscreenInterface->videoFullscreenModel()->setVideoLayerFrame(self.modelVideoLayerFrame);
+        if (auto* model = _fullscreenInterface->videoFullscreenModel())
+            model->setVideoLayerFrame(self.modelVideoLayerFrame);
         targetVideoFrame = smallestRectWithAspectRatioAroundRect(videoAspectRatio, self.bounds);
     } else
         ASSERT_NOT_REACHED();
@@ -325,8 +325,8 @@ static VideoFullscreenInterfaceAVKit::ExitFullScreenReason convertToExitFullScre
     
     if (!CGRectEqualToRect(self.modelVideoLayerFrame, [self bounds])) {
         self.modelVideoLayerFrame = [self bounds];
-        ASSERT(_fullscreenInterface->videoFullscreenModel());
-        _fullscreenInterface->videoFullscreenModel()->setVideoLayerFrame(self.modelVideoLayerFrame);
+        if (auto* model = _fullscreenInterface->videoFullscreenModel())
+            model->setVideoLayerFrame(self.modelVideoLayerFrame);
     }
     [(UIView *)[_videoSublayer delegate] setTransform:CGAffineTransformIdentity];
     
@@ -350,8 +350,8 @@ static VideoFullscreenInterfaceAVKit::ExitFullScreenReason convertToExitFullScre
     else
         ASSERT_NOT_REACHED();
     
-    ASSERT(_fullscreenInterface->videoFullscreenModel());
-    _fullscreenInterface->videoFullscreenModel()->setVideoLayerGravity(gravity);
+    if (auto* model = _fullscreenInterface->videoFullscreenModel())
+        model->setVideoLayerGravity(gravity);
 }
 
 - (NSString *)videoGravity