Repaint tests don't work in WebKit2
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 22:19:10 +0000 (22:19 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 22:19:10 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68453

Tools:

Reviewed by Sam Weinig.

Convert DumpRenderTree to use use the repaint rects
exposed via WebKit API when generating the repaint test
overlay.

Fix WebKitTestRunner to work with repaint tests, again
using the repaint rects exposed from WK2.

In both cases, layoutTestController.display() now just
forces a display of the web view, and turns on repaint
rect tracking on the main FrameView.

Later, when pixel results are requested, the alpha overlay
that shows the repaint rects is generated using the list
of rects supplied by WebCore.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetDefaultsToConsistentValues):
(resetWebViewToConsistentStateBeforeTesting):
(displayWebView):
* DumpRenderTree/mac/PixelDumpSupportMac.mm:
(paintRepaintRectOverlay):
(createBitmapContextFromWebView):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
(WTR::InjectedBundle::done):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(WTR::InjectedBundle::setRepaintRects):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::reset):
(WTR::InjectedBundlePage::dump):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::display):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/cg/TestInvocationCG.cpp:
(WTR::paintRepaintRectOverlay):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):

LayoutTests:

Reviewed by Sam Weinig.

Update Mac results to use the new repaint rects. Differences from old results:
        * There are no longer invalidates from scrolling.
        * We no longer see the effects of AppKit rect coalescing.
        * Composting tests show the overlay now, but repaints in compositing layers do not show.

    Bad results in a couple of tests are covered by bugs 68830 and 68829.

* platform/mac/fast/repaint/4774354-expected.png:
* platform/mac/fast/repaint/block-layout-inline-children-float-positioned-expected.png:
* platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png:
* platform/mac/fast/repaint/border-radius-repaint-expected.png:
* platform/mac/fast/repaint/clipped-relative-expected.png:
* platform/mac/fast/repaint/containing-block-position-change-expected.png:
* platform/mac/fast/repaint/control-clip-expected.png:
* platform/mac/fast/repaint/delete-into-nested-block-expected.png:
* platform/mac/fast/repaint/fixed-and-absolute-position-scrolled-expected.png:
* platform/mac/fast/repaint/fixed-scroll-simple-expected.png:
* platform/mac/fast/repaint/flexible-box-overflow-expected.png:
* platform/mac/fast/repaint/flexible-box-overflow-horizontal-expected.png:
* platform/mac/fast/repaint/float-move-during-layout-expected.png:
* platform/mac/fast/repaint/float-overflow-expected.png:
* platform/mac/fast/repaint/float-overflow-right-expected.png:
* platform/mac/fast/repaint/iframe-scroll-repaint-expected.png:
* platform/mac/fast/repaint/inline-block-overflow-expected.png:
* platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.png:
* platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png:
* platform/mac/fast/repaint/layer-child-outline-expected.png:
* platform/mac/fast/repaint/layer-outline-expected.png:
* platform/mac/fast/repaint/layer-outline-horizontal-expected.png:
* platform/mac/fast/repaint/line-flow-with-floats-in-regions-expected.png:
* platform/mac/fast/repaint/line-overflow-expected.png:
* platform/mac/fast/repaint/nested-iframe-scroll-inner-expected.png:
* platform/mac/fast/repaint/nested-iframe-scroll-outer-expected.png:
* platform/mac/fast/repaint/outline-child-repaint-expected.png:
* platform/mac/fast/repaint/outline-shrinking-expected.png:
* platform/mac/fast/repaint/overflow-delete-line-expected.png:
* platform/mac/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png:
* platform/mac/fast/repaint/repaint-during-scroll-expected.png:
* platform/mac/fast/repaint/scale-page-shrink-expected.png:
* platform/mac/fast/repaint/search-field-cancel-expected.png:
* platform/mac/fast/repaint/selection-after-remove-expected.png:
* platform/mac/fast/repaint/shadow-multiple-horizontal-expected.png:
* platform/mac/fast/repaint/shadow-multiple-strict-horizontal-expected.png:
* platform/mac/fast/repaint/shadow-multiple-strict-vertical-expected.png:
* platform/mac/fast/repaint/shadow-multiple-vertical-expected.png:
* platform/mac/fast/repaint/static-to-positioned-expected.png:
* platform/mac/fast/repaint/table-cell-move-expected.png:
* platform/mac/fast/repaint/text-selection-rect-in-overflow-2-expected.png:
* platform/mac/fast/repaint/text-shadow-expected.png:
* platform/mac/fast/repaint/text-shadow-horizontal-expected.png:

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

54 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/repaint/4774354-expected.png
LayoutTests/platform/mac/fast/repaint/block-layout-inline-children-float-positioned-expected.png
LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png
LayoutTests/platform/mac/fast/repaint/border-radius-repaint-expected.png
LayoutTests/platform/mac/fast/repaint/clipped-relative-expected.png
LayoutTests/platform/mac/fast/repaint/containing-block-position-change-expected.png
LayoutTests/platform/mac/fast/repaint/control-clip-expected.png
LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.png
LayoutTests/platform/mac/fast/repaint/fixed-and-absolute-position-scrolled-expected.png
LayoutTests/platform/mac/fast/repaint/fixed-scroll-simple-expected.png
LayoutTests/platform/mac/fast/repaint/flexible-box-overflow-expected.png
LayoutTests/platform/mac/fast/repaint/flexible-box-overflow-horizontal-expected.png
LayoutTests/platform/mac/fast/repaint/float-move-during-layout-expected.png
LayoutTests/platform/mac/fast/repaint/float-overflow-expected.png
LayoutTests/platform/mac/fast/repaint/float-overflow-right-expected.png
LayoutTests/platform/mac/fast/repaint/iframe-scroll-repaint-expected.png
LayoutTests/platform/mac/fast/repaint/inline-block-overflow-expected.png
LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.png
LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png
LayoutTests/platform/mac/fast/repaint/layer-child-outline-expected.png
LayoutTests/platform/mac/fast/repaint/layer-outline-expected.png
LayoutTests/platform/mac/fast/repaint/layer-outline-horizontal-expected.png
LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-in-regions-expected.png
LayoutTests/platform/mac/fast/repaint/line-overflow-expected.png
LayoutTests/platform/mac/fast/repaint/nested-iframe-scroll-inner-expected.png
LayoutTests/platform/mac/fast/repaint/nested-iframe-scroll-outer-expected.png
LayoutTests/platform/mac/fast/repaint/outline-child-repaint-expected.png
LayoutTests/platform/mac/fast/repaint/outline-shrinking-expected.png
LayoutTests/platform/mac/fast/repaint/overflow-delete-line-expected.png
LayoutTests/platform/mac/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png
LayoutTests/platform/mac/fast/repaint/repaint-during-scroll-expected.png
LayoutTests/platform/mac/fast/repaint/scale-page-shrink-expected.png
LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.png
LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.png
LayoutTests/platform/mac/fast/repaint/shadow-multiple-horizontal-expected.png
LayoutTests/platform/mac/fast/repaint/shadow-multiple-strict-horizontal-expected.png
LayoutTests/platform/mac/fast/repaint/shadow-multiple-strict-vertical-expected.png
LayoutTests/platform/mac/fast/repaint/shadow-multiple-vertical-expected.png
LayoutTests/platform/mac/fast/repaint/static-to-positioned-expected.png
LayoutTests/platform/mac/fast/repaint/table-cell-move-expected.png
LayoutTests/platform/mac/fast/repaint/text-selection-rect-in-overflow-2-expected.png
LayoutTests/platform/mac/fast/repaint/text-shadow-expected.png
LayoutTests/platform/mac/fast/repaint/text-shadow-horizontal-expected.png
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/TestInvocation.h
Tools/WebKitTestRunner/cg/TestInvocationCG.cpp

index 2e324a5..0d18ced 100644 (file)
@@ -1,3 +1,61 @@
+2011-09-26  Simon Fraser  <simon.fraser@apple.com>
+
+        Repaint tests don't work in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=68453
+
+        Reviewed by Sam Weinig.
+        
+        Update Mac results to use the new repaint rects. Differences from old results:
+               * There are no longer invalidates from scrolling.
+               * We no longer see the effects of AppKit rect coalescing.
+               * Composting tests show the overlay now, but repaints in compositing layers do not show.
+               
+           Bad results in a couple of tests are covered by bugs 68830 and 68829.
+
+        * platform/mac/fast/repaint/4774354-expected.png:
+        * platform/mac/fast/repaint/block-layout-inline-children-float-positioned-expected.png:
+        * platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png:
+        * platform/mac/fast/repaint/border-radius-repaint-expected.png:
+        * platform/mac/fast/repaint/clipped-relative-expected.png:
+        * platform/mac/fast/repaint/containing-block-position-change-expected.png:
+        * platform/mac/fast/repaint/control-clip-expected.png:
+        * platform/mac/fast/repaint/delete-into-nested-block-expected.png:
+        * platform/mac/fast/repaint/fixed-and-absolute-position-scrolled-expected.png:
+        * platform/mac/fast/repaint/fixed-scroll-simple-expected.png:
+        * platform/mac/fast/repaint/flexible-box-overflow-expected.png:
+        * platform/mac/fast/repaint/flexible-box-overflow-horizontal-expected.png:
+        * platform/mac/fast/repaint/float-move-during-layout-expected.png:
+        * platform/mac/fast/repaint/float-overflow-expected.png:
+        * platform/mac/fast/repaint/float-overflow-right-expected.png:
+        * platform/mac/fast/repaint/iframe-scroll-repaint-expected.png:
+        * platform/mac/fast/repaint/inline-block-overflow-expected.png:
+        * platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.png:
+        * platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png:
+        * platform/mac/fast/repaint/layer-child-outline-expected.png:
+        * platform/mac/fast/repaint/layer-outline-expected.png:
+        * platform/mac/fast/repaint/layer-outline-horizontal-expected.png:
+        * platform/mac/fast/repaint/line-flow-with-floats-in-regions-expected.png:
+        * platform/mac/fast/repaint/line-overflow-expected.png:
+        * platform/mac/fast/repaint/nested-iframe-scroll-inner-expected.png:
+        * platform/mac/fast/repaint/nested-iframe-scroll-outer-expected.png:
+        * platform/mac/fast/repaint/outline-child-repaint-expected.png:
+        * platform/mac/fast/repaint/outline-shrinking-expected.png:
+        * platform/mac/fast/repaint/overflow-delete-line-expected.png:
+        * platform/mac/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png:
+        * platform/mac/fast/repaint/repaint-during-scroll-expected.png:
+        * platform/mac/fast/repaint/scale-page-shrink-expected.png:
+        * platform/mac/fast/repaint/search-field-cancel-expected.png:
+        * platform/mac/fast/repaint/selection-after-remove-expected.png:
+        * platform/mac/fast/repaint/shadow-multiple-horizontal-expected.png:
+        * platform/mac/fast/repaint/shadow-multiple-strict-horizontal-expected.png:
+        * platform/mac/fast/repaint/shadow-multiple-strict-vertical-expected.png:
+        * platform/mac/fast/repaint/shadow-multiple-vertical-expected.png:
+        * platform/mac/fast/repaint/static-to-positioned-expected.png:
+        * platform/mac/fast/repaint/table-cell-move-expected.png:
+        * platform/mac/fast/repaint/text-selection-rect-in-overflow-2-expected.png:
+        * platform/mac/fast/repaint/text-shadow-expected.png:
+        * platform/mac/fast/repaint/text-shadow-horizontal-expected.png:
+
 2011-09-26  John Bauman  <jbauman@chromium.org>
 
         Fix nonpremultiplied webgl toDataURL to jpeg
