| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "core/dom/NodeRenderingTraversal.h" | 48 #include "core/dom/NodeRenderingTraversal.h" |
| 49 #include "core/dom/NodeTraversal.h" | 49 #include "core/dom/NodeTraversal.h" |
| 50 #include "core/dom/ProcessingInstruction.h" | 50 #include "core/dom/ProcessingInstruction.h" |
| 51 #include "core/dom/Range.h" | 51 #include "core/dom/Range.h" |
| 52 #include "core/dom/StaticNodeList.h" | 52 #include "core/dom/StaticNodeList.h" |
| 53 #include "core/dom/TemplateContentDocumentFragment.h" | 53 #include "core/dom/TemplateContentDocumentFragment.h" |
| 54 #include "core/dom/Text.h" | 54 #include "core/dom/Text.h" |
| 55 #include "core/dom/TreeScopeAdopter.h" | 55 #include "core/dom/TreeScopeAdopter.h" |
| 56 #include "core/dom/UserActionElementSet.h" | 56 #include "core/dom/UserActionElementSet.h" |
| 57 #include "core/dom/WeakNodeMap.h" | 57 #include "core/dom/WeakNodeMap.h" |
| 58 #include "core/dom/WheelController.h" | |
| 59 #include "core/dom/shadow/ElementShadow.h" | 58 #include "core/dom/shadow/ElementShadow.h" |
| 60 #include "core/dom/shadow/InsertionPoint.h" | 59 #include "core/dom/shadow/InsertionPoint.h" |
| 61 #include "core/dom/shadow/ShadowRoot.h" | 60 #include "core/dom/shadow/ShadowRoot.h" |
| 62 #include "core/editing/htmlediting.h" | 61 #include "core/editing/htmlediting.h" |
| 63 #include "core/editing/markup.h" | 62 #include "core/editing/markup.h" |
| 64 #include "core/events/Event.h" | 63 #include "core/events/Event.h" |
| 65 #include "core/events/EventDispatchMediator.h" | 64 #include "core/events/EventDispatchMediator.h" |
| 66 #include "core/events/EventDispatcher.h" | 65 #include "core/events/EventDispatcher.h" |
| 67 #include "core/events/EventListener.h" | 66 #include "core/events/EventListener.h" |
| 68 #include "core/events/GestureEvent.h" | 67 #include "core/events/GestureEvent.h" |
| (...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1922 } | 1921 } |
| 1923 } | 1922 } |
| 1924 | 1923 |
| 1925 if (AXObjectCache::accessibilityEnabled()) { | 1924 if (AXObjectCache::accessibilityEnabled()) { |
| 1926 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) | 1925 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) |
| 1927 cache->remove(this); | 1926 cache->remove(this); |
| 1928 } | 1927 } |
| 1929 | 1928 |
| 1930 oldDocument.markers().removeMarkers(this); | 1929 oldDocument.markers().removeMarkers(this); |
| 1931 | 1930 |
| 1932 const EventListenerVector& mousewheelListeners = getEventListeners(EventType
Names::mousewheel); | |
| 1933 WheelController* oldController = WheelController::from(oldDocument); | |
| 1934 WheelController* newController = WheelController::from(document()); | |
| 1935 for (size_t i = 0; i < mousewheelListeners.size(); ++i) { | |
| 1936 oldController->didRemoveWheelEventHandler(oldDocument); | |
| 1937 newController->didAddWheelEventHandler(document()); | |
| 1938 } | |
| 1939 | |
| 1940 const EventListenerVector& wheelListeners = getEventListeners(EventTypeNames
::wheel); | |
| 1941 for (size_t i = 0; i < wheelListeners.size(); ++i) { | |
| 1942 oldController->didRemoveWheelEventHandler(oldDocument); | |
| 1943 newController->didAddWheelEventHandler(document()); | |
| 1944 } | |
| 1945 | 1931 |
| 1946 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets
()) { | 1932 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets
()) { |
| 1947 while (touchHandlers->contains(this)) { | 1933 while (touchHandlers->contains(this)) { |
| 1948 oldDocument.didRemoveTouchEventHandler(this); | 1934 oldDocument.didRemoveTouchEventHandler(this); |
| 1949 document().didAddTouchEventHandler(this); | 1935 document().didAddTouchEventHandler(this); |
| 1950 } | 1936 } |
| 1951 } | 1937 } |
| 1952 if (oldDocument.frameHost() != document().frameHost()) { | 1938 if (oldDocument.frameHost() != document().frameHost()) { |
| 1953 if (oldDocument.frameHost()) | 1939 if (oldDocument.frameHost()) |
| 1954 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHos
t(*this); | 1940 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHos
t(*this); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1969 } | 1955 } |
| 1970 } | 1956 } |
| 1971 | 1957 |
| 1972 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) | 1958 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) |
| 1973 { | 1959 { |
| 1974 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) | 1960 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) |
| 1975 return false; | 1961 return false; |
| 1976 | 1962 |
| 1977 Document& document = targetNode->document(); | 1963 Document& document = targetNode->document(); |
| 1978 document.addListenerTypeIfNeeded(eventType); | 1964 document.addListenerTypeIfNeeded(eventType); |
| 1979 if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mouse
wheel) | 1965 if (isTouchEventType(eventType)) |
| 1980 WheelController::from(document)->didAddWheelEventHandler(document); | |
| 1981 else if (isTouchEventType(eventType)) | |
| 1982 document.didAddTouchEventHandler(targetNode); | 1966 document.didAddTouchEventHandler(targetNode); |
| 1983 if (document.frameHost()) | 1967 if (document.frameHost()) |
| 1984 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN
ode, eventType); | 1968 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN
ode, eventType); |
| 1985 | 1969 |
| 1986 return true; | 1970 return true; |
| 1987 } | 1971 } |
| 1988 | 1972 |
| 1989 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) | 1973 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) |
| 1990 { | 1974 { |
| 1991 return tryAddEventListener(this, eventType, listener, useCapture); | 1975 return tryAddEventListener(this, eventType, listener, useCapture); |
| 1992 } | 1976 } |
| 1993 | 1977 |
| 1994 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) | 1978 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) |
| 1995 { | 1979 { |
| 1996 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) | 1980 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) |
| 1997 return false; | 1981 return false; |
| 1998 | 1982 |
| 1999 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of | 1983 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of |
| 2000 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 | 1984 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 |
| 2001 Document& document = targetNode->document(); | 1985 Document& document = targetNode->document(); |
| 2002 if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mouse
wheel) | 1986 if (isTouchEventType(eventType)) |
| 2003 WheelController::from(document)->didRemoveWheelEventHandler(document); | |
| 2004 else if (isTouchEventType(eventType)) | |
| 2005 document.didRemoveTouchEventHandler(targetNode); | 1987 document.didRemoveTouchEventHandler(targetNode); |
| 2006 if (document.frameHost()) | 1988 if (document.frameHost()) |
| 2007 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ
etNode, eventType); | 1989 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ
etNode, eventType); |
| 2008 | 1990 |
| 2009 return true; | 1991 return true; |
| 2010 } | 1992 } |
| 2011 | 1993 |
| 2012 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) | 1994 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) |
| 2013 { | 1995 { |
| 2014 return tryRemoveEventListener(this, eventType, listener, useCapture); | 1996 return tryRemoveEventListener(this, eventType, listener, useCapture); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 node->showTreeForThis(); | 2560 node->showTreeForThis(); |
| 2579 } | 2561 } |
| 2580 | 2562 |
| 2581 void showNodePath(const WebCore::Node* node) | 2563 void showNodePath(const WebCore::Node* node) |
| 2582 { | 2564 { |
| 2583 if (node) | 2565 if (node) |
| 2584 node->showNodePathForThis(); | 2566 node->showNodePathForThis(); |
| 2585 } | 2567 } |
| 2586 | 2568 |
| 2587 #endif | 2569 #endif |
| OLD | NEW |