Bug 732564 - Merge the UpdateAndDraw and UpdateLater events into a single Update event since they do the same thing now. r=Cwiiis
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 12 Mar 2012 12:03:37 -0400
changeset 89321 d732ef6bebaabfed03c5c07c4490649f76f3d5a4
parent 89320 278c638c3dcbbdf09c2b4c86e2309f8baf6c6612
child 89322 8e0e446b7d67e09cc91131ede326ac5d7e8cd90b
push id22242
push userkgupta@mozilla.com
push dateWed, 14 Mar 2012 15:19:09 +0000
treeherdermozilla-central@936ef50fa498 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs732564
milestone13.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 732564 - Merge the UpdateAndDraw and UpdateLater events into a single Update event since they do the same thing now. r=Cwiiis
mobile/android/base/gfx/GeckoLayerClient.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -114,18 +114,17 @@ public class GeckoLayerClient implements
     void setLayerController(LayerController layerController) {
         mLayerController = layerController;
 
         layerController.setRoot(mRootLayer);
         if (mGeckoViewport != null) {
             layerController.setViewportMetrics(mGeckoViewport);
         }
 
-        GeckoAppShell.registerGeckoEventListener("Viewport:UpdateAndDraw", this);
-        GeckoAppShell.registerGeckoEventListener("Viewport:UpdateLater", this);
+        GeckoAppShell.registerGeckoEventListener("Viewport:Update", this);
 
         sendResizeEventIfNecessary(false);
 
         LayerView view = layerController.getView();
         view.setListener(this);
 
         mLayerRenderer = new LayerRenderer(view);
     }
@@ -273,31 +272,28 @@ public class GeckoLayerClient implements
         if (mViewportSizeChanged) {
             mViewportSizeChanged = false;
             GeckoAppShell.viewSizeChanged();
         }
     }
 
     /** Implementation of GeckoEventResponder/GeckoEventListener. */
     public void handleMessage(String event, JSONObject message) {
-        if ("Viewport:UpdateAndDraw".equals(event)) {
-            mUpdateViewportOnEndDraw = true;
-            mIgnorePaintsPendingViewportSizeChange = false;
-        } else if ("Viewport:UpdateLater".equals(event)) {
+        if ("Viewport:Update".equals(event)) {
             mUpdateViewportOnEndDraw = true;
             mIgnorePaintsPendingViewportSizeChange = false;
         }
     }
 
     /** Implementation of GeckoEventResponder. */
     public String getResponse() {
         // We are responding to the events handled in handleMessage() above with
-        // the display port margins we want. Note that both messages we are currently
-        // handling (Viewport:UpdateAndDraw and Viewport:UpdateLater) require this
-        // response, so we can just return this indiscriminately.
+        // the display port margins we want. Note that all messages we are currently
+        // handling (Viewport:Update) require this response, so we can just return
+        // this indiscriminately.
         return RectUtils.toJSON(mDisplayPortMargins);
     }
 
     void geometryChanged() {
         /* Let Gecko know if the screensize has changed */
         sendResizeEventIfNecessary(false);
         if (mLayerController.getRedrawHint())
             adjustViewport();
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1737,23 +1737,19 @@ Tab.prototype = {
     }
 
     this.sendViewportUpdate();
   },
 
   sendViewportUpdate: function() {
     if (BrowserApp.selectedTab != this)
       return;
-    this.sendViewportMessage("Viewport:UpdateAndDraw");
-  },
-
-  sendViewportMessage: function(msg) {
     let displayPortMargins = sendMessageToJava({
       gecko: {
-        type: msg
+        type: "Viewport:Update"
       }
     });
     if (displayPortMargins != null)
       this.refreshDisplayPort(JSON.parse(displayPortMargins));
   },
 
   handleEvent: function(aEvent) {
     switch (aEvent.type) {
@@ -1892,17 +1888,17 @@ Tab.prototype = {
         let tab = BrowserApp.getTabForWindow(aEvent.target.top);
         BrowserApp.selectTab(tab);
         break;
       }
 
       case "scroll": {
         let win = this.browser.contentWindow;
         if (this.userScrollPos.x != win.scrollX || this.userScrollPos.y != win.scrollY) {
-          this.sendViewportMessage("Viewport:UpdateLater");
+          this.sendViewportUpdate();
         }
         break;
       }
 
       case "PluginClickToPlay": {
         // Keep track of the number of plugins to know whether or not to show
         // the hidden plugins doorhanger
         this._pluginCount++;