Bug 1320587 - Force first paint when (re-)attaching Gecko to Java. r=darchons
MozReview-Commit-ID: 6vUbIXTPNLQ
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1062,40 +1062,30 @@ private:
public:
void AttachToJava(jni::Object::Param aClient, jni::Object::Param aNPZC)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mWindow) {
return; // Already shut down.
}
- const auto& layerClient = GeckoLayerClient::Ref::From(aClient);
-
- // If resetting is true, Android destroyed our GeckoApp activity and we
- // had to recreate it, but all the Gecko-side things were not
- // destroyed. We therefore need to link up the new java objects to
- // Gecko, and that's what we do here.
- const bool resetting = !!mLayerClient;
- mLayerClient = layerClient;
+ mLayerClient = GeckoLayerClient::Ref::From(aClient);
MOZ_ASSERT(aNPZC);
auto npzc = NativePanZoomController::LocalRef(
jni::GetGeckoThreadEnv(),
NativePanZoomController::Ref::From(aNPZC));
mWindow->mNPZCSupport.Attach(npzc, mWindow, npzc);
- layerClient->OnGeckoReady();
-
- if (resetting) {
- // Since we are re-linking the new java objects to Gecko, we need
- // to get the viewport from the compositor (since the Java copy was
- // thrown away) and we do that by setting the first-paint flag.
- if (RefPtr<CompositorBridgeParent> bridge = mWindow->GetCompositorBridgeParent()) {
- bridge->ForceIsFirstPaint();
- }
+ mLayerClient->OnGeckoReady();
+
+ // Set the first-paint flag so that we (re-)link any new Java objects
+ // to Gecko, co-ordinate viewports, etc.
+ if (RefPtr<CompositorBridgeParent> bridge = mWindow->GetCompositorBridgeParent()) {
+ bridge->ForceIsFirstPaint();
}
}
void OnSizeChanged(int32_t aWindowWidth, int32_t aWindowHeight,
int32_t aScreenWidth, int32_t aScreenHeight)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mWindow) {