Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added new embedder API and code review comments update Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 // member. 933 // member.
934 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by 934 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by
935 // Webkit. A keyDown event is typically associated with a keyPress(char) 935 // Webkit. A keyDown event is typically associated with a keyPress(char)
936 // event and a keyUp event. We reset this flag here as this is a new keyDown 936 // event and a keyUp event. We reset this flag here as this is a new keyDown
937 // event. 937 // event.
938 m_suppressNextKeypressEvent = false; 938 m_suppressNextKeypressEvent = false;
939 939
940 // If there is a select popup, it should be the one processing the event, 940 // If there is a select popup, it should be the one processing the event,
941 // not the page. 941 // not the page.
942 if (m_selectPopup) 942 if (m_selectPopup)
943 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event) ); 943 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(mainFr ameImpl()->frameView(), event));
944 if (m_pagePopup) { 944 if (m_pagePopup) {
945 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); 945 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(mainFrameImpl() ->frameView(), event));
946 // We need to ignore the next Char event after this otherwise pressing 946 // We need to ignore the next Char event after this otherwise pressing
947 // enter when selecting an item in the popup will go to the page. 947 // enter when selecting an item in the popup will go to the page.
948 if (WebInputEvent::RawKeyDown == event.type) 948 if (WebInputEvent::RawKeyDown == event.type)
949 m_suppressNextKeypressEvent = true; 949 m_suppressNextKeypressEvent = true;
950 return true; 950 return true;
951 } 951 }
952 952
953 RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame(); 953 RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame();
954 if (focusedFrame && focusedFrame->isRemoteFrame()) { 954 if (focusedFrame && focusedFrame->isRemoteFrame()) {
955 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr ame(focusedFrame.get())); 955 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr ame(focusedFrame.get()));
956 webFrame->client()->forwardInputEvent(&event); 956 webFrame->client()->forwardInputEvent(&event);
957 return true; 957 return true;
958 } 958 }
959 959
960 if (!focusedFrame || !focusedFrame->isLocalFrame()) 960 if (!focusedFrame || !focusedFrame->isLocalFrame())
961 return false; 961 return false;
962 962
963 LocalFrame* frame = toLocalFrame(focusedFrame.get()); 963 LocalFrame* frame = toLocalFrame(focusedFrame.get());
964 964
965 PlatformKeyboardEventBuilder evt(event); 965 PlatformKeyboardEventBuilder evt(mainFrameImpl()->frameView(), event);
966 966
967 if (frame->eventHandler().keyEvent(evt)) { 967 if (frame->eventHandler().keyEvent(evt)) {
968 if (WebInputEvent::RawKeyDown == event.type) { 968 if (WebInputEvent::RawKeyDown == event.type) {
969 // Suppress the next keypress event unless the focused node is a plu g-in node. 969 // Suppress the next keypress event unless the focused node is a plu g-in node.
970 // (Flash needs these keypress events to handle non-US keyboards.) 970 // (Flash needs these keypress events to handle non-US keyboards.)
971 Element* element = focusedElement(); 971 Element* element = focusedElement();
972 if (!element || !element->renderer() || !element->renderer()->isEmbe ddedObject()) 972 if (!element || !element->renderer() || !element->renderer()->isEmbe ddedObject())
973 m_suppressNextKeypressEvent = true; 973 m_suppressNextKeypressEvent = true;
974 } 974 }
975 return true; 975 return true;
(...skipping 26 matching lines...) Expand all
1002 // member. The m_suppressNextKeypressEvent is set if the KeyDown is 1002 // member. The m_suppressNextKeypressEvent is set if the KeyDown is
1003 // handled by Webkit. A keyDown event is typically associated with a 1003 // handled by Webkit. A keyDown event is typically associated with a
1004 // keyPress(char) event and a keyUp event. We reset this flag here as it 1004 // keyPress(char) event and a keyUp event. We reset this flag here as it
1005 // only applies to the current keyPress event. 1005 // only applies to the current keyPress event.
1006 bool suppress = m_suppressNextKeypressEvent; 1006 bool suppress = m_suppressNextKeypressEvent;
1007 m_suppressNextKeypressEvent = false; 1007 m_suppressNextKeypressEvent = false;
1008 1008
1009 // If there is a select popup, it should be the one processing the event, 1009 // If there is a select popup, it should be the one processing the event,
1010 // not the page. 1010 // not the page.
1011 if (m_selectPopup) 1011 if (m_selectPopup)
1012 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event) ); 1012 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(mainFr ameImpl()->frameView(), event));
1013 if (m_pagePopup) 1013 if (m_pagePopup)
1014 return m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); 1014 return m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(mainFram eImpl()->frameView(), event));
1015 1015
1016 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); 1016 LocalFrame* frame = toLocalFrame(focusedCoreFrame());
1017 if (!frame) 1017 if (!frame)
1018 return suppress; 1018 return suppress;
1019 1019
1020 EventHandler& handler = frame->eventHandler(); 1020 EventHandler& handler = frame->eventHandler();
1021 1021
1022 PlatformKeyboardEventBuilder evt(event); 1022 PlatformKeyboardEventBuilder evt(mainFrameImpl()->frameView(), event);
1023 if (!evt.isCharacterKey()) 1023 if (!evt.isCharacterKey())
1024 return true; 1024 return true;
1025 1025
1026 // Accesskeys are triggered by char events and can't be suppressed. 1026 // Accesskeys are triggered by char events and can't be suppressed.
1027 if (handler.handleAccessKey(evt)) 1027 if (handler.handleAccessKey(evt))
1028 return true; 1028 return true;
1029 1029
1030 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to 1030 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to
1031 // the eventHandler::keyEvent. We mimic this behavior on all platforms since 1031 // the eventHandler::keyEvent. We mimic this behavior on all platforms since
1032 // for now we are converting other platform's key events to windows key 1032 // for now we are converting other platform's key events to windows key
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after
4502 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4502 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4503 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4503 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4504 } 4504 }
4505 4505
4506 void WebViewImpl::forceNextWebGLContextCreationToFail() 4506 void WebViewImpl::forceNextWebGLContextCreationToFail()
4507 { 4507 {
4508 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4508 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4509 } 4509 }
4510 4510
4511 } // namespace blink 4511 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698