Changeset 295628 in webkit


Ignore:
Timestamp:
Jun 16, 2022 11:05:39 PM (2 years ago)
Author:
Wenson Hsieh
Message:

[iOS] Callout bar is sometimes obscured when selecting Live Text in a fullscreen video in AVPlayerViewController
https://bugs.webkit.org/show_bug.cgi?id=241700
rdar://95310525

Reviewed by Tim Horton.

Even after the changes in r295052, UITextEffectsWindow-hosted text selection views (e.g. grabber
dots and callout bar) are still _sometimes_ obscured behind the fullscreen player view controller
window. This happens because UIKit may actually maintain multiple UITextEffectsWindows at
different window levels (only one of which is used to host text selection UI for Live Text in
fullscreen videos). For instance, if the user focuses the unified field in Safari and selects or
edits text in the unified field, a UITextEffectsWindow with a window level of 1.0 will be
instantiated; if this happens prior to triggering Live Text for a fullscreen video, this text
effects window may be reused for Live Text.

In cases where this .windowLevel = 1.0 text effects window is used, the window used for the player
view controller (which currently has a level of UITextEffectsBeneathStatusBarWindowLevel - 1) will
be above the rest of the Live Text selection UI, which causes this bug to occur.

Mitigate this by explicitly grabbing the UITextEffectsWindow that corresponds to the player view's
window using +sharedTextEffectsWindowForWindowScene:, and setting the player view window's level
to a value that's right below this text effects window.

  • Source/WebCore/PAL/pal/ios/UIKitSoftLink.h:
  • Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm:
  • Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h:
  • Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm:

(VideoFullscreenInterfaceAVKit::doSetup):

Canonical link: https://commits.webkit.org/251633@main

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h

    r275775 r295628  
    5959SOFT_LINK_CLASS_FOR_HEADER(PAL, UIScreen)
    6060SOFT_LINK_CLASS_FOR_HEADER(PAL, UITapGestureRecognizer)
     61SOFT_LINK_CLASS_FOR_HEADER(PAL, UITextEffectsWindow)
    6162SOFT_LINK_CLASS_FOR_HEADER(PAL, UITraitCollection)
    6263SOFT_LINK_CLASS_FOR_HEADER(PAL, UIView)
  • trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm

    r270823 r295628  
    5959SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIScreen)
    6060SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UITapGestureRecognizer)
     61SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UITextEffectsWindow)
    6162SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UITraitCollection)
    6263SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIView)
  • trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h

    r277452 r295628  
    4444#import <UIKit/UIPasteboard_Private.h>
    4545#import <UIKit/UIScreen_Private.h>
     46#import <UIKit/UITextEffectsWindow.h>
    4647#import <UIKit/UIViewController_Private.h>
    4748#import <UIKit/NSItemProvider+UIKitAdditions.h>
     
    174175@end
    175176
     177@interface UIApplicationRotationFollowingWindow : UIWindow
     178@end
     179
     180@interface UIAutoRotatingWindow : UIApplicationRotationFollowingWindow
     181@end
     182
     183@interface UITextEffectsWindow : UIAutoRotatingWindow
     184+ (UITextEffectsWindow *)sharedTextEffectsWindowForWindowScene:(UIWindowScene *)windowScene;
     185@end
     186
    176187#endif // USE(APPLE_INTERNAL_SDK)
    177188
  • trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

    r295052 r295628  
    13721372        [m_viewController _setIgnoreAppSupportedOrientations:YES];
    13731373        [m_window setRootViewController:m_viewController.get()];
    1374         [m_window setWindowLevel:PAL::get_UIKit_UITextEffectsBeneathStatusBarWindowLevel() - 1];
     1374        auto textEffectsWindowLevel = [&] {
     1375            auto *textEffectsWindow = [PAL::getUITextEffectsWindowClass() sharedTextEffectsWindowForWindowScene:[m_window windowScene]];
     1376            return textEffectsWindow ? textEffectsWindow.windowLevel : PAL::get_UIKit_UITextEffectsBeneathStatusBarWindowLevel();
     1377        }();
     1378        [m_window setWindowLevel:textEffectsWindowLevel - 1];
    13751379        [m_window makeKeyAndVisible];
    13761380    }
    1377 #endif
     1381#endif // !PLATFORM(WATCHOS)
    13781382
    13791383    if (!m_playerLayerView)
Note: See TracChangeset for help on using the changeset viewer.