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

Unified Diff: Source/core/html/HTMLMenuItemElement.cpp

Issue 766863002: Implement checked attribute for menuitem. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years 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/HTMLMenuItemElement.h ('k') | Source/core/page/ContextMenuControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMenuItemElement.cpp
diff --git a/Source/core/html/HTMLMenuItemElement.cpp b/Source/core/html/HTMLMenuItemElement.cpp
index e0774e7552ac538ebad2d36115441908ff55c6e5..79d6759ffca96ab5b80873e38fc0bade7e363d41 100644
--- a/Source/core/html/HTMLMenuItemElement.cpp
+++ b/Source/core/html/HTMLMenuItemElement.cpp
@@ -6,14 +6,30 @@
#include "core/html/HTMLMenuItemElement.h"
#include "core/HTMLNames.h"
+#include "core/events/Event.h"
namespace blink {
+using namespace HTMLNames;
+
inline HTMLMenuItemElement::HTMLMenuItemElement(Document& document)
: HTMLElement(HTMLNames::menuitemTag, document)
{
}
+void HTMLMenuItemElement::defaultEventHandler(Event* event)
+{
+ if (event->type() == EventTypeNames::click) {
+ if (equalIgnoringCase(fastGetAttribute(typeAttr), "checkbox")) {
+ if (fastHasAttribute(checkedAttr))
+ removeAttribute(checkedAttr);
+ else
+ setAttribute(checkedAttr, "checked");
+ }
+ event->setDefaultHandled();
+ }
+}
+
DEFINE_NODE_FACTORY(HTMLMenuItemElement)
} // namespace blink
« no previous file with comments | « Source/core/html/HTMLMenuItemElement.h ('k') | Source/core/page/ContextMenuControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698