Commit Graph

3149 Commits

Author SHA1 Message Date
Jens Stutte
9e14278425 Bug 1839051 - Use nsTArray::Sort in the SpanningCellSorter. r=xpcom-reviewers,emilio
We use stable sorting here as we want the order to not change unless really needed.

Depends on D181890

Differential Revision: https://phabricator.services.mozilla.com/D181891
2023-12-11 06:53:27 +00:00
Iulian Moraru
95f4da1719 Backed out 8 changesets (bug 1839051) for causing assertion failures on NotificationController.cpp. CLOSED TREE
Backed out changeset 94a4c163e417 (bug 1839051)
Backed out changeset 5204b97e40bc (bug 1839051)
Backed out changeset 8443a22a399d (bug 1839051)
Backed out changeset 2ab1e27d5945 (bug 1839051)
Backed out changeset 20a850a4fd7e (bug 1839051)
Backed out changeset 658568fe9662 (bug 1839051)
Backed out changeset 82525b11a7c3 (bug 1839051)
Backed out changeset 720e6863c41a (bug 1839051)
2023-12-04 22:34:25 +02:00
Jens Stutte
3837ef18e3 Bug 1839051 - Use nsTArray::Sort in the SpanningCellSorter. r=xpcom-reviewers,emilio
We use stable sorting here as we want the order to not change unless really needed.

Depends on D181890

Differential Revision: https://phabricator.services.mozilla.com/D181891
2023-12-04 18:33:41 +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
Jonathan Kew
2ba7f19c6c Bug 1859523 - For table with collapsed borders, restrict painting of positioned cell background to the size inside the borders. r=layout-reviewers,emilio
The spec doesn't address this, AFAICT, but this makes our rendering better
match Chrome and Safari, and fixes the "disappearing" borders that have been
reported a number of times.

Differential Revision: https://phabricator.services.mozilla.com/D195044
2023-11-30 12:39:32 +00:00
Jonathan Kew
0203b5780c Bug 1867252 - Remove no-longer-used ns[BC]TableCellFrame::PaintBackground method. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D194977
2023-11-29 12:47:26 +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
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
a54674b2e7 Bug 1442018 - nsCellMap needs to try harder to find the appropriate cellmap for a table header/footer that may be a repeat. r=layout-reviewers,emilio
If a repeated header/footer row group gets fragmented, so that it has a
next-in-flow, its REPEATABLE flag will be cleared. But in such a case,
nsCellMap still needs to find the "original" in order to get the map
for the repeated frame.

Depends on D193660

Differential Revision: https://phabricator.services.mozilla.com/D193661
2023-11-15 16:24:48 +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
4a9e4339e7 Bug 1863837 Part 5 - Always push overflow table rows to overflow list. r=layout-reviewers,emilio
Similar to Part 4, but for table row frames.

This patch shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D193144
2023-11-13 22:36:14 +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
15a3b70bcb Bug 1863837 Part 1 - Remove an undefined method declaration in nsTableFrame.h. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D193140
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
da5d082209 Bug 1861562 Part 4 - Micro optimization in nsTableRowGroupFrame::InitChildReflowInput(). r=layout-reviewers,jfkthame
We don't need the type-casting if `aBorderCollapse` is false.

Differential Revision: https://phabricator.services.mozilla.com/D192051
2023-10-27 18:38:08 +00:00
Ting-Yu Lin
9fa842f014 Bug 1861562 Part 3 - Use GetFirstCell() to avoid extra do_QueryFrame again. r=layout-reviewers,jfkthame
Similar to https://phabricator.services.mozilla.com/D190375, convert more loops.

Differential Revision: https://phabricator.services.mozilla.com/D192050
2023-10-27 18:38:07 +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
Ting-Yu Lin
9e4b140720 Bug 1861562 Part 1 - Replace GetRowBefore() with GetPrevRow(). r=layout-reviewers,jfkthame
We really don't need to call `GetNextRow()` repeatedly from `aStartRow` until
reaching `aRow`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D192048
2023-10-27 18:38:06 +00:00
Ting-Yu Lin
e7971e84c0 Bug 1678767 Part 4 - Convert nsTableRowGroupFrame::SplitSpanningCells() to use logical coordinates. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D191370
2023-10-23 18:38:01 +00:00
Ting-Yu Lin
ae5ff1eff8 Bug 1678767 Part 3 - Convert nsPresContext and frame arguments from references to pointers. r=dshin
In layout code, we almost always operate on frames via pointers. With this
patch, we can eliminate extra `&` and `*`.

Differential Revision: https://phabricator.services.mozilla.com/D191369
2023-10-23 18:38:00 +00:00
Ting-Yu Lin
a1013c7313 Bug 1678767 Part 2 - Convert nsTableRowGroupFrame::SplitRowGroup() to logical coordinates. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D191368
2023-10-23 18:38:00 +00:00
Ting-Yu Lin
a5b890bd77 Bug 1678767 Part 1 - Convert nsTableRowGroupFrame::Reflow() to logical coordinates. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D191367
2023-10-23 18:37:59 +00:00
Ting-Yu Lin
15c43e1a6f Bug 1859446 Part 6 - Remove unused nsresult return value from various table methods. r=layout-reviewers,jfkthame
We never communicate error status via the `nsresult` return value, and they
always return `NS_OK`. Hence the removal.

