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

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

Issue 2841473002: Implement HTMLMenuItemElement.label (Closed)
Patch Set: Reflect review comments 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..5675f11cec1e9f54f25c78019dec6d4cf1cf7d89 100644
--- a/third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMenuItemElement.cpp
@@ -8,6 +8,7 @@
#include "core/dom/ElementTraversal.h"
#include "core/events/Event.h"
#include "core/frame/UseCounter.h"
+#include "core/html/parser/HTMLParserIdioms.h"
namespace blink {
@@ -57,6 +58,26 @@ void HTMLMenuItemElement::DefaultEventHandler(Event* event) {
}
}
+String HTMLMenuItemElement::label() const {
+ const AtomicString label = FastGetAttribute(labelAttr);
+ if (!label.IsNull())
+ return label;
+ return conceptualLabel();
+}
+
+void HTMLMenuItemElement::setLabel(const AtomicString& label) {
+ setAttribute(labelAttr, label);
+}
+
+String HTMLMenuItemElement::conceptualLabel() const {
+ const AtomicString label = FastGetAttribute(labelAttr);
+ if (!label.IsEmpty())
+ return label;
+ return this->textContent(false)
+ .StripWhiteSpace(IsHTMLSpace<UChar>)
+ .SimplifyWhiteSpace(IsHTMLSpace<UChar>);
+}
+
DEFINE_NODE_FACTORY(HTMLMenuItemElement)
} // namespace blink
« 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