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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp

Issue 2372593005: Restrict type attribute on menuitem (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/HTMLMenuItemElement.h" 5 #include "core/html/HTMLMenuItemElement.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/dom/ElementTraversal.h" 8 #include "core/dom/ElementTraversal.h"
9 #include "core/events/Event.h" 9 #include "core/events/Event.h"
10 #include "core/frame/UseCounter.h" 10 #include "core/frame/UseCounter.h"
(...skipping 30 matching lines...) Expand all
41 if (equalIgnoringNullity(groupAttr.impl(), group.impl())) 41 if (equalIgnoringNullity(groupAttr.impl(), group.impl()))
42 menuItem.removeAttribute(checkedAttr); 42 menuItem.removeAttribute(checkedAttr);
43 } 43 }
44 } 44 }
45 setAttribute(checkedAttr, "checked"); 45 setAttribute(checkedAttr, "checked");
46 } 46 }
47 event->setDefaultHandled(); 47 event->setDefaultHandled();
48 } 48 }
49 } 49 }
50 50
51 AtomicString HTMLMenuItemElement::type() const {
52 const AtomicString& menuItemType = fastGetAttribute(typeAttr);
53 if (equalIgnoringCase(menuItemType, "radio")) {
tkent 2016/11/14 03:47:09 Do you want equalIgnoringCase(), not equalIgnoring
rwlbuis 2016/11/14 15:22:26 Yes, very likely. However I will go the autogenera
54 DEFINE_STATIC_LOCAL(const AtomicString, radio, ("radio"));
55 return radio;
56 }
57 if (equalIgnoringCase(menuItemType, "checkbox")) {
58 DEFINE_STATIC_LOCAL(const AtomicString, checkbox, ("checkbox"));
59 return checkbox;
60 }
61 DEFINE_STATIC_LOCAL(const AtomicString, command, ("command"));
62 return command;
63 }
64
65 void HTMLMenuItemElement::setType(const AtomicString& menuItemType) {
66 setAttribute(typeAttr, menuItemType);
67 }
68
51 DEFINE_NODE_FACTORY(HTMLMenuItemElement) 69 DEFINE_NODE_FACTORY(HTMLMenuItemElement)
52 70
53 } // namespace blink 71 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698