| 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;
|
|
|