From 762918d29a2ba879b1ea0a39118b35b7c130fdd3 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Thu, 16 Aug 2012 17:35:20 -0400 Subject: [PATCH] Bug 777450 - Part 2: Long pressing a Flash video no longer activates text selection. r=wesj --- mobile/android/chrome/content/browser.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index de0648173720..9877b1875222 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -1388,8 +1388,7 @@ var NativeWindow = { 0, null); rootElement.ownerDocument.defaultView.addEventListener("contextmenu", this, false); rootElement.dispatchEvent(event); - } else { - // Otherwise, let the selection handler take over + } else if (SelectionHandler.canSelect(rootElement)) { SelectionHandler.startSelection(rootElement, aX, aY); } }, @@ -1643,6 +1642,14 @@ var SelectionHandler = { this._ignoreCollapsedSelection = false; }, + /** Returns true if the provided element can be selected in text selection, false otherwise. */ + canSelect: function sh_canSelect(aElement) { + return !(aElement instanceof Ci.nsIDOMHTMLButtonElement || + aElement instanceof Ci.nsIDOMHTMLEmbedElement || + aElement instanceof Ci.nsIDOMHTMLImageElement || + aElement instanceof Ci.nsIDOMHTMLMediaElement); + }, + // aX/aY are in top-level window browser coordinates startSelection: function sh_startSelection(aElement, aX, aY) { // Clear out any existing selection