OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(toLocalFrameTemporary(f
ocusedFrame.get())); | 908 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(toLocalFrameTemporary(f
ocusedFrame.get())); |
909 webFrame->client()->forwardInputEvent(&event); | 909 webFrame->client()->forwardInputEvent(&event); |
910 return true; | 910 return true; |
911 } | 911 } |
912 | 912 |
913 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 913 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
914 return false; | 914 return false; |
915 | 915 |
916 RefPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); | 916 RefPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); |
917 | 917 |
| 918 PlatformKeyboardEventBuilder evt(event); |
| 919 |
| 920 if (frame->eventHandler().keyEvent(evt)) { |
| 921 if (WebInputEvent::RawKeyDown == event.type) { |
| 922 // Suppress the next keypress event unless the focused node is a plu
g-in node. |
| 923 // (Flash needs these keypress events to handle non-US keyboards.) |
| 924 Element* element = focusedElement(); |
| 925 if (!element || !element->renderer() || !element->renderer()->isEmbe
ddedObject()) |
| 926 m_suppressNextKeypressEvent = true; |
| 927 } |
| 928 return true; |
| 929 } |
| 930 |
918 #if !OS(MACOSX) | 931 #if !OS(MACOSX) |
919 const WebInputEvent::Type contextMenuTriggeringEventType = | 932 const WebInputEvent::Type contextMenuTriggeringEventType = |
920 #if OS(WIN) | 933 #if OS(WIN) |
921 WebInputEvent::KeyUp; | 934 WebInputEvent::KeyUp; |
922 #else | 935 #else |
923 WebInputEvent::RawKeyDown; | 936 WebInputEvent::RawKeyDown; |
924 #endif | 937 #endif |
925 | 938 |
926 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers
) && event.windowsKeyCode == VKEY_APPS; | 939 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers
) && event.windowsKeyCode == VKEY_APPS; |
927 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window
sKeyCode == VKEY_F10; | 940 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window
sKeyCode == VKEY_F10; |
928 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri
ngEventType) { | 941 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri
ngEventType) { |
929 sendContextMenuEvent(event); | 942 sendContextMenuEvent(event); |
930 return true; | 943 return true; |
931 } | 944 } |
932 #endif // !OS(MACOSX) | 945 #endif // !OS(MACOSX) |
933 | 946 |
934 PlatformKeyboardEventBuilder evt(event); | |
935 | |
936 if (frame->eventHandler().keyEvent(evt)) { | |
937 if (WebInputEvent::RawKeyDown == event.type) { | |
938 // Suppress the next keypress event unless the focused node is a plu
g-in node. | |
939 // (Flash needs these keypress events to handle non-US keyboards.) | |
940 Element* element = focusedElement(); | |
941 if (!element || !element->renderer() || !element->renderer()->isEmbe
ddedObject()) | |
942 m_suppressNextKeypressEvent = true; | |
943 } | |
944 return true; | |
945 } | |
946 | |
947 return keyEventDefault(event); | 947 return keyEventDefault(event); |
948 } | 948 } |
949 | 949 |
950 bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event) | 950 bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event) |
951 { | 951 { |
952 ASSERT(event.type == WebInputEvent::Char); | 952 ASSERT(event.type == WebInputEvent::Char); |
953 | 953 |
954 // Please refer to the comments explaining the m_suppressNextKeypressEvent | 954 // Please refer to the comments explaining the m_suppressNextKeypressEvent |
955 // member. The m_suppressNextKeypressEvent is set if the KeyDown is | 955 // member. The m_suppressNextKeypressEvent is set if the KeyDown is |
956 // handled by Webkit. A keyDown event is typically associated with a | 956 // handled by Webkit. A keyDown event is typically associated with a |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3999 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 3999 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4000 | 4000 |
4001 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4001 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4002 return false; | 4002 return false; |
4003 | 4003 |
4004 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4004 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4005 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4005 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4006 } | 4006 } |
4007 | 4007 |
4008 } // namespace blink | 4008 } // namespace blink |
OLD | NEW |