Diff
Modified: trunk/LayoutTests/ChangeLog (155305 => 155306)
--- trunk/LayoutTests/ChangeLog 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/LayoutTests/ChangeLog 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,3 +1,19 @@
+2013-09-08 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r155069 and r155138.
+ http://trac.webkit.org/changeset/155069
+ http://trac.webkit.org/changeset/155138
+ https://bugs.webkit.org/show_bug.cgi?id=121008
+
+ Seems to have broken many tests (bug 120963) (Requested by ap
+ on #webkit).
+
+ * fast/images/pdf-as-image-with-annotations-expected.html: Removed.
+ * fast/images/pdf-as-image-with-annotations.html: Removed.
+ * fast/images/resources/annotation.pdf: Removed.
+ * platform/mac/fast/images/pdf-as-image-landscape-expected.png:
+ * platform/mac/fast/images/pdf-as-image-landscape-expected.txt:
+
2013-09-07 Mark Lam <[email protected]>
Change LayoutTests' u*-w* files to use pre and post js files in LayoutTests/resources.
Deleted: trunk/LayoutTests/fast/images/pdf-as-image-with-annotations-expected.html (155305 => 155306)
--- trunk/LayoutTests/fast/images/pdf-as-image-with-annotations-expected.html 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/LayoutTests/fast/images/pdf-as-image-with-annotations-expected.html 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,6 +0,0 @@
-<html>
-<body style='margin: 0px'>
-<div style='background: lime; height: 100px; width: 100px; overflow: hidden;'>
-</div>
-</body>
-</html>
\ No newline at end of file
Deleted: trunk/LayoutTests/fast/images/pdf-as-image-with-annotations.html (155305 => 155306)
--- trunk/LayoutTests/fast/images/pdf-as-image-with-annotations.html 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/LayoutTests/fast/images/pdf-as-image-with-annotations.html 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>There should be a single 100x100 green square at 0x0.</title>
-</head>
-<body style='margin: 0px'>
-<div style='background: red; height: 100px; width: 100px; overflow: hidden;'>
- <img src=''>
-</div>
-</body>
-</html>
\ No newline at end of file
Deleted: trunk/LayoutTests/fast/images/resources/annotation.pdf
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/images/pdf-as-image-landscape-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/images/pdf-as-image-landscape-expected.txt (155305 => 155306)
--- trunk/LayoutTests/platform/mac/fast/images/pdf-as-image-landscape-expected.txt 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/LayoutTests/platform/mac/fast/images/pdf-as-image-landscape-expected.txt 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,12 +1,12 @@
-layer at (0,0) size 850x654
+layer at (0,0) size 850x653
RenderView at (0,0) size 785x585
-layer at (0,0) size 785x654
- RenderBlock {HTML} at (0,0) size 785x654
- RenderBody {BODY} at (8,8) size 769x630
+layer at (0,0) size 785x653
+ RenderBlock {HTML} at (0,0) size 785x653
+ RenderBody {BODY} at (8,8) size 769x629
RenderBlock (anonymous) at (0,0) size 769x18
RenderText {#text} at (0,0) size 663x18
text run at (0,0) width 349: "This test that we correctly orient landscape pdf images. "
text run at (349,0) width 314: "The green rectangle should be wider than it is tall."
- RenderBlock {P} at (0,34) size 769x596
- RenderImage {IMG} at (0,0) size 842x596
+ RenderBlock {P} at (0,34) size 769x595
+ RenderImage {IMG} at (0,0) size 842x595
RenderText {#text} at (0,0) size 0x0
Modified: trunk/Source/WebCore/ChangeLog (155305 => 155306)
--- trunk/Source/WebCore/ChangeLog 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/Source/WebCore/ChangeLog 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,3 +1,31 @@
+2013-09-08 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r155069 and r155138.
+ http://trac.webkit.org/changeset/155069
+ http://trac.webkit.org/changeset/155138
+ https://bugs.webkit.org/show_bug.cgi?id=121008
+
+ Seems to have broken many tests (bug 120963) (Requested by ap
+ on #webkit).
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::PDFDocumentImage::PDFDocumentImage):
+ (WebCore::PDFDocumentImage::~PDFDocumentImage):
+ (WebCore::PDFDocumentImage::size):
+ (WebCore::PDFDocumentImage::dataChanged):
+ (WebCore::PDFDocumentImage::adjustCTM):
+ (WebCore::PDFDocumentImage::setCurrentPage):
+ (WebCore::PDFDocumentImage::pageCount):
+ (WebCore::PDFDocumentImage::draw):
+ * platform/graphics/cg/PDFDocumentImage.h:
+ (WebCore::PDFDocumentImage::create):
+ (WebCore::PDFDocumentImage::hasSingleSecurityOrigin):
+ (WebCore::PDFDocumentImage::destroyDecodedData):
+ (WebCore::PDFDocumentImage::decodedSize):
+ * platform/graphics/mac/PDFDocumentImageMac.mm: Removed.
+ * platform/mac/SoftLinking.h:
+
2013-09-08 Andreas Kling <[email protected]>
ScriptExecutionContext: Use FINAL instead of foo() { virtualFoo() }
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (155305 => 155306)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-09-08 18:10:56 UTC (rev 155306)
@@ -904,7 +904,6 @@
2D5A592F152525230036EE51 /* ImageOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */; };
2D5A5931152525D00036EE51 /* ImageOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748D6612CC3763001FBA41 /* ImageOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */; };
- 2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */; };
2D8287F616E4A0380086BD00 /* HitTestLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */; };
2D8287F716E4A0380086BD00 /* HitTestLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8287F516E4A0380086BD00 /* HitTestLocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */; };
@@ -7347,7 +7346,6 @@
2D46F04F17B96FD2005647F0 /* IntSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntSize.cpp; sourceTree = "<group>"; };
2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityPolicyViolationEvent.h; sourceTree = "<group>"; };
2D5BC42616F882BE007048D0 /* SecurityPolicyViolationEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecurityPolicyViolationEvent.idl; sourceTree = "<group>"; };
- 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFDocumentImageMac.mm; sourceTree = "<group>"; };
2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestLocation.cpp; sourceTree = "<group>"; };
2D8287F516E4A0380086BD00 /* HitTestLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestLocation.h; sourceTree = "<group>"; };
2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCrossfadeValue.cpp; sourceTree = "<group>"; };
@@ -18725,7 +18723,6 @@
E4B41E100CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.h */,
E4B41E110CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.mm */,
0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */,
- 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */,
163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */,
B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */,
49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */,
@@ -26006,7 +26003,6 @@
4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */,
C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */,
- 2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */,
BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */,
BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */,
7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp (155305 => 155306)
--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2006, 2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,17 +42,21 @@
#include "ImageSourceCG.h"
#endif
+using namespace std;
+
namespace WebCore {
PDFDocumentImage::PDFDocumentImage()
: Image(0) // PDFs don't animate
+ , m_document(0)
, m_rotation(0.0f)
- , m_hasPage(false)
+ , m_currentPage(-1)
{
}
PDFDocumentImage::~PDFDocumentImage()
{
+ CGPDFDocumentRelease(m_document);
}
String PDFDocumentImage::filenameExtension() const
@@ -66,10 +70,10 @@
const float cosa = cosf(-m_rotation);
const float width = m_mediaBox.size().width();
const float height = m_mediaBox.size().height();
- const float rotWidth = fabsf(width * cosa - height * sina);
- const float rotHeight = fabsf(width * sina + height * cosa);
+ const float rotWidth = width * cosa - height * sina;
+ const float rotHeight = width * sina + height * cosa;
- return expandedIntSize(FloatSize(rotWidth, rotHeight));
+ return IntSize((int)(fabsf(rotWidth) + 0.5f), (int)(fabsf(rotHeight) + 0.5f));
}
void PDFDocumentImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
@@ -81,19 +85,27 @@
bool PDFDocumentImage::dataChanged(bool allDataReceived)
{
- ASSERT(!m_document);
if (allDataReceived && !m_document) {
- createPDFDocument();
-
- if (pageCount()) {
- m_hasPage = true;
- computeBoundsForCurrentPage();
- }
+#if PLATFORM(MAC)
+ // On Mac the NSData inside the SharedBuffer can be secretly appended to without the SharedBuffer's knowledge. We use SharedBuffer's ability
+ // to wrap itself inside CFData to get around this, ensuring that ImageIO is really looking at the SharedBuffer.
+ RetainPtr<CFDataRef> data = ""
+ RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data.get()));
+#else
+ // 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));
+#endif
+ m_document = CGPDFDocumentCreateWithProvider(dataProvider.get());
+ setCurrentPage(0);
}
- return m_document; // Return true if size is available.
+ return m_document; // return true if size is available
}
-void PDFDocumentImage::applyRotationForPainting(GraphicsContext* context) const
+void PDFDocumentImage::adjustCTM(GraphicsContext* context) const
{
// rotate the crop box and calculate bounding box
float sina = sinf(-m_rotation);
@@ -101,22 +113,59 @@
float width = m_cropBox.width();
float height = m_cropBox.height();
- // calculate rotated x and y edges of the crop box. if they're negative, it means part of the image has
+ // calculate rotated x and y edges of the corp box. if they're negative, it means part of the image has
// been rotated outside of the bounds and we need to shift over the image so it lies inside the bounds again
CGPoint rx = CGPointMake(width * cosa, width * sina);
CGPoint ry = CGPointMake(-height * sina, height * cosa);
// adjust so we are at the crop box origin
const CGFloat zero = 0;
- CGContextTranslateCTM(context->platformContext(), floorf(-std::min(zero, std::min(rx.x, ry.x))), floorf(-std::min(zero, std::min(rx.y, ry.y))));
+ CGContextTranslateCTM(context->platformContext(), floorf(-min(zero, min(rx.x, ry.x))), floorf(-min(zero, min(rx.y, ry.y))));
// rotate -ve to remove rotation
CGContextRotateCTM(context->platformContext(), -m_rotation);
+
+ // shift so we are completely within media box
+ CGContextTranslateCTM(context->platformContext(), m_mediaBox.x() - m_cropBox.x(), m_mediaBox.y() - m_cropBox.y());
}
+void PDFDocumentImage::setCurrentPage(int page)
+{
+ if (!m_document)
+ return;
+
+ if (page == m_currentPage)
+ return;
+
+ if (!(page >= 0 && page < pageCount()))
+ return;
+
+ m_currentPage = page;
+
+ CGPDFPageRef cgPage = CGPDFDocumentGetPage(m_document, page + 1);
+
+ // get media box (guaranteed)
+ m_mediaBox = CGPDFPageGetBoxRect(cgPage, kCGPDFMediaBox);
+
+ // get crop box (not always there). if not, use media box
+ CGRect r = CGPDFPageGetBoxRect(cgPage, kCGPDFCropBox);
+ if (!CGRectIsEmpty(r))
+ m_cropBox = r;
+ else
+ m_cropBox = m_mediaBox;
+
+ // get page rotation angle
+ m_rotation = CGPDFPageGetRotationAngle(cgPage) * piFloat / 180.0f; // to radians
+}
+
+int PDFDocumentImage::pageCount() const
+{
+ return m_document ? CGPDFDocumentGetNumberOfPages(m_document) : 0;
+}
+
void PDFDocumentImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator op, BlendMode)
{
- if (!m_document || !m_hasPage)
+ if (!m_document || m_currentPage == -1)
return;
{
@@ -128,60 +177,25 @@
float vScale = dstRect.height() / srcRect.height();
// Scale and translate so the document is rendered in the correct location,
- // accounting for the fact that the GraphicsContext is flipped.
+ // including accounting for the fact that a GraphicsContext is always flipped
+ // and doing appropriate flipping.
CGContextTranslateCTM(context->platformContext(), dstRect.x() - srcRect.x() * hScale, dstRect.y() - srcRect.y() * vScale);
CGContextScaleCTM(context->platformContext(), hScale, vScale);
CGContextScaleCTM(context->platformContext(), 1, -1);
CGContextTranslateCTM(context->platformContext(), 0, -srcRect.height());
CGContextClipToRect(context->platformContext(), CGRectIntegral(srcRect));
- drawPDFPage(context);
+ // Rotate translate image into position according to doc properties.
+ adjustCTM(context);
+
+ CGContextTranslateCTM(context->platformContext(), -m_mediaBox.x(), -m_mediaBox.y());
+ CGContextDrawPDFPage(context->platformContext(), CGPDFDocumentGetPage(m_document, m_currentPage + 1));
}
if (imageObserver())
imageObserver()->didDraw(this);
}
-#if !USE(PDFKIT_FOR_PDFDOCUMENTIMAGE)
-void PDFDocumentImage::createPDFDocument()
-{
- RetainPtr<CFDataRef> data = ""
- RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data.get()));
- m_document = CGPDFDocumentCreateWithProvider(dataProvider.get());
}
-void PDFDocumentImage::computeBoundsForCurrentPage()
-{
- CGPDFPageRef cgPage = CGPDFDocumentGetPage(m_document.get(), 1);
-
- m_mediaBox = CGPDFPageGetBoxRect(cgPage, kCGPDFMediaBox);
-
- // Get crop box (not always there). If not, use media box.
- CGRect r = CGPDFPageGetBoxRect(cgPage, kCGPDFCropBox);
- if (!CGRectIsEmpty(r))
- m_cropBox = r;
- else
- m_cropBox = m_mediaBox;
-
- m_rotation = deg2rad(static_cast<float>(CGPDFPageGetRotationAngle(cgPage)));
-}
-
-unsigned PDFDocumentImage::pageCount() const
-{
- return CGPDFDocumentGetNumberOfPages(m_document.get());
-}
-
-void PDFDocumentImage::drawPDFPage(GraphicsContext* context)
-{
- applyRotationForPainting(context);
-
- CGContextTranslateCTM(context->platformContext(), -m_cropBox.x(), -m_cropBox.y());
-
- // CGPDF pages are indexed from 1.
- CGContextDrawPDFPage(context->platformContext(), CGPDFDocumentGetPage(m_document.get(), 1));
-}
-#endif // !USE(PDFKIT_FOR_PDFDOCUMENTIMAGE)
-
-}
-
#endif // USE(CG)
Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h (155305 => 155306)
--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2006, 2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,66 +32,53 @@
#if USE(CG)
-#if PLATFORM(MAC) && !PLATFORM(IOS)
-#define WTF_USE_PDFKIT_FOR_PDFDOCUMENTIMAGE 1
-#endif
-
typedef struct CGPDFDocument *CGPDFDocumentRef;
-OBJC_CLASS PDFDocument;
namespace WebCore {
-class GraphicsContext;
+ class GraphicsContext;
-class PDFDocumentImage : public Image {
-public:
- static PassRefPtr<PDFDocumentImage> create()
- {
- return adoptRef(new PDFDocumentImage);
- }
+ class PDFDocumentImage : public Image {
+ public:
+ static PassRefPtr<PDFDocumentImage> create()
+ {
+ return adoptRef(new PDFDocumentImage);
+ }
-private:
- PDFDocumentImage();
- virtual ~PDFDocumentImage();
+ private:
+ virtual ~PDFDocumentImage();
- virtual String filenameExtension() const OVERRIDE;
+ virtual String filenameExtension() const;
- virtual bool hasSingleSecurityOrigin() const OVERRIDE { return true; }
+ virtual bool hasSingleSecurityOrigin() const { return true; }
- virtual bool dataChanged(bool allDataReceived) OVERRIDE;
+ virtual bool dataChanged(bool allDataReceived);
- // FIXME: PDF Images are underreporting decoded sizes and will be unable
- // to prune because these functions are not implemented yet.
- virtual void destroyDecodedData(bool /*destroyAll*/ = true) OVERRIDE { }
- virtual unsigned decodedSize() const OVERRIDE { return 0; }
+ // FIXME: PDF Images are underreporting decoded sizes and will be unable
+ // to prune because these functions are not implemented yet.
+ virtual void destroyDecodedData(bool /*destroyAll*/ = true) { }
+ virtual unsigned decodedSize() const { return 0; }
- virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE;
- virtual IntSize size() const OVERRIDE;
+ virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
+ virtual IntSize size() const;
- virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode) OVERRIDE;
+ PDFDocumentImage();
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode);
- // FIXME: Implement this to be less conservative.
- virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
+ // FIXME: Implement this to be less conservative.
+ virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
- void applyRotationForPainting(GraphicsContext*) const;
+ void setCurrentPage(int);
+ int pageCount() const;
+ void adjustCTM(GraphicsContext*) const;
- void createPDFDocument();
- void computeBoundsForCurrentPage();
- unsigned pageCount() const;
- void drawPDFPage(GraphicsContext*);
+ CGPDFDocumentRef m_document;
+ FloatRect m_mediaBox;
+ FloatRect m_cropBox;
+ float m_rotation;
+ int m_currentPage;
+ };
-#if USE(PDFKIT_FOR_PDFDOCUMENTIMAGE)
- RetainPtr<PDFDocument> m_document;
-#else
- RetainPtr<CGPDFDocumentRef> m_document;
-#endif
-
- FloatRect m_mediaBox;
- FloatRect m_cropBox;
- float m_rotation;
- bool m_hasPage;
-};
-
}
#endif // USE(CG)
Deleted: trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm (155305 => 155306)
--- trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm 2013-09-08 18:10:56 UTC (rev 155306)
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2013 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. ``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
- * 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.
- */
-
-#import "config.h"
-#import "PDFDocumentImage.h"
-
-#if USE(PDFKIT_FOR_PDFDOCUMENTIMAGE)
-
-#import "LocalCurrentGraphicsContext.h"
-#import "SharedBuffer.h"
-#import "SoftLinking.h"
-#import <Quartz/Quartz.h>
-#import <objc/objc-class.h>
-#import <wtf/RetainPtr.h>
-
-SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, PDFKit)
-SOFT_LINK_CLASS(PDFKit, PDFDocument)
-
-namespace WebCore {
-
-void PDFDocumentImage::createPDFDocument()
-{
- m_document = adoptNS([[getPDFDocumentClass() alloc] initWithData:data()->createNSData()]);
-}
-
-void PDFDocumentImage::computeBoundsForCurrentPage()
-{
- PDFPage *pdfPage = [m_document pageAtIndex:0];
-
- m_mediaBox = [pdfPage boundsForBox:kPDFDisplayBoxMediaBox];
- m_cropBox = [pdfPage boundsForBox:kPDFDisplayBoxCropBox];
-
- m_rotation = deg2rad(static_cast<float>([pdfPage rotation]));
-}
-
-unsigned PDFDocumentImage::pageCount() const
-{
- return [m_document pageCount];
-}
-
-void PDFDocumentImage::drawPDFPage(GraphicsContext* context)
-{
- CGContextTranslateCTM(context->platformContext(), -m_cropBox.x(), -m_cropBox.y());
-
- LocalCurrentGraphicsContext localCurrentContext(context);
- [[m_document pageAtIndex:0] drawWithBox:kPDFDisplayBoxCropBox];
-}
-
-}
-
-#endif // USE(PDFKIT_FOR_PDFDOCUMENTIMAGE)
Modified: trunk/Source/WebCore/platform/mac/SoftLinking.h (155305 => 155306)
--- trunk/Source/WebCore/platform/mac/SoftLinking.h 2013-09-08 17:31:34 UTC (rev 155305)
+++ trunk/Source/WebCore/platform/mac/SoftLinking.h 2013-09-08 18:10:56 UTC (rev 155306)
@@ -65,10 +65,10 @@
return frameworkLibrary; \
}
-#define SOFT_LINK_FRAMEWORK_IN_UMBRELLA(umbrella, framework) \
+#define SOFT_LINK_FRAMEWORK_IN_CORESERVICES_UMBRELLA(framework) \
static void* framework##Library() \
{ \
- static void* frameworkLibrary = dlopen("/System/Library/Frameworks/" #umbrella ".framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ static void* frameworkLibrary = dlopen("/System/Library/Frameworks/CoreServices.framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \
return frameworkLibrary; \
}