Commit Graph

722 Commits

Author SHA1 Message Date
Ting-Yu Lin
74f04d11d5 Bug 1927962 - Remove GridReflowInput::CalculateTrackSizes(). r=dholbert
`CalculateTrackSizes()` is used only once, while `CalculateTrackSizesForAxis()`
is used more extensively. Let's just expand `CalculateTrackSizes()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D227300
2024-10-30 22:18:34 +00:00
Connor Pearson
169b33896d Bug 1654541 - Rename eFitContent to eApplyFitContentClamping. r=emilio
Depends on D226204

Differential Revision: https://phabricator.services.mozilla.com/D227324
2024-10-30 15:40:34 +00:00
Connor Pearson
4acf8e5dc8 Bug 1654541 - fit-content percentage should only clamp when definite. r=emilio,layout-grid-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D226204
2024-10-30 15:40:34 +00:00
serge-sans-paille
262f78c07f Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc
a5eb905bf4 Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
07101ac24d Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
004e704b22 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
2c916d4973 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Emily McDonough
6c474e0521 Bug 1924584 - Document spec steps and links for intrinsic sizing of grid container tracks. r=dholbert DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D225556
2024-10-16 01:41:01 +00:00
David Shin
e52d21fa25 Bug 1900232: Part 5 - Add anchor-size() to sizing properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222534
2024-09-23 13:58:38 +00:00
David Shin
41f83d368b Bug 1900232: Part 2 - Create one place to shim inset getters. r=firefox-style-system-reviewers,emilio
... Instead of handling `anchor()` function at each site manually.

Differential Revision: https://phabricator.services.mozilla.com/D222531
2024-09-23 13:58:37 +00:00
Boris Chiou
918475f5c7 Bug 1865438 - Resolve percentage of ratio determining size for grid repetition auto. r=TYLin
Now we pass the containing block size and use it to resolve the
percentage value of ratio-determining size.

Differential Revision: https://phabricator.services.mozilla.com/D221397
2024-09-17 18:21:05 +00:00
Boris Chiou
7335b67ea8 Bug 1865438 - Add transferred min & max size when computing the reflowInput for repeat(). r=TYLin
We rely on the min/max sizes in the RepeatTrackSizingInput to determine
how many auto-repeat items we can place, so we have to make sure we take
aspect-ratio into account. So if we have aspect-ratio, we need to take
it into account and use the ratio-determining size to compute the
transferred min/max/preferred size.

However, we don't have the information of containing block now, and
we will fix the case if the ratio determining size has percentage in the
following patch.

Differential Revision: https://phabricator.services.mozilla.com/D195199
2024-09-17 18:21:05 +00:00
Ting-Yu Lin
6af05a0977 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.

When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-09-03 04:25:41 +00:00
Butkovits Atila
4d06404349 Backed out 6 changesets (bug 1909761) for causing failures at test_contextmenu_rtl.xhtml. CLOSED TREE
Backed out changeset 1e9f47784a54 (bug 1909761)
Backed out changeset d2dcf159185b (bug 1909761)
Backed out changeset 3f48c106bff9 (bug 1909761)
Backed out changeset 38d1e5eda09d (bug 1909761)
Backed out changeset 8de556490289 (bug 1909761)
Backed out changeset 4e7f22f43bb4 (bug 1909761)
2024-08-28 10:44:09 +03:00
Ting-Yu Lin
f0ff97db90 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.

When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-08-28 06:18:44 +00:00
Emily McDonough
63c1f671af Bug 1841677 - Fix incorrect flooring of grid auto-repeat with minmax(.., ..)) when max < min r=dholbert
This was already happening correctly when placing grid items, but it was not
implemented correctly when measuring the overal grid size.

Ideally, MaxSizingFor or some kind of replacement could do this kind of check
already. If you don't want to fiddle around with sizing functions then you
probably want to perform this check every time, and if you really need the
max sizing function directly you can just get it with SizingFor.

Differential Revision: https://phabricator.services.mozilla.com/D220196
2024-08-27 23:12:35 +00:00
Ting-Yu Lin
a024d0e616 Bug 1914661 Part 3 - Add ReflowInput::SetBResizeForPercentages(). r=dholbert
We have `SetBResize()`, so it would be useful to add a method to set
`mIsBResizeForPercentages` flag for consistency.

Differential Revision: https://phabricator.services.mozilla.com/D220023
2024-08-23 19:52:50 +00:00
Ting-Yu Lin
cac8ac479b Bug 1914661 Part 1 - Rename NS_CSS_MINMAX, and move it into mozilla namespace. r=dholbert
`NS_CSS_MINMAX` looks like a macro, but it is a function. Let's name it like a
function.

Differential Revision: https://phabricator.services.mozilla.com/D220021
2024-08-23 19:52:49 +00:00
Ting-Yu Lin
e11df5d2a8 Bug 1912600 - Update spec links and comments in grid container. r=dholbert
It is better to include the level number in the URL (e.g. css-grid-2) since the
chapter number might differ between level 1 and level 2. Note: subgrid is
defined in level 2.

Differential Revision: https://phabricator.services.mozilla.com/D219013
2024-08-12 03:15:17 +00:00
Ting-Yu Lin
2969a5e0cb Bug 1909995 Part 2 - Add IntrinsicISize() as a helper to implement GetMinISize() and GetPrefISize(). r=layout-reviewers,emilio
Most frame types have identical or very similar implementation for GetMinISize()
and GetPrefISize(), and many of them already have `IntrinsicISize()` to unify
the implementation. This patch introduces nsIFrame::IntrinsicISize() so that
derived classes only need to override one method.

`nsBlockFrame`, `ColumnSetWrapperFrame`, and `nsColumnSetFrame` are the only
three classes where their `GetMinISize()` and `GetPrefISize()` have significant
differences. Therefore, we rename `GetMinISize()` and `GetPrefISize()` to
`MinISize()` and `PrefISize`, respectively, and use them as helpers to implement
their `IntrinsicISize()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D217790
2024-07-26 20:54:56 +00:00
Daniel Holbert
56c38ff56f Bug 1909773 part 2: Create BehavesLikeStretchOnInlineAxis() utility-function as an abstraction for the '-moz-available' sizing behavior. r=emilio
This patch doesn't change behavior.

The '-moz-available' keyword is our closest equivalent to the CSS 'stretch'
keyword, *specifically* for the inline axis (since we currently nerf
'-moz-available' to behave like the initial value in the block axis). Hence, it
makes sense to say that the '-moz-available' keyword "Behaves Like Stretch On
Inline Axis".

By abstracting the existing behavior behind this helper-function, we can
start implementing the actual 'stretch' value in terms of this existing
behavior, in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D217685
2024-07-25 18:18:23 +00:00
Iulian Moraru
c5a0ab3de8 Backed out 2 changesets (bug 1908320) for causing wr failures on align-items-baseline-column-vert.html. CLOSED TREE
Backed out changeset 86c1052ebb70 (bug 1908320)
Backed out changeset 99afd830a8bd (bug 1908320)
2024-07-19 15:04:32 +03:00
Tiaan Louw
496b2d1da8 Bug 1908320 - No baseline alignment if there are no parallel items. r=layout-reviewers,emilio
If an alignment group has no items with a baseline parallel to the
baseline alignment axis, then the fallback alignment is used.

Differential Revision: https://phabricator.services.mozilla.com/D216794
2024-07-19 10:35:14 +00:00
Tiaan Louw
e03908e291 Bug 1908320 - Orthogonal items should also participate in baseline alignment r=layout-reviewers,emilio
All items in an alignment context should be checked for baseline
alignment.  Items that turn out to be orthogonal to the alignment
context should synthesize a baseline.

`grid-self-baseline-horiz-004.html.ini` and
`grid-self-baseline-vertical-rl-003.html.ini` are fixed in the follow
up patch: D216794.

The other errors are due to previously succeeding by chance.

Differential Revision: https://phabricator.services.mozilla.com/D216793
2024-07-19 10:35:14 +00:00
Ting-Yu Lin
38f5786fbe Bug 1906792 Part 3 - Move ContainIntrinsicISize() calls into IntrinsicISize() helper for flex and grid container. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D216000
2024-07-09 18:49:33 +00:00
Jonathan Watt
53bb6cb24a Bug 1900195. Remove support for the 'align-tracks' and 'justify-tracks' properties. r=emilio
These properties were added as part of the experimental Masonry support added
in bug 1607954. Since then the CSS WG resolved to remove these properties in:
https://github.com/w3c/csswg-drafts/pull/9529

This patch is a fairly brain dead removal of the properties, simply changing
the consumer code to take the code paths that would have been taken previously
if the properties were not set. That leaves some obvious dead code, which has
been removed, but no attempt has been made to redesign the Masonry code to
"make sense" without these properties. That would require a more prolonged
effort to understand Masonry, how the spec has changed in the last four years,
and how we should best change our code.

For now, this removal is simply focused on reducing the amount of memory used
by nsStyleDisplay to unblock the landing of bug 1899949.

Differential Revision: https://phabricator.services.mozilla.com/D212358
2024-06-02 00:16:26 +00:00
Ting-Yu Lin
5cdee429ce Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-30 06:32:22 +00:00
Ting-Yu Lin
19542ed32d Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-30 06:32:18 +00:00
Sebastian Hengst
bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin
37e9b779f9 Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-28 04:46:20 +00:00
Ting-Yu Lin
7e7ff289d4 Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-28 04:46:17 +00:00
Ting-Yu Lin
27bb908f13 Bug 1824877 Part 2 - Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame. r=dholbert
Also, change the ScrollContainerFrame::GetFrameName() to return
"ScrollContainer" instead of "HTMLScroll".

Differential Revision: https://phabricator.services.mozilla.com/D210233
2024-05-15 17:50:48 +00:00
Ting-Yu Lin
53837706d6 Bug 1824877 Part 1 - Rename nsGfxScrollFrame.{h,cpp} to ScrollContainerFrame.{h,cpp}. r=dholbert
Remove the #include from `nsFrameState.cpp` because it is not used.

Differential Revision: https://phabricator.services.mozilla.com/D210232
2024-05-15 17:50:48 +00:00
Daniel Holbert
150ae54eff Bug 1410243: Make nsGridContainerFrame give each child a dedicated ReflowStatus to use for reflow. r=TYLin
This matches what we do in flexbox, here:
https://searchfox.org/mozilla-central/rev/8c3ca2f5a74e0ba59c3d9dddf5468a2ffab13467/layout/generic/nsFlexContainerFrame.cpp#2024,2033-2035,2038-2042

We have fuzzer testcases where the child reflow sets the reflow status to
"OverflowIncomplete", which is fine from the perspective of the
immediately-following "IsComplete()" assertion in the contextual code of this
patch; but it's not fine if we then go on to reuse that
already-set-to-OverflowIncomplete status for another child's reflow.

Differential Revision: https://phabricator.services.mozilla.com/D207094
2024-04-19 16:06:29 +00:00
Ting-Yu Lin
ecc8d53a54 Bug 1891173 - Convert PhysicalAxis to an enum class. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D207332
2024-04-15 22:17:25 +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
Emilio Cobos Álvarez
a9cdcefbb5 Bug 1887867 - Fix button-as-subgrid border/padding computations. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D206896
2024-04-08 19:49:29 +00:00
Ting-Yu Lin
8a77ebbb16 Bug 1888535 Part 5 - Remove DISPLAY_REFLOW. r=layout-reviewers,emilio
It is used in `Reflow()` implementations.

Differential Revision: https://phabricator.services.mozilla.com/D206317
2024-04-02 19:03:05 +00:00
Ting-Yu Lin
319fc12b73 Bug 1888535 Part 4 - Remove DISPLAY_PREF_INLINE_SIZE and DISPLAY_MIN_INLINE_SIZE. r=layout-reviewers,emilio
The two macros are used in `GetPrefISize()` and `GetMinISize()` implementations.
After removing them, we could further simplify some implementations because we
don't need a `result` variable in many cases.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D206316
2024-04-02 19:03:04 +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
flowejam
9d4992fcc6 Bug 1885693: Converted LogicalSide to an enum class, and renamed variables accordingly. r=TYLin
Values were static_casted where required. Some functions in WritingModes.h were
rewritten such that bitwise operations aren't being used. Added static_casts to
avoid (debug) build errors from debugging printfs in layout/tables/nsCellMap.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D205510
2024-03-26 17:55:16 +00:00
Ting-Yu Lin
6e96b5881a Bug 1881495 part 1: Add ShrinkWrap flag for grid items that are self-aligned (not stretched) in MeasuringReflow(). r=dholbert
Bug 1350037 Part 3 [1] removed the code in ReflowInput that adds `ShrinkWrap`
flag self-aligned grid items, to prevent the table-caption from getting aligned
behavior, but it accidentally broke self-aligned behavior for other types of
frames that are grid items.

We actually already check if we need to add `ShrinkWrap` in grid item's final
reflow [2], but we were missing the same logic in `MeasuringReflow()`. This
patch adds that.

[1] https://hg.mozilla.org/mozilla-central/rev/6e8085865f74
[2] https://searchfox.org/mozilla-central/rev/202c48686136360a23b73a49b611a19e64f3e1b8/layout/generic/nsGridContainerFrame.cpp#7651,7657

Differential Revision: https://phabricator.services.mozilla.com/D203514
2024-03-05 00:50:31 +00:00
Ting-Yu Lin
49e3e60117 Bug 1879770 Part 2 - Add a helper to query intrinsic scrollbar-gutter size for subgrid. r=emilio
See https://bugzilla.mozilla.org/show_bug.cgi?id=1879770#c2 for an analysis.

Differential Revision: https://phabricator.services.mozilla.com/D201893
2024-03-04 14:30:23 +00:00
Tiaan Louw
a8554ca864 Bug 1878846 - Take writing mode into account when calculating baseline sharing group. r=layout-reviewers,dholbert,emilio
https://drafts.csswg.org/css-align-3/#baseline-terms
The baseline sharing group is not equal to the baseline specified for
the item. It has to be calculated separately.  The baseline sharing
group determines on which side of the block the item is aligned, but the
specified baseline is still used to determine the baseline of the item.

Depends on D200767

Differential Revision: https://phabricator.services.mozilla.com/D200768
2024-02-20 10:05:12 +00:00
Norisz Fay
abe66c049b Backed out changeset c59a7f7b8852 (bug 1878846) for causing Wr failures on align-items-baseline-row-vert.html 2024-02-14 18:40:55 +02:00
Tiaan Louw
446572e28a Bug 1878846 - Take writing mode into account when calculating baseline sharing group. r=layout-reviewers,dholbert,emilio
https://drafts.csswg.org/css-align-3/#baseline-terms
The baseline sharing group is not equal to the baseline specified for
the item. It has to be calculated separately.  The baseline sharing
group determines on which side of the block the item is aligned, but the
specified baseline is still used to determine the baseline of the item.

Differential Revision: https://phabricator.services.mozilla.com/D200768
2024-02-14 10:39:43 +00:00
Iulian Moraru
ea16d6b212 Backed out changeset b6eb0c382d2f (bug 1878846) for causing wr failures on masonry-grid-item-content-baseline-001.html. CLOSED TREE 2024-02-13 00:55:32 +02:00
Tiaan Louw
57997c4c5a Bug 1878846 - Take writing mode into account when calculating baseline sharing group. r=layout-reviewers,dholbert,emilio
https://drafts.csswg.org/css-align-3/#baseline-terms
The baseline sharing group is not equal to the baseline specified for
the item. It has to be calculated separately.  The baseline sharing
group determines on which side of the block the item is aligned, but the
specified baseline is still used to determine the baseline of the item.

Differential Revision: https://phabricator.services.mozilla.com/D200768
2024-02-12 21:56:07 +00:00
Tiaan Louw
2e3c1d2a54 Bug 1878846 - Change grid items to use PerLogicalAxis types. r=TYLin
This avoids using raw integer values which might cause bugs.
Also removed a clang-format: off block for better formatting.

Differential Revision: https://phabricator.services.mozilla.com/D200767
2024-02-12 21:51:00 +00:00