index 0ab638c..a4793f2 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/4774354-expected.png and b/LayoutTests/platform/mac/fast/repaint/4774354-expected.png differ
index b71c73c..07d1554 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/block-layout-inline-children-float-positioned-expected.png and b/LayoutTests/platform/mac/fast/repaint/block-layout-inline-children-float-positioned-expected.png differ
index 28adc18..749cb19 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png and b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png differ
index 39594dc..b16ee1e 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/border-radius-repaint-expected.png and b/LayoutTests/platform/mac/fast/repaint/border-radius-repaint-expected.png differ
index 5763194..8f63600 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/clipped-relative-expected.png and b/LayoutTests/platform/mac/fast/repaint/clipped-relative-expected.png differ
index 2d18b8b..d3570bb 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/containing-block-position-change-expected.png and b/LayoutTests/platform/mac/fast/repaint/containing-block-position-change-expected.png differ
index a751fd4..382f0e3 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/control-clip-expected.png and b/LayoutTests/platform/mac/fast/repaint/control-clip-expected.png differ
index 107308c..9b090f9 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.png and b/LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.png differ
index 39e0951..2f9da56 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/fixed-and-absolute-position-scrolled-expected.png and b/LayoutTests/platform/mac/fast/repaint/fixed-and-absolute-position-scrolled-expected.png differ
index 9cb5182..916a812 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/fixed-scroll-simple-expected.png and b/LayoutTests/platform/mac/fast/repaint/fixed-scroll-simple-expected.png differ
index 8b929e8..fc63e26 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/flexible-box-overflow-expected.png and b/LayoutTests/platform/mac/fast/repaint/flexible-box-overflow-expected.png differ
index 147d4cd..84db38f 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/flexible-box-overflow-horizontal-expected.png and b/LayoutTests/platform/mac/fast/repaint/flexible-box-overflow-horizontal-expected.png differ
index 39c0f71..2c368e3 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/float-move-during-layout-expected.png and b/LayoutTests/platform/mac/fast/repaint/float-move-during-layout-expected.png differ
index 39edd33..413aae8 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/float-overflow-expected.png and b/LayoutTests/platform/mac/fast/repaint/float-overflow-expected.png differ
index c265bf1..cec20bf 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/float-overflow-right-expected.png and b/LayoutTests/platform/mac/fast/repaint/float-overflow-right-expected.png differ
index 996908d..8d5f9d6 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/iframe-scroll-repaint-expected.png and b/LayoutTests/platform/mac/fast/repaint/iframe-scroll-repaint-expected.png differ
index c9af32d..39858cb 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/inline-block-overflow-expected.png and b/LayoutTests/platform/mac/fast/repaint/inline-block-overflow-expected.png differ
index dd17145..7dc8785 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.png and b/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.png differ
index 824b19e..47b1896 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png and b/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png differ
index c65028c..9a74c89 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/layer-child-outline-expected.png and b/LayoutTests/platform/mac/fast/repaint/layer-child-outline-expected.png differ
index 2d0ae18..270e0d8 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/layer-outline-expected.png and b/LayoutTests/platform/mac/fast/repaint/layer-outline-expected.png differ
index 0757d18..e6f31d4 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/layer-outline-horizontal-expected.png and b/LayoutTests/platform/mac/fast/repaint/layer-outline-horizontal-expected.png differ
index aef0af7..f54997d 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-in-regions-expected.png and b/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-in-regions-expected.png differ
index efbf1a5..d2452f6 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/line-overflow-expected.png and b/LayoutTests/platform/mac/fast/repaint/line-overflow-expected.png differ
index 22eef4a..0dfee57 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/nested-iframe-scroll-inner-expected.png and b/LayoutTests/platform/mac/fast/repaint/nested-iframe-scroll-inner-expected.png differ
index b266a35..41f9096 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/nested-iframe-scroll-outer-expected.png and b/LayoutTests/platform/mac/fast/repaint/nested-iframe-scroll-outer-expected.png differ
index 1b3fe33..c42ae81 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/outline-child-repaint-expected.png and b/LayoutTests/platform/mac/fast/repaint/outline-child-repaint-expected.png differ
index 8f6e244..976aed8 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/outline-shrinking-expected.png and b/LayoutTests/platform/mac/fast/repaint/outline-shrinking-expected.png differ
index ffd9aa6..0812f6e 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/overflow-delete-line-expected.png and b/LayoutTests/platform/mac/fast/repaint/overflow-delete-line-expected.png differ
index 825786d..7a68de1 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png and b/LayoutTests/platform/mac/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png differ
index e2735e9..1fc0ed0 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/repaint-during-scroll-expected.png and b/LayoutTests/platform/mac/fast/repaint/repaint-during-scroll-expected.png differ
index 20d4662..feadb25 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/scale-page-shrink-expected.png and b/LayoutTests/platform/mac/fast/repaint/scale-page-shrink-expected.png differ
index 31ea414..c75889e 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.png and b/LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.png differ
index 22d62bf..4d06ab0 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.png and b/LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.png differ
index 999c4d5..76f4de3 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/shadow-multiple-horizontal-expected.png and b/LayoutTests/platform/mac/fast/repaint/shadow-multiple-horizontal-expected.png differ
index 999c4d5..76f4de3 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/shadow-multiple-strict-horizontal-expected.png and b/LayoutTests/platform/mac/fast/repaint/shadow-multiple-strict-horizontal-expected.png differ
index d7cc1fd..dcb5d85 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/shadow-multiple-strict-vertical-expected.png and b/LayoutTests/platform/mac/fast/repaint/shadow-multiple-strict-vertical-expected.png differ
index d7cc1fd..dcb5d85 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/shadow-multiple-vertical-expected.png and b/LayoutTests/platform/mac/fast/repaint/shadow-multiple-vertical-expected.png differ
index 763e87c..b2531e8 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/static-to-positioned-expected.png and b/LayoutTests/platform/mac/fast/repaint/static-to-positioned-expected.png differ
index f91a9bd..9633f98 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/table-cell-move-expected.png and b/LayoutTests/platform/mac/fast/repaint/table-cell-move-expected.png differ
index 7c6d7cc..5a82999 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/text-selection-rect-in-overflow-2-expected.png and b/LayoutTests/platform/mac/fast/repaint/text-selection-rect-in-overflow-2-expected.png differ
index baf410d..20da457 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/text-shadow-expected.png and b/LayoutTests/platform/mac/fast/repaint/text-shadow-expected.png differ
index 27015a4..1e28889 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/text-shadow-horizontal-expected.png and b/LayoutTests/platform/mac/fast/repaint/text-shadow-horizontal-expected.png differ
index f2ce5f7..08d0478 100644 (file)
@@ -1,3 +1,49 @@
+2011-09-26  Simon Fraser  <simon.fraser@apple.com>
+
+        Repaint tests don't work in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=68453
+
+        Reviewed by Sam Weinig.
+        
+        Convert DumpRenderTree to use use the repaint rects
+        exposed via WebKit API when generating the repaint test
+        overlay.
+        
+        Fix WebKitTestRunner to work with repaint tests, again
+        using the repaint rects exposed from WK2.
+        
+        In both cases, layoutTestController.display() now just
+        forces a display of the web view, and turns on repaint
+        rect tracking on the main FrameView.
+        
+        Later, when pixel results are requested, the alpha overlay
+        that shows the repaint rects is generated using the list
+        of rects supplied by WebCore.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetDefaultsToConsistentValues):
+        (resetWebViewToConsistentStateBeforeTesting):
+        (displayWebView):
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (paintRepaintRectOverlay):
+        (createBitmapContextFromWebView):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        (WTR::InjectedBundle::done):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        (WTR::InjectedBundle::setRepaintRects):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::reset):
+        (WTR::InjectedBundlePage::dump):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::display):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        * WebKitTestRunner/TestInvocation.h:
+        * WebKitTestRunner/cg/TestInvocationCG.cpp:
+        (WTR::paintRepaintRectOverlay):
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
+
 2011-09-26  Nayan Kumar K  <nayankk@motorola.com>
 
         Get hover'ed element URL from HitTest.
