Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

Issue 11644048: Revert 138209 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
===================================================================
--- Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (revision 138265)
+++ Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (working copy)
@@ -27,6 +27,7 @@
#include "ScrollingCoordinator.h"
+#include "Document.h"
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsLayer.h"
@@ -177,6 +178,57 @@
return nonFastScrollableRegion;
}
+#if ENABLE(TOUCH_EVENT_TRACKING)
+static void accumulateRendererTouchEventTargetRects(Vector<IntRect>& rects, const RenderObject* renderer)
+{
+ // FIXME: This method is O(N^2) as it walks the tree to the root for every renderer. RenderGeometryMap would fix this.
+ rects.append(enclosingIntRect(renderer->clippedOverflowRectForRepaint(0)));
+ if (renderer->isRenderBlock()) {
+ const RenderBlock* block = toRenderBlock(renderer);
+ for (RenderObject* child = block->firstChild(); child; child = child->nextSibling())
+ accumulateRendererTouchEventTargetRects(rects, child);
+ }
+}
+
+static void accumulateDocumentEventTargetRects(Vector<IntRect>& rects, const Document* document)
+{
+ ASSERT(document);
+ if (!document->touchEventTargets())
+ return;
+
+ const TouchEventTargetSet* targets = document->touchEventTargets();
+ for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
+ const Node* touchTarget = iter->key;
+ if (!touchTarget->inDocument())
+ continue;
+
+ if (touchTarget == document) {
+ if (RenderView* view = document->renderView())
+ rects.append(enclosingIntRect(view->clippedOverflowRectForRepaint(0)));
+ return;
+ }
+
+ if (touchTarget->isDocumentNode() && touchTarget != document) {
+ accumulateDocumentEventTargetRects(rects, static_cast<const Document*>(touchTarget));
+ continue;
+ }
+
+ if (RenderObject* renderer = touchTarget->renderer())
+ accumulateRendererTouchEventTargetRects(rects, renderer);
+ }
+}
+
+void ScrollingCoordinator::computeAbsoluteTouchEventTargetRects(const Document* document, Vector<IntRect>& rects)
+{
+ ASSERT(document);
+ if (!document->view())
+ return;
+
+ // FIXME: These rects won't be properly updated if the renderers are in a sub-tree that scrolls.
+ accumulateDocumentEventTargetRects(rects, document);
+}
+#endif
+
unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount()
{
unsigned wheelEventHandlerCount = 0;

Powered by Google App Engine
This is Rietveld 408576698