Changeset 202536 in webkit


Ignore:
Timestamp:
Jun 27, 2016 7:58:16 PM (8 years ago)
Author:
Simon Fraser
Message:

[iOS] -webkit-overflow-scrolling: touch prevents repaint with RTL
https://bugs.webkit.org/show_bug.cgi?id=159186
rdar://problem/26659341

Reviewed by Zalan Bujtas.
Source/WebCore:

There were two issues with repaints in -webkit-overflow-scrolling:touch scrolling
layers.

First, if the scrolled contents were inline (e.g. a <span>), then repaints were
broken because RenderInline didn't call shouldApplyClipAndScrollPositionForRepaint().
Fix by making shouldApplyClipAndScrollPositionForRepaint() a member function of RenderBox
and calling it from RenderBox::computeRectForRepaint() and RenderInline::clippedOverflowRectForRepaint().

Second, repaints were broken in RTL because RenderLayerBacking::setContentsNeedDisplayInRect()
confused scroll offset and scroll position; it needs to subtract scrollPosition.

Finally renamed to applyCachedClipAndScrollOffsetForRepaint() to applyCachedClipAndScrollPositionForRepaint()
to make it clear that it uses scrollPosition, not scrollOffset.

Tests: compositing/scrolling/touch-scrolling-repaint-spans.html

compositing/scrolling/touch-scrolling-repaint.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::applyCachedClipAndScrollPositionForRepaint):
(WebCore::RenderBox::shouldApplyClipAndScrollPositionForRepaint):
(WebCore::RenderBox::computeRectForRepaint):
(WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint): Deleted.
(WebCore::shouldApplyContainersClipAndOffset): Deleted.

  • rendering/RenderBox.h:
  • rendering/RenderInline.cpp:

(WebCore::RenderInline::clippedOverflowRectForRepaint):
(WebCore::RenderInline::computeRectForRepaint):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::computeRectForRepaint):

LayoutTests:

  • compositing/scrolling/touch-scrolling-repaint-expected.html: Added.
  • compositing/scrolling/touch-scrolling-repaint-spans-expected.html: Added.
  • compositing/scrolling/touch-scrolling-repaint-spans.html: Added.
  • compositing/scrolling/touch-scrolling-repaint.html: Added.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202532 r202536  
     12016-06-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] -webkit-overflow-scrolling: touch prevents repaint with RTL
     4        https://bugs.webkit.org/show_bug.cgi?id=159186
     5        rdar://problem/26659341
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * compositing/scrolling/touch-scrolling-repaint-expected.html: Added.
     10        * compositing/scrolling/touch-scrolling-repaint-spans-expected.html: Added.
     11        * compositing/scrolling/touch-scrolling-repaint-spans.html: Added.
     12        * compositing/scrolling/touch-scrolling-repaint.html: Added.
     13
    1142016-06-27  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r202533 r202536  
     12016-06-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] -webkit-overflow-scrolling: touch prevents repaint with RTL
     4        https://bugs.webkit.org/show_bug.cgi?id=159186
     5        rdar://problem/26659341
     6
     7        Reviewed by Zalan Bujtas.
     8       
     9        There were two issues with repaints in -webkit-overflow-scrolling:touch scrolling
     10        layers.
     11
     12        First, if the scrolled contents were inline (e.g. a <span>), then repaints were
     13        broken because RenderInline didn't call shouldApplyClipAndScrollPositionForRepaint().
     14        Fix by making shouldApplyClipAndScrollPositionForRepaint() a member function of RenderBox
     15        and calling it from RenderBox::computeRectForRepaint() and RenderInline::clippedOverflowRectForRepaint().
     16
     17        Second, repaints were broken in RTL because RenderLayerBacking::setContentsNeedDisplayInRect()
     18        confused scroll offset and scroll position; it needs to subtract scrollPosition.
     19       
     20        Finally renamed to applyCachedClipAndScrollOffsetForRepaint() to applyCachedClipAndScrollPositionForRepaint()
     21        to make it clear that it uses scrollPosition, not scrollOffset.
     22
     23        Tests: compositing/scrolling/touch-scrolling-repaint-spans.html
     24               compositing/scrolling/touch-scrolling-repaint.html
     25
     26        * rendering/RenderBox.cpp:
     27        (WebCore::RenderBox::applyCachedClipAndScrollPositionForRepaint):
     28        (WebCore::RenderBox::shouldApplyClipAndScrollPositionForRepaint):
     29        (WebCore::RenderBox::computeRectForRepaint):
     30        (WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint): Deleted.
     31        (WebCore::shouldApplyContainersClipAndOffset): Deleted.
     32        * rendering/RenderBox.h:
     33        * rendering/RenderInline.cpp:
     34        (WebCore::RenderInline::clippedOverflowRectForRepaint):
     35        (WebCore::RenderInline::computeRectForRepaint):
     36        * rendering/RenderLayerBacking.cpp:
     37        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
     38        * rendering/RenderObject.cpp:
     39        (WebCore::RenderObject::computeRectForRepaint):
     40
    1412016-06-27  Commit Queue  <commit-queue@webkit.org>
    242
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r202103 r202536  
    10131013}
    10141014
    1015 void RenderBox::applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const
     1015void RenderBox::applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect) const
    10161016{
    10171017    flipForWritingMode(paintRect);
     
    21952195}
    21962196
    2197 static inline bool shouldApplyContainersClipAndOffset(const RenderLayerModelObject* repaintContainer, RenderBox* containerBox)
     2197bool RenderBox::shouldApplyClipAndScrollPositionForRepaint(const RenderLayerModelObject* repaintContainer) const
    21982198{
    21992199#if PLATFORM(IOS)
    2200     if (!repaintContainer || repaintContainer != containerBox)
     2200    if (!repaintContainer || repaintContainer != this)
    22012201        return true;
    22022202
    2203     return !containerBox->hasLayer() || !containerBox->layer()->usesCompositedScrolling();
     2203    return !hasLayer() || !layer()->usesCompositedScrolling();
    22042204#else
    22052205    UNUSED_PARAM(repaintContainer);
    2206     UNUSED_PARAM(containerBox);
    22072206    return true;
    22082207#endif
     
    23102309    if (container->hasOverflowClip()) {
    23112310        RenderBox& containerBox = downcast<RenderBox>(*container);
    2312         if (shouldApplyContainersClipAndOffset(repaintContainer, &containerBox)) {
    2313             containerBox.applyCachedClipAndScrollOffsetForRepaint(adjustedRect);
     2311        if (containerBox.shouldApplyClipAndScrollPositionForRepaint(repaintContainer)) {
     2312            containerBox.applyCachedClipAndScrollPositionForRepaint(adjustedRect);
    23142313            if (adjustedRect.isEmpty())
    23152314                return adjustedRect;
  • trunk/Source/WebCore/rendering/RenderBox.h

    r201701 r202536  
    578578    ScrollPosition scrollPosition() const;
    579579    LayoutSize cachedSizeForOverflowClip() const;
    580     void applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const;
     580
     581    bool shouldApplyClipAndScrollPositionForRepaint(const RenderLayerModelObject* repaintContainer) const;
     582    void applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect) const;
    581583
    582584    virtual bool hasRelativeDimensions() const;
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r201635 r202536  
    12351235        return repaintRect;
    12361236
    1237     if (containingBlock->hasOverflowClip())
    1238         containingBlock->applyCachedClipAndScrollOffsetForRepaint(repaintRect);
     1237    if (containingBlock->hasOverflowClip() && containingBlock->shouldApplyClipAndScrollPositionForRepaint(repaintContainer))
     1238        containingBlock->applyCachedClipAndScrollPositionForRepaint(repaintRect);
    12391239
    12401240    repaintRect = containingBlock->computeRectForRepaint(repaintRect, repaintContainer);
     
    12971297    adjustedRect.setLocation(topLeft);
    12981298    if (container->hasOverflowClip()) {
    1299         downcast<RenderBox>(*container).applyCachedClipAndScrollOffsetForRepaint(adjustedRect);
     1299        downcast<RenderBox>(*container).applyCachedClipAndScrollPositionForRepaint(adjustedRect);
    13001300        if (adjustedRect.isEmpty())
    13011301            return adjustedRect;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r202005 r202536  
    22852285        layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);
    22862286#if PLATFORM(IOS)
    2287         // Account for the fact that RenderLayerBacking::updateGeometry() bakes scrollOffset into offsetFromRenderer on iOS.
    2288         layerDirtyRect.moveBy(-m_owningLayer.scrollOffset() + m_devicePixelFractionFromRenderer);
     2287        // Account for the fact that RenderLayerBacking::updateGeometry() bakes scrollOffset into offsetFromRenderer on iOS,
     2288        // but the repaint rect is computed without taking the scroll position into account (see shouldApplyClipAndScrollPositionForRepaint()).
     2289        layerDirtyRect.moveBy(-m_owningLayer.scrollPosition());
    22892290#endif
    22902291        m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r202292 r202536  
    979979    LayoutRect adjustedRect = rect;
    980980    if (parent->hasOverflowClip()) {
    981         downcast<RenderBox>(*parent).applyCachedClipAndScrollOffsetForRepaint(adjustedRect);
     981        downcast<RenderBox>(*parent).applyCachedClipAndScrollPositionForRepaint(adjustedRect);
    982982        if (adjustedRect.isEmpty())
    983983            return adjustedRect;
Note: See TracChangeset for help on using the changeset viewer.