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

Side by Side Diff: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp

Issue 2874313002: Fix is_browser_shortcut; add a test.
Patch Set: SendKeyPressSync Created 3 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "KeyboardEventManager.h" 5 #include "KeyboardEventManager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/UserGestureIndicator.h" 10 #include "core/dom/UserGestureIndicator.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 Element* elem = 159 Element* elem =
160 frame_->GetDocument()->GetElementByAccessKey(key.DeprecatedLower()); 160 frame_->GetDocument()->GetElementByAccessKey(key.DeprecatedLower());
161 if (!elem) 161 if (!elem)
162 return false; 162 return false;
163 elem->AccessKeyAction(false); 163 elem->AccessKeyAction(false);
164 return true; 164 return true;
165 } 165 }
166 166
167 WebInputEventResult KeyboardEventManager::KeyEvent( 167 WebInputEventResult KeyboardEventManager::KeyEvent(
168 const WebKeyboardEvent& initial_key_event) { 168 const WebKeyboardEvent& initial_key_event) {
169 LOG(ERROR) << "KeyboardEventManager::KeyEvent";
169 frame_->GetChromeClient().ClearToolTip(*frame_); 170 frame_->GetChromeClient().ClearToolTip(*frame_);
170 171
171 if (initial_key_event.windows_key_code == VK_CAPITAL) 172 if (initial_key_event.windows_key_code == VK_CAPITAL)
172 CapsLockStateMayHaveChanged(); 173 CapsLockStateMayHaveChanged();
173 174
174 if (scroll_manager_->MiddleClickAutoscrollInProgress()) { 175 if (scroll_manager_->MiddleClickAutoscrollInProgress()) {
175 DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); 176 DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled());
176 // If a key is pressed while the middleClickAutoscroll is in progress then 177 // If a key is pressed while the middleClickAutoscroll is in progress then
177 // we want to stop. 178 // we want to stop.
178 if (initial_key_event.GetType() == WebInputEvent::kKeyDown || 179 if (initial_key_event.GetType() == WebInputEvent::kKeyDown ||
(...skipping 10 matching lines...) Expand all
189 if (!node) 190 if (!node)
190 return WebInputEventResult::kNotHandled; 191 return WebInputEventResult::kNotHandled;
191 192
192 // To be meaningful enough to indicate user intention, a keyboard event needs 193 // To be meaningful enough to indicate user intention, a keyboard event needs
193 // - not to be a modifier event 194 // - not to be a modifier event
194 // - not to be a browser shortcut 195 // - not to be a browser shortcut
195 // https://crbug.com/709765 196 // https://crbug.com/709765
196 bool is_modifier = 197 bool is_modifier =
197 Platform::Current()->IsDomKeyForModifier(initial_key_event.dom_key); 198 Platform::Current()->IsDomKeyForModifier(initial_key_event.dom_key);
198 bool is_browser_shortcut = initial_key_event.is_browser_shortcut; 199 bool is_browser_shortcut = initial_key_event.is_browser_shortcut;
200 LOG(ERROR) << "initial_key_event.GetType() " << initial_key_event.GetType();
201 LOG(ERROR) << "initial_key_event.is_browser_shortcut "
202 << initial_key_event.is_browser_shortcut;
203 LOG(ERROR) << "initial_key_event.windows_key_code "
204 << initial_key_event.windows_key_code;
205 LOG(ERROR) << "initial_key_event.dom_code " << initial_key_event.dom_code;
206 LOG(ERROR) << "initial_key_event.dom_key " << initial_key_event.dom_key;
207 LOG(ERROR) << "initial_key_event.text[0] " << initial_key_event.text[0] << " "
208 << (initial_key_event.text[0] ? ((char)initial_key_event.text[0])
209 : ' ');
210 LOG(ERROR) << "is_modifier " << is_modifier;
199 211
200 std::unique_ptr<UserGestureIndicator> gesture_indicator; 212 std::unique_ptr<UserGestureIndicator> gesture_indicator;
201 if (!is_modifier && !is_browser_shortcut) { 213 if (!is_modifier && !is_browser_shortcut) {
202 gesture_indicator.reset(new UserGestureIndicator( 214 gesture_indicator.reset(new UserGestureIndicator(
203 UserGestureToken::Create(frame_->GetDocument()))); 215 UserGestureToken::Create(frame_->GetDocument())));
204 } 216 }
205 217
206 // In IE, access keys are special, they are handled after default keydown 218 // In IE, access keys are special, they are handled after default keydown
207 // processing, but cannot be canceled - this is hard to match. On Mac OS X, 219 // processing, but cannot be canceled - this is hard to match. On Mac OS X,
208 // we process them before dispatching keydown, as the default keydown handler 220 // we process them before dispatching keydown, as the default keydown handler
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 if (current_modifiers & ::cmdKey) 476 if (current_modifiers & ::cmdKey)
465 modifiers |= WebInputEvent::kMetaKey; 477 modifiers |= WebInputEvent::kMetaKey;
466 #else 478 #else
467 // TODO(crbug.com/538289): Implement on other platforms. 479 // TODO(crbug.com/538289): Implement on other platforms.
468 return static_cast<WebInputEvent::Modifiers>(0); 480 return static_cast<WebInputEvent::Modifiers>(0);
469 #endif 481 #endif
470 return static_cast<WebInputEvent::Modifiers>(modifiers); 482 return static_cast<WebInputEvent::Modifiers>(modifiers);
471 } 483 }
472 484
473 } // namespace blink 485 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698