Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: safari/content.js

Issue 5589897452716032: Implemented ext.contextMenus for Safari (Closed)
Patch Set: Created Jan. 18, 2014, 10:29 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« safari/background.js ('K') | « safari/background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/content.js
===================================================================
--- a/safari/content.js
+++ b/safari/content.js
@@ -305,4 +305,15 @@
};
ext.onMessage = new MessageEventTarget(safari.self);
+
+ // Safari does not pass the element which the context menu is refering to
+ // so we need to add it to the event's user info.
+ document.addEventListener("contextmenu", function(event)
+ {
+ var element = event.srcElement;
+ safari.self.tab.setContextMenuEventUserInfo(event, {
+ srcUrl: ("src" in element) ? element.src : null,
+ tagName: element.localName
+ });
+ }, false);
})();
« safari/background.js ('K') | « safari/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld