| Differences between
and this patch
- a/LayoutTests/ChangeLog +12 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2015-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        printing does not use minimum page zoom factor
4
        https://bugs.webkit.org/show_bug.cgi?id=108507
5
6
        Reviewed by Darin Adler.
7
8
        Unskip printing reftests that should pass now.
9
10
        * platform/gtk/TestExpectations:
11
        * platform/mac-wk2/TestExpectations:
12
1
2015-09-16  Ryosuke Niwa  <rniwa@webkit.org>
13
2015-09-16  Ryosuke Niwa  <rniwa@webkit.org>
2
14
3
        Add failing expectation to css3/font-feature-settings-rendering-2.html on Mavericks.
15
        Add failing expectation to css3/font-feature-settings-rendering-2.html on Mavericks.
- a/LayoutTests/platform/gtk/TestExpectations -4 lines
Lines 2406-2415 webkit.org/b/143871 svg/W3C-SVG-1.1-SE/linking-uri-01-b.svg [ Failure ] a/LayoutTests/platform/gtk/TestExpectations_sec1
2406
2406
2407
webkit.org/b/143924 fast/text/hyphen-min-preferred-width.html [ Skip ]
2407
webkit.org/b/143924 fast/text/hyphen-min-preferred-width.html [ Skip ]
2408
2408
2409
webkit.org/b/144494 printing/quirks-percentage-height-body.html [ ImageOnlyFailure ]
2410
webkit.org/b/144494 printing/quirks-percentage-height.html [ ImageOnlyFailure ]
2411
webkit.org/b/144494 printing/standards-percentage-heights.html [ ImageOnlyFailure ]
2412
2413
webkit.org/b/144575 http/tests/loading/promote-img-preload-priority.html [ Failure ]
2409
webkit.org/b/144575 http/tests/loading/promote-img-preload-priority.html [ Failure ]
2414
2410
2415
webkit.org/b/144673 fast/forms/button-line-height.html [ ImageOnlyFailure ]
2411
webkit.org/b/144673 fast/forms/button-line-height.html [ ImageOnlyFailure ]
- a/LayoutTests/platform/mac-wk2/TestExpectations -4 lines
Lines 196-205 webkit.org/b/105954 http/tests/navigation/reload-subframe-object.html [ Failure a/LayoutTests/platform/mac-wk2/TestExpectations_sec1
196
196
197
webkit.org/b/105960 plugins/navigator-plugins.html [ Failure ]
197
webkit.org/b/105960 plugins/navigator-plugins.html [ Failure ]
198
198
199
webkit.org/b/108507 printing/quirks-percentage-height-body.html [ Skip ]
200
webkit.org/b/108507 printing/quirks-percentage-height.html [ Skip ]
201
webkit.org/b/108507 printing/standards-percentage-heights.html [ Skip ]
202
203
webkit.org/b/104954 http/tests/canvas/canvas-slow-font-loading.html [ ImageOnlyFailure ]
199
webkit.org/b/104954 http/tests/canvas/canvas-slow-font-loading.html [ ImageOnlyFailure ]
204
200
205
# Flaky everywhere.
201
# Flaky everywhere.
- a/Source/WebCore/ChangeLog +17 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2015-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        printing does not use minimum page zoom factor
4
        https://bugs.webkit.org/show_bug.cgi?id=108507
5
6
        Reviewed by Darin Adler.
7
8
        * page/PrintContext.cpp:
9
        (WebCore::PrintContext::beginAndComputePageRectsWithPageSize):
10
        Helper function to share common code from numberOfPages() and
11
        spoolAllPagesWithBoundaries().
12
        (WebCore::PrintContext::numberOfPages): Use beginAndComputePageRectsWithPageSize().
13
        (WebCore::PrintContext::spoolAllPagesWithBoundaries): Use
14
        beginAndComputePageRectsWithPageSize() and don't flip the Y axis
15
        for non Cocoa platforms.
16
        * page/PrintContext.h:
17
1
2015-09-16  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
18
2015-09-16  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2
19
3
        Remove all uses of PassRefPtr in WebCore/inspector
20
        Remove all uses of PassRefPtr in WebCore/inspector
- a/Source/WebCore/page/PrintContext.cpp -19 / +29 lines
Lines 301-332 String PrintContext::pageSizeAndMarginsInPixels(Frame* frame, int pageNumber, in a/Source/WebCore/page/PrintContext.cpp_sec1
301
           String::number(marginTop) + ' ' + String::number(marginRight) + ' ' + String::number(marginBottom) + ' ' + String::number(marginLeft);
301
           String::number(marginTop) + ' ' + String::number(marginRight) + ' ' + String::number(marginBottom) + ' ' + String::number(marginLeft);
302
}
302
}
303
303
304
int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
304
bool PrintContext::beginAndComputePageRectsWithPageSize(Frame& frame, const FloatSize& pageSizeInPixels)
305
{
305
{
306
    frame->document()->updateLayout();
306
    if (!frame.document() || !frame.view() || !frame.document()->renderView())
307
        return false;
307
308
308
    FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
309
    frame.document()->updateLayout();
309
    PrintContext printContext(frame);
310
310
    printContext.begin(pageRect.width(), pageRect.height());
311
    begin(pageSizeInPixels.width(), pageSizeInPixels.height());
311
    // Account for shrink-to-fit.
312
    // Account for shrink-to-fit.
312
    FloatSize scaledPageSize = pageSizeInPixels;
313
    FloatSize scaledPageSize = pageSizeInPixels;
313
    scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width());
314
    scaledPageSize.scale(frame.view()->contentsSize().width() / pageSizeInPixels.width());
314
    printContext.computePageRectsWithPageSize(scaledPageSize, false);
315
    computePageRectsWithPageSize(scaledPageSize, false);
315
    return printContext.pageCount();
316
317
    return true;
316
}
318
}
317
319
318
void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext& graphicsContext, const FloatSize& pageSizeInPixels)
320
int PrintContext::numberOfPages(Frame& frame, const FloatSize& pageSizeInPixels)
319
{
321
{
320
    if (!frame->document() || !frame->view() || !frame->document()->renderView())
322
    PrintContext printContext(&frame);
321
        return;
323
    if (!printContext.beginAndComputePageRectsWithPageSize(frame, pageSizeInPixels))
322
324
        return -1;
323
    frame->document()->updateLayout();
324
325
325
    PrintContext printContext(frame);
326
    return printContext.pageCount();
326
    printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height());
327
}
327
328
328
    float pageHeight;
329
void PrintContext::spoolAllPagesWithBoundaries(Frame& frame, GraphicsContext& graphicsContext, const FloatSize& pageSizeInPixels)
329
    printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight);
330
{
331
    PrintContext printContext(&frame);
332
    if (!printContext.beginAndComputePageRectsWithPageSize(frame, pageSizeInPixels))
333
        return;
330
334
331
    const float pageWidth = pageSizeInPixels.width();
335
    const float pageWidth = pageSizeInPixels.width();
332
    const Vector<IntRect>& pageRects = printContext.pageRects();
336
    const Vector<IntRect>& pageRects = printContext.pageRects();
Lines 337-354 void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext& gr a/Source/WebCore/page/PrintContext.cpp_sec2
337
    graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight));
341
    graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight));
338
342
339
    graphicsContext.save();
343
    graphicsContext.save();
344
#if PLATFORM(COCOA)
340
    graphicsContext.translate(0, totalHeight);
345
    graphicsContext.translate(0, totalHeight);
341
    graphicsContext.scale(FloatSize(1, -1));
346
    graphicsContext.scale(FloatSize(1, -1));
347
#endif
342
348
343
    int currentHeight = 0;
349
    int currentHeight = 0;
344
    for (size_t pageIndex = 0; pageIndex < pageRects.size(); pageIndex++) {
350
    for (size_t pageIndex = 0; pageIndex < pageRects.size(); pageIndex++) {
345
        // Draw a line for a page boundary if this isn't the first page.
351
        // Draw a line for a page boundary if this isn't the first page.
346
        if (pageIndex > 0) {
352
        if (pageIndex > 0) {
353
#if PLATFORM(COCOA)
354
            int boundaryLineY = currentHeight;
355
#else
356
            int boundaryLineY = currentHeight - 1;
357
#endif
347
            graphicsContext.save();
358
            graphicsContext.save();
348
            graphicsContext.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
359
            graphicsContext.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
349
            graphicsContext.setFillColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
360
            graphicsContext.setFillColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
350
            graphicsContext.drawLine(IntPoint(0, currentHeight),
361
            graphicsContext.drawLine(IntPoint(0, boundaryLineY), IntPoint(pageWidth, boundaryLineY));
351
                                     IntPoint(pageWidth, currentHeight));
352
            graphicsContext.restore();
362
            graphicsContext.restore();
353
        }
363
        }
354
364
- a/Source/WebCore/page/PrintContext.h -2 / +3 lines
Lines 73-83 public: a/Source/WebCore/page/PrintContext.h_sec1
73
    WEBCORE_EXPORT static String pageProperty(Frame*, const char* propertyName, int pageNumber);
73
    WEBCORE_EXPORT static String pageProperty(Frame*, const char* propertyName, int pageNumber);
74
    WEBCORE_EXPORT static bool isPageBoxVisible(Frame*, int pageNumber);
74
    WEBCORE_EXPORT static bool isPageBoxVisible(Frame*, int pageNumber);
75
    WEBCORE_EXPORT static String pageSizeAndMarginsInPixels(Frame*, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
75
    WEBCORE_EXPORT static String pageSizeAndMarginsInPixels(Frame*, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
76
    WEBCORE_EXPORT static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels);
76
    WEBCORE_EXPORT static int numberOfPages(Frame&, const FloatSize& pageSizeInPixels);
77
    // Draw all pages into a graphics context with lines which mean page boundaries.
77
    // Draw all pages into a graphics context with lines which mean page boundaries.
78
    // The height of the graphics context should be
78
    // The height of the graphics context should be
79
    // (pageSizeInPixels.height() + 1) * number-of-pages - 1
79
    // (pageSizeInPixels.height() + 1) * number-of-pages - 1
80
    WEBCORE_EXPORT static void spoolAllPagesWithBoundaries(Frame*, GraphicsContext&, const FloatSize& pageSizeInPixels);
80
    WEBCORE_EXPORT static void spoolAllPagesWithBoundaries(Frame&, GraphicsContext&, const FloatSize& pageSizeInPixels);
81
81
82
protected:
82
protected:
83
    Frame* m_frame;
83
    Frame* m_frame;
Lines 85-90 protected: a/Source/WebCore/page/PrintContext.h_sec2
85
85
86
private:
86
private:
87
    void computePageRectsWithPageSizeInternal(const FloatSize& pageSizeInPixels, bool allowHorizontalTiling);
87
    void computePageRectsWithPageSizeInternal(const FloatSize& pageSizeInPixels, bool allowHorizontalTiling);
88
    bool beginAndComputePageRectsWithPageSize(Frame&, const FloatSize& pageSizeInPixels);
88
89
89
    // Used to prevent misuses of begin() and end() (e.g., call end without begin).
90
    // Used to prevent misuses of begin() and end() (e.g., call end without begin).
90
    bool m_isPrinting;
91
    bool m_isPrinting;
- a/Source/WebCore/testing/Internals.cpp -1 / +1 lines
Lines 1991-1997 int Internals::numberOfPages(float pageWidth, float pageHeight) a/Source/WebCore/testing/Internals.cpp_sec1
1991
    if (!frame())
1991
    if (!frame())
1992
        return -1;
1992
        return -1;
1993
1993
1994
    return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight));
1994
    return PrintContext::numberOfPages(*frame(), FloatSize(pageWidth, pageHeight));
1995
}
1995
}
1996
1996
1997
String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode& ec) const
1997
String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode& ec) const
- a/Source/WebKit/mac/ChangeLog +13 lines
Lines 1-3 a/Source/WebKit/mac/ChangeLog_sec1
1
2015-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        printing does not use minimum page zoom factor
4
        https://bugs.webkit.org/show_bug.cgi?id=108507
