Bug 456163 - Singular matrices with -moz-transform hangs reftests; r+sr=roc

This commit is contained in:
Keith Schwarz 2008-09-22 22:27:37 +02:00
parent 34f7c387e2
commit 26d8115686
3 changed files with 25 additions and 20 deletions

View File

@ -1090,32 +1090,24 @@ void nsDisplayTransform::Paint(nsDisplayListBuilder *aBuilder,
nsIRenderingContext *aCtx,
const nsRect &aDirtyRect)
{
/* Here's how this is going to work:
* 1. Convert the stored transform matrix into a gfxMatrix
* 2. Read out the old graphics matrix.
* 3. Compute the net graphics matrix at this point.
* 4. Set that as the active matrix.
* 5. Apply the inverse transform to the dirty rect so that children think
* they're drawing in local space.
* 6. Render everything.
* 7. Reset the matrix.
/* Get the local transform matrix with which we'll transform all wrapped
* elements. If this matrix is singular, we shouldn't display anything
* and can abort.
*/
gfxMatrix newTransformMatrix =
GetResultingTransformMatrix(mFrame, aBuilder->ToReferenceFrame(mFrame),
mFrame->PresContext()->AppUnitsPerDevPixel(),
nsnull);
if (newTransformMatrix.IsSingular())
return;
/* Get the context and automatically save and restore it. */
gfxContext* gfx = aCtx->ThebesContext();
gfxContextAutoSaveRestore autoRestorer(gfx);
/* Unit conversion is based on the local presentation context. */
float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
/* Compute the new matrix by taking the old matrix and multiplying the
* transform matrix of this frame only. The new transform is prepended to
* the old transform, since that way, if we have several stacked transforms,
* the innermost transform is applied first.
/* Get the new CTM by applying this transform after all of the
* transforms preceding it.
*/
gfxMatrix newTransformMatrix =
GetResultingTransformMatrix(mFrame, aBuilder->ToReferenceFrame(mFrame),
factor, nsnull);
newTransformMatrix.Multiply(gfx->CurrentMatrix());
/* Set the matrix for the transform based on the old matrix and the new

View File

@ -1,3 +1,7 @@
# Transforms specifying singular matrices shouldn't display at all.
# NOTE: Regressions might manifest themselves as reftest timeouts on
# this test.
== singular-1a.html about:blank
# Multiple transforms should act identically to nested divs.
== compound-1a.html compound-1-ref.html
!= compound-1a.html compound-1-fail.html

View File

@ -0,0 +1,9 @@
<html>
<head>
</head>
<body>
<div style="-moz-transform: matrix(1, 1, 1, 1, 0, 0); width: 100px; height: 100px; background-color: gold;">
This shouldn't be visible.
</div>
</body>
</html>