Changeset 59611 in webkit


Ignore:
Timestamp:
May 17, 2010 8:34:14 AM (14 years ago)
Author:
antti.j.koivisto@nokia.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=39218
[Qt] Tiled backing store tiles sometimes flicker when exiting a zoom animation

Reviewed by Kenneth Rohde Christiansen.

WebCore:

Tiles sometimes flicker when exiting a zoom animation. This happens as a result
of the visible rectangle being momentarily out of sync.

Instead of updating the visible rect by explicitly setting it, pull it through
the client and recompute in the WebKit level.

  • page/ChromeClient.h:

(WebCore::ChromeClient::visibleRectForTiledBackingStore):

  • page/Frame.cpp:

(WebCore::Frame::tiledBackingStoreVisibleRect):

  • page/Frame.h:
  • platform/graphics/TiledBackingStore.cpp:

(WebCore::TiledBackingStore::checkVisibleRectChanged):
(WebCore::TiledBackingStore::createTiles):

  • platform/graphics/TiledBackingStore.h:
  • platform/graphics/TiledBackingStoreClient.h:

WebKit/qt:

Tiles sometimes flicker when exiting a zoom animation. This happens as a result
of the visible rectangle being momentarily out of sync.

Instead of updating the visible rect by explicitly setting it, pull it through
the client and recompute in WebKit the level.

  • Api/qgraphicswebview.cpp:

(QGraphicsWebView::paint):

  • WebCoreSupport/ChromeClientQt.cpp:

(WebCore::ChromeClientQt::visibleRectForTiledBackingStore):

  • WebCoreSupport/ChromeClientQt.h:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r59610 r59611  
     12010-05-17  Antti Koivisto  <koivisto@iki.fi>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=39218
     6        [Qt] Tiled backing store tiles sometimes flicker when exiting a zoom animation
     7       
     8        Tiles sometimes flicker when exiting a zoom animation. This happens as a result
     9        of the visible rectangle being momentarily out of sync.
     10       
     11        Instead of updating the visible rect by explicitly setting it, pull it through
     12        the client and recompute in the WebKit level.
     13
     14        * page/ChromeClient.h:
     15        (WebCore::ChromeClient::visibleRectForTiledBackingStore):
     16        * page/Frame.cpp:
     17        (WebCore::Frame::tiledBackingStoreVisibleRect):
     18        * page/Frame.h:
     19        * platform/graphics/TiledBackingStore.cpp:
     20        (WebCore::TiledBackingStore::checkVisibleRectChanged):
     21        (WebCore::TiledBackingStore::createTiles):
     22        * platform/graphics/TiledBackingStore.h:
     23        * platform/graphics/TiledBackingStoreClient.h:
     24
    1252010-05-15  Adam Roben  <aroben@apple.com>
    226
  • trunk/WebCore/page/ChromeClient.h

    r57961 r59611  
    223223        virtual void enterFullscreenForNode(Node*) { }
    224224        virtual void exitFullscreenForNode(Node*) { }
    225        
     225
     226#if ENABLE(TILED_BACKING_STORE)
     227        virtual IntRect visibleRectForTiledBackingStore() const { return IntRect(); }
     228#endif
     229
    226230#if PLATFORM(MAC)
    227231        virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
  • trunk/WebCore/page/Frame.cpp

    r59384 r59611  
    3737#include "CachedCSSStyleSheet.h"
    3838#include "Chrome.h"
     39#include "ChromeClient.h"
    3940#include "DOMWindow.h"
    4041#include "DocLoader.h"
     
    18441845    return IntRect(IntPoint(), m_view->contentsSize());
    18451846}
     1847
     1848IntRect Frame::tiledBackingStoreVisibleRect()
     1849{
     1850    if (!m_page)
     1851        return IntRect();
     1852    return m_page->chrome()->client()->visibleRectForTiledBackingStore();
     1853}
    18461854#endif
    18471855
  • trunk/WebCore/page/Frame.h

    r59384 r59611  
    295295        virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea);
    296296        virtual IntRect tiledBackingStoreContentsRect();
     297        virtual IntRect tiledBackingStoreVisibleRect();
    297298#endif
    298299
  • trunk/WebCore/platform/graphics/TiledBackingStore.cpp

    r59363 r59611  
    132132}
    133133
    134 void TiledBackingStore::viewportChanged(const IntRect& contentsViewport)
    135 {
    136     IntRect viewport = mapFromContents(contentsViewport);
    137     if (m_viewport == viewport)
    138         return;
    139 
    140     m_viewport = viewport;
     134void TiledBackingStore::adjustVisibleRect()
     135{
     136    IntRect visibleRect = mapFromContents(m_client->tiledBackingStoreVisibleRect());
     137    if (m_previousVisibleRect == visibleRect)
     138        return;
     139    m_previousVisibleRect = visibleRect;
    141140
    142141    startTileCreationTimer();
     
    180179    if (m_contentsFrozen)
    181180        return;
    182 
    183     if (m_viewport.isEmpty())
     181   
     182    IntRect visibleRect = mapFromContents(m_client->tiledBackingStoreVisibleRect());
     183    m_previousVisibleRect = visibleRect;
     184
     185    if (visibleRect.isEmpty())
    184186        return;
    185187
     
    188190
    189191    // FIXME: Make configurable/adapt to memory.
    190     IntRect keepRect = m_viewport;
    191     keepRect.inflateX(m_viewport.width());
    192     keepRect.inflateY(3 * m_viewport.height());
     192    IntRect keepRect = visibleRect;
     193    keepRect.inflateX(visibleRect.width());
     194    keepRect.inflateY(3 * visibleRect.height());
    193195    keepRect.intersect(contentsRect());
    194196   
    195197    dropTilesOutsideRect(keepRect);
    196198   
    197     IntRect coverRect = m_viewport;
    198     coverRect.inflateX(m_viewport.width() / 2);
    199     coverRect.inflateY(2 * m_viewport.height());
     199    IntRect coverRect = visibleRect;
     200    coverRect.inflateX(visibleRect.width() / 2);
     201    coverRect.inflateY(2 * visibleRect.height());
    200202    coverRect.intersect(contentsRect());
    201203   
     
    214216            ++requiredTileCount;
    215217            // Distance is 0 for all currently visible tiles.
    216             double distance = tileDistance(m_viewport, currentCoordinate);
     218            double distance = tileDistance(visibleRect, currentCoordinate);
    217219            if (distance > shortestDistance)
    218220                continue;
  • trunk/WebCore/platform/graphics/TiledBackingStore.h

    r56184 r59611  
    4242    ~TiledBackingStore();
    4343
    44     void viewportChanged(const IntRect& viewportRect);
     44    void adjustVisibleRect();
    4545   
    4646    float contentsScale() { return m_contentsScale; }
     
    9696    IntSize m_tileSize;
    9797   
    98     IntRect m_viewport;
     98    IntRect m_previousVisibleRect;
    9999    float m_contentsScale;
    100100    float m_pendingScale;
  • trunk/WebCore/platform/graphics/TiledBackingStoreClient.h

    r55976 r59611  
    3030    virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) = 0;
    3131    virtual IntRect tiledBackingStoreContentsRect() = 0;
     32    virtual IntRect tiledBackingStoreVisibleRect() = 0;
    3233};
    3334
  • trunk/WebKit/qt/Api/qgraphicswebview.cpp

    r59539 r59611  
    6161
    6262    void updateResizesToContentsForPage();
    63     QRectF graphicsItemVisibleRect() const;
     63    virtual QRectF graphicsItemVisibleRect() const;
     64
    6465
    6566    void detachCurrentPage();
     
    312313    if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) {
    313314        // FIXME: We should set the backing store viewport earlier than in paint
    314         if (d->resizesToContents)
    315             backingStore->viewportChanged(WebCore::IntRect(d->graphicsItemVisibleRect()));
    316         else {
    317             QRectF visibleRect(d->page->mainFrame()->scrollPosition(), d->page->mainFrame()->geometry().size());
    318             backingStore->viewportChanged(WebCore::IntRect(visibleRect));
    319         }
     315        backingStore->adjustVisibleRect();
    320316        // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change.
    321317        WebCore::GraphicsContext context(painter);
  • trunk/WebKit/qt/ChangeLog

    r59580 r59611  
     12010-05-17  Antti Koivisto  <koivisto@iki.fi>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=39218
     6        [Qt] Tiled backing store tiles sometimes flicker when exiting a zoom animation
     7       
     8        Tiles sometimes flicker when exiting a zoom animation. This happens as a result
     9        of the visible rectangle being momentarily out of sync.
     10       
     11        Instead of updating the visible rect by explicitly setting it, pull it through
     12        the client and recompute in WebKit the level.
     13
     14        * Api/qgraphicswebview.cpp:
     15        (QGraphicsWebView::paint):
     16        * WebCoreSupport/ChromeClientQt.cpp:
     17        (WebCore::ChromeClientQt::visibleRectForTiledBackingStore):
     18        * WebCoreSupport/ChromeClientQt.h:
     19
    1202010-05-16  Robert Hogan  <robert@webkit.org>
    221
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r59033 r59611  
    568568
    569569#endif
     570   
     571#if ENABLE(TILED_BACKING_STORE)
     572IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
     573{
     574    if (!platformPageClient())
     575        return IntRect();
     576    return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect()));
     577}
     578#endif
    570579
    571580QtAbstractWebPopup* ChromeClientQt::createSelectPopup()
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r59033 r59611  
    146146#endif
    147147
     148#if ENABLE(TILED_BACKING_STORE)
     149        virtual IntRect visibleRectForTiledBackingStore() const;
     150#endif
     151
    148152#if ENABLE(TOUCH_EVENTS)
    149153        virtual void needTouchEvents(bool) { }
Note: See TracChangeset for help on using the changeset viewer.