5
6
        Reviewed by Darin Adler.
7
8
        Pass a the frame as a reference instead of using pointers.
9
10
        * Misc/WebCoreStatistics.mm:
11
        (-[WebFrame numberOfPagesWithPageWidth:pageHeight:]):
12
        (-[WebFrame printToCGContext:pageWidth:pageHeight:]):
13
1
2015-09-16  Brady Eidson  <beidson@apple.com>
14
2015-09-16  Brady Eidson  <beidson@apple.com>
2
15
3
        Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
16
        Have window.indexedDB.deleteDatabase return an IDBOpenDBRequest.
- a/Source/WebKit/mac/Misc/WebCoreStatistics.mm -2 / +6 lines
Lines 276-282 using namespace WebCore; a/Source/WebKit/mac/Misc/WebCoreStatistics.mm_sec1
276
276
277
- (int)numberOfPagesWithPageWidth:(float)pageWidthInPixels pageHeight:(float)pageHeightInPixels
277
- (int)numberOfPagesWithPageWidth:(float)pageWidthInPixels pageHeight:(float)pageHeightInPixels
278
{
278
{
279
    return PrintContext::numberOfPages(_private->coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
279
    Frame* coreFrame = _private->coreFrame;
280
    if (!coreFrame)
281
        return -1;
282
283
    return PrintContext::numberOfPages(*coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
280
}
284
}
281
285
282
- (void)printToCGContext:(CGContextRef)cgContext pageWidth:(float)pageWidthInPixels pageHeight:(float)pageHeightInPixels
286
- (void)printToCGContext:(CGContextRef)cgContext pageWidth:(float)pageWidthInPixels pageHeight:(float)pageHeightInPixels
Lines 286-292 using namespace WebCore; a/Source/WebKit/mac/Misc/WebCoreStatistics.mm_sec2
286
        return;
290
        return;
287
291
288
    GraphicsContext graphicsContext(cgContext);
292
    GraphicsContext graphicsContext(cgContext);
289
    PrintContext::spoolAllPagesWithBoundaries(coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels));
293
    PrintContext::spoolAllPagesWithBoundaries(*coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels));
