зеркало из https://github.com/mozilla/pjs.git
Bug 757847 - Use a reference rather than a pointer that is never null. r=ajuma
This commit is contained in:
Родитель
4901fe54de
Коммит
c0ccebee74
|
@ -347,38 +347,36 @@ CompositorParent::TransformShadowTree()
|
|||
ShadowLayer* shadow = layer->AsShadowLayer();
|
||||
ContainerLayer* container = layer->AsContainerLayer();
|
||||
|
||||
const FrameMetrics* metrics = &container->GetFrameMetrics();
|
||||
const FrameMetrics& metrics = container->GetFrameMetrics();
|
||||
const gfx3DMatrix& rootTransform = mLayerManager->GetRoot()->GetTransform();
|
||||
const gfx3DMatrix& currentTransform = layer->GetTransform();
|
||||
|
||||
float rootScaleX = rootTransform.GetXScale();
|
||||
float rootScaleY = rootTransform.GetYScale();
|
||||
|
||||
if (mIsFirstPaint && metrics) {
|
||||
mContentRect = metrics->mContentRect;
|
||||
SetFirstPaintViewport(metrics->mViewportScrollOffset,
|
||||
if (mIsFirstPaint) {
|
||||
mContentRect = metrics.mContentRect;
|
||||
SetFirstPaintViewport(metrics.mViewportScrollOffset,
|
||||
1/rootScaleX,
|
||||
mContentRect,
|
||||
metrics->mCSSContentRect);
|
||||
metrics.mCSSContentRect);
|
||||
mIsFirstPaint = false;
|
||||
} else if (metrics && !metrics->mContentRect.IsEqualEdges(mContentRect)) {
|
||||
mContentRect = metrics->mContentRect;
|
||||
SetPageRect(1/rootScaleX, mContentRect, metrics->mCSSContentRect);
|
||||
} else if (!metrics.mContentRect.IsEqualEdges(mContentRect)) {
|
||||
mContentRect = metrics.mContentRect;
|
||||
SetPageRect(1/rootScaleX, mContentRect, metrics.mCSSContentRect);
|
||||
}
|
||||
|
||||
// We synchronise the viewport information with Java after sending the above
|
||||
// notifications, so that Java can take these into account in its response.
|
||||
if (metrics) {
|
||||
// Calculate the absolute display port to send to Java
|
||||
nsIntRect displayPort = metrics->mDisplayPort;
|
||||
nsIntPoint scrollOffset = metrics->mViewportScrollOffset;
|
||||
displayPort.x += scrollOffset.x;
|
||||
displayPort.y += scrollOffset.y;
|
||||
// Calculate the absolute display port to send to Java
|
||||
nsIntRect displayPort = metrics.mDisplayPort;
|
||||
nsIntPoint scrollOffset = metrics.mViewportScrollOffset;
|
||||
displayPort.x += scrollOffset.x;
|
||||
displayPort.y += scrollOffset.y;
|
||||
|
||||
SyncViewportInfo(displayPort, 1/rootScaleX, mLayersUpdated,
|
||||
mScrollOffset, mXScale, mYScale);
|
||||
mLayersUpdated = false;
|
||||
}
|
||||
SyncViewportInfo(displayPort, 1/rootScaleX, mLayersUpdated,
|
||||
mScrollOffset, mXScale, mYScale);
|
||||
mLayersUpdated = false;
|
||||
|
||||
// Handle transformations for asynchronous panning and zooming. We determine the
|
||||
// zoom used by Gecko from the transformation set on the root layer, and we
|
||||
|
@ -386,32 +384,18 @@ CompositorParent::TransformShadowTree()
|
|||
// 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) {
|
||||
float tempScaleDiffX = rootScaleX * mXScale;
|
||||
float tempScaleDiffY = rootScaleY * mYScale;
|
||||
float tempScaleDiffX = rootScaleX * mXScale;
|
||||
float tempScaleDiffY = rootScaleY * mYScale;
|
||||
|
||||
nsIntPoint metricsScrollOffset(0, 0);
|
||||
if (metrics->IsScrollable())
|
||||
metricsScrollOffset = metrics->mViewportScrollOffset;
|
||||
nsIntPoint metricsScrollOffset(0, 0);
|
||||
if (metrics.IsScrollable())
|
||||
metricsScrollOffset = metrics.mViewportScrollOffset;
|
||||
|
||||
nsIntPoint scrollCompensation(
|
||||
(mScrollOffset.x / tempScaleDiffX - metricsScrollOffset.x) * mXScale,
|
||||
(mScrollOffset.y / tempScaleDiffY - metricsScrollOffset.y) * mYScale);
|
||||
ViewTransform treeTransform(-scrollCompensation, mXScale, mYScale);
|
||||
shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
|
||||
|
||||
// Alter the scroll offset so that fixed position layers remain within
|
||||
// the page area.
|
||||
int offsetX = NS_MAX(0, NS_MIN(mScrollOffset.x, mContentRect.width - mWidgetSize.width));
|
||||
int offsetY = NS_MAX(0, NS_MIN(mScrollOffset.y, mContentRect.height - mWidgetSize.height));
|
||||
gfxPoint reverseViewTranslation(offsetX / tempScaleDiffX - metricsScrollOffset.x,
|
||||
offsetY / tempScaleDiffY - metricsScrollOffset.y);
|
||||
|
||||
TranslateFixedLayers(layer, reverseViewTranslation);
|
||||
} else {
|
||||
ViewTransform treeTransform(nsIntPoint(0,0), mXScale, mYScale);
|
||||
shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
|
||||
}
|
||||
nsIntPoint scrollCompensation(
|
||||
(mScrollOffset.x / tempScaleDiffX - metricsScrollOffset.x) * mXScale,
|
||||
(mScrollOffset.y / tempScaleDiffY - metricsScrollOffset.y) * mYScale);
|
||||
ViewTransform treeTransform(-scrollCompensation, mXScale, mYScale);
|
||||
shadow->SetShadowTransform(gfx3DMatrix(treeTransform) * currentTransform);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче