haikuwebkit/LayoutTests/tiled-drawing/tile-coverage-slow-scrollin...

33 lines
892 B
HTML
Raw Permalink Normal View History

https://bugs.webkit.org/show_bug.cgi?id=100169 We should make TileCache tiles the size of the tile coverage rect when we can't do fast scrolling -and- <rdar://problem/12505021> Reviewed by Simon Fraser. Source/WebCore: Some websites that don't do fast scrolling still scroll slower than they do with tiled drawing disabled. https://bugs.webkit.org/show_bug.cgi?id=99768 addressed some of this performance problem, but there is still more ground to make up. This patch addresses the remaining issue by making tiles the size of the window when we can't do fast scrolling. The constructor and create function no longer take a size parameter. That's all fully controlled within TileCache now. m_tileSize is no longer const. * platform/graphics/ca/mac/TileCache.h: Store the current default size as constants so that we can access it in both the constructor and adjustTileSizeForCoverageRect(). * platform/graphics/ca/mac/TileCache.mm: (WebCore::TileCache::TileCache): This new function will set m_tileSize to the size of the tile coverage rect if the tile coverage is limited to the visible area. Otherwise, the tiles are set to be the default size. (WebCore::TileCache::adjustTileSizeForCoverageRect): Call adjustTileSizeForCoverageRect(). (WebCore::TileCache::revalidateTiles): No need to send in a size anymore. * platform/graphics/ca/mac/WebTileCacheLayer.h: (WebCore): LayoutTests: New test. * platform/mac/tiled-drawing/tile-coverage-slow-scrolling-expected.txt: Added. * platform/mac/tiled-drawing/tile-coverage-slow-scrolling.html: Added. Canonical link: https://commits.webkit.org/118342@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-25 00:19:35 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.box {
height: 100px;
width: 100px;
https://bugs.webkit.org/show_bug.cgi?id=101001 Pages with position:fixed elements should still be able to scroll on the scrolling thread -and corresponding- <rdar://problem/10857315> Reviewed by Simon Fraser. Source/WebCore: This patch adds two new classes. ScrollingStateFixedNode is a class to represent fixed nodes in the state tree, and ScrollingTreeFixedNode represents fixed node in the scrolling tree over on the scrolling thread. * WebCore.xcodeproj/project.pbxproj: When we are (non-programatically) scrolling fixed objects on the scrolling thread, we do not want to do any work here. * page/FrameView.cpp: (WebCore::FrameView::updateFixedElementsAfterScrolling): Whenever we sync the position of the main frame's layer, we have to do the same for scrolling tree children. * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::updateMainFrameScrollPosition): New ScrollingNodeType -- FixedNode, yay! And two new functions specific to dealing with FixedNodes. * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateViewportConstrainedNode): (WebCore::ScrollingCoordinator::syncChildPositions): This is the new class that represents fixed nodes in the state tree. All of the changed properties are stored within FixedPositionViewportConstraints. * page/scrolling/ScrollingStateFixedNode.cpp: Added. (WebCore): (WebCore::ScrollingStateFixedNode::create): (WebCore::ScrollingStateFixedNode::ScrollingStateFixedNode): (WebCore::ScrollingStateFixedNode::~ScrollingStateFixedNode): (WebCore::ScrollingStateFixedNode::updateConstraints): (WebCore::ScrollingStateFixedNode::dumpProperties): * page/scrolling/ScrollingStateFixedNode.h: Added. (WebCore): (ScrollingStateFixedNode): (WebCore::ScrollingStateFixedNode::viewportConstraints): (WebCore::toScrollingStateFixedNode): Make sure to create the right type of clone for each node. * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::cloneAndReset): Now that m_children may be anything other than null, I found this bug. We encounter it when the parameter to removeChild is this and we want to remove all of our children. In that case, this is obviously not found in its own child array. (WebCore::ScrollingStateNode::removeChild): ScrollingStateNode now caches the GraphicsLayer in addition to the PlatformLayer. This will allow us to sync the GraphicsLayer position at the appropriate times. * page/scrolling/ScrollingStateNode.h: (WebCore::ScrollingStateNode::isScrollingStateFixedNode): (WebCore::ScrollingStateNode::graphicsLayer): (ScrollingStateNode): Handle fixed nodes. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::updateTreeFromStateNode): New function parentScrollPositionDidChange() is called on children when the parent has scrolled. * page/scrolling/ScrollingTreeNode.h: (ScrollingTreeNode): * page/scrolling/ScrollingTreeScrollingNode.h: (ScrollingTreeScrollingNode): Return true for supportsFixedPositionLayers(). * page/scrolling/mac/ScrollingCoordinatorMac.h: (ScrollingCoordinatorMac): Handle fixed nodes. * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::attachToStateTree): Now that m_children can be non-null I caught this pre-existing bug where we would come times remove a node without updating the HashMap. This patch fixes that by consolidating the removal into one function. (WebCore::ScrollingCoordinatorMac::removeNode): (WebCore::ScrollingCoordinatorMac::detachFromStateTree): (WebCore::ScrollingCoordinatorMac::clearStateTree): Update the GraphicsLayers to reflect the new position that the Scrolling thread has moved the underlying CALayer to already. (WebCore::ScrollingCoordinatorMac::syncChildPositions): Pass new constraints over to the appropriate state node. (WebCore::ScrollingCoordinatorMac::updateViewportConstrainedNode): Cache the GraphicsLayer in addition to the PlatformLayer. * page/scrolling/mac/ScrollingStateNodeMac.mm: (WebCore::ScrollingStateNode::setScrollLayer): Here is the new class that represents fixed nodes over on the scrolling thread. * page/scrolling/mac/ScrollingTreeFixedNode.h: Added. (WebCore): (ScrollingTreeFixedNode): * page/scrolling/mac/ScrollingTreeFixedNode.mm: Added. (WebCore): (WebCore::ScrollingTreeFixedNode::create): (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode): (WebCore::ScrollingTreeFixedNode::~ScrollingTreeFixedNode): (WebCore::ScrollingTreeFixedNode::update): This is where the magic happens. re-position the fixed object when its parent has scrolled so that it appears to have not moved at all. (WebCore::ScrollingTreeFixedNode::parentScrollPositionDidChange): Whenever we change the position of a scrolling layer, tell our children. * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm: (WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition): Handle fixed nodes. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::attachToScrollingCoordinator): detachFromScrollingCoordinator() needs to be public so that it can be called from RenderLayerCompositor for fixed nodes. * rendering/RenderLayerBacking.h: (RenderLayerBacking): RenderLayerCompositor takes control of attaching and detaching fixed nodes to/from the ScrollingCoordinator. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): (WebCore::RenderLayerCompositor::didFlushChangesForLayer): (WebCore::RenderLayerCompositor::updateBacking): (WebCore::RenderLayerCompositor::layerWillBeRemoved): (WebCore::RenderLayerCompositor::didMoveOnscreen): (WebCore::RenderLayerCompositor::willMoveOffscreen): (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants): (WebCore::isRootmostFixedOrStickyLayer): (WebCore): (WebCore::RenderLayerCompositor::updateViewportConstraintStatus): (WebCore::RenderLayerCompositor::addViewportConstrainedLayer): (WebCore::RenderLayerCompositor::removeViewportConstrainedLayer): (WebCore::RenderLayerCompositor::computeViewportConstraints): (WebCore::nearestScrollingCoordinatorAncestor): (WebCore::RenderLayerCompositor::registerOrUpdateViewportConstrainedLayer): (WebCore::RenderLayerCompositor::unregisterViewportConstrainedLayer): (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers): * rendering/RenderLayerCompositor.h: (WebCore): (RenderLayerCompositor): LayoutTests: New tests. * platform/mac/tiled-drawing/fixed: Added. * platform/mac/tiled-drawing/fixed/absolute-inside-fixed-expected.txt: Added. * platform/mac/tiled-drawing/fixed/absolute-inside-fixed.html: Added. * platform/mac/tiled-drawing/fixed/fixed-position-out-of-view-expected.txt: Added. * platform/mac/tiled-drawing/fixed/fixed-position-out-of-view-negative-zindex-expected.txt: Added. * platform/mac/tiled-drawing/fixed/fixed-position-out-of-view-negative-zindex.html: Added. * platform/mac/tiled-drawing/fixed/fixed-position-out-of-view.html: Added. * platform/mac/tiled-drawing/fixed/four-bars-expected.txt: Added. * platform/mac/tiled-drawing/fixed/four-bars.html: Added. * platform/mac/tiled-drawing/fixed/nested-fixed-expected.txt: Added. * platform/mac/tiled-drawing/fixed/nested-fixed.html: Added. * platform/mac/tiled-drawing/fixed/percentage-inside-fixed-expected.txt: Added. * platform/mac/tiled-drawing/fixed/percentage-inside-fixed.html: Added. These two tests are supposed to be in "slow scrolling" mode. Now that fixed elements can scroll "fast," we need something else to force slow scrolling. We should probably just add something to window.internals to do that, but in the meantime, background-attachment:fixed will work. * platform/mac/tiled-drawing/scrolling-tree-slow-scrolling-expected.txt: * platform/mac/tiled-drawing/scrolling-tree-slow-scrolling.html: * platform/mac/tiled-drawing/tile-coverage-slow-scrolling-expected.txt: * platform/mac/tiled-drawing/tile-coverage-slow-scrolling.html: Canonical link: https://commits.webkit.org/119354@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-11-05 23:31:58 +00:00
background-image: -webkit-repeating-linear-gradient(red 10%, green 10%, green 30%);
background-attachment: fixed; /* At this time, background-attachment:fixed forces slow mode. */
https://bugs.webkit.org/show_bug.cgi?id=100169 We should make TileCache tiles the size of the tile coverage rect when we can't do fast scrolling -and- <rdar://problem/12505021> Reviewed by Simon Fraser. Source/WebCore: Some websites that don't do fast scrolling still scroll slower than they do with tiled drawing disabled. https://bugs.webkit.org/show_bug.cgi?id=99768 addressed some of this performance problem, but there is still more ground to make up. This patch addresses the remaining issue by making tiles the size of the window when we can't do fast scrolling. The constructor and create function no longer take a size parameter. That's all fully controlled within TileCache now. m_tileSize is no longer const. * platform/graphics/ca/mac/TileCache.h: Store the current default size as constants so that we can access it in both the constructor and adjustTileSizeForCoverageRect(). * platform/graphics/ca/mac/TileCache.mm: (WebCore::TileCache::TileCache): This new function will set m_tileSize to the size of the tile coverage rect if the tile coverage is limited to the visible area. Otherwise, the tiles are set to be the default size. (WebCore::TileCache::adjustTileSizeForCoverageRect): Call adjustTileSizeForCoverageRect(). (WebCore::TileCache::revalidateTiles): No need to send in a size anymore. * platform/graphics/ca/mac/WebTileCacheLayer.h: (WebCore): LayoutTests: New test. * platform/mac/tiled-drawing/tile-coverage-slow-scrolling-expected.txt: Added. * platform/mac/tiled-drawing/tile-coverage-slow-scrolling.html: Added. Canonical link: https://commits.webkit.org/118342@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-25 00:19:35 +00:00
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function doTest()
{
if (window.internals) {
document.getElementById('layers').innerText = internals.layerTreeAsText(document,
internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
}
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<div class="box">
</div>
<pre id="layers">Layer tree goes here</p>
</body>
</html>