290
}
294
}
291
295
292
@end
296
@end
- a/Source/WebKit2/ChangeLog +23 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2015-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        printing does not use minimum page zoom factor
4
        https://bugs.webkit.org/show_bug.cgi?id=108507
5
6
        Reviewed by Darin Adler.
7
8
        Add kWKSnapshotOptionsPrinting flag to indicate the snapshot
9
        should be generated in printing mode.
10
11
        * Shared/API/c/WKImage.h:
12
        * Shared/API/c/WKSharedAPICast.h:
13
        (WebKit::toSnapshotOptions):
14
        * Shared/ImageOptions.h:
15
        * WebProcess/InjectedBundle/InjectedBundle.cpp:
16
        (WebKit::InjectedBundle::numberOfPages): Pass the frame as a
17
        reference instead of a pointer.
18
        * WebProcess/WebPage/WebPage.cpp:
19
        (WebKit::WebPage::scaledSnapshotWithOptions): In case of printing,
20
        calculate the bitmap height based on the number of pages.
21
        (WebKit::WebPage::snapshotAtSize): In case of printing, use
22
        PrintContext::spoolAllPagesWithBoundaries() and return.
23
1
2015-09-16  Joseph Pecoraro  <pecoraro@apple.com>
24
2015-09-16  Joseph Pecoraro  <pecoraro@apple.com>
2
25
3
        Web Inspector: Fix common typo "supress" => "suppress"
26
        Web Inspector: Fix common typo "supress" => "suppress"
- a/Source/WebKit2/Shared/API/c/WKImage.h +1 lines
Lines 45-50 enum { a/Source/WebKit2/Shared/API/c/WKImage.h_sec1
45
    kWKSnapshotOptionsPaintSelectionRectangle = 1 << 3,
45
    kWKSnapshotOptionsPaintSelectionRectangle = 1 << 3,
46
    kWKSnapshotOptionsForceBlackText = 1 << 4,
46
    kWKSnapshotOptionsForceBlackText = 1 << 4,
47
    kWKSnapshotOptionsForceWhiteText = 1 << 5,
47
    kWKSnapshotOptionsForceWhiteText = 1 << 5,
48
    kWKSnapshotOptionsPrinting = 1 << 6,
48
};
49
};
49
typedef uint32_t WKSnapshotOptions;
50
typedef uint32_t WKSnapshotOptions;
50
51
- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +2 lines
Lines 951-956 inline SnapshotOptions toSnapshotOptions(WKSnapshotOptions wkSnapshotOptions) a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h_sec1
951
        snapshotOptions |= SnapshotOptionsForceBlackText;
951
        snapshotOptions |= SnapshotOptionsForceBlackText;
952
    if (wkSnapshotOptions & kWKSnapshotOptionsForceWhiteText)
952
    if (wkSnapshotOptions & kWKSnapshotOptionsForceWhiteText)
953
        snapshotOptions |= SnapshotOptionsForceWhiteText;
953
        snapshotOptions |= SnapshotOptionsForceWhiteText;
954
    if (wkSnapshotOptions & kWKSnapshotOptionsPrinting)
955
        snapshotOptions |= SnapshotOptionsPrinting;
954
956
955
    return snapshotOptions;
957
    return snapshotOptions;
956
}
958
}
- a/Source/WebKit2/Shared/ImageOptions.h +1 lines
Lines 40-45 enum { a/Source/WebKit2/Shared/ImageOptions.h_sec1
40
    SnapshotOptionsExcludeDeviceScaleFactor = 1 << 5,
40
    SnapshotOptionsExcludeDeviceScaleFactor = 1 << 5,
41
    SnapshotOptionsForceBlackText = 1 << 6,
41
    SnapshotOptionsForceBlackText = 1 << 6,
42
    SnapshotOptionsForceWhiteText = 1 << 7,
42
    SnapshotOptionsForceWhiteText = 1 << 7,
43
    SnapshotOptionsPrinting = 1 << 8,
43
};
44
};
44
typedef uint32_t SnapshotOptions;
45
typedef uint32_t SnapshotOptions;
45
46
- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp -1 / +1 lines
Lines 407-413 int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, dou a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp_sec1
407
    if (!pageHeightInPixels)
407
    if (!pageHeightInPixels)
408
        pageHeightInPixels = coreFrame->view()->height();
408
        pageHeightInPixels = coreFrame->view()->height();
