mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
remove updateTouchEventTargetRectsIfNeeded
BUG= R=abarth@chromium.org Review URL: https://codereview.chromium.org/713073003
This commit is contained in:
parent
e00f34ccf6
commit
c0ffe6fb23
@ -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",
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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<OwnPtr<MutationObserverRegistration> >* 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<EventListe
|
||||
|
||||
static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, PassRefPtr<EventListener> 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<EventListener> listener, bool useCapture)
|
||||
@ -1438,8 +1417,6 @@ bool Node::removeEventListener(const AtomicString& eventType, PassRefPtr<EventLi
|
||||
|
||||
void Node::removeAllEventListeners()
|
||||
{
|
||||
if (hasEventListeners() && document().frameHost())
|
||||
document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
|
||||
EventTarget::removeAllEventListeners();
|
||||
}
|
||||
|
||||
|
||||
@ -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<AtomicString> 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<EventHandlerClass>(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<EventHandlerClass>(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<EventHandlerClass>(handlerClassIndex);
|
||||
Vector<EventTarget*> 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<EventHandlerClass>(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
|
||||
@ -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<EventTarget*> 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
|
||||
@ -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> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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<EventHandlerRegistry> m_eventHandlerRegistry;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -107,8 +107,6 @@ public:
|
||||
|
||||
virtual void clearCompositedSelectionBounds() { }
|
||||
|
||||
virtual void needTouchEvents(bool) = 0;
|
||||
|
||||
virtual void setTouchAction(TouchAction) = 0;
|
||||
|
||||
virtual String acceptLanguages() = 0;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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> 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<const GraphicsLayer*, Vector<LayoutRect> > 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<const RenderLayer*, Vector<const LocalFrame*> > 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<const RenderLayer*>& 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<LayoutRect>* glRects;
|
||||
if (glIter == graphicsRects.end())
|
||||
glRects = &graphicsRects.add(graphicsLayer, Vector<LayoutRect>()).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<const RenderLayer*> 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<const RenderLayer*> 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<const RenderLayer*>::iterator it = oldLayersWithTouchRects.begin(); it != oldLayersWithTouchRects.end(); ++it) {
|
||||
if (!layerRects.contains(*it))
|
||||
layerRects.add(*it, Vector<LayoutRect>());
|
||||
}
|
||||
|
||||
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<WebRect> 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
|
||||
|
||||
@ -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>);
|
||||
blink::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation);
|
||||
void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation);
|
||||
|
||||
@ -2753,22 +2753,6 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& a
|
||||
inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location()), paintContainer);
|
||||
}
|
||||
|
||||
void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const LayoutPoint& layerOffset) const
|
||||
{
|
||||
RenderBox::computeSelfHitTestRects(rects, layerOffset);
|
||||
|
||||
if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) {
|
||||
for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
|
||||
LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top());
|
||||
LayoutUnit bottom = std::min<LayoutUnit>(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());
|
||||
|
||||
@ -285,8 +285,6 @@ protected:
|
||||
|
||||
virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) const override;
|
||||
|
||||
virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const override;
|
||||
|
||||
void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*);
|
||||
|
||||
virtual bool isInlineBlock() const override final { return isInline() && isReplaced(); }
|
||||
|
||||
@ -403,18 +403,6 @@ void RenderBox::addFocusRingRects(Vector<IntRect>& 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<LayoutRect>& 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.
|
||||
|
||||
@ -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<LayoutRect>&, const LayoutPoint& layerOffset) const override;
|
||||
|
||||
void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; }
|
||||
|
||||
virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModelObject& paintInvalidationContainer,
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -172,8 +172,6 @@ public:
|
||||
void contentChanged(ContentChangeType);
|
||||
bool hasAcceleratedCompositing() const;
|
||||
|
||||
virtual void computeLayerHitTestRects(LayerHitTestRects&) const override;
|
||||
|
||||
protected:
|
||||
virtual void willBeDestroyed() override;
|
||||
|
||||
|
||||
@ -1349,12 +1349,6 @@ private:
|
||||
|
||||
}
|
||||
|
||||
void RenderInline::computeSelfHitTestRects(Vector<LayoutRect>& rects, const LayoutPoint& layerOffset) const
|
||||
{
|
||||
AbsoluteLayoutRectsGeneratorContext context(rects, layerOffset);
|
||||
generateLineBoxRects(context);
|
||||
}
|
||||
|
||||
void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
|
||||
{
|
||||
RenderStyle* styleToUse = style();
|
||||
|
||||
@ -102,8 +102,6 @@ protected:
|
||||
|
||||
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
|
||||
|
||||
virtual void computeSelfHitTestRects(Vector<LayoutRect>& rects, const LayoutPoint& layerOffset) const override;
|
||||
|
||||
private:
|
||||
virtual RenderObjectChildList* virtualChildren() override final { return children(); }
|
||||
virtual const RenderObjectChildList* virtualChildren() const override final { return children(); }
|
||||
|
||||
@ -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<LayoutRect> 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<LayoutRect>()).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);
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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<LayoutRect> 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<LayoutRect>* iterValue;
|
||||
if (iter == layerRects.end())
|
||||
iterValue = &layerRects.add(currentLayer, Vector<LayoutRect>()).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();
|
||||
|
||||
@ -821,9 +821,6 @@ public:
|
||||
|
||||
virtual void addFocusRingRects(Vector<IntRect>&, 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<LayoutRect>&, const LayoutPoint& layerOffset) const { };
|
||||
|
||||
virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModelObject& paintInvalidationContainer,
|
||||
const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalidationContainer,
|
||||
const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalidationContainer);
|
||||
|
||||
@ -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<StringImpl> text)
|
||||
{
|
||||
ASSERT(text);
|
||||
|
||||
@ -145,8 +145,6 @@ protected:
|
||||
virtual void setTextInternal(PassRefPtr<StringImpl>);
|
||||
virtual UChar previousCharacter() const;
|
||||
|
||||
virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
|
||||
|
||||
InlineTextBox* createTextBox();
|
||||
|
||||
private:
|
||||
|
||||
@ -228,14 +228,6 @@ void RenderView::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformStat
|
||||
}
|
||||
}
|
||||
|
||||
void RenderView::computeSelfHitTestRects(Vector<LayoutRect>& 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.
|
||||
|
||||
@ -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<LayoutRect>&, const LayoutPoint& layerOffset) const override;
|
||||
|
||||
|
||||
bool shouldInvalidatePaint(const LayoutRect&) const;
|
||||
|
||||
|
||||
@ -181,10 +181,6 @@ public:
|
||||
virtual bool shouldScrollOnMainThread() const = 0;
|
||||
|
||||
virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) = 0;
|
||||
virtual WebVector<WebRect> nonFastScrollableRegion() const = 0;
|
||||
|
||||
virtual void setTouchEventHandlerRegion(const WebVector<WebRect>&) = 0;
|
||||
virtual WebVector<WebRect> 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.
|
||||
|
||||
@ -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() { }
|
||||
|
||||
|
||||
@ -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) { }
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -336,49 +336,6 @@ void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) {
|
||||
layer_->SetNonFastScrollableRegion(region);
|
||||
}
|
||||
|
||||
WebVector<WebRect> 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<WebRect> 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<WebRect>& rects) {
|
||||
cc::Region region;
|
||||
for (size_t i = 0; i < rects.size(); ++i)
|
||||
region.Union(rects[i]);
|
||||
layer_->SetTouchEventHandlerRegion(region);
|
||||
}
|
||||
|
||||
WebVector<WebRect> 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<WebRect> 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(
|
||||
|
||||
@ -119,10 +119,6 @@ class WebLayerImpl : public blink::WebLayer, public cc::LayerClient {
|
||||
virtual bool shouldScrollOnMainThread() const;
|
||||
virtual void setNonFastScrollableRegion(
|
||||
const blink::WebVector<blink::WebRect>& region);
|
||||
virtual blink::WebVector<blink::WebRect> nonFastScrollableRegion() const;
|
||||
virtual void setTouchEventHandlerRegion(
|
||||
const blink::WebVector<blink::WebRect>& region);
|
||||
virtual blink::WebVector<blink::WebRect> touchEventHandlerRegion() const;
|
||||
virtual void setScrollClient(blink::WebLayerScrollClient* client);
|
||||
virtual bool isOrphan() const;
|
||||
virtual void setWebLayerClient(blink::WebLayerClient* client);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user