Closed Bug 1598156 Opened 5 years ago Closed 10 months ago

[motion-1] Support "<basic-shape> || <coord-box>" for offset-path

Categories

(Core :: CSS Transitions and Animations, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: boris, Assigned: boris)

References

(Blocks 3 open bugs, )

Details

(Keywords: dev-doc-complete)

Attachments

(8 files, 5 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Implement basic shapes for offset-path.

Note: The syntax might be changed because of w3c/fxtf-drafts/#369.

Keywords: dev-doc-needed
Blocks: 1598159
Severity: normal → S3
Summary: [motion-1] Support offset-path: [ <basic-shape> || <geometry-box> ] → [motion-1] Support <basic-shape> for offset-path
Duplicate of this bug: 1821455
Summary: [motion-1] Support <basic-shape> for offset-path → [motion-1] Support "<basic-shape> || <coord-box>" for offset-path

The definition of <basic-shape> includes other types of basic shapes,
e.g. path(), xywh(), rect(). So we put them together to match the spec.
However, some properties only use the subset of basic shapes, so we use
the bitflags to choose the supported basic shape at the parse time.

Also, remove StyleBasicShapeType because no one uses it.

Only refactoring in this patch.

For outline shapes, fill-rule should be ignored. We add the flag in
the parser of BasicShape, so offset-path can use this flag to ignore
fill-rule.

Note: "IgnoreFillRule" means the fill-rule is still in the function
syntax, but we don't use it. Alwasy using the default fill-rule so we don't
serialize it and it doesn't affect the interpolation.

No behavir change in this patch.

The omitted postion has special meaning for offset-path. It defaults to using
offset-position as the circle/ellipse center if the explicit center is
not given. So we have to introduce ShapePosition::None to represent this
case.

We omit this component if it is not given, when serializing offet-path,
and preserve the value even if it specifies the default value, for the
same reason.

Note: No behavior change on shape-outside and clip-path in this patch.

https://drafts.fxtf.org/motion-1/#valdef-offset-path-basic-shape

We rewrite the data structure of OffsetPath to support all basic shapes.
However, We don't build the gfx::Path for basic shapes other than path()
for now.

Also, will add <coord-box> in the next patch.

Note: The serialize of the specified value of <position> should be
updated because we have to convert the keyword into percentage per the
spec. This should be done by Bug 1832691, so I didn't add tests here.

This patch makes sure the syntax of offset-path is:
offset-path: none | <offset-path> || <coord-box>.

So we can reuse these gfx::Path creaters.

FWIW, I think this will make us pass these two interop-2023 WPTs:
https://wpt.fyi/results/css/motion/offset-path-shape.html (fixed by part 4, in style system at least)
https://wpt.fyi/results/css/motion/offset-path-geometry-box.html (fixed by part 5, in style system at least)

Yes. And I still need one extra patch to make sure it renders properly for coord-box. Also, there are some new tests on the upstream repo:
offset-path-coord-box-001.html
offset-path-coord-box-002.html
offset-path-coord-box-003.html
I will check them as well.

Blocks: 1837042
Depends on: 1837305

Comment on attachment 9336917 [details]
Bug 1598156 - Part 1: Rework GenericBasicShape.

Revision D179624 was moved to bug 1837305. Setting attachment 9336917 [details] to obsolete.

Attachment #9336917 - Attachment is obsolete: true

Comment on attachment 9336918 [details]
Bug 1598156 - Part 2: Add IgnoreFillRule for BasicShape parser.

Revision D179625 was moved to bug 1837305. Setting attachment 9336918 [details] to obsolete.

Attachment #9336918 - Attachment is obsolete: true

Comment on attachment 9336919 [details]
Bug 1598156 - Part 3: Introduce ShapePosition for BasicShape.

Revision D179626 was moved to bug 1837305. Setting attachment 9336919 [details] to obsolete.

Attachment #9336919 - Attachment is obsolete: true

Comment on attachment 9336920 [details]
Bug 1598156 - Part 4: Use BasicShape for OffsetPath in style system.

Revision D179627 was moved to bug 1837305. Setting attachment 9336920 [details] to obsolete.

Attachment #9336920 - Attachment is obsolete: true

Comment on attachment 9336921 [details]
Bug 1598156 - Part 5: Add coord-box into offset-path property.

Revision D179628 was moved to bug 1837305. Setting attachment 9336921 [details] to obsolete.

Attachment #9336921 - Attachment is obsolete: true

(In reply to Daniel Holbert [:dholbert] from comment #10)

FWIW, I think this will make us pass these two interop-2023 WPTs: [...]

Presumably/hopefully this also makes us pass all of the 17 tests that were just added to interop-2023 in https://github.com/web-platform-tests/interop/issues/327#issuecomment-1582309275

The data in PathReferenceData could be used for basic shape as well, so
I'd like to rename it. Also, use nsPoint for the current position and
use nsRect for the rect of containing block so we can reuse some
functions in ShapeUtils without redundant conversions, for Bug 1598156.

Also, fix the missing serialization of mBorderBox in layers message.

Attachment #9336922 - Attachment description: Bug 1598156 - Part 6: Factor out the building of gfx::path into separate functions. → Bug 1598156 - Part 1: Factor out the building of gfx::path into separate functions.

Because we'd like to use it for all basic shapes.

No behavior change.

Attachment #9339396 - Attachment description: Bug 1581237 - Rename RayReferenceData as PathReferenceData. → Bug 1598156 - Part 3: Remove RayReferenceData.

We'd like to reuse it to compute the center position for circle() and
ellipse(), so use a better function name.

No behavior change.

The data structure of StyleOffsetPath is complicated, so adding some
useful functions to simplify the code.

No behavior change.

Attachment #9336923 - Attachment description: Bug 1598156 - Part 7: Build path for basic shapes (without OMTA). → Bug 1598156 - Part 6: Build path for basic shapes.

I tweak css/motion/offset-path-coord-box-001.html a little bit to
avoid using floating-point number in the reference file.

For offset-path-coord-box-002.html and offset-path-coord-box-003.html,
I make the border width larger so it'd be clear to see the difference.
Also the original reference files are not correct because they always use
border-box, so I also fix them to use the correct box.

Attachment #9336924 - Attachment description: Bug 1598156 - Part 8: OMTA (wip) → Bug 1598156 - Part 8: Support Compositor animations for all basic shapes.
Assignee: nobody → boris.chiou
Blocks: 1838977
Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ef9f8655ad63
Part 1: Factor out the building of gfx::path into separate functions. r=emilio
https://hg.mozilla.org/integration/autoland/rev/4cfb1ecae1ef
Part 2: Rename Path as Shape in OffsetPathData. r=emilio
https://hg.mozilla.org/integration/autoland/rev/ffab15c6d340
Part 3: Remove RayReferenceData. r=emilio
https://hg.mozilla.org/integration/autoland/rev/4ecee4746253
Part 4: Rename ComputeRayOrigin as ComputePosition. r=emilio
https://hg.mozilla.org/integration/autoland/rev/d05733192617
Part 5: Add some helper functions to check the type of StyleOffsetPath. r=emilio
https://hg.mozilla.org/integration/autoland/rev/e6f1d47e29a7
Part 6: Build path for basic shapes. r=emilio
https://hg.mozilla.org/integration/autoland/rev/588cd3f02088
Part 7: Support <coord-box> without any function. r=emilio
https://hg.mozilla.org/integration/autoland/rev/e7b972f1cc78
Part 8: Support Compositor animations for all basic shapes. r=emilio,hiro
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40760 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Regressions: 1840601
Regressions: 1840603
See Also: → 1840819
Duplicate of this bug: 1840819

MDN doc updates for this feature can be tracked via this issue: https://github.com/mdn/content/issues/27747.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: