[webkit-changes] [WebKit/WebKit] 9f5688: Videos disappear when switching from landscape to ...
Chris Dumez
noreply at github.com
Wed Aug 2 19:02:25 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9f56887fb2ba27edb898641f5dd1d1c7f8ec2d00
https://github.com/WebKit/WebKit/commit/9f56887fb2ba27edb898641f5dd1d1c7f8ec2d00
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-08-02 (Wed, 02 Aug 2023)
Changed paths:
A LayoutTests/fast/screen-orientation/orientation-in-resize-event-expected.txt
A LayoutTests/fast/screen-orientation/orientation-in-resize-event.html
M LayoutTests/platform/glib/TestExpectations
M LayoutTests/platform/mac/TestExpectations
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/SourcesCocoa.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
R Source/WebCore/platform/ScreenOrientationProvider.cpp
R Source/WebCore/platform/ScreenOrientationProvider.h
R Source/WebCore/platform/ios/ScreenOrientationProviderIOS.mm
M Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceGStreamer.cpp
M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.cpp
M Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.h
M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
M Source/WebKit/UIProcess/ios/WebScreenOrientationManagerProxyIOS.mm
Log Message:
-----------
Videos disappear when switching from landscape to portrait on cnn.com
https://bugs.webkit.org/show_bug.cgi?id=259666
rdar://112416568
Reviewed by Eric Carlson.
On CNN.com, the JS listens for the window `resize` event instead of the orientation change
event and queries `screen.orientation.angle` when this event is fired to determine if we're
in landscape or portrait.
The issue is that Safari has very special handling to deal with rotation (_beginAnimatedResizeWithUpdates
& _endAnimatedResize), where it temporarily overrides the screen orientation. While `window.orientation`
was properly handling this (making sure `window.orientation` stays consistent with the viewport size),
`window.screen.orientation.angle` wasn't. As a result, we'd fire a resize event for the rotation but
the value returned by `window.screen.orientation.angle` would be inconsistent, causing CNN.com to make
the wrong decision and not removing a CSS class when it should have. This was the root cause of the bug.
To address the issue, I am updating `window.screen.orientation` to get its orientation from the same
place as `window.orientation`, instead of the ScreenOrientationProvider, which didn't properly deal
with Safari animated resizing. This actually simplifies the code a lot and gets rid of the bug.
* LayoutTests/fast/screen-orientation/orientation-in-resize-event-expected.txt: Added.
* LayoutTests/fast/screen-orientation/orientation-in-resize-event.html: Added.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/ScreenOrientationProvider.cpp: Removed.
* Source/WebCore/platform/ScreenOrientationProvider.h: Removed.
* Source/WebCore/platform/ios/ScreenOrientationProviderIOS.mm: Removed.
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setCocoaView):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.cpp:
(WebKit::toString):
(WebKit::WebScreenOrientationManagerProxy::WebScreenOrientationManagerProxy):
(WebKit::WebScreenOrientationManagerProxy::~WebScreenOrientationManagerProxy):
(WebKit::WebScreenOrientationManagerProxy::currentOrientation):
(WebKit::WebScreenOrientationManagerProxy::setCurrentOrientation):
(WebKit::WebScreenOrientationManagerProxy::lock):
(WebKit::WebScreenOrientationManagerProxy::setShouldSendChangeNotification):
(WebKit::WebScreenOrientationManagerProxy::screenOrientationDidChange): Deleted.
(WebKit::WebScreenOrientationManagerProxy::platformInitialize): Deleted.
(WebKit::WebScreenOrientationManagerProxy::platformDestroy): Deleted.
* Source/WebKit/UIProcess/WebScreenOrientationManagerProxy.h:
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::toScreenOrientationType):
(WebKit::WebPageProxy::setDeviceOrientation):
* Source/WebKit/UIProcess/ios/WebScreenOrientationManagerProxyIOS.mm:
(WebKit::WebScreenOrientationManagerProxy::platformInitialize): Deleted.
(WebKit::WebScreenOrientationManagerProxy::platformDestroy): Deleted.
(WebKit::WebScreenOrientationManagerProxy::setWindow): Deleted.
(WebKit::WebScreenOrientationManagerProxy::webViewDidMoveToWindow): Deleted.
Canonical link: https://commits.webkit.org/266531@main
More information about the webkit-changes
mailing list