Commit 6ad4f78d authored by Raine Makelainen's avatar Raine Makelainen

Merge branch 'jb36016' into 'master'

Send embed:linkclicked message on single tap

When an anchor or html area element is clicked and it contains
href, send "embed:linkclicked" message with clicked uri.

See merge request !22
parents a8bbaf03 34fcd80e
......@@ -207,6 +207,16 @@ EmbedHelper.prototype = {
}
this._touchElement = null;
}
let uri = this._getLinkURI(element);
if (uri && (uri instanceof Ci.nsIURI)) {
let winid = Services.embedlite.getIDByWindow(content);
Services.embedlite.sendAsyncMessage(winid, "embed:linkclicked",
JSON.stringify({
"uri": uri.asciiSpec
}));
}
break;
}
case "Gesture:DoubleTap": {
......@@ -572,13 +582,13 @@ EmbedHelper.prototype = {
},
_handleFullScreenChanged: function(aEvent) {
let window = aEvent.target.defaultView;
let winid = Services.embedlite.getIDByWindow(window);
this.inFullScreen = aEvent.target.mozFullScreen;
Services.embedlite.sendAsyncMessage(winid, "embed:fullscreenchanged",
JSON.stringify({
"fullscreen": aEvent.target.mozFullScreen
}));
let window = aEvent.target.defaultView;
let winid = Services.embedlite.getIDByWindow(window);
this.inFullScreen = aEvent.target.mozFullScreen;
Services.embedlite.sendAsyncMessage(winid, "embed:fullscreenchanged",
JSON.stringify({
"fullscreen": aEvent.target.mozFullScreen
}));
},
_handleTouchMove: function(aEvent) {
......@@ -612,7 +622,7 @@ EmbedHelper.prototype = {
},
_getLinkURI: function(aElement) {
if (aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
if (aElement && aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
((aElement instanceof Ci.nsIDOMHTMLAnchorElement && aElement.href) ||
(aElement instanceof Ci.nsIDOMHTMLAreaElement && aElement.href))) {
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment