haikuwebkit/LayoutTests/displaylists/replay-skip-clipped-rect.html

42 lines
866 B
HTML
Raw Permalink Normal View History

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): Canonical link: https://commits.webkit.org/171474@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-01-24 20:39:42 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
#clipper {
height: 200px;
width: 200px;
overflow: hidden;
-webkit-transform: translateZ(0);
}
#target {
/* Tiled layer, shifted to show the second tile. */
height: 200px;
width: 3200px;
-webkit-transform: translate3d(-512px, 0, 0);
}
.shadowed {
/* Just outside the second tile. */
margin-left: 412px;
width: 100px;
height: 100px;
background-color: blue;
}
</style>
<script src="resources/dump-target-replay-list.js"></script>
</head>
<body>
<div id="clipper">
<div id="target">
<div class="shadowed">
</div>
</div>
</div>
<pre id="output"></pre>
</body>
</html>