iOS build broke with change to make Mac use PDFKit for PDFDocumentImage
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Sep 2013 19:25:21 +0000 (19:25 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Sep 2013 19:25:21 +0000 (19:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=120771

Reviewed by Anders Carlsson.

* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::createPDFDocument):
Use the (removed in r155069) PLATFORM(MAC) way of making a CGDataProvider from a SharedBuffer
everywhere; this is what iOS was expecting to use (where I accidentally changed behavior),
and it should also work for Windows, the only other USE(CG) platform.

Since we only createPDFDocument() after all data has been received, I'm not
restoring the comment about the SharedBuffer being secretly written to behind its back.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155138 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp

index 5c5a08a..e27033d 100644 (file)
@@ -1,3 +1,19 @@
+2013-09-05  Tim Horton  <timothy_horton@apple.com>
+
+        iOS build broke with change to make Mac use PDFKit for PDFDocumentImage
+        https://bugs.webkit.org/show_bug.cgi?id=120771
+
+        Reviewed by Anders Carlsson.
+
+        * platform/graphics/cg/PDFDocumentImage.cpp:
+        (WebCore::PDFDocumentImage::createPDFDocument):
+        Use the (removed in r155069) PLATFORM(MAC) way of making a CGDataProvider from a SharedBuffer
+        everywhere; this is what iOS was expecting to use (where I accidentally changed behavior),
+        and it should also work for Windows, the only other USE(CG) platform.
+
+        Since we only createPDFDocument() after all data has been received, I'm not
+        restoring the comment about the SharedBuffer being secretly written to behind its back.
+
 2013-09-04  Dean Jackson  <dino@apple.com>
 
         Rename supportsContext to probablySupportsContext
index a99b8a1..9af69cd 100644 (file)
@@ -145,13 +145,8 @@ void PDFDocumentImage::draw(GraphicsContext* context, const FloatRect& dstRect,
 #if !USE(PDFKIT_FOR_PDFDOCUMENTIMAGE)
 void PDFDocumentImage::createPDFDocument()
 {
-    // Create a CGDataProvider to wrap the SharedBuffer.
-    // We use the GetBytesAtPosition callback rather than the GetBytePointer one because SharedBuffer
-    // does not provide a way to lock down the byte pointer and guarantee that it won't move, which
-    // is a requirement for using the GetBytePointer callback.
-
-    CGDataProviderDirectCallbacks providerCallbacks = { 0, 0, 0, sharedBufferGetBytesAtPosition, 0 };
-    RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateDirect(this->data(), this->data()->size(), &providerCallbacks));
+    RetainPtr<CFDataRef> data = adoptCF(this->data()->createCFData());
+    RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data.get()));
     m_document = CGPDFDocumentCreateWithProvider(dataProvider.get());
 }