57 Commits
Author SHA1 Message Date
Mr. M 8880cba9fa Bug 2035317 - Add rendering for CSS corner-shape support r=layout-reviewers,emilio,gfx-reviewers,firefox-style-system-reviewers,cheff,nical
Differential Revision: https://phabricator.services.mozilla.com/D297660
2026-06-09 15:01:50 +00:00
Diego Escalante b8760116f3 Bug 2037673 - Add farthest-corner and closest-corner to circle() and ellipse(). r=boris,firefox-style-system-reviewers,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D300834
2026-05-20 20:29:03 +00:00
rperta ffb9665ac7 Revert "Bug 2037673 - Add farthest-corner and closest-corner to circle() and ellipse(). r=boris,firefox-style-system-reviewers,layout-reviewers" for causing mochitest failures at test_property_syntax_errors.html
This reverts commit 5b69273b2a.
2026-05-19 17:22:23 +00:00
Diego Escalante 5b69273b2a Bug 2037673 - Add farthest-corner and closest-corner to circle() and ellipse(). r=boris,firefox-style-system-reviewers,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D300834
2026-05-19 16:14:41 +00:00
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
Emilio Cobos Álvarez 08d8a894db Bug 1984859 - Use a common type for layout rounded corners and graphics rounded corners. r=layout-reviewers,gfx-reviewers,jfkthame,jnicol
Differential Revision: https://phabricator.services.mozilla.com/D262041
2025-08-23 22:55:18 +00:00
Atila Butkovits 533eabba32 Revert "Bug 1984859: apply code formatting via Lando" for causing failures at element-paint-native-widget.html.
This reverts commit c7950c03d7.

Revert "Bug 1984859 - Use a common type for layout rounded corners and graphics rounded corners. r=layout-reviewers,gfx-reviewers,jfkthame,jnicol"

This reverts commit 2991156989.

Revert "Bug 1984859 - Use Margin to represent border widths in nsCSSRendering. r=layout-reviewers,gfx-reviewers,jfkthame,jnicol"

This reverts commit 446150abe6.
2025-08-23 19:10:23 +00:00
Emilio Cobos Álvarez 2991156989 Bug 1984859 - Use a common type for layout rounded corners and graphics rounded corners. r=layout-reviewers,gfx-reviewers,jfkthame,jnicol
Differential Revision: https://phabricator.services.mozilla.com/D262041
2025-08-23 17:57:50 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Boris Chiou a9cb9dca03 Bug 1916646 - Floor right/bottom values of inset()/rect() to make sure that width and height of the rectangle are valid. r=dshin
Per spec of `rect()`, the second (right) and third (bottom) values are
floored by the fourth (left) and second (top) values, respectively. This
is to avoid that they don't cross over the other edge. In our
implementation, we just clamp width and height to make sure they are not
negative. The both ways should be identical.

Note that the spec also mentions another way to handle the similar case
in `inset()`, which would like to apply the algorithm mentioned in
"CSS Backgrounds 3 § 4.5 Overlapping Curves rules" to proportionally reduce
the inset effect to 100%. This may cause a different result from
flooring the values. I suspect this is a spec issue:
https://github.com/w3c/csswg-drafts/issues/10870.

Differential Revision: https://phabricator.services.mozilla.com/D222536
2024-09-18 18:14:33 +00:00
Boris Chiou cf36b529e6 Bug 1823475 - Drop DefaultPosition and omit "at <position>" if it is not specified. r=devtools-reviewers,emilio
`at <position>` is optional value and we should omit it if author doesn't
specify it, for all basic-shape functions, and ray().

Note that there is a related interpolation issue [1] if one of the end values
doesn't specify `at <position>`. We didn't address this issue in this patch.

[1] https://github.com/w3c/csswg-drafts/issues/9068

Also, this updates the devtool code to give it the default value, "50% 50%",
for circle() and ellipse() if `at <position>` is not specified.

Differential Revision: https://phabricator.services.mozilla.com/D181918
2023-09-26 21:05:20 +00:00
Boris Chiou 43bb1fa8a2 Bug 1842277 - Compute <basic-shape-rect> to the equivalent inset() function. r=devtools-reviewers,emilio
Per spec
https://drafts.csswg.org/css-shapes-1/#basic-shape-computed-values, and
the spec issue, https://github.com/w3c/csswg-drafts/issues/9053,
all <basic-shape-rect> functions compute to the equivalent inset() function.
i.e.
`xywh(x y w h)` computes to
`inset(y calc(100% - x - w) calc(100% - y - h) x)`

The basic concept is to use `BasicShapeRect` as the specified value of
`<basic-shape-rect>`, i.e. inset()/xywh()/rect(), and its computed value is
the equivalent `InsetRect`, and so it becomes possible to interpolate among
these three functions.

