Bug 721220 - Send message back to java after tab selection is complete. r=mbrubeck
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Wed, 25 Jan 2012 20:06:08 -0800
changeset 86650 45207178a7350cf632e3bbf38c89ab1f8b8d873e
parent 86649 a89575b19f6c58f34161a81ba2c4f9ff1b60b9e6
child 86651 710c9b8252fb521ddf704ce290011dc8c6c75e3e
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs721220
milestone12.0a1
Bug 721220 - Send message back to java after tab selection is complete. r=mbrubeck
mobile/android/base/gfx/GeckoSoftwareLayerClient.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/gfx/GeckoSoftwareLayerClient.java
+++ b/mobile/android/base/gfx/GeckoSoftwareLayerClient.java
@@ -157,17 +157,17 @@ public class GeckoSoftwareLayerClient ex
         layerController.setRoot(mTileLayer);
         if (mGeckoViewport != null) {
             layerController.setViewportMetrics(mGeckoViewport);
         }
 
         GeckoAppShell.registerGeckoEventListener("Viewport:UpdateAndDraw", this);
         GeckoAppShell.registerGeckoEventListener("Viewport:UpdateLater", this);
         GeckoAppShell.registerGeckoEventListener("Document:Shown", this);
-        GeckoAppShell.registerGeckoEventListener("Tab:Selected", this);
+        GeckoAppShell.registerGeckoEventListener("Tab:Selected:Done", this);
 
         sendResizeEventIfNecessary();
     }
 
     private boolean setHasDirectTexture(boolean hasDirectTexture) {
         if (mTileLayer != null && hasDirectTexture == mHasDirectTexture)
             return false;
 
@@ -514,17 +514,17 @@ public class GeckoSoftwareLayerClient ex
             mUpdateViewportOnEndDraw = true;
 
             // Redraw everything.
             Rect rect = new Rect(0, 0, mBufferSize.width, mBufferSize.height);
             GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.DRAW, rect));
         } else if ("Viewport:UpdateLater".equals(event)) {
             mUpdateViewportOnEndDraw = true;
         } else if (("Document:Shown".equals(event) ||
-                    "Tab:Selected".equals(event)) &&
+                    "Tab:Selected:Done".equals(event)) &&
                    (mTileLayer instanceof MultiTileLayer)) {
             beginTransaction(mTileLayer);
             try {
                 ((MultiTileLayer)mTileLayer).invalidateTiles();
                 ((MultiTileLayer)mTileLayer).invalidateBuffer();
             } finally {
                 endTransaction(mTileLayer);
             }
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -534,16 +534,24 @@ var BrowserApp = {
   // in the Java UI.
   _handleTabSelected: function _handleTabSelected(aTab) {
       this.selectedTab = aTab;
       aTab.active = true;
 
       let evt = document.createEvent("UIEvents");
       evt.initUIEvent("TabSelect", true, false, window, null);
       aTab.browser.dispatchEvent(evt);
+
+    let message = {
+      gecko: {
+        type: "Tab:Selected:Done",
+        tabID: aTab.id
+      }
+    };
+    sendMessageToJava(message);
   },
 
   quit: function quit() {
     // Figure out if there's at least one other browser window around.
     let lastBrowser = true;
     let e = Services.wm.getEnumerator("navigator:browser");
     while (e.hasMoreElements() && lastBrowser) {
       let win = e.getNext();