Changeset 274939 in webkit


Ignore:
Timestamp:
Mar 24, 2021 8:14:55 AM (16 months ago)
Author:
graouts@webkit.org
Message:

Support animation of the tab-size CSS property
https://bugs.webkit.org/show_bug.cgi?id=223688

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Import the tab-size interpolation test with its 196 tests passing.

  • web-platform-tests/css/css-text/animations/tab-size-interpolation-expected.txt: Added.
  • web-platform-tests/css/css-text/animations/tab-size-interpolation.html: Added.

Source/WebCore:

Test: imported/w3c/web-platform-tests/css/css-text/animations/tab-size-interpolation.html

  • animation/CSSPropertyAnimation.cpp:

(WebCore::blendFunc):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • platform/graphics/TabSize.h:

(WebCore::TabSize::value const):
(WebCore::TabSize::operator bool const):

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r274936 r274939  
     12021-03-24  Antoine Quint  <graouts@webkit.org>
     2
     3        Support animation of the tab-size CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223688
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Import the tab-size interpolation test with its 196 tests passing.
     9
     10        * web-platform-tests/css/css-text/animations/tab-size-interpolation-expected.txt: Added.
     11        * web-platform-tests/css/css-text/animations/tab-size-interpolation.html: Added.
     12
    1132021-03-24  Chris Lord  <clord@igalia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r274933 r274939  
     12021-03-24  Antoine Quint  <graouts@webkit.org>
     2
     3        Support animation of the tab-size CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223688
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Test: imported/w3c/web-platform-tests/css/css-text/animations/tab-size-interpolation.html
     9
     10        * animation/CSSPropertyAnimation.cpp:
     11        (WebCore::blendFunc):
     12        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     13        * platform/graphics/TabSize.h:
     14        (WebCore::TabSize::value const):
     15        (WebCore::TabSize::operator bool const):
     16
    1172021-03-24  Rob Buis  <rbuis@igalia.com>
    218
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r274415 r274939  
    5858#include "StylePropertyShorthand.h"
    5959#include "StyleResolver.h"
     60#include "TabSize.h"
    6061#include <algorithm>
    6162#include <memory>
     
    99100        return progress < 0.5 ? from : to;
    100101    return blend(from.length(), to.length(), progress, ValueRangeNonNegative);
     102}
     103
     104static inline TabSize blendFunc(const CSSPropertyBlendingClient*, const TabSize& from, const TabSize& to, double progress)
     105{
     106    auto blendedValue = blend(from.value(), to.value(), progress);
     107    return { blendedValue < 0 ? 0 : blendedValue, from.isSpaces() ? SpaceValueType : LengthValueType };
    101108}
    102109
     
    18561863};
    18571864
     1865class TabSizePropertyWrapper final : public PropertyWrapper<const TabSize&> {
     1866    WTF_MAKE_FAST_ALLOCATED;
     1867public:
     1868    TabSizePropertyWrapper()
     1869        : PropertyWrapper<const TabSize&>(CSSPropertyTabSize, &RenderStyle::tabSize, &RenderStyle::setTabSize)
     1870    {
     1871    }
     1872
     1873private:
     1874    bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
     1875    {
     1876        return value(from).isSpaces() == value(to).isSpaces();
     1877    }
     1878
     1879    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
     1880    {
     1881        if (!canInterpolate(from, to))
     1882            (destination->*m_setter)(progress ? value(to) : value(from));
     1883        else
     1884            PropertyWrapper::blend(client, destination, from, to, progress);
     1885    }
     1886};
     1887
    18581888class PropertyWrapperAspectRatio final : public AnimationPropertyWrapperBase {
    18591889    WTF_MAKE_FAST_ALLOCATED;
     
    21182148        new NonNegativeFloatPropertyWrapper(CSSPropertyFlexShrink, &RenderStyle::flexShrink, &RenderStyle::setFlexShrink),
    21192149        new PropertyWrapper<int>(CSSPropertyOrder, &RenderStyle::order, &RenderStyle::setOrder),
     2150
     2151        new TabSizePropertyWrapper,
    21202152
    21212153        // FIXME: The following properties are currently not animatable but should be:
  • trunk/Source/WebCore/platform/graphics/TabSize.h

    r246193 r274939  
    5454    }
    5555
    56     operator bool() const { return m_value; }
     56    float value() const
     57    {
     58        return m_value;
     59    }
     60
     61    operator bool() const { return value(); }
    5762
    5863    float m_value;
Note: See TracChangeset for help on using the changeset viewer.