OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |