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

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

Issue 2380683007: 'icon' IDL attribute of HTMLMenuItemElement should reflect as URL. (Closed)
Patch Set: Created 4 years, 2 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 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"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 using namespace HTMLNames; 14 using namespace HTMLNames;
15 15
16 inline HTMLMenuItemElement::HTMLMenuItemElement(Document& document) 16 inline HTMLMenuItemElement::HTMLMenuItemElement(Document& document)
17 : HTMLElement(HTMLNames::menuitemTag, document) 17 : HTMLElement(HTMLNames::menuitemTag, document)
18 { 18 {
19 UseCounter::count(document, UseCounter::MenuItemElement); 19 UseCounter::count(document, UseCounter::MenuItemElement);
20 } 20 }
21 21
22 bool HTMLMenuItemElement::isURLAttribute(const Attribute& attribute) const
23 {
24 return attribute.name() == iconAttr || HTMLElement::isURLAttribute(attribute );
25 }
26
22 void HTMLMenuItemElement::defaultEventHandler(Event* event) 27 void HTMLMenuItemElement::defaultEventHandler(Event* event)
23 { 28 {
24 if (event->type() == EventTypeNames::click) { 29 if (event->type() == EventTypeNames::click) {
25 if (equalIgnoringCase(fastGetAttribute(typeAttr), "checkbox")) { 30 if (equalIgnoringCase(fastGetAttribute(typeAttr), "checkbox")) {
26 if (fastHasAttribute(checkedAttr)) 31 if (fastHasAttribute(checkedAttr))
27 removeAttribute(checkedAttr); 32 removeAttribute(checkedAttr);
28 else 33 else
29 setAttribute(checkedAttr, "checked"); 34 setAttribute(checkedAttr, "checked");
30 } else if (equalIgnoringCase(fastGetAttribute(typeAttr), "radio")) { 35 } else if (equalIgnoringCase(fastGetAttribute(typeAttr), "radio")) {
31 if (Element* parent = parentElement()) { 36 if (Element* parent = parentElement()) {
32 AtomicString group = fastGetAttribute(radiogroupAttr); 37 AtomicString group = fastGetAttribute(radiogroupAttr);
33 for (HTMLMenuItemElement& menuItem : Traversal<HTMLMenuItemEleme nt>::childrenOf(*parent)) { 38 for (HTMLMenuItemElement& menuItem : Traversal<HTMLMenuItemEleme nt>::childrenOf(*parent)) {
34 if (!menuItem.fastHasAttribute(checkedAttr)) 39 if (!menuItem.fastHasAttribute(checkedAttr))
35 continue; 40 continue;
36 const AtomicString& groupAttr = menuItem.fastGetAttribute(ra diogroupAttr); 41 const AtomicString& groupAttr = menuItem.fastGetAttribute(ra diogroupAttr);
37 if (equalIgnoringNullity(groupAttr.impl(), group.impl())) 42 if (equalIgnoringNullity(groupAttr.impl(), group.impl()))
38 menuItem.removeAttribute(checkedAttr); 43 menuItem.removeAttribute(checkedAttr);
39 } 44 }
40 } 45 }
41 setAttribute(checkedAttr, "checked"); 46 setAttribute(checkedAttr, "checked");
42 } 47 }
43 event->setDefaultHandled(); 48 event->setDefaultHandled();
44 } 49 }
45 } 50 }
46 51
47 DEFINE_NODE_FACTORY(HTMLMenuItemElement) 52 DEFINE_NODE_FACTORY(HTMLMenuItemElement)
48 53
49 } // namespace blink 54 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMenuItemElement.h ('k') | third_party/WebKit/Source/core/html/HTMLMenuItemElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698