Changeset 143537 in webkit
- Timestamp:
- Feb 20, 2013, 4:48:45 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/mac-wk2/tiled-drawing/tile-size-slow-zoomed-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/TiledBacking.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/ca/mac/TileCache.h (modified) (6 diffs)
-
Source/WebCore/platform/graphics/ca/mac/TileCache.mm (modified) (11 diffs)
-
Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm (modified) (1 diff)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/mac/WKView.mm (modified) (4 diffs)
-
Source/WebKit2/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/DrawingArea.h (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (modified) (3 diffs)
-
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r143535 r143537 1 2013-02-20 Simon Fraser <simon.fraser@apple.com> 2 3 Zoomed, slow-scrolling pages keep recreating tiles when scrolled 4 https://bugs.webkit.org/show_bug.cgi?id=110379 5 6 Reviewed by Tim Horton. 7 8 This test now just has one tile, rather than four. There is an apparent issue 9 with the integral tile cache coverage rect being smaller than the visible rect. 10 This is caused by rounding when dumping the tile coverage rect. 11 12 * platform/mac-wk2/tiled-drawing/tile-size-slow-zoomed-expected.txt: 13 1 14 2013-02-20 Julien Chaffraix <jchaffraix@webkit.org> 2 15 -
trunk/LayoutTests/platform/mac-wk2/tiled-drawing/tile-size-slow-zoomed-expected.txt
r143423 r143537 11 11 (transform [1.70 0.00 0.00 0.00] [0.00 1.70 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00]) 12 12 (visible rect 0.00, 0.00 461.76 x 344.12) 13 (tile cache coverage 0, 0 784 x 584)14 (tile size 785 x 58 6)15 (top left tile 0, 0 tiles grid 2 x 2)13 (tile cache coverage 0, 0 461 x 344) 14 (tile size 785 x 585) 15 (top left tile 0, 0 tiles grid 1 x 1) 16 16 (children 1 17 17 (GraphicsLayer -
trunk/Source/WebCore/ChangeLog
r143536 r143537 1 2013-02-20 Simon Fraser <simon.fraser@apple.com> 2 3 Zoomed, slow-scrolling pages keep recreating tiles when scrolled 4 https://bugs.webkit.org/show_bug.cgi?id=110379 5 6 Reviewed by Tim Horton. 7 8 On slow-scrolling pages the TileCache makes the tiles the size of 9 the visible rect to minimize per-tile painting overhead. If the size 10 of that rect changes, the TileCache re-creates all the tiles. 11 12 This was a problem whem zoomed, because mapping the visible rect 13 through the scale transform and then rounding it would cause the 14 size to keep changing, causing lots of tile re-creation. 15 16 Fix by carrying the visibleRect around as a FloatRect, and doing 17 the same for the exposedRect. We then only expand to integers 18 when computing the tile size. This also fixes an issue where we could 19 sometimes make extra tiles because of fractional bits of tiles at the edges, 20 as shown by the test result change. 21 22 * platform/graphics/TiledBacking.h: 23 * platform/graphics/ca/GraphicsLayerCA.cpp: 24 (WebCore::GraphicsLayerCA::updateVisibleRect): 25 * platform/graphics/ca/mac/TileCache.h: 26 * platform/graphics/ca/mac/TileCache.mm: 27 (WebCore::TileCache::setVisibleRect): 28 (WebCore::TileCache::setExposedRect): 29 (WebCore::TileCache::prepopulateRect): 30 (WebCore::TileCache::computeTileCoverageRect): 31 (WebCore::TileCache::tileSizeForCoverageRect): 32 (WebCore::TileCache::blankPixelCountForTiles): 33 (WebCore::TileCache::revalidateTiles): 34 (WebCore::TileCache::ensureTilesForRect): 35 * platform/graphics/ca/mac/WebTileLayer.mm: 36 (-[WebTileLayer logFilledFreshTile]): 37 1 38 2013-02-20 Julien Chaffraix <jchaffraix@webkit.org> 2 39 -
trunk/Source/WebCore/platform/graphics/TiledBacking.h
r139822 r143537 45 45 virtual ~TiledBacking() { } 46 46 47 virtual void setVisibleRect(const IntRect&) = 0;48 virtual IntRect visibleRect() const = 0;47 virtual void setVisibleRect(const FloatRect&) = 0; 48 virtual FloatRect visibleRect() const = 0; 49 49 50 virtual void setExposedRect(const IntRect&) = 0;50 virtual void setExposedRect(const FloatRect&) = 0; 51 51 virtual void setClipsToExposedRect(bool) = 0; 52 52 53 virtual void prepopulateRect(const IntRect&) = 0;53 virtual void prepopulateRect(const FloatRect&) = 0; 54 54 55 55 virtual void setIsInWindow(bool) = 0; -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r143417 r143537 1622 1622 tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate); 1623 1623 1624 tiledBacking()->setVisibleRect( enclosingIntRect(tileArea));1624 tiledBacking()->setVisibleRect(tileArea); 1625 1625 1626 1626 m_sizeAtLastVisibleRectUpdate = m_size; -
trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h
r140475 r143537 27 27 #define TileCache_h 28 28 29 #include "FloatRect.h" 29 30 #include "IntPointHash.h" 30 31 #include "IntRect.h" … … 77 78 void setTileDebugBorderColor(CGColorRef); 78 79 79 virtual IntRect visibleRect() const OVERRIDE { return m_visibleRect; }80 virtual FloatRect visibleRect() const OVERRIDE { return m_visibleRect; } 80 81 81 82 unsigned blankPixelCount() const; 82 static unsigned blankPixelCountForTiles(const WebTileLayerList&, const IntRect&, const IntPoint&);83 static unsigned blankPixelCountForTiles(const WebTileLayerList&, const FloatRect&, const IntPoint&); 83 84 84 85 // Only public for the WebTileCacheMapLayer. … … 106 107 107 108 // TiledBacking member functions. 108 virtual void setVisibleRect(const IntRect&) OVERRIDE;109 virtual void setExposedRect(const IntRect&) OVERRIDE;109 virtual void setVisibleRect(const FloatRect&) OVERRIDE; 110 virtual void setExposedRect(const FloatRect&) OVERRIDE; 110 111 virtual void setClipsToExposedRect(bool) OVERRIDE; 111 virtual void prepopulateRect(const IntRect&) OVERRIDE;112 virtual void prepopulateRect(const FloatRect&) OVERRIDE; 112 113 virtual void setIsInWindow(bool) OVERRIDE; 113 114 virtual void setTileCoverage(TileCoverage) OVERRIDE; … … 131 132 void getTileIndexRangeForRect(const IntRect&, TileIndex& topLeft, TileIndex& bottomRight) const; 132 133 133 IntRect computeTileCoverageRect(const IntRect& previousVisibleRect) const;134 IntSize tileSizeForCoverageRect(const IntRect&) const;134 FloatRect computeTileCoverageRect(const FloatRect& previousVisibleRect) const; 135 IntSize tileSizeForCoverageRect(const FloatRect&) const; 135 136 136 137 void scheduleTileRevalidation(double interval); … … 143 144 144 145 void revalidateTiles(TileValidationPolicyFlags foregroundValidationPolicy = 0, TileValidationPolicyFlags backgroundValidationPolicy = 0); 145 void ensureTilesForRect(const IntRect&);146 void ensureTilesForRect(const FloatRect&); 146 147 void updateTileCoverageMap(); 147 148 … … 169 170 170 171 IntSize m_tileSize; 171 IntRect m_visibleRect;172 IntRect m_visibleRectAtLastRevalidate;173 IntRect m_exposedRect; // The exposed area of containing platform views.172 FloatRect m_visibleRect; 173 FloatRect m_visibleRectAtLastRevalidate; 174 FloatRect m_exposedRect; // The exposed area of containing platform views. 174 175 175 176 typedef HashMap<TileIndex, TileInfo> TileMap; -
trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm
r143423 r143537 298 298 } 299 299 300 void TileCache::setVisibleRect(const IntRect& visibleRect)300 void TileCache::setVisibleRect(const FloatRect& visibleRect) 301 301 { 302 302 if (m_visibleRect == visibleRect) … … 307 307 } 308 308 309 void TileCache::setExposedRect(const IntRect& exposedRect)309 void TileCache::setExposedRect(const FloatRect& exposedRect) 310 310 { 311 311 if (m_exposedRect == exposedRect) … … 328 328 } 329 329 330 void TileCache::prepopulateRect(const IntRect& rect)330 void TileCache::prepopulateRect(const FloatRect& rect) 331 331 { 332 332 ensureTilesForRect(rect); … … 418 418 } 419 419 420 IntRect TileCache::computeTileCoverageRect(const IntRect& previousVisibleRect) const421 { 422 IntRect visibleRect = m_visibleRect;420 FloatRect TileCache::computeTileCoverageRect(const FloatRect& previousVisibleRect) const 421 { 422 FloatRect visibleRect = m_visibleRect; 423 423 424 424 if (m_clipsToExposedRect) … … 434 434 435 435 // FIXME: look at how far the document can scroll in each dimension. 436 int coverageHorizontalSize = visibleRect.width();437 int coverageVerticalSize = visibleRect.height();436 float coverageHorizontalSize = visibleRect.width(); 437 float coverageVerticalSize = visibleRect.height(); 438 438 439 439 // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height. … … 447 447 448 448 // Don't extend coverage before 0 or after the end. 449 IntRect coverageBounds = bounds();450 int coverageLeft = visibleRect.x() - (coverageHorizontalSize - visibleRect.width()) / 2;449 FloatRect coverageBounds = bounds(); 450 float coverageLeft = visibleRect.x() - (coverageHorizontalSize - visibleRect.width()) / 2; 451 451 coverageLeft = min(coverageLeft, coverageBounds.maxX() - coverageHorizontalSize); 452 452 coverageLeft = max(coverageLeft, coverageBounds.x()); 453 453 454 int coverageTop = visibleRect.y() - (coverageVerticalSize - visibleRect.height()) / 2;454 float coverageTop = visibleRect.y() - (coverageVerticalSize - visibleRect.height()) / 2; 455 455 coverageTop = min(coverageTop, coverageBounds.maxY() - coverageVerticalSize); 456 456 coverageTop = max(coverageTop, coverageBounds.y()); 457 457 458 return IntRect(coverageLeft, coverageTop, coverageHorizontalSize, coverageVerticalSize);459 } 460 461 IntSize TileCache::tileSizeForCoverageRect(const IntRect& coverageRect) const458 return FloatRect(coverageLeft, coverageTop, coverageHorizontalSize, coverageVerticalSize); 459 } 460 461 IntSize TileCache::tileSizeForCoverageRect(const FloatRect& coverageRect) const 462 462 { 463 463 if (m_tileCoverage & CoverageForSlowScrolling) { 464 IntSize tileSize = coverageRect.size();464 FloatSize tileSize = coverageRect.size(); 465 465 tileSize.scale(m_scale); 466 return tileSize;466 return expandedIntSize(tileSize); 467 467 } 468 468 … … 496 496 } 497 497 498 unsigned TileCache::blankPixelCountForTiles(const WebTileLayerList& tiles, const IntRect& visibleRect, const IntPoint& tileTranslation)498 unsigned TileCache::blankPixelCountForTiles(const WebTileLayerList& tiles, const FloatRect& visibleRect, const IntPoint& tileTranslation) 499 499 { 500 500 Region paintedVisibleTiles; … … 503 503 const WebTileLayer* tileLayer = it->get(); 504 504 505 IntRect visiblePart(CGRectOffset([tileLayer frame], tileTranslation.x(), tileTranslation.y()));505 FloatRect visiblePart(CGRectOffset([tileLayer frame], tileTranslation.x(), tileTranslation.y())); 506 506 visiblePart.intersect(visibleRect); 507 507 508 508 if (!visiblePart.isEmpty()) 509 paintedVisibleTiles.unite( visiblePart);510 } 511 512 Region uncoveredRegion( visibleRect);509 paintedVisibleTiles.unite(enclosingIntRect(visiblePart)); 510 } 511 512 Region uncoveredRegion(enclosingIntRect(visibleRect)); 513 513 uncoveredRegion.subtract(paintedVisibleTiles); 514 514 … … 582 582 return; 583 583 584 IntRect visibleRect = m_visibleRect;584 FloatRect visibleRect = m_visibleRect; 585 585 586 586 if (m_clipsToExposedRect) … … 592 592 TileValidationPolicyFlags validationPolicy = m_isInWindow ? foregroundValidationPolicy : backgroundValidationPolicy; 593 593 594 IntRect tileCoverageRect = computeTileCoverageRect(m_visibleRectAtLastRevalidate);594 FloatRect tileCoverageRect = computeTileCoverageRect(m_visibleRectAtLastRevalidate); 595 595 FloatRect scaledRect(tileCoverageRect); 596 596 scaledRect.scale(m_scale); … … 751 751 } 752 752 753 void TileCache::ensureTilesForRect(const IntRect& rect)753 void TileCache::ensureTilesForRect(const FloatRect& rect) 754 754 { 755 755 if (m_unparentsOffscreenTiles && !m_isInWindow) -
trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm
r136774 r143537 79 79 - (void)logFilledFreshTile 80 80 { 81 IntRect visiblePart(enclosingIntRect([self frame]));81 FloatRect visiblePart([self frame]); 82 82 visiblePart.intersect(_tileCache->visibleRect()); 83 83 -
trunk/Source/WebKit2/ChangeLog
r143505 r143537 1 2013-02-20 Simon Fraser <simon.fraser@apple.com> 2 3 Zoomed, slow-scrolling pages keep recreating tiles when scrolled 4 https://bugs.webkit.org/show_bug.cgi?id=110379 5 6 Reviewed by Tim Horton. 7 8 Make the visible rect and exposed rects passed through 9 the drawing area to the tile cache FloatRects instead of IntRects. 10 11 * UIProcess/API/mac/WKView.mm: 12 (-[WKView setFrameSize:]): 13 (-[WKView _updateWindowAndViewFrames]): 14 (-[WKView enableFrameSizeUpdates]): 15 (-[WKView setMinimumWidthForAutoLayout:]): 16 * UIProcess/WebPageProxy.h: 17 * UIProcess/mac/WebPageProxyMac.mm: 18 (WebKit::WebPageProxy::viewExposedRectChanged): 19 * WebProcess/WebPage/DrawingArea.h: 20 (WebKit::DrawingArea::setExposedRect): 21 * WebProcess/WebPage/WebPage.cpp: 22 (WebKit::WebPage::viewExposedRectChanged): 23 * WebProcess/WebPage/WebPage.h: 24 * WebProcess/WebPage/WebPage.messages.in: 25 * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: 26 (TiledCoreAnimationDrawingArea): 27 * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: 28 (WebKit::TiledCoreAnimationDrawingArea::setExposedRect): 29 1 30 2013-02-20 Dirk Schulze <krit@webkit.org> 2 31 -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r141173 r143537 383 383 if (![self frameSizeUpdatesDisabled]) { 384 384 if (_data->_expandsToFitContentViaAutoLayout) 385 _data->_page->viewExposedRectChanged( enclosingIntRect([self visibleRect]));385 _data->_page->viewExposedRectChanged([self visibleRect]); 386 386 [self _setDrawingAreaSize:size]; 387 387 } … … 399 399 _data->_page->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates), IntPoint(accessibilityPosition)); 400 400 if (_data->_expandsToFitContentViaAutoLayout) 401 _data->_page->viewExposedRectChanged( enclosingIntRect([self visibleRect]));401 _data->_page->viewExposedRectChanged([self visibleRect]); 402 402 } 403 403 … … 3203 3203 if (!(--_data->_frameSizeUpdatesDisabledCount)) { 3204 3204 if (_data->_expandsToFitContentViaAutoLayout) 3205 _data->_page->viewExposedRectChanged( enclosingIntRect([self visibleRect]));3205 _data->_page->viewExposedRectChanged([self visibleRect]); 3206 3206 [self _setDrawingAreaSize:[self frame].size]; 3207 3207 } … … 3264 3264 3265 3265 if (expandsToFit) 3266 _data->_page->viewExposedRectChanged( enclosingIntRect([self visibleRect]));3266 _data->_page->viewExposedRectChanged([self visibleRect]); 3267 3267 3268 3268 _data->_page->setMainFrameIsScrollable(!expandsToFit); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r143474 r143537 383 383 void updateWindowIsVisible(bool windowIsVisible); 384 384 void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates); 385 void viewExposedRectChanged(const WebCore:: IntRect& exposedRect);385 void viewExposedRectChanged(const WebCore::FloatRect& exposedRect); 386 386 void setMainFrameIsScrollable(bool); 387 387 -
trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r139822 r143537 138 138 } 139 139 140 void WebPageProxy::viewExposedRectChanged(const IntRect& exposedRect)140 void WebPageProxy::viewExposedRectChanged(const FloatRect& exposedRect) 141 141 { 142 142 if (!isValid()) -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
r143472 r143537 85 85 virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) { } 86 86 87 virtual void setExposedRect(const WebCore:: IntRect&) { }87 virtual void setExposedRect(const WebCore::FloatRect&) { } 88 88 virtual void mainFrameScrollabilityChanged(bool) { } 89 89 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r143474 r143537 2912 2912 #endif 2913 2913 2914 void WebPage::viewExposedRectChanged(const IntRect& exposedRect)2914 void WebPage::viewExposedRectChanged(const FloatRect& exposedRect) 2915 2915 { 2916 2916 m_drawingArea->setExposedRect(exposedRect); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r143474 r143537 722 722 #endif 723 723 724 void viewExposedRectChanged(const WebCore:: IntRect& exposedRect);724 void viewExposedRectChanged(const WebCore::FloatRect& exposedRect); 725 725 void setMainFrameIsScrollable(bool); 726 726 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r143474 r143537 257 257 SetWindowIsVisible(bool windowIsVisible) 258 258 WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates, WebCore::IntPoint accessibilityViewCoordinates) 259 ViewExposedRectChanged(WebCore:: IntRect exposedRect)259 ViewExposedRectChanged(WebCore::FloatRect exposedRect) 260 260 SetMainFrameIsScrollable(bool isScrollable) 261 261 RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken) -
trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
r143472 r143537 31 31 #include "DrawingArea.h" 32 32 #include "LayerTreeContext.h" 33 #include <WebCore/FloatRect.h> 33 34 #include <WebCore/GraphicsLayerClient.h> 34 35 #include <WebCore/LayerFlushScheduler.h> … … 73 74 virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) OVERRIDE; 74 75 75 virtual void setExposedRect(const WebCore:: IntRect&) OVERRIDE;76 virtual void setExposedRect(const WebCore::FloatRect&) OVERRIDE; 76 77 virtual void mainFrameScrollabilityChanged(bool) OVERRIDE; 77 78 … … 121 122 bool m_hasRootCompositingLayer; 122 123 123 WebCore:: IntRect m_exposedRect;124 WebCore::FloatRect m_exposedRect; 124 125 125 126 WebCore::IntSize m_lastSentIntrinsicContentSize; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
r143472 r143537 340 340 } 341 341 342 void TiledCoreAnimationDrawingArea::setExposedRect(const IntRect& exposedRect)342 void TiledCoreAnimationDrawingArea::setExposedRect(const FloatRect& exposedRect) 343 343 { 344 344 // FIXME: This should be mapped through the scroll offset, but we need to keep it up to date.
Note:
See TracChangeset
for help on using the changeset viewer.