Differential Revision: https://phabricator.services.mozilla.com/D191156
2023-10-17 17:30:02 +00:00
Ting-Yu Lin
c30c701a46 Bug 1859446 Part 5 - Make CreateContinuingRowFrame() return newly created table row frame. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D191155
2023-10-17 17:30:02 +00:00
Ting-Yu Lin
facfff20cb Bug 1859446 Part 4 - Rename desiredSize variable for table row children. r=layout-reviewers,jfkthame
Add "kid" prefix for table row's desired size so that it won't be confused with
`aDesiredSize` output argument.

Differential Revision: https://phabricator.services.mozilla.com/D191154
2023-10-17 17:30:01 +00:00
Ting-Yu Lin
db3cea7c64 Bug 1859446 Part 3 - Rename member vars in TableRowGroupReflowInput to match coding style. r=layout-reviewers,jfkthame
Also, remove `using TableRowGroupReflowInput` statement since it helps my editor
jump directly to `TableRowGroupReflowInput`'s definition rather than to the
alias.

Differential Revision: https://phabricator.services.mozilla.com/D191153
2023-10-17 17:30:01 +00:00
Ting-Yu Lin
c877ed36cd Bug 1859446 Part 2 - Remove TableRowGroupReflowInput::tableFrame. r=layout-reviewers,jfkthame
`tableFrame` is seldom used, and all the functions that need the table frame
have already got it via `GetTableFrame()` helper.

Differential Revision: https://phabricator.services.mozilla.com/D191152
2023-10-17 17:30:01 +00:00
Ting-Yu Lin
e2ef3873f8 Bug 1859446 Part 1 - Remove haveRow variable in nsTableRowGroupFrame::ReflowChildren(). r=layout-reviewers,jfkthame
We don't need set `haveRow` to `true` in every iteration in the loop over table
rows. It is sufficient to check `GetFirstRow()`.

Differential Revision: https://phabricator.services.mozilla.com/D191151
2023-10-17 17:30:00 +00:00
Tom Marble
0cb91fe33e Bug 1855300 - convert .ini manifests to .toml: batch 11 remaining **/mochitest.ini r=jmaher,geckoview-reviewers,extension-reviewers,valentin,credential-management-reviewers,cookie-reviewers,sgalich,m_kato,robwu
Differential Revision: https://phabricator.services.mozilla.com/D190515
2023-10-13 02:32:24 +00:00
Mathew Hodson
d548d9a37a Bug 1772652 - Avoid divide by zero for infinite-size columns. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D188425
2023-10-12 09:30:29 +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
Ting-Yu Lin
2364264db4 Bug 1857585 Part 7 - Revise the helper computing table cell's block-size. r=dholbert
* It used to return useless `nsresult`. Change it to return the block-size
  instead of modifying the argument to return value.
* Shorten its name to `CalcCellActualBSize` to match `CalcBSize`.

Differential Revision: https://phabricator.services.mozilla.com/D190377
2023-10-08 01:05:14 +00:00
Ting-Yu Lin
f52827d4a9 Bug 1857585 Part 6 - Use GetFirstRow() to avoid extra do_QueryFrame. r=dholbert
While I'm here, revise GetFirstRow(), GetLastRow(), and GetNextRow(), and add
assertions to them to ensure the correctness of table frame tree structure.

Differential Revision: https://phabricator.services.mozilla.com/D190376
2023-10-08 01:05:14 +00:00
Ting-Yu Lin
4c5bd14e56 Bug 1857585 Part 5 - Use GetFirstCell() to avoid extra do_QueryFrame. r=dholbert
nsTableRowFrame's children are all nsTableCellFrame, and `GetFirstCell()` has an
assertion for that. Hence, we can delete the unreachable code dealing with
non-cell frames.

Differential Revision: https://phabricator.services.mozilla.com/D190375
2023-10-08 01:05:13 +00:00
Ting-Yu Lin
21279d80d7 Bug 1857585 Part 4 - Simplify unpaginated block-size helpers. r=dholbert
We don't ever remove `NS_TABLE_ROW_HAS_UNPAGINATED_BSIZE` bit, so let's set the
bit directly in `SetUnpaginatedBSize()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D190374
2023-10-08 01:05:13 +00:00
Ting-Yu Lin
f7485e2773 Bug 1857585 Part 3 - Remove nscoord parameter for ResetBSize(). r=dholbert
It is confusing for ResetBSize() to take a parameter to set the fixed
block-size. The caller can call `SetFixedBSize()` if needed.

Differential Revision: https://phabricator.services.mozilla.com/D190373
2023-10-08 01:05:12 +00:00
Ting-Yu Lin
8ef012fd58 Bug 1857585 Part 2 - Remove a redundant writing-mode variable. r=dholbert
`wm` has been declared near the beginning of `nsTableCellFrame::Reflow()`.

Differential Revision: https://phabricator.services.mozilla.com/D190372
2023-10-08 01:05:12 +00:00
Ting-Yu Lin
5c27b8d0d0 Bug 1857585 Part 1 - Remove unused PresContext parameter. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D190371
2023-10-08 01:05:11 +00:00
Ting-Yu Lin
ad1d86449b Bug 1856469 - Remove redundant GetTableFrame() call in nsTableRowFrame::DidResize(). r=dholbert
We've got `tableFrame` at the beginning of the method.

Differential Revision: https://phabricator.services.mozilla.com/D189865
2023-10-02 23:51:45 +00:00