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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 setNeedsValidityCheck(); | 295 setNeedsValidityCheck(); |
296 if (m_size != oldSize && inActiveDocument()) { | 296 if (m_size != oldSize && inActiveDocument()) { |
297 lazyReattachIfAttached(); | 297 lazyReattachIfAttached(); |
298 setRecalcListItems(); | 298 setRecalcListItems(); |
299 } | 299 } |
300 } else if (name == multipleAttr) | 300 } else if (name == multipleAttr) |
301 parseMultipleAttribute(value); | 301 parseMultipleAttribute(value); |
302 else if (name == accesskeyAttr) { | 302 else if (name == accesskeyAttr) { |
303 // FIXME: ignore for the moment. | 303 // FIXME: ignore for the moment. |
304 // | 304 // |
305 } else if (name == disabledAttr) { | |
306 setNeedsWillValidateCheck(); | |
tkent
2014/02/19 04:17:51
You should call HTMLFormControlElemenetWithState::
Habib Virji
2014/02/19 08:26:43
Done.
| |
307 if (renderer() && renderer()->isMenuList()) { | |
308 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { | |
309 if (menuList->popupIsVisible()) | |
310 menuList->hidePopup(); | |
311 } | |
312 } | |
313 | |
305 } else | 314 } else |
306 HTMLFormControlElementWithState::parseAttribute(name, value); | 315 HTMLFormControlElementWithState::parseAttribute(name, value); |
307 } | 316 } |
308 | 317 |
318 bool HTMLSelectElement::isDisabledFormControl() const | |
tkent
2014/02/19 04:17:51
You should not override isDisabledFormControl. Th
Habib Virji
2014/02/19 08:26:43
Done.
| |
319 { | |
320 return fastHasAttribute(disabledAttr); | |
321 } | |
322 | |
309 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const | 323 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const |
310 { | 324 { |
311 return true; | 325 return true; |
312 } | 326 } |
313 | 327 |
314 bool HTMLSelectElement::canSelectAll() const | 328 bool HTMLSelectElement::canSelectAll() const |
315 { | 329 { |
316 return !usesMenuList(); | 330 return !usesMenuList(); |
317 } | 331 } |
318 | 332 |
(...skipping 735 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 | 1068 // that our caller doesn't process the event further, but don't set |
1055 // the event as handled. | 1069 // the event as handled. |
1056 if (!renderer()) | 1070 if (!renderer()) |
1057 return true; | 1071 return true; |
1058 | 1072 |
1059 // Save the selection so it can be compared to the new selection | 1073 // Save the selection so it can be compared to the new selection |
1060 // when dispatching change events during selectOption, which | 1074 // when dispatching change events during selectOption, which |
1061 // gets called from RenderMenuList::valueChanged, which gets called | 1075 // gets called from RenderMenuList::valueChanged, which gets called |
1062 // after the user makes a selection from the menu. | 1076 // after the user makes a selection from the menu. |
1063 saveLastSelection(); | 1077 saveLastSelection(); |
1064 if (RenderMenuList* menuList = toRenderMenuList(renderer())) | 1078 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
1065 menuList->showPopup(); | 1079 if (!isDisabledFormControl()) |
tkent
2014/02/19 04:17:51
We had better check isDisabledFormControl earlier.
Habib Virji
2014/02/19 08:26:43
Done.
| |
1080 menuList->showPopup(); | |
1081 } | |
1066 event->setDefaultHandled(); | 1082 event->setDefaultHandled(); |
1067 } | 1083 } |
1068 return true; | 1084 return true; |
1069 } | 1085 } |
1070 | 1086 |
1071 return false; | 1087 return false; |
1072 } | 1088 } |
1073 #endif | 1089 #endif |
1074 | 1090 |
1075 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) | 1091 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 | 1157 // Calling focus() may remove the renderer or change the |
1142 // renderer type. | 1158 // renderer type. |
1143 if (!renderer() || !renderer()->isMenuList()) | 1159 if (!renderer() || !renderer()->isMenuList()) |
1144 return; | 1160 return; |
1145 | 1161 |
1146 // Save the selection so it can be compared to the new selection | 1162 // Save the selection so it can be compared to the new selection |
1147 // when dispatching change events during selectOption, which | 1163 // when dispatching change events during selectOption, which |
1148 // gets called from RenderMenuList::valueChanged, which gets cal led | 1164 // gets called from RenderMenuList::valueChanged, which gets cal led |
1149 // after the user makes a selection from the menu. | 1165 // after the user makes a selection from the menu. |
1150 saveLastSelection(); | 1166 saveLastSelection(); |
1151 if (RenderMenuList* menuList = toRenderMenuList(renderer())) | 1167 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
1152 menuList->showPopup(); | 1168 if (!isDisabledFormControl()) |
1169 menuList->showPopup(); | |
1170 } | |
1153 handled = true; | 1171 handled = true; |
1154 } | 1172 } |
1155 } else if (renderTheme.popsMenuByArrowKeys()) { | 1173 } else if (renderTheme.popsMenuByArrowKeys()) { |
1156 if (keyCode == ' ') { | 1174 if (keyCode == ' ') { |
1157 focus(); | 1175 focus(); |
1158 | 1176 |
1159 // Calling focus() may remove the renderer or change the | 1177 // Calling focus() may remove the renderer or change the |
1160 // renderer type. | 1178 // renderer type. |
1161 if (!renderer() || !renderer()->isMenuList()) | 1179 if (!renderer() || !renderer()->isMenuList()) |
1162 return; | 1180 return; |
1163 | 1181 |
1164 // Save the selection so it can be compared to the new selection | 1182 // Save the selection so it can be compared to the new selection |
1165 // when dispatching change events during selectOption, which | 1183 // when dispatching change events during selectOption, which |
1166 // gets called from RenderMenuList::valueChanged, which gets cal led | 1184 // gets called from RenderMenuList::valueChanged, which gets cal led |
1167 // after the user makes a selection from the menu. | 1185 // after the user makes a selection from the menu. |
1168 saveLastSelection(); | 1186 saveLastSelection(); |
1169 if (RenderMenuList* menuList = toRenderMenuList(renderer())) | 1187 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
1170 menuList->showPopup(); | 1188 if (!isDisabledFormControl()) |
1189 menuList->showPopup(); | |
1190 } | |
1171 handled = true; | 1191 handled = true; |
1172 } else if (keyCode == '\r') { | 1192 } else if (keyCode == '\r') { |
1173 if (form()) | 1193 if (form()) |
1174 form()->submitImplicitly(event, false); | 1194 form()->submitImplicitly(event, false); |
1175 dispatchChangeEventForMenuList(); | 1195 dispatchChangeEventForMenuList(); |
1176 handled = true; | 1196 handled = true; |
1177 } | 1197 } |
1178 } | 1198 } |
1179 | 1199 |
1180 if (handled) | 1200 if (handled) |
1181 event->setDefaultHandled(); | 1201 event->setDefaultHandled(); |
1182 } | 1202 } |
1183 | 1203 |
1184 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { | 1204 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { |
1185 focus(); | 1205 focus(); |
1186 if (renderer() && renderer()->isMenuList()) { | 1206 if (renderer() && renderer()->isMenuList()) { |
1187 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { | 1207 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
1188 if (menuList->popupIsVisible()) | 1208 if (menuList->popupIsVisible()) |
1189 menuList->hidePopup(); | 1209 menuList->hidePopup(); |
1190 else { | 1210 else { |
1191 // Save the selection so it can be compared to the new | 1211 // Save the selection so it can be compared to the new |
1192 // selection when we call onChange during selectOption, | 1212 // selection when we call onChange during selectOption, |
1193 // which gets called from RenderMenuList::valueChanged, | 1213 // which gets called from RenderMenuList::valueChanged, |
1194 // which gets called after the user makes a selection from | 1214 // which gets called after the user makes a selection from |
1195 // the menu. | 1215 // the menu. |
1196 saveLastSelection(); | 1216 saveLastSelection(); |
1197 menuList->showPopup(); | 1217 if (!isDisabledFormControl()) |
1218 menuList->showPopup(); | |
1198 } | 1219 } |
1199 } | 1220 } |
1200 } | 1221 } |
1201 event->setDefaultHandled(); | 1222 event->setDefaultHandled(); |
1202 } | 1223 } |
1203 | 1224 |
1204 if (event->type() == EventTypeNames::blur) { | 1225 if (event->type() == EventTypeNames::blur) { |
1205 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { | 1226 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
1206 if (menuList->popupIsVisible()) | 1227 if (menuList->popupIsVisible()) |
1207 menuList->hidePopup(); | 1228 menuList->hidePopup(); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1560 { | 1581 { |
1561 return true; | 1582 return true; |
1562 } | 1583 } |
1563 | 1584 |
1564 bool HTMLSelectElement::supportsAutofocus() const | 1585 bool HTMLSelectElement::supportsAutofocus() const |
1565 { | 1586 { |
1566 return true; | 1587 return true; |
1567 } | 1588 } |
1568 | 1589 |
1569 } // namespace | 1590 } // namespace |
OLD | NEW |