Commit 356b4e99 authored by hyatt's avatar hyatt

Clean up matrix() parsing. Make sure the first four arguments can be...

        Clean up matrix() parsing.  Make sure the first four arguments can be lengths or numbers.  The last two
        args can be lengths or numbers or percents.

        Reviewed by Beth

        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSParser.cpp:
        (WebCore::TransformOperationInfo::TransformOperationInfo):
        (WebCore::CSSParser::parseTransform):
        * rendering/RenderStyle.h:
        (WebCore::MatrixTransformOperation::apply):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 58730d7c
2007-11-09 David Hyatt <hyatt@apple.com>
Clean up matrix() parsing. Make sure the first four arguments can be lengths or numbers. The last two
args can be lengths or numbers or percents.
Reviewed by Beth
* WebCore.xcodeproj/project.pbxproj:
* css/CSSParser.cpp:
(WebCore::TransformOperationInfo::TransformOperationInfo):
(WebCore::CSSParser::parseTransform):
* rendering/RenderStyle.h:
(WebCore::MatrixTransformOperation::apply):
2007-11-09 Beth Dakin <bdakin@apple.com>
Reviewed by Oliver.
......
......@@ -3325,7 +3325,7 @@ public:
} else if (fname == "matrix(") {
m_type = CSSTransformValue::MatrixTransformOperation;
m_argCount = 11;
m_unit = CSSParser::FNumber;
m_unit = CSSParser::FLength;
}
if (fname == "scale(" || fname == "skew(" || fname == "translate(") {
......@@ -3380,8 +3380,20 @@ PassRefPtr<CSSValue> CSSParser::parseTransform()
// Snag our values.
Value* a = args->current();
unsigned argNumber = 0;
while (a) {
if (!validUnit(a, info.unit(), true)) // Always parse strictly, since this is a newer property, so there's no reason to be lax.
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))
return 0;
// Add the value to the current transform operation.
......@@ -3393,6 +3405,8 @@ PassRefPtr<CSSValue> CSSParser::parseTransform()
if (a->unit != Value::Operator || a->iValue != ',')
return 0;
a = args->next();
argNumber++;
}
}
......
......@@ -786,7 +786,7 @@ public:
virtual void apply(AffineTransform& transform, const IntSize& borderBoxSize)
{
AffineTransform matrix(m_a.calcValue(1), m_b.calcValue(1), m_c.calcValue(1), m_d.calcValue(1), m_e.calcValue(borderBoxSize.width()), m_f.calcValue(borderBoxSize.height()));
AffineTransform matrix(m_a.value(), m_b.value(), m_c.value(), m_d.value(), m_e.calcValue(borderBoxSize.width()), m_f.calcValue(borderBoxSize.height()));
transform.multiply(matrix);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment