diff --git a/mobile/android/base/GeckoEvent.java b/mobile/android/base/GeckoEvent.java index a13e0bf81c4..ca12bdaed20 100644 --- a/mobile/android/base/GeckoEvent.java +++ b/mobile/android/base/GeckoEvent.java @@ -78,6 +78,7 @@ public class GeckoEvent { public static final int ACTIVITY_START = 17; public static final int BROADCAST = 19; public static final int VIEWPORT = 20; + public static final int EXPOSE = 21; public static final int IME_COMPOSITION_END = 0; public static final int IME_COMPOSITION_BEGIN = 1; diff --git a/widget/src/android/AndroidJavaWrappers.h b/widget/src/android/AndroidJavaWrappers.h index f05cff9874c..377c721ac23 100644 --- a/widget/src/android/AndroidJavaWrappers.h +++ b/widget/src/android/AndroidJavaWrappers.h @@ -532,6 +532,7 @@ public: ACTIVITY_START = 17, BROADCAST = 19, VIEWPORT = 20, + EXPOSE = 21, dummy_java_enum_list_end }; diff --git a/widget/src/android/nsWindow.cpp b/widget/src/android/nsWindow.cpp index 3bcb8184943..1dc1baf463b 100644 --- a/widget/src/android/nsWindow.cpp +++ b/widget/src/android/nsWindow.cpp @@ -978,6 +978,7 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae) break; case AndroidGeckoEvent::DRAW: + case AndroidGeckoEvent::EXPOSE: win->OnDraw(ae); break; @@ -1168,15 +1169,16 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae) if (gAndroidBounds.width <= 0 || gAndroidBounds.height <= 0) return; - /* - * Check to see whether browser.js wants us to draw. This will be false during page - * transitions, in which case we immediately bail out. - */ nsCOMPtr metadataProvider = AndroidBridge::Bridge()->GetDrawMetadataProvider(); + /* + * If this is a DRAW event (not an EXPOSE event), check to see whether browser.js wants us to + * draw. This will be false during page transitions, in which case we immediately bail out. + */ + bool shouldDraw = true; - if (metadataProvider) { + if (metadataProvider && ae->Type() == AndroidGeckoEvent::DRAW) { metadataProvider->DrawingAllowed(&shouldDraw); } if (!shouldDraw) { @@ -1187,6 +1189,12 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae) AndroidBridge::Bridge()->GetSoftwareLayerClient(); client.BeginDrawing(gAndroidBounds.width, gAndroidBounds.height); + // Redraw the entire tile on an EXPOSE event. Otherwise (on a DRAW event), redraw only the + // portion specified by the event. + nsIntRect rect(0, 0, gAndroidBounds.width, gAndroidBounds.height); + if (ae->Type() == AndroidGeckoEvent::DRAW) + rect = ae->Rect(); + nsAutoString metadata; unsigned char *bits = NULL; if (sHasDirectTexture) { @@ -1219,7 +1227,7 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae) // XXX: lock only the dirty rect above and pass it in here DrawTo(targetSurface); } else { - DrawTo(targetSurface, ae->Rect()); + DrawTo(targetSurface, rect); } if (metadataProvider) { @@ -1232,7 +1240,7 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae) client.UnlockBuffer(); } } - client.EndDrawing(ae->Rect(), metadata); + client.EndDrawing(rect, metadata); return; #endif