Chromium Code Reviews| 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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1054 // that our caller doesn't process the event further, but don't set | 1054 // that our caller doesn't process the event further, but don't set |
| 1055 // the event as handled. | 1055 // the event as handled. |
| 1056 if (!renderer()) | 1056 if (!renderer()) |
| 1057 return true; | 1057 return true; |
| 1058 | 1058 |
| 1059 // Save the selection so it can be compared to the new selection | 1059 // Save the selection so it can be compared to the new selection |
| 1060 // when dispatching change events during selectOption, which | 1060 // when dispatching change events during selectOption, which |
| 1061 // gets called from RenderMenuList::valueChanged, which gets called | 1061 // gets called from RenderMenuList::valueChanged, which gets called |
| 1062 // after the user makes a selection from the menu. | 1062 // after the user makes a selection from the menu. |
| 1063 saveLastSelection(); | 1063 saveLastSelection(); |
| 1064 if (RenderMenuList* menuList = toRenderMenuList(renderer())) | 1064 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| 1065 menuList->showPopup(); | 1065 if (!isDisabledOrReadOnly()) |
|
tkent
2014/02/17 00:14:30
* <select> can not be read-only.
* This check has
Habib Virji
2014/02/18 10:23:21
Done.
"<select> can not be read-only."
--> Select
| |
| 1066 menuList->showPopup(); | |
| 1067 } | |
| 1066 event->setDefaultHandled(); | 1068 event->setDefaultHandled(); |
| 1067 } | 1069 } |
| 1068 return true; | 1070 return true; |
| 1069 } | 1071 } |
| 1070 | 1072 |
| 1071 return false; | 1073 return false; |
| 1072 } | 1074 } |
| 1073 #endif | 1075 #endif |
| 1074 | 1076 |
| 1075 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) | 1077 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1141 // Calling focus() may remove the renderer or change the | 1143 // Calling focus() may remove the renderer or change the |
| 1142 // renderer type. | 1144 // renderer type. |
| 1143 if (!renderer() || !renderer()->isMenuList()) | 1145 if (!renderer() || !renderer()->isMenuList()) |
| 1144 return; | 1146 return; |
| 1145 | 1147 |
| 1146 // Save the selection so it can be compared to the new selection | 1148 // Save the selection so it can be compared to the new selection |
| 1147 // when dispatching change events during selectOption, which | 1149 // when dispatching change events during selectOption, which |
| 1148 // gets called from RenderMenuList::valueChanged, which gets cal led | 1150 // gets called from RenderMenuList::valueChanged, which gets cal led |
| 1149 // after the user makes a selection from the menu. | 1151 // after the user makes a selection from the menu. |
| 1150 saveLastSelection(); | 1152 saveLastSelection(); |
| 1151 if (RenderMenuList* menuList = toRenderMenuList(renderer())) | 1153 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| 1152 menuList->showPopup(); | 1154 if (!isDisabledOrReadOnly()) |
| 1155 menuList->showPopup(); | |
| 1156 } | |
| 1153 handled = true; | 1157 handled = true; |
| 1154 } | 1158 } |
| 1155 } else if (renderTheme.popsMenuByArrowKeys()) { | 1159 } else if (renderTheme.popsMenuByArrowKeys()) { |
| 1156 if (keyCode == ' ') { | 1160 if (keyCode == ' ') { |
| 1157 focus(); | 1161 focus(); |
| 1158 | 1162 |
| 1159 // Calling focus() may remove the renderer or change the | 1163 // Calling focus() may remove the renderer or change the |
| 1160 // renderer type. | 1164 // renderer type. |
| 1161 if (!renderer() || !renderer()->isMenuList()) | 1165 if (!renderer() || !renderer()->isMenuList()) |
| 1162 return; | 1166 return; |
| 1163 | 1167 |
| 1164 // Save the selection so it can be compared to the new selection | 1168 // Save the selection so it can be compared to the new selection |
| 1165 // when dispatching change events during selectOption, which | 1169 // when dispatching change events during selectOption, which |
| 1166 // gets called from RenderMenuList::valueChanged, which gets cal led | 1170 // gets called from RenderMenuList::valueChanged, which gets cal led |
| 1167 // after the user makes a selection from the menu. | 1171 // after the user makes a selection from the menu. |
| 1168 saveLastSelection(); | 1172 saveLastSelection(); |
| 1169 if (RenderMenuList* menuList = toRenderMenuList(renderer())) | 1173 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| 1170 menuList->showPopup(); | 1174 if (!isDisabledOrReadOnly()) |
| 1175 menuList->showPopup(); | |
| 1176 } | |
| 1171 handled = true; | 1177 handled = true; |
| 1172 } else if (keyCode == '\r') { | 1178 } else if (keyCode == '\r') { |
| 1173 if (form()) | 1179 if (form()) |
| 1174 form()->submitImplicitly(event, false); | 1180 form()->submitImplicitly(event, false); |
| 1175 dispatchChangeEventForMenuList(); | 1181 dispatchChangeEventForMenuList(); |
| 1176 handled = true; | 1182 handled = true; |
| 1177 } | 1183 } |
| 1178 } | 1184 } |
| 1179 | 1185 |
| 1180 if (handled) | 1186 if (handled) |
| 1181 event->setDefaultHandled(); | 1187 event->setDefaultHandled(); |
| 1182 } | 1188 } |
| 1183 | 1189 |
| 1184 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { | 1190 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { |
| 1185 focus(); | 1191 focus(); |
| 1186 if (renderer() && renderer()->isMenuList()) { | 1192 if (renderer() && renderer()->isMenuList()) { |
| 1187 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { | 1193 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| 1188 if (menuList->popupIsVisible()) | 1194 if (menuList->popupIsVisible()) |
| 1189 menuList->hidePopup(); | 1195 menuList->hidePopup(); |
| 1190 else { | 1196 else { |
| 1191 // Save the selection so it can be compared to the new | 1197 // Save the selection so it can be compared to the new |
| 1192 // selection when we call onChange during selectOption, | 1198 // selection when we call onChange during selectOption, |
| 1193 // which gets called from RenderMenuList::valueChanged, | 1199 // which gets called from RenderMenuList::valueChanged, |
| 1194 // which gets called after the user makes a selection from | 1200 // which gets called after the user makes a selection from |
| 1195 // the menu. | 1201 // the menu. |
| 1196 saveLastSelection(); | 1202 saveLastSelection(); |
| 1197 menuList->showPopup(); | 1203 if (!isDisabledOrReadOnly()) |
| 1204 menuList->showPopup(); | |
| 1198 } | 1205 } |
| 1199 } | 1206 } |
| 1200 } | 1207 } |
| 1201 event->setDefaultHandled(); | 1208 event->setDefaultHandled(); |
| 1202 } | 1209 } |
| 1203 | 1210 |
| 1204 if (event->type() == EventTypeNames::blur) { | 1211 if (event->type() == EventTypeNames::blur) { |
| 1205 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { | 1212 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| 1206 if (menuList->popupIsVisible()) | 1213 if (menuList->popupIsVisible()) |
| 1207 menuList->hidePopup(); | 1214 menuList->hidePopup(); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1560 { | 1567 { |
| 1561 return true; | 1568 return true; |
| 1562 } | 1569 } |
| 1563 | 1570 |
| 1564 bool HTMLSelectElement::supportsAutofocus() const | 1571 bool HTMLSelectElement::supportsAutofocus() const |
| 1565 { | 1572 { |
| 1566 return true; | 1573 return true; |
| 1567 } | 1574 } |
| 1568 | 1575 |
| 1569 } // namespace | 1576 } // namespace |
| OLD | NEW |