Bug 797942 - Update compositor size on SIZE_CHANGED or SetCompositor, but only at startup; r=snorp
authorGeoff Brown <gbrown@mozilla.com>
Tue, 23 Oct 2012 13:53:00 -0600
changeset 111175 ef02503c438742d7a5932e97938df9488214c7a1
parent 111174 b3c8f279987b16fd631d14cc53b2c030944a7064
child 111176 1494dd3c23150eb8ff5eafbc0542cc5064f0236b
push id16913
push usergbrown@mozilla.com
push dateTue, 23 Oct 2012 19:53:28 +0000
treeherdermozilla-inbound@ef02503c4387 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs797942
milestone19.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 797942 - Update compositor size on SIZE_CHANGED or SetCompositor, but only at startup; r=snorp
widget/android/nsWindow.cpp
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -766,16 +766,23 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
             NS_ASSERTION(points.Length() == 2, "Size changed does not have enough coordinates");
 
             int nw = points[0].x;
             int nh = points[0].y;
 
             if (ae->Type() == AndroidGeckoEvent::FORCED_RESIZE || nw != gAndroidBounds.width ||
                 nh != gAndroidBounds.height) {
 
+                if (sCompositorParent != 0 && gAndroidBounds.width == 0) {
+                    // Propagate size change to compositor. This is sometimes essential
+                    // on startup, because the window size may not have been available
+                    // when the compositor was created.
+                    ScheduleResumeComposition(nw, nh);
+                }
+
                 gAndroidBounds.width = nw;
                 gAndroidBounds.height = nh;
 
                 // tell all the windows about the new size
                 for (size_t i = 0; i < gTopLevelWindows.Length(); ++i) {
                     if (gTopLevelWindows[i]->mIsVisible)
                         gTopLevelWindows[i]->Resize(gAndroidBounds.width,
                                                     gAndroidBounds.height,
@@ -2237,18 +2244,24 @@ nsWindow::DrawWindowOverlay(LayerManager
 nsRefPtr<mozilla::layers::CompositorParent> nsWindow::sCompositorParent = 0;
 nsRefPtr<mozilla::layers::CompositorChild> nsWindow::sCompositorChild = 0;
 bool nsWindow::sCompositorPaused = false;
 
 void
 nsWindow::SetCompositor(mozilla::layers::CompositorParent* aCompositorParent,
                         mozilla::layers::CompositorChild* aCompositorChild)
 {
+    bool sizeChangeNeeded = (aCompositorParent && !sCompositorParent && gAndroidBounds.width != 0);
+
     sCompositorParent = aCompositorParent;
     sCompositorChild = aCompositorChild;
+
+    if (sizeChangeNeeded) {
+        ScheduleResumeComposition(gAndroidBounds.width, gAndroidBounds.height);
+    }
 }
 
 void
 nsWindow::ScheduleComposite()
 {
     if (sCompositorParent) {
         sCompositorParent->ScheduleRenderOnCompositorThread();
     }