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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp

Issue 2511923002: <select>: ignore modified keydown events in some cases (Closed)
Patch Set: tests Created 4 years, 1 month 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/LayoutTests/fast/forms/select/ignore-keydown-with-modifiers.html ('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 /* 1 /*
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 1999 Antti Koivisto (koivisto@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 if (!m_activeSelectionState) 1280 if (!m_activeSelectionState)
1281 return; 1281 return;
1282 } 1282 }
1283 1283
1284 // The key handling below shouldn't be used for non spatial navigation 1284 // The key handling below shouldn't be used for non spatial navigation
1285 // mode Mac 1285 // mode Mac
1286 if (LayoutTheme::theme().popsMenuByArrowKeys() && 1286 if (LayoutTheme::theme().popsMenuByArrowKeys() &&
1287 !isSpatialNavigationEnabled(document().frame())) 1287 !isSpatialNavigationEnabled(document().frame()))
1288 return; 1288 return;
1289 1289
1290 int ignoreModifiers = PlatformEvent::ShiftKey | PlatformEvent::CtrlKey |
1291 PlatformEvent::AltKey | PlatformMouseEvent::MetaKey;
1292 if (keyEvent->modifiers() & ignoreModifiers)
1293 return;
1294
1290 const String& key = keyEvent->key(); 1295 const String& key = keyEvent->key();
1291 bool handled = true; 1296 bool handled = true;
1292 const ListItems& listItems = this->listItems(); 1297 const ListItems& listItems = this->listItems();
1293 HTMLOptionElement* option = selectedOption(); 1298 HTMLOptionElement* option = selectedOption();
1294 int listIndex = option ? option->listIndex() : -1; 1299 int listIndex = option ? option->listIndex() : -1;
1295 1300
1296 if (key == "ArrowDown" || key == "ArrowRight") 1301 if (key == "ArrowDown" || key == "ArrowRight")
1297 option = nextValidOption(listIndex, SkipForwards, 1); 1302 option = nextValidOption(listIndex, SkipForwards, 1);
1298 else if (key == "ArrowUp" || key == "ArrowLeft") 1303 else if (key == "ArrowUp" || key == "ArrowLeft")
1299 option = nextValidOption(listIndex, SkipBackwards, 1); 1304 option = nextValidOption(listIndex, SkipBackwards, 1);
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 m_popupUpdater = nullptr; 2036 m_popupUpdater = nullptr;
2032 } 2037 }
2033 2038
2034 void HTMLSelectElement::didMutateSubtree() { 2039 void HTMLSelectElement::didMutateSubtree() {
2035 DCHECK(popupIsVisible()); 2040 DCHECK(popupIsVisible());
2036 DCHECK(m_popup); 2041 DCHECK(m_popup);
2037 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2042 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2038 } 2043 }
2039 2044
2040 } // namespace blink 2045 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/ignore-keydown-with-modifiers.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698