2007-04-05  Oliver Hunt  <oliver@apple.com>

        Reviewed by Adam.

WebCore:
        Fix rdar://problem/5030934 -- landscape PDFs embedded as an image are cut off
        also fixes scaling of pdf images

        PDFDocumentImage was not accounting for page rotation in a number of places

        * platform/graphics/cg/PDFDocumentImage.cpp:
        (WebCore::PDFDocumentImage::size):
          we need to account for rotation of the pdf image effecting our bounds
        (WebCore::PDFDocumentImage::draw):
          When compensating for flipped coords we need to use the correct rect for the 
          coordinate space.  We can't pass size() to CGContextDrawPDFDocument as it
          returns the rotated bounds now -- this is also save the old 
          FloatSize -> IntSize -> FloatSize conversions.
LayoutTests:
        Testcase for landscape pdfs as image

        rdar://problem/5030934 -- landscape PDFs embedded as an image are cut off

        * fast/images/pdf-as-image-landscape-expected.txt: Added.
        * fast/images/pdf-as-image-landscape.html: Added.
        * fast/images/resources/pdf_test_landscape.pdf: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/images/pdf-as-image-landscape.html b/LayoutTests/fast/images/pdf-as-image-landscape.html
new file mode 100644
index 0000000..7d524d3
--- /dev/null
+++ b/LayoutTests/fast/images/pdf-as-image-landscape.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+This test that we correctly orient landscape pdf images.  The green rectangle should be wider than it is tall.<p />
+<img src="resources/pdf_test_landscape.pdf"/>
+</body>
+</html>