Changeset 171132 in webkit


Ignore:
Timestamp:
Jul 15, 2014 7:58:21 PM (10 years ago)
Author:
Simon Fraser
Message:

[iOS] Fix touches inside accelerated overflow:scroll
https://bugs.webkit.org/show_bug.cgi?id=134961
<rdar://problem/16088789>

Reviewed by Benjamin Poulain.

When individual elements inside an overflow:scroll with -webkit-overflow-scrolling: touch
had touch event listeners, we would fail to take the scroll offset into account when
building the touch event region, causing touches on those elements to fail after scrolling.

Touch event region building uses RenderObject::absoluteClippedOverflowRect(), and that
code path tries to fix up repaint rects to work correctly in composited overflow:scroll.
However, that broke the touch region computation.

Fix by only ignoring the scroll offset for calls to computeRectForRepaint() which
have a non-null repaintContainer (which indicates that we're doing a repaint in the
compositing layer), and for which the repaintContainer is the containing block
which is using composited scrolling. This restores correct behavior to the event region
code which always calls this with a null repaintContainer.

  • rendering/RenderBox.cpp:

(WebCore::shouldAppyContainersClipAndOffset):
(WebCore::RenderBox::computeRectForRepaint):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r171119 r171132  
     12014-07-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Fix touches inside accelerated overflow:scroll
     4        https://bugs.webkit.org/show_bug.cgi?id=134961
     5        <rdar://problem/16088789>
     6
     7        Reviewed by Benjamin Poulain.
     8
     9        When individual elements inside an overflow:scroll with -webkit-overflow-scrolling: touch
     10        had touch event listeners, we would fail to take the scroll offset into account when
     11        building the touch event region, causing touches on those elements to fail after scrolling.
     12       
     13        Touch event region building uses RenderObject::absoluteClippedOverflowRect(), and that
     14        code path tries to fix up repaint rects to work correctly in composited overflow:scroll.
     15        However, that broke the touch region computation.
     16       
     17        Fix by only ignoring the scroll offset for calls to computeRectForRepaint() which
     18        have a non-null repaintContainer (which indicates that we're doing a repaint in the
     19        compositing layer), and for which the repaintContainer is the containing block
     20        which is using composited scrolling. This restores correct behavior to the event region
     21        code which always calls this with a null repaintContainer.
     22
     23        * rendering/RenderBox.cpp:
     24        (WebCore::shouldAppyContainersClipAndOffset):
     25        (WebCore::RenderBox::computeRectForRepaint):
     26
    1272014-07-15  Simon Fraser  <simon.fraser@apple.com>
    228
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r170841 r171132  
    21112111}
    21122112
     2113static inline bool shouldAppyContainersClipAndOffset(const RenderLayerModelObject* repaintContainer, RenderBox* containerBox)
     2114{
     2115#if PLATFORM(IOS)
     2116    if (!repaintContainer || repaintContainer != containerBox)
     2117        return true;
     2118
     2119    return !containerBox->hasLayer() || !containerBox->layer()->usesCompositedScrolling();
     2120#else
     2121    return true;
     2122#endif
     2123}
     2124
    21132125void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
    21142126{
     
    22012213    if (o->hasOverflowClip()) {
    22022214        RenderBox* containerBox = toRenderBox(o);
    2203 #if PLATFORM(IOS)
    2204         if (!containerBox->layer() || !containerBox->layer()->usesCompositedScrolling()) {
    2205 #endif
    2206         containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
    2207         if (rect.isEmpty())
    2208             return;
    2209 #if PLATFORM(IOS)
    2210         }
    2211 #endif
     2215        if (shouldAppyContainersClipAndOffset(repaintContainer, containerBox)) {
     2216            containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
     2217            if (rect.isEmpty())
     2218                return;
     2219        }
    22122220    }
    22132221
Note: See TracChangeset for help on using the changeset viewer.