<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189908] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189908">189908</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-17 00:24:50 -0700 (Thu, 17 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>printing does not use minimum page zoom factor
https://bugs.webkit.org/show_bug.cgi?id=108507

Reviewed by Darin Adler.

Source/WebCore:

* page/PrintContext.cpp:
(WebCore::PrintContext::beginAndComputePageRectsWithPageSize):
Helper function to share common code from numberOfPages() and
spoolAllPagesWithBoundaries().
(WebCore::PrintContext::numberOfPages): Use beginAndComputePageRectsWithPageSize().
(WebCore::PrintContext::spoolAllPagesWithBoundaries): Use
beginAndComputePageRectsWithPageSize() and don't flip the Y axis
for non Cocoa platforms.
* page/PrintContext.h:

Source/WebKit/mac:

Pass a the frame as a reference instead of using pointers.

* Misc/WebCoreStatistics.mm:
(-[WebFrame numberOfPagesWithPageWidth:pageHeight:]):
(-[WebFrame printToCGContext:pageWidth:pageHeight:]):

Source/WebKit2:

Add kWKSnapshotOptionsPrinting flag to indicate the snapshot
should be generated in printing mode.

* Shared/API/c/WKImage.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toSnapshotOptions):
* Shared/ImageOptions.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::numberOfPages): Pass the frame as a
reference instead of a pointer.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions): In case of printing,
calculate the bitmap height based on the number of pages.
(WebKit::WebPage::snapshotAtSize): In case of printing, use
PrintContext::spoolAllPagesWithBoundaries() and return.

Tools:

WebKitTestRunner always takes the snapshots from the UI process
(expect for IOS), so in the case of printing, the layout in the
web view is not the expected one. When printing, we need to take
the snapshot in the web process and ensure it's rendered with a
PrintContext.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::dump): When dumping pixels, pass
kWKSnapshotOptionsPrinting option to
WKBundlePageCreateSnapshotWithOptions() when printing. When not
printing, don't even create the snapshot, since it will be ignored
by the UI process that always creates its own from the WebView (expect for IOS platform)
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::dumpResults): Use always the snapshot image
received from the web process if any when comparing pixel
results. Now we only receive a snapshot from the web process in
case of printing, or when platform is IOS. Otherwhise, generate
the snapshot from the WebView as usual.
* WebKitTestRunner/TestInvocation.h: Add SnapshotResultType enum
parameter to dumpPixelsAndCompareWithExpected, since the snapshot
is created by the caller now, but the CG implementation needs to
know if it's a Web or UI process snapshot.
* WebKitTestRunner/cairo/TestInvocationCairo.cpp:
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Create a
cairo surface for the given image.
* WebKitTestRunner/cg/TestInvocationCG.cpp:
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Create a
CGContext for the given image.

LayoutTests:

Unskip printing reftests that should pass now.

