Title: [169398] trunk/Source/WebKit2
Revision
169398
Author
timothy_hor...@apple.com
Date
2014-05-27 13:45:21 -0700 (Tue, 27 May 2014)

Log Message

[wk2] PDFPlugin snapshots are misplaced
https://bugs.webkit.org/show_bug.cgi?id=133323

Reviewed by Simon Fraser.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::paintControlForLayerInContext):
(WebKit::PDFPlugin::snapshot):
Include the scroll offset in the snapshot translation,
and use the whole document size instead of just the view size.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (169397 => 169398)


--- trunk/Source/WebKit2/ChangeLog	2014-05-27 19:47:14 UTC (rev 169397)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-27 20:45:21 UTC (rev 169398)
@@ -1,3 +1,16 @@
+2014-05-27  Timothy Horton  <timothy_hor...@apple.com>
+
+        [wk2] PDFPlugin snapshots are misplaced
+        https://bugs.webkit.org/show_bug.cgi?id=133323
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::paintControlForLayerInContext):
+        (WebKit::PDFPlugin::snapshot):
+        Include the scroll offset in the snapshot translation,
+        and use the whole document size instead of just the view size.
+
 2014-05-27  Sam Weinig  <s...@webkit.org>
 
         [WebKit2] Move WebPreferences macro definitions and key names into their own files

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (169397 => 169398)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2014-05-27 19:47:14 UTC (rev 169397)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2014-05-27 20:45:21 UTC (rev 169398)
@@ -1110,7 +1110,7 @@
         return;
     }
     
-    Scrollbar* scrollbar = 0;
+    Scrollbar* scrollbar = nullptr;
     
     if (layer == m_verticalScrollbarLayer)
         scrollbar = verticalScrollbar();
@@ -1127,7 +1127,7 @@
 PassRefPtr<ShareableBitmap> PDFPlugin::snapshot()
 {
     if (size().isEmpty())
-        return 0;
+        return nullptr;
 
     float contentsScaleFactor = controller()->contentsScaleFactor();
     IntSize backingStoreSize = size();
@@ -1137,7 +1137,7 @@
     auto context = bitmap->createGraphicsContext();
 
     context->scale(FloatSize(contentsScaleFactor, -contentsScaleFactor));
-    context->translate(0, -size().height());
+    context->translate(-m_scrollOffset.width(), -m_pdfDocumentSize.height() + m_scrollOffset.height());
 
     [m_pdfLayerController snapshotInContext:context->platformContext()];
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to