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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
43 #include "core/dom/ElementRareData.h" | 43 #include "core/dom/ElementRareData.h" |
44 #include "core/dom/ElementTraversal.h" | 44 #include "core/dom/ElementTraversal.h" |
45 #include "core/dom/ExceptionCode.h" | 45 #include "core/dom/ExceptionCode.h" |
46 #include "core/dom/LiveNodeList.h" | 46 #include "core/dom/LiveNodeList.h" |
47 #include "core/dom/NodeRareData.h" | 47 #include "core/dom/NodeRareData.h" |
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/ScrollEventHandlerController.h" |
52 #include "core/dom/StaticNodeList.h" | 53 #include "core/dom/StaticNodeList.h" |
53 #include "core/dom/TemplateContentDocumentFragment.h" | 54 #include "core/dom/TemplateContentDocumentFragment.h" |
54 #include "core/dom/Text.h" | 55 #include "core/dom/Text.h" |
55 #include "core/dom/TreeScopeAdopter.h" | 56 #include "core/dom/TreeScopeAdopter.h" |
56 #include "core/dom/UserActionElementSet.h" | 57 #include "core/dom/UserActionElementSet.h" |
57 #include "core/dom/WheelController.h" | 58 #include "core/dom/WheelController.h" |
58 #include "core/dom/shadow/ElementShadow.h" | 59 #include "core/dom/shadow/ElementShadow.h" |
59 #include "core/dom/shadow/InsertionPoint.h" | 60 #include "core/dom/shadow/InsertionPoint.h" |
60 #include "core/dom/shadow/ShadowRoot.h" | 61 #include "core/dom/shadow/ShadowRoot.h" |
61 #include "core/editing/htmlediting.h" | 62 #include "core/editing/htmlediting.h" |
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 document().addListenerTypeIfNeeded(types[i]); | 1913 document().addListenerTypeIfNeeded(types[i]); |
1913 } | 1914 } |
1914 } | 1915 } |
1915 | 1916 |
1916 if (AXObjectCache::accessibilityEnabled()) { | 1917 if (AXObjectCache::accessibilityEnabled()) { |
1917 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) | 1918 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) |
1918 cache->remove(this); | 1919 cache->remove(this); |
1919 } | 1920 } |
1920 | 1921 |
1921 const EventListenerVector& mousewheelListeners = getEventListeners(EventType
Names::mousewheel); | 1922 const EventListenerVector& mousewheelListeners = getEventListeners(EventType
Names::mousewheel); |
1922 WheelController* oldController = WheelController::from(oldDocument); | 1923 WheelController* oldWheelController = WheelController::from(oldDocument); |
1923 WheelController* newController = WheelController::from(document()); | 1924 WheelController* newWheelController = WheelController::from(document()); |
1924 for (size_t i = 0; i < mousewheelListeners.size(); ++i) { | 1925 for (size_t i = 0; i < mousewheelListeners.size(); ++i) { |
1925 oldController->didRemoveWheelEventHandler(oldDocument); | 1926 oldWheelController->didRemoveWheelEventHandler(oldDocument); |
1926 newController->didAddWheelEventHandler(document()); | 1927 newWheelController->didAddWheelEventHandler(document()); |
1927 } | 1928 } |
1928 | 1929 |
1929 const EventListenerVector& wheelListeners = getEventListeners(EventTypeNames
::wheel); | 1930 const EventListenerVector& wheelListeners = getEventListeners(EventTypeNames
::wheel); |
1930 for (size_t i = 0; i < wheelListeners.size(); ++i) { | 1931 for (size_t i = 0; i < wheelListeners.size(); ++i) { |
1931 oldController->didRemoveWheelEventHandler(oldDocument); | 1932 oldWheelController->didRemoveWheelEventHandler(oldDocument); |
1932 newController->didAddWheelEventHandler(document()); | 1933 newWheelController->didAddWheelEventHandler(document()); |
| 1934 } |
| 1935 |
| 1936 const EventListenerVector& scrollListeners = getEventListeners(EventTypeName
s::scroll); |
| 1937 ScrollEventHandlerController* oldScrollController = ScrollEventHandlerContro
ller::from(oldDocument); |
| 1938 ScrollEventHandlerController* newScrollController = ScrollEventHandlerContro
ller::from(document()); |
| 1939 for (size_t i = 0; i < scrollListeners.size(); ++i) { |
| 1940 oldScrollController->didRemoveScrollEventHandler(oldDocument); |
| 1941 newScrollController->didAddScrollEventHandler(document()); |
1933 } | 1942 } |
1934 | 1943 |
1935 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets
()) { | 1944 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets
()) { |
1936 while (touchHandlers->contains(this)) { | 1945 while (touchHandlers->contains(this)) { |
1937 oldDocument.didRemoveTouchEventHandler(this); | 1946 oldDocument.didRemoveTouchEventHandler(this); |
1938 document().didAddTouchEventHandler(this); | 1947 document().didAddTouchEventHandler(this); |
1939 } | 1948 } |
1940 } | 1949 } |
1941 | 1950 |
1942 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserv
erRegistry()) { | 1951 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserv
erRegistry()) { |
(...skipping 11 matching lines...) Expand all Loading... |
1954 | 1963 |
1955 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) | 1964 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) |
1956 { | 1965 { |
1957 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) | 1966 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) |
1958 return false; | 1967 return false; |
1959 | 1968 |
1960 Document& document = targetNode->document(); | 1969 Document& document = targetNode->document(); |
1961 document.addListenerTypeIfNeeded(eventType); | 1970 document.addListenerTypeIfNeeded(eventType); |
1962 if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mouse
wheel) | 1971 if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mouse
wheel) |
1963 WheelController::from(document)->didAddWheelEventHandler(document); | 1972 WheelController::from(document)->didAddWheelEventHandler(document); |
| 1973 else if (eventType == EventTypeNames::scroll) |
| 1974 ScrollEventHandlerController::from(document)->didAddScrollEventHandler(d
ocument); |
1964 else if (isTouchEventType(eventType)) | 1975 else if (isTouchEventType(eventType)) |
1965 document.didAddTouchEventHandler(targetNode); | 1976 document.didAddTouchEventHandler(targetNode); |
1966 | 1977 |
1967 return true; | 1978 return true; |
1968 } | 1979 } |
1969 | 1980 |
1970 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) | 1981 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) |
1971 { | 1982 { |
1972 return tryAddEventListener(this, eventType, listener, useCapture); | 1983 return tryAddEventListener(this, eventType, listener, useCapture); |
1973 } | 1984 } |
1974 | 1985 |
1975 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) | 1986 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) |
1976 { | 1987 { |
1977 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) | 1988 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) |
1978 return false; | 1989 return false; |
1979 | 1990 |
1980 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of | 1991 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of |
1981 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 | 1992 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 |
1982 Document& document = targetNode->document(); | 1993 Document& document = targetNode->document(); |
1983 if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mouse
wheel) | 1994 if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mouse
wheel) |
1984 WheelController::from(document)->didRemoveWheelEventHandler(document); | 1995 WheelController::from(document)->didRemoveWheelEventHandler(document); |
| 1996 else if (eventType == EventTypeNames::scroll) |
| 1997 ScrollEventHandlerController::from(document)->didRemoveScrollEventHandle
r(document); |
1985 else if (isTouchEventType(eventType)) | 1998 else if (isTouchEventType(eventType)) |
1986 document.didRemoveTouchEventHandler(targetNode); | 1999 document.didRemoveTouchEventHandler(targetNode); |
1987 | 2000 |
1988 return true; | 2001 return true; |
1989 } | 2002 } |
1990 | 2003 |
1991 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) | 2004 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) |
1992 { | 2005 { |
1993 return tryRemoveEventListener(this, eventType, listener, useCapture); | 2006 return tryRemoveEventListener(this, eventType, listener, useCapture); |
1994 } | 2007 } |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 node->showTreeForThis(); | 2548 node->showTreeForThis(); |
2536 } | 2549 } |
2537 | 2550 |
2538 void showNodePath(const WebCore::Node* node) | 2551 void showNodePath(const WebCore::Node* node) |
2539 { | 2552 { |
2540 if (node) | 2553 if (node) |
2541 node->showNodePathForThis(); | 2554 node->showNodePathForThis(); |
2542 } | 2555 } |
2543 | 2556 |
2544 #endif | 2557 #endif |
OLD | NEW |