Changeset 198502 in webkit


Ignore:
Timestamp:
Mar 21, 2016, 3:25:08 PM (10 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Use larger tiles when possible to reduce per-tile painting overhead
https://bugs.webkit.org/show_bug.cgi?id=155734
rdar://problem/24968144

Reviewed by Tim Horton.

Source/WebCore:

The existing tile size logic is wired to adjustScrollbars, which doesn't fire
when scrolling is delegated. For iOS WK2, key off of a new unobscuredContentSizeChanged()
function that runs when the UI process tells told WebCore that the unobscured size
has changed. In addition, contentsResized() is used to update scrollability when
page changes size.

  • page/FrameView.cpp:

(WebCore::FrameView::contentsResized):
(WebCore::FrameView::addedOrRemovedScrollbar):
(WebCore::FrameView::adjustTiledBackingScrollability): Handle both delegated and non-delegated
scrolling; the former looks at the visible size (based on the unobscuredVisibleContentRect),
the latter at the presence of scrollbars.
(WebCore::FrameView::unobscuredContentSizeChanged):

  • page/FrameView.h:
  • platform/ScrollView.h:

(WebCore::ScrollView::unobscuredContentSizeChanged):

  • platform/graphics/ca/TileController.cpp:

(WebCore::TileController::adjustTileCoverageRect): Use kDefaultTileSize rather than the
tile size, to retain the old amount of overdraw.
(WebCore::TileController::tileSize): There was a bug in the not-scrollable case; we need
to scale.

  • platform/ios/ScrollViewIOS.mm:

(WebCore::ScrollView::setUnobscuredContentSize):

LayoutTests:

New results with larger page tiles in WK2.

  • platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt: Added.
  • platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt: Added.
  • platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt: Added.
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r198501 r198502  
     12016-03-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Use larger tiles when possible to reduce per-tile painting overhead
     4        https://bugs.webkit.org/show_bug.cgi?id=155734
     5        rdar://problem/24968144
     6
     7        Reviewed by Tim Horton.
     8
     9        New results with larger page tiles in WK2.
     10
     11        * platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt: Added.
     12        * platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt: Added.
     13        * platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt: Added.
     14
    1152016-03-21  Hyungwook Lee  <hyungwook.lee@navercorp.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r198500 r198502  
     12016-03-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Use larger tiles when possible to reduce per-tile painting overhead
     4        https://bugs.webkit.org/show_bug.cgi?id=155734
     5        rdar://problem/24968144
     6
     7        Reviewed by Tim Horton.
     8
     9        The existing tile size logic is wired to adjustScrollbars, which doesn't fire
     10        when scrolling is delegated. For iOS WK2, key off of a new unobscuredContentSizeChanged()
     11        function that runs when the UI process tells told WebCore that the unobscured size
     12        has changed. In addition, contentsResized() is used to update scrollability when
     13        page changes size.
     14
     15        * page/FrameView.cpp:
     16        (WebCore::FrameView::contentsResized):
     17        (WebCore::FrameView::addedOrRemovedScrollbar):
     18        (WebCore::FrameView::adjustTiledBackingScrollability): Handle both delegated and non-delegated
     19        scrolling; the former looks at the visible size (based on the unobscuredVisibleContentRect),
     20        the latter at the presence of scrollbars.
     21        (WebCore::FrameView::unobscuredContentSizeChanged):
     22        * page/FrameView.h:
     23        * platform/ScrollView.h:
     24        (WebCore::ScrollView::unobscuredContentSizeChanged):
     25        * platform/graphics/ca/TileController.cpp:
     26        (WebCore::TileController::adjustTileCoverageRect): Use kDefaultTileSize rather than the
     27        tile size, to retain the old amount of overdraw.
     28        (WebCore::TileController::tileSize): There was a bug in the not-scrollable case; we need
     29        to scale.
     30        * platform/ios/ScrollViewIOS.mm:
     31        (WebCore::ScrollView::setUnobscuredContentSize):
     32
    1332016-03-21  Chris Dumez  <cdumez@apple.com>
    234
  • trunk/Source/WebCore/page/FrameView.cpp

    r198238 r198502  
    21372137}
    21382138
     2139void FrameView::contentsResized()
     2140{
     2141    // For non-delegated scrolling, adjustTiledBackingScrollability() is called via addedOrRemovedScrollbar() which occurs less often.
     2142    if (delegatesScrolling())
     2143        adjustTiledBackingScrollability();
     2144}
     2145
    21392146void FrameView::delegatesScrollingDidChange()
    21402147{
     
    24672474    }
    24682475
    2469     if (auto* tiledBacking = this->tiledBacking()) {
    2470         TiledBacking::Scrollability scrollability = TiledBacking::NotScrollable;
    2471         if (horizontalScrollbar())
    2472             scrollability = TiledBacking::HorizontallyScrollable;
    2473 
    2474         if (verticalScrollbar())
    2475             scrollability |= TiledBacking::VerticallyScrollable;
    2476 
    2477         tiledBacking->setScrollability(scrollability);
    2478     }
    2479 }
     2476    adjustTiledBackingScrollability();
     2477}
     2478
     2479void FrameView::adjustTiledBackingScrollability()
     2480{
     2481    auto* tiledBacking = this->tiledBacking();
     2482    if (!tiledBacking)
     2483        return;
     2484   
     2485    bool horizontallyScrollable;
     2486    bool verticallyScrollable;
     2487
     2488    if (delegatesScrolling()) {
     2489        IntSize documentSize = contentsSize();
     2490        IntSize visibleSize = this->visibleSize();
     2491       
     2492        horizontallyScrollable = documentSize.width() > visibleSize.width();
     2493        verticallyScrollable = documentSize.height() > visibleSize.height();
     2494    } else {
     2495        horizontallyScrollable = horizontalScrollbar();
     2496        verticallyScrollable = verticalScrollbar();
     2497    }
     2498
     2499    TiledBacking::Scrollability scrollability = TiledBacking::NotScrollable;
     2500    if (horizontallyScrollable)
     2501        scrollability = TiledBacking::HorizontallyScrollable;
     2502
     2503    if (verticallyScrollable)
     2504        scrollability |= TiledBacking::VerticallyScrollable;
     2505
     2506    tiledBacking->setScrollability(scrollability);
     2507}
     2508
     2509#if PLATFORM(IOS)
     2510void FrameView::unobscuredContentSizeChanged()
     2511{
     2512    adjustTiledBackingScrollability();
     2513}
     2514#endif
    24802515
    24812516static LayerFlushThrottleState::Flags determineLayerFlushThrottleState(Page& page)
  • trunk/Source/WebCore/page/FrameView.h

    r198238 r198502  
    511511    WEBCORE_EXPORT void availableContentSizeChanged(AvailableSizeChangeReason) override;
    512512
     513    void adjustTiledBackingScrollability();
     514
    513515    void addPaintPendingMilestones(LayoutMilestones);
    514516    void firePaintRelatedMilestonesIfNeeded();
     
    637639    GraphicsLayer* layerForOverhangAreas() const override;
    638640#endif
     641    void contentsResized() override;
     642
     643#if PLATFORM(IOS)
     644    void unobscuredContentSizeChanged() override;
     645#endif
    639646
    640647    bool usesCompositedScrolling() const override;
  • trunk/Source/WebCore/platform/ScrollView.h

    r197563 r198502  
    420420    virtual void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset&, const ScrollOffset&) { }
    421421
     422#if PLATFORM(IOS)
     423    virtual void unobscuredContentSizeChanged() { }
     424#endif
     425
    422426private:
    423427    IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
  • trunk/Source/WebCore/platform/graphics/ca/TileController.cpp

    r198189 r198502  
    364364    }
    365365
    366     double horizontalMargin = tileSize().width() / contentsScale;
    367     double verticalMargin = tileSize().height() / contentsScale;
     366    double horizontalMargin = kDefaultTileSize / contentsScale;
     367    double verticalMargin = kDefaultTileSize / contentsScale;
    368368
    369369    double currentTime = monotonicallyIncreasingTime();
     
    495495    IntSize tileSize(kDefaultTileSize, kDefaultTileSize);
    496496
    497     if (m_scrollability == NotScrollable)
    498         tileSize = boundsWithoutMargin().size().constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
    499     else if (m_scrollability == VerticallyScrollable)
    500         tileSize.setWidth(std::min(std::max(boundsWithoutMargin().width(), kDefaultTileSize), kGiantTileSize));
     497    if (m_scrollability == NotScrollable) {
     498        IntSize scaledSize = expandedIntSize(boundsWithoutMargin().size() * tileGrid().scale());
     499        tileSize = scaledSize.constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
     500    } else if (m_scrollability == VerticallyScrollable)
     501        tileSize.setWidth(std::min(std::max<int>(ceilf(boundsWithoutMargin().width() * tileGrid().scale()), kDefaultTileSize), kGiantTileSize));
     502
     503    LOG_WITH_STREAM(Scrolling, stream << "TileController::tileSize newSize=" << tileSize);
    501504
    502505    m_tileSizeLocked = true;
  • trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm

    r194476 r198502  
    117117{
    118118    ASSERT(!platformWidget());
     119    if (size == m_unobscuredContentSize)
     120        return;
     121
    119122    m_unobscuredContentSize = size;
     123    unobscuredContentSizeChanged();
    120124}
    121125
Note: See TracChangeset for help on using the changeset viewer.