Add testing for display list replay, and skip clipped-out items on replay
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Jan 2016 20:39:42 +0000 (20:39 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Jan 2016 20:39:42 +0000 (20:39 +0000)
commit529d3c521be740190701f3c6e31c725662f3486f
treed3f7291dcf7955a791a66fc313fb361e176f9401
parent47f8afdd8da1b52d2241902cc13d2c86d207d301
Add testing for display list replay, and skip clipped-out items on replay
https://bugs.webkit.org/show_bug.cgi?id=153408

Reviewed by Zalan Bujtas.
Source/WebCore:

Make it possible to save and serialize a DisplayList of Items which were
actually applied on replay, so that replay-time optimizations can be tested.

This exposes internals.setElementTracksDisplayListReplay() and
internals.replayDisplayListForElement().

Do a trivial replay-time optimization, which is to skip items whose extents are
outside the replay clip.

Test: displaylists/replay-skip-clipped-rect.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setIsTrackingDisplayListReplay):
(WebCore::GraphicsLayer::isTrackingDisplayListReplay):
(WebCore::GraphicsLayer::replayDisplayListAsText):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::layerDisplayListMap): Use a singleton map to store the replay display lists
to avoid bloating GraphicsLayerCA for test-only code. The map stores a pair of the
replay list and a clip rect, which are both dumped. Dumping the clip rect ensures that
we're reporting the replay for the correct tile in a test (since there will be a replay
for each tile).
(WebCore::GraphicsLayerCA::~GraphicsLayerCA):
(WebCore::GraphicsLayerCA::platformCALayerPaintContents):
(WebCore::GraphicsLayerCA::setIsTrackingDisplayListReplay):
(WebCore::GraphicsLayerCA::replayDisplayListAsText):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/displaylists/DisplayList.h:
(WebCore::DisplayList::DisplayList::appendItem):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay): In the unlikely event of tracking replays,
allocate a new DisplayList and append to it items which actually get applied.
* platform/graphics/displaylists/DisplayListReplayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setIsTrackingDisplayListReplay):
(WebCore::RenderLayerBacking::replayDisplayListAsText):
* rendering/RenderLayerBacking.h:
* testing/Internals.cpp:
(WebCore::Internals::setElementTracksDisplayListReplay):
(WebCore::Internals::replayDisplayListForElement):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Test that a clipped-out rectangle is not painted.

In order to get the rect into the display list, we need to make the target
compositing layer be tiled, and to be clipped by an ancestor so that only the
second tile renders. (This complexity is required because in simpler scenarios,
the rect is clipped out at recording time.)

* displaylists/replay-skip-clipped-rect-expected.txt: Added.
* displaylists/replay-skip-clipped-rect.html: Added.
* displaylists/resources/dump-target-replay-list.js: Added.
(doTest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt [new file with mode: 0644]
LayoutTests/displaylists/replay-skip-clipped-rect.html [new file with mode: 0644]
LayoutTests/displaylists/resources/dump-target-replay-list.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/displaylists/DisplayList.h
Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl