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

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

Issue 12250020: Merge 141858 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 10 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 | « LayoutTests/fast/forms/select/select-change-type-on-focus-expected.txt ('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 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 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 // Use space to toggle arrow key handling for selection change or sp atial navigation. 1154 // Use space to toggle arrow key handling for selection change or sp atial navigation.
1155 m_activeSelectionState = !m_activeSelectionState; 1155 m_activeSelectionState = !m_activeSelectionState;
1156 event->setDefaultHandled(); 1156 event->setDefaultHandled();
1157 return; 1157 return;
1158 } 1158 }
1159 1159
1160 if (renderTheme->popsMenuBySpaceOrReturn()) { 1160 if (renderTheme->popsMenuBySpaceOrReturn()) {
1161 if (keyCode == ' ' || keyCode == '\r') { 1161 if (keyCode == ' ' || keyCode == '\r') {
1162 focus(); 1162 focus();
1163 1163
1164 // Calling focus() may cause us to lose our renderer, in which c ase 1164 // Calling focus() may remove the renderer or change the
1165 // do not want to handle the event. 1165 // renderer type.
1166 if (!renderer()) 1166 if (!renderer() || !renderer()->isMenuList())
1167 return; 1167 return;
1168 1168
1169 // Save the selection so it can be compared to the new selection 1169 // Save the selection so it can be compared to the new selection
1170 // when dispatching change events during selectOption, which 1170 // when dispatching change events during selectOption, which
1171 // gets called from RenderMenuList::valueChanged, which gets cal led 1171 // gets called from RenderMenuList::valueChanged, which gets cal led
1172 // after the user makes a selection from the menu. 1172 // after the user makes a selection from the menu.
1173 saveLastSelection(); 1173 saveLastSelection();
1174 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1174 if (RenderMenuList* menuList = toRenderMenuList(renderer()))
1175 menuList->showPopup(); 1175 menuList->showPopup();
1176 handled = true; 1176 handled = true;
1177 } 1177 }
1178 } else if (renderTheme->popsMenuByArrowKeys()) { 1178 } else if (renderTheme->popsMenuByArrowKeys()) {
1179 if (keyCode == ' ') { 1179 if (keyCode == ' ') {
1180 focus(); 1180 focus();
1181 1181
1182 // Calling focus() may cause us to lose our renderer, in which c ase 1182 // Calling focus() may remove the renderer or change the
1183 // do not want to handle the event. 1183 // renderer type.
1184 if (!renderer()) 1184 if (!renderer() || !renderer()->isMenuList())
1185 return; 1185 return;
1186 1186
1187 // Save the selection so it can be compared to the new selection 1187 // Save the selection so it can be compared to the new selection
1188 // when dispatching change events during selectOption, which 1188 // when dispatching change events during selectOption, which
1189 // gets called from RenderMenuList::valueChanged, which gets cal led 1189 // gets called from RenderMenuList::valueChanged, which gets cal led
1190 // after the user makes a selection from the menu. 1190 // after the user makes a selection from the menu.
1191 saveLastSelection(); 1191 saveLastSelection();
1192 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1192 if (RenderMenuList* menuList = toRenderMenuList(renderer()))
1193 menuList->showPopup(); 1193 menuList->showPopup();
1194 handled = true; 1194 handled = true;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 const Vector<HTMLElement*>& items = listItems(); 1545 const Vector<HTMLElement*>& items = listItems();
1546 for (unsigned i = 0; i < items.size(); ++i) { 1546 for (unsigned i = 0; i < items.size(); ++i) {
1547 if (items[i]->hasTagName(optionTag)) 1547 if (items[i]->hasTagName(optionTag))
1548 ++options; 1548 ++options;
1549 } 1549 }
1550 1550
1551 return options; 1551 return options;
1552 } 1552 }
1553 1553
1554 } // namespace 1554 } // namespace
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/select/select-change-type-on-focus-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698