Chromium Code Reviews| Index: Source/core/html/HTMLSelectElement.cpp |
| diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp |
| index 097f90eed19660aaa225dc054ff684f1bd2821c3..0cd49dbdea2dcd250b70524e3a7ad6ba326dcb88 100644 |
| --- a/Source/core/html/HTMLSelectElement.cpp |
| +++ b/Source/core/html/HTMLSelectElement.cpp |
| @@ -302,10 +302,24 @@ void HTMLSelectElement::parseAttribute(const QualifiedName& name, const AtomicSt |
| else if (name == accesskeyAttr) { |
| // FIXME: ignore for the moment. |
| // |
| + } else if (name == disabledAttr) { |
| + setNeedsWillValidateCheck(); |
|
tkent
2014/02/19 04:17:51
You should call HTMLFormControlElemenetWithState::
Habib Virji
2014/02/19 08:26:43
Done.
|
| + if (renderer() && renderer()->isMenuList()) { |
| + if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| + if (menuList->popupIsVisible()) |
| + menuList->hidePopup(); |
| + } |
| + } |
| + |
| } else |
| HTMLFormControlElementWithState::parseAttribute(name, value); |
| } |
| +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.
|
| +{ |
| + return fastHasAttribute(disabledAttr); |
| +} |
| + |
| bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const |
| { |
| return true; |
| @@ -1061,8 +1075,10 @@ bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event) |
| // gets called from RenderMenuList::valueChanged, which gets called |
| // after the user makes a selection from the menu. |
| saveLastSelection(); |
| - if (RenderMenuList* menuList = toRenderMenuList(renderer())) |
| - menuList->showPopup(); |
| + if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| + if (!isDisabledFormControl()) |
|
tkent
2014/02/19 04:17:51
We had better check isDisabledFormControl earlier.
Habib Virji
2014/02/19 08:26:43
Done.
|
| + menuList->showPopup(); |
| + } |
| event->setDefaultHandled(); |
| } |
| return true; |
| @@ -1148,8 +1164,10 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* event) |
| // gets called from RenderMenuList::valueChanged, which gets called |
| // after the user makes a selection from the menu. |
| saveLastSelection(); |
| - if (RenderMenuList* menuList = toRenderMenuList(renderer())) |
| - menuList->showPopup(); |
| + if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| + if (!isDisabledFormControl()) |
| + menuList->showPopup(); |
| + } |
| handled = true; |
| } |
| } else if (renderTheme.popsMenuByArrowKeys()) { |
| @@ -1166,8 +1184,10 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* event) |
| // gets called from RenderMenuList::valueChanged, which gets called |
| // after the user makes a selection from the menu. |
| saveLastSelection(); |
| - if (RenderMenuList* menuList = toRenderMenuList(renderer())) |
| - menuList->showPopup(); |
| + if (RenderMenuList* menuList = toRenderMenuList(renderer())) { |
| + if (!isDisabledFormControl()) |
| + menuList->showPopup(); |
| + } |
| handled = true; |
| } else if (keyCode == '\r') { |
| if (form()) |
| @@ -1194,7 +1214,8 @@ void HTMLSelectElement::menuListDefaultEventHandler(Event* event) |
| // which gets called after the user makes a selection from |
| // the menu. |
| saveLastSelection(); |
| - menuList->showPopup(); |
| + if (!isDisabledFormControl()) |
| + menuList->showPopup(); |
| } |
| } |
| } |