Title: [266218] trunk/Source/WebCore
Revision
266218
Author
[email protected]
Date
2020-08-26 20:35:18 -0700 (Wed, 26 Aug 2020)

Log Message

REGRESSION: touchbar controls don't reflect video state in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=215873
<rdar://problem/66723354>

Reviewed by Eric Carlson.

* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager setPlaying:]):
(-[WebPlaybackControlsManager isPlaying]):
Create an actual ivar `_playing` for holding the play/pause state. This is needed because
`AVTouchBarScrubber` uses KVO to update the state of the play/pause button whenever the
related video controller (in this case `AVTouchBarPlaybackControlsControlling`) changes
using an `NSValueBinding`. KVO needs an actual ivar in order to function properly.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266217 => 266218)


--- trunk/Source/WebCore/ChangeLog	2020-08-27 03:21:56 UTC (rev 266217)
+++ trunk/Source/WebCore/ChangeLog	2020-08-27 03:35:18 UTC (rev 266218)
@@ -1,3 +1,20 @@
+2020-08-26  Devin Rousso  <[email protected]>
+
+        REGRESSION: touchbar controls don't reflect video state in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=215873
+        <rdar://problem/66723354>
+
+        Reviewed by Eric Carlson.
+
+        * platform/mac/WebPlaybackControlsManager.h:
+        * platform/mac/WebPlaybackControlsManager.mm:
+        (-[WebPlaybackControlsManager setPlaying:]):
+        (-[WebPlaybackControlsManager isPlaying]):
+        Create an actual ivar `_playing` for holding the play/pause state. This is needed because
+        `AVTouchBarScrubber` uses KVO to update the state of the play/pause button whenever the
+        related video controller (in this case `AVTouchBarPlaybackControlsControlling`) changes
+        using an `NSValueBinding`. KVO needs an actual ivar in order to function properly.
+
 2020-08-26  Kate Cheney  <[email protected]>
 
         Resource Load Statistics data summary does not report data which is held up in the web content process.

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h (266217 => 266218)


--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h	2020-08-27 03:21:56 UTC (rev 266217)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h	2020-08-27 03:35:18 UTC (rev 266218)
@@ -51,6 +51,7 @@
     RetainPtr<AVTouchBarMediaSelectionOption> _currentAudioTouchBarMediaSelectionOption;
     RetainPtr<NSArray<AVTouchBarMediaSelectionOption *>> _legibleTouchBarMediaSelectionOptions;
     RetainPtr<AVTouchBarMediaSelectionOption> _currentLegibleTouchBarMediaSelectionOption;
+    BOOL _playing;
     float _rate;
     BOOL _canTogglePlayback;
 

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm (266217 => 266218)


--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm	2020-08-27 03:21:56 UTC (rev 266217)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm	2020-08-27 03:35:18 UTC (rev 266218)
@@ -288,22 +288,27 @@
 
 - (void)setPlaying:(BOOL)playing
 {
-    if (!_playbackSessionInterfaceMac || !_playbackSessionInterfaceMac->playbackSessionModel())
+    if (playing != _playing) {
+        [self willChangeValueForKey:@"playing"];
+        _playing = playing;
+        [self didChangeValueForKey:@"playing"];
+    }
+
+    if (!_playbackSessionInterfaceMac)
         return;
 
-    BOOL isCurrentlyPlaying = self.playing;
-    if (!isCurrentlyPlaying && playing)
-        _playbackSessionInterfaceMac->playbackSessionModel()->play();
-    else if (isCurrentlyPlaying && !playing)
-        _playbackSessionInterfaceMac->playbackSessionModel()->pause();
+    if (auto* model = _playbackSessionInterfaceMac->playbackSessionModel()) {
+        BOOL isCurrentlyPlaying = model->isPlaying();
+        if (!isCurrentlyPlaying && _playing)
+            model->play();
+        else if (isCurrentlyPlaying && !_playing)
+            model->pause();
+    }
 }
 
 - (BOOL)isPlaying
 {
-    if (_playbackSessionInterfaceMac && _playbackSessionInterfaceMac->playbackSessionModel())
-        return _playbackSessionInterfaceMac->playbackSessionModel()->isPlaying();
-
-    return NO;
+    return _playing;
 }
 
 - (void)togglePictureInPicture
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to