Title: [107013] trunk/Source/WebCore
Revision
107013
Author
ander...@apple.com
Date
2012-02-07 17:00:06 -0800 (Tue, 07 Feb 2012)

Log Message

Use the non-fast-scrollable region to detect when we can't do fast scrolling
https://bugs.webkit.org/show_bug.cgi?id=78056
<rdar://problem/10247932>

Reviewed by Sam Weinig.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
Actually set the non-fast scrollable region on the scrolling tree state.

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::tryToHandleWheelEvent):
Check if the wheel event's position is inside the non-fast-scrollable region
and return false if it is.

(WebCore::ScrollingTree::updateMainFrameScrollPosition):
Store the cached main frame scroll position so we can use it in tryToHandleWheelEvent.

* platform/graphics/Region.cpp:
* platform/graphics/Region.h:
Add a simple contains(const IntPoint&) member function.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107012 => 107013)


--- trunk/Source/WebCore/ChangeLog	2012-02-08 00:59:11 UTC (rev 107012)
+++ trunk/Source/WebCore/ChangeLog	2012-02-08 01:00:06 UTC (rev 107013)
@@ -1,3 +1,27 @@
+2012-02-07  Anders Carlsson  <ander...@apple.com>
+
+        Use the non-fast-scrollable region to detect when we can't do fast scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=78056
+        <rdar://problem/10247932>
+
+        Reviewed by Sam Weinig.
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
+        Actually set the non-fast scrollable region on the scrolling tree state.
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::tryToHandleWheelEvent):
+        Check if the wheel event's position is inside the non-fast-scrollable region
+        and return false if it is.
+
+        (WebCore::ScrollingTree::updateMainFrameScrollPosition):
+        Store the cached main frame scroll position so we can use it in tryToHandleWheelEvent.
+
+        * platform/graphics/Region.cpp:
+        * platform/graphics/Region.h:
+        Add a simple contains(const IntPoint&) member function.
+
 2012-02-07  Dan Bernstein  <m...@apple.com>
 
         <rdar://problem/10475450> Synthetic bold is illegible under some scaling transforms

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (107012 => 107013)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-02-08 00:59:11 UTC (rev 107012)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-02-08 01:00:06 UTC (rev 107013)
@@ -117,6 +117,7 @@
 
     m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
     m_scrollingTreeState->setContentsSize(frameView->contentsSize());
+    m_scrollingTreeState->setNonFastScrollableRegion(nonScrollableRegion);
     scheduleTreeStateCommit();
 }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (107012 => 107013)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2012-02-08 00:59:11 UTC (rev 107012)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2012-02-08 01:00:06 UTC (rev 107013)
@@ -61,10 +61,16 @@
 
         if (m_hasWheelEventHandlers)
             return false;
+
+        if (!m_nonFastScrollableRegion.isEmpty()) {
+            // FIXME: This is not correct for non-default scroll origins.
+            IntPoint position = wheelEvent.position();
+            position.moveBy(m_mainFrameScrollPosition);
+            if (m_nonFastScrollableRegion.contains(position))
+                return false;
+        }
     }
 
-    // FIXME: Check if we're over a subframe or overflow div.
-
     ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, this, wheelEvent));
     return true;
 }
@@ -106,6 +112,11 @@
     if (!m_scrollingCoordinator)
         return;
 
+    {
+        MutexLocker lock(m_mutex);
+        m_mainFrameScrollPosition = scrollPosition;
+    }
+
     callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition));
 }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (107012 => 107013)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2012-02-08 00:59:11 UTC (rev 107012)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2012-02-08 01:00:06 UTC (rev 107013)
@@ -73,6 +73,7 @@
 
     Mutex m_mutex;
     Region m_nonFastScrollableRegion;
+    IntPoint m_mainFrameScrollPosition;
     bool m_hasWheelEventHandlers;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/Region.cpp (107012 => 107013)


--- trunk/Source/WebCore/platform/graphics/Region.cpp	2012-02-08 00:59:11 UTC (rev 107012)
+++ trunk/Source/WebCore/platform/graphics/Region.cpp	2012-02-08 01:00:06 UTC (rev 107013)
@@ -70,6 +70,13 @@
     return WebCore::intersect(region, *this) == region;
 }
 
+bool Region::contains(const IntPoint& point) const
+{
+    // FIXME: This is inefficient. We should be able to iterate over the spans and find
+    // out if the region contains the point.
+    return contains(IntRect(point, IntSize(1, 1)));
+}
+
 Region::Shape::Shape()
 {
 }

Modified: trunk/Source/WebCore/platform/graphics/Region.h (107012 => 107013)


--- trunk/Source/WebCore/platform/graphics/Region.h	2012-02-08 00:59:11 UTC (rev 107012)
+++ trunk/Source/WebCore/platform/graphics/Region.h	2012-02-08 01:00:06 UTC (rev 107013)
@@ -50,6 +50,8 @@
     // Returns true if the query region is a subset of this region.
     bool contains(const Region&) const;
 
+    bool contains(const IntPoint&) const;
+
 #ifndef NDEBUG
     void dump() const;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to