409
409
410
    return PrintContext::numberOfPages(coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
410
    return PrintContext::numberOfPages(*coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
411
}
411
}
412
412
413
int InjectedBundle::pageNumberForElementById(WebFrame* frame, const String& id, double pageWidthInPixels, double pageHeightInPixels)
413
int InjectedBundle::pageNumberForElementById(WebFrame* frame, const String& id, double pageWidthInPixels, double pageHeightInPixels)
- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp -4 / +17 lines
Lines 1711-1720 PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, dou a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp_sec1
1711
{
1711
{
1712
    IntRect snapshotRect = rect;
1712
    IntRect snapshotRect = rect;
1713
    IntSize bitmapSize = snapshotRect.size();
1713
    IntSize bitmapSize = snapshotRect.size();
1714
    double scaleFactor = additionalScaleFactor;
1714
    if (options & SnapshotOptionsPrinting) {
1715
    if (!(options & SnapshotOptionsExcludeDeviceScaleFactor))
1715
        ASSERT(additionalScaleFactor == 1);
1716
        scaleFactor *= corePage()->deviceScaleFactor();
1716
        Frame* coreFrame = m_mainFrame->coreFrame();
1717
    bitmapSize.scale(scaleFactor);
1717
        if (!coreFrame)
1718
            return nullptr;
1719
        bitmapSize.setHeight(PrintContext::numberOfPages(*coreFrame, bitmapSize) * (bitmapSize.height() + 1) - 1);
1720
    } else {
1721
        double scaleFactor = additionalScaleFactor;
1722
        if (!(options & SnapshotOptionsExcludeDeviceScaleFactor))
1723
            scaleFactor *= corePage()->deviceScaleFactor();
1724
        bitmapSize.scale(scaleFactor);
1725
    }
1718
1726
1719
    return snapshotAtSize(rect, bitmapSize, options);
1727
    return snapshotAtSize(rect, bitmapSize, options);
1720
}
1728
}
Lines 1740-1745 PassRefPtr<WebImage> WebPage::snapshotAtSize(const IntRect& rect, const IntSize& a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp_sec2
1740
1748
1741
    auto graphicsContext = snapshot->bitmap()->createGraphicsContext();
1749
    auto graphicsContext = snapshot->bitmap()->createGraphicsContext();
1742
1750
1751
    if (options & SnapshotOptionsPrinting) {
1752
        PrintContext::spoolAllPagesWithBoundaries(*coreFrame, *graphicsContext, snapshotRect.size());
1753
        return snapshot.release();
1754
    }
1755
1743
    Color documentBackgroundColor = frameView->documentBackgroundColor();
1756
    Color documentBackgroundColor = frameView->documentBackgroundColor();
1744
    Color backgroundColor = (coreFrame->settings().backgroundShouldExtendBeyondPage() && documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView->baseBackgroundColor();
1757
    Color backgroundColor = (coreFrame->settings().backgroundShouldExtendBeyondPage() && documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView->baseBackgroundColor();
1745
    graphicsContext->fillRect(IntRect(IntPoint(), bitmapSize), backgroundColor, ColorSpaceDeviceRGB);
1758
    graphicsContext->fillRect(IntRect(IntPoint(), bitmapSize), backgroundColor, ColorSpaceDeviceRGB);
- a/Tools/ChangeLog +36 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2015-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        printing does not use minimum page zoom factor
4
        https://bugs.webkit.org/show_bug.cgi?id=108507
5
6
        Reviewed by Darin Adler.
7
8
        WebKitTestRunner always takes the snapshots from the UI process
9
        (expect for IOS), so in the case of printing, the layout in the
10
        web view is not the expected one. When printing, we need to take
11
        the snapshot in the web process and ensure it's rendered with a
12
        PrintContext.
13
14
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
15
        (WTR::InjectedBundlePage::dump): When dumping pixels, pass
16
        kWKSnapshotOptionsPrinting option to
17
        WKBundlePageCreateSnapshotWithOptions() when printing. When not
18
        printing, don't even create the snapshot, since it will be ignored
19
        by the UI process that always creates its own from the WebView (expect for IOS platform)
20
        * WebKitTestRunner/TestInvocation.cpp:
21
        (WTR::TestInvocation::dumpResults): Use always the snapshot image
22
        received from the web process if any when comparing pixel
23
        results. Now we only receive a snapshot from the web process in
24
        case of printing, or when platform is IOS. Otherwhise, generate
25
        the snapshot from the WebView as usual.
26
        * WebKitTestRunner/TestInvocation.h: Add SnapshotResultType enum
27
        parameter to dumpPixelsAndCompareWithExpected, since the snapshot
28
        is created by the caller now, but the CG implementation needs to
29
        know if it's a Web or UI process snapshot.
30
        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
31
        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Create a
32
        cairo surface for the given image.
33
        * WebKitTestRunner/cg/TestInvocationCG.cpp:
34
        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Create a
35
        CGContext for the given image.
36
1
2015-09-16  Myles C. Maxfield  <mmaxfield@apple.com>
37
2015-09-16  Myles C. Maxfield  <mmaxfield@apple.com>
2
38
3
        Create a font which can be used for testing font features
39
        Create a font which can be used for testing font features
- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp -5 / +19 lines
Lines 889-900 void InjectedBundlePage::dump() a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp_sec1
889
        injectedBundle.dumpBackForwardListsForAllPages(stringBuilder);
889
        injectedBundle.dumpBackForwardListsForAllPages(stringBuilder);
890
890
891
    if (injectedBundle.shouldDumpPixels() && injectedBundle.testRunner()->shouldDumpPixels()) {
891
    if (injectedBundle.shouldDumpPixels() && injectedBundle.testRunner()->shouldDumpPixels()) {
892
        WKSnapshotOptions options = kWKSnapshotOptionsShareable | kWKSnapshotOptionsInViewCoordinates;
892
        WKSnapshotOptions options = kWKSnapshotOptionsShareable;
893
        if (injectedBundle.testRunner()->shouldDumpSelectionRect())
893
        WKRect snapshotRect = WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page));
894
            options |= kWKSnapshotOptionsPaintSelectionRectangle;
894
        bool shouldCreateSnapshot = false;
895
        if (injectedBundle.testRunner()->isPrinting()) {
896
            shouldCreateSnapshot = true;
897
            options |= kWKSnapshotOptionsPrinting;
898
        } else {
899
#if PLATFORM(IOS)
900
            // Only IOS needs to generate the snapshot in the web process, all other ports generate
901
            // a snapshot from the web view contents in the UI process.
902
            shouldCreateSnapshot = true;
903
            options |= kWKSnapshotOptionsInViewCoordinates;
904
            if (injectedBundle.testRunner()->shouldDumpSelectionRect())
905
                options |= kWKSnapshotOptionsPaintSelectionRectangle;
906
#endif
907
        }
895
908
896
        injectedBundle.setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), options)).get());
909
        if (shouldCreateSnapshot)
897
        if (WKBundlePageIsTrackingRepaints(m_page))
910
            injectedBundle.setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, snapshotRect, options)).get());
911
        if (WKBundlePageIsTrackingRepaints(m_page) && !injectedBundle.testRunner()->isPrinting())
898
            injectedBundle.setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
912
            injectedBundle.setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
