Commit Graph

707 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
b899a4e0c6 Bug 1942036 - Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D234711
2025-01-20 19:30:52 +00:00
Goloman Adrian
ee62a27e0b Backed out changeset d291e613ef7b (bug 1942036) for causing wpt failures @scrollWidthHeight-overflow-visible-negative-margins.html. CLOSED TREE 2025-01-19 01:31:06 +02:00
Emilio Cobos Álvarez
7c91dd9780 Bug 1942036 - Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D234711
2025-01-18 21:41:49 +00:00
Stanca Serban
5495b295cb Backed out changeset 3f6d1963e0e0 (bug 1942036) for causing wpt failures in scrollWidthHeight-overflow-visible-negative-margins.html. CLOSED TREE 2025-01-18 19:00:26 +02:00
Emilio Cobos Álvarez
0e9411cda1 Bug 1942036 - Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D234711
2025-01-18 13:58:15 +00:00
Sandor Molnar
959e980e6e Backed out changeset 87e1173b9098 (bug 1942036) for causing multiple reftest/mochitest failures. CLOSED TREE 2025-01-17 21:31:25 +02:00
Emilio Cobos Álvarez
2ad04429e3 Bug 1942036 - Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D234711
2025-01-17 18:17:42 +00:00
Emilio Cobos Álvarez
342cb387e1 Bug 1936156 - Don't consider collapsed margins for in-flow line bounds if we're not a BFC. r=dshin
So that our client{Width,Height} and scroll{Width,Height} calculations
make sense.

Differential Revision: https://phabricator.services.mozilla.com/D231629
2024-12-11 17:02:25 +00:00
Jonathan Kew
55066c9ce0 Bug 1887465 - Introduce UsedFloat and UsedClear types in layout, for the used values of CSS float and clear properties after resolving logical values. r=layout-reviewers,emilio
No change in behavior, just makes it clearer when we're working with used values
where the inline-* logical values have been resolved.

Differential Revision: https://phabricator.services.mozilla.com/D230029
2024-11-25 22:58:47 +00:00
Alexandru Marc
ed1511635d Backed out 2 changesets (bug 1887465) for causing build bustages @ WritingModes.h . CLOSED TREE
Backed out changeset 5203c09eceb4 (bug 1887465)
Backed out changeset 0507fcccf575 (bug 1887465)
2024-11-25 18:47:23 +02:00
Jonathan Kew
4d1ec66bf7 Bug 1887465 - Introduce UsedFloat and UsedClear types in layout, for the used values of CSS float and clear properties after resolving logical values. r=layout-reviewers,emilio
No change in behavior, just makes it clearer when we're working with used values
where the inline-* logical values have been resolved.

Differential Revision: https://phabricator.services.mozilla.com/D230029
2024-11-25 14:02:27 +00:00
Emilio Cobos Álvarez
b1269ccea6 Bug 1932800 - Fix caret baseline of empty inline and text frames. r=dshin
Added Gecko reftests because I don't know what the best place to put
them in WPT is, and caret rendering is kind of undefined, but...

Differential Revision: https://phabricator.services.mozilla.com/D229926
2024-11-24 14:46:16 +00:00
Goloman Adrian
caa559759f Backed out 3 changesets (bug 1932800) for causing marionette failures @test_accessiblecaret_cursor_mode.py. CLOSED TREE
Backed out changeset f40a44add850 (bug 1932800)
Backed out changeset 7cda61151052 (bug 1932800)
Backed out changeset 4974ccf274fa (bug 1932800)
2024-11-24 15:16:48 +02:00
Emilio Cobos Álvarez
b121dde1da Bug 1932800 - Fix caret baseline of empty inline and text frames. r=dshin
Added Gecko reftests because I don't know what the best place to put
them in WPT is, and caret rendering is kind of undefined, but...

Differential Revision: https://phabricator.services.mozilla.com/D229926
2024-11-23 12:46:48 +00:00
Sandor Molnar
e7348a5625 Backed out 3 changesets (bug 1932800) for causing reftest failures. CLOSED TREE
Backed out changeset c06b939ca2f2 (bug 1932800)
Backed out changeset 048956318eb0 (bug 1932800)
Backed out changeset 333442d03d1a (bug 1932800)
2024-11-23 12:40:11 +02:00
Emilio Cobos Álvarez
8121200d6a Bug 1932800 - Fix caret baseline of empty inline and text frames. r=dshin
Added Gecko reftests because I don't know what the best place to put
them in WPT is, and caret rendering is kind of undefined, but...

Differential Revision: https://phabricator.services.mozilla.com/D229926
2024-11-23 09:00:29 +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
Jonathan Kew
2f12a74934 Bug 1930225 - Update nsBlockFrame marker-property callsites to avoid redundant property lookups. r=layout-reviewers,emilio
No change in observable behavior.

Differential Revision: https://phabricator.services.mozilla.com/D229111
2024-11-15 17:57:18 +00:00
Jonathan Kew
209c03cc6c Bug 1930225 - Ensure nsBlockFrame::Has{Inside,Outside}Marker methods return the correct value even if style has changed since the marker was created. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D229027
2024-11-15 17:57:17 +00:00
David Shin
c35c146cbd Bug 1768921 - Ensure that padding inflated bounds of in-flow children are included in the scrollable element's overflow area. r=dholbert
This means that when users scroll to the inline-end of a scroller, they will
see that the inline-end padding of that scroller is added in.

This is achieved by unioning an additional rect into the scrollable element's
overflow area (Which is an accumulation of the recursive overflow-area
contributions from its subtree).

This additional rect is calculated as follows:
- In-flow children and float's margin boxes are unioned (including zero-size boxes)
- The unioned rect is then inflated by the scrollable element's padding

Note: The bounds of zero-area in-flow-child rects are included in this rect,
in both block- and inline- directions. This is a change in behavior; Divs of
huge inline size and zero block size used to not affect the scrollable overflow,
where divs with huge block size and zero inline size did, as a side effect of now
removed `nsBlockFrame::ConsiderBlockEndEdgeOfChildren`.

Note on WPT change sizing-orthog-(vlr|vrl)-in-htb-(008|020)-ref.xht - the padding existed
to force empty space below `p#sentence-after`. However, this only applies to previous
Firefox. Any combination of browser + default font (+ its default size) causing a scroll
would cause the test to fail as false positive (According to wpt.fyi, this is what happens
with sizing-orthog-(vlr|vrl)-008.xht tests). This change brings Firefox's scroll behaviour
inline with other browsers.

Differential Revision: https://phabricator.services.mozilla.com/D151310
2024-11-13 20:29:13 +00:00
Norisz Fay
07ccada8ce Backed out changeset 1445e1cfc71f (bug 1768921) for causing multiple failures CLOSED TREE 2024-11-08 00:09:56 +02:00
David Shin
361dd30414 Bug 1768921 - Ensure that padding inflated bounds of in-flow children are included in the scrollable element's overflow area. r=dholbert
This means that when users scroll to the inline-end of a scroller, they will
see that the inline-end padding of that scroller is added in.

This is achieved by unioning an additional rect into the scrollable element's
overflow area (Which is an accumulation of the recursive overflow-area
contributions from its subtree).

This additional rect is calculated as follows:
- In-flow children and float's margin boxes are unioned (including zero-size boxes)
- The unioned rect is then inflated by the scrollable element's padding

Note: The bounds of zero-area in-flow-child rects are included in this rect,
in both block- and inline- directions. This is a change in behavior; Divs of
huge inline size and zero block size used to not affect the scrollable overflow,
where divs with huge block size and zero inline size did, as a side effect of now
removed `nsBlockFrame::ConsiderBlockEndEdgeOfChildren`.

Note on WPT change sizing-orthog-(vlr|vrl)-in-htb-(008|020)-ref.xht - the padding existed
to force empty space below `p#sentence-after`. However, this only applies to previous
Firefox. Any combination of browser + default font (+ its default size) causing a scroll
would cause the test to fail as false positive (According to wpt.fyi, this is what happens
with sizing-orthog-(vlr|vrl)-008.xht tests). This change brings Firefox's scroll behaviour
inline with other browsers.

Differential Revision: https://phabricator.services.mozilla.com/D151310
2024-11-07 21:03:05 +00:00
Emilio Cobos Álvarez
c3d7719c2c Bug 1791226 - Don't paint line-clamped lines. r=layout-reviewers,dshin
This matches the proposal in
https://github.com/w3c/csswg-drafts/pull/10816, and creates much better
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D157578
2024-10-21 10:41:26 +00:00
Cristina Horotan
86102c2240 Backed out changeset c6ce92301ca1 (bug 1791226) for causing assertion failures at nsBlockFrame.cpp on a CLOSED TREE 2024-10-19 04:50:37 +03:00
Emilio Cobos Álvarez
90631bc35d Bug 1791226 - Don't paint line-clamped lines. r=layout-reviewers,dshin
This matches the proposal in
https://github.com/w3c/csswg-drafts/pull/10816, and creates much better
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D157578
2024-10-18 23:03:13 +00:00
Emilio Cobos Álvarez
9381d7e414 Bug 1791226 - Improve line-clamp behavior with padding / nested blocks. r=layout-reviewers,dshin
This matches Blink with border / padding in nested blocks, and seems
worth doing even if we paint the nested lines. Follow-up patch will
prevent painting the nested lines.

