Index: Source/core/html/HTMLElement.cpp |
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp |
index 041571390d1c06175442ff1acafa8f5410bc8275..acde71cadf5ebee8dba54e196ca8089d2aef67d7 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" |
@@ -901,6 +902,31 @@ bool HTMLElement::isInteractiveContent() const |
return false; |
} |
+ |
+HTMLMenuElement* HTMLElement::contextMenu() const |
+{ |
+ const AtomicString& contextMenuId(fastGetAttribute(contextmenuAttr)); |
+ if (contextMenuId.isNull()) |
+ return nullptr; |
+ |
+ Element* element = treeScope().getElementById(contextMenuId); |
+ return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : nullptr; |
pals
2014/08/17 17:18:13
Specification
http://www.whatwg.org/specs/web-apps
tkent
2014/08/18 02:24:52
Off topic: Please refer to multipage version URL.
pals
2014/08/18 14:23:24
Done.
|
+} |
+ |
+void HTMLElement::setContextMenu(HTMLMenuElement* contextMenu) |
+{ |
+ if (!contextMenu) |
+ return; |
+ |
+ const AtomicString& contextMenuId(contextMenu->fastGetAttribute(idAttr)); |
+ const AtomicString& contextMenuType(contextMenu->fastGetAttribute(typeAttr)); |
+ |
+ if (!contextMenuId.isNull() && equalIgnoringCase(contextMenuType, "popup") && contextMenu->inDocument()) |
pals
2014/08/17 17:18:13
http://www.whatwg.org/specs/web-apps/current-work/
tkent
2014/08/18 02:24:52
You misread the specification. This paragraph is
tkent
2014/08/18 02:27:27
reject IDs of <menu type=popup> -> reject IDs of *
pals
2014/08/18 14:23:24
Done.
|
+ setAttribute(contextmenuAttr, contextMenuId); |
+ else |
+ setAttribute(contextmenuAttr, ""); |
pals
2014/08/17 17:18:13
Specification
http://www.whatwg.org/specs/web-apps
tkent
2014/08/18 02:24:52
"same home subtree" means we need to check treeSco
pals
2014/08/18 14:23:24
Done. I was doing inDocument() check. Also added a
|
+} |
+ |
void HTMLElement::defaultEventHandler(Event* event) |
{ |
if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { |