Commit graph

1583 commits

Author SHA1 Message Date
David Shin
0c24333993 Bug 1879731: Address clang-tidy concerns in BCMapCellIterator. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D202316
2024-02-27 15:55:40 +00:00
David Shin
9184cb608d Bug 1879731: Correctly fill out previous last border information at row and column edges in border-collapsed tables. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D202232
2024-02-27 15:55:40 +00:00
David Shin
6d96ef707d Bug 1873473: Part 4 - Update documentation in CalcBCBorders. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D197933
2024-02-13 18:37:04 +00:00
David Shin
a11082fca6 Bug 1873473: Part 3 - Rename variables using physical corners in CalcBCBorders to logical corners. r=layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D197932
2024-02-13 18:37:03 +00:00
David Shin
da3519452d Bug 1873473: Part 2 - Move variables in CalcBCBorders to be more scope-specific where possible. r=layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D197931
2024-02-13 18:37:03 +00:00
David Shin
02b1a97bd5 Bug 1873473: Part 1 - Refactor lastBStartBorder in nsTableFrame::CalcBCBorders to be Maybe<T> r=TYLin
This is only used to calculate the block-start border of the overall table,
not and is unused after. Use `Maybe<>` to reflect it as such.

Differential Revision: https://phabricator.services.mozilla.com/D197930
2024-02-13 18:37:02 +00:00
Ting-Yu Lin
d2705889ee Bug 1879371 Part 2 - Add a helper for placing repeated table footer avoid code duplication. r=jwatt
This patch shouldn't change behavior. There was a callsite missed
`SetRepeatable(false)` when the repeated table footer is not allowed, but I
think it was an oversight rather than intentional.