* platform/gtk/TestExpectations:
* platform/mac-wk2/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagePrintContextcpp">trunk/Source/WebCore/page/PrintContext.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePrintContexth">trunk/Source/WebCore/page/PrintContext.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebCoreStatisticsmm">trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcWKImageh">trunk/Source/WebKit2/Shared/API/c/WKImage.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcWKSharedAPICasth">trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h</a></li>
<li><a href="#trunkSourceWebKit2SharedImageOptionsh">trunk/Source/WebKit2/Shared/ImageOptions.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationh">trunk/Tools/WebKitTestRunner/TestInvocation.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnercairoTestInvocationCairocpp">trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnercgTestInvocationCGcpp">trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/LayoutTests/ChangeLog        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-09-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        printing does not use minimum page zoom factor
+        https://bugs.webkit.org/show_bug.cgi?id=108507
+
+        Reviewed by Darin Adler.
+
+        Unskip printing reftests that should pass now.
+
+        * platform/gtk/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+
</ins><span class="cx"> 2015-09-16  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Add failing expectation to css3/font-feature-settings-rendering-2.html on Mavericks.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -2406,10 +2406,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/143924 fast/text/hyphen-min-preferred-width.html [ Skip ]
</span><span class="cx"> 
</span><del>-webkit.org/b/144494 printing/quirks-percentage-height-body.html [ ImageOnlyFailure ]
-webkit.org/b/144494 printing/quirks-percentage-height.html [ ImageOnlyFailure ]
-webkit.org/b/144494 printing/standards-percentage-heights.html [ ImageOnlyFailure ]
-
</del><span class="cx"> webkit.org/b/144575 http/tests/loading/promote-img-preload-priority.html [ Failure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/144673 fast/forms/button-line-height.html [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -196,10 +196,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/105960 plugins/navigator-plugins.html [ Failure ]
</span><span class="cx"> 
</span><del>-webkit.org/b/108507 printing/quirks-percentage-height-body.html [ Skip ]
-webkit.org/b/108507 printing/quirks-percentage-height.html [ Skip ]
-webkit.org/b/108507 printing/standards-percentage-heights.html [ Skip ]
-
</del><span class="cx"> webkit.org/b/104954 http/tests/canvas/canvas-slow-font-loading.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><span class="cx"> # Flaky everywhere.
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebCore/ChangeLog        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-09-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        printing does not use minimum page zoom factor
+        https://bugs.webkit.org/show_bug.cgi?id=108507
+
+        Reviewed by Darin Adler.
+
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::beginAndComputePageRectsWithPageSize):
+        Helper function to share common code from numberOfPages() and
+        spoolAllPagesWithBoundaries().
+        (WebCore::PrintContext::numberOfPages): Use beginAndComputePageRectsWithPageSize().
+        (WebCore::PrintContext::spoolAllPagesWithBoundaries): Use
+        beginAndComputePageRectsWithPageSize() and don't flip the Y axis
+        for non Cocoa platforms.
+        * page/PrintContext.h:
+
</ins><span class="cx"> 2015-09-16  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         removeShadow shouldn't call ChildNodeRemovalNotifier with the shadow host as the removal point
</span></span></pre></div>
<a id="trunkSourceWebCorepagePrintContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PrintContext.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PrintContext.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebCore/page/PrintContext.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -301,33 +301,37 @@
</span><span class="cx">            String::number(marginTop) + ' ' + String::number(marginRight) + ' ' + String::number(marginBottom) + ' ' + String::number(marginLeft);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int PrintContext::numberOfPages(Frame* frame, const FloatSize&amp; pageSizeInPixels)
</del><ins>+bool PrintContext::beginAndComputePageRectsWithPageSize(Frame&amp; frame, const FloatSize&amp; pageSizeInPixels)
</ins><span class="cx"> {
</span><del>-    frame-&gt;document()-&gt;updateLayout();
</del><ins>+    if (!frame.document() || !frame.view() || !frame.document()-&gt;renderView())
+        return false;
</ins><span class="cx"> 
</span><del>-    FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
-    PrintContext printContext(frame);
-    printContext.begin(pageRect.width(), pageRect.height());
</del><ins>+    frame.document()-&gt;updateLayout();
+
+    begin(pageSizeInPixels.width(), pageSizeInPixels.height());
</ins><span class="cx">     // Account for shrink-to-fit.
</span><span class="cx">     FloatSize scaledPageSize = pageSizeInPixels;
</span><del>-    scaledPageSize.scale(frame-&gt;view()-&gt;contentsSize().width() / pageRect.width());
-    printContext.computePageRectsWithPageSize(scaledPageSize, false);
</del><ins>+    scaledPageSize.scale(frame.view()-&gt;contentsSize().width() / pageSizeInPixels.width());
+    computePageRectsWithPageSize(scaledPageSize, false);
+
+    return true;
+}
+
+int PrintContext::numberOfPages(Frame&amp; frame, const FloatSize&amp; pageSizeInPixels)
+{
+    PrintContext printContext(&amp;frame);
+    if (!printContext.beginAndComputePageRectsWithPageSize(frame, pageSizeInPixels))
+        return -1;
+
</ins><span class="cx">     return printContext.pageCount();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext&amp; graphicsContext, const FloatSize&amp; pageSizeInPixels)
</del><ins>+void PrintContext::spoolAllPagesWithBoundaries(Frame&amp; frame, GraphicsContext&amp; graphicsContext, const FloatSize&amp; pageSizeInPixels)
</ins><span class="cx"> {
</span><del>-    if (!frame-&gt;document() || !frame-&gt;view() || !frame-&gt;document()-&gt;renderView())
</del><ins>+    PrintContext printContext(&amp;frame);
+    if (!printContext.beginAndComputePageRectsWithPageSize(frame, pageSizeInPixels))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    frame-&gt;document()-&gt;updateLayout();
-
-    PrintContext printContext(frame);
-    printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height());
-
-    float pageHeight;
-    printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight);
-
</del><span class="cx">     const float pageWidth = pageSizeInPixels.width();
</span><span class="cx">     const Vector&lt;IntRect&gt;&amp; pageRects = printContext.pageRects();
</span><span class="cx">     int totalHeight = pageRects.size() * (pageSizeInPixels.height() + 1) - 1;
</span><span class="lines">@@ -337,18 +341,24 @@
</span><span class="cx">     graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight));
</span><span class="cx"> 
</span><span class="cx">     graphicsContext.save();
</span><ins>+#if PLATFORM(COCOA)
</ins><span class="cx">     graphicsContext.translate(0, totalHeight);
</span><span class="cx">     graphicsContext.scale(FloatSize(1, -1));
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     int currentHeight = 0;
</span><span class="cx">     for (size_t pageIndex = 0; pageIndex &lt; pageRects.size(); pageIndex++) {
</span><span class="cx">         // Draw a line for a page boundary if this isn't the first page.
</span><span class="cx">         if (pageIndex &gt; 0) {
</span><ins>+#if PLATFORM(COCOA)
+            int boundaryLineY = currentHeight;
+#else
+            int boundaryLineY = currentHeight - 1;
+#endif
</ins><span class="cx">             graphicsContext.save();
</span><span class="cx">             graphicsContext.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
</span><span class="cx">             graphicsContext.setFillColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
</span><del>-            graphicsContext.drawLine(IntPoint(0, currentHeight),
-                                     IntPoint(pageWidth, currentHeight));
</del><ins>+            graphicsContext.drawLine(IntPoint(0, boundaryLineY), IntPoint(pageWidth, boundaryLineY));
</ins><span class="cx">             graphicsContext.restore();
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePrintContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PrintContext.h (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PrintContext.h        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebCore/page/PrintContext.h        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -73,11 +73,11 @@
</span><span class="cx">     WEBCORE_EXPORT static String pageProperty(Frame*, const char* propertyName, int pageNumber);
</span><span class="cx">     WEBCORE_EXPORT static bool isPageBoxVisible(Frame*, int pageNumber);
</span><span class="cx">     WEBCORE_EXPORT static String pageSizeAndMarginsInPixels(Frame*, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
</span><del>-    WEBCORE_EXPORT static int numberOfPages(Frame*, const FloatSize&amp; pageSizeInPixels);
</del><ins>+    WEBCORE_EXPORT static int numberOfPages(Frame&amp;, const FloatSize&amp; pageSizeInPixels);
</ins><span class="cx">     // Draw all pages into a graphics context with lines which mean page boundaries.
</span><span class="cx">     // The height of the graphics context should be
</span><span class="cx">     // (pageSizeInPixels.height() + 1) * number-of-pages - 1
</span><del>-    WEBCORE_EXPORT static void spoolAllPagesWithBoundaries(Frame*, GraphicsContext&amp;, const FloatSize&amp; pageSizeInPixels);
</del><ins>+    WEBCORE_EXPORT static void spoolAllPagesWithBoundaries(Frame&amp;, GraphicsContext&amp;, const FloatSize&amp; pageSizeInPixels);
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     Frame* m_frame;
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void computePageRectsWithPageSizeInternal(const FloatSize&amp; pageSizeInPixels, bool allowHorizontalTiling);
</span><ins>+    bool beginAndComputePageRectsWithPageSize(Frame&amp;, const FloatSize&amp; pageSizeInPixels);
</ins><span class="cx"> 
</span><span class="cx">     // Used to prevent misuses of begin() and end() (e.g., call end without begin).
</span><span class="cx">     bool m_isPrinting;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1991,7 +1991,7 @@
</span><span class="cx">     if (!frame())
</span><span class="cx">         return -1;
</span><span class="cx"> 
</span><del>-    return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight));
</del><ins>+    return PrintContext::numberOfPages(*frame(), FloatSize(pageWidth, pageHeight));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode&amp; ec) const
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-09-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        printing does not use minimum page zoom factor
+        https://bugs.webkit.org/show_bug.cgi?id=108507
+
+        Reviewed by Darin Adler.
+
+        Pass a the frame as a reference instead of using pointers.
+
+        * Misc/WebCoreStatistics.mm:
+        (-[WebFrame numberOfPagesWithPageWidth:pageHeight:]):
+        (-[WebFrame printToCGContext:pageWidth:pageHeight:]):
+
</ins><span class="cx"> 2015-09-16  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebCoreStatisticsmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -276,7 +276,11 @@
</span><span class="cx"> 
</span><span class="cx"> - (int)numberOfPagesWithPageWidth:(float)pageWidthInPixels pageHeight:(float)pageHeightInPixels
</span><span class="cx"> {
</span><del>-    return PrintContext::numberOfPages(_private-&gt;coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
</del><ins>+    Frame* coreFrame = _private-&gt;coreFrame;
+    if (!coreFrame)
+        return -1;
+
+    return PrintContext::numberOfPages(*coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)printToCGContext:(CGContextRef)cgContext pageWidth:(float)pageWidthInPixels pageHeight:(float)pageHeightInPixels
</span><span class="lines">@@ -286,7 +290,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     GraphicsContext graphicsContext(cgContext);
</span><del>-    PrintContext::spoolAllPagesWithBoundaries(coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels));
</del><ins>+    PrintContext::spoolAllPagesWithBoundaries(*coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit2/ChangeLog        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-09-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        printing does not use minimum page zoom factor
+        https://bugs.webkit.org/show_bug.cgi?id=108507
+
+        Reviewed by Darin Adler.
+
+        Add kWKSnapshotOptionsPrinting flag to indicate the snapshot
+        should be generated in printing mode.
+
+        * Shared/API/c/WKImage.h:
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toSnapshotOptions):
+        * Shared/ImageOptions.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::numberOfPages): Pass the frame as a
+        reference instead of a pointer.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaledSnapshotWithOptions): In case of printing,
+        calculate the bitmap height based on the number of pages.
+        (WebKit::WebPage::snapshotAtSize): In case of printing, use
+        PrintContext::spoolAllPagesWithBoundaries() and return.
+
</ins><span class="cx"> 2015-09-16  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Fix common typo &quot;supress&quot; =&gt; &quot;suppress&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcWKImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/WKImage.h (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/WKImage.h        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit2/Shared/API/c/WKImage.h        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     kWKSnapshotOptionsPaintSelectionRectangle = 1 &lt;&lt; 3,
</span><span class="cx">     kWKSnapshotOptionsForceBlackText = 1 &lt;&lt; 4,
</span><span class="cx">     kWKSnapshotOptionsForceWhiteText = 1 &lt;&lt; 5,
</span><ins>+    kWKSnapshotOptionsPrinting = 1 &lt;&lt; 6,
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t WKSnapshotOptions;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcWKSharedAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -951,6 +951,8 @@
</span><span class="cx">         snapshotOptions |= SnapshotOptionsForceBlackText;
</span><span class="cx">     if (wkSnapshotOptions &amp; kWKSnapshotOptionsForceWhiteText)
</span><span class="cx">         snapshotOptions |= SnapshotOptionsForceWhiteText;
</span><ins>+    if (wkSnapshotOptions &amp; kWKSnapshotOptionsPrinting)
+        snapshotOptions |= SnapshotOptionsPrinting;
</ins><span class="cx"> 
</span><span class="cx">     return snapshotOptions;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedImageOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ImageOptions.h (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ImageOptions.h        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit2/Shared/ImageOptions.h        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx">     SnapshotOptionsExcludeDeviceScaleFactor = 1 &lt;&lt; 5,
</span><span class="cx">     SnapshotOptionsForceBlackText = 1 &lt;&lt; 6,
</span><span class="cx">     SnapshotOptionsForceWhiteText = 1 &lt;&lt; 7,
</span><ins>+    SnapshotOptionsPrinting = 1 &lt;&lt; 8,
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t SnapshotOptions;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx">     if (!pageHeightInPixels)
</span><span class="cx">         pageHeightInPixels = coreFrame-&gt;view()-&gt;height();
</span><span class="cx"> 
</span><del>-    return PrintContext::numberOfPages(coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
</del><ins>+    return PrintContext::numberOfPages(*coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int InjectedBundle::pageNumberForElementById(WebFrame* frame, const String&amp; id, double pageWidthInPixels, double pageHeightInPixels)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1711,10 +1711,18 @@
</span><span class="cx"> {
</span><span class="cx">     IntRect snapshotRect = rect;
</span><span class="cx">     IntSize bitmapSize = snapshotRect.size();
</span><del>-    double scaleFactor = additionalScaleFactor;
-    if (!(options &amp; SnapshotOptionsExcludeDeviceScaleFactor))
-        scaleFactor *= corePage()-&gt;deviceScaleFactor();
-    bitmapSize.scale(scaleFactor);
</del><ins>+    if (options &amp; SnapshotOptionsPrinting) {
+        ASSERT(additionalScaleFactor == 1);
+        Frame* coreFrame = m_mainFrame-&gt;coreFrame();
+        if (!coreFrame)
+            return nullptr;
+        bitmapSize.setHeight(PrintContext::numberOfPages(*coreFrame, bitmapSize) * (bitmapSize.height() + 1) - 1);
+    } else {
+        double scaleFactor = additionalScaleFactor;
+        if (!(options &amp; SnapshotOptionsExcludeDeviceScaleFactor))
+            scaleFactor *= corePage()-&gt;deviceScaleFactor();
+        bitmapSize.scale(scaleFactor);
+    }
</ins><span class="cx"> 
</span><span class="cx">     return snapshotAtSize(rect, bitmapSize, options);
</span><span class="cx"> }
</span><span class="lines">@@ -1740,6 +1748,11 @@
</span><span class="cx"> 
</span><span class="cx">     auto graphicsContext = snapshot-&gt;bitmap()-&gt;createGraphicsContext();
</span><span class="cx"> 
</span><ins>+    if (options &amp; SnapshotOptionsPrinting) {
+        PrintContext::spoolAllPagesWithBoundaries(*coreFrame, *graphicsContext, snapshotRect.size());
+        return snapshot.release();
+    }
+
</ins><span class="cx">     Color documentBackgroundColor = frameView-&gt;documentBackgroundColor();
</span><span class="cx">     Color backgroundColor = (coreFrame-&gt;settings().backgroundShouldExtendBeyondPage() &amp;&amp; documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView-&gt;baseBackgroundColor();
</span><span class="cx">     graphicsContext-&gt;fillRect(IntRect(IntPoint(), bitmapSize), backgroundColor, ColorSpaceDeviceRGB);
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Tools/ChangeLog        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2015-09-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        printing does not use minimum page zoom factor
+        https://bugs.webkit.org/show_bug.cgi?id=108507
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner always takes the snapshots from the UI process
+        (expect for IOS), so in the case of printing, the layout in the
+        web view is not the expected one. When printing, we need to take
+        the snapshot in the web process and ensure it's rendered with a
+        PrintContext.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::dump): When dumping pixels, pass
+        kWKSnapshotOptionsPrinting option to
+        WKBundlePageCreateSnapshotWithOptions() when printing. When not
+        printing, don't even create the snapshot, since it will be ignored
+        by the UI process that always creates its own from the WebView (expect for IOS platform)
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::dumpResults): Use always the snapshot image
+        received from the web process if any when comparing pixel
+        results. Now we only receive a snapshot from the web process in
+        case of printing, or when platform is IOS. Otherwhise, generate
+        the snapshot from the WebView as usual.
+        * WebKitTestRunner/TestInvocation.h: Add SnapshotResultType enum
+        parameter to dumpPixelsAndCompareWithExpected, since the snapshot
+        is created by the caller now, but the CG implementation needs to
+        know if it's a Web or UI process snapshot.
+        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Create a
+        cairo surface for the given image.
+        * WebKitTestRunner/cg/TestInvocationCG.cpp:
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Create a
+        CGContext for the given image.
+
</ins><span class="cx"> 2015-09-16  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Create a font which can be used for testing font features
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -889,12 +889,26 @@
</span><span class="cx">         injectedBundle.dumpBackForwardListsForAllPages(stringBuilder);
</span><span class="cx"> 
</span><span class="cx">     if (injectedBundle.shouldDumpPixels() &amp;&amp; injectedBundle.testRunner()-&gt;shouldDumpPixels()) {
</span><del>-        WKSnapshotOptions options = kWKSnapshotOptionsShareable | kWKSnapshotOptionsInViewCoordinates;
-        if (injectedBundle.testRunner()-&gt;shouldDumpSelectionRect())
-            options |= kWKSnapshotOptionsPaintSelectionRectangle;
</del><ins>+        WKSnapshotOptions options = kWKSnapshotOptionsShareable;
+        WKRect snapshotRect = WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page));
+        bool shouldCreateSnapshot = false;
+        if (injectedBundle.testRunner()-&gt;isPrinting()) {
+            shouldCreateSnapshot = true;
+            options |= kWKSnapshotOptionsPrinting;
+        } else {
+#if PLATFORM(IOS)
+            // Only IOS needs to generate the snapshot in the web process, all other ports generate
+            // a snapshot from the web view contents in the UI process.
+            shouldCreateSnapshot = true;
+            options |= kWKSnapshotOptionsInViewCoordinates;
+            if (injectedBundle.testRunner()-&gt;shouldDumpSelectionRect())
+                options |= kWKSnapshotOptionsPaintSelectionRectangle;
+#endif
+        }
</ins><span class="cx"> 
</span><del>-        injectedBundle.setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), options)).get());
-        if (WKBundlePageIsTrackingRepaints(m_page))
</del><ins>+        if (shouldCreateSnapshot)
+            injectedBundle.setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, snapshotRect, options)).get());
+        if (WKBundlePageIsTrackingRepaints(m_page) &amp;&amp; !injectedBundle.testRunner()-&gt;isPrinting())
</ins><span class="cx">             injectedBundle.setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -267,16 +267,22 @@
</span><span class="cx">     else
</span><span class="cx">         dumpAudio(m_audioResult.get());
</span><span class="cx"> 
</span><del>-    if (m_dumpPixels &amp;&amp; m_pixelResult) {
-        m_gotRepaint = false;
-        WKPageForceRepaint(TestController::singleton().mainWebView()-&gt;page(), this, TestInvocation::forceRepaintDoneCallback);
-        TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
-        if (!m_gotRepaint) {
-            m_errorMessage = &quot;Timed out waiting for pre-pixel dump repaint\n&quot;;
-            m_webProcessIsUnresponsive = true;
-            return;
</del><ins>+    if (m_dumpPixels) {
+        if (m_pixelResult)
+            dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get(), TestInvocation::SnapshotResultType::WebContents);
+        else {
+            m_gotRepaint = false;
+            WKPageForceRepaint(TestController::singleton().mainWebView()-&gt;page(), this, TestInvocation::forceRepaintDoneCallback);
+            TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
+            if (!m_gotRepaint) {
+                m_errorMessage = &quot;Timed out waiting for pre-pixel dump repaint\n&quot;;
+                m_webProcessIsUnresponsive = true;
+                return;
+            }
+            WKRetainPtr&lt;WKImageRef&gt; windowSnapshot = TestController::singleton().mainWebView()-&gt;windowSnapshotImage();
+            ASSERT(windowSnapshot);
+            dumpPixelsAndCompareWithExpected(windowSnapshot.get(), m_repaintRects.get(), TestInvocation::SnapshotResultType::WebView);
</ins><span class="cx">         }
</span><del>-        dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get());
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     fputs(&quot;#EOF\n&quot;, stdout);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.h        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -63,7 +63,8 @@
</span><span class="cx"> private:
</span><span class="cx">     void dumpResults();
</span><span class="cx">     static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false);
</span><del>-    void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects);
</del><ins>+    enum class SnapshotResultType { WebView, WebContents };
+    void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects, SnapshotResultType);
</ins><span class="cx">     void dumpAudio(WKDataRef);
</span><span class="cx">     bool compareActualHashToExpectedAndDumpResults(const char[33]);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercairoTestInvocationCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -106,9 +106,9 @@
</span><span class="cx">     cairo_destroy(context);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects)
</del><ins>+void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects, SnapshotResultType)
</ins><span class="cx"> {
</span><del>-    cairo_surface_t* surface = WKImageCreateCairoSurface(TestController::singleton().mainWebView()-&gt;windowSnapshotImage().get());
</del><ins>+    cairo_surface_t* surface = WKImageCreateCairoSurface(image);
</ins><span class="cx"> 
</span><span class="cx">     if (repaintRects)
</span><span class="cx">         paintRepaintRectOverlay(surface, repaintRects);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercgTestInvocationCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp (189907 => 189908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp        2015-09-17 06:51:50 UTC (rev 189907)
+++ trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp        2015-09-17 07:24:50 UTC (rev 189908)
</span><span class="lines">@@ -154,17 +154,10 @@
</span><span class="cx">     CGContextRestoreGState(context);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects)
</del><ins>+void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects, SnapshotResultType snapshotType)
</ins><span class="cx"> {
</span><del>-    PlatformWebView* webView = TestController::singleton().mainWebView();
-    WKRetainPtr&lt;WKImageRef&gt; windowSnapshot = webView-&gt;windowSnapshotImage();
</del><ins>+    RetainPtr&lt;CGContextRef&gt; context = adoptCF(createCGContextFromImage(image, snapshotType == SnapshotResultType::WebView ? DontFlipGraphicsContext : FlipGraphicsContext));
</ins><span class="cx"> 
</span><del>-    RetainPtr&lt;CGContextRef&gt; context;
-    if (windowSnapshot)
-        context = adoptCF(createCGContextFromImage(windowSnapshot.get(), DontFlipGraphicsContext));
-    else
-        context = adoptCF(createCGContextFromImage(image));
-
</del><span class="cx">     // A non-null repaintRects array means we're doing a repaint test.
</span><span class="cx">     if (repaintRects)
</span><span class="cx">         paintRepaintRectOverlay(context.get(), image, repaintRects);
</span></span></pre>
</div>
</div>

</body>
</html>