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

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: Select disable attribute handling in parseAttribute 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 | « Source/core/html/HTMLSelectElement.h ('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..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();
}
}
}
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698