Changeset 285255 in webkit


Ignore:
Timestamp:
Nov 4, 2021 1:51:14 AM (9 months ago)
Author:
Martin Robinson
Message:

implement transform: perspective(none)
https://bugs.webkit.org/show_bug.cgi?id=231361
<rdar://problem/84124161>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt:
  • web-platform-tests/css/css-transforms/parsing/transform-valid-expected.txt:

Source/WebCore:

Add support for perspective(none) and update test results
to show newly passing tests.

No new tests. This is covered by the existing WPT tests:

  • imported/w3c/web-platform-tests/css/css-transforms/parsing/transform-valid.html
  • imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-001.html
  • css/TransformFunctions.cpp:

(WebCore::transformsForValue): Accept a "none" keyword as an input and be a bit more stringent
about what kind of numbers are accepted. These should be rejected earlier in consumePerspective.
This can now hold an Undefined length which indicates perspective: none.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumePerspective): Accept "none" and clean up the code a little, using ValueRange
instead of a manual check for numerical values. Also make the code structure a little more
consistent.

  • platform/graphics/transforms/PerspectiveTransformOperation.h: Update assertion, because

Undefined means perpsective: none now.

  • platform/graphics/transforms/PerspectiveTransformOperation.cpp:

(WebCore::PerspectiveTransformOperation::blend): Handle the case of perspective: none for
either values.

LayoutTests:

  • platform/glib/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285253 r285255  
     12021-11-04  Martin Robinson  <mrobinson@webkit.org>
     2
     3        implement transform: perspective(none)
     4        https://bugs.webkit.org/show_bug.cgi?id=231361
     5        <rdar://problem/84124161>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * platform/glib/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt:
     10
    1112021-11-03  Arcady Goldmints-Orlov  <agoldmints@igalia.com>
    212
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r285235 r285255  
     12021-11-04  Martin Robinson  <mrobinson@webkit.org>
     2
     3        implement transform: perspective(none)
     4        https://bugs.webkit.org/show_bug.cgi?id=231361
     5        <rdar://problem/84124161>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt:
     10        * web-platform-tests/css/css-transforms/parsing/transform-valid-expected.txt:
     11
    1122021-11-03  Joonghun Park  <jh718.park@samsung.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt

    r282287 r285255  
    9292PASS Web Animations: property <transform> from [scaleZ(2)] to [scaleZ(2) perspective(500px)] at (1) should be [scaleZ(2) perspective(500px)]
    9393PASS Web Animations: property <transform> from [scaleZ(2)] to [scaleZ(2) perspective(500px)] at (2) should be [scaleZ(2) perspective(250px)]
    94 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    95 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    96 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    97 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    98 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
    99 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    100 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    101 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    102 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    103 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
    104 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    105 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    106 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    107 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    108 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
    109 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    110 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    111 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    112 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    113 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
     94PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     95PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     96PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     97PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     98PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
     99PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     100PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     101PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     102PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     103PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
     104PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     105PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     106PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     107PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     108PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
     109PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     110PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     111PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     112PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     113PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
    114114PASS CSS Transitions: property <transform> from [rotate(30deg)] to [rotate(330deg)] at (-1) should be [rotate(-270deg)]
    115115PASS CSS Transitions: property <transform> from [rotate(30deg)] to [rotate(330deg)] at (0) should be [rotate(30deg)]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/transform-valid-expected.txt

    r282144 r285255  
    3939PASS e.style['transform'] = "skewY(-90deg)" should set the property value
    4040PASS e.style['transform'] = "perspective(10px)" should set the property value
    41 FAIL e.style['transform'] = "perspective(none)" should set the property value assert_not_equals: property should be set got disallowed value ""
     41PASS e.style['transform'] = "perspective(none)" should set the property value
    4242PASS e.style['transform'] = "translate(1px, 2%) scale(3, 4) rotate(-90deg)" should set the property value
    4343
  • trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt

    r282420 r285255  
    9292PASS Web Animations: property <transform> from [scaleZ(2)] to [scaleZ(2) perspective(500px)] at (1) should be [scaleZ(2) perspective(500px)]
    9393PASS Web Animations: property <transform> from [scaleZ(2)] to [scaleZ(2) perspective(500px)] at (2) should be [scaleZ(2) perspective(250px)]
    94 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    95 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    96 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    97 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    98 FAIL CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
    99 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    100 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    101 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    102 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    103 FAIL CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
    104 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    105 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    106 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    107 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    108 FAIL CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
    109 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    110 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)] assert_true: 'from' value should be supported expected true got false
    111 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)] assert_true: 'from' value should be supported expected true got false
    112 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)] assert_true: 'from' value should be supported expected true got false
    113 FAIL Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)] assert_true: 'from' value should be supported expected true got false
     94PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     95PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     96PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     97PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     98PASS CSS Transitions: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
     99PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     100PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     101PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     102PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     103PASS CSS Transitions with transition: all: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
     104PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     105PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     106PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     107PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     108PASS CSS Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
     109PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (-1) should be [perspective(none)]
     110PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0) should be [perspective(none)]
     111PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (0.5) should be [perspective(1000px)]
     112PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (1) should be [perspective(500px)]
     113PASS Web Animations: property <transform> from [perspective(none)] to [perspective(500px)] at (2) should be [perspective(250px)]
    114114PASS CSS Transitions: property <transform> from [rotate(30deg)] to [rotate(330deg)] at (-1) should be [rotate(-270deg)]
    115115PASS CSS Transitions: property <transform> from [rotate(30deg)] to [rotate(330deg)] at (0) should be [rotate(30deg)]
  • trunk/Source/WebCore/ChangeLog

    r285254 r285255  
     12021-11-04  Martin Robinson  <mrobinson@webkit.org>
     2
     3        implement transform: perspective(none)
     4        https://bugs.webkit.org/show_bug.cgi?id=231361
     5        <rdar://problem/84124161>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add support for perspective(none) and update test results
     10        to show newly passing tests.
     11
     12        No new tests. This is covered by the existing WPT tests:
     13            - imported/w3c/web-platform-tests/css/css-transforms/parsing/transform-valid.html
     14            - imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-001.html
     15
     16        * css/TransformFunctions.cpp:
     17        (WebCore::transformsForValue): Accept a "none" keyword as an input and be a bit more stringent
     18        about what kind of numbers are accepted. These should be rejected earlier in consumePerspective.
     19        This can now hold an Undefined length which indicates perspective: none.
     20        * css/parser/CSSPropertyParser.cpp:
     21        (WebCore::consumePerspective): Accept "none" and clean up the code a little, using ValueRange
     22        instead of a manual check for numerical values. Also make the code structure a little more
     23        consistent.
     24        * platform/graphics/transforms/PerspectiveTransformOperation.h: Update assertion, because
     25        Undefined means perpsective: none now.
     26        * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
     27        (WebCore::PerspectiveTransformOperation::blend): Handle the case of perspective: none for
     28        either values.
     29
    1302021-11-03  Megan Gardner  <megan_gardner@apple.com>
    231
  • trunk/Source/WebCore/css/TransformFunctions.cpp

    r282144 r285255  
    323323        }
    324324        case CSSValuePerspective: {
    325             Length p = Length(0, LengthType::Fixed);
    326             if (firstValue.isLength())
    327                 p = convertToFloatLength(&firstValue, conversionData);
    328             else {
    329                 // This is a quirk that should go away when 3d transforms are finalized.
    330                 double val = firstValue.doubleValue();
    331                 p = val >= 0 ? Length(clampToPositiveInteger(val), LengthType::Fixed) : Length(LengthType::Undefined);
    332             }
    333 
    334             if (p.isUndefined()) {
    335                 operations.clear();
    336                 return false;
    337             }
    338 
    339             operations.append(PerspectiveTransformOperation::create(p));
     325            std::optional<Length> perspectiveLength;
     326            if (!firstValue.isValueID()) {
     327                if (firstValue.isLength())
     328                    perspectiveLength = convertToFloatLength(&firstValue, conversionData);
     329                else {
     330                    // This is a quirk that should go away when 3d transforms are finalized.
     331                    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=232669
     332                    // This does not deal properly with calc(), because we aren't passing conversionData here.
     333                    double doubleValue = firstValue.doubleValue();
     334                    if (doubleValue < 0) {
     335                        operations.clear();
     336                        return false;
     337                    }
     338                    perspectiveLength = Length(clampToPositiveInteger(doubleValue), LengthType::Fixed);
     339                }
     340            } else
     341                ASSERT(firstValue.valueID() == CSSValueNone);
     342
     343            operations.append(PerspectiveTransformOperation::create(perspectiveLength));
    340344            break;
    341345        }
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r285235 r285255  
    18321832static bool consumePerspective(CSSParserTokenRange& args, CSSParserMode cssParserMode, RefPtr<CSSFunctionValue>& transformValue)
    18331833{
     1834    if (args.peek().id() == CSSValueNone) {
     1835        transformValue->append(consumeIdent(args).releaseNonNull());
     1836        return true;
     1837    }
     1838
    18341839    if (auto parsedValue = consumeLength(args, cssParserMode, ValueRange::NonNegative)) {
    18351840        transformValue->append(parsedValue.releaseNonNull());
     
    18371842    }
    18381843
    1839     auto perspective = consumeNumberRaw(args);
    1840     if (!perspective || *perspective < 0)
    1841         return false;
    1842     transformValue->append(CSSPrimitiveValue::create(*perspective, CSSUnitType::CSS_PX));
    1843     return true;
     1844    if (auto perspective = consumeNumberRaw(args, ValueRange::NonNegative)) {
     1845        transformValue->append(CSSPrimitiveValue::create(*perspective, CSSUnitType::CSS_PX));
     1846        return true;
     1847    }
     1848
     1849    return false;
    18441850}
    18451851
  • trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp

    r276141 r285255  
    4646   
    4747    if (blendToIdentity) {
    48         double p = floatValueForLength(m_p, 1);
     48        if (!m_p)
     49            return PerspectiveTransformOperation::create(m_p);
     50
     51        double p = floatValueForLength(*m_p, 1);
    4952        p = WebCore::blend(p, 1.0, context); // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700
    5053        return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), LengthType::Fixed));
     
    5255   
    5356    const PerspectiveTransformOperation* fromOp = downcast<PerspectiveTransformOperation>(from);
    54     Length fromP = fromOp ? fromOp->m_p : Length(m_p.type());
    55     Length toP = m_p;
     57    if (!fromOp)
     58        return *this;
     59
     60    auto fromP = fromOp->m_p;
     61    auto toP = m_p;
    5662
    5763    TransformationMatrix fromT;
     64    if (fromP)
     65        fromT.applyPerspective(floatValueForLength(*fromP, 1));
     66
    5867    TransformationMatrix toT;
    59     fromT.applyPerspective(floatValueForLength(fromP, 1));
    60     toT.applyPerspective(floatValueForLength(toP, 1));
     68    if (toP)
     69        toT.applyPerspective(floatValueForLength(*toP, 1));
     70
    6171    toT.blend(fromT, context.progress);
    6272    TransformationMatrix::Decomposed4Type decomp;
     
    7282void PerspectiveTransformOperation::dump(TextStream& ts) const
    7383{
    74     ts << type() << "(" << m_p << ")";
     84    ts << type() << "(";
     85    if (!m_p)
     86        ts << "none";
     87    else
     88        ts << m_p;
     89    ts << ")";
    7590}
    7691
  • trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h

    r276141 r285255  
    2929#include "LengthFunctions.h"
    3030#include "TransformOperation.h"
     31#include <optional>
    3132#include <wtf/Ref.h>
    3233
     
    3738class PerspectiveTransformOperation final : public TransformOperation {
    3839public:
    39     static Ref<PerspectiveTransformOperation> create(const Length& p)
     40    static Ref<PerspectiveTransformOperation> create(const std::optional<Length>& p)
    4041    {
    4142        return adoptRef(*new PerspectiveTransformOperation(p));
     
    4748    }
    4849
    49     Length perspective() const { return m_p; }
     50    std::optional<Length> perspective() const { return m_p; }
    5051   
    5152private:
    52     bool isIdentity() const override { return !floatValueForLength(m_p, 1); }
     53    bool isIdentity() const override { return !m_p || !floatValueForLength(*m_p, 1); }
    5354    bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
    5455    bool isRepresentableIn2D() const final { return false; }
     
    5859    bool apply(TransformationMatrix& transform, const FloatSize&) const override
    5960    {
    60         transform.applyPerspective(floatValueForLength(m_p, 1));
     61        if (m_p)
     62            transform.applyPerspective(floatValueForLength(*m_p, 1));
    6163        return false;
    6264    }
     
    6668    void dump(WTF::TextStream&) const final;
    6769
    68     PerspectiveTransformOperation(const Length& p)
     70    PerspectiveTransformOperation(const std::optional<Length>& p)
    6971        : TransformOperation(PERSPECTIVE)
    7072        , m_p(p)
    7173    {
    72         ASSERT(p.isFixed());
     74        ASSERT(!p || (*p).isFixed());
    7375    }
    7476
    75     Length m_p;
     77    std::optional<Length> m_p;
    7678};
    7779
Note: See TracChangeset for help on using the changeset viewer.