From aad457aa8efd9e81ec5954f007d36c5cc0f2fcf9 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 3 Sep 2015 23:18:52 -0400 Subject: [PATCH] Bug 1201625 - Special-case B2GDroid since it doesn't have a root content document. r=rbarker --HG-- extra : commitid : HyFaXHFS3vH --- gfx/layers/composite/AsyncCompositionManager.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index a23fb9a51ba8..66f36da1a3ee 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -647,7 +647,17 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer) // bug 1036967 removed the (dead) call. #if defined(MOZ_ANDROID_APZ) - if (metrics.IsRootContent()) { + bool rootContentLayer = metrics.IsRootContent(); +#ifdef MOZ_B2GDROID + // B2GDroid is a special snowflake since it doesn't seem to have any root + // content document. However we still need to send a setFirstPaintViewport + // message, so we use the root of the layer tree as the root content layer + // instead. For the most part this should work fine; the Java code will just + // think the root layer is the "main" content, which in a manner of speaking, + // it is. + rootContentLayer = (aLayer->GetParent() == nullptr); +#endif // MOZ_B2GDROID + if (rootContentLayer) { if (mIsFirstPaint) { CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel().ToScaleFactor(); LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom); @@ -659,7 +669,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer) mIsFirstPaint = false; mLayersUpdated = false; } -#endif +#endif // MOZ_ANDROID_APZ // Transform the current local clip by this APZC's async transform. If we're // using containerful scrolling, then the clip is not part of the scrolled