| 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 17 matching lines...) Expand all Loading... |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "core/page/EventHandler.h" | 29 #include "core/page/EventHandler.h" |
| 30 | 30 |
| 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 32 #include "core/HTMLNames.h" | 32 #include "core/HTMLNames.h" |
| 33 #include "core/SVGNames.h" | 33 #include "core/SVGNames.h" |
| 34 #include "core/clipboard/DataObject.h" | 34 #include "core/clipboard/DataObject.h" |
| 35 #include "core/clipboard/DataTransfer.h" | 35 #include "core/clipboard/DataTransfer.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/DocumentMarkerController.h" | 37 #include "core/dom/DocumentMarkerController.h" |
| 38 #include "core/dom/FullscreenElementStack.h" | 38 #include "core/dom/Fullscreen.h" |
| 39 #include "core/dom/NodeRenderingTraversal.h" | 39 #include "core/dom/NodeRenderingTraversal.h" |
| 40 #include "core/dom/TouchList.h" | 40 #include "core/dom/TouchList.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
| 42 #include "core/editing/Editor.h" | 42 #include "core/editing/Editor.h" |
| 43 #include "core/editing/FrameSelection.h" | 43 #include "core/editing/FrameSelection.h" |
| 44 #include "core/editing/TextIterator.h" | 44 #include "core/editing/TextIterator.h" |
| 45 #include "core/editing/htmlediting.h" | 45 #include "core/editing/htmlediting.h" |
| 46 #include "core/events/DOMWindowEventQueue.h" | 46 #include "core/events/DOMWindowEventQueue.h" |
| 47 #include "core/events/EventPath.h" | 47 #include "core/events/EventPath.h" |
| 48 #include "core/events/KeyboardEvent.h" | 48 #include "core/events/KeyboardEvent.h" |
| (...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2937 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) | 2937 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) |
| 2938 return false; | 2938 return false; |
| 2939 String key = evt.unmodifiedText(); | 2939 String key = evt.unmodifiedText(); |
| 2940 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); | 2940 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); |
| 2941 if (!elem) | 2941 if (!elem) |
| 2942 return false; | 2942 return false; |
| 2943 elem->accessKeyAction(false); | 2943 elem->accessKeyAction(false); |
| 2944 return true; | 2944 return true; |
| 2945 } | 2945 } |
| 2946 | 2946 |
| 2947 bool EventHandler::isKeyEventAllowedInFullScreen(FullscreenElementStack* fullscr
een, const PlatformKeyboardEvent& keyEvent) const | 2947 bool EventHandler::isKeyEventAllowedInFullScreen(Fullscreen* fullscreen, const P
latformKeyboardEvent& keyEvent) const |
| 2948 { | 2948 { |
| 2949 if (fullscreen->webkitFullScreenKeyboardInputAllowed()) | 2949 if (fullscreen->webkitFullScreenKeyboardInputAllowed()) |
| 2950 return true; | 2950 return true; |
| 2951 | 2951 |
| 2952 if (keyEvent.type() == PlatformKeyboardEvent::Char) { | 2952 if (keyEvent.type() == PlatformKeyboardEvent::Char) { |
| 2953 if (keyEvent.text().length() != 1) | 2953 if (keyEvent.text().length() != 1) |
| 2954 return false; | 2954 return false; |
| 2955 UChar character = keyEvent.text()[0]; | 2955 UChar character = keyEvent.text()[0]; |
| 2956 return character == ' '; | 2956 return character == ' '; |
| 2957 } | 2957 } |
| 2958 | 2958 |
| 2959 int keyCode = keyEvent.windowsVirtualKeyCode(); | 2959 int keyCode = keyEvent.windowsVirtualKeyCode(); |
| 2960 return (keyCode >= VK_BACK && keyCode <= VK_CAPITAL) | 2960 return (keyCode >= VK_BACK && keyCode <= VK_CAPITAL) |
| 2961 || (keyCode >= VK_SPACE && keyCode <= VK_DELETE) | 2961 || (keyCode >= VK_SPACE && keyCode <= VK_DELETE) |
| 2962 || (keyCode >= VK_OEM_1 && keyCode <= VK_OEM_PLUS) | 2962 || (keyCode >= VK_OEM_1 && keyCode <= VK_OEM_PLUS) |
| 2963 || (keyCode >= VK_MULTIPLY && keyCode <= VK_OEM_8); | 2963 || (keyCode >= VK_MULTIPLY && keyCode <= VK_OEM_8); |
| 2964 } | 2964 } |
| 2965 | 2965 |
| 2966 bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) | 2966 bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) |
| 2967 { | 2967 { |
| 2968 RefPtr<FrameView> protector(m_frame->view()); | 2968 RefPtr<FrameView> protector(m_frame->view()); |
| 2969 | 2969 |
| 2970 ASSERT(m_frame->document()); | 2970 ASSERT(m_frame->document()); |
| 2971 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(*m_frame->document())) { | 2971 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(*m_frame->document()))
{ |
| 2972 if (fullscreen->webkitIsFullScreen() && !isKeyEventAllowedInFullScreen(f
ullscreen, initialKeyEvent)) { | 2972 if (fullscreen->webkitIsFullScreen() && !isKeyEventAllowedInFullScreen(f
ullscreen, initialKeyEvent)) { |
| 2973 UseCounter::count(*m_frame->document(), UseCounter::KeyEventNotAllow
edInFullScreen); | 2973 UseCounter::count(*m_frame->document(), UseCounter::KeyEventNotAllow
edInFullScreen); |
| 2974 return false; | 2974 return false; |
| 2975 } | 2975 } |
| 2976 } | 2976 } |
| 2977 | 2977 |
| 2978 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) | 2978 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) |
| 2979 capsLockStateMayHaveChanged(); | 2979 capsLockStateMayHaveChanged(); |
| 2980 | 2980 |
| 2981 #if OS(WIN) | 2981 #if OS(WIN) |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3850 unsigned EventHandler::accessKeyModifiers() | 3850 unsigned EventHandler::accessKeyModifiers() |
| 3851 { | 3851 { |
| 3852 #if OS(MACOSX) | 3852 #if OS(MACOSX) |
| 3853 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3853 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3854 #else | 3854 #else |
| 3855 return PlatformEvent::AltKey; | 3855 return PlatformEvent::AltKey; |
| 3856 #endif | 3856 #endif |
| 3857 } | 3857 } |
| 3858 | 3858 |
| 3859 } // namespace blink | 3859 } // namespace blink |
| OLD | NEW |