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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 | 2037 |
2038 fireEventListeners(&event); | 2038 fireEventListeners(&event); |
2039 } | 2039 } |
2040 | 2040 |
2041 void Node::dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event> event) | 2041 void Node::dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event> event) |
2042 { | 2042 { |
2043 event->setTrusted(true); | 2043 event->setTrusted(true); |
2044 EventDispatcher::dispatchScopedEvent(*this, event->createMediator()); | 2044 EventDispatcher::dispatchScopedEvent(*this, event->createMediator()); |
2045 } | 2045 } |
2046 | 2046 |
2047 bool Node::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) | 2047 DispatchEventResult Node::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> ev
ent) |
2048 { | 2048 { |
2049 return EventDispatcher::dispatchEvent(*this, event->createMediator()); | 2049 return EventDispatcher::dispatchEvent(*this, event->createMediator()); |
2050 } | 2050 } |
2051 | 2051 |
2052 void Node::dispatchSubtreeModifiedEvent() | 2052 void Node::dispatchSubtreeModifiedEvent() |
2053 { | 2053 { |
2054 if (isInShadowTree()) | 2054 if (isInShadowTree()) |
2055 return; | 2055 return; |
2056 | 2056 |
2057 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 2057 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
2058 | 2058 |
2059 if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER)) | 2059 if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER)) |
2060 return; | 2060 return; |
2061 | 2061 |
2062 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMSubtreeModified
, true)); | 2062 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMSubtreeModified
, true)); |
2063 } | 2063 } |
2064 | 2064 |
2065 bool Node::dispatchDOMActivateEvent(int detail, PassRefPtrWillBeRawPtr<Event> un
derlyingEvent) | 2065 DispatchEventResult Node::dispatchDOMActivateEvent(int detail, PassRefPtrWillBeR
awPtr<Event> underlyingEvent) |
2066 { | 2066 { |
2067 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 2067 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
2068 RefPtrWillBeRawPtr<UIEvent> event = UIEvent::create(EventTypeNames::DOMActiv
ate, true, true, document().domWindow(), detail); | 2068 RefPtrWillBeRawPtr<UIEvent> event = UIEvent::create(EventTypeNames::DOMActiv
ate, true, true, document().domWindow(), detail); |
2069 event->setUnderlyingEvent(underlyingEvent); | 2069 event->setUnderlyingEvent(underlyingEvent); |
2070 dispatchScopedEvent(event); | 2070 dispatchScopedEvent(event); |
2071 return event->defaultHandled(); | 2071 |
| 2072 // TODO(dtapuska): Dispatching scoped events shouldn't check the return |
| 2073 // type because the scoped event could get put off in the delayed queue. |
| 2074 return EventTarget::dispatchEventResult(*event); |
2072 } | 2075 } |
2073 | 2076 |
2074 bool Node::dispatchMouseEvent(const PlatformMouseEvent& nativeEvent, const Atomi
cString& eventType, | 2077 DispatchEventResult Node::dispatchMouseEvent(const PlatformMouseEvent& nativeEve
nt, const AtomicString& eventType, |
2075 int detail, Node* relatedTarget) | 2078 int detail, Node* relatedTarget) |
2076 { | 2079 { |
2077 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, documen
t().domWindow(), nativeEvent, detail, relatedTarget); | 2080 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, documen
t().domWindow(), nativeEvent, detail, relatedTarget); |
2078 return dispatchEvent(event); | 2081 return dispatchEvent(event); |
2079 } | 2082 } |
2080 | 2083 |
2081 void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEve
ntOptions eventOptions, SimulatedClickCreationScope scope) | 2084 void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEve
ntOptions eventOptions, SimulatedClickCreationScope scope) |
2082 { | 2085 { |
2083 EventDispatcher::dispatchSimulatedClick(*this, underlyingEvent, eventOptions
, scope); | 2086 EventDispatcher::dispatchSimulatedClick(*this, underlyingEvent, eventOptions
, scope); |
2084 } | 2087 } |
(...skipping 14 matching lines...) Expand all Loading... |
2099 if (event->target() != this) | 2102 if (event->target() != this) |
2100 return; | 2103 return; |
2101 const AtomicString& eventType = event->type(); | 2104 const AtomicString& eventType = event->type(); |
2102 if (eventType == EventTypeNames::keydown || eventType == EventTypeNames::key
press) { | 2105 if (eventType == EventTypeNames::keydown || eventType == EventTypeNames::key
press) { |
2103 if (event->isKeyboardEvent()) { | 2106 if (event->isKeyboardEvent()) { |
2104 if (LocalFrame* frame = document().frame()) | 2107 if (LocalFrame* frame = document().frame()) |
2105 frame->eventHandler().defaultKeyboardEventHandler(toKeyboardEven
t(event)); | 2108 frame->eventHandler().defaultKeyboardEventHandler(toKeyboardEven
t(event)); |
2106 } | 2109 } |
2107 } else if (eventType == EventTypeNames::click) { | 2110 } else if (eventType == EventTypeNames::click) { |
2108 int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail()
: 0; | 2111 int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail()
: 0; |
2109 if (dispatchDOMActivateEvent(detail, event)) | 2112 if (dispatchDOMActivateEvent(detail, event) != DispatchEventResult::NotC
anceled) |
2110 event->setDefaultHandled(); | 2113 event->setDefaultHandled(); |
2111 } else if (eventType == EventTypeNames::contextmenu) { | 2114 } else if (eventType == EventTypeNames::contextmenu) { |
2112 if (Page* page = document().page()) | 2115 if (Page* page = document().page()) |
2113 page->contextMenuController().handleContextMenuEvent(event); | 2116 page->contextMenuController().handleContextMenuEvent(event); |
2114 } else if (eventType == EventTypeNames::textInput) { | 2117 } else if (eventType == EventTypeNames::textInput) { |
2115 if (event->hasInterface(EventNames::TextEvent)) { | 2118 if (event->hasInterface(EventNames::TextEvent)) { |
2116 if (LocalFrame* frame = document().frame()) | 2119 if (LocalFrame* frame = document().frame()) |
2117 frame->eventHandler().defaultTextInputEventHandler(toTextEvent(e
vent)); | 2120 frame->eventHandler().defaultTextInputEventHandler(toTextEvent(e
vent)); |
2118 } | 2121 } |
2119 #if OS(WIN) | 2122 #if OS(WIN) |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 | 2444 |
2442 void showNodePath(const blink::Node* node) | 2445 void showNodePath(const blink::Node* node) |
2443 { | 2446 { |
2444 if (node) | 2447 if (node) |
2445 node->showNodePathForThis(); | 2448 node->showNodePathForThis(); |
2446 else | 2449 else |
2447 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2450 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2448 } | 2451 } |
2449 | 2452 |
2450 #endif | 2453 #endif |
OLD | NEW |