Commit Graph

3230 Commits

Author SHA1 Message Date
Ting-Yu Lin
e4f0d54b4d Bug 1913515 - Add a helper to return the inner frame of nsTableCellFrame. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D219359
2024-08-18 01:04:02 +00:00
Ting-Yu Lin
d5617c94de Bug 1910428 Part 2 - Convert BtlsISizeType to an enum class. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D217974
2024-07-29 22:04:00 +00:00
Ting-Yu Lin
5d30882a28 Bug 1909995 Part 4 - Add optional percentage basis argument to IntrinsicForContainer(). r=layout-reviewers,emilio
The underlying helper `IntrinsicForAxis()` already accepts an optional
percentage basis. This patch adds the same percentage basis argument to
`IntrinsicForContainer()`, allowing future callers to use it without needing to
convert to `IntrinsicForAxis()`.

This patch is a preparation for bug 1909761.

Differential Revision: https://phabricator.services.mozilla.com/D217792
2024-07-26 20:54:57 +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
Daniel Holbert
a8c637281f Bug 1909773 part 4: Add support for '-webkit-fill-available' as an alias for the CSS 'stretch' behavior (off-by-default for now). r=emilio
Both '-webkit-fill-available' and 'stretch' are equivalent to '-moz-available'
at this point in the patch series, and both are off-by-default, because
actually supporting them would require that we add special logic to handle them
as block-axis sizes (which I'll do in a separate bug).

Differential Revision: https://phabricator.services.mozilla.com/D217687
2024-07-25 18:18:24 +00:00
Daniel Holbert
6bdbaba6b7 Bug 1909773 part 3: Add off-by-default support for the CSS 'stretch' sizing keyword, just matching the behavior of '-moz-available' for now. r=emilio
This patch is intended to be mechanical, just adding the new keyword as an
alias for the existing behavior, basically.

In a later bug, 'stretch' will gain additional capabilities before we enable
the pref.  After that, I intend to ultimately make '-moz-available' an alias of
'stretch', assuming that doing so is web-compatible.

Differential Revision: https://phabricator.services.mozilla.com/D217686
2024-07-25 18:18:24 +00:00
Daniel Holbert
56c38ff56f Bug 1909773 part 2: Create BehavesLikeStretchOnInlineAxis() utility-function as an abstraction for the '-moz-available' sizing behavior. r=emilio
This patch doesn't change behavior.

The '-moz-available' keyword is our closest equivalent to the CSS 'stretch'
keyword, *specifically* for the inline axis (since we currently nerf
'-moz-available' to behave like the initial value in the block axis). Hence, it
makes sense to say that the '-moz-available' keyword "Behaves Like Stretch On
Inline Axis".

By abstracting the existing behavior behind this helper-function, we can
start implementing the actual 'stretch' value in terms of this existing
behavior, in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D217685
2024-07-25 18:18:23 +00:00
Sylvestre Ledru
a3ea006705 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio,necko-reviewers,geckoview-reviewers,application-update-reviewers,media-playback-reviewers,devtools-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,migration-reviewers,padenot,mconley,nchevobbe,kershaw,gstoll,mstange,bytesized,m_kato
This new version of clang 17 also slightly changed the formatting.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D215914
2024-07-17 11:15:31 +00:00
Emilio Cobos Álvarez
501f63a2fd Bug 1907289 - Reflow table cell if collapsed borders have changed. r=dshin
A potentially better approach could be to call FrameNeedsReflow from
nsBCTableCellFrame::SetBorderWidth... But it seems that might
over-invalidate quite a lot when recalculating borders, since it seems
we reset the relevant ones and then accumulate directly on the frame.

If that seems like a better approach, happy to give that a try. This
should be less risky for performance changes in general tho.

Differential Revision: https://phabricator.services.mozilla.com/D216409
2024-07-12 15:05:32 +00:00
Ting-Yu Lin
0f3a5513f5 Bug 1905462 Part 2 - Pass a style block size and aspect-ratio into ComputeISizeValue(). r=layout-reviewers,emilio
`ComputeISizeValue()` used to take `StyleSizeOverrides`, but

This patch reflects the fact that intrinsic inline size value such as
'min-content', 'max-content', etc. can be resolved via a definite block size and
a preferred aspect-ratio.

For the callers in `nsIFrame::ComputeSize()` and
`nsContainerFrame::ComputeSizeWithIntrinsicDimensions()`, we can pass the
`styleBSize` and `aspectRatio` that have considered the size overrides.

Also, simplify `ComputeISizeValueFromAspectRatio()` so that it can be reused in
other places. We'll adapt more callers in the next part. Note that the `aFlags`
parameter is unused, so it is removed.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D215294
2024-07-01 21:26:01 +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
Ting-Yu Lin
19542ed32d Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-30 06:32:18 +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
Ting-Yu Lin
7e7ff289d4 Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-28 04:46:17 +00:00
Ting-Yu Lin
b4a0842882 Bug 1824877 Part 3 - Change ScrollContainerFrame's type from Scroll to ScrollContainer. r=dholbert
This effectively changes the `IsScrollFrame()` helper to
`IsScrollContainerFrame()`.

Differential Revision: https://phabricator.services.mozilla.com/D210357
2024-05-15 17:50:49 +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
Ting-Yu Lin
319fc12b73 Bug 1888535 Part 4 - Remove DISPLAY_PREF_INLINE_SIZE and DISPLAY_MIN_INLINE_SIZE. r=layout-reviewers,emilio
The two macros are used in `GetPrefISize()` and `GetMinISize()` implementations.
After removing them, we could further simplify some implementations because we
don't need a `result` variable in many cases.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D206316
2024-04-02 19:03:04 +00:00
Ting-Yu Lin
512cea0dbf Bug 1888535 Part 3 - Remove DISPLAY_REFLOW_CHANGE used only in nsTableCellFrame. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206315
2024-04-02 19:03:04 +00:00
sid
568f27d168 Bug 1825386 - Converted LogicalAxis to enum class and type casted where necessary. r=TYLin
LogicalAxis is one of the Logical* enums. Converting it from enum to
enum class increases type safety. To run with the pre-existing code,
type casting was added when needed. Comments have been edited where
needed.

Differential Revision: https://phabricator.services.mozilla.com/D206108
2024-03-30 16:20:37 +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
9bad1041af Bug 1648947 - Force table-cells to use 'vertical-align:top' in printing. r=dholbert
When printing tables, if a table row group is split across the page boundary,
its table-cell descendants with `vertical-align:baseline|middle|bottom|` do not
align as expected and there might be data loss. Currently, we reflow the table
row frames first, and then call DidResize() [1] to move table cells to their
vertical-align positions via BlockDirAlignChild() [2] . This is fine if the
table is in gallery mode or can fit in one page, but it doesn't work if it is
across the page boundary.

To fix this properly, we need to rewrite the table fragmentation code so that
the a table cell is reflowed in its aligned position with a correct constrained
available bsize. In the meantime, this patch works around the data loss by
forcing table-cells to use `vertical-align:top`. This is a hack, but it also
matches Google Chrome's current behavior. I feel this is a good interim solution
to improve our printing quality.

[1] https://searchfox.org/mozilla-central/rev/2537e5eaafaab9a7ef6be5cfc8e9b1e2c747fdfd/layout/tables/nsTableRowGroupFrame.cpp#1119-1125
[2] https://searchfox.org/mozilla-central/rev/2537e5eaafaab9a7ef6be5cfc8e9b1e2c747fdfd/layout/tables/nsTableRowFrame.cpp#370-372

Differential Revision: https://phabricator.services.mozilla.com/D205538
2024-03-26 02:41:07 +00:00
Ting-Yu Lin
1c8592d312 Bug 1886942 Part 3 - Inline simple getter/setters in nsTableCellFrame. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D205419
2024-03-23 17:06:05 +00:00
Ting-Yu Lin
069c15f2bd Bug 1886942 Part 2 - Initialize nsTableCellFrame members in the declaration. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D205418
2024-03-23 17:06:05 +00:00
Ting-Yu Lin
8bd0b3625c Bug 1886942 Part 1 - Remove typedefs in nsTableCellFrame. r=layout-reviewers,emilio
These typedefs are either not used, or used only a few times.

Differential Revision: https://phabricator.services.mozilla.com/D205417
2024-03-23 17:06:05 +00:00
pstanciu
8388ab36d8 Backed out 3 changesets (bug 1886942) for causing build bustages on nsMathMLmtableFrame.h
Backed out changeset cf8f333d8f5e (bug 1886942)
Backed out changeset 83878f41b5e9 (bug 1886942)
Backed out changeset 195908957031 (bug 1886942)
2024-03-23 05:33:20 +02:00
Ting-Yu Lin
018c93cf49 Bug 1886942 Part 3 - Inline simple getter/setters in nsTableCellFrame. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D205419
2024-03-22 22:06:26 +00:00
Ting-Yu Lin
6dc0dc413f Bug 1886942 Part 2 - Initialize nsTableCellFrame members in the declaration. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D205418
2024-03-22 22:06:26 +00:00
Ting-Yu Lin
3dc081b5c3 Bug 1886942 Part 1 - Remove typedefs in nsTableCellFrame. r=layout-reviewers,emilio
These typedefs are either not used, or used only once or twice.

Differential Revision: https://phabricator.services.mozilla.com/D205417
2024-03-22 22:06:25 +00:00
Emilio Cobos Álvarez
0f046c7136 Bug 1883813 - Implement table cell height quirk as per spec. r=dshin
That is, don't force the width to be content-box. That matches other
implementations and the spec.

Differential Revision: https://phabricator.services.mozilla.com/D204812
2024-03-20 21:32:01 +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
Frédéric Wang
89782dfedc Bug 1883606 - Export more MathML crashtests to WPT. r=emilio
Follow-up of bug 1795630 for some crashtests that were not in `mathml`
directories. The list was extracted in a subjective way from [1] by
looking at some tests that seem to contain essentially MathML with
some simple HTML or CSS. The changes to `crashtest.list` files have
been generated by [2].

[1] https://searchfox.org/mozilla-central/search?q=%3Cmath%7Cmathml&path=crashtest&case=true&regexp=true
[2] `for file in $(^Ct ~/list-of-tests.txt); do D=$(dirname $file); F=$(filename $file); sed -i "/$F/d" $D/crashtests.list; done`

Differential Revision: https://phabricator.services.mozilla.com/D203614
2024-03-08 15:40:22 +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
Emilio Cobos Álvarez
09d3f65e7e Bug 1883694 - Minor cleanups to some table alignment code. r=dshin,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D203620
2024-03-06 12:59:09 +00:00