-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 960e0d1. rdar://114720841
[iOS] Cannot scroll page by dragging on a bare <video> element https://bugs.webkit.org/show_bug.cgi?id=261563 rdar://114720841 Reviewed by Simon Fraser. The UI-side compositing subsystem relies on UIViews of particular classes or conforming to particular protocols for collecting the appropriate views during hit testing. WebAVPlayerLayerView is not one of those clasess, nor can it conform to the protocols defined in WebKit (as it's a product of WebCore). So to the hit testing logic of UI-side compositing, it's a black hole. Add a new class, WKVideoView, which is a WKCompositingView as well as WKNativelyInteractible, to host the WebAVPlayerLayerView. * Source/WebKit/SourcesCocoa.txt: * Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::createViewWithID): * Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: * Source/WebKit/UIProcess/ios/WKVideoView.h: Added. * Source/WebKit/UIProcess/ios/WKVideoView.mm: Added. (+[WKVideoView layerClass]): (-[WKVideoView hitTest:withEvent:]): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: Canonical link: https://commits.webkit.org/268041@main Identifier: 265870.602@safari-7616.2.9.10-branch
- Loading branch information
Showing
9 changed files
with
150 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
RUN(video.src = findMediaFile("video", "../../../media/content/test")) | ||
EVENT(canplay) | ||
RUN(video.play()) | ||
Promise resolved OK | ||
Simulate drag on video element | ||
EVENT(scroll) | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>video-scrolling</title> | ||
<script src=../../../media/video-test.js></script> | ||
<script src=../../../media/media-file.js></script> | ||
<script src=../../../resources/basic-gestures.js></script> | ||
<script> | ||
async function runTest() { | ||
findMediaElement(); | ||
run('video.src = findMediaFile("video", "../../../media/content/test")'); | ||
await waitFor(video, 'canplay'); | ||
await shouldResolve(run('video.play()')); | ||
|
||
consoleWrite('Simulate drag on video element'); | ||
|
||
let middleX = video.offsetLeft + video.offsetWidth / 2; | ||
let middleY = video.offsetTop + video.offsetHeight / 2; | ||
touchAndDragFromPointToPoint(middleX, middleY, middleX, 0); | ||
await waitFor(document, 'scroll'); | ||
} | ||
|
||
window.addEventListener('load', event => { | ||
runTest().then(endTest).catch(failTest); | ||
}) | ||
</script> | ||
<style> | ||
#spacer { width: 100vw; height: 100vh; } | ||
</style> | ||
</head> | ||
<body> | ||
<video muted playsinline></video> | ||
<div id=spacer></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2023 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#if PLATFORM(IOS_FAMILY) | ||
|
||
#import "RemoteLayerTreeViews.h" | ||
|
||
@interface WKVideoView : WKCompositingView <WKNativelyInteractible> | ||
@end | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2023 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "WKVideoView.h" | ||
|
||
#if PLATFORM(IOS_FAMILY) | ||
@implementation WKVideoView | ||
+ (Class)layerClass | ||
{ | ||
return [CALayer class]; | ||
} | ||
|
||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event | ||
{ | ||
return [self pointInside:point withEvent:event] ? self : nil; | ||
} | ||
|
||
- (void)layoutSubviews | ||
{ | ||
for (UIView *subview in self.subviews) | ||
subview.frame = self.bounds; | ||
} | ||
@end | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters