Title: [171132] trunk/Source/WebCore
Revision
171132
Author
simon.fra...@apple.com
Date
2014-07-15 19:58:21 -0700 (Tue, 15 Jul 2014)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (171131 => 171132)


--- trunk/Source/WebCore/ChangeLog	2014-07-16 02:26:49 UTC (rev 171131)
+++ trunk/Source/WebCore/ChangeLog	2014-07-16 02:58:21 UTC (rev 171132)
@@ -1,5 +1,31 @@
 2014-07-15  Simon Fraser  <simon.fra...@apple.com>
 
+        [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):
+
+2014-07-15  Simon Fraser  <simon.fra...@apple.com>
+
         [iOS] Fix issues drawing subsampled image elements and CSS images
         https://bugs.webkit.org/show_bug.cgi?id=134944
         <rdar://problem/17634095>

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (171131 => 171132)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2014-07-16 02:26:49 UTC (rev 171131)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2014-07-16 02:58:21 UTC (rev 171132)
@@ -2110,6 +2110,18 @@
     return r;
 }
 
+static inline bool shouldAppyContainersClipAndOffset(const RenderLayerModelObject* repaintContainer, RenderBox* containerBox)
+{
+#if PLATFORM(IOS)
+    if (!repaintContainer || repaintContainer != containerBox)
+        return true;
+
+    return !containerBox->hasLayer() || !containerBox->layer()->usesCompositedScrolling();
+#else
+    return true;
+#endif
+}
+
 void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
 {
     // The rect we compute at each step is shifted by our x/y offset in the parent container's coordinate space.
@@ -2200,15 +2212,11 @@
     rect.setLocation(topLeft);
     if (o->hasOverflowClip()) {
         RenderBox* containerBox = toRenderBox(o);
-#if PLATFORM(IOS)
-        if (!containerBox->layer() || !containerBox->layer()->usesCompositedScrolling()) {
-#endif
-        containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
-        if (rect.isEmpty())
-            return;
-#if PLATFORM(IOS)
-        } 
-#endif
+        if (shouldAppyContainersClipAndOffset(repaintContainer, containerBox)) {
+            containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
+            if (rect.isEmpty())
+                return;
+        }
     }
 
     if (containerSkipped) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to