index 5f38ae4..207b421 100644 (file)
@@ -350,7 +350,6 @@ static NSString *libraryPathForDumpRenderTree()
 // Called before each test.
 static void resetDefaultsToConsistentValues()
 {
-    // Give some clear to undocumented defaults values
     static const int NoFontSmoothing = 0;
     static const int BlueTintedAppearance = 1;
 
@@ -1012,7 +1011,8 @@ static void resetWebViewToConsistentStateBeforeTesting()
     [WebView _removeAllUserContentFromGroup:[webView groupName]];
     [[webView window] setAutodisplay:NO];
     [webView _setMinimumTimerInterval:[WebView _defaultMinimumTimerInterval]];
-
+    [webView setTracksRepaints:NO];
+    
     resetDefaultsToConsistentValues();
 
     if (gLayoutTestController)
@@ -1172,12 +1172,11 @@ static void runTest(const string& testPathOrURL)
 
 void displayWebView()
 {
-    NSView *webView = [mainFrame webView];
+    WebView *webView = [mainFrame webView];
     [webView display];
-    [webView lockFocus];
-    [[[NSColor blackColor] colorWithAlphaComponent:0.66] set];
-    NSRectFillUsingOperation([webView frame], NSCompositeSourceOver);
-    [webView unlockFocus];
+    
+    [webView setTracksRepaints:YES];
+    [webView resetTrackedRepaints];
 }
 
 @implementation DumpRenderTreeEvent
index 22d8121..e0c0837 100644 (file)
@@ -130,6 +130,35 @@ static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t p
     return BitmapContext::createByAdoptingBitmapAndContext(buffer, context);
 }
 
