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

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

Issue 1058243002: Implement support to consider <space> key as part of typeAhead searching. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch with new implementation Created 5 years, 8 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) 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 reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * 10 *
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 return ((layoutTheme.popsMenuByArrowKeys() && (keyIdentifier == "Down" || k eyIdentifier == "Up")) 1218 return ((layoutTheme.popsMenuByArrowKeys() && (keyIdentifier == "Down" || k eyIdentifier == "Up"))
1219 || (layoutTheme.popsMenuByAltDownUpOrF4Key() && (keyIdentifier == "Down" || keyIdentifier == "Up") && keyEvent->altKey()) 1219 || (layoutTheme.popsMenuByAltDownUpOrF4Key() && (keyIdentifier == "Down" || keyIdentifier == "Up") && keyEvent->altKey())
1220 || (layoutTheme.popsMenuByAltDownUpOrF4Key() && (!keyEvent->altKey() && !keyEvent->ctrlKey() && keyIdentifier == "F4"))); 1220 || (layoutTheme.popsMenuByAltDownUpOrF4Key() && (!keyEvent->altKey() && !keyEvent->ctrlKey() && keyIdentifier == "F4")));
1221 } 1221 }
1222 1222
1223 bool HTMLSelectElement::shouldOpenPopupForKeyPressEvent(KeyboardEvent *event) 1223 bool HTMLSelectElement::shouldOpenPopupForKeyPressEvent(KeyboardEvent *event)
1224 { 1224 {
1225 LayoutTheme& layoutTheme = LayoutTheme::theme(); 1225 LayoutTheme& layoutTheme = LayoutTheme::theme();
1226 int keyCode = event->keyCode(); 1226 int keyCode = event->keyCode();
1227 1227
1228 return ((layoutTheme.popsMenuBySpaceKey() && event->keyCode() == ' ') 1228 return ((layoutTheme.popsMenuBySpaceKey() && event->keyCode() == ' ' && !m_t ypeAhead.hasActiveSession(event))
1229 || (layoutTheme.popsMenuByReturnKey() && keyCode == '\r')); 1229 || (layoutTheme.popsMenuByReturnKey() && keyCode == '\r'));
1230 } 1230 }
1231 1231
1232 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) 1232 void HTMLSelectElement::menuListDefaultEventHandler(Event* event)
1233 { 1233 {
1234 if (event->type() == EventTypeNames::keydown) { 1234 if (event->type() == EventTypeNames::keydown) {
1235 if (!layoutObject() || !event->isKeyboardEvent()) 1235 if (!layoutObject() || !event->isKeyboardEvent())
1236 return; 1236 return;
1237 1237
1238 KeyboardEvent* keyEvent = toKeyboardEvent(event); 1238 KeyboardEvent* keyEvent = toKeyboardEvent(event);
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 int focusedIndex = activeSelectionEndListIndex(); 1768 int focusedIndex = activeSelectionEndListIndex();
1769 if (focusedIndex < 0) 1769 if (focusedIndex < 0)
1770 focusedIndex = firstSelectableListIndex(); 1770 focusedIndex = firstSelectableListIndex();
1771 if (focusedIndex < 0) 1771 if (focusedIndex < 0)
1772 return nullptr; 1772 return nullptr;
1773 HTMLElement* focused = listItems()[focusedIndex]; 1773 HTMLElement* focused = listItems()[focusedIndex];
1774 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr ; 1774 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr ;
1775 } 1775 }
1776 1776
1777 } // namespace 1777 } // namespace
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/select/select-typeahead-with-spacekey-expected.txt ('k') | Source/core/html/forms/TypeAhead.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698