WKPDFView paints rotated pages squished
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jul 2014 23:01:47 +0000 (23:01 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jul 2014 23:01:47 +0000 (23:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135401
<rdar://problem/17173916>

Reviewed by Simon Fraser.

* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView _computePageAndDocumentFrames]):
[page size] returns the crop box's size, ignoring rotation.
[page cropBoxAccountForRotation] respects rotation, but otherwise returns the same size.
UIPDFPageView will respect rotation when painting, so we
should make sure that it is given an aspect ratio that also
respects rotation, so that the page isn't squished.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKPDFView.mm

index b2fb672719546824a18d17f36af71ad0b23e80b2..bb2402f84029413bc0b8d53556e30dd5e00a8df1 100644 (file)
@@ -1,3 +1,19 @@
+2014-07-29  Tim Horton  <timothy_horton@apple.com>
+
+        WKPDFView paints rotated pages squished
+        https://bugs.webkit.org/show_bug.cgi?id=135401
+        <rdar://problem/17173916>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView _computePageAndDocumentFrames]):
+        [page size] returns the crop box's size, ignoring rotation.
+        [page cropBoxAccountForRotation] respects rotation, but otherwise returns the same size.
+        UIPDFPageView will respect rotation when painting, so we
+        should make sure that it is given an aspect ratio that also
+        respects rotation, so that the page isn't squished.
+
 2014-07-29  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         URTBF for !ENABLE(DATABASE_PROCESS) platforms.
 2014-07-29  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         URTBF for !ENABLE(DATABASE_PROCESS) platforms.
index 746fbccda0a95188381ec8506ca0b976cf95c949..dc144f9e24de0fd0dd78032ba54fb0e9fde524c6 100644 (file)
@@ -239,7 +239,7 @@ typedef struct {
         if (!page)
             continue;
 
         if (!page)
             continue;
 
-        CGSize pageSize = [page size];
+        CGSize pageSize = [page cropBoxAccountForRotation].size;
         pageFrame.size.height = pageSize.height / pageSize.width * pageFrame.size.width;
         CGRect pageFrameWithMarginApplied = CGRectInset(pageFrame, pdfPageMargin, pdfPageMargin);
 
         pageFrame.size.height = pageSize.height / pageSize.width * pageFrame.size.width;
         CGRect pageFrameWithMarginApplied = CGRectInset(pageFrame, pdfPageMargin, pdfPageMargin);