Changeset 148651 in webkit
- Timestamp:
- Apr 17, 2013 5:04:49 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148648 r148651 1 2013-04-17 Simon Fraser <simon.fraser@apple.com> 2 3 Fix GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() to do predictive visible rect expansion 4 https://bugs.webkit.org/show_bug.cgi?id=114775 5 6 Reviewed by Tim Horton. 7 8 GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() is intended to answer the question 9 "if your visible rect is changed to X, would any tiles be created or destroyed?". 10 11 However, for compositing layer tiled layers, we do some predictive visible rect expansion based on how 12 the visible rect is changing when we actually commit visible rect changes. recursiveVisibleRectChangeRequiresFlush() 13 was not doing that, causing it to give confusing answers, so fix it to do so. 14 15 Both now call adjustTiledLayerVisibleRect(), and it's cleaner to make this a static function. 16 17 A somewhat unrelated change is to take the layer bounds origin into account 18 in GraphicsLayerCA::computeVisibleRect(). Desktop WebKit never sets this, but it's used 19 on other platforms for composited scrolling, so needs to be taken into account 20 when computing visible rects. 21 22 * platform/graphics/ca/GraphicsLayerCA.cpp: 23 (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush): 24 (WebCore::GraphicsLayerCA::computeVisibleRect): 25 (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect): 26 (WebCore::GraphicsLayerCA::updateVisibleRect): 27 * platform/graphics/ca/GraphicsLayerCA.h: 28 (GraphicsLayerCA): 29 1 30 2013-04-17 Oliver Hunt <oliver@apple.com> 2 31 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r147797 r148651 914 914 // This may be called at times when layout has not been updated, so we want to avoid calling out to the client 915 915 // for animating transforms. 916 FloatRect visibleRect = computeVisibleRect(localState, 0); 917 if (visibleRect != m_visibleRect) { 916 FloatRect newVisibleRect = computeVisibleRect(localState, 0); 917 if (m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer) 918 newVisibleRect = adjustTiledLayerVisibleRect(tiledBacking(), m_visibleRect, newVisibleRect, m_sizeAtLastVisibleRectUpdate, m_size); 919 920 if (newVisibleRect != m_visibleRect) { 918 921 if (TiledBacking* tiledBacking = this->tiledBacking()) { 919 if (tiledBacking->tilesWouldChangeForVisibleRect( visibleRect))922 if (tiledBacking->tilesWouldChangeForVisibleRect(newVisibleRect)) 920 923 return true; 921 924 } … … 995 998 bool mapWasClamped; 996 999 FloatRect clipRectForChildren = state.mappedQuad(&mapWasClamped).boundingBox(); 997 FloatRect clipRectForSelf(0, 0, m_size.width(), m_size.height()); 1000 FloatPoint boundsOrigin = m_boundsOrigin; 1001 clipRectForChildren.move(boundsOrigin.x(), boundsOrigin.y()); 1002 1003 FloatRect clipRectForSelf(boundsOrigin, m_size); 998 1004 if (!applyWasClamped && !mapWasClamped) 999 1005 clipRectForSelf.intersect(clipRectForChildren); … … 1593 1599 } 1594 1600 1595 FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const Float Size& oldSize) const1601 FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize) 1596 1602 { 1597 1603 // If the old visible rect is empty, we have no information about how the visible area is changing 1598 1604 // (maybe the layer was just created), so don't attempt to expand. Also don't attempt to expand 1599 1605 // if the size changed. 1600 if (oldVisibleRect.isEmpty() || m_size != oldSize)1601 return m_visibleRect;1606 if (oldVisibleRect.isEmpty() || newSize != oldSize) 1607 return newVisibleRect; 1602 1608 1603 1609 const float paddingMultiplier = 2; 1604 1610 1605 float leftEdgeDelta = paddingMultiplier * ( m_visibleRect.x() - oldVisibleRect.x());1606 float rightEdgeDelta = paddingMultiplier * ( m_visibleRect.maxX() - oldVisibleRect.maxX());1607 1608 float topEdgeDelta = paddingMultiplier * ( m_visibleRect.y() - oldVisibleRect.y());1609 float bottomEdgeDelta = paddingMultiplier * ( m_visibleRect.maxY() - oldVisibleRect.maxY());1611 float leftEdgeDelta = paddingMultiplier * (newVisibleRect.x() - oldVisibleRect.x()); 1612 float rightEdgeDelta = paddingMultiplier * (newVisibleRect.maxX() - oldVisibleRect.maxX()); 1613 1614 float topEdgeDelta = paddingMultiplier * (newVisibleRect.y() - oldVisibleRect.y()); 1615 float bottomEdgeDelta = paddingMultiplier * (newVisibleRect.maxY() - oldVisibleRect.maxY()); 1610 1616 1611 1617 FloatRect existingTileBackingRect = tiledBacking->visibleRect(); 1612 FloatRect expandedRect = m_visibleRect;1618 FloatRect expandedRect = newVisibleRect; 1613 1619 1614 1620 // More exposed on left side. … … 1660 1666 FloatRect tileArea = m_visibleRect; 1661 1667 if (m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer) 1662 tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);1668 tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, tileArea, m_sizeAtLastVisibleRectUpdate, m_size); 1663 1669 1664 1670 tiledBacking()->setVisibleRect(tileArea); -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r147797 r148651 251 251 const FloatRect& visibleRect() const { return m_visibleRect; } 252 252 253 FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatSize& oldSize) const;253 static FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize); 254 254 255 255 bool recursiveVisibleRectChangeRequiresFlush(const TransformState&) const;
Note: See TracChangeset
for help on using the changeset viewer.