Changeset 27978 in webkit


Ignore:
Timestamp:
Nov 22, 2007 8:11:09 PM (16 years ago)
Author:
mitz@apple.com
Message:

WebCore:

Reviewed by Maciej Stachowiak.

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.

  • 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.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r27970 r27978  
     12007-11-22  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        - pixel test for http://bugs.webkit.org/show_bug.cgi?id=15943
     6          -webkit-transform matrix does not work
     7
     8        * fast/transforms/matrix-01.html: Added.
     9        * platform/mac/fast/transforms/matrix-01-expected.checksum: Added.
     10        * platform/mac/fast/transforms/matrix-01-expected.png: Added.
     11        * platform/mac/fast/transforms/matrix-01-expected.txt: Added.
     12
    1132007-11-22  Julien Chaffraix  <julien.chaffraix@gmail.com>
    214
  • trunk/WebCore/ChangeLog

    r27973 r27978  
     12007-11-22  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=15943
     6          -webkit-transform matrix does not work
     7
     8        Test: fast/transforms/matrix-01.html
     9
     10        Parse all six matrix entries as numbers.
     11
     12        * css/CSSParser.cpp:
     13        (WebCore::TransformOperationInfo::TransformOperationInfo):
     14        (WebCore::CSSParser::parseTransform):
     15        * css/CSSStyleSelector.cpp:
     16        (WebCore::CSSStyleSelector::applyProperty):
     17        * rendering/RenderStyle.cpp:
     18        (WebCore::MatrixTransformOperation::blend):
     19        * rendering/RenderStyle.h:
     20        (WebCore::MatrixTransformOperation::MatrixTransformOperation):
     21        (WebCore::MatrixTransformOperation::apply):
     22
    1232007-11-22  Laszlo Gombos  <laszlo.gombos@gmail.com>
    224
  • trunk/WebCore/css/CSSParser.cpp

    r27650 r27978  
    33263326            m_type = CSSTransformValue::MatrixTransformOperation;
    33273327            m_argCount = 11;
    3328             m_unit = CSSParser::FLength;
     3328            m_unit = CSSParser::FNumber;
    33293329        }
    33303330       
     
    33833383        unsigned argNumber = 0;
    33843384        while (a) {
    3385             bool strictParsing = true;
    33863385            CSSParser::Units unit = info.unit();
    3387             if (info.type() == CSSTransformValue::MatrixTransformOperation) {
    3388                 // We use lax parsing for matrix(), since we want to allow raw numbers to be converted to fixed lengths.
    3389                 strictParsing = false;
    3390                
    3391                 // Allow percents in the last two spots of matrix().
    3392                 if (argNumber >= 4)
    3393                     unit = (unit | CSSParser::FPercent);
    3394             }
    3395 
    3396             if (!validUnit(a, unit, strictParsing))
     3386
     3387            if (!validUnit(a, unit, true))
    33973388                return 0;
    33983389           
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r27951 r27978  
    39783978                        CSSPrimitiveValue* fifthValue = static_cast<CSSPrimitiveValue*>(values->item(4));
    39793979                        CSSPrimitiveValue* sixthValue = static_cast<CSSPrimitiveValue*>(values->item(5));
    3980                         bool ok;
    3981                         MatrixTransformOperation* matrix = new MatrixTransformOperation(convertToLength(firstValue, style, &ok),
    3982                                                                                         convertToLength(secondValue, style, &ok),
    3983                                                                                         convertToLength(thirdValue, style, &ok),
    3984                                                                                         convertToLength(fourthValue, style, &ok),
    3985                                                                                         convertToLength(fifthValue, style, &ok),
    3986                                                                                         convertToLength(sixthValue, style, &ok));
     3980                        MatrixTransformOperation* matrix = new MatrixTransformOperation(firstValue->getDoubleValue(),
     3981                                                                                        secondValue->getDoubleValue(),
     3982                                                                                        thirdValue->getDoubleValue(),
     3983                                                                                        fourthValue->getDoubleValue(),
     3984                                                                                        fifthValue->getDoubleValue(),
     3985                                                                                        sixthValue->getDoubleValue());
    39873986                        operations.append(matrix);
    39883987                        break;
  • trunk/WebCore/rendering/RenderStyle.cpp

    r27951 r27978  
    514514   
    515515    if (blendToIdentity)
    516         return new MatrixTransformOperation(Length(1, m_a.type()).blend(m_a, progress),
    517                                             Length(0, m_b.type()).blend(m_b, progress),
    518                                             Length(0, m_c.type()).blend(m_c, progress),
    519                                             Length(1, m_d.type()).blend(m_d, progress),
    520                                             Length(0, m_e.type()).blend(m_e, progress),
    521                                             Length(0, m_f.type()).blend(m_f, progress));
     516        return new MatrixTransformOperation(m_a * (1. - progress) + progress,
     517                                            m_b * (1. - progress),
     518                                            m_c * (1. - progress),
     519                                            m_d * (1. - progress) + progress,
     520                                            m_e * (1. - progress),
     521                                            m_f * (1. - progress));
    522522
    523523    const MatrixTransformOperation* fromOp = static_cast<const MatrixTransformOperation*>(from);
    524     Length fromA = fromOp ? fromOp->m_a : Length(1, m_a.type());
    525     Length fromB = fromOp ? fromOp->m_b : Length(0, m_b.type());
    526     Length fromC = fromOp ? fromOp->m_c : Length(0, m_c.type());
    527     Length fromD = fromOp ? fromOp->m_d : Length(1, m_d.type());
    528     Length fromE = fromOp ? fromOp->m_e : Length(0, m_e.type());
    529     Length fromF = fromOp ? fromOp->m_f : Length(0, m_f.type());
    530    
    531     return new MatrixTransformOperation(m_a.blend(fromA, progress),
    532                                         m_b.blend(fromB, progress),
    533                                         m_c.blend(fromC, progress),
    534                                         m_d.blend(fromD, progress),
    535                                         m_e.blend(fromE, progress),
    536                                         m_f.blend(fromF, progress));
     524    double fromA = fromOp ? fromOp->m_a : 1.;
     525    double fromB = fromOp ? fromOp->m_b : 0;
     526    double fromC = fromOp ? fromOp->m_c : 0;
     527    double fromD = fromOp ? fromOp->m_d : 1.;
     528    double fromE = fromOp ? fromOp->m_e : 0;
     529    double fromF = fromOp ? fromOp->m_f : 0;
     530   
     531    return new MatrixTransformOperation(fromA + (m_a - fromA) * progress,
     532                                        fromB + (m_b - fromB) * progress,
     533                                        fromC + (m_c - fromC) * progress,
     534                                        fromD + (m_d - fromD) * progress,
     535                                        fromE + (m_e - fromE) * progress,
     536                                        fromF + (m_f - fromF) * progress);
    537537}
    538538
  • trunk/WebCore/rendering/RenderStyle.h

    r27776 r27978  
    770770{
    771771public:
    772     MatrixTransformOperation(const Length& a, const Length& b, const Length& c, const Length& d, const Length& e, const Length& f)
     772    MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
    773773    : m_a(a), m_b(b), m_c(c), m_d(d), m_e(e), m_f(f)
    774774    {}
     
    787787    virtual void apply(AffineTransform& transform, const IntSize& borderBoxSize)
    788788    {
    789         AffineTransform matrix(m_a.value(), m_b.value(), m_c.value(), m_d.value(), m_e.calcValue(borderBoxSize.width()), m_f.calcValue(borderBoxSize.height()));
     789        AffineTransform matrix(m_a, m_b, m_c, m_d, m_e, m_f);
    790790        transform.multiply(matrix);
    791791    }
     
    794794   
    795795private:
    796     Length m_a;
    797     Length m_b;
    798     Length m_c;
    799     Length m_d;
    800     Length m_e;
    801     Length m_f;
     796    double m_a;
     797    double m_b;
     798    double m_c;
     799    double m_d;
     800    double m_e;
     801    double m_f;
    802802};
    803803
Note: See TracChangeset for help on using the changeset viewer.