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

Unified Diff: Source/core/html/HTMLElement.cpp

Issue 243403006: Implement contextmenu attribute with basic support of <menu> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review comments Created 6 years, 5 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: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index d5c9c754a92cbefc8fa757afb46179696f09b339..784e34af3dc3fcf45919f0c28f955851b8b5c86e 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -48,6 +48,7 @@
#include "core/html/HTMLBRElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLMenuElement.h"
#include "core/html/HTMLTemplateElement.h"
#include "core/html/HTMLTextFormControlElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
@@ -900,6 +901,17 @@ bool HTMLElement::isInteractiveContent() const
return false;
}
+PassRefPtrWillBeRawPtr<HTMLMenuElement> HTMLElement::contextMenu() const
+{
+ Element* element = treeScope().getElementById(fastGetAttribute(contextmenuAttr));
+ return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : 0;
+}
+
+void HTMLElement::setContextMenu(PassRefPtrWillBeRawPtr<HTMLMenuElement> contextMenu)
+{
+ setAttribute(contextmenuAttr, contextMenu->elementData()->idForStyleResolution());
tkent 2014/07/31 06:07:55 Does this behavior conform to the standard?
pals 2014/08/01 10:03:07 Specification says that the contextmenu attribute
tkent 2014/08/04 02:26:12 The HTML specification must have a detailed algori
pals 2014/08/04 08:58:27 Now I am checking if id is null and I have added
+}
+
void HTMLElement::defaultEventHandler(Event* event)
{
if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {

Powered by Google App Engine
This is Rietveld 408576698