Differential Revision: https://phabricator.services.mozilla.com/D201136
2024-02-12 21:55:34 +00:00
Ting-Yu Lin
77fd9972c1 Bug 1879371 Part 1 - Move a comment closer to its code in nsTableFrame::ReflowChildren(). r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D201135
2024-02-12 21:55:33 +00:00
Ting-Yu Lin
1055b1302e Bug 1875600 - Use nsIFrame::PresShell() to simply some callers. r=layout-reviewers,emilio
Those callers who using the pointer immediately after getting from
`GetPresShell()` can be replaced with `PresShell()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D199164
2024-01-23 00:30:53 +00:00
Ting-Yu Lin
ba6d212459 Bug 1871608 Part 3 - Remove one addition unused methods and cleanup a comment. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D197209
2023-12-22 22:53:51 +00:00
Ting-Yu Lin
5374b8b9dd Bug 1871608 Part 2 - Remove unused setters and member variables for continuous BC borders in table parts. r=jwatt
With Part 1, these unused setters and member variables can also be removed.

Differential Revision: https://phabricator.services.mozilla.com/D197208
2023-12-22 22:53:50 +00:00
Ting-Yu Lin
77c5c07bab Bug 1867916 - Fix initialization of available block-size in TableReflowInput. r=emilio,layout-reviewers
This is a bug introduced by bug 1866836 Part 1
https://hg.mozilla.org/mozilla-central/rev/845986cc0a8d

`AdvanceBCoord()` will modify `mAvailSize.BSize()`, so we really should
initialize `mAvailSize.BSize()` first.

Differential Revision: https://phabricator.services.mozilla.com/D195332
2023-12-02 18:56:30 +00:00
Ting-Yu Lin
1cf1c68a91 Bug 1866836 Part 2 - Pass border and padding down from nsTableFrame::Reflow(). r=layout-reviewers,emilio
In Bug 1863421, we'll apply ApplySkipSides() for `borderPadding`. This patch
ensures we use the correct skipped border and padding everywhere.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D194789
2023-11-27 23:10:40 +00:00
Ting-Yu Lin
61ae4fb8ad Bug 1866836 Part 1 - Consolidate available size computation in TableReflowInput's constructor. r=layout-reviewers,emilio
Before this patch, we get available block-size in `Reflow()` and available
inline-size in `ReflowTable()`. Then we adjust them in TableReflowInput's
constructor. This patch moves all the computation into TableReflowInput's
constructor.

This is a preparation for bug 1863421, and doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D194788
2023-11-27 23:10:39 +00:00
Jonathan Kew
f22792227f Bug 1442018 - Avoid crashing in BCPaintBorderIterator if mCellMap was not found. r=layout-reviewers,emilio
This does not fix the underlying issue, which is that when the table
got fragmented, we failed to maintain the cellmap (attached to the
first-in-flow) to keep track of the additional rowgroup frame created
to go in the overflowing part of the table.

So this is a wallpaper patch just to prevent the crash here (confirmed
with testcase 5); it'll still throw NS_ASSERTIONs in a debug build,
and in the "bad" case (which depends on details of scaling) some of
the borders will be missing from the print preview/output, but that
seems preferable to crashing.

Differential Revision: https://phabricator.services.mozilla.com/D193660
2023-11-15 16:24:48 +00:00
Ting-Yu Lin
67d9c2fb7b Bug 1863837 Part 10 - Improve ergonomics of TableReflowInput. r=layout-reviewers,emilio
- Better encapsulation.
- Add `AdvanceBCoord()` to adjust block-offset and available block-size at
  once.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D193149
2023-11-13 22:36:16 +00:00
Ting-Yu Lin
44d862821f Bug 1863837 Part 9 - Remove unnecessary logic in nsTableFrame::ReflowChildren(). r=layout-reviewers,emilio
Remove `nextRowGroupFrame` variable since `childX + 1` is a valid index of
rowGroups and rowGroups never containing nullptr, `nextRowGroupFrame` is always
valid.

Differential Revision: https://phabricator.services.mozilla.com/D193148
2023-11-13 22:36:16 +00:00
Ting-Yu Lin
b0009550de Bug 1863837 Part 8 - Revise methods that calculate table frame's block-size. r=layout-reviewers,emilio
Make `CalcDesiredBSize()` return `nscoord`, and revise the documentation.

Note: `CalcDesiredBSize` is a helper method for `Reflow`. I removed the
unnecessary for-loop computing child overflow because we're going to compute it
again in `Reflow()` [1], just right after we adjust the children's positions in
vertical-rl writing-mode.

This patch doesn't change behavior.

[1] https://searchfox.org/mozilla-central/rev/636f037a59d3fa41e27fee05742eb3679f76a366/layout/tables/nsTableFrame.cpp#1805-1811

Differential Revision: https://phabricator.services.mozilla.com/D193147
2023-11-13 22:36:16 +00:00
Ting-Yu Lin
9b80a327a8 Bug 1863837 Part 7 - Use table frame's writing-mode in some helpers. r=layout-reviewers,emilio
Table frame and its table row group children have the same writing-mode [1], so
this patch doesn't change behavior.

Since these helpers use data such as `TableReflowInput::mAvailSize`, which is in
table's writing-mode. Let's change these `wm` variables to initialize from
`GetWritingMode()` to avoid confusion.

[1] https://searchfox.org/mozilla-central/rev/02841791400cf7cf5760c0cfaf31f5d772624253/layout/tables/nsTableRowGroupFrame.h#54

Differential Revision: https://phabricator.services.mozilla.com/D193146
2023-11-13 22:36:15 +00:00
Ting-Yu Lin
31a87e10e6 Bug 1863837 Part 6 - Convert table header and footer reflow to use logical coordinates. r=layout-reviewers,emilio
This patch might fix table fragmentation when table's writing-mode is vertical.
But I'm in the process of fixing fragmentation, so I don't bother adding
testcase for it.

Differential Revision: https://phabricator.services.mozilla.com/D193145
2023-11-13 22:36:15 +00:00
Ting-Yu Lin
77925882bb Bug 1863837 Part 4 - Always push overflow table row groups to overflow list. r=layout-reviewers,emilio
Putting overflow child frames into the overflow list is a convention in other
layout frame types.

In non-incremental table reflow like printing, a table frame won't have a
continuation until the table wrapper's parent created it. Even if a table does
have a continuation when calling `PushChildren()`, it's totally fine to put
pushed child frames into overflow list since we've called
`MoveOverflowToChildList()` at the beginning of `nsTableFrame::Reflow()` so that
a table continuation can pull them into its principal child list.

Also, rename `PushChildren()` to `PushChildrenToOverflow()` in order to reflect
its purpose and match its counterpart in
`nsContainerFrame::PushChildrenToOverflow()`.

This patch shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D193143
2023-11-13 22:36:14 +00:00
Ting-Yu Lin
a2db328714 Bug 1863837 Part 3 - Rename cellSpacingI/cellSpacingB to colSpacing/rowSpacing. r=layout-reviewers,emilio
The methods were renamed in
https://hg.mozilla.org/mozilla-central/rev/778616c8f74e, so should the
variables.

Differential Revision: https://phabricator.services.mozilla.com/D193142
2023-11-13 22:36:14 +00:00
Ting-Yu Lin
dd7bef0239 Bug 1863837 Part 2 - Make OrderRowGroups() return RowGroupArray. r=layout-reviewers,emilio
It's more ergonomic to return RowGroupArray directly. While I'm here, improve
its documentation and rename it to `OrderedRowGroups()` since we do not actually
reorder children in table frame's principal child list.

Differential Revision: https://phabricator.services.mozilla.com/D193141
2023-11-13 22:36:13 +00:00
Ting-Yu Lin
84409099da Bug 1861539 - Use logical ReflowChild() and FinishReflowChild() to reflow table column group & table column. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D192041
2023-11-02 18:37:10 +00:00
Ting-Yu Lin
f1fe0fa667 Bug 1861562 Part 7 - Remove unneeded GetChildAreaOffset(). r=layout-reviewers,jfkthame
In the previous part, we've fixed `GetIncludedOuterBCBorder()` so that it won't
return empty result while calling from a table's continuation. That means, when
table wrapper frame creates reflow input for a border-collapsed table frame [1],
the computed border and padding is correct for all table continuations. Hence,
when we need border and padding, it is sufficient to get from `ReflowInput`
instead of `GetChildAreaOffset()`.

In `BCPaintBorderIterator` where there is no reflow input, we can call
`GetIncludedOuterBCBorder` directly.

[1] https://searchfox.org/mozilla-central/rev/40d51bef58b8e901d6ab4b60dd280f372a0e417d/layout/tables/nsTableWrapperFrame.cpp#626-633

Differential Revision: https://phabricator.services.mozilla.com/D192054
2023-10-27 18:38:09 +00:00
Ting-Yu Lin
2822603c9a Bug 1861562 Part 6 - Ensure TableBCData is accessible from table's continuations. r=layout-reviewers,jfkthame
`TableBCData` is essential for methods like `GetOuterBCBorder`,
`GetIncludedOuterBCBorder`, etc. We need to ensure all the table's continuations
can access it in order to get the border-collapsing border correctly. This patch
changes `GetTableBCData` to reach the first-in-flow for the data (similar to
`GetCellMap()`).

While I'm here, I rename the property, struct, and helpers to make them
consistent, and move the struct to mozilla namespace.

This patch potentially changes behavior when a border-collapsed table is
fragmented, but the layout is very broken (bug 1861575) that I don't feel its
worth writing a test.

Differential Revision: https://phabricator.services.mozilla.com/D192053
2023-10-27 18:38:08 +00:00
Ting-Yu Lin
d63958c5d6 Bug 1861562 Part 5 - Don't set table frame's desired inline size repeatedly. r=layout-reviewers,jfkthame
We set `aDesiredSize.ISize(wm)` again after calling `ReflowTable()`. Since no
other variable depending on the desired inline-size, there's no point set it
near the beginning of `Reflow()` and in `ReflowTable()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D192052
2023-10-27 18:38:08 +00:00
Ting-Yu Lin
0f1f90c224 Bug 1861562 Part 2 - Remove redundant kidRG variable. r=layout-reviewers,jfkthame
`kidFrame` is already a `nsTableRowGroupFrame*`.

Differential Revision: https://phabricator.services.mozilla.com/D192049
2023-10-27 18:38:07 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Cosmin Sabou
fbfcb4b40a Backed out changeset c20fe6f0a048 (bug 1825384) for causing table related reftest failures. CLOSED TREE 2023-09-11 19:51:30 +03:00
David Shin
751f217d5e Bug 1825384 - Use app units in border-collapsed table data, not dev pixels. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D187140
2023-09-11 14:23:01 +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
a7cc63588d Bug 1852076 - Simplify table part frame-destruction, to remove the need for a destruct root. r=dholbert
This is in order to eventually remove the destruct root.

This is a performance optimization to avoid doing the work of
registration if the table is about to go away anyways. The only thing
this wants to check is whether the first continuation is getting
destroyed. We can do that much more easily, explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D187677
2023-09-08 09:26:25 +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
Emilio Cobos Álvarez
7bf3b0e527 Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
2023-07-26 06:46:32 +00:00
Iulian Moraru
0c0945174b Backed out changeset f3394bd0f554 (bug 1844195) for causing conflicts with another backout. 2023-07-26 04:00:57 +03:00
Emilio Cobos Álvarez
e56bda6fd8 Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
2023-07-25 21:14:39 +00:00
Iulian Moraru
da43d00caa Backed out changeset 3a3f2d5937c4 (bug 1844195) for causing mass failures. CLOSED TREE 2023-07-25 23:07:30 +03:00
Emilio Cobos Álvarez
c70814ab25 Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
2023-07-25 18:40:30 +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
David Shin
72338e1209 Bug 1832110: Fix and simplify handling of empty rows when drawing border-collapsed tables. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D178048
2023-05-15 20:12:48 +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
Ting-Yu Lin
67f66f89ee Bug 1832452 - Remove rowGroupFrame local variable in nsTableFrame::ReflowChildren(). r=layout-reviewers,tnikkel
`kidFrame` and `rowGroupFrame` are the same. This patch doesn't change the
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D177714
2023-05-11 16:54:32 +00:00