Граф коммитов

676 Коммитов

Автор SHA1 Сообщение Дата
Ting-Yu Lin 26a6db6fb1 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 710069d82f 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 5548e07e75 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 ed86eca444 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 7356b21e22 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 4b2c52c158 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 5253789f83 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 1280d93c4b 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 8f8de2d6f5 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 60e14507ee 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 cd80eb1aef 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 11ae833dc9 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 fda2f65b44 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 890b1a6fac 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 91f1553dc6 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 981ac7c72c 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 2bf56c0358 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 6b93b80768 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 66e4438f6a 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
Jonathan Kew 860d32f808 Bug 1872929 - Don't allow text-wrap:balance adjustment to cause an overflow-wrap line break to be used. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D199974
2024-01-30 18:58:16 +00:00
Frédéric Wang dd89777ec2 Bug 1874826 - Avoid reconstruction due to change to block formatting context. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D198931
2024-01-23 10:09:57 +00:00
Frédéric Wang 56a3e0d495 Bug 1765615 - Handle most changes to CSS `contain` and `content-visibility` without needing to reconstruct frames. r=layout-reviewers,emilio
Right now, we reconstruct frames in response to a change in the CSS
`contain` property or `content-visibility`. This patch tries to optimize
this a bit:

1. Updates involving style containment change continue to force a
  reconstruction, due to the need to handle counters/quotes.

2. Updates involving paint/layout containment change only force a
   reconstruction if it's needed to handle absolutely/fixed
   positioned descendants or floats (for this one, see also bug 1874826).

3. Other containment changes will only force a reflow and repaint.

Per the CSS contain spec, layout, style and paint containments are
enabled for `content-visibility: hidden` and `content-visibility: auto`.
As a consequence, changing `content-visibility` between `hidden` and
`auto` values no longer requires reconstruction. Changing between these
values and `visible` may need a reconstruction although authors may
generally avoid that in practice by forcing `style` containment.

Differential Revision: https://phabricator.services.mozilla.com/D197043
2024-01-17 08:22:48 +00:00
Emilio Cobos Álvarez 5730ee0ca5 Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00
Jonathan Kew 5ea2e66c02 Bug 1834320 - Don't apply justification spacing when there are further tabs on the line. r=layout-reviewers,emilio
The spec explicitly requires that we "must ensure that tab stops continue to line up"
when applying justification to content with preserved white-space that includes tabs.
So when we're computing justification spacing adjustments, we must not apply adjustments
if there is a preserved tab later on the same line; only text after the last tab is to
be justified.

Differential Revision: https://phabricator.services.mozilla.com/D191996
2023-11-03 09:06:29 +00:00
Jonathan Kew 71e6f71f87 Bug 784648 - Implement the 'hanging' and 'each-line' options for CSS text-indent. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D191522
2023-10-23 15:12:23 +00:00
Jonathan Kew bd93e1361b Bug 1731541 - Implement text-wrap: balance for nsBlockFrame reflow. r=emilio
A simple form of balance for short blocks, implemented by incrementally reducing
the effective inline-size used during line-breaking, up to the point where an
extra line would be created.

This fails the test text-wrap-balance-line-clamp-001.html, but it's unclear to me
if that test is correct (see https://github.com/w3c/csswg-drafts/issues/9310).
If we do want the behavior expected by that test, an additional patch to handle
the interaction with line-clamp will be required.

Depends on D187543

Differential Revision: https://phabricator.services.mozilla.com/D187544
2023-09-30 15:53:12 +00:00
Sandor Molnar 2f5b657343 Backed out 5 changesets (bug 1731541) for causing multiple wpt failures. CLOSED TREE
Backed out changeset c185a38fb335 (bug 1731541)
Backed out changeset 16a3de29e4e6 (bug 1731541)
Backed out changeset 225642ff1de8 (bug 1731541)
Backed out changeset eb0b125d3214 (bug 1731541)
Backed out changeset af42a433722a (bug 1731541)
2023-09-28 23:49:24 +03:00
Jonathan Kew 995f8c3269 Bug 1731541 - Implement text-wrap: balance for nsBlockFrame reflow. r=emilio
A simple form of balance for short blocks, implemented by incrementally reducing
the effective inline-size used during line-breaking, up to the point where an
extra line would be created.

This fails the test text-wrap-balance-line-clamp-001.html, but it's unclear to me
if that test is correct (see https://github.com/w3c/csswg-drafts/issues/9310).
If we do want the behavior expected by that test, an additional patch to handle
the interaction with line-clamp will be required.

Depends on D187543

Differential Revision: https://phabricator.services.mozilla.com/D187544
2023-09-28 17:28:19 +00:00
Natalia Csoregi 0489f93a3d Backed out 4 changesets (bug 1731541) for causing bustage on nsBlockFrame.cpp. CLOSED TREE
Backed out changeset 7ce2b41bb730 (bug 1731541)
Backed out changeset 71d889de8d97 (bug 1731541)
Backed out changeset 0fd4431f5279 (bug 1731541)
Backed out changeset 5926241957b4 (bug 1731541)
2023-09-28 12:09:30 +03:00
Jonathan Kew 3d38b742aa Bug 1731541 - Implement text-wrap: balance for nsBlockFrame reflow. r=emilio
A simple form of balance for short blocks, implemented by incrementally reducing
the effective inline-size used during line-breaking, up to the point where an
extra line would be created.

This fails the test text-wrap-balance-line-clamp-001.html, but it's unclear to me
if that test is correct (see https://github.com/w3c/csswg-drafts/issues/9310).
If we do want the behavior expected by that test, an additional patch to handle
the interaction with line-clamp will be required.

Depends on D187543

Differential Revision: https://phabricator.services.mozilla.com/D187544
2023-09-28 08:31:20 +00:00
Emilio Cobos Álvarez aefd1ddb30 Bug 1851787 - Plumb a DestroyContext through all functions that can destroy frames. r=dholbert
This prevents anonymous content getting destroyed at weird times
during frame destruction.

Differential Revision: https://phabricator.services.mozilla.com/D187693
2023-09-08 15:11:17 +00:00
Emilio Cobos Álvarez 52d097c513 Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
2023-09-07 11:46:30 +00:00
Narcis Beleuzu 77ba6cde90 Backed out changeset 55052ae7d067 (bug 1851868) for reftest failure on 1153695.html . CLOSED TREE 2023-09-07 02:42:25 +03:00
Emilio Cobos Álvarez 59766eeba4 Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
2023-09-06 22:34:35 +00:00
David Shin 267a479339 Bug 1809568 - Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-17 12:56:54 +00:00
Sandor Molnar 71c2b3db49 Backed out 3 changesets (bug 1809568) for causing build bustages in layout/generic/nsLineLayout.cpp CLOSED TREE
Backed out changeset 6c5bbcbafce9 (bug 1809568)
Backed out changeset b518133a5c34 (bug 1809568)
Backed out changeset 2407088e9b49 (bug 1809568)
2023-05-17 01:34:42 +03:00
David Shin 1eefa9a516 Bug 1809568 - Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-16 20:48:18 +00:00
Sandor Molnar a50a2052fe Backed out 3 changesets (bug 1809568) for causing node devtools failures in devtools/client/debugger/src/components/test/QuickOpenModal.spec.js CLOSED TREE
Backed out changeset 56ce741da8f5 (bug 1809568)
Backed out changeset 5a91ce4870e4 (bug 1809568)
Backed out changeset cc00422f050a (bug 1809568)
2023-05-16 22:22:31 +03:00
David Shin 30a10fdbc6 Bug 1809568 - Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-16 19:02:11 +00:00
Cristian Tuns 4d57ea669d Backed out 3 changesets (bug 1809568) for causing build bustages on nsLineLayout.cpp CLOSED TREE
Backed out changeset e862b1560caa (bug 1809568)
Backed out changeset 0a20b91de67b (bug 1809568)
Backed out changeset 6060fc7d49d4 (bug 1809568)
2023-05-15 13:03:03 -04:00
David Shin c4f2c2237b Bug 1809568 - Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-15 14:34:26 +00:00
Cosmin Sabou 543905e105 Backed out 3 changesets (bug 1809568) for causing build bustages on nsBlockFrame.cpp. CLOSED TREE
Backed out changeset eaa7fe280317 (bug 1809568)
Backed out changeset ab0f2bcb2d9b (bug 1809568)
Backed out changeset a481bf06452b (bug 1809568)
2023-05-01 21:42:14 +03:00
David Shin d2ebe93a83 Bug 1809568 - Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-01 17:04:27 +00:00
Iulian Moraru c9ffb3ffa8 Backed out 3 changesets (bug 1809568) for causing build bustages on nsLineLayout.cpp. CLOSED TREE
Backed out changeset 573dc0bd9554 (bug 1809568)
Backed out changeset b8401947aea0 (bug 1809568)
Backed out changeset 7ecabe895121 (bug 1809568)
2023-05-01 17:59:21 +03:00
David Shin 8ff73f5fcc Bug 1809568 - Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-01 13:44:43 +00:00
David Shin f5a42005e2 Bug 1811311 - Part 3: Refactor `GetNaturalBaselineBOffset` to return `Maybe<nscoord>`. r=layout-reviewers,emilio
Changed from returning `bool` & taking an out parameter.

Differential Revision: https://phabricator.services.mozilla.com/D168998
2023-02-23 14:53:27 +00:00
David Shin 5c7c22165f Bug 1811311 - Part 1: Unite baseline-related functions in `nsIFrame` into one. r=emilio
Before, there existed 3 virtual functions that calculated baselines:

- `GetLogicalBaseline`
- `GetVerticalAlignBaseline`
- `GetNaturalBaselineBOffset`

Each of them had slightly different behaviours:

- `GetLogicalBaseline` would synthesize a baseline if there is no baseline.
  Others would simply return `false`.
- `GetNaturalBaselineBOffset` requires the caller to pick which of first/last
  baseline to calculate. Others pick on on their own.
- `GetNaturalBaselineBOffset`'s result can be either offset from border box
   start/end edge, depending on the caller-supplied baseline. Others always
   return offset from border box start edge.

Now:

- `GetNaturalBaselineBOffset` is the sole virtual function.
- `GetLogicalBaseline` exists to support its use, with 2 virtual helper functions:
  - `SynthesizeFallbackBaseline` to generate a baseline for elements that
    doesn't have one.
  - `GetBaselineSharingGroup` to preserve the default baseline picking behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D167990
2023-02-23 14:53:26 +00:00
Robert Longson 2ec308723b Bug 1651129 - Convert uses of mState to various StateBits methods and make mState private r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D169943
2023-02-15 21:35:46 +00:00
Ting-Yu Lin 514d412f9b Bug 1799732 Part 3 - Convert FrameChildListID to enum class. r=emilio
This patch is first generated by the following script under gecko root folder.

```
#!/bin/bash

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "kPrincipalList" "FrameChildListID::Principal"
rename "kPopupList" "FrameChildListID::Popup"
rename "kCaptionList" "FrameChildListID::Caption"
rename "kColGroupList" "FrameChildListID::ColGroup"
rename "kAbsoluteList" "FrameChildListID::Absolute"
rename "kFixedList" "FrameChildListID::Fixed"
rename "kOverflowList" "FrameChildListID::Overflow"
rename "kOverflowContainersList" "FrameChildListID::OverflowContainers"
rename "kExcessOverflowContainersList" "FrameChildListID::ExcessOverflowContainers"
rename "kOverflowOutOfFlowList" "FrameChildListID::OverflowOutOfFlow"
rename "kFloatList" "FrameChildListID::Float"
rename "kBulletList" "FrameChildListID::Bullet"
rename "kPushedFloatsList" "FrameChildListID::PushedFloats"
rename "kBackdropList" "FrameChildListID::Backdrop"
rename "kNoReflowPrincipalList" "FrameChildListID::NoReflowPrincipal"
```

And then:
1. Manually fix `FrameChildListID` definition in nsFrameList.h.
2. Apply clang-format.

Differential Revision: https://phabricator.services.mozilla.com/D161864
2022-11-12 04:38:53 +00:00
Noemi Erli 7c40c0e983 Backed out 3 changesets (bug 1799732) for causing build bustages in nsIFrame.cpp CLOSED TREE
Backed out changeset e559f9dbc76f (bug 1799732)
Backed out changeset c40fda7a8b0b (bug 1799732)
Backed out changeset 1f84bfb41ab8 (bug 1799732)
2022-11-12 02:16:45 +02:00