Reviewed by Maciej Stachowiak.
- fix http://bugs.webkit.org/show_bug.cgi?id=15943
-webkit-transform matrix does not work
Test: fast/transforms/matrix-01.html
Parse all six matrix entries as numbers.
* css/CSSParser.cpp:
(WebCore::TransformOperationInfo::TransformOperationInfo):
(WebCore::CSSParser::parseTransform):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/RenderStyle.cpp:
(WebCore::MatrixTransformOperation::blend):
* rendering/RenderStyle.h:
(WebCore::MatrixTransformOperation::MatrixTransformOperation):
(WebCore::MatrixTransformOperation::apply):
LayoutTests:
Reviewed by Maciej Stachowiak.
- pixel test for http://bugs.webkit.org/show_bug.cgi?id=15943
-webkit-transform matrix does not work
* fast/transforms/matrix-01.html: Added.
* platform/mac/fast/transforms/matrix-01-expected.checksum: Added.
* platform/mac/fast/transforms/matrix-01-expected.png: Added.
* platform/mac/fast/transforms/matrix-01-expected.txt: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27978
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-22 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - pixel test for http://bugs.webkit.org/show_bug.cgi?id=15943
+ -webkit-transform matrix does not work
+
+ * fast/transforms/matrix-01.html: Added.
+ * platform/mac/fast/transforms/matrix-01-expected.checksum: Added.
+ * platform/mac/fast/transforms/matrix-01-expected.png: Added.
+ * platform/mac/fast/transforms/matrix-01-expected.txt: Added.
+
2007-11-22 Julien Chaffraix <julien.chaffraix@gmail.com>
Reviewed by Alexey.
--- /dev/null
+<head>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ -webkit-transform-origin: 0 0;
+ background-color: skyblue;
+ border: 5px solid black;
+ }
+ .matrix { -webkit-transform: rotate(-30deg) matrix(.866, .5, -.5, .866, 0, 0); }
+</style>
+</head>
+<body>
+ <div class="matrix"></div>
+</body>
--- /dev/null
+98c0236866e23a68f0cee5440380d146
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+layer at (8,8) size 110x110
+ RenderBlock {DIV} at (0,0) size 110x110 [bgcolor=#87CEEB] [border: (5px solid #000000)]
+2007-11-22 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15943
+ -webkit-transform matrix does not work
+
+ Test: fast/transforms/matrix-01.html
+
+ Parse all six matrix entries as numbers.
+
+ * css/CSSParser.cpp:
+ (WebCore::TransformOperationInfo::TransformOperationInfo):
+ (WebCore::CSSParser::parseTransform):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ * rendering/RenderStyle.cpp:
+ (WebCore::MatrixTransformOperation::blend):
+ * rendering/RenderStyle.h:
+ (WebCore::MatrixTransformOperation::MatrixTransformOperation):
+ (WebCore::MatrixTransformOperation::apply):
+
2007-11-22 Laszlo Gombos <laszlo.gombos@gmail.com>
Reviewed by Alp Toker.
} else if (fname == "matrix(") {
m_type = CSSTransformValue::MatrixTransformOperation;
m_argCount = 11;
- m_unit = CSSParser::FLength;
+ m_unit = CSSParser::FNumber;
}
if (fname == "scale(" || fname == "skew(" || fname == "translate(") {
Value* a = args->current();
unsigned argNumber = 0;
while (a) {
- bool strictParsing = true;
CSSParser::Units unit = info.unit();
- if (info.type() == CSSTransformValue::MatrixTransformOperation) {
- // We use lax parsing for matrix(), since we want to allow raw numbers to be converted to fixed lengths.
- strictParsing = false;
-
- // Allow percents in the last two spots of matrix().
- if (argNumber >= 4)
- unit = (unit | CSSParser::FPercent);
- }
- if (!validUnit(a, unit, strictParsing))
+ if (!validUnit(a, unit, true))
return 0;
// Add the value to the current transform operation.
CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(values->item(3));
CSSPrimitiveValue* fifthValue = static_cast<CSSPrimitiveValue*>(values->item(4));
CSSPrimitiveValue* sixthValue = static_cast<CSSPrimitiveValue*>(values->item(5));
- bool ok;
- MatrixTransformOperation* matrix = new MatrixTransformOperation(convertToLength(firstValue, style, &ok),
- convertToLength(secondValue, style, &ok),
- convertToLength(thirdValue, style, &ok),
- convertToLength(fourthValue, style, &ok),
- convertToLength(fifthValue, style, &ok),
- convertToLength(sixthValue, style, &ok));
+ MatrixTransformOperation* matrix = new MatrixTransformOperation(firstValue->getDoubleValue(),
+ secondValue->getDoubleValue(),
+ thirdValue->getDoubleValue(),
+ fourthValue->getDoubleValue(),
+ fifthValue->getDoubleValue(),
+ sixthValue->getDoubleValue());
operations.append(matrix);
break;
}
return this;
if (blendToIdentity)
- return new MatrixTransformOperation(Length(1, m_a.type()).blend(m_a, progress),
- Length(0, m_b.type()).blend(m_b, progress),
- Length(0, m_c.type()).blend(m_c, progress),
- Length(1, m_d.type()).blend(m_d, progress),
- Length(0, m_e.type()).blend(m_e, progress),
- Length(0, m_f.type()).blend(m_f, progress));
+ return new MatrixTransformOperation(m_a * (1. - progress) + progress,
+ m_b * (1. - progress),
+ m_c * (1. - progress),
+ m_d * (1. - progress) + progress,
+ m_e * (1. - progress),
+ m_f * (1. - progress));
const MatrixTransformOperation* fromOp = static_cast<const MatrixTransformOperation*>(from);
- Length fromA = fromOp ? fromOp->m_a : Length(1, m_a.type());
- Length fromB = fromOp ? fromOp->m_b : Length(0, m_b.type());
- Length fromC = fromOp ? fromOp->m_c : Length(0, m_c.type());
- Length fromD = fromOp ? fromOp->m_d : Length(1, m_d.type());
- Length fromE = fromOp ? fromOp->m_e : Length(0, m_e.type());
- Length fromF = fromOp ? fromOp->m_f : Length(0, m_f.type());
+ double fromA = fromOp ? fromOp->m_a : 1.;
+ double fromB = fromOp ? fromOp->m_b : 0;
+ double fromC = fromOp ? fromOp->m_c : 0;
+ double fromD = fromOp ? fromOp->m_d : 1.;
+ double fromE = fromOp ? fromOp->m_e : 0;
+ double fromF = fromOp ? fromOp->m_f : 0;
- return new MatrixTransformOperation(m_a.blend(fromA, progress),
- m_b.blend(fromB, progress),
- m_c.blend(fromC, progress),
- m_d.blend(fromD, progress),
- m_e.blend(fromE, progress),
- m_f.blend(fromF, progress));
+ return new MatrixTransformOperation(fromA + (m_a - fromA) * progress,
+ fromB + (m_b - fromB) * progress,
+ fromC + (m_c - fromC) * progress,
+ fromD + (m_d - fromD) * progress,
+ fromE + (m_e - fromE) * progress,
+ fromF + (m_f - fromF) * progress);
}
Transition::Transition()
class MatrixTransformOperation : public TransformOperation
{
public:
- MatrixTransformOperation(const Length& a, const Length& b, const Length& c, const Length& d, const Length& e, const Length& f)
+ MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
: m_a(a), m_b(b), m_c(c), m_d(d), m_e(e), m_f(f)
{}
virtual void apply(AffineTransform& transform, const IntSize& borderBoxSize)
{
- AffineTransform matrix(m_a.value(), m_b.value(), m_c.value(), m_d.value(), m_e.calcValue(borderBoxSize.width()), m_f.calcValue(borderBoxSize.height()));
+ AffineTransform matrix(m_a, m_b, m_c, m_d, m_e, m_f);
transform.multiply(matrix);
}
virtual TransformOperation* blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
private:
- Length m_a;
- Length m_b;
- Length m_c;
- Length m_d;
- Length m_e;
- Length m_f;
+ double m_a;
+ double m_b;
+ double m_c;
+ double m_d;
+ double m_e;
+ double m_f;
};
class TransformOperations