Bug 226174

Summary: [css-grid] Add discrete animation support for grid-template-columns|rows
Product: WebKit Reporter: zsun
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, ews-watchlist, graouts, gyuyoung.kim, jfernandez, obrufau, rego, ryuan.choi, sergio, svillar, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 204580    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

zsun
Reported 2021-05-24 05:24:01 PDT
We need to add discrete animation support for grid-template-columns|rows. This is the first step for Bug 204580.
Attachments
Patch (242.49 KB, patch)
2021-05-24 05:45 PDT, zsun
no flags
Patch (233.00 KB, patch)
2021-05-25 05:50 PDT, zsun
no flags
Patch (236.11 KB, patch)
2021-05-25 06:09 PDT, zsun
no flags
Patch (233.99 KB, patch)
2021-05-26 05:03 PDT, zsun
no flags
Patch (231.97 KB, patch)
2021-05-27 03:07 PDT, zsun
no flags
Patch (231.94 KB, patch)
2021-05-27 07:17 PDT, zsun
no flags
zsun
Comment 1 2021-05-24 05:45:25 PDT
Oriol Brufau
Comment 2 2021-05-24 09:09:24 PDT
Comment on attachment 429527 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429527&action=review > Source/WebCore/animation/CSSPropertyAnimation.cpp:700 > +class GridTemplateColumnsWrapper final : public AnimationPropertyWrapperBase { These 2 classes are almost identical. Maybe you could merge them into e.g. GridTemplateTracksWrapper? And then use something like new GridTemplateTracksWrapper(CSSPropertyGridTemplateColumns, &RenderStyle::gridColumns, &RenderStyle::setGridColumns, &RenderStyle::gridAutoRepeatColumns, &RenderStyle::setGridAutoRepeatColumns), new GridTemplateTracksWrapper(CSSPropertyGridTemplateRows, &RenderStyle::gridRows, &RenderStyle::setGridRows, &RenderStyle::gridAutoRepeatRows, &RenderStyle::setGridAutoRepeatRows), > Source/WebCore/animation/CSSPropertyAnimation.cpp:707 > + { Nit: remove trailing spaces > Source/WebCore/animation/CSSPropertyAnimation.cpp:743 > + { Nit: remove trailing spaces
zsun
Comment 3 2021-05-25 05:50:20 PDT
zsun
Comment 4 2021-05-25 06:09:26 PDT
Oriol Brufau
Comment 5 2021-05-25 10:52:47 PDT
Comment on attachment 429650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429650&action=review > Source/WebCore/animation/CSSPropertyAnimation.cpp:709 > + , m_orderedNamedGridColumnLinesWrapper(DiscretePropertyWrapper<const OrderedNamedGridLinesMap&>(CSSPropertyGridTemplateColumns, &RenderStyle::orderedNamedGridColumnLines, &RenderStyle::setOrderedNamedGridColumnLines)) This may also need the named grid lines inside an auto-repeat: autoRepeatOrderedNamedGridColumnLines(), setAutoRepeatOrderedNamedGridColumnLines() > Source/cmake/OptionsGTK.cmake:73 > +#WEBKIT_OPTION_DEFINE(USE_AVIF "Whether to enable support for AVIF images." PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES}) The changes in this file seem unrelated
zsun
Comment 6 2021-05-26 05:03:53 PDT
Antoine Quint
Comment 7 2021-05-26 05:28:23 PDT
Oriol commented earlier that the two classes should be refactored into a single class and I second that comment.
zsun
Comment 8 2021-05-26 07:07:26 PDT
(In reply to Antoine Quint from comment #7) > Oriol commented earlier that the two classes should be refactored into a > single class and I second that comment. 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?
Oriol Brufau
Comment 9 2021-05-26 07:49:14 PDT
(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.
zsun
Comment 10 2021-05-27 03:07:44 PDT
zsun
Comment 11 2021-05-27 03:23:17 PDT
(In reply to Oriol Brufau from comment #9) > (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. Thanks very much for the suggestions! Code has been updated.
Oriol Brufau
Comment 12 2021-05-27 06:44:11 PDT
Comment on attachment 429861 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429861&action=review Looks good, thanks! Just some nits > Source/WebCore/ChangeLog:10 > + Reviewed by Antoine Quint. Nit: double space in "by Antoine" > Source/WebCore/animation/CSSPropertyAnimation.cpp:754 > + { Nit: remove the indentation. I think the curly brackets should be aligned with GridTemplateTracksWrapper, not with the commas. > Source/WebCore/animation/CSSPropertyAnimation.cpp:766 > + // ... Nit: remove this comment > Source/WebCore/animation/CSSPropertyAnimation.cpp:767 > + { Nit: ditto (indentation) > LayoutTests/imported/w3c/ChangeLog:6 > + Reviewed by Antoine Quint. Nit: ditto (spaces)
zsun
Comment 13 2021-05-27 07:17:08 PDT
EWS
Comment 14 2021-05-27 12:51:19 PDT
Committed r278173 (238216@main): <https://commits.webkit.org/238216@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 429876 [details].
Radar WebKit Bug Importer
Comment 15 2021-05-27 12:52:22 PDT
Note You need to log in before you can comment on or make changes to this bug.