Backed out changeset aab6b12f4a2b (Bug 455403) due to reftest failures from landing patches in the wrong order, and unexplained reftest hangs.

This commit is contained in:
L. David Baron 2008-09-19 16:04:34 -07:00
Родитель d0300d2843
Коммит eacac09939
8 изменённых файлов: 56 добавлений и 141 удалений

Просмотреть файл

@ -52,9 +52,9 @@
* A matrix that represents an affine transformation. Projective
* transformations are not supported. This matrix looks like:
*
* / a b 0 \
* | c d 0 |
* \ tx ty 1 /
* / a b tx \
* | c d ty |
* \ 0 0 1 /
*
* So, transforming a point (x, y) results in:
*

Просмотреть файл

@ -1,31 +0,0 @@
<html>
<head>
<style type="text/css">
div.test
{
background-color: gold;
width:200px;
height:100px;
border: 1px solid black;
}
div
{
-moz-transform-origin: top left;
}
</style>
</head>
<body>
<div style="position:relative; left:400px; top:200px;">
<div style="-moz-transform: skew(45deg);">
<div style="-moz-transform: rotate(90deg);">
<div style="-moz-transform: scale(2);">
<div style="-moz-transform: translate(100px);">
<div class="test">
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,31 +0,0 @@
<html>
<head>
<style type="text/css">
div.test
{
background-color: gold;
width:200px;
height:100px;
border: 1px solid black;
}
div
{
-moz-transform-origin: top left;
}
</style>
</head>
<body>
<div style="position:relative; left:400px; top:200px;">
<div style="-moz-transform: translate(100px);">
<div style="-moz-transform: scale(2);">
<div style="-moz-transform: rotate(90deg);">
<div style="-moz-transform: skew(45deg);">
<div class="test">
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,23 +0,0 @@
<html>
<head>
<style type="text/css">
div.test
{
background-color: gold;
width:200px;
height:100px;
border: 1px solid black;
}
div
{
-moz-transform-origin: top left;
}
</style>
</head>
<body>
<div style="position:relative; left:400px; top:200px;">
<div class="test" style="-moz-transform: translate(100px) scale(2) rotate(90deg) skew(45deg);">
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,6 +1,3 @@
# Multiple transforms should act identically to nested divs.
== compound-1a.html compound-1-ref.html
!= compound-1a.html compound-1-fail.html
# translatex should act like position: relative
== translatex-1a.html translatex-1-ref.html
random == translatex-1b.html translatex-1-ref.html # bug 455138
@ -38,16 +35,14 @@ random == translate-1b.html translate-1-ref.html # bug 455138
== origin-2a.html origin-2-ref.html
== origin-2b.html origin-2-ref.html
== origin-2c.html origin-2-ref.html
# "Translate" with percentages should be indistinguishable from translate with
# equivalent values. This entire family of reftests has subpixel rounding
# errors, however, and so they're marked "random" until a resolution is found.
random == percent-1a.html percent-1-ref.html
random == percent-1b.html percent-1-ref.html
random == percent-1c.html percent-1-ref.html
# translate with percentages should be indistinguishable from translate with equivalent values.
== percent-1a.html percent-1-ref.html
== percent-1b.html percent-1-ref.html
== percent-1c.html percent-1-ref.html
random == percent-1d.html percent-1-ref.html # bug 455138
random == percent-1e.html percent-1-ref.html # bug 455138
random == percent-1f.html percent-1-ref.html # bug 455138
random == percent-1g.html percent-1-ref.html
== percent-1g.html percent-1-ref.html
# Transformed elements are abs-pos and fixed-pos containing blocks.
== abspos-1a.html abspos-1-ref.html
== abspos-1b.html abspos-1-ref.html

Просмотреть файл

@ -2,7 +2,7 @@
<head>
</head>
<body>
<div style="width:100px;height:200px;-moz-transform: translate(50px, -50px) rotate(-90deg); border: 1px solid black;">
<div style="width:100px;height:200px;-moz-transform: rotate(-90deg) translate(50px, -50px); border: 1px solid black;">
</div>
</body>

Просмотреть файл

