-
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.
REGRESSION (272448.703@safari-7618-branch): [iOS] <input type=file> c…
…amera capture instantly dismisses rdar://125046135 Reviewed by Abrar Rahman Protyasha and Wenson Hsieh. 272448.703@safari-7618-branch added logic to dismiss presented pickers, such as the file upload panel, when the `WKWebView` was removed from the hierarchy. The behavior is necessary to avoid scenarios where a picker can be displayed over a site that's unrelated to the one requesting the information. While that solution is correct for modal presentations, it is incorrect for fullscreen presentations, which remove views from the hierarchy following presentation. The camera view controller uses a fullscreen presentation. Consequently, once it gets presented, the web view is removed from the hierarchy, and following 272448.703@safari-7618-branch, it is instantly dismissed. To fix, reduce the scope of the previous fix to exclude fullscreen presentations. In this case, there is no need to dismiss presented view controllers, as the web view content is already hidden. Note that there is no way to detect whether a view was removed from the hierarchy due to a fullscreen presentation. Consequently, the solution checks the status of various presented pickers. * Source/WebKit/UIProcess/Cocoa/PickerDismissalReason.h: Introduce `PickerDismissalReason`s to control the dimissal behavior. In particular, `ViewRemoved` now checks for fullscreen presentations, to avoid instant dismissal. * Source/WebKit/UIProcess/Cocoa/WKContactPicker.h: * Source/WebKit/UIProcess/Cocoa/WKContactPicker.mm: (-[WKContactPicker dismissIfNeededWithReason:]): * Source/WebKit/UIProcess/Cocoa/WKShareSheet.h: * Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet dismissIfNeededWithReason:]): * Source/WebKit/UIProcess/ios/UIKitUtilities.h: * Source/WebKit/UIProcess/ios/UIKitUtilities.mm: (-[UIViewController _wk_isInFullscreenPresentation]): * Source/WebKit/UIProcess/ios/WKContentView.mm: (-[WKContentView willMoveToWindow:]): * Source/WebKit/UIProcess/ios/WKContentViewInteraction.h: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView dismissFilePicker]): (-[WKContentView _showShareSheet:inRect:completionHandler:]): (-[WKContentView dismissPickersIfNeededWithReason:]): (-[WKContentView dismissPickers]): Deleted. * Source/WebKit/UIProcess/ios/WKPDFView.mm: (-[WKPDFView dealloc]): `ProcessExited` is used here, since it has the desired semantics. In effect, the remote process of the host view controller is exited here. (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]): * Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.h: * Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel dismissIfNeededWithReason:]): * Source/WebKit/UIProcess/mac/WebViewImpl.mm: (WebKit::WebViewImpl::showShareSheet): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: Canonical link: https://commits.webkit.org/272448.818@safari-7618-branch
- Loading branch information
Showing
15 changed files
with
143 additions
and
26 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,37 @@ | ||
/* | ||
* Copyright (C) 2024 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 | ||
|
||
namespace WebKit { | ||
|
||
enum class PickerDismissalReason : uint8_t { | ||
ResetState, | ||
ViewRemoved, | ||
ProcessExited, | ||
Testing, | ||
}; | ||
|
||
} // namespace WebKit |
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
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
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