Also, we can drop BuildXywhPath() and ComputeRect() because now there is
only inset() function when building gfx::Path.

Besides, tweak the test, offset-path-shape-xywh-003.html, because the original
test, `xywh(10% 10% 80% 80%)`, has to calculate `calc(100% - 10% - 80%)`.
Its result is `Percentage(0.099999964)` in Rust code, and then it makes us
compute an imprecision inset rect when building the gfx::path, which results in
a transform with the sub-pixel translation. So change it to
`xywh(10% 10% 90% 90%)` to avoid adding fuzzy tolerance.

Differential Revision: https://phabricator.services.mozilla.com/D183221
2023-07-12 20:16:47 +00:00
Boris Chiou 1b1742d1d8 Bug 1786160 - Support xywh() for clip-path. r=emilio
The fuzzy in the test happens on the round because we use the different way
to draw the round of clip-path (compared to border-radius property) in
the render backend, so there are some tiny differences.

Differential Revision: https://phabricator.services.mozilla.com/D182421
2023-07-07 18:12:41 +00:00
Boris Chiou 4f1e83c297 Bug 1786160 - Support xywh() for offset-path. r=emilio
And rename some functions, e.g. BuildInsetPath as BuildRectPath and
ComputeInsetRadii as ComputeRectRadii, because we would like to use it for
inset()/xywh()/rect(). All of them define the similar rectangles.

Also, tweak the tests:
1. tweak offset-path-shape-xywh-001.html to avoid the element just at
   the bottom-right corner of path because there is no tangent angle at this
   point. Its direction angle could be 90deg or 180deg, depends on the
   implementation.
2. tweak offset-path-shape-xywh-002.html and
   offset-path-shape-xywh-002-ref.html together because it seems the
   original ref file is incorrect. The test was added by Blink and the
   implementation of xywh() in Blink uses the height of the reference box to
   resolve the precentage value of the width of the transformed box.
   It doesn't make sense because we should use the width of the reference box
   to resolve it. So tweak the test and its reference file together
   based on Gecko's result.

Differential Revision: https://phabricator.services.mozilla.com/D182420
2023-07-07 18:12:41 +00:00
Boris Chiou 0bde3ad169 Bug 1786160 - Rename inset as rect in ShapeUtils. r=emilio
We would like to use these function for all rectangular shape, i.e.
inset()/xywh()/rect(). So rename them to avoid confusion.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D182422
2023-07-07 18:12:41 +00:00
Boris Chiou 9019fe65c6 Bug 1598156 - Part 7: Support <coord-box> without any function. r=emilio
I tweak css/motion/offset-path-coord-box-001.html a little bit to
avoid decimals 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.

Also, rename offset-path-geometry-box.html as offset-path-coord-box-004.html,
because there is no "geometry-box" in the spec. We are using "coord-box"
now.

Differential Revision: https://phabricator.services.mozilla.com/D181317
2023-06-26 23:23:55 +00:00
Boris Chiou 5ddf7e23db Bug 1598156 - Part 1: Factor out the building of gfx::path into separate functions. r=emilio
So we can reuse them to draw basic shapes for offset-path.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D179629
2023-06-26 23:23:54 +00:00
Boris Chiou ec0d14e71d Bug 1837305 - Part 3: Use PositionOrAuto for "at <position>" in circle and ellipse. r=emilio
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. Just like what we do for ray(), here we also use
PositionOrAuto for it.

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.

For shape-outside and clip-path, we don't change their behaviors for now.
This bug is for offset-path and we will use it in the following patches.
We should fix them in Bug 1837340.

Differential Revision: https://phabricator.services.mozilla.com/D179626
2023-06-15 00:03:59 +00:00
Boris Chiou 4e52df356d Bug 1820070 - Part 3: Apply "at <position>" and offset-position to ray function. r=emilio
We apply offset-position and "at <position>" to ray function. However,
only use it on the main thread. For compositor animation, we will finish
it in the following patches.

No need to add tests because there are tests in the WPT upstream repo already:
css/motion/offset-path-ray-011.html
css/motion/offset-path-ray-012.html
css/motion/offset-path-ray-013.html
css/motion/offset-path-ray-014.html

Those tests should cover what we do in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D179861
2023-06-06 21:40:52 +00:00
Emilio Cobos Álvarez c43e65587f Bug 1785903 - Use inset rect as the border area to compute shape radii. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D155072
2022-08-22 22:15:24 +00:00
Emilio Cobos Álvarez cb66a015b3 Bug 1704742 - Fix percent basis of shape radii. r=TYLin
Matches other browsers, and the spec, as per
https://drafts.csswg.org/css-shapes/#basic-shape:

    All the lengths expressed in percentages are resolved from the used
    dimensions of the reference box.

Differential Revision: https://phabricator.services.mozilla.com/D111790
2021-04-14 09:29:37 +00:00
longsonr d0980a7f6e Bug 1652254 - Remove svg from some moz.build local includes r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D83247
2020-07-12 16:38:26 +00:00
Emilio Cobos Álvarez 3244910d0e Bug 1561738 - Remove nsStyleCoord. r=boris
And move the useful bits of it somewhere else (ServoStyleConstInlines.h for the
inline function definitions, and nsFrame.cpp for the static assertions).

Differential Revision: https://phabricator.services.mozilla.com/D36120
2019-06-28 12:44:44 +02:00
Cosmin Sabou a5a1cf97a8 Backed out 3 changesets (bug 1561738) for causing build bustages on nsGridContainerFrame.cpp CLOSED TREE
Backed out changeset 98f100abc2ba (bug 1561738)
Backed out changeset 9ed20d0fb9ba (bug 1561738)
Backed out changeset 483b1e134ace (bug 1561738)
2019-06-28 13:27:09 +03:00
Emilio Cobos Álvarez a622c42ad4 Bug 1561738 - Remove nsStyleCoord. r=boris
And move the useful bits of it somewhere else (ServoStyleConstInlines.h for the
inline function definitions, and nsFrame.cpp for the static assertions).

Differential Revision: https://phabricator.services.mozilla.com/D36120
2019-06-28 09:46:26 +00:00
Emilio Cobos Álvarez 95464eaeb7 Bug 1548691 - Use the owned slice type for basic shape polygon coordinates. r=TYLin,heycam
This enables destructors for tagged unions in cbindgen, implemented in:

 * https://github.com/eqrion/cbindgen/pull/333

Which allow us to properly generate a destructor for the cbindgen-generated
StyleBasicShape (which now contains an OwnedSlice).

For now, we still use the glue code to go from Box<BasicShape> to
UniquePtr<BasicShape>. But that will change in the future when we generate even
more stuff and remove all the glue.

I could add support for copy-constructor generation to cbindgen for tagged
enums, but I'm not sure if it'll end up being needed, and copy-constructing
unions in C++ is always very tricky.

Differential Revision: https://phabricator.services.mozilla.com/D29769
2019-05-09 11:24:57 +00:00
Ryan Hunt a96492f0f6 Bug 1523969 part 14 - Move method definition inline comments to new line in 'layout/'. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D21115
2019-02-25 16:09:24 -06:00
Emilio Cobos Álvarez 94f0e8db7b Bug 1516454 - Use rust lengths for border corners. r=boris
The test in https://github.com/web-platform-tests/wpt/pull/15423 hasn't been
synced over yet, but it passes with this patch of course.

Differential Revision: https://phabricator.services.mozilla.com/D20960
2019-02-26 06:01:34 -08:00
Cosmin Sabou fbb2c899cf Backed out 4 changesets (bug 1516454, bug 1530247) for multiple failures on Linux x64 asan. CLOSED TREE
Backed out changeset 180c7672c57c (bug 1516454)
Backed out changeset a460a4d0a66c (bug 1516454)
Backed out changeset c6ab8d3dd19a (bug 1530247)
Backed out changeset 43862dc87e0b (bug 1516454)
2019-02-26 00:49:27 +02:00
Emilio Cobos Álvarez c7f72d5f09 Bug 1516454 - Use rust lengths for border corners. r=boris
The test in https://github.com/web-platform-tests/wpt/pull/15423 hasn't been
synced over yet, but it passes with this patch of course.

Differential Revision: https://phabricator.services.mozilla.com/D20960
2019-02-25 12:42:31 -08:00
Sylvestre Ledru e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Emilio Cobos Álvarez 9babd758f5 Bug 1504078 - Use references in the shapes code. r=bradwerth,TYLin
It doesn't make much sense to return const UniquePtr<Foo>& for something that
can't be null, it's just confusing.

Also make more stuff actually const.

Differential Revision: https://phabricator.services.mozilla.com/D10647
2018-11-02 18:19:06 +00:00
Brad Werth 59a8c43274 Bug 1461046 Part 2: Change ShapeUtils::ComputeInsetRect to return the inverse of a rect deflated more than its bounds can tolerate. r=dholbert
MozReview-Commit-ID: IScKyqzjMoy
2018-05-18 17:51:19 -07:00
Gurzau Raul fe59adc10b Backed out 7 changesets (bug 1461046) for permafailing reftest on /reftests/css-invalid/select/select-disabled-fieldset-1.html a=backout
Backed out changeset f5990eb1eb0d (bug 1461046)
Backed out changeset 8e0c340b9700 (bug 1461046)
Backed out changeset fbfe1d5b94e1 (bug 1461046)
Backed out changeset 48057a6ba3d6 (bug 1461046)
Backed out changeset 5c8648bcf6bb (bug 1461046)
Backed out changeset 157bbc74460a (bug 1461046)
Backed out changeset e990d4d07b0e (bug 1461046)
2018-06-02 05:07:03 +03:00
Brad Werth 009f35375d Bug 1461046 Part 2: Change ShapeUtils::ComputeInsetRect to return the inverse of a rect deflated more than its bounds can tolerate. r=dholbert
MozReview-Commit-ID: IScKyqzjMoy
2018-05-18 17:51:19 -07:00
Ting-Yu Lin 5ef96b463f Bug 1418905 - Move nsRuleNode::ComputeCoordPercentCalc() into nsStyleCoord. r=heycam
MozReview-Commit-ID: GLLseBxhUiP
2017-11-20 14:05:19 +08:00
Ting-Yu Lin d35b7d33db Bug 1404243 Part 3 - Remove refcount for StyleBasicShape, and use UniquePtr to hold it. r=heycam
After StyleBasicShape is set to StyleShapeSource, it's life cycle never go
beyond StyleShapeSource, so I make StyleBasicShape hold by a UniquePtr in
StyleShapeSource.

Also, replace all raw pointers to StyleBasicShape by UniquePtr in all APIs.

MozReview-Commit-ID: 1MfIFjP8TsQ
2017-09-25 18:50:24 +08:00
Ting-Yu Lin 17312fe511 Bug 1326409 Part 6 - Convert aBasicShape to a pointer to a const value. r=dholbert
To address reviewer's comments in bug 1326409 comment 13 and comment 14.

MozReview-Commit-ID: FiUXXk4O8N7
2017-03-13 12:03:40 +08:00
Ting-Yu Lin 2b90024ba8 Bug 1326409 Part 4 - Extract a function to compute polygon vertices. r=dholbert
MozReview-Commit-ID: B4BzBHjLHxW
2017-03-13 12:03:40 +08:00
Ting-Yu Lin b7972e4381 Bug 1326409 Part 2 - Rewrite the return expression of ComputeCircleOrEllipseCenter(). r=dholbert
MozReview-Commit-ID: 60gvYceeNiP
2017-03-13 12:03:39 +08:00
Ting-Yu Lin 3499e2f590 Bug 1326407 Part 2 - Extract a function to compute inset radii. r=dbaron
MozReview-Commit-ID: 3XbfW40AJCI
2017-02-16 10:51:48 +08:00
Ting-Yu Lin b0f2779767 Bug 1326407 Part 1 - Extract a function to compute inset rect. r=dbaron
MozReview-Commit-ID: DmVOVArtzBZ
2017-02-16 10:51:47 +08:00
Ting-Yu Lin ef5b455bad Bug 1326407 Part 0 - Add assertion to ShapeUtils functions. r=me
Address Bug 1326407 comment 11.

MozReview-Commit-ID: 8Iy5q3f4yPd
2017-02-16 10:51:47 +08:00
Ting-Yu Lin 408c2d430f Bug 1326406 Part 2 - Extract the computation of ellipse radii as ComputeEllipseRadii(). r=dbaron
MozReview-Commit-ID: LPdvg66adHQ
2017-01-23 17:17:05 +08:00
Ting-Yu Lin a291192f2f Bug 1311244 Part 4 - Extract the computation of circle radius as ComputeCircleRadius(). r=dbaron
MozReview-Commit-ID: LJNvNOoc7FI
2017-01-06 16:36:05 +08:00
Ting-Yu Lin 45631eeeea Bug 1311244 Part 3 - Extract the computation of center as ComputeCircleOrEllipseCenter(). r=dbaron
MozReview-Commit-ID: A6OTJ9PD43c
2017-01-06 16:35:53 +08:00
Ting-Yu Lin 7704778bc0 Bug 1311244 Part 2 - Create ShapeUtils, and move EnumerationToLength into it. r=dbaron
More functions in nsCSSClipPathInstance will be refactored and moved into
ShapeUtils in subsequent patches.

MozReview-Commit-ID: LmJUevY8YGr
2017-01-06 16:35:29 +08:00
Carsten "Tomcat" Book 26b5c85932 Backed out changeset d523b9c7c0bb (bug 1311244) 2017-01-12 14:19:26 +01:00
Carsten "Tomcat" Book fca6b16c59 Backed out changeset 61d064c78aa2 (bug 1311244) 2017-01-12 14:19:24 +01:00
Carsten "Tomcat" Book 537cb9c4ba Backed out changeset b1d7a47b0c70 (bug 1311244) 2017-01-12 14:19:23 +01:00