Commit Graph

1607 Commits

Author SHA1 Message Date
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
David Shin
839a771067 Bug 1901126: Invalidate along the entire table edge when a cell in the edge of the table is modified. r=dholbert
Every time we recompute border collapsed table borders, we discard previously
computed values. This is done to avoid statefulness bugs, like Bug 1871609.
When a table-edge cell is modified, the border computation needs to extend
to cover all cells adjacent to that edge, to determine which cell contributes
to the maximum border-width.

Also, rename the use of X/Y usage to Col/Row to reduce potential confusion.

Differential Revision: https://phabricator.services.mozilla.com/D213793
2024-06-18 01:31:52 +00:00
David Shin
9c139a15bb Bug 1901126: Stop considering border inline-sides' widths from only the first row. r=dholbert
The previous behaviour does not match the up-to-date spec:
https://drafts.csswg.org/css-tables-3/#border-collapsing

"[...] set the table-root border-{...}-width to half the maximum
width found during the harmonization processes for that border [...]."

Differential Revision: https://phabricator.services.mozilla.com/D213792
2024-06-18 01:31:52 +00:00
Ting-Yu Lin
8d546a2fd5 Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-30 17:58:25 +00:00
Ting-Yu Lin
5cdee429ce Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-30 06:32:22 +00:00
Sebastian Hengst
bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Sebastian Hengst
18041c50bb Backed out 2 changesets (bug 1899345) for conflicting with backout of bug 1896516
Backed out changeset b96c165e9ab4 (bug 1899345)
Backed out changeset 01a540f73690 (bug 1899345)
2024-05-29 11:21:39 +02:00
Ting-Yu Lin
5644682c09 Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-29 05:10:38 +00:00
Stanca Serban
60109eeb45 Backed out 2 changesets (bug 1899345) for causing android build bustages in ScrollContainerFrame.cpp. CLOSED TREE
Backed out changeset ccb2ccbef46e (bug 1899345)
Backed out changeset 6f66d112b450 (bug 1899345)
2024-05-29 03:49:38 +03:00
Ting-Yu Lin
940c33226a Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-29 00:17:58 +00:00
Emilio Cobos Álvarez
1d2f00404f Bug 1899187 - Use cbindgen for border-spacing. r=firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D211781
2024-05-28 09:37:22 +00:00
Ting-Yu Lin
37e9b779f9 Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-28 04:46:20 +00:00
David Shin
558610b3b0 Bug 1825384 - Use app units in border-collapsed table data, not dev pixels. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D187140
2024-05-14 13:51:28 +00:00
David Shin
4ae445ed3d Bug 1871609: On calculating border-collapsed table's borders, reset max-seen width. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D208526
2024-05-08 16:43:07 +00:00
Cristian Tuns
c708bef960 Backed out changeset 84b76f80bf96 (bug 1871609) for causing wpt failures in /css/css-tables/* CLOSED TREE 2024-05-07 10:10:21 -04:00
David Shin
5e870f6bd5 Bug 1871609: On calculating border-collapsed table's borders, reset max-seen width. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D208526
2024-05-07 13:11:23 +00:00
Ting-Yu Lin
7b4e1c313a Bug 1892307 Part 2 - Remove LogicalSideBits. r=layout-reviewers,jfkthame
We can replace `mBits` with `EnumSet<LogicalSide>` in `LogicalSides` so that
`LogicalSideBits` is not relavent.

Differential Revision: https://phabricator.services.mozilla.com/D207906
2024-04-19 22:16:03 +00:00
Ting-Yu Lin
8a77ebbb16 Bug 1888535 Part 5 - Remove DISPLAY_REFLOW. r=layout-reviewers,emilio
It is used in `Reflow()` implementations.

Differential Revision: https://phabricator.services.mozilla.com/D206317
2024-04-02 19:03:05 +00:00
flowejam
9d4992fcc6 Bug 1885693: Converted LogicalSide to an enum class, and renamed variables accordingly. r=TYLin
Values were static_casted where required. Some functions in WritingModes.h were
rewritten such that bitwise operations aren't being used. Added static_casts to
avoid (debug) build errors from debugging printfs in layout/tables/nsCellMap.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D205510
2024-03-26 17:55:16 +00:00
Ting-Yu Lin
42fe4966fa Bug 1885691 - Convert LogicalCorner to enum class in WritingMode.h. r=dholbert
While I'm here, I remove the explict indices (0 - 3) for the enumerators since
they don't get used anywhere.

Differential Revision: https://phabricator.services.mozilla.com/D204833
2024-03-16 01:26:40 +00:00
Ting-Yu Lin
38414bb841 Bug 1881157 - Restore the old behavior that allows TableBCDataProperty to be set on table continuations. r=dholbert
Bug 1861562 Part 6 [1] made a bold assumption that TableBCDataProperty should
only be set on first-in-flow, but apparently a table continuation can call
`GetOrCreateTableBCData()` to set the property in the testcase [2].

This patch restores the old behavior that allows TableBCDataProperty to be set
on table continuations.

[1] https://hg.mozilla.org/mozilla-central/rev/c9c310c769d2
[2] Note: we don't support fragmenting tables in multicol. Table continuations
are created in this testcase because the abspos `<dialog>` in the table
is fragmented.

Differential Revision: https://phabricator.services.mozilla.com/D203707
2024-03-07 14:45:59 +00:00
Sandor Molnar
2d5719f996 Backed out changeset 2960ea3e50ca (bug 1881157) for causing crashtest assertion failures. CLOSED TREE 2024-03-06 21:01:06 +02:00
Ting-Yu Lin
567c398b05 Bug 1881157 - Restore the old behavior that allows TableBCDataProperty to be set on table continuations. r=dholbert
Bug 1861562 Part 6 [1] made a bold assumption that TableBCDataProperty should
only be set on first-in-flow, but apparently a table continuation can call
`GetOrCreateTableBCData()` to set the property in the testcase [2].

This patch restores the old behavior that allows TableBCDataProperty to be set
on table continuations.

[1] https://hg.mozilla.org/mozilla-central/rev/c9c310c769d2
[2] Note: we don't support fragmenting tables in multicol. Table continuations
are created in this testcase because the abspos `<dialog>` in the table
is fragmented.

Differential Revision: https://phabricator.services.mozilla.com/D203707
2024-03-06 16:32:56 +00:00
Ting-Yu Lin
d0d7d7b42e Bug 1863421 Part 1 - Stop reserving row-spacing at the block-start edge in table continuations. r=dholbert
The testcases in our own reftest frameworks are modified to reflect the current
rendering. The main difference after this patch is that we don't apply row
border-spacing at the block-start edge in the table continuations. As a result,
we add `top: -2px` to reference pages such as
`rowgroup-page-break-after-always-1-ref.html` and
`rowgroup-page-break-after-always-2-ref.html` to counteract the default UA table
style `border-spacing: 2px;` [1].

[1] https://searchfox.org/mozilla-central/rev/6b0b8c1003504e302e243c300355ef4d61e24909/layout/style/res/html.css#257

Differential Revision: https://phabricator.services.mozilla.com/D195333
2024-03-06 16:01:58 +00:00
David Shin
6cd1400e8a 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
275655e413 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
d6b7304705 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
744ba2519b 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
4b1dab0a64 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
e488d77db2 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
4802877b67 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
a9e6818c64 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
e9151ca0ee 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
184ed738e0 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
ad72f90b4b 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
877e7be3ac 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
4efe14dae3 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
a9cee7aceb 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
a70192004a 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
42482e3f31 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
97e42f43de 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
9b25d780cc 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
7316de1e99 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
08a404e97a 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
6aa28c51b5 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
2bcef56cb0 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
ceab71994c 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
cdbb7e354b 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
edee5a26a1 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
124504fa68 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