| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 void HTMLMenuItemElement::ParseAttribute( | 26 void HTMLMenuItemElement::ParseAttribute( |
| 27 const AttributeModificationParams& params) { | 27 const AttributeModificationParams& params) { |
| 28 if (params.name == iconAttr) | 28 if (params.name == iconAttr) |
| 29 UseCounter::Count(GetDocument(), UseCounter::kMenuItemElementIconAttribute); | 29 UseCounter::Count(GetDocument(), UseCounter::kMenuItemElementIconAttribute); |
| 30 HTMLElement::ParseAttribute(params); | 30 HTMLElement::ParseAttribute(params); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void HTMLMenuItemElement::DefaultEventHandler(Event* event) { | 33 void HTMLMenuItemElement::DefaultEventHandler(Event* event) { |
| 34 if (event->type() == EventTypeNames::click) { | 34 if (event->type() == EventTypeNames::click) { |
| 35 if (EqualIgnoringCase(FastGetAttribute(typeAttr), "checkbox")) { | 35 if (DeprecatedEqualIgnoringCase(FastGetAttribute(typeAttr), "checkbox")) { |
| 36 if (FastHasAttribute(checkedAttr)) | 36 if (FastHasAttribute(checkedAttr)) |
| 37 removeAttribute(checkedAttr); | 37 removeAttribute(checkedAttr); |
| 38 else | 38 else |
| 39 setAttribute(checkedAttr, "checked"); | 39 setAttribute(checkedAttr, "checked"); |
| 40 } else if (EqualIgnoringCase(FastGetAttribute(typeAttr), "radio")) { | 40 } else if (DeprecatedEqualIgnoringCase(FastGetAttribute(typeAttr), |
| 41 "radio")) { |
| 41 if (Element* parent = parentElement()) { | 42 if (Element* parent = parentElement()) { |
| 42 AtomicString group = FastGetAttribute(radiogroupAttr); | 43 AtomicString group = FastGetAttribute(radiogroupAttr); |
| 43 for (HTMLMenuItemElement& menu_item : | 44 for (HTMLMenuItemElement& menu_item : |
| 44 Traversal<HTMLMenuItemElement>::ChildrenOf(*parent)) { | 45 Traversal<HTMLMenuItemElement>::ChildrenOf(*parent)) { |
| 45 if (!menu_item.FastHasAttribute(checkedAttr)) | 46 if (!menu_item.FastHasAttribute(checkedAttr)) |
| 46 continue; | 47 continue; |
| 47 const AtomicString& group_attr = | 48 const AtomicString& group_attr = |
| 48 menu_item.FastGetAttribute(radiogroupAttr); | 49 menu_item.FastGetAttribute(radiogroupAttr); |
| 49 if (EqualIgnoringNullity(group_attr.Impl(), group.Impl())) | 50 if (EqualIgnoringNullity(group_attr.Impl(), group.Impl())) |
| 50 menu_item.removeAttribute(checkedAttr); | 51 menu_item.removeAttribute(checkedAttr); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 setAttribute(checkedAttr, "checked"); | 54 setAttribute(checkedAttr, "checked"); |
| 54 } | 55 } |
| 55 event->SetDefaultHandled(); | 56 event->SetDefaultHandled(); |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 | 59 |
| 59 DEFINE_NODE_FACTORY(HTMLMenuItemElement) | 60 DEFINE_NODE_FACTORY(HTMLMenuItemElement) |
| 60 | 61 |
| 61 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |