Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[iOS] Move WKPDFView's password view to WKWebView
https://bugs.webkit.org/show_bug.cgi?id=167401 Reviewed by Tim Horton. r210943 moved the PDF password view into the new class WKPasswordView but left it as a subview of the WKPDFView. To show the password view for Web content, my original plan was to teach WKContentView to host its own password view, but this turned out not to work. Since QuickLook needs to unlock a document before determining its preview's MIME type, we have to ask for a password during provisional navigation, but if the still-committed document is a PDF then the WKContentView will not be in the view hierarchy. To ensure password view visibility, this patch moves the ownership of WKPasswordView to WKWebView and creates an internal API for showing and hiding it. When -_showPasswordViewWithDocumentName:passwordHandler: is called, WKWebView inserts a new WKPasswordView as a subview of the scroll view and hides the current content view. The password view is removed and the current content view is unhidden by -_hidePasswordView. This also fixes a bug in WKPDFView where a PDF document is laid out incorrectly if the view size changes while the password view is displayed. * UIProcess/API/Cocoa/WKWebView.mm: Declared _passwordView. (-[WKWebView _processDidExit]): Hid the password view. (-[WKWebView _didCommitLayerTree:]): Ignored if not showing the standard content view. (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]): Ditto. (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]): Ditto. (-[WKWebView usesStandardContentView]): Changed to return false if _passwordView is non-nil. (-[WKWebView _updateContentRectsWithState:]): Updated _passwordView's frame with the current bounds size. (-[WKWebView _showPasswordViewWithDocumentName:passwordHandler:]): Created a WKPasswordView, called -showInScrollView:, and hid _currentContentView. (-[WKWebView _hidePasswordView]): Removed _passwordView from its superview, set _passwordView to nil, and unhid _currentContentView. (-[WKWebView _passwordView]): Returned _passwordView. (-[WKWebView _beginAnimatedResizeWithUpdates:]): Called -usesStandardContentView instead of checking for a non-nil _customContentView when deciding whether to do a non-animated resize. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/ios/WKPDFView.mm: Removed _passwordView. (-[WKPDFView web_setMinimumSize:]): Set m_minimumSize and updated the frame size even when a password view is displayed. (-[WKPDFView _computePageAndDocumentFrames]): Removed password view code. (-[WKPDFView _showPasswordEntryField]): Ditto. (-[WKPDFView _passwordViewFrame]): Deleted. * UIProcess/ios/WKPasswordView.h: * UIProcess/ios/WKPasswordView.mm: (-[WKPasswordView initWithFrame:documentName:]): Stored a copy of documentName in _documentName. (-[WKPasswordView documentName]): Added. Returns _documentName. (-[WKPasswordView showInScrollView:]): Renamed from displayInContentView:. Started saving zoomScale and contentSize. (-[WKPasswordView hide]): Started restoring zoomeScale and contentSize. (-[WKPasswordView showPasswordFailureAlert]): Renamed from -displayPasswordFailureAlert. (-[WKPasswordView displayInContentView:]): Renamed to -showInScrollView: (-[WKPasswordView displayPasswordFailureAlert]): Renamed to -showPasswordFailureAlert. Canonical link: https://commits.webkit.org/184456@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
6 changed files
with
123 additions
and
37 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
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