Changeset 63521 in webkit
- Timestamp:
- Jul 15, 2010 11:25:48 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r63520 r63521 1 2010-07-15 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Printing test results differ between machines, we should use ImageDiff instead 6 https://bugs.webkit.org/show_bug.cgi?id=20011 7 8 Added printing/setPrinting.html to check there is the page boundary. 9 10 Enabled printing/composite-layer-printing.html with setPrinting. 11 12 The result of printing/media-queries-print.html shrunk because of 13 PrintingMinimumShrinkFactor in PrintContext::begin(). 14 15 * platform/mac/Skipped: 16 * platform/mac/printing/compositing-layer-printing-expected.checksum: Added. 17 * platform/mac/printing/compositing-layer-printing-expected.png: Added. 18 * platform/mac/printing/compositing-layer-printing-expected.txt: Added. 19 * platform/mac/printing/media-queries-print-expected.checksum: 20 * platform/mac/printing/media-queries-print-expected.png: 21 * platform/mac/printing/setPrinting-expected.checksum: Added. 22 * platform/mac/printing/setPrinting-expected.png: Added. 23 * platform/mac/printing/setPrinting-expected.txt: Added. 24 * printing/compositing-layer-printing.html: 25 * printing/setPrinting.html: Added. 26 1 27 2010-07-15 MORITA Hajime <morrita@google.com> 2 28 -
trunk/LayoutTests/platform/gtk/Skipped
r63454 r63521 5862 5862 # Directory upload is not enabled. 5863 5863 fast/forms/input-file-directory-upload.html 5864 5865 # Need setPrinting. See https://bugs.webkit.org/show_bug.cgi?id=20011 5866 printing/setPrinting.html -
trunk/LayoutTests/platform/mac/Skipped
r63454 r63521 35 35 # see bug <rdar://problem/5646437> REGRESSION (r28015): svg/batik/text/smallFonts fails 36 36 svg/batik/text/smallFonts.svg 37 38 # see bug https://bugs.webkit.org/show_bug.cgi?id=20011 -- Printing tests should use ImageDiff39 printing/compositing-layer-printing.html40 37 41 38 # Skip because fix for https://bugs.webkit.org/show_bug.cgi?id=26770 was reverted -
trunk/LayoutTests/platform/mac/printing/media-queries-print-expected.checksum
r58396 r63521 1 6090d2b0a19649aba8a379f982a345d3 1 9ea3bf56e7033cfee8a2beb3a800d85f -
trunk/LayoutTests/platform/qt/Skipped
r63454 r63521 5464 5464 # Directory upload is not enabled. 5465 5465 fast/forms/input-file-directory-upload.html 5466 5467 # Need setPrinting. See https://bugs.webkit.org/show_bug.cgi?id=20011 5468 printing/setPrinting.html -
trunk/LayoutTests/platform/win/Skipped
r63454 r63521 957 957 # Directory upload is not enabled. 958 958 fast/forms/input-file-directory-upload.html 959 960 # Need setPrinting. See https://bugs.webkit.org/show_bug.cgi?id=20011 961 printing/setPrinting.html -
trunk/LayoutTests/printing/compositing-layer-printing.html
r51718 r63521 14 14 <script> 15 15 if (window.layoutTestController) 16 layoutTestController. printToPDF();16 layoutTestController.setPrinting(); 17 17 </script> 18 18 </head> -
trunk/WebCore/ChangeLog
r63518 r63521 1 2010-07-15 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Printing test results differ between machines, we should use ImageDiff instead 6 https://bugs.webkit.org/show_bug.cgi?id=20011 7 8 Added spoolAllPagesWithBoundaries into PrintContext. 9 10 Test: printing/setPrinting.html 11 12 * WebCore.base.exp: 13 * page/PrintContext.cpp: 14 (WebCore::PrintContext::spoolAllPagesWithBoundaries): 15 * page/PrintContext.h: 16 1 17 2010-07-15 Kent Tamura <tkent@chromium.org> 2 18 -
trunk/WebCore/WebCore.exp.in
r63462 r63521 256 256 __ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE 257 257 __ZN7WebCore12PrintContext26pageSizeAndMarginsInPixelsEPNS_5FrameEiiiiiii 258 __ZN7WebCore12PrintContext27spoolAllPagesWithBoundariesEPNS_5FrameERNS_15GraphicsContextERKNS_9FloatSizeE 258 259 __ZN7WebCore12PrintContext28computePageRectsWithPageSizeERKNS_9FloatSizeEb 259 260 __ZN7WebCore12PrintContextC1EPNS_5FrameE -
trunk/WebCore/page/PrintContext.cpp
r61975 r63521 245 245 } 246 246 247 } 247 void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext& graphicsContext, const FloatSize& pageSizeInPixels) 248 { 249 if (!frame->document() || !frame->view() || !frame->document()->renderer()) 250 return; 251 252 frame->document()->updateLayout(); 253 254 PrintContext printContext(frame); 255 printContext.begin(pageSizeInPixels.width()); 256 257 float pageHeight; 258 printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight); 259 260 const float pageWidth = pageSizeInPixels.width(); 261 const Vector<IntRect>& pageRects = printContext.pageRects(); 262 int totalHeight = pageRects.size() * (pageSizeInPixels.height() + 1) - 1; 263 264 // Fill the whole background by white. 265 graphicsContext.setFillColor(Color(255, 255, 255), DeviceColorSpace); 266 graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight)); 267 268 graphicsContext.save(); 269 graphicsContext.translate(0, totalHeight); 270 graphicsContext.scale(FloatSize(1, -1)); 271 272 int currentHeight = 0; 273 for (size_t pageIndex = 0; pageIndex < pageRects.size(); pageIndex++) { 274 // Draw a line for a page boundary if this isn't the first page. 275 if (pageIndex > 0) { 276 graphicsContext.save(); 277 graphicsContext.setStrokeColor(Color(0, 0, 255), DeviceColorSpace); 278 graphicsContext.setFillColor(Color(0, 0, 255), DeviceColorSpace); 279 graphicsContext.drawLine(IntPoint(0, currentHeight), 280 IntPoint(pageWidth, currentHeight)); 281 graphicsContext.restore(); 282 } 283 284 graphicsContext.save(); 285 graphicsContext.translate(0, currentHeight); 286 printContext.spoolPage(graphicsContext, pageIndex, pageWidth); 287 graphicsContext.restore(); 288 289 currentHeight += pageSizeInPixels.height() + 1; 290 } 291 292 graphicsContext.restore(); 293 } 294 295 } -
trunk/WebCore/page/PrintContext.h
r61975 r63521 60 60 static String pageSizeAndMarginsInPixels(Frame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft); 61 61 static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels); 62 // Draw all pages into a graphics context with lines which mean page boundaries. 63 // The height of the graphics context should be 64 // (pageSizeInPixels.height() + 1) * number-of-pages - 1 65 static void spoolAllPagesWithBoundaries(Frame*, GraphicsContext&, const FloatSize& pageSizeInPixels); 62 66 63 67 protected: -
trunk/WebKit/mac/ChangeLog
r63445 r63521 1 2010-07-15 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Printing test results differ between machines, we should use ImageDiff instead 6 https://bugs.webkit.org/show_bug.cgi?id=20011 7 8 * Misc/WebCoreStatistics.h: 9 * Misc/WebCoreStatistics.mm: 10 (-[WebFrame printToCGContext:cgContext:pageWidthInPixels:]): 11 1 12 2010-07-15 Daniel Bates <dbates@rim.com> 2 13 -
trunk/WebKit/mac/Misc/WebCoreStatistics.h
r61975 r63521 91 91 - (bool)isPageBoxVisible:(int)pageNumber; 92 92 - (NSString *)pageSizeAndMarginsInPixels:(int)pageNumber:(int)width:(int)height:(int)marginTop:(int)marginRight:(int)marginBottom:(int)marginLeft; 93 - (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels; 93 94 @end -
trunk/WebKit/mac/Misc/WebCoreStatistics.mm
r61975 r63521 38 38 #import <WebCore/GCController.h> 39 39 #import <WebCore/GlyphPageTreeNode.h> 40 #import <WebCore/GraphicsContext.h> 40 41 #import <WebCore/IconDatabase.h> 41 42 #import <WebCore/JSDOMWindow.h> … … 290 291 return PrintContext::pageSizeAndMarginsInPixels(_private->coreFrame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft); 291 292 } 293 294 - (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels 295 { 296 Frame* coreFrame = _private->coreFrame; 297 if (!coreFrame) 298 return; 299 300 GraphicsContext graphicsContext(cgContext); 301 PrintContext::spoolAllPagesWithBoundaries(coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels)); 302 } 303 292 304 @end -
trunk/WebKitTools/ChangeLog
r63508 r63521 1 2010-07-15 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Printing test results differ between machines, we should use ImageDiff instead 6 https://bugs.webkit.org/show_bug.cgi?id=20011 7 8 * DumpRenderTree/PixelDumpSupport.cpp: 9 (dumpWebViewAsPixelsAndCompareWithExpected): 10 * DumpRenderTree/PixelDumpSupport.h: 11 * DumpRenderTree/mac/PixelDumpSupportMac.mm: 12 (createBitmapContext): This function was added to share bitmap context creation code. 13 (createBitmapContextFromWebView): 14 (createPagedBitmapContext): 15 1 16 2010-07-15 Yuta Kitamura <yutak@chromium.org> 2 17 -
trunk/WebKitTools/DumpRenderTree/PixelDumpSupport.cpp
r63130 r63521 43 43 void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash) 44 44 { 45 RefPtr<BitmapContext> context = createBitmapContextFromWebView(gLayoutTestController->testOnscreen(), gLayoutTestController->testRepaint(), gLayoutTestController->testRepaintSweepHorizontally(), gLayoutTestController->dumpSelectionRect()); 45 RefPtr<BitmapContext> context; 46 if (gLayoutTestController->isPrinting()) 47 context = createPagedBitmapContext(); 48 else 49 context = createBitmapContextFromWebView(gLayoutTestController->testOnscreen(), gLayoutTestController->testRepaint(), gLayoutTestController->testRepaintSweepHorizontally(), gLayoutTestController->dumpSelectionRect()); 46 50 ASSERT(context); 47 51 -
trunk/WebKitTools/DumpRenderTree/PixelDumpSupport.h
r45505 r63521 37 37 38 38 void computeMD5HashStringForBitmapContext(BitmapContext*, char hashString[33]); 39 PassRefPtr<BitmapContext> createPagedBitmapContext(); 39 40 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect); 40 41 void dumpBitmap(BitmapContext*); -
trunk/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
r46340 r63521 39 39 #include <wtf/RefPtr.h> 40 40 41 #import <WebKit/WebCoreStatistics.h> 41 42 #import <WebKit/WebDocumentPrivate.h> 42 43 #import <WebKit/WebHTMLViewPrivate.h> … … 105 106 } 106 107 107 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect) 108 { 109 WebView* view = [mainFrame webView]; 110 111 // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path 112 // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled. 113 if ([view _isUsingAcceleratedCompositing]) 114 onscreen = YES; 115 116 NSSize webViewSize = [view frame].size; 117 size_t pixelsWide = static_cast<size_t>(webViewSize.width); 118 size_t pixelsHigh = static_cast<size_t>(webViewSize.height); 108 static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t pixelsHigh) 109 { 119 110 size_t rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance 120 111 … … 141 132 } 142 133 143 // The BitmapContext keeps the CGContextRef and the pixel buffer alive 144 RefPtr<BitmapContext> bitmapContext = BitmapContext::createByAdoptingBitmapAndContext(buffer, context); 145 134 return BitmapContext::createByAdoptingBitmapAndContext(buffer, context); 135 } 136 137 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect) 138 { 139 WebView* view = [mainFrame webView]; 140 141 // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path 142 // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled. 143 if ([view _isUsingAcceleratedCompositing]) 144 onscreen = YES; 145 146 NSSize webViewSize = [view frame].size; 147 size_t pixelsWide = static_cast<size_t>(webViewSize.width); 148 size_t pixelsHigh = static_cast<size_t>(webViewSize.height); 149 RefPtr<BitmapContext> bitmapContext = createBitmapContext(pixelsWide, pixelsHigh); 150 if (!bitmapContext) 151 return 0; 152 CGContextRef context = bitmapContext->cgContext(); 153 146 154 NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]; 147 155 ASSERT(nsContext); … … 255 263 return bitmapContext.release(); 256 264 } 265 266 PassRefPtr<BitmapContext> createPagedBitmapContext() 267 { 268 int pageWidthInPixels = LayoutTestController::maxViewWidth; 269 int pageHeightInPixels = LayoutTestController::maxViewHeight; 270 int numberOfPages = [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels]; 271 272 RefPtr<BitmapContext> bitmapContext = createBitmapContext(pageWidthInPixels, numberOfPages * (pageHeightInPixels + 1) - 1); 273 [mainFrame printToCGContext:bitmapContext->cgContext():pageWidthInPixels:pageHeightInPixels]; 274 return bitmapContext.release(); 275 }
Note: See TracChangeset
for help on using the changeset viewer.