899
    }
913
    }
900
914
- a/Tools/WebKitTestRunner/TestInvocation.cpp -9 / +15 lines
Lines 267-282 void TestInvocation::dumpResults() a/Tools/WebKitTestRunner/TestInvocation.cpp_sec1
267
    else
267
    else
268
        dumpAudio(m_audioResult.get());
268
        dumpAudio(m_audioResult.get());
269
269
270
    if (m_dumpPixels && m_pixelResult) {
270
    if (m_dumpPixels) {
271
        m_gotRepaint = false;
271
        if (m_pixelResult)
272
        WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
272
            dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get(), TestInvocation::SnapshotResultType::WebContents);
273
        TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
273
        else {
274
        if (!m_gotRepaint) {
274
            m_gotRepaint = false;
275
            m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
275
            WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
276
            m_webProcessIsUnresponsive = true;
276
            TestController::singleton().runUntil(m_gotRepaint, TestController::shortTimeout);
277
            return;
277
            if (!m_gotRepaint) {
278
                m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
279
                m_webProcessIsUnresponsive = true;
280
                return;
281
            }
282
            WKRetainPtr<WKImageRef> windowSnapshot = TestController::singleton().mainWebView()->windowSnapshotImage();
283
            ASSERT(windowSnapshot);
284
            dumpPixelsAndCompareWithExpected(windowSnapshot.get(), m_repaintRects.get(), TestInvocation::SnapshotResultType::WebView);
278
        }
285
        }
279
        dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get());
280
    }
286
    }
281
287
282
    fputs("#EOF\n", stdout);
288
    fputs("#EOF\n", stdout);
- a/Tools/WebKitTestRunner/TestInvocation.h -1 / +2 lines
Lines 63-69 public: a/Tools/WebKitTestRunner/TestInvocation.h_sec1
63
private:
63
private:
64
    void dumpResults();
64
    void dumpResults();
65
    static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false);
65
    static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false);
66
    void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects);
66
    enum class SnapshotResultType { WebView, WebContents };
67
    void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects, SnapshotResultType);
67
    void dumpAudio(WKDataRef);
68
    void dumpAudio(WKDataRef);
68
    bool compareActualHashToExpectedAndDumpResults(const char[33]);
69
    bool compareActualHashToExpectedAndDumpResults(const char[33]);
69
70
- a/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp -2 / +2 lines
Lines 106-114 static void paintRepaintRectOverlay(cairo_surface_t* surface, WKArrayRef repaint a/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp_sec1
106
    cairo_destroy(context);
106
    cairo_destroy(context);
107
}
107
}
108
108
109
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects)
109
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects, SnapshotResultType)
110
{
110
{
111
    cairo_surface_t* surface = WKImageCreateCairoSurface(TestController::singleton().mainWebView()->windowSnapshotImage().get());
111
    cairo_surface_t* surface = WKImageCreateCairoSurface(image);
112
112
113
    if (repaintRects)
113
    if (repaintRects)
114
        paintRepaintRectOverlay(surface, repaintRects);
114
        paintRepaintRectOverlay(surface, repaintRects);
- a/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp -9 / +2 lines
Lines 154-169 static void paintRepaintRectOverlay(CGContextRef context, WKImageRef image, WKAr a/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp_sec1
154
    CGContextRestoreGState(context);
154
    CGContextRestoreGState(context);
155
}
155
}
156
156
157
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects)
157
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects, SnapshotResultType snapshotType)
158
{
158
{
159
    PlatformWebView* webView = TestController::singleton().mainWebView();
159
    RetainPtr<CGContextRef> context = adoptCF(createCGContextFromImage(image, snapshotType == SnapshotResultType::WebView ? DontFlipGraphicsContext : FlipGraphicsContext));
160
    WKRetainPtr<WKImageRef> windowSnapshot = webView->windowSnapshotImage();
161
162
    RetainPtr<CGContextRef> context;
163
    if (windowSnapshot)
164
        context = adoptCF(createCGContextFromImage(windowSnapshot.get(), DontFlipGraphicsContext));
165
    else
166
        context = adoptCF(createCGContextFromImage(image));
167
160
168
    // A non-null repaintRects array means we're doing a repaint test.
161
    // A non-null repaintRects array means we're doing a repaint test.
169
    if (repaintRects)
162
    if (repaintRects)

Return to Bug 108507