Changeset 152266 in webkit


Ignore:
Timestamp:
Jul 1, 2013 2:47:51 PM (11 years ago)
Author:
timothy_horton@apple.com
Message:

[wk2] TiledCoreAnimationDrawingArea should support scrolling its exposed rect
https://bugs.webkit.org/show_bug.cgi?id=118173
<rdar://problem/14301166>

Reviewed by Anders Carlsson.

Offset the exposed rect passed from the WKView by the main frame's current scroll position
before sending it to our TiledBackings, so that it is in the same coordinate space as their
ordinary visibleRects.

This has the side effect of making clips-to-exposed-rect testable (though useless) in Safari.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:

Add updateScrolledExposedRect() and m_scrolledExposedRect.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::scroll):
Call updateScrolledExposedRect when the main frame scrolls.

(WebKit::TiledCoreAnimationDrawingArea::setExposedRect):
Remove a FIXME about this change.
Call updateScrolledExposedRect instead of passing down the unscrolled rect.

(WebKit::TiledCoreAnimationDrawingArea::setClipsToExposedRect):
Call updateScrolledExposedRect, because that method will short-circuit if
setClipsToExposedRect is false, so we need to update here for correctness
if we get a setExposedRect(), setClipsToExposedRect(true) pair.

(WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
Update m_scrolledExposedRect and propagate it to our TiledBackings.

(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
(WebKit::TiledCoreAnimationDrawingArea::createPageOverlayLayer):
(WebKit::TiledCoreAnimationDrawingArea::didCommitChangesForLayer):
Use the scrolled exposed rect.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r152249 r152266  
     12013-07-01  Tim Horton  <timothy_horton@apple.com>
     2
     3        [wk2] TiledCoreAnimationDrawingArea should support scrolling its exposed rect
     4        https://bugs.webkit.org/show_bug.cgi?id=118173
     5        <rdar://problem/14301166>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        Offset the exposed rect passed from the WKView by the main frame's current scroll position
     10        before sending it to our TiledBackings, so that it is in the same coordinate space as their
     11        ordinary visibleRects.
     12
     13        This has the side effect of making clips-to-exposed-rect testable (though useless) in Safari.
     14
     15        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
     16        Add updateScrolledExposedRect() and m_scrolledExposedRect.
     17
     18        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     19        (WebKit::TiledCoreAnimationDrawingArea::scroll):
     20        Call updateScrolledExposedRect when the main frame scrolls.
     21
     22        (WebKit::TiledCoreAnimationDrawingArea::setExposedRect):
     23        Remove a FIXME about this change.
     24        Call updateScrolledExposedRect instead of passing down the unscrolled rect.
     25
     26        (WebKit::TiledCoreAnimationDrawingArea::setClipsToExposedRect):
     27        Call updateScrolledExposedRect, because that method will short-circuit if
     28        setClipsToExposedRect is false, so we need to update here for correctness
     29        if we get a setExposedRect(), setClipsToExposedRect(true) pair.
     30
     31        (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
     32        Update m_scrolledExposedRect and propagate it to our TiledBackings.
     33
     34        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
     35        (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
     36        (WebKit::TiledCoreAnimationDrawingArea::createPageOverlayLayer):
     37        (WebKit::TiledCoreAnimationDrawingArea::didCommitChangesForLayer):
     38        Use the scrolled exposed rect.
     39
    1402013-07-01  Ada Chan  <adachan@apple.com>
    241
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r152190 r152266  
    112112    void updateIntrinsicContentSizeTimerFired(WebCore::Timer<TiledCoreAnimationDrawingArea>*);
    113113    void updateMainFrameClipsToExposedRect();
     114    void updateScrolledExposedRect();
    114115   
    115116    void invalidateAllPageOverlays();
     
    133134
    134135    WebCore::FloatRect m_exposedRect;
     136    WebCore::FloatRect m_scrolledExposedRect;
    135137    bool m_clipsToExposedRect;
    136138
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r152190 r152266  
    113113void TiledCoreAnimationDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
    114114{
     115    updateScrolledExposedRect();
    115116}
    116117
     
    352353    IntRect visibleRect = enclosingIntRect(m_rootLayer.get().frame);
    353354    if (m_clipsToExposedRect)
    354         visibleRect.intersect(enclosingIntRect(m_exposedRect));
     355        visibleRect.intersect(enclosingIntRect(m_scrolledExposedRect));
    355356
    356357    for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
     
    405406void TiledCoreAnimationDrawingArea::setExposedRect(const FloatRect& exposedRect)
    406407{
    407     // FIXME: This should be mapped through the scroll offset, but we need to keep it up to date.
    408408    m_exposedRect = exposedRect;
    409 
    410     mainFrameTiledBacking()->setExposedRect(exposedRect);
    411 
    412     for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it)
     409    updateScrolledExposedRect();
     410}
     411
     412void TiledCoreAnimationDrawingArea::setClipsToExposedRect(bool clipsToExposedRect)
     413{
     414    m_clipsToExposedRect = clipsToExposedRect;
     415    updateScrolledExposedRect();
     416    updateMainFrameClipsToExposedRect();
     417}
     418
     419void TiledCoreAnimationDrawingArea::updateScrolledExposedRect()
     420{
     421    if (!m_clipsToExposedRect)
     422        return;
     423
     424    Frame* frame = m_webPage->corePage()->mainFrame();
     425    if (!frame)
     426        return;
     427
     428    FrameView* frameView = frame->view();
     429    if (!frameView)
     430        return;
     431
     432    IntPoint scrollPositionWithOrigin = frameView->scrollPosition() + toIntSize(frameView->scrollOrigin());
     433
     434    m_scrolledExposedRect = m_exposedRect;
     435    m_scrolledExposedRect.moveBy(scrollPositionWithOrigin);
     436
     437    mainFrameTiledBacking()->setExposedRect(m_scrolledExposedRect);
     438
     439    for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
    413440        if (TiledBacking* tiledBacking = it->value->tiledBacking())
    414             tiledBacking->setExposedRect(exposedRect);
    415 }
    416 
    417 void TiledCoreAnimationDrawingArea::setClipsToExposedRect(bool clipsToExposedRect)
    418 {
    419     m_clipsToExposedRect = clipsToExposedRect;
    420     updateMainFrameClipsToExposedRect();
     441            tiledBacking->setExposedRect(m_scrolledExposedRect);
     442    }
    421443}
    422444
     
    566588    if (TiledBacking* tiledBacking = mainFrameTiledBacking()) {
    567589        tiledBacking->setAggressivelyRetainsTiles(m_webPage->corePage()->settings()->aggressiveTileRetentionEnabled());
    568         tiledBacking->setExposedRect(m_exposedRect);
     590        tiledBacking->setExposedRect(m_scrolledExposedRect);
    569591    }
    570592
     
    590612
    591613    if (TiledBacking* tiledBacking = layer->tiledBacking()) {
    592         tiledBacking->setExposedRect(m_exposedRect);
     614        tiledBacking->setExposedRect(m_scrolledExposedRect);
    593615        tiledBacking->setClipsToExposedRect(m_clipsToExposedRect);
    594616    }
     
    638660
    639661    if (TiledBacking* tiledBacking = layer->tiledBacking()) {
    640         tiledBacking->setExposedRect(m_exposedRect);
     662        tiledBacking->setExposedRect(m_scrolledExposedRect);
    641663        tiledBacking->setClipsToExposedRect(m_clipsToExposedRect);
    642664    }
Note: See TracChangeset for help on using the changeset viewer.