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 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 | 1973 |
1974 fireEventListeners(&event); | 1974 fireEventListeners(&event); |
1975 } | 1975 } |
1976 | 1976 |
1977 void Node::dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event> event) | 1977 void Node::dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event> event) |
1978 { | 1978 { |
1979 event->setTrusted(true); | 1979 event->setTrusted(true); |
1980 EventDispatcher::dispatchScopedEvent(*this, event->createMediator()); | 1980 EventDispatcher::dispatchScopedEvent(*this, event->createMediator()); |
1981 } | 1981 } |
1982 | 1982 |
1983 bool Node::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) | 1983 WebInputEventResult Node::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> ev
ent) |
1984 { | 1984 { |
1985 return EventDispatcher::dispatchEvent(*this, event->createMediator()); | 1985 return EventDispatcher::dispatchEvent(*this, event->createMediator()); |
1986 } | 1986 } |
1987 | 1987 |
1988 void Node::dispatchSubtreeModifiedEvent() | 1988 void Node::dispatchSubtreeModifiedEvent() |
1989 { | 1989 { |
1990 if (isInShadowTree()) | 1990 if (isInShadowTree()) |
1991 return; | 1991 return; |
1992 | 1992 |
1993 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 1993 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
1994 | 1994 |
1995 if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER)) | 1995 if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER)) |
1996 return; | 1996 return; |
1997 | 1997 |
1998 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMSubtreeModified
, true)); | 1998 dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMSubtreeModified
, true)); |
1999 } | 1999 } |
2000 | 2000 |
2001 bool Node::dispatchDOMActivateEvent(int detail, PassRefPtrWillBeRawPtr<Event> un
derlyingEvent) | 2001 WebInputEventResult Node::dispatchDOMActivateEvent(int detail, PassRefPtrWillBeR
awPtr<Event> underlyingEvent) |
2002 { | 2002 { |
2003 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 2003 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
2004 RefPtrWillBeRawPtr<UIEvent> event = UIEvent::create(EventTypeNames::DOMActiv
ate, true, true, document().domWindow(), detail); | 2004 RefPtrWillBeRawPtr<UIEvent> event = UIEvent::create(EventTypeNames::DOMActiv
ate, true, true, document().domWindow(), detail); |
2005 event->setUnderlyingEvent(underlyingEvent); | 2005 event->setUnderlyingEvent(underlyingEvent); |
2006 dispatchScopedEvent(event); | 2006 dispatchScopedEvent(event); |
2007 return event->defaultHandled(); | 2007 |
| 2008 // TODO(dtapuska): Dispatching scoped events shouldn't check the return |
| 2009 // type because the scoped event could get put off in the delayed queue. |
| 2010 return event->eventResult(); |
2008 } | 2011 } |
2009 | 2012 |
2010 bool Node::dispatchMouseEvent(const PlatformMouseEvent& nativeEvent, const Atomi
cString& eventType, | 2013 WebInputEventResult Node::dispatchMouseEvent(const PlatformMouseEvent& nativeEve
nt, const AtomicString& eventType, |
2011 int detail, Node* relatedTarget) | 2014 int detail, Node* relatedTarget) |
2012 { | 2015 { |
2013 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, documen
t().domWindow(), nativeEvent, detail, relatedTarget); | 2016 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, documen
t().domWindow(), nativeEvent, detail, relatedTarget); |
2014 return dispatchEvent(event); | 2017 return dispatchEvent(event); |
2015 } | 2018 } |
2016 | 2019 |
2017 void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEve
ntOptions eventOptions, SimulatedClickCreationScope scope) | 2020 void Node::dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEve
ntOptions eventOptions, SimulatedClickCreationScope scope) |
2018 { | 2021 { |
2019 EventDispatcher::dispatchSimulatedClick(*this, underlyingEvent, eventOptions
, scope); | 2022 EventDispatcher::dispatchSimulatedClick(*this, underlyingEvent, eventOptions
, scope); |
2020 } | 2023 } |
2021 | 2024 |
2022 void Node::dispatchInputEvent() | 2025 void Node::dispatchInputEvent() |
2023 { | 2026 { |
2024 dispatchScopedEvent(Event::createBubble(EventTypeNames::input)); | 2027 dispatchScopedEvent(Event::createBubble(EventTypeNames::input)); |
2025 } | 2028 } |
2026 | 2029 |
2027 void Node::defaultEventHandler(Event* event) | 2030 void Node::defaultEventHandler(Event* event) |
2028 { | 2031 { |
2029 if (event->target() != this) | 2032 if (event->target() != this) |
2030 return; | 2033 return; |
2031 const AtomicString& eventType = event->type(); | 2034 const AtomicString& eventType = event->type(); |
2032 if (eventType == EventTypeNames::keydown || eventType == EventTypeNames::key
press) { | 2035 if (eventType == EventTypeNames::keydown || eventType == EventTypeNames::key
press) { |
2033 if (event->isKeyboardEvent()) { | 2036 if (event->isKeyboardEvent()) { |
2034 if (LocalFrame* frame = document().frame()) | 2037 if (LocalFrame* frame = document().frame()) |
2035 frame->eventHandler().defaultKeyboardEventHandler(toKeyboardEven
t(event)); | 2038 frame->eventHandler().defaultKeyboardEventHandler(toKeyboardEven
t(event)); |
2036 } | 2039 } |
2037 } else if (eventType == EventTypeNames::click) { | 2040 } else if (eventType == EventTypeNames::click) { |
2038 int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail()
: 0; | 2041 int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail()
: 0; |
2039 if (dispatchDOMActivateEvent(detail, event)) | 2042 if (dispatchDOMActivateEvent(detail, event) != WebInputEventResult::NotH
andled) |
2040 event->setDefaultHandled(); | 2043 event->setDefaultHandled(); |
2041 } else if (eventType == EventTypeNames::contextmenu) { | 2044 } else if (eventType == EventTypeNames::contextmenu) { |
2042 if (Page* page = document().page()) | 2045 if (Page* page = document().page()) |
2043 page->contextMenuController().handleContextMenuEvent(event); | 2046 page->contextMenuController().handleContextMenuEvent(event); |
2044 } else if (eventType == EventTypeNames::textInput) { | 2047 } else if (eventType == EventTypeNames::textInput) { |
2045 if (event->hasInterface(EventNames::TextEvent)) { | 2048 if (event->hasInterface(EventNames::TextEvent)) { |
2046 if (LocalFrame* frame = document().frame()) | 2049 if (LocalFrame* frame = document().frame()) |
2047 frame->eventHandler().defaultTextInputEventHandler(toTextEvent(e
vent)); | 2050 frame->eventHandler().defaultTextInputEventHandler(toTextEvent(e
vent)); |
2048 } | 2051 } |
2049 #if OS(WIN) | 2052 #if OS(WIN) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 | 2354 |
2352 void showNodePath(const blink::Node* node) | 2355 void showNodePath(const blink::Node* node) |
2353 { | 2356 { |
2354 if (node) | 2357 if (node) |
2355 node->showNodePathForThis(); | 2358 node->showNodePathForThis(); |
2356 else | 2359 else |
2357 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2360 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2358 } | 2361 } |
2359 | 2362 |
2360 #endif | 2363 #endif |
OLD | NEW |