[Webkit-unassigned] [Bug 226174] [css-grid] Add discrete animation support for grid-template-columns|rows

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 26 07:49:14 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=226174

--- Comment #9 from Oriol Brufau <obrufau at igalia.com> ---
(In reply to zsun from comment #8)
> Thanks for the comments! Oriol and I had a private discussion on this. If we
> unify them into a single class, We will have to pass a lot arguments over to
> the the unified class, for the moment, around 13. We thought maybe just
> leave them separated?

Thinking more about this, rather than passing all the functions as arguments to the constructor, I guess you could define a template class, and then specialize with different constructors. Something like

template <GridTrackSizingDirection>
class GridTemplateTracksWrapper : public AnimationPropertyWrapperBase {
    WTF_MAKE_FAST_ALLOCATED;
public:
    GridTemplateTracksWrapper();

private:
    // ... common logic
};

template <>
GridTemplateTracksWrapper<ForColumns>::GridTemplateTracksWrapper()
    : AnimationPropertyWrapperBase(CSSPropertyGridTemplateColumns)
    , m_gridTracksWrapper(DiscretePropertyWrapper<const Vector<GridTrackSize>&>(CSSPropertyGridTemplateColumns, &RenderStyle::gridColumns, &RenderStyle::setGridColumns))
    , m_autoRepeatTracksWrapper(DiscretePropertyWrapper<const Vector<GridTrackSize>&>(CSSPropertyGridTemplateColumns, &RenderStyle::gridAutoRepeatColumns, &RenderStyle::setGridAutoRepeatColumns))
    // ...
    {
    }

template <>
GridTemplateTracksWrapper<ForRows>::GridTemplateTracksWrapper()
    : AnimationPropertyWrapperBase(CSSPropertyGridTemplateRows)
    , m_gridTracksWrapper(DiscretePropertyWrapper<const Vector<GridTrackSize>&>(CSSPropertyGridTemplateRows, &RenderStyle::gridRows, &RenderStyle::setGridRows))
    , m_autoRepeatTracksWrapper(DiscretePropertyWrapper<const Vector<GridTrackSize>&>(CSSPropertyGridTemplateRows, &RenderStyle::gridAutoRepeatRows, &RenderStyle::setGridAutoRepeatRows))
    // ...
    {
    }

GridTrackSizingDirection is defined in GridPositionsResolver.h, you could also create another enum here I guess.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210526/1cd2665d/attachment.htm>


More information about the webkit-unassigned mailing list