+static void paintRepaintRectOverlay(WebView* webView, CGContextRef context)
+{
+    CGRect viewRect = NSRectToCGRect([webView bounds]);
+
+    CGContextSaveGState(context);
+
+    // Using a transparency layer is easier than futzing with clipping.
+    CGContextBeginTransparencyLayer(context, 0);
+
+    // Flip the context.
+    CGContextScaleCTM(context, 1, -1);
+    CGContextTranslateCTM(context, 0, -viewRect.size.height);
+    
+    CGContextSetRGBFillColor(context, 0, 0, 0, static_cast<CGFloat>(0.66));
+    CGContextFillRect(context, viewRect);
+
+    NSArray *repaintRects = [webView trackedRepaintRects];
+    if (repaintRects) {
+        
+        for (NSValue *value in repaintRects) {
+            CGRect currRect = NSRectToCGRect([value rectValue]);
+            CGContextClearRect(context, currRect);
+        }
+    }
+    
+    CGContextEndTransparencyLayer(context);
+    CGContextRestoreGState(context);
+}
+
 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
 {
     WebView* view = [mainFrame webView];
@@ -175,6 +204,9 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
             CGImageRef image = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [[view window] windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque);
             CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image);
             CGImageRelease(image);
+
+            if ([view isTrackingRepaints])
+                paintRepaintRectOverlay(view, context);
         } else {
             // Make sure the view has been painted.
             [view displayIfNeeded];
@@ -188,6 +220,10 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
             RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
             [NSGraphicsContext setCurrentContext:nsContext];
             [imageRep draw];
+            
+            if ([view isTrackingRepaints])
+                paintRepaintRectOverlay(view, context);
+            
             [NSGraphicsContext setCurrentContext:savedContext.get()];
         }
     }
index dd04578..740e7b3 100644 (file)
@@ -170,6 +170,7 @@ void InjectedBundle::beginTesting()
 
     m_outputStream.str("");
     m_pixelResult.clear();
+    m_repaintRects.clear();
 
     m_layoutTestController = LayoutTestController::create();
     m_gcController = GCController::create();
@@ -209,6 +210,9 @@ void InjectedBundle::done()
     WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult"));
     WKDictionaryAddItem(doneMessageBody.get(), pixelResultKey.get(), m_pixelResult.get());
 
+    WKRetainPtr<WKStringRef> repaintRectsKey = adoptWK(WKStringCreateWithUTF8CString("RepaintRects"));
+    WKDictionaryAddItem(doneMessageBody.get(), repaintRectsKey.get(), m_repaintRects.get());
+
     WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get());
 
     closeOtherPages();
index 506bedf..b90fa9f 100644 (file)
@@ -64,6 +64,7 @@ public:
     void done();
     std::ostringstream& os() { return m_outputStream; }
     void setPixelResult(WKImageRef image) { m_pixelResult = image; }
+    void setRepaintRects(WKArrayRef rects) { m_repaintRects = rects; }
 
     bool isTestRunning() { return m_state == Testing; }
 
@@ -115,6 +116,7 @@ private:
     bool m_dumpPixels;
 
     WKRetainPtr<WKImageRef> m_pixelResult;
+    WKRetainPtr<WKArrayRef> m_repaintRects;
 };
 
 } // namespace WTR
index 9c80ad0..d515733 100644 (file)
@@ -307,6 +307,8 @@ void InjectedBundlePage::reset()
     m_previousTestBackForwardListItem = adoptWK(WKBundleBackForwardListCopyItemAtIndex(WKBundlePageGetBackForwardList(m_page), 0));
 
     WKBundleFrameClearOpener(WKBundlePageGetMainFrame(m_page));
+    
+    WKBundlePageSetTracksRepaints(m_page, false);
 }
 
 // Loader Client Callbacks
@@ -575,8 +577,11 @@ void InjectedBundlePage::dump()
     if (InjectedBundle::shared().layoutTestController()->shouldDumpBackForwardListsForAllWindows())
         InjectedBundle::shared().dumpBackForwardListsForAllPages();
 
-    if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().layoutTestController()->shouldDumpPixels())
+    if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().layoutTestController()->shouldDumpPixels()) {
         InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotInViewCoordinates(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), kWKImageOptionsShareable)).get());
+        if (WKBundlePageIsTrackingRepaints(m_page))
+            InjectedBundle::shared().setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
+    }
 
     InjectedBundle::shared().done();
 }
index 03c27f6..97a7fae 100644 (file)
@@ -122,7 +122,10 @@ JSClassRef LayoutTestController::wrapperClass()
 
 void LayoutTestController::display()
 {
-    // FIXME: actually implement, once we want pixel tests
+    WKBundlePageRef page = InjectedBundle::shared().page()->page();
+    WKBundlePageForceRepaint(page);
+    WKBundlePageSetTracksRepaints(page, true);
+    WKBundlePageResetTrackedRepaints(page);
 }
 
 void LayoutTestController::dumpAsText(bool dumpPixels)
index be20046..657fb96 100644 (file)
@@ -222,13 +222,16 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
         WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult"));
         WKImageRef pixelResult = static_cast<WKImageRef>(WKDictionaryGetItemForKey(messageBodyDictionary, pixelResultKey.get()));
         ASSERT(!pixelResult || m_dumpPixels);
+        
+        WKRetainPtr<WKStringRef> repaintRectsKey = adoptWK(WKStringCreateWithUTF8CString("RepaintRects"));
+        WKArrayRef repaintRects = static_cast<WKArrayRef>(WKDictionaryGetItemForKey(messageBodyDictionary, repaintRectsKey.get()));        
 
         // Dump text.
         dump(toSTD(textOutput).c_str(), true);
 
         // Dump pixels (if necessary).
         if (m_dumpPixels && pixelResult)
-            dumpPixelsAndCompareWithExpected(pixelResult);
+            dumpPixelsAndCompareWithExpected(pixelResult, repaintRects);
 
         fputs("#EOF\n", stdout);
         fflush(stdout);
index aab58a2..5ff7ea0 100644 (file)
@@ -46,7 +46,7 @@ public:
 
 private:
     void dump(const char*, bool singleEOF = false);
-    void dumpPixelsAndCompareWithExpected(WKImageRef);
+    void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects);
     bool compareActualHashToExpectedAndDumpResults(const char[33]);
     
     WKRetainPtr<WKURLRef> m_url;
index 4408454..bed8f56 100644 (file)
@@ -114,10 +114,42 @@ static void dumpBitmap(CGContextRef bitmapContext, const char* checksum)
     printPNG(data, dataLength, checksum);
 }
 
-void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image)
+static void paintRepaintRectOverlay(CGContextRef context, WKImageRef image, WKArrayRef repaintRects)
+{
+    WKSize imageSize = WKImageGetSize(image);
+
+    CGContextSaveGState(context);
+
+    // Using a transparency layer is easier than futzing with clipping.
+    CGContextBeginTransparencyLayer(context, 0);
+    
+    // Flip the context.
+    CGContextScaleCTM(context, 1, -1);
+    CGContextTranslateCTM(context, 0, -imageSize.height);
+    
+    CGContextSetRGBFillColor(context, 0, 0, 0, static_cast<CGFloat>(0.66));
+    CGContextFillRect(context, CGRectMake(0, 0, imageSize.width, imageSize.height));
+
+    // Clear the repaint rects.
+    size_t count = WKArrayGetSize(repaintRects);
+    for (size_t i = 0; i < count; ++i) {
+        WKRect rect = WKRectGetValue(static_cast<WKRectRef>(WKArrayGetItemAtIndex(repaintRects, i)));
+        CGRect cgRect = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+        CGContextClearRect(context, cgRect);
+    }
+    
+    CGContextEndTransparencyLayer(context);
+    CGContextRestoreGState(context);
+}
+
+void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects)
 {
     CGContextRef context = createCGContextFromImage(image);
 
+    // A non-null repaintRects array means we're doing a repaint test.
+    if (repaintRects)
+        paintRepaintRectOverlay(context, image, repaintRects);
+
     char actualHash[33];
     computeMD5HashStringForContext(context, actualHash);
     if (!compareActualHashToExpectedAndDumpResults(actualHash))