<rdar://problem/
48955900> and https://bugs.webkit.org/show_bug.cgi?id=195765
Reviewed by Tim Horton.
Source/WebCore:
Covered by API tests.
* page/FrameView.cpp:
(WebCore::FrameView::paintContents): Don't paint the debug color outside of the FrameRect.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::setURLForRect):
* rendering/PaintPhase.h: Add "AnnotateLinks" option to always gather and annotation links.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::hasOutlineAnnotation const): Also return true when the PaintOptions include "AnnotateLinks"
Source/WebKit:
This is refactoring a combination of "snapshotFirstPage" PDF printing code and the
"takeSnapshot" API code to capture the on-screen visible page to a PDF at full fidelity.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::drawToPDF):
(WebKit::WebPageProxy::drawToPDFCallback):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _wk_pageCountForPrintFormatter:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::drawToPDFCallback): Move to cross platform WebPageProxy.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::pdfSnapshotAtSize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::pdfSnapshotAtSize): Instead of assuming 1 page capped at 200 inches,
paginate every 200 inches.
(WebKit::WebPage::drawToPDF):
(WebKit::paintSnapshotAtSize): Deleted.
(WebKit::WebPage::pdfSnapshotAtSize): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Tools:
-Add an "Export to PDF..." menu option to MiniBrowser.
-Add API tests for the API itself.
* MiniBrowser/MiniBrowser.entitlements:
* MiniBrowser/mac/BrowserWindowController.h:
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController forceRepaint:]):
(-[BrowserWindowController saveAsPDF:]):
* MiniBrowser/mac/MainMenu.xib:
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController validateMenuItem:]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController validateMenuItem:]):
(-[WK2BrowserWindowController saveAsPDF:]):
* TestWebKitAPI/Configurations/Base.xcconfig:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/PDFSnapshot.mm: Added.
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestPDFDocument.h: Added.
* TestWebKitAPI/cocoa/TestPDFDocument.mm: Added.
(TestWebKitAPI::toCGRect):
(TestWebKitAPI::toPlatformPoint):
(TestWebKitAPI::TestPDFAnnotation::TestPDFAnnotation):
(TestWebKitAPI::TestPDFAnnotation::isLink const):
(TestWebKitAPI::TestPDFAnnotation::bounds const):
(TestWebKitAPI::TestPDFAnnotation::linkURL const):
(TestWebKitAPI::TestPDFPage::create):
(TestWebKitAPI::TestPDFPage::TestPDFPage):
(TestWebKitAPI::TestPDFPage::annotations):
(TestWebKitAPI::TestPDFPage::characterCount const):
(TestWebKitAPI::TestPDFPage::text const):
(TestWebKitAPI::TestPDFPage::rectForCharacterAtIndex const):
(TestWebKitAPI::TestPDFPage::characterIndexAtPoint const):
(TestWebKitAPI::TestPDFPage::bounds const):
(TestWebKitAPI::TestPDFPage::colorAtPoint const):
(TestWebKitAPI::TestPDFDocument::createFromData):
(TestWebKitAPI::TestPDFDocument::TestPDFDocument):
(TestWebKitAPI::TestPDFDocument::pageCount const):
(TestWebKitAPI::TestPDFDocument::page):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249739
268f45cc-cd09-0410-ab3c-
d52691b4dbfc