WebPage::scaledSnapshotWithOptions returns a corrupt snapshot if you request a rect...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Mar 2013 06:29:59 +0000 (06:29 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Mar 2013 06:29:59 +0000 (06:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111820
<rdar://problem/13375785>

Reviewed by Simon Fraser.

We have to clear the image - there could be area that won’t be painted by the FrameView,
or the FrameView could have a transparent background.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions):

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 04c9f7a..c3c3fce 100644 (file)
@@ -1,5 +1,19 @@
 2013-03-10  Tim Horton  <timothy_horton@apple.com>
 
+        WebPage::scaledSnapshotWithOptions returns a corrupt snapshot if you request a rect larger than the FrameView’s size
+        https://bugs.webkit.org/show_bug.cgi?id=111820
+        <rdar://problem/13375785>
+
+        Reviewed by Simon Fraser.
+
+        We have to clear the image - there could be area that won’t be painted by the FrameView,
+        or the FrameView could have a transparent background.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaledSnapshotWithOptions):
+
+2013-03-10  Tim Horton  <timothy_horton@apple.com>
+
         Fix a typo in http://trac.webkit.org/changeset/145332.
 
         Unreviewed.
index e661aec..7eccfc8 100644 (file)
@@ -1414,6 +1414,9 @@ PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, dou
         return 0;
 
     OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
+
+    graphicsContext->clearRect(IntRect(IntPoint(), bitmapSize));
+
     graphicsContext->applyDeviceScaleFactor(combinedScaleFactor);
     graphicsContext->translate(-rect.x(), -rect.y());