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 18 matching lines...) Expand all Loading... |
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/InputTypeNames.h" | 33 #include "core/InputTypeNames.h" |
34 #include "core/SVGNames.h" | 34 #include "core/SVGNames.h" |
35 #include "core/clipboard/DataObject.h" | 35 #include "core/clipboard/DataObject.h" |
36 #include "core/clipboard/DataTransfer.h" | 36 #include "core/clipboard/DataTransfer.h" |
37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
38 #include "core/dom/DocumentMarkerController.h" | 38 #include "core/dom/DocumentMarkerController.h" |
39 #include "core/dom/Fullscreen.h" | |
40 #include "core/dom/NodeRenderingTraversal.h" | 39 #include "core/dom/NodeRenderingTraversal.h" |
41 #include "core/dom/TouchList.h" | 40 #include "core/dom/TouchList.h" |
42 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
43 #include "core/editing/Editor.h" | 42 #include "core/editing/Editor.h" |
44 #include "core/editing/FrameSelection.h" | 43 #include "core/editing/FrameSelection.h" |
45 #include "core/editing/TextIterator.h" | 44 #include "core/editing/TextIterator.h" |
46 #include "core/editing/htmlediting.h" | 45 #include "core/editing/htmlediting.h" |
47 #include "core/events/DOMWindowEventQueue.h" | 46 #include "core/events/DOMWindowEventQueue.h" |
48 #include "core/events/EventPath.h" | 47 #include "core/events/EventPath.h" |
49 #include "core/events/KeyboardEvent.h" | 48 #include "core/events/KeyboardEvent.h" |
(...skipping 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) | 2967 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) |
2969 return false; | 2968 return false; |
2970 String key = evt.unmodifiedText(); | 2969 String key = evt.unmodifiedText(); |
2971 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); | 2970 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); |
2972 if (!elem) | 2971 if (!elem) |
2973 return false; | 2972 return false; |
2974 elem->accessKeyAction(false); | 2973 elem->accessKeyAction(false); |
2975 return true; | 2974 return true; |
2976 } | 2975 } |
2977 | 2976 |
2978 bool EventHandler::isKeyEventAllowedInFullScreen(Fullscreen* fullscreen, const P
latformKeyboardEvent& keyEvent) const | |
2979 { | |
2980 if (fullscreen->webkitFullScreenKeyboardInputAllowed()) | |
2981 return true; | |
2982 | |
2983 if (keyEvent.type() == PlatformKeyboardEvent::Char) { | |
2984 if (keyEvent.text().length() != 1) | |
2985 return false; | |
2986 UChar character = keyEvent.text()[0]; | |
2987 return character == ' '; | |
2988 } | |
2989 | |
2990 int keyCode = keyEvent.windowsVirtualKeyCode(); | |
2991 return (keyCode >= VK_BACK && keyCode <= VK_CAPITAL) | |
2992 || (keyCode >= VK_SPACE && keyCode <= VK_DELETE) | |
2993 || (keyCode >= VK_OEM_1 && keyCode <= VK_OEM_PLUS) | |
2994 || (keyCode >= VK_MULTIPLY && keyCode <= VK_OEM_8); | |
2995 } | |
2996 | |
2997 bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) | 2977 bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) |
2998 { | 2978 { |
2999 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2979 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); |
3000 | 2980 |
3001 ASSERT(m_frame->document()); | |
3002 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(*m_frame->document()))
{ | |
3003 if (fullscreen->webkitCurrentFullScreenElement() && !isKeyEventAllowedIn
FullScreen(fullscreen, initialKeyEvent)) { | |
3004 UseCounter::count(*m_frame->document(), UseCounter::KeyEventNotAllow
edInFullScreen); | |
3005 return false; | |
3006 } | |
3007 } | |
3008 | |
3009 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) | 2981 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) |
3010 capsLockStateMayHaveChanged(); | 2982 capsLockStateMayHaveChanged(); |
3011 | 2983 |
3012 #if OS(WIN) | 2984 #if OS(WIN) |
3013 if (panScrollInProgress()) { | 2985 if (panScrollInProgress()) { |
3014 // If a key is pressed while the panScroll is in progress then we want t
o stop | 2986 // If a key is pressed while the panScroll is in progress then we want t
o stop |
3015 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.
type() == PlatformEvent::RawKeyDown) | 2987 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.
type() == PlatformEvent::RawKeyDown) |
3016 stopAutoscroll(); | 2988 stopAutoscroll(); |
3017 | 2989 |
3018 // If we were in panscroll mode, we swallow the key event | 2990 // If we were in panscroll mode, we swallow the key event |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3881 unsigned EventHandler::accessKeyModifiers() | 3853 unsigned EventHandler::accessKeyModifiers() |
3882 { | 3854 { |
3883 #if OS(MACOSX) | 3855 #if OS(MACOSX) |
3884 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3856 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3885 #else | 3857 #else |
3886 return PlatformEvent::AltKey; | 3858 return PlatformEvent::AltKey; |
3887 #endif | 3859 #endif |
3888 } | 3860 } |
3889 | 3861 |
3890 } // namespace blink | 3862 } // namespace blink |
OLD | NEW |