Commit Graph

753 Commits

Author SHA1 Message Date
David Shin
61d5b05704 Bug 1945944: Add flag to dump frame tree with only deterministic information for diffing. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D236797
2025-02-06 15:34:27 +00:00
Emily McDonough
94bbab1b23 Bug 1946236 - Update a bug link for implementing the grid sizing algorithm r=layout-grid-reviewers,TYLin DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D236955
2025-02-05 23:06:58 +00:00
Ting-Yu Lin
42256d68d1 Bug 1945003 Part 3 - Rename remaining GridReflowInput variables. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D236291
2025-02-01 01:03:38 +00:00
Ting-Yu Lin
fd748fc6b3 Bug 1945003 Part 2 - Rename GridReflowInput parameters from aState to aGridRI. r=dholbert
Bug 1277129 renamed `GridReflowState` to `GridReflowInput`, hence the renaming
of these parameters. This change also helps distinguish these variables from
`GridItemInfo::mState` and `TrackSize::mState`.

Differential Revision: https://phabricator.services.mozilla.com/D236290
2025-02-01 01:03:38 +00:00
Ting-Yu Lin
50e1488176 Bug 1945003 Part 1 - Convert typedef to using in nsGridContainerFrame.cpp. r=dholbert
Also, sort the existing `using` declarations.

Differential Revision: https://phabricator.services.mozilla.com/D236289
2025-02-01 01:03:37 +00:00
Ting-Yu Lin
fe32255255 Bug 1930672 - Resolve percentage sizes when computing auto repeat grid tracks. r=layout-grid-reviewers,tlouw
Differential Revision: https://phabricator.services.mozilla.com/D229379
2025-01-29 05:02:42 +00:00
Ting-Yu Lin
e2666b9103 Bug 1936854 - Disregard inline-size property when computing grid intrinsic inline size with auto repeat tracks. r=layout-grid-reviewers,dholbert
`RepeatTrackSizingInput::InitFromStyle()` is called in
`nsGridContainerFrame::ComputeIntrinsicISize()`. When we compute a frame's
intrinsic inline size, its inline-size property should not affect the result.

Differential Revision: https://phabricator.services.mozilla.com/D235879
2025-01-29 05:02:42 +00:00
Emily McDonough
87603e55fc Bug 1938619 - Add a pref (disabled by default) to enable intrinsic sizing of flexible grid tracks based on grid items that span multiple tracks. r=layout-grid-reviewers,dholbert
The pref layout.css.grid-flex-spanning-items-intrinsic-sizing.enabled is
expected to be removed once these regressions are fixed. This should be a good
compromise between maintaining the code from bug 1916849, and avoiding
breakage/extra backouts.

Differential Revision: https://phabricator.services.mozilla.com/D235089
2025-01-24 06:30:03 +00:00
David Shin
3d615cb7f6 Bug 1923763: Part 5 - Replace inset evaluations with anchor-resolved inset evaluations. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D231259
2025-01-21 15:11:25 +00:00
Stanca Serban
4a35296e0c Backed out 7 changesets (bug 1923763) for causing build bustages in nsStyleStruct.cpp. CLOSED TREE
Backed out changeset d55070e64ced (bug 1923763)
Backed out changeset a92a0bc6047f (bug 1923763)
Backed out changeset 2203e2c5268e (bug 1923763)
Backed out changeset 0cc5e744c01a (bug 1923763)
Backed out changeset d2139afa933b (bug 1923763)
Backed out changeset 93e59980eac1 (bug 1923763)
Backed out changeset 8018734b5491 (bug 1923763)
2025-01-21 11:10:22 +02:00
David Shin
6b9f17e7ff Bug 1923763: Part 5 - Replace inset evaluations with anchor-resolved inset evaluations. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D231259
2025-01-20 23:54:50 +00:00
Ting-Yu Lin
75c9013d4c Bug 1878371 - Fix overflow alignment for distributed alignment values for grid. r=layout-grid-reviewers,dholbert
Per the CSS Align specification, 'space-between', 'space-around', and
'space-evenly' should use a "safe" fallback alignment when overflow occurs. This
patch implements that behavior, renames the function for clarity, and removes
unused parameters.

Differential Revision: https://phabricator.services.mozilla.com/D234755
2025-01-19 22:01:47 +00:00
Emily McDonough
fe2ef59f06 Bug 1941643 - Simplify a lambda in SubgridComputeMarginBorderPadding r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D234208
2025-01-15 00:04:26 +00:00
Emily McDonough
f8475ff189 Bug 1916849 - Implement intrinsic sizing for spanning grid items with flex tracks. r=tlouw,dholbert
This has a couple unfortunate parts to its implementation. In particular, the
adjustment to ShouldApplyAutoMinSize are difficult to explain other than that
function doesn't actually calculate if the minimum contribution of an item is
content-based, but rather checks if the caller should also call MinSize or not.

Part of this calculation includes checking the min-size-auto of the item, but
some are just matching checks for special cases in MinSize.

This could be optimized, and should definitely be refactored to simplify how
all of this is computed.

This still doesn't quite correctly handle all cases for items spanning flex
tracks and tracks with a definite length, but that case is already not handled
correctly so this won't introduce any regressions for that case unless the
expected result is that such an item will have an intrinsic size of zero. In
that case, simply not calculating anything would accidentally be the correct
value, and this new calculation may or may not produce that result.

Differential Revision: https://phabricator.services.mozilla.com/D230829
2024-12-19 23:55:10 +00:00
Ting-Yu Lin
0db103d4b6 Bug 1936276 - Revert Bug 1930672 to fix the overlapping icons on beta.destinyitemmanager.com. r=layout-reviewers,dholbert
This reverts commit https://hg.mozilla.org/mozilla-central/rev/4f3dfc147a61
after resolving the code conflict with Bug 1933101 Part 2
https://hg.mozilla.org/mozilla-central/rev/03da611d9c58

Differential Revision: https://phabricator.services.mozilla.com/D231879
2024-12-12 17:05:46 +00:00
Emily McDonough
9cc098f109 Bug 1936412 - Make comment for ShouldApplyAutoMinSize more correct, rename MinSize to MinContribution. r=tlouw
Differential Revision: https://phabricator.services.mozilla.com/D231748
2024-12-11 17:45:42 +00:00
Emily McDonough
bab7612ef0 Bug 1933803 - Remove explicitly stored per-span data from nsGridContainerFrame::Tracks::ResolveIntrinsicSize r=dholbert
Whether not this is actually useful to store separately is debatable.
While we will need to iterate spans to recalculate this in step 3, we
already need to iterate the tracks multiple times for step 3 so this
doesn't affect the complexity of the operation and this iteration is
relatively cheap.

This data was stored in an auto-array. This means that we only allocate
when the max span is large, but this means we either would do a larger
allocation before, or do more iterations now. At least now, we don't
allocate a big array for a single span, and the complexity of the
iteration is linear in the dimensions of the number of total spans and
the number of tracks in all spans combined, multiplied together. This
is the same complexity of each call to GrowSizeForSpanningItems, and so
is already the complexity of step 3 as a whole.

Differential Revision: https://phabricator.services.mozilla.com/D230438
2024-12-02 20:04:30 +00:00
Ting-Yu Lin
82948d6d24 Bug 1933101 Part 3 - Simplify MinSize() in nsGridContainerFrame.cpp. r=layout-reviewers,emilio
This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D230065
2024-11-25 16:38:54 +00:00
Ting-Yu Lin
d83ba680ad Bug 1933101 Part 2 - Add BehavesLikeInitialValue() to StyleSize and StyleMaxSize. r=layout-reviewers,emilio
Ideally, `BehavesLikeInitialValue()` should be defined via
`IMPL_BEHAVES_LIKE_SIZE_METHODS` macro in ServoStyleConstsInlines.h. However, it
accepts `LogicalAxis`, which is defined in `WritingModes.h`. Therefore, we have
to implement it in `WritingModes.h`.

Differential Revision: https://phabricator.services.mozilla.com/D230064
2024-11-25 16:38:53 +00:00
Ting-Yu Lin
e6851290c7 Bug 1933101 Part 1 - Use StyleSize::Size() instead of ISize() and BSize() separately. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D230063
2024-11-25 16:38:53 +00:00
Emilio Cobos Álvarez
a5184c1852 Bug 1926015 - Percentage-basis aware intrinsic cache. r=TYLin,dholbert
This avoids returning wrong intrinsic values with different calls into
intrinsic size computation, which is wrong by definition.

We shouldn't be wallpapering over it by clearing intrinsic sizes
mid-layout as the original patch was doing.

Differential Revision: https://phabricator.services.mozilla.com/D229621
2024-11-21 19:55:31 +00:00
Adi
b34823b0fe Backed out 5 changesets (bug 1926015) for causing crashtest failures @1730506.html. CLOSED TREE
Backed out changeset 7df628ab162c (bug 1926015)
Backed out changeset a3524c96da73 (bug 1926015)
Backed out changeset cfbf0fa7bf8d (bug 1926015)
Backed out changeset 2c2f56268bd7 (bug 1926015)
Backed out changeset 55175ed82058 (bug 1926015)
2024-11-21 21:28:08 +02:00
Emilio Cobos Álvarez
2e6b4fa1dc Bug 1926015 - Percentage-basis aware intrinsic cache. r=TYLin,dholbert
This avoids returning wrong intrinsic values with different calls into
intrinsic size computation, which is wrong by definition.

We shouldn't be wallpapering over it by clearing intrinsic sizes
mid-layout as the original patch was doing.

Differential Revision: https://phabricator.services.mozilla.com/D229621
2024-11-21 17:04:14 +00:00
Ting-Yu Lin
863bab3170 Bug 1930672 - Resolve percentage sizes when computing auto repeat grid tracks. r=layout-grid-reviewers,tlouw
Differential Revision: https://phabricator.services.mozilla.com/D229379
2024-11-20 00:22:57 +00:00
Emily McDonough
68b6971878 Bug 1931594 - Do not apply auto min size for grid items that span multiple tracks if any of those tracks are flexible. r=layout-grid-reviewers,tlouw
This currently does not actually affect anything, as we do not do intrinsic
sizing for grid items that span multiple tracks if any of those tracks are
flexible anyway.
This is in preparation to do intrinsic sizing for those items in Bug 1916849.

Differential Revision: https://phabricator.services.mozilla.com/D229189
2024-11-19 02:04:31 +00:00
Ting-Yu Lin
1ab1d9fab1 Bug 1931478 - Replace mozilla::Clamp with std::clamp in nsGridContainerFrame.cpp. r=layout-reviewers,emilio
`std::clamp()` requires `min <= max`. In
`RepeatTrackSizingInput::InitFromStyle()`, it computes `max` as
`max = std::max(min, resolved-max-value)` in
https://searchfox.org/mozilla-central/rev/4e69784010d271c0fce0927442e4f8e66ffe645b/layout/generic/nsGridContainerFrame.cpp#326-337

Therefore, the `max` value is never less than `min`, satisfying `min <= max`
when calling `std::clamp` to compute `size`. Hence, this patch doesn't change
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D229098
2024-11-15 20:53:26 +00:00
David Shin
ee160a66f7 Bug 1920160: Part 4 - Move CSSAlignmentForAbsPosChild to nsContainerFrame. r=jwatt,firefox-style-system-reviewers,emilio
Absolutely positioned elements can be aligned, so it no longer
is grid-specific.

Differential Revision: https://phabricator.services.mozilla.com/D226530
2024-11-07 16:33:41 +00:00
longsonr
843d861ed7 Bug 1929338 - convert more mozilla:clamped to std:clamp r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D228069
2024-11-05 18:52:41 +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
eea5781b8f Bug 1920160: Part 4 - Move CSSAlignmentForAbsPosChild to nsContainerFrame. r=jwatt,firefox-style-system-reviewers,emilio
Absolutely positioned elements can be aligned, so it no longer
is grid-specific.

Differential Revision: https://phabricator.services.mozilla.com/D226530
2024-11-05 00:44:43 +00:00
Ting-Yu Lin
a54bdd3541 Bug 1928241 - Update references to grid spec to level 2. r=dholbert DONTBUILD
For Grid Layout Algorithm, the difference between level 1 & 2 is just section
number. There is no additional top level steps in level 2.

Differential Revision: https://phabricator.services.mozilla.com/D227419
2024-11-01 05:45:50 +00:00
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