[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hamaji at chromium.org hamaji at chromium.org
Wed Dec 22 11:15:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d58d8e04898abcc9babaf789c2286af0ff604f75
Author: hamaji at chromium.org <hamaji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 16 06:25:48 2010 +0000

    2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Printing test results differ between machines, we should use ImageDiff instead
            https://bugs.webkit.org/show_bug.cgi?id=20011
    
            Added printing/setPrinting.html to check there is the page boundary.
    
            Enabled printing/composite-layer-printing.html with setPrinting.
    
            The result of printing/media-queries-print.html shrunk because of
            PrintingMinimumShrinkFactor in PrintContext::begin().
    
            * platform/mac/Skipped:
            * platform/mac/printing/compositing-layer-printing-expected.checksum: Added.
            * platform/mac/printing/compositing-layer-printing-expected.png: Added.
            * platform/mac/printing/compositing-layer-printing-expected.txt: Added.
            * platform/mac/printing/media-queries-print-expected.checksum:
            * platform/mac/printing/media-queries-print-expected.png:
            * platform/mac/printing/setPrinting-expected.checksum: Added.
            * platform/mac/printing/setPrinting-expected.png: Added.
            * platform/mac/printing/setPrinting-expected.txt: Added.
            * printing/compositing-layer-printing.html:
            * printing/setPrinting.html: Added.
    2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Printing test results differ between machines, we should use ImageDiff instead
            https://bugs.webkit.org/show_bug.cgi?id=20011
    
            Added spoolAllPagesWithBoundaries into PrintContext.
    
            Test: printing/setPrinting.html
    
            * WebCore.base.exp:
            * page/PrintContext.cpp:
            (WebCore::PrintContext::spoolAllPagesWithBoundaries):
            * page/PrintContext.h:
    2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Printing test results differ between machines, we should use ImageDiff instead
            https://bugs.webkit.org/show_bug.cgi?id=20011
    
            * Misc/WebCoreStatistics.h:
            * Misc/WebCoreStatistics.mm:
            (-[WebFrame printToCGContext:cgContext:pageWidthInPixels:]):
    2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Printing test results differ between machines, we should use ImageDiff instead
            https://bugs.webkit.org/show_bug.cgi?id=20011
    
            * DumpRenderTree/PixelDumpSupport.cpp:
            (dumpWebViewAsPixelsAndCompareWithExpected):
            * DumpRenderTree/PixelDumpSupport.h:
            * DumpRenderTree/mac/PixelDumpSupportMac.mm:
            (createBitmapContext): This function was added to share bitmap context creation code.
            (createBitmapContextFromWebView):
            (createPagedBitmapContext):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63521 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 47dda52..2706351 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,29 @@
+2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Printing test results differ between machines, we should use ImageDiff instead
+        https://bugs.webkit.org/show_bug.cgi?id=20011
+
+        Added printing/setPrinting.html to check there is the page boundary.
+
+        Enabled printing/composite-layer-printing.html with setPrinting.
+
+        The result of printing/media-queries-print.html shrunk because of
+        PrintingMinimumShrinkFactor in PrintContext::begin().
+
+        * platform/mac/Skipped:
+        * platform/mac/printing/compositing-layer-printing-expected.checksum: Added.
+        * platform/mac/printing/compositing-layer-printing-expected.png: Added.
+        * platform/mac/printing/compositing-layer-printing-expected.txt: Added.
+        * platform/mac/printing/media-queries-print-expected.checksum:
+        * platform/mac/printing/media-queries-print-expected.png:
+        * platform/mac/printing/setPrinting-expected.checksum: Added.
+        * platform/mac/printing/setPrinting-expected.png: Added.
+        * platform/mac/printing/setPrinting-expected.txt: Added.
+        * printing/compositing-layer-printing.html:
+        * printing/setPrinting.html: Added.
+
 2010-07-15  MORITA Hajime  <morrita at google.com>
 
         Unrviewed, added missing expectations.
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 0cf3a82..1813c7e 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5861,3 +5861,6 @@ http/tests/loading/preload-slow-loading.php
 
 # Directory upload is not enabled.
 fast/forms/input-file-directory-upload.html
+
+# Need setPrinting. See https://bugs.webkit.org/show_bug.cgi?id=20011
+printing/setPrinting.html
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index b65fd8f..8063621 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -35,9 +35,6 @@ fast/events/attempt-scroll-with-no-scrollbars.html
 # see bug <rdar://problem/5646437> REGRESSION (r28015): svg/batik/text/smallFonts fails
 svg/batik/text/smallFonts.svg
 
-# see bug https://bugs.webkit.org/show_bug.cgi?id=20011 -- Printing tests should use ImageDiff
-printing/compositing-layer-printing.html
-
 # Skip because fix for https://bugs.webkit.org/show_bug.cgi?id=26770 was reverted
 compositing/animation/animated-composited-inside-hidden.html
 
diff --git a/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.checksum b/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.checksum
new file mode 100644
index 0000000..af8e568
--- /dev/null
+++ b/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.checksum
@@ -0,0 +1 @@
+590ebb52f9258d18c8e95839d2823f84
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.png b/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.png
new file mode 100644
index 0000000..3cf070f
Binary files /dev/null and b/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.png differ
diff --git a/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.txt b/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.txt
new file mode 100644
index 0000000..cdaf9c2
--- /dev/null
+++ b/LayoutTests/platform/mac/printing/compositing-layer-printing-expected.txt
@@ -0,0 +1,11 @@
+layer at (0,0) size 1000x270
+  RenderView at (0,0) size 1000x270
+layer at (0,0) size 1000x270
+  RenderBlock {HTML} at (0,0) size 1000x270
+    RenderBody {BODY} at (8,16) size 984x244
+      RenderBlock {P} at (0,0) size 984x18
+        RenderText {#text} at (0,0) size 454x18
+          text run at (0,0) width 454: "You should see two green squares below on screen, and when printed."
+      RenderBlock {DIV} at (10,34) size 100x100 [bgcolor=#008000]
+layer at (18,160) size 100x100
+  RenderBlock {DIV} at (10,144) size 100x100 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/printing/media-queries-print-expected.checksum b/LayoutTests/platform/mac/printing/media-queries-print-expected.checksum
index fff49fe..62fbe44 100644
--- a/LayoutTests/platform/mac/printing/media-queries-print-expected.checksum
+++ b/LayoutTests/platform/mac/printing/media-queries-print-expected.checksum
@@ -1 +1 @@
-6090d2b0a19649aba8a379f982a345d3
\ No newline at end of file
+9ea3bf56e7033cfee8a2beb3a800d85f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/printing/media-queries-print-expected.png b/LayoutTests/platform/mac/printing/media-queries-print-expected.png
index 1f110c9..98cd556 100644
Binary files a/LayoutTests/platform/mac/printing/media-queries-print-expected.png and b/LayoutTests/platform/mac/printing/media-queries-print-expected.png differ
diff --git a/LayoutTests/platform/mac/printing/setPrinting-expected.checksum b/LayoutTests/platform/mac/printing/setPrinting-expected.checksum
new file mode 100644
index 0000000..717bf61
--- /dev/null
+++ b/LayoutTests/platform/mac/printing/setPrinting-expected.checksum
@@ -0,0 +1 @@
+acb402590109e72d730b68ed674c8708
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/printing/setPrinting-expected.png b/LayoutTests/platform/mac/printing/setPrinting-expected.png
new file mode 100644
index 0000000..c01dde6
Binary files /dev/null and b/LayoutTests/platform/mac/printing/setPrinting-expected.png differ
diff --git a/LayoutTests/platform/mac/printing/setPrinting-expected.txt b/LayoutTests/platform/mac/printing/setPrinting-expected.txt
new file mode 100644
index 0000000..caf78a3
--- /dev/null
+++ b/LayoutTests/platform/mac/printing/setPrinting-expected.txt
@@ -0,0 +1,12 @@
+layer at (0,0) size 982x785
+  RenderView at (0,0) size 982x785
+layer at (0,0) size 982x785
+  RenderBlock {HTML} at (0,0) size 982x785
+    RenderBody {BODY} at (0,0) size 982x785
+      RenderBlock {DIV} at (0,0) size 800x749 [bgcolor=#008000]
+        RenderText {#text} at (0,0) size 237x18
+          text run at (0,0) width 237: "This test case should output 2 pages."
+      RenderBlock (anonymous) at (0,749) size 982x36
+        RenderText {#text} at (0,0) size 972x36
+          text run at (0,0) width 972: "There should be a blue line above this test. This line is the boundary of 2 pages. As the height of green box is shorter than the height of a page by one"
+          text run at (0,18) width 485: "pixel, there should be a white line between the green box and the blue line."
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 1e4acd8..c30fb16 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5463,3 +5463,6 @@ inspector/timeline-recalculate-styles.html
 
 # Directory upload is not enabled.
 fast/forms/input-file-directory-upload.html
+
+# Need setPrinting. See https://bugs.webkit.org/show_bug.cgi?id=20011
+printing/setPrinting.html
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index e5ea19f..e0e5695 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -956,3 +956,6 @@ userscripts/user-style-top-frame-only.html
 
 # Directory upload is not enabled.
 fast/forms/input-file-directory-upload.html
+
+# Need setPrinting. See https://bugs.webkit.org/show_bug.cgi?id=20011
+printing/setPrinting.html
diff --git a/LayoutTests/printing/compositing-layer-printing.html b/LayoutTests/printing/compositing-layer-printing.html
index ca7efa2..8db4ca6 100644
--- a/LayoutTests/printing/compositing-layer-printing.html
+++ b/LayoutTests/printing/compositing-layer-printing.html
@@ -13,7 +13,7 @@
   </style>
   <script>
     if (window.layoutTestController)
-      layoutTestController.printToPDF();
+      layoutTestController.setPrinting();
   </script>
 </head>
 <body>
diff --git a/LayoutTests/printing/setPrinting.html b/LayoutTests/printing/setPrinting.html
new file mode 100644
index 0000000..ff31df7
--- /dev/null
+++ b/LayoutTests/printing/setPrinting.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.setPrinting();
+</script>
+</head>
+
+<body style="margin: 0px;">
+<div style="width: 800px; height: 749px; background-color: green;">
+This test case should output 2 pages.
+</div>
+There should be a blue line above this test.
+This line is the boundary of 2 pages.
+As the height of green box is shorter than the height of a page by one pixel,
+there should be a white line between the green box and the blue line.
+</div>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a4a26d2..01eb076 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Printing test results differ between machines, we should use ImageDiff instead
+        https://bugs.webkit.org/show_bug.cgi?id=20011
+
+        Added spoolAllPagesWithBoundaries into PrintContext.
+
+        Test: printing/setPrinting.html
+
+        * WebCore.base.exp:
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::spoolAllPagesWithBoundaries):
+        * page/PrintContext.h:
+
 2010-07-15  Kent Tamura  <tkent at chromium.org>
 
         Unreviewed, small style fixes.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index c9eb488..a4ed7ce 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -255,6 +255,7 @@ __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE
 __ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi
 __ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE
 __ZN7WebCore12PrintContext26pageSizeAndMarginsInPixelsEPNS_5FrameEiiiiiii
+__ZN7WebCore12PrintContext27spoolAllPagesWithBoundariesEPNS_5FrameERNS_15GraphicsContextERKNS_9FloatSizeE
 __ZN7WebCore12PrintContext28computePageRectsWithPageSizeERKNS_9FloatSizeEb
 __ZN7WebCore12PrintContextC1EPNS_5FrameE
 __ZN7WebCore12PrintContextD1Ev
diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp
index 7e1e35d..a41bed3 100644
--- a/WebCore/page/PrintContext.cpp
+++ b/WebCore/page/PrintContext.cpp
@@ -244,4 +244,52 @@ int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
     return printContext.pageCount();
 }
 
+void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext& graphicsContext, const FloatSize& pageSizeInPixels)
+{
+    if (!frame->document() || !frame->view() || !frame->document()->renderer())
+        return;
+
+    frame->document()->updateLayout();
+
+    PrintContext printContext(frame);
+    printContext.begin(pageSizeInPixels.width());
+
+    float pageHeight;
+    printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight);
+
+    const float pageWidth = pageSizeInPixels.width();
+    const Vector<IntRect>& pageRects = printContext.pageRects();
+    int totalHeight = pageRects.size() * (pageSizeInPixels.height() + 1) - 1;
+
+    // Fill the whole background by white.
+    graphicsContext.setFillColor(Color(255, 255, 255), DeviceColorSpace);
+    graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight));
+
+    graphicsContext.save();
+    graphicsContext.translate(0, totalHeight);
+    graphicsContext.scale(FloatSize(1, -1));
+
+    int currentHeight = 0;
+    for (size_t pageIndex = 0; pageIndex < pageRects.size(); pageIndex++) {
+        // Draw a line for a page boundary if this isn't the first page.
+        if (pageIndex > 0) {
+            graphicsContext.save();
+            graphicsContext.setStrokeColor(Color(0, 0, 255), DeviceColorSpace);
+            graphicsContext.setFillColor(Color(0, 0, 255), DeviceColorSpace);
+            graphicsContext.drawLine(IntPoint(0, currentHeight),
+                                     IntPoint(pageWidth, currentHeight));
+            graphicsContext.restore();
+        }
+
+        graphicsContext.save();
+        graphicsContext.translate(0, currentHeight);
+        printContext.spoolPage(graphicsContext, pageIndex, pageWidth);
+        graphicsContext.restore();
+
+        currentHeight += pageSizeInPixels.height() + 1;
+    }
+
+    graphicsContext.restore();
+}
+
 }
diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h
index 1080c29..8492718 100644
--- a/WebCore/page/PrintContext.h
+++ b/WebCore/page/PrintContext.h
@@ -59,6 +59,10 @@ public:
     static bool isPageBoxVisible(Frame* frame, int pageNumber);
     static String pageSizeAndMarginsInPixels(Frame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
     static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels);
+    // Draw all pages into a graphics context with lines which mean page boundaries.
+    // The height of the graphics context should be
+    // (pageSizeInPixels.height() + 1) * number-of-pages - 1
+    static void spoolAllPagesWithBoundaries(Frame*, GraphicsContext&, const FloatSize& pageSizeInPixels);
 
 protected:
     Frame* m_frame;
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index c2f1a74..069bcc5 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Printing test results differ between machines, we should use ImageDiff instead
+        https://bugs.webkit.org/show_bug.cgi?id=20011
+
+        * Misc/WebCoreStatistics.h:
+        * Misc/WebCoreStatistics.mm:
+        (-[WebFrame printToCGContext:cgContext:pageWidthInPixels:]):
+
 2010-07-15  Daniel Bates  <dbates at rim.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h
index 33e3e0f..1565c26 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.h
+++ b/WebKit/mac/Misc/WebCoreStatistics.h
@@ -90,4 +90,5 @@
 - (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber;
 - (bool)isPageBoxVisible:(int)pageNumber;
 - (NSString *)pageSizeAndMarginsInPixels:(int)pageNumber:(int)width:(int)height:(int)marginTop:(int)marginRight:(int)marginBottom:(int)marginLeft;
+- (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels;
 @end
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index bbe07d5..a5d5ae1 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -37,6 +37,7 @@
 #import <WebCore/Frame.h>
 #import <WebCore/GCController.h>
 #import <WebCore/GlyphPageTreeNode.h>
+#import <WebCore/GraphicsContext.h>
 #import <WebCore/IconDatabase.h>
 #import <WebCore/JSDOMWindow.h>
 #import <WebCore/PageCache.h>
@@ -289,4 +290,15 @@ using namespace WebCore;
 {
     return PrintContext::pageSizeAndMarginsInPixels(_private->coreFrame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
 }
+
+- (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels
+{
+    Frame* coreFrame = _private->coreFrame;
+    if (!coreFrame)
+        return;
+
+    GraphicsContext graphicsContext(cgContext);
+    PrintContext::spoolAllPagesWithBoundaries(coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
 @end
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8ef7428..94097dc 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-15  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Printing test results differ between machines, we should use ImageDiff instead
+        https://bugs.webkit.org/show_bug.cgi?id=20011
+
+        * DumpRenderTree/PixelDumpSupport.cpp:
+        (dumpWebViewAsPixelsAndCompareWithExpected):
+        * DumpRenderTree/PixelDumpSupport.h:
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (createBitmapContext): This function was added to share bitmap context creation code.
+        (createBitmapContextFromWebView):
+        (createPagedBitmapContext):
+
 2010-07-15  Yuta Kitamura  <yutak at chromium.org>
 
         Reviewed by Kent Tamura.
diff --git a/WebKitTools/DumpRenderTree/PixelDumpSupport.cpp b/WebKitTools/DumpRenderTree/PixelDumpSupport.cpp
index e372827..6212add 100644
--- a/WebKitTools/DumpRenderTree/PixelDumpSupport.cpp
+++ b/WebKitTools/DumpRenderTree/PixelDumpSupport.cpp
@@ -42,7 +42,11 @@
 
 void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash)
 {
-    RefPtr<BitmapContext> context = createBitmapContextFromWebView(gLayoutTestController->testOnscreen(), gLayoutTestController->testRepaint(), gLayoutTestController->testRepaintSweepHorizontally(), gLayoutTestController->dumpSelectionRect());
+    RefPtr<BitmapContext> context;
+    if (gLayoutTestController->isPrinting())
+        context = createPagedBitmapContext();
+    else
+        context = createBitmapContextFromWebView(gLayoutTestController->testOnscreen(), gLayoutTestController->testRepaint(), gLayoutTestController->testRepaintSweepHorizontally(), gLayoutTestController->dumpSelectionRect());
     ASSERT(context);
     
     // Compute the hash of the bitmap context pixels
diff --git a/WebKitTools/DumpRenderTree/PixelDumpSupport.h b/WebKitTools/DumpRenderTree/PixelDumpSupport.h
index 94c5312..e172a83 100644
--- a/WebKitTools/DumpRenderTree/PixelDumpSupport.h
+++ b/WebKitTools/DumpRenderTree/PixelDumpSupport.h
@@ -36,6 +36,7 @@
 class BitmapContext;
 
 void computeMD5HashStringForBitmapContext(BitmapContext*, char hashString[33]);
+PassRefPtr<BitmapContext> createPagedBitmapContext();
 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect);
 void dumpBitmap(BitmapContext*);
 void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash);
diff --git a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
index 0059b69..97b12bb 100644
--- a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
@@ -38,6 +38,7 @@
 #include <wtf/Assertions.h>
 #include <wtf/RefPtr.h>
 
+#import <WebKit/WebCoreStatistics.h>
 #import <WebKit/WebDocumentPrivate.h>
 #import <WebKit/WebHTMLViewPrivate.h>
 #import <WebKit/WebKit.h>
@@ -104,18 +105,8 @@ void setupMainDisplayColorProfile()
     signal(SIGTERM, restoreMainDisplayColorProfile);
 }
 
-PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
+static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t pixelsHigh)
 {
-    WebView* view = [mainFrame webView];
-
-    // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path
-    // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled.
-    if ([view _isUsingAcceleratedCompositing])
-        onscreen = YES;
-
-    NSSize webViewSize = [view frame].size;
-    size_t pixelsWide = static_cast<size_t>(webViewSize.width);
-    size_t pixelsHigh = static_cast<size_t>(webViewSize.height);
     size_t rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance
 
     void *buffer = calloc(pixelsHigh, rowBytes);
@@ -140,9 +131,26 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
         return 0;
     }
 
-    // The BitmapContext keeps the CGContextRef and the pixel buffer alive
-    RefPtr<BitmapContext> bitmapContext = BitmapContext::createByAdoptingBitmapAndContext(buffer, context);
-    
+    return BitmapContext::createByAdoptingBitmapAndContext(buffer, context);
+}
+
+PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
+{
+    WebView* view = [mainFrame webView];
+
+    // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path
+    // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled.
+    if ([view _isUsingAcceleratedCompositing])
+        onscreen = YES;
+
+    NSSize webViewSize = [view frame].size;
+    size_t pixelsWide = static_cast<size_t>(webViewSize.width);
+    size_t pixelsHigh = static_cast<size_t>(webViewSize.height);
+    RefPtr<BitmapContext> bitmapContext = createBitmapContext(pixelsWide, pixelsHigh);
+    if (!bitmapContext)
+        return 0;
+    CGContextRef context = bitmapContext->cgContext();
+
     NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
     ASSERT(nsContext);
     
@@ -254,3 +262,14 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
     
     return bitmapContext.release();
 }
+
+PassRefPtr<BitmapContext> createPagedBitmapContext()
+{
+    int pageWidthInPixels = LayoutTestController::maxViewWidth;
+    int pageHeightInPixels = LayoutTestController::maxViewHeight;
+    int numberOfPages = [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels];
+
+    RefPtr<BitmapContext> bitmapContext = createBitmapContext(pageWidthInPixels, numberOfPages * (pageHeightInPixels + 1) - 1);
+    [mainFrame printToCGContext:bitmapContext->cgContext():pageWidthInPixels:pageHeightInPixels];
+    return bitmapContext.release();
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list