Changeset 132427 in webkit


Ignore:
Timestamp:
Oct 24, 2012, 5:19:35 PM (12 years ago)
Author:
Beth Dakin
Message:

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.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r132424 r132427  
     12012-10-24  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=100169
     4        We should make TileCache tiles the size of the tile coverage rect
     5        when we can't do fast scrolling
     6        -and-
     7        <rdar://problem/12505021>
     8
     9        Reviewed by Simon Fraser.
     10
     11        New test.
     12        * platform/mac/tiled-drawing/tile-coverage-slow-scrolling-expected.txt: Added.
     13        * platform/mac/tiled-drawing/tile-coverage-slow-scrolling.html: Added.
     14
    1152012-10-24  David Barton  <dbarton@mathscribe.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r132424 r132427  
     12012-10-24  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=100169
     4        We should make TileCache tiles the size of the tile coverage rect
     5        when we can't do fast scrolling
     6        -and-
     7        <rdar://problem/12505021>
     8
     9        Reviewed by Simon Fraser.
     10
     11        Some websites that don't do fast scrolling still scroll slower than
     12        they do with tiled drawing disabled.
     13        https://bugs.webkit.org/show_bug.cgi?id=99768 addressed some of this
     14        performance problem, but there is still more ground to make up. This
     15        patch addresses the remaining issue by making tiles the size of the
     16        window when we can't do fast scrolling.
     17
     18        The constructor and create function no longer take a size parameter.
     19        That's all fully controlled within TileCache now. m_tileSize is no
     20        longer const.
     21        * platform/graphics/ca/mac/TileCache.h:
     22
     23        Store the current default size as constants so that we can access it
     24        in both the constructor and adjustTileSizeForCoverageRect().
     25        * platform/graphics/ca/mac/TileCache.mm:
     26        (WebCore::TileCache::TileCache):
     27
     28        This new function will set m_tileSize to the size of the tile
     29        coverage rect if the tile coverage is limited to the visible area.
     30        Otherwise, the tiles are set to be the default size.
     31        (WebCore::TileCache::adjustTileSizeForCoverageRect):
     32       
     33        Call adjustTileSizeForCoverageRect().
     34        (WebCore::TileCache::revalidateTiles):
     35
     36        No need to send in a size anymore.
     37        * platform/graphics/ca/mac/WebTileCacheLayer.h:
     38        (WebCore):
     39
    1402012-10-24  David Barton  <dbarton@mathscribe.com>
    241
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h

    r132301 r132427  
    5252
    5353public:
    54     static PassOwnPtr<TileCache> create(WebTileCacheLayer*, const IntSize& tileSize);
     54    static PassOwnPtr<TileCache> create(WebTileCacheLayer*);
    5555    ~TileCache();
    5656
     
    8080
    8181private:
    82     TileCache(WebTileCacheLayer*, const IntSize& tileSize);
     82    TileCache(WebTileCacheLayer*);
    8383
    8484    // TiledBacking member functions.
     
    100100
    101101    IntRect computeTileCoverageRect() const;
     102    IntSize tileSizeForCoverageRect(const IntRect&) const;
    102103
    103104    void scheduleTileRevalidation(double interval);
     
    113114    WebTileCacheLayer* m_tileCacheLayer;
    114115    RetainPtr<CALayer> m_tileContainerLayer;
    115     const IntSize m_tileSize;
     116    IntSize m_tileSize;
    116117    IntRect m_visibleRect;
    117118
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm

    r132301 r132427  
    4646namespace WebCore {
    4747
    48 PassOwnPtr<TileCache> TileCache::create(WebTileCacheLayer* tileCacheLayer, const IntSize& tileSize)
    49 {
    50     return adoptPtr(new TileCache(tileCacheLayer, tileSize));
    51 }
    52 
    53 TileCache::TileCache(WebTileCacheLayer* tileCacheLayer, const IntSize& tileSize)
     48static const int defaultTileCacheWidth = 512;
     49static const int defaultTileCacheHeight = 512;
     50
     51PassOwnPtr<TileCache> TileCache::create(WebTileCacheLayer* tileCacheLayer)
     52{
     53    return adoptPtr(new TileCache(tileCacheLayer));
     54}
     55
     56TileCache::TileCache(WebTileCacheLayer* tileCacheLayer)
    5457    : m_tileCacheLayer(tileCacheLayer)
    5558    , m_tileContainerLayer(adoptCF([[CALayer alloc] init]))
    56     , m_tileSize(tileSize)
     59    , m_tileSize(defaultTileCacheWidth, defaultTileCacheHeight)
    5760    , m_tileRevalidationTimer(this, &TileCache::tileRevalidationTimerFired)
    5861    , m_scale(1)
     
    301304    topLeft.setX(max(clampedRect.x() / m_tileSize.width(), 0));
    302305    topLeft.setY(max(clampedRect.y() / m_tileSize.height(), 0));
    303     bottomRight.setX(max(clampedRect.maxX() / m_tileSize.width(), 0));
    304     bottomRight.setY(max(clampedRect.maxY() / m_tileSize.height(), 0));
     306
     307    int bottomXRatio = ceil((float)clampedRect.maxX() / m_tileSize.width());
     308    bottomRight.setX(max(bottomXRatio - 1, 0));
     309
     310    int bottomYRatio = ceil((float)clampedRect.maxY() / m_tileSize.height());
     311    bottomRight.setY(max(bottomYRatio - 1, 0));
    305312}
    306313
     
    326333}
    327334
     335IntSize TileCache::tileSizeForCoverageRect(const IntRect& coverageRect) const
     336{
     337    if (m_tileCoverage == CoverageForVisibleArea)
     338        return coverageRect.size();
     339    return IntSize(defaultTileCacheWidth, defaultTileCacheHeight);
     340}
     341
    328342void TileCache::scheduleTileRevalidation(double interval)
    329343{
     
    380394    IntRect tileCoverageRect = computeTileCoverageRect();
    381395
     396    IntSize oldTileSize = m_tileSize;
     397    m_tileSize = tileSizeForCoverageRect(tileCoverageRect);
     398    bool tileSizeChanged = m_tileSize != oldTileSize;
     399
    382400    Vector<TileIndex> tilesToRemove;
    383401
     
    387405        WebTileLayer* tileLayer = it->value.get();
    388406
    389         if (!rectForTileIndex(tileIndex).intersects(tileCoverageRect)) {
     407        if (!rectForTileIndex(tileIndex).intersects(tileCoverageRect) || tileSizeChanged) {
    390408            // Remove this layer.
    391409            [tileLayer removeFromSuperlayer];
  • trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm

    r130554 r132427  
    4141        return nil;
    4242
    43     // FIXME: The tile size should be configurable.
    44     _tileCache = TileCache::create(self, IntSize(512, 512));
     43    _tileCache = TileCache::create(self);
    4544#ifndef NDEBUG
    4645    [self setName:@"WebTileCacheLayer"];
Note: See TracChangeset for help on using the changeset viewer.