Changeset 107237 in webkit


Ignore:
Timestamp:
Feb 9, 2012 6:40:47 AM (12 years ago)
Author:
jocelyn.turcotte@nokia.com
Message:

[Qt] Fetch the visible rect from LayerTreeHost instead of keeping a copy in each layer.
https://bugs.webkit.org/show_bug.cgi?id=78009

Reviewed by Noam Rosenthal.

Since WebGraphicsLayers are now accessed directly from LayerTreeHost, they don't
need to keep the visible rect to pass it down their child layers anymore.

  • WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:

(WebCore::WebGraphicsLayer::setContentsScale):
(WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
(WebCore::WebGraphicsLayer::adjustVisibleRect):
(WebCore):

  • WebProcess/WebCoreSupport/WebGraphicsLayer.h:

(WebGraphicsLayerClient):
(WebGraphicsLayer):

  • WebProcess/WebPage/qt/LayerTreeHostQt.cpp:

(WebKit::LayerTreeHostQt::registerLayer):
(WebKit::LayerTreeHostQt::visibleContentsRect):
(WebKit):
(WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):

  • WebProcess/WebPage/qt/LayerTreeHostQt.h:

(LayerTreeHostQt):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r107236 r107237  
     12012-02-07  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
     2
     3        [Qt] Fetch the visible rect from LayerTreeHost instead of keeping a copy in each layer.
     4        https://bugs.webkit.org/show_bug.cgi?id=78009
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Since WebGraphicsLayers are now accessed directly from LayerTreeHost, they don't
     9        need to keep the visible rect to pass it down their child layers anymore.
     10
     11        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
     12        (WebCore::WebGraphicsLayer::setContentsScale):
     13        (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
     14        (WebCore::WebGraphicsLayer::adjustVisibleRect):
     15        (WebCore):
     16        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
     17        (WebGraphicsLayerClient):
     18        (WebGraphicsLayer):
     19        * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
     20        (WebKit::LayerTreeHostQt::registerLayer):
     21        (WebKit::LayerTreeHostQt::visibleContentsRect):
     22        (WebKit):
     23        (WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
     24        * WebProcess/WebPage/qt/LayerTreeHostQt.h:
     25        (LayerTreeHostQt):
     26
    1272012-02-09  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
    228
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp

    r107236 r107237  
    484484}
    485485
    486 void WebGraphicsLayer::setVisibleContentRectAndScale(const IntRect& pageVisibleRect, float scale)
    487 {
    488     if (m_pageVisibleRect == pageVisibleRect && m_contentsScale == scale)
    489         return;
    490 
    491     m_pageVisibleRect = pageVisibleRect;
     486void WebGraphicsLayer::setContentsScale(float scale)
     487{
    492488    m_contentsScale = scale;
    493 
    494     if (!m_mainBackingStore || m_mainBackingStore->contentsScale() != scale) {
     489    if (m_mainBackingStore && m_mainBackingStore->contentsScale() != scale) {
    495490        m_previousBackingStore = m_mainBackingStore.release();
    496491        m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
    497492        m_mainBackingStore->setContentsScale(scale);
    498     } else
    499         m_mainBackingStore->adjustVisibleRect();
     493    }
    500494}
    501495
     
    538532    // The resulting quad might be squewed and the visible rect is the bounding box of this quad,
    539533    // so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier).
    540     return m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_pageVisibleRect)));
     534    return m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_webGraphicsLayerClient->visibleContentsRect())));
    541535}
    542536
     
    624618    if (client)
    625619        client->attachLayer(this);
     620}
     621
     622void WebGraphicsLayer::adjustVisibleRect()
     623{
     624    if (m_mainBackingStore)
     625        m_mainBackingStore->adjustVisibleRect();
    626626}
    627627
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h

    r107236 r107237  
    5353    virtual void removeTile(WebLayerID, int tileID) = 0;
    5454
     55    virtual WebCore::IntRect visibleContentsRect() const = 0;
    5556    virtual bool layerTreeTileUpdatesAllowed() const = 0;
    5657    virtual int64_t adoptImageBackingStore(WebCore::Image*) = 0;
     
    103104    void setNeedsDisplayInRect(const FloatRect&);
    104105    void setContentsNeedsDisplay();
    105     void setVisibleContentRectAndScale(const IntRect&, float scale);
     106    void setContentsScale(float);
    106107    void setVisibleContentRectTrajectoryVector(const FloatPoint&);
    107108    virtual void syncCompositingState(const FloatRect&);
     
    138139    void setWebGraphicsLayerClient(WebKit::WebGraphicsLayerClient*);
    139140
     141    void adjustVisibleRect();
    140142    bool isReadyForTileBufferSwap() const;
    141143    void updateContentBuffers();
     
    148150    GraphicsLayer* m_maskTarget;
    149151    FloatRect m_needsDisplayRect;
    150     IntRect m_pageVisibleRect;
    151152    LayerTransform m_layerTransform;
    152153    bool m_needsDisplay : 1;
  • trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp

    r107236 r107237  
    241241    m_registeredLayers.add(layer);
    242242
    243     layer->setVisibleContentRectAndScale(m_visibleContentsRect, m_contentsScale);
     243    layer->setContentsScale(m_contentsScale);
     244    layer->adjustVisibleRect();
    244245}
    245246
     
    415416}
    416417
     418WebCore::IntRect LayerTreeHostQt::visibleContentsRect() const
     419{
     420    return m_visibleContentsRect;
     421}
     422
    417423void LayerTreeHostQt::setVisibleContentRectAndScale(const IntRect& rect, float scale)
    418424{
     
    423429
    424430    HashSet<WebCore::WebGraphicsLayer*>::iterator end = m_registeredLayers.end();
    425     for (HashSet<WebCore::WebGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it)
    426         (*it)->setVisibleContentRectAndScale(rect, scale);
     431    for (HashSet<WebCore::WebGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it) {
     432        (*it)->setContentsScale(scale);
     433        (*it)->adjustVisibleRect();
     434    }
    427435    scheduleLayerFlush();
    428436}
  • trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h

    r107236 r107237  
    7070    virtual void updateTile(WebLayerID, int tileID, const UpdateInfo&);
    7171    virtual void removeTile(WebLayerID, int tileID);
     72    virtual WebCore::IntRect visibleContentsRect() const;
    7273    virtual void renderNextFrame();
    7374    virtual void purgeBackingStores();
Note: See TracChangeset for help on using the changeset viewer.