Differential Revision: https://phabricator.services.mozilla.com/D157572
2024-10-18 19:21:22 +00:00
Tamas Szentpeteri
3c21e7547c Backed out changeset 8396d1845d92 (bug 1791226) for causing wr failures on webkit-line-clamp-050.html. CLOSED TREE 2024-10-18 20:08:05 +03:00
Emilio Cobos Álvarez
f38521a63a Bug 1791226 - Harvest a block frame state bit. r=layout-reviewers,jfkthame
This will be useful.

Differential Revision: https://phabricator.services.mozilla.com/D223433
2024-10-18 13:10:54 +00:00
Emilio Cobos Álvarez
5d2e26f710 Bug 1791226 - Improve line-clamp behavior with padding / nested blocks. r=layout-reviewers,dshin
This matches Blink with border / padding in nested blocks, and seems
worth doing even if we paint the nested lines. Follow-up patch will
prevent painting the nested lines.

Differential Revision: https://phabricator.services.mozilla.com/D157572
2024-10-18 12:15:15 +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
Jonathan Kew
800340ccc6 Bug 727831 - Use the line cursor to optimize nsBlockFrame::DoRemoveFrame, to avoid perf cliff when reflowing/modifying large blocks of text. r=layout-reviewers,emilio
This is basically Mats' line-cursor patch from 2012, updated to account for changes
in nsBlockFrame that have happened since then.

The example in https://bugzilla.mozilla.org/show_bug.cgi?id=1911451, for instance,
benefits hugely from this. Profile of resizing the textarea in the example there,
after pasting in the huge JS source:

Current mozilla-central: https://share.firefox.dev/3M6gUui
(truncated because I got tired of waiting for the reflow to finish)

With this patch applied: https://share.firefox.dev/46RMmpy
It's still janky, but only takes a second or so to reflow at each step.

Differential Revision: https://phabricator.services.mozilla.com/D219358
2024-08-22 12:55:40 +00:00
Emilio Cobos Álvarez
a012cd6770 Bug 1906475 - Improve scroll{Width,Height} implementation for overflow: visible frames. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D218782
2024-08-15 15:02:00 +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
Ting-Yu Lin
d52e3dc178 Bug 1903141 Part 3 - Store floats list in a frame property rather than in nsBlockFrame::mFloats. r=dholbert
On optimized builds for all desktop platforms, `nsBlockFrame` is 192 bytes, and
`mFloats` is 16 bytes. With this patch, we can reduce the size of `nsBlockFrame`
to 176 bytes, saving 8.33% memory on every `nsBlockFrame` and its derived
subclasses allocated.

On a real webpage like https://en.wikipedia.org/wiki/Firefox, `about:memory`
shows that we allocate 0.36 MB of `nsBlockFrame` consistently. After this patch,
we allocate 0.33 MB, saving approximately 30 KB (0.36 MB * 8.33%) of the memory.

Differential Revision: https://phabricator.services.mozilla.com/D214046
2024-06-19 21:50:41 +00:00
Ting-Yu Lin
761d698a01 Bug 1903141 Part 2 - Annotate EnsurePushedFloats() as MOZ_NONNULL_RETURN. r=dholbert
`EnsurePushedFloats()` either returns the existing pushed floats list or creates
a new empty one. Therefore, it can never return nullptr.

Differential Revision: https://phabricator.services.mozilla.com/D214045
2024-06-19 21:50:41 +00:00
Ting-Yu Lin
d00d8eefb7 Bug 1903141 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert
After Bug 1902542 Part 5 [1], the pushed floats list is deleted if it is empty.
Therefore, we can simplify `MaybeHasFloats()` as suggested in the XXX comment.

[1] https://hg.mozilla.org/mozilla-central/rev/52a9610fc9f2

