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

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

Issue 2841473002: Implement HTMLMenuItemElement.label (Closed)
Patch Set: Fix syntax error Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp b/third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp
index 20502c4aa363ecfaa2afd8ae0a63951b059b6cc8..9c9e149586b6471d14e0993f51eb9e87eedce774 100644
--- a/third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp
@@ -4,6 +4,7 @@
#include "core/html/HTMLMenuItemElement.h"
+#include "core/html/parser/HTMLParserIdioms.h"
#include "core/HTMLNames.h"
#include "core/dom/ElementTraversal.h"
#include "core/events/Event.h"
@@ -57,6 +58,18 @@ void HTMLMenuItemElement::DefaultEventHandler(Event* event) {
}
}
+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.
+ const AtomicString label = FastGetAttribute(labelAttr);
+ 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.
+ return label;
+ 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.
+ .SimplifyWhiteSpace(IsHTMLSpace<UChar>);
+}
+
+void HTMLMenuItemElement::setLabel(const AtomicString& label) {
+ setAttribute(labelAttr, label);
+}
+
DEFINE_NODE_FACTORY(HTMLMenuItemElement)
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698