Changeset 233246 in webkit


Ignore:
Timestamp:
Jun 26, 2018 10:06:51 PM (6 years ago)
Author:
Wenson Hsieh
Message:

[iPad apps on macOS] Unable to interact with video elements that have started playing
https://bugs.webkit.org/show_bug.cgi?id=187073
<rdar://problem/40591107>

Reviewed by Tim Horton.

Source/WebCore/PAL:

Define an SPI method on CALayer. See WebKit ChangeLog for more detail.

  • pal/spi/cocoa/QuartzCoreSPI.h:

Source/WebKit:

On iOS, we currently force remote hosting contexts to be non-interactive by passing in kCAContextIgnoresHitTest
when creating the CAContext. However, this flag is not respected by CoreAnimation when running iOS apps on macOS.
This means all HID events dispatched over a video that has been played (which causes WebKit to insert a
CALayerHost-backed WKRemoteView in the view hierarchy) will be routed to the context ID of the video's CAContext
rather than the context ID of the key window containing the WKWebView.

This subsequently causes all gesture recognizers (hover, touch, tap, long press) to fail recognition when
running iOS apps on macOS. To address this, we set a flag on WKRemoteView's CALayerHost to prevent hit-testing
to the remote layer. This allows us to avoid routing HID events to the wrong context, and instead target the
main UIWindow.

Manually verified that click, touch, and mouseenter/mouseleave events are dispatched when interacting over a
video element.

  • UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:

(-[WKRemoteView initWithFrame:contextID:]):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/ChangeLog

    r233122 r233246  
     12018-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iPad apps on macOS] Unable to interact with video elements that have started playing
     4        https://bugs.webkit.org/show_bug.cgi?id=187073
     5        <rdar://problem/40591107>
     6
     7        Reviewed by Tim Horton.
     8
     9        Define an SPI method on CALayer. See WebKit ChangeLog for more detail.
     10
     11        * pal/spi/cocoa/QuartzCoreSPI.h:
     12
    1132018-06-23  Yusuke Suzuki  <utatane.tea@gmail.com>
    214
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h

    r232642 r233246  
    9595- (void)reloadValueForKeyPath:(NSString *)keyPath;
    9696@property BOOL allowsGroupBlending;
     97@property BOOL allowsHitTesting;
    9798@property BOOL canDrawConcurrently;
    9899@property BOOL contentsOpaque;
  • trunk/Source/WebKit/ChangeLog

    r233244 r233246  
     12018-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iPad apps on macOS] Unable to interact with video elements that have started playing
     4        https://bugs.webkit.org/show_bug.cgi?id=187073
     5        <rdar://problem/40591107>
     6
     7        Reviewed by Tim Horton.
     8
     9        On iOS, we currently force remote hosting contexts to be non-interactive by passing in `kCAContextIgnoresHitTest`
     10        when creating the CAContext. However, this flag is not respected by CoreAnimation when running iOS apps on macOS.
     11        This means all HID events dispatched over a video that has been played (which causes WebKit to insert a
     12        CALayerHost-backed WKRemoteView in the view hierarchy) will be routed to the context ID of the video's CAContext
     13        rather than the context ID of the key window containing the WKWebView.
     14
     15        This subsequently causes all gesture recognizers (hover, touch, tap, long press) to fail recognition when
     16        running iOS apps on macOS. To address this, we set a flag on WKRemoteView's CALayerHost to prevent hit-testing
     17        to the remote layer. This allows us to avoid routing HID events to the wrong context, and instead target the
     18        main UIWindow.
     19
     20        Manually verified that click, touch, and mouseenter/mouseleave events are dispatched when interacting over a
     21        video element.
     22
     23        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
     24        (-[WKRemoteView initWithFrame:contextID:]):
     25
    1262018-06-26  Commit Queue  <commit-queue@webkit.org>
    227
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm

    r222896 r233246  
    135135- (instancetype)initWithFrame:(CGRect)frame contextID:(uint32_t)contextID
    136136{
    137     if ((self = [super initWithFrame:frame]))
    138         [(CALayerHost *)[self layer] setContextId:contextID];
     137    if ((self = [super initWithFrame:frame])) {
     138        CALayerHost *layer = (CALayerHost *)self.layer;
     139        layer.contextId = contextID;
     140#if ENABLE(MINIMAL_SIMULATOR)
     141        // When running iOS apps on macOS, kCAContextIgnoresHitTest isn't respected; instead, we avoid
     142        // hit-testing to the remote context by disabling hit-testing on its host layer. See
     143        // <rdar://problem/40591107> for more details.
     144        layer.allowsHitTesting = NO;
     145#endif
     146    }
    139147   
    140148    return self;
Note: See TracChangeset for help on using the changeset viewer.