Bug 931028. Transform matrices when used for painting related things should be in dev pixels and not CSS pixels. r=mattwoodrow

This commit is contained in:
Timothy Nikkel 2014-01-19 17:30:36 -06:00
parent bb6f46baf1
commit b2654ec621

View File

@ -4408,7 +4408,7 @@ bool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,
* think that it's painting in its original rectangular coordinate space. * think that it's painting in its original rectangular coordinate space.
* If we can't untransform, take the entire overflow rect */ * If we can't untransform, take the entire overflow rect */
nsRect untransformedVisibleRect; nsRect untransformedVisibleRect;
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
if (ShouldPrerenderTransformedContent(aBuilder, mFrame) || if (ShouldPrerenderTransformedContent(aBuilder, mFrame) ||
!UntransformRectMatrix(mVisibleRect, !UntransformRectMatrix(mVisibleRect,
GetTransform(factor), GetTransform(factor),
@ -4442,7 +4442,7 @@ void nsDisplayTransform::HitTest(nsDisplayListBuilder *aBuilder,
* 3. Use it to transform the rect into the correct space. * 3. Use it to transform the rect into the correct space.
* 4. Pass that rect down through to the list's version of HitTest. * 4. Pass that rect down through to the list's version of HitTest.
*/ */
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
gfx3DMatrix matrix = GetTransform(factor); gfx3DMatrix matrix = GetTransform(factor);
if (!IsFrameVisible(mFrame, matrix)) { if (!IsFrameVisible(mFrame, matrix)) {
@ -4501,7 +4501,7 @@ void nsDisplayTransform::HitTest(nsDisplayListBuilder *aBuilder,
float float
nsDisplayTransform::GetHitDepthAtPoint(const nsPoint& aPoint) nsDisplayTransform::GetHitDepthAtPoint(const nsPoint& aPoint)
{ {
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
gfx3DMatrix matrix = GetTransform(factor); gfx3DMatrix matrix = GetTransform(factor);
NS_ASSERTION(IsFrameVisible(mFrame, matrix), "We can't have hit a frame that isn't visible!"); NS_ASSERTION(IsFrameVisible(mFrame, matrix), "We can't have hit a frame that isn't visible!");
@ -4524,7 +4524,7 @@ nsRect nsDisplayTransform::GetBounds(nsDisplayListBuilder *aBuilder, bool* aSnap
mFrame->GetVisualOverflowRectRelativeToSelf() : mFrame->GetVisualOverflowRectRelativeToSelf() :
mStoredList.GetBounds(aBuilder, aSnap); mStoredList.GetBounds(aBuilder, aSnap);
*aSnap = false; *aSnap = false;
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
return nsLayoutUtils::MatrixTransformRect(untransformedBounds, return nsLayoutUtils::MatrixTransformRect(untransformedBounds,
GetTransform(factor), GetTransform(factor),
factor); factor);
@ -4551,7 +4551,7 @@ nsRegion nsDisplayTransform::GetOpaqueRegion(nsDisplayListBuilder *aBuilder,
{ {
*aSnap = false; *aSnap = false;
nsRect untransformedVisible; nsRect untransformedVisible;
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
// If we're going to prerender all our content, pretend like we // If we're going to prerender all our content, pretend like we
// don't have opqaue content so that everything under us is rendered // don't have opqaue content so that everything under us is rendered
// as well. That will increase graphics memory usage if our frame // as well. That will increase graphics memory usage if our frame
@ -4563,7 +4563,7 @@ nsRegion nsDisplayTransform::GetOpaqueRegion(nsDisplayListBuilder *aBuilder,
return nsRegion(); return nsRegion();
} }
const gfx3DMatrix& matrix = GetTransform(nsPresContext::AppUnitsPerCSSPixel()); const gfx3DMatrix& matrix = GetTransform(factor);
nsRegion result; nsRegion result;
gfxMatrix matrix2d; gfxMatrix matrix2d;
@ -4583,11 +4583,11 @@ nsRegion nsDisplayTransform::GetOpaqueRegion(nsDisplayListBuilder *aBuilder,
bool nsDisplayTransform::IsUniform(nsDisplayListBuilder *aBuilder, nscolor* aColor) bool nsDisplayTransform::IsUniform(nsDisplayListBuilder *aBuilder, nscolor* aColor)
{ {
nsRect untransformedVisible; nsRect untransformedVisible;
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
if (!UntransformRectMatrix(mVisibleRect, GetTransform(factor), factor, &untransformedVisible)) { if (!UntransformRectMatrix(mVisibleRect, GetTransform(factor), factor, &untransformedVisible)) {
return false; return false;
} }
const gfx3DMatrix& matrix = GetTransform(nsPresContext::AppUnitsPerCSSPixel()); const gfx3DMatrix& matrix = GetTransform(factor);
gfxMatrix matrix2d; gfxMatrix matrix2d;
return matrix.Is2D(&matrix2d) && return matrix.Is2D(&matrix2d) &&
@ -4659,7 +4659,7 @@ nsRect nsDisplayTransform::TransformRect(const nsRect &aUntransformedBounds,
{ {
NS_PRECONDITION(aFrame, "Can't take the transform based on a null frame!"); NS_PRECONDITION(aFrame, "Can't take the transform based on a null frame!");
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = aFrame->PresContext()->AppUnitsPerDevPixel();
return nsLayoutUtils::MatrixTransformRect return nsLayoutUtils::MatrixTransformRect
(aUntransformedBounds, (aUntransformedBounds,
GetResultingTransformMatrix(aFrame, aOrigin, factor, aBoundsOverride), GetResultingTransformMatrix(aFrame, aOrigin, factor, aBoundsOverride),
@ -4673,7 +4673,7 @@ nsRect nsDisplayTransform::TransformRectOut(const nsRect &aUntransformedBounds,
{ {
NS_PRECONDITION(aFrame, "Can't take the transform based on a null frame!"); NS_PRECONDITION(aFrame, "Can't take the transform based on a null frame!");
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = aFrame->PresContext()->AppUnitsPerDevPixel();
return nsLayoutUtils::MatrixTransformRectOut return nsLayoutUtils::MatrixTransformRectOut
(aUntransformedBounds, (aUntransformedBounds,
GetResultingTransformMatrix(aFrame, aOrigin, factor, aBoundsOverride), GetResultingTransformMatrix(aFrame, aOrigin, factor, aBoundsOverride),
@ -4711,7 +4711,7 @@ bool nsDisplayTransform::UntransformRect(const nsRect &aUntransformedBounds,
/* Grab the matrix. If the transform is degenerate, just hand back the /* Grab the matrix. If the transform is degenerate, just hand back the
* empty rect. * empty rect.
*/ */
float factor = nsPresContext::AppUnitsPerCSSPixel(); float factor = aFrame->PresContext()->AppUnitsPerDevPixel();
gfx3DMatrix matrix = GetResultingTransformMatrix(aFrame, aOrigin, factor); gfx3DMatrix matrix = GetResultingTransformMatrix(aFrame, aOrigin, factor);
return UntransformRectMatrix(aUntransformedBounds, matrix, factor, aOutRect); return UntransformRectMatrix(aUntransformedBounds, matrix, factor, aOutRect);