Commit graph

774 commits

Author SHA1 Message Date
David Shin
c2e27a0f1a 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
Ting-Yu Lin
ef7e43f284 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
b518ef30fa 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
a32338de71 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
Masayuki Nakano
3e8ec8fb57 Bug 1872410 - Make nsTableRowGroupFrame::FindLineContaining allow callers to set aFrame to an out-of-flow child r=emilio
If the table-row-group is styled by CSS and it does not have proper table row
children, anonymous table rows and cells are generated and the real content is
rendered in a placeholder.  In this case, the parent of out-of-flow child frame
is the table-row-group frame even though the table-row-group frame has only
anonymous table-row child frame.  Therefore, it fails to query `nsTableRowFrame`
and access `nsIFrame` methods with `nullptr`.

This patch allows the method users to set an out-of-flow child frame and
makes the method return "not found".

Differential Revision: https://phabricator.services.mozilla.com/D197983
2024-01-10 03:13:15 +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
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
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
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
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
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
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
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
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
David Shin
d9e74a40b1 Bug 1821177: Ensure nsTableRowGroupFrame's CreateContinuingRowFrame and UndoContinuedRow push and pull from overflow lists. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D177631
2023-05-11 15:05:19 +00:00
Emilio Cobos Álvarez
e18c9b7ad6 Bug 1815552 - Make positioned table parts deal correctly with switching position without being reframed. r=TYLin,layout-reviewers
While looking at the backout, I noticed table parts relied on reframing
on abspos-container-ness changes in a subtle way, see the test, which
fails with the first patch of this bug applied without these changes.

Make the NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN mean the same for table parts
as for everything else. Instead, keep the registration status on each
relevant frame class individually.

Depends on D169127

Differential Revision: https://phabricator.services.mozilla.com/D170969
2023-03-01 19:04:17 +00:00
Cristina Horotan
e15f3e3295 Backed out 2 changesets (bug 1815552) for causing Bp-hybrid bustages at ComputedStyle.h on a CLOSED TREE
Backed out changeset da0f9295df91 (bug 1815552)
Backed out changeset cda1ee891058 (bug 1815552)
2023-03-01 16:05:19 +02:00
Emilio Cobos Álvarez
029e62f738 Bug 1815552 - Make positioned table parts deal correctly with switching position without being reframed. r=TYLin,layout-reviewers
While looking at the backout, I noticed table parts relied on reframing
on abspos-container-ness changes in a subtle way, see the test, which
fails with the first patch of this bug applied without these changes.

Make the NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN mean the same for table parts
as for everything else. Instead, keep the registration status on each
relevant frame class individually.

Depends on D169127

Differential Revision: https://phabricator.services.mozilla.com/D170969
2023-03-01 10:36:54 +00:00
Emilio Cobos Álvarez
c8200e7d27 Bug 1818851 - Minor cleanups to table classes. r=TYLin
Remove redundant virtual keywords, and initialize stuff in the declaration
when possible.

Differential Revision: https://phabricator.services.mozilla.com/D170968
2023-02-25 00:42:48 +00:00
Ting-Yu Lin
8f8ddadd2f Bug 1803863 Part 3 - Simplify the usages for ReflowOutput. r=emilio
- Remove unnecessary calls to ClearSize() after declaring a fresh ReflowOutput.
- Use ReflowOutput::SetSize() in nsTableFrame::FixupPositionedTableParts().

Differential Revision: https://phabricator.services.mozilla.com/D163763
2022-12-03 18:35:43 +00:00
Martin Robinson
abb5044ca7 Bug 1803377 - Rename the values of the IntrinsicDirty enum r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D163607
2022-12-02 12:27:31 +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
Ting-Yu Lin
192956df1b 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-11 23:44:17 +00:00
Ting-Yu Lin
040feb02dd Bug 1798373 Part 7 - Change nsContainerFrame::InsertFrames() to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160843
2022-11-01 21:15:55 +00:00
Ting-Yu Lin
c99b45fa14 Bug 1798373 Part 6 - Change nsContainerFrame::AppendFrames() to take rvalue reference of nsFrameList. r=emilio
Change nsBlockFrame::AppendFrames() helper, too.

Differential Revision: https://phabricator.services.mozilla.com/D160842
2022-11-01 21:15:54 +00:00
Ting-Yu Lin
adf4fab73c Bug 1798373 Part 2 - Change nsFrameList::AppendFrames to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160838
2022-11-01 21:15:52 +00:00
Ting-Yu Lin
569c5f244b Bug 1798373 Part 1 - Change nsFrameList::InsertFrames to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160837
2022-11-01 21:15:52 +00:00
Ting-Yu Lin
ce9040c985 Bug 1794035 Part 4 - Use range-based for loops to iterate nsFrameList. r=emilio
After this patch, we still need nsFrameList::Enumerator to iterate
nsFrameList::Slice. We might enhance nsFrameList::Iterator to support Slice, but
I'll leave this for another day.

Differential Revision: https://phabricator.services.mozilla.com/D158809
2022-10-07 01:41:41 +00:00
Emilio Cobos Álvarez
a3231a2981 Bug 1793375 - Rename nsILineIterator::GetDirection to IsLineIteratorFlowRTL. r=dholbert
bool GetDirection() is rather meaningless.

Differential Revision: https://phabricator.services.mozilla.com/D158474
2022-10-03 11:00:39 +00:00
Emilio Cobos Álvarez
b935f1c325 Bug 1792333 - Factor out the "find closest frame in the line" checks. r=dholbert
Depends on D158085

Differential Revision: https://phabricator.services.mozilla.com/D158437
2022-10-02 07:06:46 +00:00
Emilio Cobos Álvarez
534f39ed75 Bug 1785310 - Remove mozilla/StaticPrefs_layout.h includes from other headers. r=dholbert
Adding layout prefs cause massive rebuilds because of this.

Differential Revision: https://phabricator.services.mozilla.com/D154928
2022-08-17 21:26:36 +00:00
Ting-Yu Lin
f101e2077d Bug 1464761 Part 4 - Remove nsReflowStatus::mTruncated bit. r=dholbert
In the description of the mTruncated bit, its purpose is the same as calling
SetInlineLineBreakBeforeAndReset(). We've removed all its usages in previous
patches, so the bit is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D151461
2022-07-27 21:55:18 +00:00