WKPDFView does not support password-protected PDFs
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Apr 2015 23:54:59 +0000 (23:54 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Apr 2015 23:54:59 +0000 (23:54 +0000)
commitfb0acdea42d2f040ed4e4d1aa8c476787e4df674
treed6e3db6ca2f51053c488a498bc9286019f9cd866
parent3192062cfd86e42d32f4e60fe907190d73d0536d
WKPDFView does not support password-protected PDFs
https://bugs.webkit.org/show_bug.cgi?id=144162
<rdar://problem/18411512>

Reviewed by Andy Estes.

* Platform/spi/ios/UIKitSPI.h:
Add some SPI.

* UIProcess/ios/WKPDFView.h:
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView _didLoadPDFDocument]):
(-[WKPDFView web_setContentProviderData:suggestedFilename:]):
Move creation of the UIPDFDocument (only possible if the CGPDFDocument is unlocked)
and initial setup of the page views out into _didLoadPDFDocument.

If the CGPDFDocument is locked, we'll show some UI to unlock it; otherwise
we'll continue on to _didLoadPDFDocument as previously.

(-[WKPDFView web_setMinimumSize:]):
Resize the password UI instead of the PDF pages if we have it.

(-[WKPDFView _computePageAndDocumentFrames]):
Don't bother doing any work revalidating PDF pages if the document is locked.

(-[WKPDFView _updatePasswordEntryField]):
Make sure that the UIDocumentPassword view is always the size of the scrollview.
This takes care of rotation.

(-[WKPDFView _keyboardDidShow:]):
Make sure that we scroll the password field around, if necessary, to keep it
on screen when editing begins.

(-[WKPDFView _showPasswordEntryField]):
(-[WKPDFView _hidePasswordEntryField]):
Adjust the background color (to match the UIDocumentPasswordView) and disable zooming
while it's up. The UIDocumentPassword view is installed into the scroll view
to match UIWebView behavior.

(-[WKPDFView userDidEnterPassword:forPasswordView:]):
(-[WKPDFView didBeginEditingPassword:inView:]):
(-[WKPDFView didEndEditingPassword:inView:]):
(-[WKPDFView _didFailToUnlock]):
Pop up a dialog informing the user that they entered the wrong password.

(-[WKPDFView _tryToUnlockWithPassword:]):
Try to unlock the document. If it succeeds, hide the unlock UI and go back to
_didLoadPDFDocument.

* English.lproj/Localizable.strings:
Add some localizable strings.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/spi/ios/UIKitSPI.h
Source/WebKit2/UIProcess/ios/WKPDFView.h
Source/WebKit2/UIProcess/ios/WKPDFView.mm