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

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

Issue 159743002: Select when disabled should not allow value change and popup is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Different expected file for mac Created 6 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/platform/mac/fast/forms/select/select-disabled-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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 HTMLFormControlElementWithState::parseAttribute(name, value);
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
309 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const 318 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const
310 { 319 {
311 return true; 320 return true;
312 } 321 }
313 322
314 bool HTMLSelectElement::canSelectAll() const 323 bool HTMLSelectElement::canSelectAll() const
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 { 1055 {
1047 if (!RenderTheme::theme().popsMenuByArrowKeys()) 1056 if (!RenderTheme::theme().popsMenuByArrowKeys())
1048 return false; 1057 return false;
1049 1058
1050 if (!isSpatialNavigationEnabled(document().frame())) { 1059 if (!isSpatialNavigationEnabled(document().frame())) {
1051 if (event->keyIdentifier() == "Down" || event->keyIdentifier() == "Up") { 1060 if (event->keyIdentifier() == "Down" || event->keyIdentifier() == "Up") {
1052 focus(); 1061 focus();
1053 // Calling focus() may cause us to lose our renderer. Return true so 1062 // Calling focus() may cause us to lose our renderer. Return true so
1054 // that our caller doesn't process the event further, but don't set 1063 // that our caller doesn't process the event further, but don't set
1055 // the event as handled. 1064 // the event as handled.
1056 if (!renderer()) 1065 if (!renderer() || isDisabledFormControl())
1057 return true; 1066 return true;
1058 1067
1059 // Save the selection so it can be compared to the new selection 1068 // Save the selection so it can be compared to the new selection
1060 // when dispatching change events during selectOption, which 1069 // when dispatching change events during selectOption, which
1061 // gets called from RenderMenuList::valueChanged, which gets called 1070 // gets called from RenderMenuList::valueChanged, which gets called
1062 // after the user makes a selection from the menu. 1071 // after the user makes a selection from the menu.
1063 saveLastSelection(); 1072 saveLastSelection();
1064 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1073 if (RenderMenuList* menuList = toRenderMenuList(renderer()))
1065 menuList->showPopup(); 1074 menuList->showPopup();
1066 event->setDefaultHandled(); 1075 event->setDefaultHandled();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 event->setDefaultHandled(); 1142 event->setDefaultHandled();
1134 return; 1143 return;
1135 } 1144 }
1136 1145
1137 if (renderTheme.popsMenuBySpaceOrReturn()) { 1146 if (renderTheme.popsMenuBySpaceOrReturn()) {
1138 if (keyCode == ' ' || keyCode == '\r') { 1147 if (keyCode == ' ' || keyCode == '\r') {
1139 focus(); 1148 focus();
1140 1149
1141 // Calling focus() may remove the renderer or change the 1150 // Calling focus() may remove the renderer or change the
1142 // renderer type. 1151 // renderer type.
1143 if (!renderer() || !renderer()->isMenuList()) 1152 if (!renderer() || !renderer()->isMenuList() || isDisabledFormCo ntrol())
1144 return; 1153 return;
1145 1154
1146 // Save the selection so it can be compared to the new selection 1155 // Save the selection so it can be compared to the new selection
1147 // when dispatching change events during selectOption, which 1156 // when dispatching change events during selectOption, which
1148 // gets called from RenderMenuList::valueChanged, which gets cal led 1157 // gets called from RenderMenuList::valueChanged, which gets cal led
1149 // after the user makes a selection from the menu. 1158 // after the user makes a selection from the menu.
1150 saveLastSelection(); 1159 saveLastSelection();
1151 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1160 if (RenderMenuList* menuList = toRenderMenuList(renderer()))
1152 menuList->showPopup(); 1161 menuList->showPopup();
1153 handled = true; 1162 handled = true;
1154 } 1163 }
1155 } else if (renderTheme.popsMenuByArrowKeys()) { 1164 } else if (renderTheme.popsMenuByArrowKeys()) {
1156 if (keyCode == ' ') { 1165 if (keyCode == ' ') {
1157 focus(); 1166 focus();
1158 1167
1159 // Calling focus() may remove the renderer or change the 1168 // Calling focus() may remove the renderer or change the
1160 // renderer type. 1169 // renderer type.
1161 if (!renderer() || !renderer()->isMenuList()) 1170 if (!renderer() || !renderer()->isMenuList() || isDisabledFormCo ntrol())
1162 return; 1171 return;
1163 1172
1164 // Save the selection so it can be compared to the new selection 1173 // Save the selection so it can be compared to the new selection
1165 // when dispatching change events during selectOption, which 1174 // when dispatching change events during selectOption, which
1166 // gets called from RenderMenuList::valueChanged, which gets cal led 1175 // gets called from RenderMenuList::valueChanged, which gets cal led
1167 // after the user makes a selection from the menu. 1176 // after the user makes a selection from the menu.
1168 saveLastSelection(); 1177 saveLastSelection();
1169 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1178 if (RenderMenuList* menuList = toRenderMenuList(renderer()))
1170 menuList->showPopup(); 1179 menuList->showPopup();
1171 handled = true; 1180 handled = true;
1172 } else if (keyCode == '\r') { 1181 } else if (keyCode == '\r') {
1173 if (form()) 1182 if (form())
1174 form()->submitImplicitly(event, false); 1183 form()->submitImplicitly(event, false);
1175 dispatchChangeEventForMenuList(); 1184 dispatchChangeEventForMenuList();
1176 handled = true; 1185 handled = true;
1177 } 1186 }
1178 } 1187 }
1179 1188
1180 if (handled) 1189 if (handled)
1181 event->setDefaultHandled(); 1190 event->setDefaultHandled();
1182 } 1191 }
1183 1192
1184 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { 1193 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) {
1185 focus(); 1194 focus();
1186 if (renderer() && renderer()->isMenuList()) { 1195 if (renderer() && renderer()->isMenuList() && !isDisabledFormControl()) {
1187 if (RenderMenuList* menuList = toRenderMenuList(renderer())) { 1196 if (RenderMenuList* menuList = toRenderMenuList(renderer())) {
1188 if (menuList->popupIsVisible()) 1197 if (menuList->popupIsVisible())
1189 menuList->hidePopup(); 1198 menuList->hidePopup();
1190 else { 1199 else {
1191 // Save the selection so it can be compared to the new 1200 // Save the selection so it can be compared to the new
1192 // selection when we call onChange during selectOption, 1201 // selection when we call onChange during selectOption,
1193 // which gets called from RenderMenuList::valueChanged, 1202 // which gets called from RenderMenuList::valueChanged,
1194 // which gets called after the user makes a selection from 1203 // which gets called after the user makes a selection from
1195 // the menu. 1204 // the menu.
1196 saveLastSelection(); 1205 saveLastSelection();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 { 1569 {
1561 return true; 1570 return true;
1562 } 1571 }
1563 1572
1564 bool HTMLSelectElement::supportsAutofocus() const 1573 bool HTMLSelectElement::supportsAutofocus() const
1565 { 1574 {
1566 return true; 1575 return true;
1567 } 1576 }
1568 1577
1569 } // namespace 1578 } // namespace
OLDNEW
« no previous file with comments | « LayoutTests/platform/mac/fast/forms/select/select-disabled-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698