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

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

Issue 2841473002: Implement HTMLMenuItemElement.label (Closed)
Patch Set: Fix syntax error Created 3 years, 7 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/html/parser/HTMLParserIdioms.h"
7 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
8 #include "core/dom/ElementTraversal.h" 9 #include "core/dom/ElementTraversal.h"
9 #include "core/events/Event.h" 10 #include "core/events/Event.h"
10 #include "core/frame/UseCounter.h" 11 #include "core/frame/UseCounter.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 using namespace HTMLNames; 15 using namespace HTMLNames;
15 16
16 inline HTMLMenuItemElement::HTMLMenuItemElement(Document& document) 17 inline HTMLMenuItemElement::HTMLMenuItemElement(Document& document)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 if (EqualIgnoringNullity(group_attr.Impl(), group.Impl())) 51 if (EqualIgnoringNullity(group_attr.Impl(), group.Impl()))
51 menu_item.removeAttribute(checkedAttr); 52 menu_item.removeAttribute(checkedAttr);
52 } 53 }
53 } 54 }
54 setAttribute(checkedAttr, "checked"); 55 setAttribute(checkedAttr, "checked");
55 } 56 }
56 event->SetDefaultHandled(); 57 event->SetDefaultHandled();
57 } 58 }
58 } 59 }
59 60
61 const String HTMLMenuItemElement::label() const {
tkent 2017/04/25 23:25:00 The return value should not be |const|. It's unne
yuzuchan 2017/04/26 08:54:57 Right! Done.
62 const AtomicString label = FastGetAttribute(labelAttr);
63 if (!label.IsNull() && label != "")
tkent 2017/04/25 09:56:34 if (!label.IsEmpty()) is simpler.
tkent 2017/04/25 23:24:59 I found the specification didn't ask to check an e
yuzuchan 2017/04/26 08:54:57 Changed the code to follow the spec. Thanks.
64 return label;
65 return this->textContent(true).StripWhiteSpace(IsHTMLSpace<UChar>)
tkent 2017/04/25 09:56:34 The argument of textContent() means convert_brs_to
yuzuchan 2017/04/26 08:54:57 Right, done.
66 .SimplifyWhiteSpace(IsHTMLSpace<UChar>);
67 }
68
69 void HTMLMenuItemElement::setLabel(const AtomicString& label) {
70 setAttribute(labelAttr, label);
71 }
72
60 DEFINE_NODE_FACTORY(HTMLMenuItemElement) 73 DEFINE_NODE_FACTORY(HTMLMenuItemElement)
61 74
62 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698