mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 732091 - Part 5: Make the compositor notify Java when the page size changes or when a first paint occurs. r=bgirard
This commit is contained in:
parent
00f07c4874
commit
665b50af00
@ -178,7 +178,6 @@ CompositorParent::Composite()
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
RequestViewTransform();
|
||||
TransformShadowTree();
|
||||
#endif
|
||||
|
||||
@ -260,34 +259,52 @@ CompositorParent::TransformShadowTree()
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
Layer* layer = GetPrimaryScrollableLayer();
|
||||
ShadowLayer* shadow = layer->AsShadowLayer();
|
||||
|
||||
gfx3DMatrix shadowTransform = layer->GetTransform();
|
||||
|
||||
ContainerLayer* container = layer->AsContainerLayer();
|
||||
|
||||
const FrameMetrics* metrics = &container->GetFrameMetrics();
|
||||
const gfx3DMatrix& rootTransform = mLayerManager->GetRoot()->GetTransform();
|
||||
const gfx3DMatrix& currentTransform = layer->GetTransform();
|
||||
|
||||
float rootScaleX = GetXScale(rootTransform);
|
||||
float rootScaleY = GetYScale(rootTransform);
|
||||
|
||||
if (mIsFirstPaint && metrics) {
|
||||
nsIntPoint scrollOffset = metrics->mViewportScrollOffset;
|
||||
mContentSize = metrics->mContentSize;
|
||||
mozilla::AndroidBridge::Bridge()->SetFirstPaintViewport(scrollOffset.x, scrollOffset.y,
|
||||
1/rootScaleX, mContentSize.width,
|
||||
mContentSize.height);
|
||||
mIsFirstPaint = false;
|
||||
} else if (metrics && (metrics->mContentSize != mContentSize)) {
|
||||
mContentSize = metrics->mContentSize;
|
||||
mozilla::AndroidBridge::Bridge()->SetPageSize(1/rootScaleX, mContentSize.width,
|
||||
mContentSize.height);
|
||||
}
|
||||
|
||||
// We request the view transform from Java after sending the above notifications,
|
||||
// so that Java can take these into account in its response.
|
||||
RequestViewTransform();
|
||||
|
||||
// Handle transformations for asynchronous panning and zooming. We determine the
|
||||
// zoom used by Gecko from the transformation set on the root layer, and we
|
||||
// determine the scroll offset used by Gecko from the frame metrics of the
|
||||
// primary scrollable layer. We compare this to the desired zoom and scroll
|
||||
// offset in the view transform we obtained from Java in order to compute the
|
||||
// transformation we need to apply.
|
||||
if (metrics && metrics->IsScrollable()) {
|
||||
float tempScaleDiffX = GetXScale(mLayerManager->GetRoot()->GetTransform()) * mXScale;
|
||||
float tempScaleDiffY = GetYScale(mLayerManager->GetRoot()->GetTransform()) * mYScale;
|
||||
float tempScaleDiffX = rootScaleX * mXScale;
|
||||
float tempScaleDiffY = rootScaleY * mYScale;
|
||||
|
||||
nsIntPoint metricsScrollOffset = metrics->mViewportScrollOffset;
|
||||
|
||||
nsIntPoint scrollCompensation(
|
||||
(mScrollOffset.x / tempScaleDiffX - metricsScrollOffset.x) * mXScale,
|
||||
(mScrollOffset.y / tempScaleDiffY - metricsScrollOffset.y) * mYScale);
|
||||
ViewTransform treeTransform(-scrollCompensation, mXScale,
|
||||
mYScale);
|
||||
shadowTransform = gfx3DMatrix(treeTransform) * currentTransform;
|
||||
|
||||
shadow->SetShadowTransform(shadowTransform);
|
||||
ViewTransform treeTransform(-scrollCompensation, mXScale, mYScale);
|
||||
shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
|
||||
} else {
|
||||
ViewTransform treeTransform(nsIntPoint(0,0), mXScale,
|
||||
mYScale);
|
||||
shadowTransform = gfx3DMatrix(treeTransform) * currentTransform;
|
||||
|
||||
shadow->SetShadowTransform(shadowTransform);
|
||||
ViewTransform treeTransform(nsIntPoint(0,0), mXScale, mYScale);
|
||||
shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ private:
|
||||
float mXScale;
|
||||
float mYScale;
|
||||
nsIntPoint mScrollOffset;
|
||||
nsIntSize mContentSize;
|
||||
|
||||
// When this flag is set, the next composition will be the first for a
|
||||
// particular document (i.e. the document displayed on the screen will change).
|
||||
|
Loading…
Reference in New Issue
Block a user