From c0ffe6fb231041e4fd01c402a69f94486d350df0 Mon Sep 17 00:00:00 2001 From: Rafael Weinstein Date: Mon, 10 Nov 2014 13:08:21 -0800 Subject: [PATCH] remove updateTouchEventTargetRectsIfNeeded BUG= R=abarth@chromium.org Review URL: https://codereview.chromium.org/713073003 --- engine/core/core.gni | 2 - engine/core/dom/Document.cpp | 3 - engine/core/dom/Node.cpp | 27 +- engine/core/frame/EventHandlerRegistry.cpp | 240 ---------------- engine/core/frame/EventHandlerRegistry.h | 104 ------- engine/core/frame/FrameHost.cpp | 8 - engine/core/frame/FrameHost.h | 4 - engine/core/frame/FrameView.cpp | 8 - engine/core/frame/LocalDOMWindow.cpp | 13 - engine/core/frame/LocalFrame.cpp | 1 - engine/core/loader/EmptyClients.h | 1 - engine/core/page/ChromeClient.h | 2 - engine/core/page/EventHandler.cpp | 8 +- .../page/scrolling/ScrollingCoordinator.cpp | 270 ------------------ .../page/scrolling/ScrollingCoordinator.h | 14 - engine/core/rendering/RenderBlock.cpp | 16 -- engine/core/rendering/RenderBlock.h | 2 - engine/core/rendering/RenderBox.cpp | 12 - engine/core/rendering/RenderBox.h | 23 -- .../core/rendering/RenderBoxModelObject.cpp | 12 - engine/core/rendering/RenderBoxModelObject.h | 2 - engine/core/rendering/RenderInline.cpp | 6 - engine/core/rendering/RenderInline.h | 2 - engine/core/rendering/RenderLayer.cpp | 38 --- engine/core/rendering/RenderLayer.h | 5 - .../core/rendering/RenderLayerModelObject.cpp | 18 -- .../core/rendering/RenderLayerModelObject.h | 2 - engine/core/rendering/RenderObject.cpp | 101 ------- engine/core/rendering/RenderObject.h | 17 -- engine/core/rendering/RenderText.cpp | 5 - engine/core/rendering/RenderText.h | 2 - engine/core/rendering/RenderView.cpp | 8 - engine/core/rendering/RenderView.h | 2 - engine/public/platform/WebLayer.h | 4 - engine/public/web/WebWidget.h | 3 - engine/public/web/WebWidgetClient.h | 3 - engine/web/ChromeClientImpl.cpp | 5 - engine/web/ChromeClientImpl.h | 1 - engine/web/WebViewImpl.cpp | 12 - engine/web/WebViewImpl.h | 3 - viewer/cc/web_layer_impl.cc | 43 --- viewer/cc/web_layer_impl.h | 4 - 42 files changed, 5 insertions(+), 1051 deletions(-) delete mode 100644 engine/core/frame/EventHandlerRegistry.cpp delete mode 100644 engine/core/frame/EventHandlerRegistry.h diff --git a/engine/core/core.gni b/engine/core/core.gni index 2f2dff3420c..ad2d401bd1c 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -708,8 +708,6 @@ sky_core_files = [ "frame/DOMWindowProperty.h", "frame/DOMWindowTimers.cpp", "frame/DOMWindowTimers.h", - "frame/EventHandlerRegistry.cpp", - "frame/EventHandlerRegistry.h", "frame/Frame.cpp", "frame/Frame.h", "frame/FrameConsole.cpp", diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index 5df3aa6c2e7..a8ae9d087e4 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -88,7 +88,6 @@ #include "core/events/PageTransitionEvent.h" #include "core/events/ScopedEventQueue.h" #include "core/fetch/ResourceFetcher.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameConsole.h" #include "core/frame/FrameHost.h" #include "core/frame/FrameView.h" @@ -1383,8 +1382,6 @@ void Document::detach(const AttachContext& context) m_styleEngine->didDetach(); - frameHost()->eventHandlerRegistry().documentDetached(*this); - // This is required, as our LocalFrame might delete itself as soon as it detaches // us. However, this violates Node::detach() semantics, as it's never // possible to re-attach. Eventually Document::detach() should be renamed, diff --git a/engine/core/dom/Node.cpp b/engine/core/dom/Node.cpp index 2d6c00b7a39..880e02f6e4a 100644 --- a/engine/core/dom/Node.cpp +++ b/engine/core/dom/Node.cpp @@ -67,7 +67,6 @@ #include "core/events/TouchEvent.h" #include "core/events/UIEvent.h" #include "core/events/WheelEvent.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" #include "core/html/HTMLAnchorElement.h" @@ -286,9 +285,6 @@ void Node::willBeDeletedFromDocument() if (hasEventTargetData()) clearEventTargetData(); - if (document.frameHost()) - document.frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); - document.markers().removeMarkers(this); } #endif @@ -573,7 +569,7 @@ void Node::traceStyleChange(StyleChangeType changeType) return; TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("style.debug"), - "Node::setNeedsStyleRecalc", TRACE_EVENT_SCOPE_PROCESS, + "Node::setNeedsStyleRecalc", TRACE_EVENT_SCOPE_PROCESS, "data", jsonObjectForStyleInvalidation(nodeCount, this) ); } @@ -1379,12 +1375,6 @@ void Node::didMoveToNewDocument(Document& oldDocument) oldDocument.markers().removeMarkers(this); oldDocument.updateRangesAfterNodeMovedToAnotherDocument(*this); - if (oldDocument.frameHost() && !document().frameHost()) - oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost(*this); - else if (document().frameHost() && !oldDocument.frameHost()) - document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(*this); - else if (oldDocument.frameHost() != document().frameHost()) - EventHandlerRegistry::didMoveBetweenFrameHosts(*this, oldDocument.frameHost(), document().frameHost()); if (Vector >* registry = mutationObserverRegistry()) { for (size_t i = 0; i < registry->size(); ++i) { @@ -1406,8 +1396,6 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve Document& document = targetNode->document(); document.addListenerTypeIfNeeded(eventType); - if (document.frameHost()) - document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetNode, eventType); return true; } @@ -1419,16 +1407,7 @@ bool Node::addEventListener(const AtomicString& eventType, PassRefPtr listener, bool useCapture) { - if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCapture)) - return false; - - // FIXME: Notify Document that the listener has vanished. We need to keep track of a number of - // listeners for each type, not just a bool - see https://bugs.webkit.org/show_bug.cgi?id=33861 - Document& document = targetNode->document(); - if (document.frameHost()) - document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targetNode, eventType); - - return true; + return targetNode->EventTarget::removeEventListener(eventType, listener, useCapture); } bool Node::removeEventListener(const AtomicString& eventType, PassRefPtr listener, bool useCapture) @@ -1438,8 +1417,6 @@ bool Node::removeEventListener(const AtomicString& eventType, PassRefPtreventHandlerRegistry().didRemoveAllEventHandlers(*this); EventTarget::removeAllEventListeners(); } diff --git a/engine/core/frame/EventHandlerRegistry.cpp b/engine/core/frame/EventHandlerRegistry.cpp deleted file mode 100644 index 9857b17bd26..00000000000 --- a/engine/core/frame/EventHandlerRegistry.cpp +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "config.h" -#include "core/frame/EventHandlerRegistry.h" - -#include "core/events/ThreadLocalEventNames.h" -#include "core/frame/LocalDOMWindow.h" -#include "core/frame/LocalFrame.h" -#include "core/page/Chrome.h" -#include "core/page/ChromeClient.h" -#include "core/page/Page.h" -#include "core/page/scrolling/ScrollingCoordinator.h" - -namespace blink { - -EventHandlerRegistry::EventHandlerRegistry(FrameHost& frameHost) - : m_frameHost(frameHost) -{ -} - -EventHandlerRegistry::~EventHandlerRegistry() -{ - checkConsistency(); -} - -bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, EventHandlerClass* result) -{ - if (eventType == EventTypeNames::scroll) { - *result = ScrollEvent; - } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mousewheel) { - *result = WheelEvent; - } else if (isTouchEventType(eventType)) { - *result = TouchEvent; -#if ENABLE(ASSERT) - } else if (eventType == EventTypeNames::load || eventType == EventTypeNames::mousemove || eventType == EventTypeNames::touchstart) { - *result = EventsForTesting; -#endif - } else { - return false; - } - return true; -} - -const EventTargetSet* EventHandlerRegistry::eventHandlerTargets(EventHandlerClass handlerClass) const -{ - checkConsistency(); - return &m_targets[handlerClass]; -} - -bool EventHandlerRegistry::hasEventHandlers(EventHandlerClass handlerClass) const -{ - checkConsistency(); - return m_targets[handlerClass].size(); -} - -bool EventHandlerRegistry::updateEventHandlerTargets(ChangeOperation op, EventHandlerClass handlerClass, EventTarget* target) -{ - EventTargetSet* targets = &m_targets[handlerClass]; - if (op == Add) { - if (!targets->add(target).isNewEntry) { - // Just incremented refcount, no real change. - return false; - } - } else { - ASSERT(op == Remove || op == RemoveAll); - ASSERT(op == RemoveAll || targets->contains(target)); - - if (op == RemoveAll) { - if (!targets->contains(target)) - return false; - targets->removeAll(target); - } else { - if (!targets->remove(target)) { - // Just decremented refcount, no real update. - return false; - } - } - } - return true; -} - -void EventHandlerRegistry::updateEventHandlerInternal(ChangeOperation op, EventHandlerClass handlerClass, EventTarget* target) -{ - bool hadHandlers = m_targets[handlerClass].size(); - bool targetSetChanged = updateEventHandlerTargets(op, handlerClass, target); - bool hasHandlers = m_targets[handlerClass].size(); - - if (hadHandlers != hasHandlers) - notifyHasHandlersChanged(handlerClass, hasHandlers); - - if (targetSetChanged) - notifyDidAddOrRemoveEventHandlerTarget(handlerClass); -} - -void EventHandlerRegistry::updateEventHandlerOfType(ChangeOperation op, const AtomicString& eventType, EventTarget* target) -{ - EventHandlerClass handlerClass; - if (!eventTypeToClass(eventType, &handlerClass)) - return; - updateEventHandlerInternal(op, handlerClass, target); -} - -void EventHandlerRegistry::didAddEventHandler(EventTarget& target, const AtomicString& eventType) -{ - updateEventHandlerOfType(Add, eventType, &target); -} - -void EventHandlerRegistry::didRemoveEventHandler(EventTarget& target, const AtomicString& eventType) -{ - updateEventHandlerOfType(Remove, eventType, &target); -} - -void EventHandlerRegistry::didAddEventHandler(EventTarget& target, EventHandlerClass handlerClass) -{ - updateEventHandlerInternal(Add, handlerClass, &target); -} - -void EventHandlerRegistry::didRemoveEventHandler(EventTarget& target, EventHandlerClass handlerClass) -{ - updateEventHandlerInternal(Remove, handlerClass, &target); -} - -void EventHandlerRegistry::didMoveIntoFrameHost(EventTarget& target) -{ - if (!target.hasEventListeners()) - return; - - Vector eventTypes = target.eventTypes(); - for (size_t i = 0; i < eventTypes.size(); ++i) { - EventHandlerClass handlerClass; - if (!eventTypeToClass(eventTypes[i], &handlerClass)) - continue; - for (unsigned count = target.getEventListeners(eventTypes[i]).size(); count > 0; --count) - didAddEventHandler(target, handlerClass); - } -} - -void EventHandlerRegistry::didMoveOutOfFrameHost(EventTarget& target) -{ - didRemoveAllEventHandlers(target); -} - -void EventHandlerRegistry::didMoveBetweenFrameHosts(EventTarget& target, FrameHost* oldFrameHost, FrameHost* newFrameHost) -{ - ASSERT(newFrameHost != oldFrameHost); - for (size_t i = 0; i < EventHandlerClassCount; ++i) { - EventHandlerClass handlerClass = static_cast(i); - const EventTargetSet* targets = &oldFrameHost->eventHandlerRegistry().m_targets[handlerClass]; - for (unsigned count = targets->count(&target); count > 0; --count) - newFrameHost->eventHandlerRegistry().didAddEventHandler(target, handlerClass); - oldFrameHost->eventHandlerRegistry().didRemoveAllEventHandlers(target); - } -} - -void EventHandlerRegistry::didRemoveAllEventHandlers(EventTarget& target) -{ - for (size_t i = 0; i < EventHandlerClassCount; ++i) { - EventHandlerClass handlerClass = static_cast(i); - updateEventHandlerInternal(RemoveAll, handlerClass, &target); - } -} - -void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerClass, bool hasActiveHandlers) -{ - switch (handlerClass) { - // FIXME(sky): Remove these enums from the EventHandlerClass entirely. - case ScrollEvent: - case WheelEvent: - break; - case TouchEvent: - m_frameHost.chrome().client().needTouchEvents(hasActiveHandlers); - break; -#if ENABLE(ASSERT) - case EventsForTesting: - break; -#endif - default: - ASSERT_NOT_REACHED(); - break; - } -} - -void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerClass handlerClass) -{ - ScrollingCoordinator* scrollingCoordinator = m_frameHost.page().scrollingCoordinator(); - if (scrollingCoordinator && handlerClass == TouchEvent) - scrollingCoordinator->touchEventTargetRectsDidChange(); -} - -void EventHandlerRegistry::documentDetached(Document& document) -{ - // Remove all event targets under the detached document. - for (size_t handlerClassIndex = 0; handlerClassIndex < EventHandlerClassCount; ++handlerClassIndex) { - EventHandlerClass handlerClass = static_cast(handlerClassIndex); - Vector targetsToRemove; - const EventTargetSet* targets = &m_targets[handlerClass]; - for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) { - if (Node* node = iter->key->toNode()) { - if (node->document() == &document) { - targetsToRemove.append(iter->key); - break; - } - } else if (iter->key->toDOMWindow()) { - // DOMWindows may outlive their documents, so we shouldn't remove their handlers - // here. - } else { - ASSERT_NOT_REACHED(); - } - } - for (size_t i = 0; i < targetsToRemove.size(); ++i) - updateEventHandlerInternal(RemoveAll, handlerClass, targetsToRemove[i]); - } -} - -void EventHandlerRegistry::checkConsistency() const -{ -#if ENABLE(ASSERT) - for (size_t i = 0; i < EventHandlerClassCount; ++i) { - EventHandlerClass handlerClass = static_cast(i); - const EventTargetSet* targets = &m_targets[handlerClass]; - for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) { - if (Node* node = iter->key->toNode()) { - // See the comment for |documentDetached| if either of these assertions fails. - ASSERT(node->document().frameHost()); - ASSERT(node->document().frameHost() == &m_frameHost); - } else if (LocalDOMWindow* window = iter->key->toDOMWindow()) { - // If any of these assertions fail, LocalDOMWindow failed to unregister its handlers - // properly. - ASSERT(window->frame()); - ASSERT(window->frame()->host()); - ASSERT(window->frame()->host() == &m_frameHost); - } - } - } -#endif // ENABLE(ASSERT) -} - -} // namespace blink diff --git a/engine/core/frame/EventHandlerRegistry.h b/engine/core/frame/EventHandlerRegistry.h deleted file mode 100644 index d0863a54e10..00000000000 --- a/engine/core/frame/EventHandlerRegistry.h +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef EventHandlerRegistry_h -#define EventHandlerRegistry_h - -#include "core/frame/FrameHost.h" -#include "wtf/HashCountedSet.h" -#include "wtf/text/AtomicString.h" - -namespace blink { - -class Document; -class EventTarget; - -typedef HashCountedSet EventTargetSet; - -// Registry for keeping track of event handlers. Note that only handlers on -// documents that can be rendered or can receive input (i.e., are attached to a -// FrameHost) are registered here. -class EventHandlerRegistry final { -public: - explicit EventHandlerRegistry(FrameHost&); - virtual ~EventHandlerRegistry(); - - // Supported event handler classes. Note that each one may correspond to - // multiple event types. - enum EventHandlerClass { - ScrollEvent, - WheelEvent, - TouchEvent, -#if ENABLE(ASSERT) - // Additional event categories for verifying handler tracking logic. - EventsForTesting, -#endif - EventHandlerClassCount, // Must be the last entry. - }; - - // Returns true if the FrameHost has event handlers of the specified class. - bool hasEventHandlers(EventHandlerClass) const; - - // Returns a set of EventTargets which have registered handlers of the given class. - const EventTargetSet* eventHandlerTargets(EventHandlerClass) const; - - // Registration and management of event handlers attached to EventTargets. - void didAddEventHandler(EventTarget&, const AtomicString& eventType); - void didAddEventHandler(EventTarget&, EventHandlerClass); - void didRemoveEventHandler(EventTarget&, const AtomicString& eventType); - void didRemoveEventHandler(EventTarget&, EventHandlerClass); - void didRemoveAllEventHandlers(EventTarget&); - - void didMoveIntoFrameHost(EventTarget&); - void didMoveOutOfFrameHost(EventTarget&); - static void didMoveBetweenFrameHosts(EventTarget&, FrameHost* oldFrameHost, FrameHost* newFrameHost); - - // Either |documentDetached| or |didMove{Into,OutOf,Between}FrameHosts| must - // be called whenever the FrameHost that is associated with a registered event - // target changes. This ensures the registry does not end up with stale - // references to handlers that are no longer related to it. - void documentDetached(Document&); - -private: - enum ChangeOperation { - Add, // Add a new event handler. - Remove, // Remove an existing event handler. - RemoveAll // Remove any and all existing event handlers for a given target. - }; - - // Returns true if |eventType| belongs to a class this registry tracks. - static bool eventTypeToClass(const AtomicString& eventType, EventHandlerClass* result); - - // Returns true if the operation actually added a new target or completely - // removed an existing one. - bool updateEventHandlerTargets(ChangeOperation, EventHandlerClass, EventTarget*); - - // Called on the EventHandlerRegistry of the root Document to notify - // clients when we have added the first handler or removed the last one for - // a given event class. |hasActiveHandlers| can be used to distinguish - // between the two cases. - void notifyHasHandlersChanged(EventHandlerClass, bool hasActiveHandlers); - - // Called to notify clients whenever a single event handler target is - // registered or unregistered. If several handlers are registered for the - // same target, only the first registration will trigger this notification. - void notifyDidAddOrRemoveEventHandlerTarget(EventHandlerClass); - - // Record a change operation to a given event handler class and notify any - // parent registry and other clients accordingly. - void updateEventHandlerOfType(ChangeOperation, const AtomicString& eventType, EventTarget*); - - void updateEventHandlerInternal(ChangeOperation, EventHandlerClass, EventTarget*); - - void updateAllEventHandlers(ChangeOperation, EventTarget&); - - void checkConsistency() const; - - FrameHost& m_frameHost; - EventTargetSet m_targets[EventHandlerClassCount]; -}; - -} // namespace blink - -#endif // EventHandlerRegistry_h diff --git a/engine/core/frame/FrameHost.cpp b/engine/core/frame/FrameHost.cpp index 584401dc197..2ca340c87ec 100644 --- a/engine/core/frame/FrameHost.cpp +++ b/engine/core/frame/FrameHost.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "core/frame/FrameHost.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/Page.h" @@ -46,7 +45,6 @@ PassOwnPtr FrameHost::create(Page& page, ServiceProvider& services) FrameHost::FrameHost(Page& page, ServiceProvider& services) : m_page(&page) , m_services(services) - , m_eventHandlerRegistry(adoptPtr(new EventHandlerRegistry(*this))) { } @@ -75,15 +73,9 @@ float FrameHost::deviceScaleFactor() const return m_page->deviceScaleFactor(); } -EventHandlerRegistry& FrameHost::eventHandlerRegistry() const -{ - return *m_eventHandlerRegistry; -} - void FrameHost::trace(Visitor* visitor) { visitor->trace(m_page); - visitor->trace(m_eventHandlerRegistry); } } diff --git a/engine/core/frame/FrameHost.h b/engine/core/frame/FrameHost.h index 5ed80433699..6b59b897f31 100644 --- a/engine/core/frame/FrameHost.h +++ b/engine/core/frame/FrameHost.h @@ -40,7 +40,6 @@ namespace blink { class Chrome; -class EventHandlerRegistry; class Page; class ServiceProvider; class Settings; @@ -75,8 +74,6 @@ public: // This value does not account for Page zoom, use LocalFrame::devicePixelRatio instead. float deviceScaleFactor() const; - EventHandlerRegistry& eventHandlerRegistry() const; - void trace(Visitor*); private: @@ -84,7 +81,6 @@ private: Page* m_page; ServiceProvider& m_services; - const OwnPtr m_eventHandlerRegistry; }; } diff --git a/engine/core/frame/FrameView.cpp b/engine/core/frame/FrameView.cpp index 330f230ea99..26f8dc1e183 100644 --- a/engine/core/frame/FrameView.cpp +++ b/engine/core/frame/FrameView.cpp @@ -778,11 +778,6 @@ void FrameView::performPostLayoutTasks() FontFaceSet::didLayout(*m_frame->document()); - if (Page* page = m_frame->page()) { - if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) - scrollingCoordinator->notifyLayoutUpdated(); - } - sendResizeEventIfNeeded(); } @@ -986,9 +981,6 @@ void FrameView::updateLayoutAndStyleForPainting() TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateLayerTree", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); view->compositor()->updateIfNeededRecursive(); - if (view->compositor()->inCompositingMode()) - m_frame->page()->scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); - updateCompositedSelectionBoundsIfNeeded(); invalidateTreeIfNeededRecursive(); diff --git a/engine/core/frame/LocalDOMWindow.cpp b/engine/core/frame/LocalDOMWindow.cpp index 1d0224d2043..3dfdc787222 100644 --- a/engine/core/frame/LocalDOMWindow.cpp +++ b/engine/core/frame/LocalDOMWindow.cpp @@ -54,7 +54,6 @@ #include "core/events/PopStateEvent.h" #include "core/frame/Console.h" #include "core/frame/DOMWindowLifecycleNotifier.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameConsole.h" #include "core/frame/FrameHost.h" #include "core/frame/FrameView.h" @@ -363,7 +362,6 @@ void LocalDOMWindow::frameDestroyed() void LocalDOMWindow::willDetachFrameHost() { - m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); m_frame->console().messageStorage()->frameWindowDiscarded(this); } @@ -708,9 +706,6 @@ bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr< if (!EventTarget::addEventListener(eventType, listener, useCapture)) return false; - if (m_frame && m_frame->host()) - m_frame->host()->eventHandlerRegistry().didAddEventHandler(*this, eventType); - if (Document* document = this->document()) document->addListenerTypeIfNeeded(eventType); @@ -728,9 +723,6 @@ bool LocalDOMWindow::removeEventListener(const AtomicString& eventType, PassRefP if (!EventTarget::removeEventListener(eventType, listener, useCapture)) return false; - if (m_frame && m_frame->host()) - m_frame->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eventType); - lifecycleNotifier().notifyRemoveEventListener(this, eventType); if (eventType == EventTypeNames::unload) { @@ -772,11 +764,6 @@ void LocalDOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mo lifecycleNotifier().notifyRemoveAllEventListeners(this); - if (mode == DoBroadcastListenerRemoval) { - if (m_frame && m_frame->host()) - m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); - } - removeAllUnloadEventListeners(this); } diff --git a/engine/core/frame/LocalFrame.cpp b/engine/core/frame/LocalFrame.cpp index 47d38fa91a9..5fd9fc072e0 100644 --- a/engine/core/frame/LocalFrame.cpp +++ b/engine/core/frame/LocalFrame.cpp @@ -39,7 +39,6 @@ #include "core/editing/markup.h" #include "core/events/Event.h" #include "core/fetch/ResourceFetcher.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameConsole.h" #include "core/frame/FrameDestructionObserver.h" #include "core/frame/FrameHost.h" diff --git a/engine/core/loader/EmptyClients.h b/engine/core/loader/EmptyClients.h index e29586b314f..e0e9945b31c 100644 --- a/engine/core/loader/EmptyClients.h +++ b/engine/core/loader/EmptyClients.h @@ -99,7 +99,6 @@ public: virtual void attachRootGraphicsLayer(GraphicsLayer*) override { } - virtual void needTouchEvents(bool) override { } virtual void setTouchAction(TouchAction touchAction) override { }; virtual String acceptLanguages() override; diff --git a/engine/core/page/ChromeClient.h b/engine/core/page/ChromeClient.h index 14d1fd0f562..851cc6368e9 100644 --- a/engine/core/page/ChromeClient.h +++ b/engine/core/page/ChromeClient.h @@ -107,8 +107,6 @@ public: virtual void clearCompositedSelectionBounds() { } - virtual void needTouchEvents(bool) = 0; - virtual void setTouchAction(TouchAction) = 0; virtual String acceptLanguages() = 0; diff --git a/engine/core/page/EventHandler.cpp b/engine/core/page/EventHandler.cpp index 6aff760bbb0..9f20e8475e1 100644 --- a/engine/core/page/EventHandler.cpp +++ b/engine/core/page/EventHandler.cpp @@ -47,7 +47,6 @@ #include "core/events/TouchEvent.h" #include "core/events/WheelEvent.h" #include "core/fetch/ImageResource.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" @@ -2509,10 +2508,9 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) m_touchPressed = !allTouchReleased; - // If there's no document receiving touch events, or no handlers on the - // document set to receive the events, then we can skip all the rest of - // this work. - if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !m_touchSequenceDocument->frameHost()->eventHandlerRegistry().hasEventHandlers(EventHandlerRegistry::TouchEvent) || !m_touchSequenceDocument->frame()) { + // If there's no document receiving touch events, then we can skip all the + // rest of this work. + if (!m_touchSequenceDocument || !m_touchSequenceDocument->frame()) { if (allTouchReleased) { m_touchSequenceDocument.clear(); m_touchSequenceUserGestureToken.clear(); diff --git a/engine/core/page/scrolling/ScrollingCoordinator.cpp b/engine/core/page/scrolling/ScrollingCoordinator.cpp index 11a2878e0fd..377c367eeaf 100644 --- a/engine/core/page/scrolling/ScrollingCoordinator.cpp +++ b/engine/core/page/scrolling/ScrollingCoordinator.cpp @@ -29,7 +29,6 @@ #include "core/dom/Document.h" #include "core/dom/Node.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" @@ -82,7 +81,6 @@ PassOwnPtr ScrollingCoordinator::create(Page* page) ScrollingCoordinator::ScrollingCoordinator(Page* page) : m_page(page) - , m_touchEventTargetRectsAreDirty(false) { } @@ -90,21 +88,6 @@ ScrollingCoordinator::~ScrollingCoordinator() { } -void ScrollingCoordinator::notifyLayoutUpdated() -{ - m_touchEventTargetRectsAreDirty = true; -} - -void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() -{ - if (!m_touchEventTargetRectsAreDirty) - return; - - TRACE_EVENT0("input", "ScrollingCoordinator::updateAfterCompositingChangeIfNeeded"); - updateTouchEventTargetRectsIfNeeded(); - m_touchEventTargetRectsAreDirty = false; -} - void ScrollingCoordinator::willDestroyScrollableArea(ScrollableArea* scrollableArea) { removeWebScrollbarLayer(scrollableArea, HorizontalScrollbar); @@ -237,132 +220,6 @@ bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc return !!webLayer; } -typedef WTF::HashMap > GraphicsLayerHitTestRects; - -// In order to do a DFS cross-frame walk of the RenderLayer tree, we need to know which -// RenderLayers have child frames inside of them. This computes a mapping for the -// current frame which we can consult while walking the layers of that frame. -// Whenever we descend into a new frame, a new map will be created. -typedef HashMap > LayerFrameMap; -static void makeLayerChildFrameMap(const LocalFrame* currentFrame, LayerFrameMap* map) -{ - map->clear(); -} - -static void projectRectsToGraphicsLayerSpaceRecursive( - const RenderLayer* curLayer, - const LayerHitTestRects& layerRects, - GraphicsLayerHitTestRects& graphicsRects, - RenderGeometryMap& geometryMap, - HashSet& layersWithRects, - LayerFrameMap& layerChildFrameMap) -{ - // Project any rects for the current layer - LayerHitTestRects::const_iterator layerIter = layerRects.find(curLayer); - if (layerIter != layerRects.end()) { - // Find the enclosing composited layer when it's in another document (for non-composited iframes). - const RenderLayer* compositedLayer = layerIter->key->enclosingLayerForPaintInvalidationCrossingFrameBoundaries(); - ASSERT(compositedLayer); - - // Find the appropriate GraphicsLayer for the composited RenderLayer. - GraphicsLayer* graphicsLayer = compositedLayer->graphicsLayerBackingForScrolling(); - - GraphicsLayerHitTestRects::iterator glIter = graphicsRects.find(graphicsLayer); - Vector* glRects; - if (glIter == graphicsRects.end()) - glRects = &graphicsRects.add(graphicsLayer, Vector()).storedValue->value; - else - glRects = &glIter->value; - - // Transform each rect to the co-ordinate space of the graphicsLayer. - for (size_t i = 0; i < layerIter->value.size(); ++i) { - LayoutRect rect = layerIter->value[i]; - if (compositedLayer != curLayer) { - FloatQuad compositorQuad = geometryMap.mapToContainer(rect, compositedLayer->renderer()); - rect = LayoutRect(compositorQuad.boundingBox()); - // If the enclosing composited layer itself is scrolled, we have to undo the subtraction - // of its scroll offset since we want the offset relative to the scrolling content, not - // the element itself. - if (compositedLayer->renderer()->hasOverflowClip()) - rect.move(compositedLayer->renderBox()->scrolledContentOffset()); - } - RenderLayer::mapRectToPaintBackingCoordinates(compositedLayer->renderer(), rect); - glRects->append(rect); - } - } - - // Walk child layers of interest - for (const RenderLayer* childLayer = curLayer->firstChild(); childLayer; childLayer = childLayer->nextSibling()) { - if (layersWithRects.contains(childLayer)) { - geometryMap.pushMappingsToAncestor(childLayer, curLayer); - projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, graphicsRects, geometryMap, layersWithRects, layerChildFrameMap); - geometryMap.popMappingsToAncestor(curLayer); - } - } - - // If this layer has any frames of interest as a child of it, walk those (with an updated frame map). - LayerFrameMap::iterator mapIter = layerChildFrameMap.find(curLayer); - if (mapIter != layerChildFrameMap.end()) { - for (size_t i = 0; i < mapIter->value.size(); i++) { - const LocalFrame* childFrame = mapIter->value[i]; - const RenderLayer* childLayer = childFrame->view()->renderView()->layer(); - if (layersWithRects.contains(childLayer)) { - LayerFrameMap newLayerChildFrameMap; - makeLayerChildFrameMap(childFrame, &newLayerChildFrameMap); - geometryMap.pushMappingsToAncestor(childLayer, curLayer); - projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, graphicsRects, geometryMap, layersWithRects, newLayerChildFrameMap); - geometryMap.popMappingsToAncestor(curLayer); - } - } - } -} - -static void projectRectsToGraphicsLayerSpace(LocalFrame* mainFrame, const LayerHitTestRects& layerRects, GraphicsLayerHitTestRects& graphicsRects) -{ - TRACE_EVENT0("input", "ScrollingCoordinator::projectRectsToGraphicsLayerSpace"); - bool touchHandlerInChildFrame = false; - - // We have a set of rects per RenderLayer, we need to map them to their bounding boxes in their - // enclosing composited layer. To do this most efficiently we'll walk the RenderLayer tree using - // RenderGeometryMap. First record all the branches we should traverse in the tree (including - // all documents on the page). - HashSet layersWithRects; - for (LayerHitTestRects::const_iterator layerIter = layerRects.begin(); layerIter != layerRects.end(); ++layerIter) { - const RenderLayer* layer = layerIter->key; - do { - if (!layersWithRects.add(layer).isNewEntry) - break; - - if (layer->parent()) { - layer = layer->parent(); - } - } while (layer); - } - - // Now walk the layer projecting rects while maintaining a RenderGeometryMap - MapCoordinatesFlags flags = UseTransforms; - if (touchHandlerInChildFrame) - flags |= TraverseDocumentBoundaries; - RenderLayer* rootLayer = mainFrame->contentRenderer()->layer(); - RenderGeometryMap geometryMap(flags); - geometryMap.pushMappingsToAncestor(rootLayer, 0); - LayerFrameMap layerChildFrameMap; - makeLayerChildFrameMap(mainFrame, &layerChildFrameMap); - projectRectsToGraphicsLayerSpaceRecursive(rootLayer, layerRects, graphicsRects, geometryMap, layersWithRects, layerChildFrameMap); -} - -void ScrollingCoordinator::updateTouchEventTargetRectsIfNeeded() -{ - TRACE_EVENT0("input", "ScrollingCoordinator::updateTouchEventTargetRectsIfNeeded"); - - if (!RuntimeEnabledFeatures::touchEnabled()) - return; - - LayerHitTestRects touchEventTargetRects; - computeTouchEventTargetRects(touchEventTargetRects); - setTouchEventTargetRects(touchEventTargetRects); -} - void ScrollingCoordinator::reset() { for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_horizontalScrollbars.end(); ++it) @@ -375,61 +232,6 @@ void ScrollingCoordinator::reset() m_layersWithTouchRects.clear(); } -// Note that in principle this could be called more often than computeTouchEventTargetRects, for -// example during a non-composited scroll (although that's not yet implemented - crbug.com/261307). -void ScrollingCoordinator::setTouchEventTargetRects(LayerHitTestRects& layerRects) -{ - TRACE_EVENT0("input", "ScrollingCoordinator::setTouchEventTargetRects"); - - // Update the list of layers with touch hit rects. - HashSet oldLayersWithTouchRects; - m_layersWithTouchRects.swap(oldLayersWithTouchRects); - for (LayerHitTestRects::iterator it = layerRects.begin(); it != layerRects.end(); ++it) { - if (!it->value.isEmpty()) { - const RenderLayer* compositedLayer = it->key->enclosingLayerForPaintInvalidationCrossingFrameBoundaries(); - ASSERT(compositedLayer); - m_layersWithTouchRects.add(compositedLayer); - } - } - - // Ensure we have an entry for each composited layer that previously had rects (so that old - // ones will get cleared out). Note that ideally we'd track this on GraphicsLayer instead of - // RenderLayer, but we have no good hook into the lifetime of a GraphicsLayer. - for (HashSet::iterator it = oldLayersWithTouchRects.begin(); it != oldLayersWithTouchRects.end(); ++it) { - if (!layerRects.contains(*it)) - layerRects.add(*it, Vector()); - } - - GraphicsLayerHitTestRects graphicsLayerRects; - projectRectsToGraphicsLayerSpace(m_page->mainFrame(), layerRects, graphicsLayerRects); - - for (GraphicsLayerHitTestRects::const_iterator iter = graphicsLayerRects.begin(); iter != graphicsLayerRects.end(); ++iter) { - const GraphicsLayer* graphicsLayer = iter->key; - WebVector webRects(iter->value.size()); - for (size_t i = 0; i < iter->value.size(); ++i) - webRects[i] = enclosingIntRect(iter->value[i]); - graphicsLayer->platformLayer()->setTouchEventHandlerRegion(webRects); - } -} - -void ScrollingCoordinator::touchEventTargetRectsDidChange() -{ - if (!RuntimeEnabledFeatures::touchEnabled()) - return; - - // Wait until after layout to update. - if (!m_page->mainFrame()->view() || m_page->mainFrame()->view()->needsLayout()) - return; - - // FIXME: scheduleAnimation() is just a method of forcing the compositor to realize that it - // needs to commit here. We should expose a cleaner API for this. - RenderView* renderView = m_page->mainFrame()->contentRenderer(); - if (renderView && renderView->compositor() && renderView->compositor()->staleInCompositingMode()) - m_page->mainFrame()->view()->scheduleAnimation(); - - m_touchEventTargetRectsAreDirty = true; -} - void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent) { WebLayer* scrollParentWebLayer = 0; @@ -463,78 +265,6 @@ void ScrollingCoordinator::willBeDestroyed() GraphicsLayer::unregisterContentsLayer(it->value->layer()); } -static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, const Document* document) -{ - ASSERT(document); - const EventTargetSet* targets = document->frameHost()->eventHandlerRegistry().eventHandlerTargets(EventHandlerRegistry::TouchEvent); - if (!targets) - return; - - // If there's a handler on the window, document, html or body element (fairly common in practice), - // then we can quickly mark the entire document and skip looking at any other handlers. - // Note that technically a handler on the body doesn't cover the whole document, but it's - // reasonable to be conservative and report the whole document anyway. - for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) { - EventTarget* target = iter->key; - Node* node = target->toNode(); - if (target->toDOMWindow() || node == document || node == document->documentElement()) { - if (RenderView* rendererView = document->renderView()) { - rendererView->computeLayerHitTestRects(rects); - } - return; - } - } - - for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) { - EventTarget* target = iter->key; - Node* node = target->toNode(); - if (!node || !node->inDocument()) - continue; - - if (node->isDocumentNode() && node != document) { - accumulateDocumentTouchEventTargetRects(rects, toDocument(node)); - } else if (RenderObject* renderer = node->renderer()) { - // If the set also contains one of our ancestor nodes then processing - // this node would be redundant. - bool hasTouchEventTargetAncestor = false; - for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEventTargetAncestor; ancestor = ancestor->parentNode()) { - if (targets->contains(ancestor)) - hasTouchEventTargetAncestor = true; - } - if (!hasTouchEventTargetAncestor) { - // Walk up the tree to the outermost non-composited scrollable layer. - RenderLayer* enclosingNonCompositedScrollLayer = 0; - for (RenderLayer* parent = renderer->enclosingLayer(); parent && parent->compositingState() == NotComposited; parent = parent->parent()) { - if (parent->scrollsOverflow()) - enclosingNonCompositedScrollLayer = parent; - } - - // Report the whole non-composited scroll layer as a touch hit rect because any - // rects inside of it may move around relative to their enclosing composited layer - // without causing the rects to be recomputed. Non-composited scrolling occurs on - // the main thread, so we're not getting much benefit from compositor touch hit - // testing in this case anyway. - if (enclosingNonCompositedScrollLayer) - enclosingNonCompositedScrollLayer->computeSelfHitTestRects(rects); - - renderer->computeLayerHitTestRects(rects); - } - } - } -} - -void ScrollingCoordinator::computeTouchEventTargetRects(LayerHitTestRects& rects) -{ - TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); - ASSERT(RuntimeEnabledFeatures::touchEnabled()); - - Document* document = m_page->mainFrame()->document(); - if (!document || !document->view()) - return; - - accumulateDocumentTouchEventTargetRects(rects, document); -} - bool ScrollingCoordinator::isForMainFrame(ScrollableArea* scrollableArea) const { // FIXME(sky): Remove diff --git a/engine/core/page/scrolling/ScrollingCoordinator.h b/engine/core/page/scrolling/ScrollingCoordinator.h index 2ab98ce2391..2c5f2edaa39 100644 --- a/engine/core/page/scrolling/ScrollingCoordinator.h +++ b/engine/core/page/scrolling/ScrollingCoordinator.h @@ -54,11 +54,6 @@ public: void willBeDestroyed(); - // Called when any frame has done its layout. - void notifyLayoutUpdated(); - - void updateAfterCompositingChangeIfNeeded(); - #if OS(MACOSX) // Dispatched by the scrolling tree during handleWheelEvent. This is required as long as scrollbars are painted on the main thread. void handleWheelEventPhase(PlatformWheelEventPhase); @@ -70,14 +65,11 @@ public: // Returns true if the coordinator handled this change. bool scrollableAreaScrollLayerDidChange(ScrollableArea*); void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation); - void touchEventTargetRectsDidChange(); void willDestroyRenderLayer(RenderLayer*); void updateScrollParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent); void updateClipParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent); - void updateTouchEventTargetRectsIfNeeded(); - // For testing purposes only. This ScrollingCoordinator is reused between layout test, and must be reset // for the results to be valid. void reset(); @@ -89,13 +81,7 @@ protected: Page* m_page; - // Dirty flags used to idenfity what really needs to be computed after compositing is updated. - bool m_touchEventTargetRectsAreDirty; - private: - void setTouchEventTargetRects(LayerHitTestRects&); - void computeTouchEventTargetRects(LayerHitTestRects&); - blink::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation, PassOwnPtr); blink::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); diff --git a/engine/core/rendering/RenderBlock.cpp b/engine/core/rendering/RenderBlock.cpp index 818bd768036..c00cded94df 100644 --- a/engine/core/rendering/RenderBlock.cpp +++ b/engine/core/rendering/RenderBlock.cpp @@ -2753,22 +2753,6 @@ void RenderBlock::addFocusRingRects(Vector& rects, const LayoutPoint& a inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location()), paintContainer); } -void RenderBlock::computeSelfHitTestRects(Vector& rects, const LayoutPoint& layerOffset) const -{ - RenderBox::computeSelfHitTestRects(rects, layerOffset); - - if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { - for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { - LayoutUnit top = std::max(curr->lineTop(), curr->top()); - LayoutUnit bottom = std::min(curr->lineBottom(), curr->top() + curr->height()); - LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top, curr->width(), bottom - top); - // It's common for this rect to be entirely contained in our box, so exclude that simple case. - if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect))) - rects.append(rect); - } - } -} - RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const { return createAnonymousWithParentRendererAndDisplay(parent, style()->display()); diff --git a/engine/core/rendering/RenderBlock.h b/engine/core/rendering/RenderBlock.h index 6b82c02371c..c85b571839c 100644 --- a/engine/core/rendering/RenderBlock.h +++ b/engine/core/rendering/RenderBlock.h @@ -285,8 +285,6 @@ protected: virtual void addFocusRingRects(Vector&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) const override; - virtual void computeSelfHitTestRects(Vector&, const LayoutPoint& layerOffset) const override; - void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*); virtual bool isInlineBlock() const override final { return isInline() && isReplaced(); } diff --git a/engine/core/rendering/RenderBox.cpp b/engine/core/rendering/RenderBox.cpp index 7d501dad264..7369453da0a 100644 --- a/engine/core/rendering/RenderBox.cpp +++ b/engine/core/rendering/RenderBox.cpp @@ -403,18 +403,6 @@ void RenderBox::addFocusRingRects(Vector& rects, const LayoutPoint& add rects.append(pixelSnappedIntRect(additionalOffset, size())); } -void RenderBox::addLayerHitTestRects(LayerHitTestRects& layerRects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const -{ - LayoutPoint adjustedLayerOffset = layerOffset + locationOffset(); - RenderBoxModelObject::addLayerHitTestRects(layerRects, currentLayer, adjustedLayerOffset, containerRect); -} - -void RenderBox::computeSelfHitTestRects(Vector& rects, const LayoutPoint& layerOffset) const -{ - if (!size().isEmpty()) - rects.append(LayoutRect(layerOffset, size())); -} - bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float delta) { // Presumably the same issue as in setScrollTop. See crbug.com/343132. diff --git a/engine/core/rendering/RenderBox.h b/engine/core/rendering/RenderBox.h index 293c79b9bbc..e7b30047703 100644 --- a/engine/core/rendering/RenderBox.h +++ b/engine/core/rendering/RenderBox.h @@ -509,26 +509,6 @@ public: virtual bool hasRelativeLogicalHeight() const; - bool hasHorizontalLayoutOverflow() const - { - if (!m_overflow) - return false; - - LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect(); - LayoutRect noOverflowRect = this->noOverflowRect(); - return layoutOverflowRect.x() < noOverflowRect.x() || layoutOverflowRect.maxX() > noOverflowRect.maxX(); - } - - bool hasVerticalLayoutOverflow() const - { - if (!m_overflow) - return false; - - LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect(); - LayoutRect noOverflowRect = this->noOverflowRect(); - return layoutOverflowRect.y() < noOverflowRect.y() || layoutOverflowRect.maxY() > noOverflowRect.maxY(); - } - virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject*) const { ASSERT_NOT_REACHED(); @@ -583,9 +563,6 @@ protected: RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild); - virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override; - virtual void computeSelfHitTestRects(Vector&, const LayoutPoint& layerOffset) const override; - void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModelObject& paintInvalidationContainer, diff --git a/engine/core/rendering/RenderBoxModelObject.cpp b/engine/core/rendering/RenderBoxModelObject.cpp index 5f40547bd10..83b78a6216c 100644 --- a/engine/core/rendering/RenderBoxModelObject.cpp +++ b/engine/core/rendering/RenderBoxModelObject.cpp @@ -2453,18 +2453,6 @@ void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) } } -void RenderBoxModelObject::computeLayerHitTestRects(LayerHitTestRects& rects) const -{ - RenderLayerModelObject::computeLayerHitTestRects(rects); - - // If there is a continuation then we need to consult it here, since this is - // the root of the tree walk and it wouldn't otherwise get picked up. - // Continuations should always be siblings in the tree, so any others should - // get picked up already by the tree walk. - if (continuation()) - continuation()->computeLayerHitTestRects(rects); -} - LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset) { ASSERT(!slowFirstChild()); diff --git a/engine/core/rendering/RenderBoxModelObject.h b/engine/core/rendering/RenderBoxModelObject.h index 3d12d3bda5f..9831d62517a 100644 --- a/engine/core/rendering/RenderBoxModelObject.h +++ b/engine/core/rendering/RenderBoxModelObject.h @@ -172,8 +172,6 @@ public: void contentChanged(ContentChangeType); bool hasAcceleratedCompositing() const; - virtual void computeLayerHitTestRects(LayerHitTestRects&) const override; - protected: virtual void willBeDestroyed() override; diff --git a/engine/core/rendering/RenderInline.cpp b/engine/core/rendering/RenderInline.cpp index 20a9f3ae674..ecb42f67890 100644 --- a/engine/core/rendering/RenderInline.cpp +++ b/engine/core/rendering/RenderInline.cpp @@ -1349,12 +1349,6 @@ private: } -void RenderInline::computeSelfHitTestRects(Vector& rects, const LayoutPoint& layerOffset) const -{ - AbsoluteLayoutRectsGeneratorContext context(rects, layerOffset); - generateLineBoxRects(context); -} - void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { RenderStyle* styleToUse = style(); diff --git a/engine/core/rendering/RenderInline.h b/engine/core/rendering/RenderInline.h index adf260516a3..39972f7af1c 100644 --- a/engine/core/rendering/RenderInline.h +++ b/engine/core/rendering/RenderInline.h @@ -102,8 +102,6 @@ protected: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; - virtual void computeSelfHitTestRects(Vector& rects, const LayoutPoint& layerOffset) const override; - private: virtual RenderObjectChildList* virtualChildren() override final { return children(); } virtual const RenderObjectChildList* virtualChildren() const override final { return children(); } diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index be9337024d5..044a03a3069 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -2672,44 +2672,6 @@ void RenderLayer::filterNeedsPaintInvalidation() { } -void RenderLayer::addLayerHitTestRects(LayerHitTestRects& rects) const -{ - computeSelfHitTestRects(rects); - for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) - child->addLayerHitTestRects(rects); -} - -void RenderLayer::computeSelfHitTestRects(LayerHitTestRects& rects) const -{ - if (!size().isEmpty()) { - Vector rect; - - if (renderBox() && renderBox()->scrollsOverflow()) { - // For scrolling layers, rects are taken to be in the space of the contents. - // We need to include the bounding box of the layer in the space of its parent - // (eg. for border / scroll bars) and if it's composited then the entire contents - // as well as they may be on another composited layer. Skip reporting contents - // for non-composited layers as they'll get projected to the same layer as the - // bounding box. - if (compositingState() != NotComposited) - rect.append(m_scrollableArea->overflowRect()); - - rects.set(this, rect); - if (const RenderLayer* parentLayer = parent()) { - LayerHitTestRects::iterator iter = rects.find(parentLayer); - if (iter == rects.end()) { - rects.add(parentLayer, Vector()).storedValue->value.append(physicalBoundingBox(parentLayer)); - } else { - iter->value.append(physicalBoundingBox(parentLayer)); - } - } - } else { - rect.append(logicalBoundingBox()); - rects.set(this, rect); - } - } -} - void RenderLayer::setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants() { renderer()->setShouldDoFullPaintInvalidation(true); diff --git a/engine/core/rendering/RenderLayer.h b/engine/core/rendering/RenderLayer.h index 54b1159bdcc..b254c330cf0 100644 --- a/engine/core/rendering/RenderLayer.h +++ b/engine/core/rendering/RenderLayer.h @@ -347,11 +347,6 @@ public: bool scrollsWithViewport() const; bool scrollsWithRespectTo(const RenderLayer*) const; - void addLayerHitTestRects(LayerHitTestRects&) const; - - // Compute rects only for this layer - void computeSelfHitTestRects(LayerHitTestRects&) const; - // FIXME: This should probably return a ScrollableArea but a lot of internal methods are mistakenly exposed. RenderLayerScrollableArea* scrollableArea() const { return m_scrollableArea.get(); } RenderLayerRepainter& paintInvalidator() { return m_paintInvalidator; } diff --git a/engine/core/rendering/RenderLayerModelObject.cpp b/engine/core/rendering/RenderLayerModelObject.cpp index 17c9b473f0e..e602e8d7c49 100644 --- a/engine/core/rendering/RenderLayerModelObject.cpp +++ b/engine/core/rendering/RenderLayerModelObject.cpp @@ -120,24 +120,6 @@ void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt } } -void RenderLayerModelObject::addLayerHitTestRects(LayerHitTestRects& rects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const -{ - if (hasLayer()) { - if (isRenderView()) { - // RenderView is handled with a special fast-path, but it needs to know the current layer. - RenderObject::addLayerHitTestRects(rects, layer(), LayoutPoint(), LayoutRect()); - } else { - // Since a RenderObject never lives outside it's container RenderLayer, we can switch - // to marking entire layers instead. This may sometimes mark more than necessary (when - // a layer is made of disjoint objects) but in practice is a significant performance - // savings. - layer()->addLayerHitTestRects(rects); - } - } else { - RenderObject::addLayerHitTestRects(rects, currentLayer, layerOffset, containerRect); - } -} - InvalidationReason RenderLayerModelObject::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState, const RenderLayerModelObject& newPaintInvalidationContainer) { const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect(); diff --git a/engine/core/rendering/RenderLayerModelObject.h b/engine/core/rendering/RenderLayerModelObject.h index 7481cd599ee..3cc132aca47 100644 --- a/engine/core/rendering/RenderLayerModelObject.h +++ b/engine/core/rendering/RenderLayerModelObject.h @@ -71,8 +71,6 @@ protected: virtual void willBeDestroyed() override; - virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer*, const LayoutPoint&, const LayoutRect&) const override; - virtual InvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState&, const RenderLayerModelObject& newPaintInvalidationContainer); private: virtual bool isLayerModelObject() const override final { return true; } diff --git a/engine/core/rendering/RenderObject.cpp b/engine/core/rendering/RenderObject.cpp index 5df878bf77f..a5e1bf99045 100644 --- a/engine/core/rendering/RenderObject.cpp +++ b/engine/core/rendering/RenderObject.cpp @@ -36,7 +36,6 @@ #include "core/editing/htmlediting.h" #include "core/fetch/ResourceLoadPriorityOptimizer.h" #include "core/fetch/ResourceLoader.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLAnchorElement.h" @@ -1819,21 +1818,6 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS } else { s_affectsParentBlock = false; } - - // Elements with non-auto touch-action will send a SetTouchAction message - // on touchstart in EventHandler::handleTouchEvent, and so effectively have - // a touchstart handler that must be reported. - // - // Since a CSS property cannot be applied directly to a text node, a - // handler will have already been added for its parent so ignore it. - TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionAuto; - if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) != (newStyle.touchAction() == TouchActionAuto)) { - EventHandlerRegistry& registry = document().frameHost()->eventHandlerRegistry(); - if (newStyle.touchAction() != TouchActionAuto) - registry.didAddEventHandler(*node(), EventHandlerRegistry::TouchEvent); - else - registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchEvent); - } } static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderStyle* b) @@ -2104,84 +2088,6 @@ LayoutRect RenderObject::localCaretRect(InlineBox*, int, LayoutUnit* extraWidthT return LayoutRect(); } -void RenderObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const -{ - // Figure out what layer our container is in. Any offset (or new layer) for this - // renderer within it's container will be applied in addLayerHitTestRects. - LayoutPoint layerOffset; - const RenderLayer* currentLayer = 0; - - if (!hasLayer()) { - RenderObject* container = this->container(); - currentLayer = container->enclosingLayer(); - if (container && currentLayer->renderer() != container) { - layerOffset.move(container->offsetFromAncestorContainer(currentLayer->renderer())); - // If the layer itself is scrolled, we have to undo the subtraction of its scroll - // offset since we want the offset relative to the scrolling content, not the - // element itself. - if (currentLayer->renderer()->hasOverflowClip()) - layerOffset.move(currentLayer->renderBox()->scrolledContentOffset()); - } - } - - this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect()); -} - -void RenderObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const -{ - ASSERT(currentLayer); - ASSERT(currentLayer == this->enclosingLayer()); - - // Compute the rects for this renderer only and add them to the results. - // Note that we could avoid passing the offset and instead adjust each result, but this - // seems slightly simpler. - Vector ownRects; - LayoutRect newContainerRect; - computeSelfHitTestRects(ownRects, layerOffset); - - // When we get to have a lot of rects on a layer, the performance cost of tracking those - // rects outweighs the benefit of doing compositor thread hit testing. - // FIXME: This limit needs to be low due to the O(n^2) algorithm in - // WebLayer::setTouchEventHandlerRegion - crbug.com/300282. - const size_t maxRectsPerLayer = 100; - - LayerHitTestRects::iterator iter = layerRects.find(currentLayer); - Vector* iterValue; - if (iter == layerRects.end()) - iterValue = &layerRects.add(currentLayer, Vector()).storedValue->value; - else - iterValue = &iter->value; - for (size_t i = 0; i < ownRects.size(); i++) { - if (!containerRect.contains(ownRects[i])) { - iterValue->append(ownRects[i]); - if (iterValue->size() > maxRectsPerLayer) { - // Just mark the entire layer instead, and switch to walking the layer - // tree instead of the render tree. - layerRects.remove(currentLayer); - currentLayer->addLayerHitTestRects(layerRects); - return; - } - if (newContainerRect.isEmpty()) - newContainerRect = ownRects[i]; - } - } - if (newContainerRect.isEmpty()) - newContainerRect = containerRect; - - // If it's possible for children to have rects outside our bounds, then we need to descend into - // the children and compute them. - // Ideally there would be other cases where we could detect that children couldn't have rects - // outside our bounds and prune the tree walk. - // Note that we don't use Region here because Union is O(N) - better to just keep a list of - // partially redundant rectangles. If we find examples where this is expensive, then we could - // rewrite Region to be more efficient. See https://bugs.webkit.org/show_bug.cgi?id=100814. - if (!isRenderView()) { - for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling()) { - curr->addLayerHitTestRects(layerRects, currentLayer, layerOffset, newContainerRect); - } - } -} - bool RenderObject::isRooted() const { const RenderObject* object = this; @@ -2282,13 +2188,6 @@ void RenderObject::willBeDestroyed() remove(); - // Remove the handler if node had touch-action set. Don't call when - // document is being destroyed as all handlers will have been cleared - // previously. Handlers are not added for text nodes so don't try removing - // for one too. Need to check if m_style is null in cases of partial construction. - if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto) - document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*node(), EventHandlerRegistry::TouchEvent); - setAncestorLineBoxDirty(false); clearLayoutRootIfNeeded(); diff --git a/engine/core/rendering/RenderObject.h b/engine/core/rendering/RenderObject.h index 30c47b3317a..d91919c7759 100644 --- a/engine/core/rendering/RenderObject.h +++ b/engine/core/rendering/RenderObject.h @@ -821,9 +821,6 @@ public: virtual void addFocusRingRects(Vector&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) const { }; - // Compute a list of hit-test rectangles per layer rooted at this renderer. - virtual void computeLayerHitTestRects(LayerHitTestRects&) const; - RespectImageOrientationEnum shouldRespectImageOrientation() const; bool isRelayoutBoundaryForInspector() const; @@ -931,20 +928,6 @@ protected: void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_node = document; } - // Add hit-test rects for the render tree rooted at this node to the provided collection on a - // per-RenderLayer basis. - // currentLayer must be the enclosing layer, and layerOffset is the current offset within - // this layer. Subclass implementations will add any offset for this renderer within it's - // container, so callers should provide only the offset of the container within it's layer. - // containerRect is a rect that has already been added for the currentLayer which is likely to - // be a container for child elements. Any rect wholly contained by containerRect can be - // skipped. - virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const; - - // Add hit-test rects for this renderer only to the provided list. layerOffset is the offset - // of this renderer within the current layer that should be used for each result. - virtual void computeSelfHitTestRects(Vector&, const LayoutPoint& layerOffset) const { }; - virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModelObject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalidationContainer, const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalidationContainer); diff --git a/engine/core/rendering/RenderText.cpp b/engine/core/rendering/RenderText.cpp index 605e7751f73..91811918cc8 100644 --- a/engine/core/rendering/RenderText.cpp +++ b/engine/core/rendering/RenderText.cpp @@ -1186,11 +1186,6 @@ UChar RenderText::previousCharacter() const return prev; } -void RenderText::addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const -{ - // Text nodes aren't event targets, so don't descend any further. -} - void RenderText::setTextInternal(PassRefPtr text) { ASSERT(text); diff --git a/engine/core/rendering/RenderText.h b/engine/core/rendering/RenderText.h index 359e6aa6aed..d3fdac46ebd 100644 --- a/engine/core/rendering/RenderText.h +++ b/engine/core/rendering/RenderText.h @@ -145,8 +145,6 @@ protected: virtual void setTextInternal(PassRefPtr); virtual UChar previousCharacter() const; - virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override; - InlineTextBox* createTextBox(); private: diff --git a/engine/core/rendering/RenderView.cpp b/engine/core/rendering/RenderView.cpp index 82d0f0d35aa..20e6d692474 100644 --- a/engine/core/rendering/RenderView.cpp +++ b/engine/core/rendering/RenderView.cpp @@ -228,14 +228,6 @@ void RenderView::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformStat } } -void RenderView::computeSelfHitTestRects(Vector& rects, const LayoutPoint&) const -{ - // Record the entire size of the contents of the frame. Note that we don't just - // use the viewport size (containing block) here because we want to ensure this includes - // all children (so we can avoid walking them explicitly). - rects.append(LayoutRect(LayoutPoint::zero(), frameView()->size())); -} - void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { // If we ever require layout but receive a paint anyway, something has gone horribly wrong. diff --git a/engine/core/rendering/RenderView.h b/engine/core/rendering/RenderView.h index 5e4a17f98bd..cab0dffd2cd 100644 --- a/engine/core/rendering/RenderView.h +++ b/engine/core/rendering/RenderView.h @@ -135,8 +135,6 @@ private: virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalidationContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, const PaintInvalidationState* = 0) const override; virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override; virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override; - virtual void computeSelfHitTestRects(Vector&, const LayoutPoint& layerOffset) const override; - bool shouldInvalidatePaint(const LayoutRect&) const; diff --git a/engine/public/platform/WebLayer.h b/engine/public/platform/WebLayer.h index 1e8d3c6eb3f..028b8ab1910 100644 --- a/engine/public/platform/WebLayer.h +++ b/engine/public/platform/WebLayer.h @@ -181,10 +181,6 @@ public: virtual bool shouldScrollOnMainThread() const = 0; virtual void setNonFastScrollableRegion(const WebVector&) = 0; - virtual WebVector nonFastScrollableRegion() const = 0; - - virtual void setTouchEventHandlerRegion(const WebVector&) = 0; - virtual WebVector touchEventHandlerRegion() const = 0; // The scroll client is notified when the scroll position of the WebLayer // changes. Only a single scroll client can be set for a WebLayer at a time. diff --git a/engine/public/web/WebWidget.h b/engine/public/web/WebWidget.h index 5263ca3bc23..95a9da2bc2d 100644 --- a/engine/public/web/WebWidget.h +++ b/engine/public/web/WebWidget.h @@ -133,9 +133,6 @@ public: // Called to inform the WebWidget of the mouse cursor's visibility. virtual void setCursorVisibilityState(bool isVisible) { } - // Check whether the given point hits any registered touch event handlers. - virtual bool hasTouchEventHandlersAt(const WebPoint&) { return true; } - // Called to inform the WebWidget that mouse capture was lost. virtual void mouseCaptureLost() { } diff --git a/engine/public/web/WebWidgetClient.h b/engine/public/web/WebWidgetClient.h index edf441f7e41..a5ba7e95b94 100644 --- a/engine/public/web/WebWidgetClient.h +++ b/engine/public/web/WebWidgetClient.h @@ -153,9 +153,6 @@ public: // Called when a gesture event is handled. virtual void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled) { } - // Called to update if touch events should be sent. - virtual void hasTouchEventHandlers(bool) { } - // Called during WebWidget::HandleInputEvent for a TouchStart event to inform the embedder // of the touch actions that are permitted for this touch. virtual void setTouchAction(WebTouchAction touchAction) { } diff --git a/engine/web/ChromeClientImpl.cpp b/engine/web/ChromeClientImpl.cpp index 30e03070daf..489cbdf7361 100644 --- a/engine/web/ChromeClientImpl.cpp +++ b/engine/web/ChromeClientImpl.cpp @@ -355,11 +355,6 @@ void ChromeClientImpl::clearCompositedSelectionBounds() m_webView->clearCompositedSelectionBounds(); } -void ChromeClientImpl::needTouchEvents(bool needsTouchEvents) -{ - m_webView->hasTouchEventHandlers(needsTouchEvents); -} - void ChromeClientImpl::setTouchAction(TouchAction touchAction) { if (WebViewClient* client = m_webView->client()) { diff --git a/engine/web/ChromeClientImpl.h b/engine/web/ChromeClientImpl.h index 84055d5cbc3..abb119818f2 100644 --- a/engine/web/ChromeClientImpl.h +++ b/engine/web/ChromeClientImpl.h @@ -86,7 +86,6 @@ public: const HitTestResult&, unsigned modifierFlags) override; virtual void setToolTip(const WTF::String& tooltipText, TextDirection) override; virtual void setCursor(const Cursor&) override; - virtual void needTouchEvents(bool needTouchEvents) override; virtual void setTouchAction(TouchAction) override; virtual GraphicsLayerFactory* graphicsLayerFactory() const override; diff --git a/engine/web/WebViewImpl.cpp b/engine/web/WebViewImpl.cpp index 693762672f3..a073c2d7507 100644 --- a/engine/web/WebViewImpl.cpp +++ b/engine/web/WebViewImpl.cpp @@ -45,7 +45,6 @@ #include "core/editing/markup.h" #include "core/events/KeyboardEvent.h" #include "core/events/WheelEvent.h" -#include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameHost.h" #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" @@ -760,17 +759,6 @@ bool WebViewImpl::zoomToMultipleTargetsRect(const WebRect& rect) return false; } -void WebViewImpl::hasTouchEventHandlers(bool hasTouchHandlers) -{ - m_client->hasTouchEventHandlers(hasTouchHandlers); -} - -bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) -{ - // FIXME: Implement this. Note that the point must be divided by pageScaleFactor. - return true; -} - bool WebViewImpl::keyEventDefault(const WebKeyboardEvent& event) { LocalFrame* frame = focusedCoreFrame(); diff --git a/engine/web/WebViewImpl.h b/engine/web/WebViewImpl.h index fe60220fb5a..254dac7069d 100644 --- a/engine/web/WebViewImpl.h +++ b/engine/web/WebViewImpl.h @@ -90,7 +90,6 @@ public: virtual void themeChanged() override; virtual bool handleInputEvent(const WebInputEvent&) override; virtual void setCursorVisibilityState(bool isVisible) override; - virtual bool hasTouchEventHandlersAt(const WebPoint&) override; virtual void mouseCaptureLost() override; virtual void setFocus(bool enable) override; virtual bool setComposition( @@ -235,8 +234,6 @@ public: bool detectContentOnTouch(const WebPoint&); - void hasTouchEventHandlers(bool); - // WebGestureCurveTarget implementation for fling. virtual bool scrollBy(const WebFloatSize& delta, const WebFloatSize& velocity) override; diff --git a/viewer/cc/web_layer_impl.cc b/viewer/cc/web_layer_impl.cc index 2adfbcc55ac..f64f7479a01 100644 --- a/viewer/cc/web_layer_impl.cc +++ b/viewer/cc/web_layer_impl.cc @@ -336,49 +336,6 @@ void WebLayerImpl::setNonFastScrollableRegion(const WebVector& rects) { layer_->SetNonFastScrollableRegion(region); } -WebVector WebLayerImpl::nonFastScrollableRegion() const { - size_t num_rects = 0; - for (cc::Region::Iterator region_rects(layer_->non_fast_scrollable_region()); - region_rects.has_rect(); - region_rects.next()) - ++num_rects; - - WebVector result(num_rects); - size_t i = 0; - for (cc::Region::Iterator region_rects(layer_->non_fast_scrollable_region()); - region_rects.has_rect(); - region_rects.next()) { - result[i] = region_rects.rect(); - ++i; - } - return result; -} - -void WebLayerImpl::setTouchEventHandlerRegion(const WebVector& rects) { - cc::Region region; - for (size_t i = 0; i < rects.size(); ++i) - region.Union(rects[i]); - layer_->SetTouchEventHandlerRegion(region); -} - -WebVector WebLayerImpl::touchEventHandlerRegion() const { - size_t num_rects = 0; - for (cc::Region::Iterator region_rects(layer_->touch_event_handler_region()); - region_rects.has_rect(); - region_rects.next()) - ++num_rects; - - WebVector result(num_rects); - size_t i = 0; - for (cc::Region::Iterator region_rects(layer_->touch_event_handler_region()); - region_rects.has_rect(); - region_rects.next()) { - result[i] = region_rects.rect(); - ++i; - } - return result; -} - void WebLayerImpl::setScrollClient(blink::WebLayerScrollClient* scroll_client) { if (scroll_client) { layer_->set_did_scroll_callback( diff --git a/viewer/cc/web_layer_impl.h b/viewer/cc/web_layer_impl.h index 7ebfa53020e..5d8a8d92253 100644 --- a/viewer/cc/web_layer_impl.h +++ b/viewer/cc/web_layer_impl.h @@ -119,10 +119,6 @@ class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { virtual bool shouldScrollOnMainThread() const; virtual void setNonFastScrollableRegion( const blink::WebVector& region); - virtual blink::WebVector nonFastScrollableRegion() const; - virtual void setTouchEventHandlerRegion( - const blink::WebVector& region); - virtual blink::WebVector touchEventHandlerRegion() const; virtual void setScrollClient(blink::WebLayerScrollClient* client); virtual bool isOrphan() const; virtual void setWebLayerClient(blink::WebLayerClient* client);