@ -135,8 +135,18 @@ nscoord nsStyleTransformMatrix::GetYTranslation(const nsRect& aBounds) const
gfxMatrix nsStyleTransformMatrix::GetThebesMatrix(const nsRect& aBounds,
PRInt32 aScale) const
{
/* Compute the graphics matrix. We take the stored main elements, along with
* the delta, and add in the matrices:
/* Compute the graphics matrix. Unfortunately, the gfxMatrix stores entries
* as
* | a b e |
* | c d f |
* | 0 0 1 |
* But we store the matrix as
* | a c e |
* | b d f |
* | 0 0 1 |
* So, we'll have to be a bit clever about how we do the conversion.
*
* Also, we need to be sure to add to this matrices the following:
*
* | 0 0 dx1|
* | 0 0 dx2| * width
@ -147,7 +157,7 @@ gfxMatrix nsStyleTransformMatrix::GetThebesMatrix(const nsRect& aBounds,
* | 0 0 0|
*/
return gfxMatrix(mMain[0], mMain[1], mMain[2], mMain[3],
return gfxMatrix(mMain[0], mMain[2], mMain[1], mMain[3],
NSAppUnitsToFloatPixels(GetXTranslation(aBounds), aScale),
NSAppUnitsToFloatPixels(GetYTranslation(aBounds), aScale));
}
@ -167,25 +177,27 @@ nsStyleTransformMatrix::operator *= (const nsStyleTransformMatrix &aOther)
float newX[2];
float newY[2];
/* [this] [aOther]
/* [aOther] [this]
* |a1 c1 e1| |a0 c0 e0| |a0a1 + b0c1 c0a1 + d0c1 e0a1 + f0c1 + e1|
* |b1 d1 f1|x|b0 d0 f0| = |a0b1 + b0d1 c0b1 + d0d1 e0b1 + f0d1 + f1|
* |0 0 1 | | 0 0 1| | 0 0 1|
*/
newMatrix[0] = aOther.mMain[0] * mMain[0] + aOther.mMain[1] * mMain[2];
newMatrix[1] = aOther.mMain[0] * mMain[1] + aOther.mMain[1] * mMain[3];
newMatrix[2] = aOther.mMain[2] * mMain[0] + aOther.mMain[3] * mMain[2];
newMatrix[3] = aOther.mMain[2] * mMain[1] + aOther.mMain[3] * mMain[3];
newMatrix[0] = mMain[0] * aOther.mMain[0] + mMain[1] * aOther.mMain[2];
newMatrix[1] = mMain[0] * aOther.mMain[1] + mMain[1] * aOther.mMain[3];
newMatrix[2] = mMain[2] * aOther.mMain[0] + mMain[3] * aOther.mMain[2];
newMatrix[3] = mMain[2] * aOther.mMain[1] + mMain[3] * aOther.mMain[3];
newDelta[0] =
NSCoordMultiply(aOther.mDelta[0], mMain[0]) +
NSCoordMultiply(aOther.mDelta[1], mMain[2]) + mDelta[0];
NSCoordMultiply(mDelta[0], aOther.mMain[0]) +
NSCoordMultiply(mDelta[1], aOther.mMain[2]) +
aOther.mDelta[0];
newDelta[1] =
NSCoordMultiply(aOther.mDelta[0], mMain[1]) +
NSCoordMultiply(aOther.mDelta[1], mMain[3]) + mDelta[1];
NSCoordMultiply(mDelta[0], aOther.mMain[1]) +
NSCoordMultiply(mDelta[1], aOther.mMain[3]) +
aOther.mDelta[1];
/* For consistent terminology, let u0, u1, v0, and v1 be the four transform
* coordinates from our matrix, and let x0, x1, y0, and y1 be the four
* transform coordinates from the other matrix. Then the new transform
* coordinates from the old matrix, and let x0, x1, y0, and y1 be the four
* transform coordinates from the new matrix. Then the new transform
* coordinates are:
*
* u0' = a1u0 + c1u1 + x0
@ -193,10 +205,10 @@ nsStyleTransformMatrix::operator *= (const nsStyleTransformMatrix &aOther)
* v0' = a1v0 + c1v1 + y0
* v1' = b1v0 + d1v1 + y1
*/
newX[0] = mMain[0] * aOther.mX[0] + mMain[2] * aOther.mX[1] + mX[0];
newX[1] = mMain[1] * aOther.mX[0] + mMain[3] * aOther.mX[1] + mX[1];
newY[0] = mMain[0] * aOther.mY[0] + mMain[2] * aOther.mY[1] + mY[0];
newY[1] = mMain[1] * aOther.mY[0] + mMain[3] * aOther.mY[1] + mY[1];
newX[0] = aOther.mMain[0] * mX[0] + aOther.mMain[2] * mX[1] + aOther.mX[0];
newX[1] = aOther.mMain[1] * mX[0] + aOther.mMain[3] * mX[1] + aOther.mX[1];
newY[0] = aOther.mMain[0] * mY[0] + aOther.mMain[2] * mY[1] + aOther.mY[0];
newY[1] = aOther.mMain[1] * mY[0] + aOther.mMain[3] * mY[1] + aOther.mY[1];
/* Now, write everything back in. */
for (PRInt32 index = 0; index < 4; ++index)
@ -389,14 +401,14 @@ static void ProcessScale(float aMain[4], const nsCSSValue::Array* aData)
static void ProcessSkewHelper(float aXAngle, float aYAngle, float aMain[4])
{
/* We want our matrix to look like this:
* | 1 tan(ThetaX) 0|
* | tan(ThetaY) 1 0|
* | 1 tan(ThetaY) 0|
* | tan(ThetaX) 1 0|
* | 0 0 1|
* However, to avoid infinte values, we'll use the SafeTangent function
* instead of the C standard tan function.
*/
aMain[2] = SafeTangent(aXAngle);
aMain[1] = SafeTangent(aYAngle);
aMain[1] = SafeTangent(aXAngle);
aMain[2] = SafeTangent(aYAngle);
}
/* Function that converts a skewx transform into a matrix. */
@ -433,6 +445,10 @@ static void ProcessRotate(float aMain[4], const nsCSSValue::Array* aData)
* | cos(theta) -sin(theta) 0|
* | sin(theta) cos(theta) 0|
* | 0 0 1|
* However, there's a bit of a problem - our coordinate system has Y
* increasing downward. Thus we will rotate by -theta
* degrees. Thus:
* A = cos(theta), B = -sin(theta), C = sin(theta), D = cos(theta)
* (see http://www.w3.org/TR/SVG/coords.html#RotationDefined)
*/
float theta = CSSToRadians(aData->Item(1));
@ -440,8 +456,8 @@ static void ProcessRotate(float aMain[4], const nsCSSValue::Array* aData)
float sinTheta = sin(theta);
aMain[0] = cosTheta;
aMain[1] = sinTheta;
aMain[2] = -sinTheta;
aMain[1] = -sinTheta;
aMain[2] = sinTheta;
aMain[3] = cosTheta;
}

Просмотреть файл

@ -49,16 +49,7 @@
* A class representing a style transformation matrix. The class actually
* wraps three different matrices, a constant matrix and two matrices
* whose values are scaled by the width and the height of the bounding
* rectangle for the object to transform. Thus, given a frame rectangle
* of dimensions (width, height) and a point (x, y) to transform, the matrix
* corresponds to the transform operation
*
* | a c e | |0 0 dX1| |0 0 dY1| | x |
*(| b d f | + |0 0 dX2| (width) + |0 0 dY2| (height)) | y |
* | 0 0 1 | |0 0 0| |0 0 0| | 1 |
*
* Note that unlike the Thebes gfxMatrix, vectors are column vectors and
* consequently the multiplication of a matrix A and a vector x is Ax, not xA.
* rectangle for the object to transform.
*/
class nsStyleContext;
class nsPresContext;
@ -84,9 +75,8 @@ class nsStyleTransformMatrix
gfxMatrix GetThebesMatrix(const nsRect& aBounds, PRInt32 aFactor) const;
/**
* Multiplies this matrix by another matrix, in that order. If A'
* is the value of A after A *= B, then for any vector x, the
* equivalence A'(x) == A(B(x)) holds.
* Multiplies this matrix by another matrix. The multiplication is
* a post-multiplication, so A *= B updates this matrix to be BA.
*
* @param aOther The matrix to multiply this matrix by.
* @return A reference to this matrix.
@ -94,13 +84,12 @@ class nsStyleTransformMatrix
nsStyleTransformMatrix& operator *= (const nsStyleTransformMatrix &aOther);
/**
* Returns a new nsStyleTransformMatrix that is equal to one matrix
* multiplied by another matrix, in that order. If C is the result of
* A * B, then for any vector x, the equivalence C(x) = A(B(x)).
* Returns a new nsStyleTransformMatrix that's equal to this matrix
* post-multiplied with another matrix.
*
* @param aOther The matrix to multiply this matrix by.
* @return A new nsStyleTransformMatrix equal to this matrix multiplied
* by the other matrix.
* @return A new nsStyleTransformMatrix equal to this matrix postmultiplied
* with the other matrix.
*/
const nsStyleTransformMatrix
operator * (const nsStyleTransformMatrix &aOther) const;