OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 | 1727 |
1728 | 1728 |
1729 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa
rget, const PlatformMouseEvent& event, Clipboard* clipboard) | 1729 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa
rget, const PlatformMouseEvent& event, Clipboard* clipboard) |
1730 { | 1730 { |
1731 FrameView* view = m_frame->view(); | 1731 FrameView* view = m_frame->view(); |
1732 | 1732 |
1733 // FIXME: We might want to dispatch a dragleave even if the view is gone. | 1733 // FIXME: We might want to dispatch a dragleave even if the view is gone. |
1734 if (!view) | 1734 if (!view) |
1735 return false; | 1735 return false; |
1736 | 1736 |
1737 view->resetDeferredRepaintDelay(); | |
1738 RefPtr<MouseEvent> me = MouseEvent::create(eventType, | 1737 RefPtr<MouseEvent> me = MouseEvent::create(eventType, |
1739 true, true, m_frame->document()->domWindow(), | 1738 true, true, m_frame->document()->domWindow(), |
1740 0, event.globalPosition().x(), event.globalPosition().y(), event.positio
n().x(), event.position().y(), | 1739 0, event.globalPosition().x(), event.globalPosition().y(), event.positio
n().x(), event.position().y(), |
1741 event.movementDelta().x(), event.movementDelta().y(), | 1740 event.movementDelta().x(), event.movementDelta().y(), |
1742 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), | 1741 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), |
1743 0, 0, clipboard); | 1742 0, 0, clipboard); |
1744 | 1743 |
1745 dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION); | 1744 dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION); |
1746 return me->defaultPrevented(); | 1745 return me->defaultPrevented(); |
1747 } | 1746 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 if (m_nodeUnderMouse) | 2020 if (m_nodeUnderMouse) |
2022 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames:
:mouseover, 0, m_lastNodeUnderMouse.get()); | 2021 m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames:
:mouseover, 0, m_lastNodeUnderMouse.get()); |
2023 } | 2022 } |
2024 m_lastNodeUnderMouse = m_nodeUnderMouse; | 2023 m_lastNodeUnderMouse = m_nodeUnderMouse; |
2025 m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nod
eUnderMouse.get()); | 2024 m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nod
eUnderMouse.get()); |
2026 } | 2025 } |
2027 } | 2026 } |
2028 | 2027 |
2029 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
tNode, bool /*cancelable*/, int clickCount, const PlatformMouseEvent& mouseEvent
, bool setUnder) | 2028 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
tNode, bool /*cancelable*/, int clickCount, const PlatformMouseEvent& mouseEvent
, bool setUnder) |
2030 { | 2029 { |
2031 if (FrameView* view = m_frame->view()) | |
2032 view->resetDeferredRepaintDelay(); | |
2033 | |
2034 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); | 2030 updateMouseEventTargetNode(targetNode, mouseEvent, setUnder); |
2035 | 2031 |
2036 bool swallowEvent = false; | 2032 bool swallowEvent = false; |
2037 | 2033 |
2038 if (m_nodeUnderMouse) | 2034 if (m_nodeUnderMouse) |
2039 swallowEvent = !(m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventT
ype, clickCount)); | 2035 swallowEvent = !(m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventT
ype, clickCount)); |
2040 | 2036 |
2041 if (swallowEvent || eventType != EventTypeNames::mousedown) | 2037 if (swallowEvent || eventType != EventTypeNames::mousedown) |
2042 return !swallowEvent; | 2038 return !swallowEvent; |
2043 | 2039 |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3089 #endif | 3085 #endif |
3090 | 3086 |
3091 // Check for cases where we are too early for events -- possible unmatched k
ey up | 3087 // Check for cases where we are too early for events -- possible unmatched k
ey up |
3092 // from pressing return in the location bar. | 3088 // from pressing return in the location bar. |
3093 RefPtr<Node> node = eventTargetNodeForDocument(m_frame->document()); | 3089 RefPtr<Node> node = eventTargetNodeForDocument(m_frame->document()); |
3094 if (!node) | 3090 if (!node) |
3095 return false; | 3091 return false; |
3096 | 3092 |
3097 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 3093 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
3098 | 3094 |
3099 if (FrameView* view = m_frame->view()) | |
3100 view->resetDeferredRepaintDelay(); | |
3101 | |
3102 // In IE, access keys are special, they are handled after default keydown pr
ocessing, but cannot be canceled - this is hard to match. | 3095 // In IE, access keys are special, they are handled after default keydown pr
ocessing, but cannot be canceled - this is hard to match. |
3103 // On Mac OS X, we process them before dispatching keydown, as the default k
eydown handler implements Emacs key bindings, which may conflict | 3096 // On Mac OS X, we process them before dispatching keydown, as the default k
eydown handler implements Emacs key bindings, which may conflict |
3104 // with access keys. Then we dispatch keydown, but suppress its default hand
ling. | 3097 // with access keys. Then we dispatch keydown, but suppress its default hand
ling. |
3105 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch
ing a keypress event for WM_SYSCHAR messages. | 3098 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch
ing a keypress event for WM_SYSCHAR messages. |
3106 // Other platforms currently match either Mac or Windows behavior, depending
on whether they send combined KeyDown events. | 3099 // Other platforms currently match either Mac or Windows behavior, depending
on whether they send combined KeyDown events. |
3107 bool matchedAnAccessKey = false; | 3100 bool matchedAnAccessKey = false; |
3108 if (initialKeyEvent.type() == PlatformEvent::KeyDown) | 3101 if (initialKeyEvent.type() == PlatformEvent::KeyDown) |
3109 matchedAnAccessKey = handleAccessKey(initialKeyEvent); | 3102 matchedAnAccessKey = handleAccessKey(initialKeyEvent); |
3110 | 3103 |
3111 // FIXME: it would be fair to let an input method handle KeyUp events before
DOM dispatch. | 3104 // FIXME: it would be fair to let an input method handle KeyUp events before
DOM dispatch. |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 return false; | 3382 return false; |
3390 | 3383 |
3391 EventTarget* target; | 3384 EventTarget* target; |
3392 if (underlyingEvent) | 3385 if (underlyingEvent) |
3393 target = underlyingEvent->target(); | 3386 target = underlyingEvent->target(); |
3394 else | 3387 else |
3395 target = eventTargetNodeForDocument(m_frame->document()); | 3388 target = eventTargetNodeForDocument(m_frame->document()); |
3396 if (!target) | 3389 if (!target) |
3397 return false; | 3390 return false; |
3398 | 3391 |
3399 if (FrameView* view = m_frame->view()) | |
3400 view->resetDeferredRepaintDelay(); | |
3401 | |
3402 RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inpu
tType); | 3392 RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inpu
tType); |
3403 event->setUnderlyingEvent(underlyingEvent); | 3393 event->setUnderlyingEvent(underlyingEvent); |
3404 | 3394 |
3405 target->dispatchEvent(event, IGNORE_EXCEPTION); | 3395 target->dispatchEvent(event, IGNORE_EXCEPTION); |
3406 return event->defaultHandled(); | 3396 return event->defaultHandled(); |
3407 } | 3397 } |
3408 | 3398 |
3409 void EventHandler::defaultTextInputEventHandler(TextEvent* event) | 3399 void EventHandler::defaultTextInputEventHandler(TextEvent* event) |
3410 { | 3400 { |
3411 if (m_frame->editor().handleTextEvent(event)) | 3401 if (m_frame->editor().handleTextEvent(event)) |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4024 unsigned EventHandler::accessKeyModifiers() | 4014 unsigned EventHandler::accessKeyModifiers() |
4025 { | 4015 { |
4026 #if OS(MACOSX) | 4016 #if OS(MACOSX) |
4027 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4017 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4028 #else | 4018 #else |
4029 return PlatformEvent::AltKey; | 4019 return PlatformEvent::AltKey; |
4030 #endif | 4020 #endif |
4031 } | 4021 } |
4032 | 4022 |
4033 } // namespace WebCore | 4023 } // namespace WebCore |
OLD | NEW |