49 Commits
Author SHA1 Message Date
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
Jonathan Watt 785566d985 Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275465
2025-12-11 08:10:21 +00:00
Sandor Molnar 1d99722539 Revert "Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers" for causing wpt failures
This reverts commit c8558d0a6d.
2025-12-10 21:33:17 +00:00
Jonathan Watt c8558d0a6d Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275465
2025-12-10 17:59:00 +00:00
Jonathan Watt a781248c8d Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275082
2025-12-10 08:24:44 +00:00
Serban Stanca b20d226403 Revert "Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers" for causing linux non-unified build bustages in nsIFrame.h.
This reverts commit 54d25f5169.
2025-12-10 01:27:42 +00:00
Jonathan Watt 54d25f5169 Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275082
2025-12-09 22:23:03 +00:00
agoloman ea8094db9f Revert "Bug 1991929 p3. Make shrink-wrapping work for anchor positioned elements. r=dshin,layout-reviewers,layout-anchor-positioning-reviewers,firefox-style-system-reviewers" for causing wr failures @popover-alignment-002.html.
This reverts commit 70c1ed629c.

Revert "Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers"

This reverts commit ac0aa650de.
2025-12-09 09:23:53 +00:00
Jonathan Watt ac0aa650de Bug 1991929 p2. Move MapCSSAlignment() to CSSAlignUtils. r=emilio,layout-reviewers,layout-anchor-positioning-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275082
2025-12-09 08:10:11 +00:00
David Shin 67791fd91e Bug 2004040: Improve handling of orthogonal anchor-center alignment r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D275135
2025-12-09 00:27:28 +00:00
Cristina Horotan 23038681a7 Revert "Bug 2004040: Properly nudge overflowing abspos elements into IMCB. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio" for causing wpt failures on align-self-default-overflow-htb-ltr-htb.html
This reverts commit e338585458.

Revert "Bug 2004040: Improve handling of orthogonal anchor-center alignment r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio"

This reverts commit 275da674fe.
2025-12-08 05:54:15 +00:00
David Shin 275da674fe Bug 2004040: Improve handling of orthogonal anchor-center alignment r=layout-anchor-positioning-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D275135
2025-12-07 19:07:59 +00:00
Keith Cirkel 1c5f80bd63 Bug 1909339 - Implement anchor-center for alignment properties when anchored r=layout-reviewers,emilio,firefox-style-system-reviewers,dshin
This implements `anchor-center` alignment for abpos elements when they
have an Anchor.

Differential Revision: https://phabricator.services.mozilla.com/D273655
2025-12-04 01:26:11 +00:00
Atila Butkovits c139426e28 Revert "Bug 1909339 - Implement anchor-center for alignment properties when anchored r=layout-reviewers,emilio,firefox-style-system-reviewers,dshin" for causing bustages at ReflowInput.cpp
This reverts commit 461b86ef9b.
2025-12-03 20:43:51 +00:00
Keith Cirkel 461b86ef9b Bug 1909339 - Implement anchor-center for alignment properties when anchored r=layout-reviewers,emilio,firefox-style-system-reviewers,dshin
This implements `anchor-center` alignment for abpos elements when they
have an Anchor.

Differential Revision: https://phabricator.services.mozilla.com/D273655
2025-12-03 19:09:27 +00:00
David Shin e68ac5eb03 Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256289
2025-07-14 21:28:20 +00:00
pstanciu 7a21072acf Revert "Bug 1969305: Adjust WPT expectations. r=layout-reviewers,emilio" for causing failures @ anchor-name-003.html
This reverts commit 5e12720896.

Revert "Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio"

This reverts commit 27a56d04a1.

Revert "Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio"

This reverts commit 69b2bd0242.

Revert "Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio"

This reverts commit 23c707d5a7.

Revert "Bug 1969305: Implement anchor size resolution. r=layout-reviewers,emilio"

This reverts commit c0d1d8808d.
2025-07-12 02:02:55 +00:00
David Shin 23c707d5a7 Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256289
2025-07-11 15:21:39 +00:00
Atila Butkovits 0b2944a3d2 Revert "Bug 1969305: Adjust WPT expectations. r=layout-reviewers,emilio" for causing bustages at GeckoBindings.cpp.
This reverts commit 49a7b8afce.

Revert "Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio"

This reverts commit 0b615836cf.

Revert "Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio"

This reverts commit 359badb60e.

Revert "Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio"

This reverts commit 17f7f64cd8.

Revert "Bug 1969305: Implement anchor size resolution. r=layout-reviewers,emilio"

This reverts commit 47197ef7ab.
2025-07-11 01:18:14 +00:00
David Shin 17f7f64cd8 Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256289
2025-07-10 20:58:18 +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
Ting-Yu Lin 3d53cdf4c7 Bug 1975356 - Convert AlignJustifyFlags to an EnumSet. r=dholbert
I feel the ergonomic of EnumSet is better.

Differential Revision: https://phabricator.services.mozilla.com/D255907
2025-07-03 22:20:36 +00:00
Tiaan Louw 012409a37f Bug 1947413 - Grid items should join the correct baseline sharing group r=dholbert
Calculate the correct baseline sharing group for grid items that are
baseline aligned. The calculation uses the algorithm from the spec here:

https://drafts.csswg.org/css-align-3/#baseline-export

In addition to corrently determining the baseline sharing group, the
baseline calculation can also be simplified.

Once we have the new baseline, we can use it in the alignment function,
which now has to take into account whether the baseline alignment
affected the side on which the item is aligned from.

For the additional test failure, it happens in subgrid and we use to
fail 11 of the 12 tests, now failing all 12, so likely we passed it by
accident.

Differential Revision: https://phabricator.services.mozilla.com/D253202
2025-07-02 09:41:11 +00:00
agoloman 076a84bff4 Revert "Bug 1947413 - Grid items should join the correct baseline sharing group r=dholbert" for causing wpt failures @subgrid-baseline-009.html.
This reverts commit 08d40c450a.
2025-06-30 18:12:00 +00:00
Tiaan Louw 08d40c450a Bug 1947413 - Grid items should join the correct baseline sharing group r=dholbert
Calculate the correct baseline sharing group for grid items that are
baseline aligned. The calculation uses the algorithm from the spec here:

https://drafts.csswg.org/css-align-3/#baseline-export

In addition to corrently determining the baseline sharing group, the
baseline calculation can also be simplified.

Once we have the new baseline, we can use it in the alignment function,
which now has to take into account whether the baseline alignment
affected the side on which the item is aligned from.

For the additional test failure, it happens in subgrid and we use to
fail 11 of the 12 tests, now failing all 12, so likely we passed it by
accident.

Differential Revision: https://phabricator.services.mozilla.com/D253202
2025-06-30 13:31:06 +00:00
David Shin 8897bdc924 Bug 1971135: Use anchor resolution params in place of position property. r=TYLin
... The full resolution that makes use of additional parameters will follow
shortly.

Differential Revision: https://phabricator.services.mozilla.com/D253175
2025-06-16 20:35:30 +00:00
David Shin 40e6a5c66e Bug 1923959: Resolve anchor for margins. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D240863
2025-04-08 02:29:18 +00:00
David Shin fa8eb4ef7e Bug 1920160: Part 5 - Align boxes when within non-auto inset absolute containing block. r=jwatt
Also implement the alignment safety behaviour that is described as "in-between"
[1].

This is mutually exclusive to `PLACEHOLDER_STATICPOS_NEEDS_CSSALIGN` related computation,
since it involves requiring CSS alignment to compute the static position when inset
values are auto, for grid & flex boxes.

[1] https://drafts.csswg.org/css-position-3/#abspos-layout

Differential Revision: https://phabricator.services.mozilla.com/D226531
2024-11-07 16:33:42 +00:00
Stanca Serban 97f84cfe33 Backed out 7 changesets (bug 1920160) for causing mochitests plain failures in test_videocontrols_vtt.html. CLOSED TREE
Backed out changeset 5d57a3a8d6aa (bug 1920160)
Backed out changeset d57f1f6f293b (bug 1920160)
Backed out changeset 8bfb6f9eab80 (bug 1920160)
Backed out changeset 45c61a69b9b8 (bug 1920160)
Backed out changeset b64bfe84e60a (bug 1920160)
Backed out changeset 26f7d594f6e0 (bug 1920160)
Backed out changeset 71d051b7857a (bug 1920160)
2024-11-05 04:11:47 +02:00
David Shin df363b5de2 Bug 1920160: Part 5 - Align boxes when within non-auto inset absolute containing block. r=jwatt
Also implement the alignment safety behaviour that is described as "in-between"
[1].

This is mutually exclusive to `PLACEHOLDER_STATICPOS_NEEDS_CSSALIGN` related computation,
since it involves requiring CSS alignment to compute the static position when inset
values are auto, for grid & flex boxes.

[1] https://drafts.csswg.org/css-position-3/#abspos-layout

Differential Revision: https://phabricator.services.mozilla.com/D226531
2024-11-05 00:44:44 +00:00
David Shin 1fad4eeb43 Bug 1900232: Part 4 - Add anchor-size() to margin properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222533
2024-09-23 13:58:38 +00:00
David Shin 3798e4c594 Bug 1900231: Parse anchor-center for self-alignment properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D221872
2024-09-12 13:07:26 +00:00
Cjm531 abac0e51ec Bug 1885695 - Change LogicalEdge to an enum class and change its variants names. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D206265
2024-04-15 20:19:47 +00:00
sid 568f27d168 Bug 1825386 - Converted LogicalAxis to enum class and type casted where necessary. r=TYLin
LogicalAxis is one of the Logical* enums. Converting it from enum to
enum class increases type safety. To run with the pre-existing code,
type casting was added when needed. Comments have been edited where
needed.

Differential Revision: https://phabricator.services.mozilla.com/D206108
2024-03-30 16:20:37 +00:00
Ting-Yu Lin df444ea8e5 Bug 1209710 - Use convenience methods to simplify CSSAlignUtils::AlignJustifySelf(). r=layout-reviewers,jfkthame
We already have convenience methods added over the years :)

Differential Revision: https://phabricator.services.mozilla.com/D95823
2020-11-04 11:12:50 +00:00
Ting-Yu Lin ca224f13ee Bug 1674931 Part 1 - Add WritingMode argument to SizeComputationInput::ComputedLogicalMargin(), and adapt callers. r=jfkthame
It's straightforward to determine which writing mode is required to pass
to ComputedLogicalMargin() by looking at any subsequent method called on
the margin.

For example, if we see

```
ComputedLogicalMargin().BStartEnd(wm);
```

the writing mode needed to pass to `ComputedLogicalMargin()` is `wm`.

Differential Revision: https://phabricator.services.mozilla.com/D95661
2020-11-03 19:44:58 +00:00
Emilio Cobos Álvarez a0eda86c37 Bug 1611583 - Use cbindgen for css-align types. r=dholbert
This provides stronger typing and removes a bunch of subtle constants matching.

Differential Revision: https://phabricator.services.mozilla.com/D61058
2020-01-31 00:56:49 +00:00
Chris Peterson 0a9155f83b Bug 1570499 - Part 1: Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute. r=froydnj
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.

Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:

* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.

Differential Revision: https://phabricator.services.mozilla.com/D56440
2019-12-20 07:16:43 +00:00
Emilio Cobos Álvarez 8ba05939c2 Bug 1546697 - Use a consistent style for enum classes in layout. r=dholbert
Per the discussion in:

  https://groups.google.com/d/msg/mozilla.dev.platform/P79pwa9z5m8/iPYPAWPHCAAJ

They should be CamelCase, and that's what most of them already do. This converts
the rest, which are a few.

For the ones that already used `e` or `k` prefixes, I've mostly done:

 for file in $(rg Type::e layout | cut -d : -f 1 | sort | uniq); do sed -i 's#Type::e#Type::#g' $file; done

For the ones that used uppercase, I've removed the prefix if it was already in
the type name, and turn them into CamelCase.

Depends on D28680

Differential Revision: https://phabricator.services.mozilla.com/D28681
2019-04-25 23:03:04 +00:00
Emilio Cobos Álvarez ce3d5d43c1 Bug 1523071 - Use Rust lengths for margin / padding / inset. r=jwatt
Also for the intersection observer root margin, since it was easier to fix it
up and clean it up than not doing it.

This is the first big step to get rid of nscoord. It duplicates a bit of logic
in nsLayoutUtils since for now max/min-width/height are still represented with
nsStyleCoord, but I think I prefer to land this incrementally.

I didn't add helpers for the physical accessors of the style rect sides that
nsStyleSides has (top/bottom/left/right) since I think we generally should
encourage the logical versions, but let me know if you want me to do that.

Differential Revision: https://phabricator.services.mozilla.com/D17739
2019-02-10 04:11:58 +01: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
Mats Palmgren 4becb5f06e Bug 1468263 - Make CSSAlignUtils use the LogicalSize::Size accessor instead of manually selecting I/BSize (idempotent patch). r=dholbert 2018-06-12 18:06:55 +02:00
Daniel Holbert 8fea3c215f Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK
2017-10-27 10:33:53 -07:00
Daniel Holbert 5bef54b406 Bug 1321387 part 4: Add #includes to some .cpp files in layout/generic, to provide types/definitions used in those files. r=TYLin
These newly-included headers' types are all used directly in the affected files.

MozReview-Commit-ID: 5NEA1QhSJKN
2016-11-30 14:51:12 -08:00
Mats Palmgren d9df1bc378 Bug 1313254 part 2 - [css-align] Change "last-baseline" to "last baseline" in layout/ (scripted change). r=dholbert 2016-11-05 02:57:07 +01:00
Daniel Holbert 668beb2cc2 Bug 1269046 part 9: Add a flag to control whether CSSAlignUtils::AlignJustifySelf() expands "auto" margins. r=mats
MozReview-Commit-ID: I0UdEIfiOqX
2016-10-31 08:59:40 -07:00
Daniel Holbert 087210301f Bug 1269046 part 8: Rewrite CSSAlignUtils::AlignJustifySelf to use a single "flags" arg instead of boolean args. r=mats
MozReview-Commit-ID: 5loE21U7FF6
2016-10-31 08:59:40 -07:00
Daniel Holbert 3057b172c6 Bug 1269046 part 3: Make a grid-specific comment more general, in CSSAlignUtils::AlignJustifySelf. r=mats
MozReview-Commit-ID: GZ35iZ2E1Iz
2016-10-31 08:58:18 -07:00
Daniel Holbert e6b037482a Bug 1269046 part 1: Spin out some grid alignment code into a helper method, in a new CSSAlignUtils class. r=mats
MozReview-Commit-ID: 1Eh2CreOLTC
2016-10-31 08:58:18 -07:00