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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLSelectElement.cpp
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index 097f90eed19660aaa225dc054ff684f1bd2821c3..b30faa5c72935b3d8e767069ea0874f671568d24 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -302,6 +302,15 @@ void HTMLSelectElement::parseAttribute(const QualifiedName& name, const AtomicSt
else if (name == accesskeyAttr) {
// FIXME: ignore for the moment.
//
+ } else if (name == disabledAttr) {
+ HTMLFormControlElementWithState::parseAttribute(name, value);
+ if (renderer() && renderer()->isMenuList()) {
+ if (RenderMenuList* menuList = toRenderMenuList(renderer())) {
+ if (menuList->popupIsVisible())
+ menuList->hidePopup();
+ }
+ }
+
} else
HTMLFormControlElementWithState::parseAttribute(name, value);
}
@@ -1053,7 +1062,7 @@ bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event)
// Calling focus() may cause us to lose our renderer. Return true so
// that our caller doesn't process the event further, but don't set
// the event as handled.
- if (!renderer())
+ if (!renderer() || isDisabledFormControl())
return true;
// Save the selection so it can be compared to the new selection
@@ -1140,7 +1149,7 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* event)
// Calling focus() may remove the renderer or change the
// renderer type.
- if (!renderer() || !renderer()->isMenuList())
+ if (!renderer() || !renderer()->isMenuList() || isDisabledFormControl())
return;
// Save the selection so it can be compared to the new selection
@@ -1158,7 +1167,7 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* event)
// Calling focus() may remove the renderer or change the
// renderer type.
- if (!renderer() || !renderer()->isMenuList())
+ if (!renderer() || !renderer()->isMenuList() || isDisabledFormControl())
return;
// Save the selection so it can be compared to the new selection
@@ -1183,7 +1192,7 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* event)
if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
focus();
- if (renderer() && renderer()->isMenuList()) {
+ if (renderer() && renderer()->isMenuList() && !isDisabledFormControl()) {
if (RenderMenuList* menuList = toRenderMenuList(renderer())) {
if (menuList->popupIsVisible())
menuList->hidePopup();
« 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