Bug 920927 - Update plugin overlay handling on mobile. r=margaret
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Tue, 15 Oct 2013 10:35:50 +0200
changeset 164610 99c71671485687b5b5a04e2560333c8d3f83586f
parent 164609 7759d30a7ae58c2606f26c8e4b44a17cd6a312e2
child 164611 f585d3d5d879a3ffbd02abb1a705cd3d33c5c85f
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs920927
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 920927 - Update plugin overlay handling on mobile. r=margaret
mobile/android/chrome/content/PluginHelper.js
--- a/mobile/android/chrome/content/PluginHelper.js
+++ b/mobile/android/chrome/content/PluginHelper.js
@@ -180,30 +180,45 @@ var PluginHelper = {
         // If the plugin is hidden, or if the overlay is too small, show a 
         // doorhanger notification
         if (PluginHelper.isTooSmall(plugin, overlay)) {
           PluginHelper.delayAndShowDoorHanger(aTab);
         } else {
           // There's a large enough visible overlay that we don't need to show
           // the doorhanger.
           aTab.shouldShowPluginDoorhanger = false;
+          overlay.style.visibility = "visible";
         }
 
         // Add click to play listener to the overlay
         overlay.addEventListener("click", function(e) {
           if (!e.isTrusted)
             return;
           e.preventDefault();
           let win = e.target.ownerDocument.defaultView.top;
           let tab = BrowserApp.getTabForWindow(win);
           tab.clickToPlayPluginsActivated = true;
           PluginHelper.playAllPlugins(win);
 
           NativeWindow.doorhanger.hide("ask-to-play-plugins", tab.id);
         }, true);
+
+        // Add handlers for over- and underflow in case the plugin gets resized
+        plugin.addEventListener("overflow", function(event) {
+          overlay.style.visibility = "hidden";
+          PluginHelper.delayAndShowDoorHanger(aTab);
+        });
+        plugin.addEventListener("underflow", function(event) {
+          // This is also triggered if only one dimension underflows,
+          // the other dimension might still overflow
+          if (!PluginHelper.isTooSmall(plugin, overlay)) {
+            overlay.style.visibility = "visible";
+          }
+        });
+
         break;
       }
 
       case "PluginPlayPreview": {
         let previewContent = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
         let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
         let mimeType = PluginHelper.getPluginMimeType(plugin);
         let playPreviewInfo = pluginHost.getPlayPreviewInfo(mimeType);
@@ -252,16 +267,17 @@ var PluginHelper = {
 
       case "PluginNotFound": {
         // On devices where we don't support Flash, there will be a
         // "Learn More..." link in the missing plugin error message.
         let learnMoreLink = doc.getAnonymousElementByAttribute(plugin, "class", "unsupportedLearnMoreLink");
         let learnMoreUrl = Services.urlFormatter.formatURLPref("app.support.baseURL");
         learnMoreUrl += "why-cant-firefox-mobile-play-flash-on-my-device";
         learnMoreLink.href = learnMoreUrl;
+        overlay.style.visibility = "visible";
         break;
       }
     }
   },
 
   // Helper to get the binding handler type from a plugin object
   _getBindingType: function(plugin) {
     if (!(plugin instanceof Ci.nsIObjectLoadingContent))