Differential Revision: https://phabricator.services.mozilla.com/D214044
2024-06-19 21:50:40 +00:00
pstanciu
f3651823b9 Backed out 3 changesets (bug 1903141) for causing crashtest failures on nsSplittableFrame.cpp CLOSED TREE
Backed out changeset ccd18b9b52fc (bug 1903141)
Backed out changeset fbd60d2007b0 (bug 1903141)
Backed out changeset ce65f1574c68 (bug 1903141)
2024-06-19 03:15:25 +03:00
Ting-Yu Lin
94a9ed2943 Bug 1903141 Part 3 - Store floats list in a frame property rather than in nsBlockFrame::mFloats. r=dholbert
On optimized builds for all desktop platforms, `nsBlockFrame` is 192 bytes, and
`mFloats` is 16 bytes. With this patch, we can reduce the size of `nsBlockFrame`
to 176 bytes, saving 8.33% memory on every `nsBlockFrame` and its derived
subclasses allocated.

On a real webpage like https://en.wikipedia.org/wiki/Firefox, `about:memory`
shows that we allocate 0.36 MB of `nsBlockFrame` consistently. After this patch,
we allocate 0.33 MB, saving approximately 30 KB (0.36 MB * 8.33%) of the memory.

Differential Revision: https://phabricator.services.mozilla.com/D214046
2024-06-18 20:13:55 +00:00
Ting-Yu Lin
5411926dad Bug 1903141 Part 2 - Annotate EnsurePushedFloats() as MOZ_NONNULL_RETURN. r=dholbert
`EnsurePushedFloats()` either returns the existing pushed floats list or creates
a new empty one. Therefore, it can never return nullptr.

Differential Revision: https://phabricator.services.mozilla.com/D214045
2024-06-18 20:13:54 +00:00
Ting-Yu Lin
f8c82f76ac Bug 1903141 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert
After Bug 1902542 Part 5 [1], the pushed floats list is deleted if it is empty.
Therefore, we can simplify `MaybeHasFloats()` as suggested in the XXX comment.

[1] https://hg.mozilla.org/mozilla-central/rev/52a9610fc9f2

Differential Revision: https://phabricator.services.mozilla.com/D214044
2024-06-18 20:13:54 +00:00
Ting-Yu Lin
b4b72988b8 Bug 1902542 Part 3 - Clean up nsBlockFrame's pushed floats handling. r=layout-reviewers,emilio
Add an "s" to PushedFloatsProperty() to match the state bit.

Rename `RemovePushedFloats()` to `StealPushedFloats()` to match other APIs that
take the ownership of a frame list.
https://searchfox.org/mozilla-central/rev/4c8627a76e2e0a9b49c2b673424da478e08715ad/layout/generic/nsContainerFrame.h#598-612

Differential Revision: https://phabricator.services.mozilla.com/D213700
2024-06-14 17:13:04 +00:00
Ting-Yu Lin
4be8fd1565 Bug 1902542 Part 1 - Clean up nsBlockFrame's helper and state bits related to ::marker. r=layout-reviewers,emilio
- Remove "FRAME" for nsBlockFrame state bits for the consistency with other bits.

- Use helpers instead of checking state bits if possible.

- Tweak one line documentation to use C++ comment style.

- Move `GetMarker()` to protected section because it is used only internally.

Differential Revision: https://phabricator.services.mozilla.com/D213698
2024-06-14 17:13:03 +00:00
fantasai
5879e8247d Bug 1684236 - Implement 'align-content' on block containers. r=layout-reviewers,jfkthame
This is Fantasai's original patch, massively simplified:

 * We now can switch whether we're a BFC dynamically (bug 1765615), which
   simplifies the patch quite a lot.

 * I removed some changes that were specific to pagination but were untested.
   I left them as D202814, just in case we need some of those in the future.

All in all this makes the patch much more manageable.

Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

Differential Revision: https://phabricator.services.mozilla.com/D181858
2024-02-27 16:32:02 +00:00
Emily McDonough
d8944d6766 Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert
This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-02-24 04:05:45 +00:00
Stanca Serban
f3138fcd27 Backed out 2 changesets (bug 1865172) for causing wpt failures in page-name-unnamed-trailing-001-print.html.
Backed out changeset fc1f91bbfd85 (bug 1865172)
Backed out changeset 17019e03e97c (bug 1865172)
2024-02-24 01:53:19 +02:00
Emily McDonough
fee7314f2a Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert
This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-02-23 22:34:37 +00:00