Commit graph

441 commits

Author SHA1 Message Date
Jonathan Kew
4594ae314a Bug 1815404 - Replace most uses of gfxContext::CreateOrNull with stack-allocated contexts. r=gfx-reviewers,lsalzman
Depends on D170370

Differential Revision: https://phabricator.services.mozilla.com/D170371
2023-02-21 07:28:25 +00:00
Jonathan Kew
1b3e69f8aa Bug 1815404 - Remove refcounting from gfxContext. r=gfx-reviewers,lsalzman
Depends on D170367

Differential Revision: https://phabricator.services.mozilla.com/D170369
2023-02-21 07:28:24 +00:00
Ting-Yu Lin
7e902d0c04 Bug 1809764 Part 2 - Ignore "break-inside:avoid" for content in a nested top-of-page multicol in last balancing reflow. r=emilio
The only difference between multicol-nested-030.html and
multicol-nested-031.html is the `column-fill` property on the outer column.

WARNING: loading 030.html and 031.html without this patch can trap Firefox in
infinite loops.

Differential Revision: https://phabricator.services.mozilla.com/D169005
2023-02-07 07:44:12 +00:00
Ting-Yu Lin
edb1fd49bf Bug 1809764 Part 1 - Add more COLUMN_SET_LOG to debug nested multicols. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D169004
2023-02-07 07:44:11 +00:00
Oriol Brufau
8847a0669e Bug 1800952 - Compute column-rule-width to 0 when column-rule-style is none. r=emilio
Depends on D164554

Differential Revision: https://phabricator.services.mozilla.com/D164549
2023-01-02 21:11:30 +00:00
Iulian Moraru
9a68bda010 Backed out changeset 370f2bb05766 (bug 1800952) for causing mass build bustages on ServoCSSPropList.mako.py. CLOSED TREE 2022-12-15 00:43:58 +02:00
Oriol Brufau
7f26be9e72 Bug 1800952 - Compute column-rule-width to 0 when column-rule-style is none. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164549
2022-12-14 21:22:02 +00:00
Noemi Erli
32e3cc6311 Backed out changeset 5c04131a0427 (bug 1800952) for causing build bustages in ServoCSSPropList CLOSED TREE 2022-12-14 18:52:47 +02:00
Oriol Brufau
726571b313 Bug 1800952 - Compute column-rule-width to 0 when column-rule-style is none. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164549
2022-12-14 16:40:41 +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
4787078c5c Bug 1798373 Part 5 - Change nsContainerFrame::SetInitialChildList() to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160841
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
Ting-Yu Lin
baa8c00217 Bug 1794035 Part 2 - Rename RemoveFramesAfter, improve its implementation, and remove ExtractTail. r=emilio
RemoveFramesAfter and ExtractTail have similar purpose, so we really should keep
one of them to avoid confusion.

They have the following minor differences:
1. RemoveFramesAfter() keeps aFrame in the list, while ExtractTail() returns it.
2. If aFrame is empty, RemoveFramesAfter() returns the entire list, while
   ExtractTail returns an empty list.

It's more convenient for the existing callers to use the RemoveFramesAfter(), so
ExtractTail is unneeded.

After this patch, both RemoveFramesAfter() and RemoveFramesBefore() return the
entire list if aFrame is nullptr.

Rename RemoveFramesAfter() to TakeFramesAfter() for symmetry with
TakeFramesBefore().

This change shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D158807
2022-10-07 01:41:40 +00:00
Ting-Yu Lin
169f235b0c Bug 1441048 Part 1 - Clarify variable naming and log when we reflow last column with unconstrained available bsize. r=emilio
The naming of `isMeasuringFeasibleContentBSize` and associated log are
misleading. We can change last column's available block-size to be unconstrained
at the end of column balancing [1].

This patch shouldn't change the behavior.

[1] https://searchfox.org/mozilla-central/rev/5c04fc7016eb7f52cf835d482f1125c8f139c959/layout/generic/nsColumnSetFrame.cpp#1144-1154

Differential Revision: https://phabricator.services.mozilla.com/D154859
2022-08-17 17:18:00 +00:00
Ting-Yu Lin
5cdc372fbb Bug 1784208 Part 3 - Remove checking mIsBalancing in FindBestBalanceBSize(). r=emilio
According to our code coverage, the `if` statement is not reachable via any
tests on our CI.
https://coverage.moz.tools/#view=file&revision=7169b8faa7e112c9c4323753434324b93270fc3d&path=layout%2Fgeneric%2FnsColumnSetFrame.cpp&line=1129

After part 1 & 2, `ReflowColumns` can no longer change
`ReflowConfig::mIsBalancing` from true to false since the `ReflowConfig`
argument is now a `const`. Thus, `mIsBalancing` can never be false in
FindBestBalanceBSize().

Differential Revision: https://phabricator.services.mozilla.com/D154429
2022-08-12 05:04:03 +00:00
Ting-Yu Lin
474a3b0b9e Bug 1784208 Part 2 - Remove nsColumnSetFrame::ReflowChildren. r=emilio
With part 1, ReflowChildren and ReflowColumns are identical except for the
constness of the ReflowConfig. I choose to remove ReflowChildren because
ReflowColumns is more meaningful and keeping it requires less change to the
existing code.

Differential Revision: https://phabricator.services.mozilla.com/D154428
2022-08-12 05:04:02 +00:00
Ting-Yu Lin
1886ac30c5 Bug 1784208 Part 1 - Remove ColumnBalanceData::mHasExcessBSize flag. r=emilio
Remove the flag because it doesn't serve its purpose for current multicolumn
frame hierarchy (i.e. after we introduce ColumnSetWrapperFrame). Nowadays, we
limit the column's block-size with the column container's block-size and
max-block-size in [1]. If the column container has content which exceeds its
max-block-size, we are going to give up column balancing and reach [2] after the
first iteration in the column balancing `while` loop in FindBestBalanceBSize().

However, the flag can still be set in cases with absurd `nscoord` values, so
this patch still changes the behavior. For example, in crashtests with bogus
sizes such as 673770.html,

```
contentBEnd > aReflowInput.mCBReflowInput->ComputedMaxBSize() && aConfig.mIsBalancing
```

can still be true when `contentBEnd` is greater than `nscoord_MAX`. In such
cases, we might spend extra iterations in column balancing. Other than that, our
rendering shouldn't have perceived behavior change.

[1] https://searchfox.org/mozilla-central/rev/6a37a2ab9328bec6a29f688d1b2fba6974d34905/layout/generic/nsBlockFrame.cpp#3834-3844
[2] https://searchfox.org/mozilla-central/rev/6a37a2ab9328bec6a29f688d1b2fba6974d34905/layout/generic/nsColumnSetFrame.cpp#1145-1162,1169-1173

Differential Revision: https://phabricator.services.mozilla.com/D154427
2022-08-12 05:04:02 +00:00
Ting-Yu Lin
c5cbd5bbfd Bug 793686 Part 1 - Don't set mIsTopOfPage on -moz-column-content during column-balancing. r=emilio
According to `nsContainerFrame::ShouldAvoidBreakInside`, we allow a frame to
break from inside when it is at the top of page/column, i.e. when `mIsTopOfPage`
is true.

This patch allows the content at the top of the column to honor the
break-inside:avoid during column balancing, so it can now propagate the
break-before status to nsColumnSetFrame if it needs to report such status.

We don't need to worry about disallowing an break-inside:avoid content from
breaking will trap the column balancing algorithm forever. If the content's
block-size is larger than the column container's available content-box
block-size, then the column balancing algorithm will give up and fill the
columns sequentially at
https://searchfox.org/mozilla-central/rev/4f2984be127d2e7c788cf1848d63dca63022beec/layout/generic/nsColumnSetFrame.cpp#1146-1162

The reference files are modified to reflect the rendering as of this patch. Note
that browsers do not agree on the rendering of `1420528-1.html`. Before this
patch, our rendering is the same as Chrome by placing "Spacer" in the first
column, but now we agree with webkit by placing it in the second column.

The multicol in `611574-2.html` is used for visual separation of subtests. I
change it from column balancing to fill to workaround bug 1784002.

Differential Revision: https://phabricator.services.mozilla.com/D154048
2022-08-10 16:19:05 +00:00
Sandor Molnar
b590965652 Backed out 2 changesets (bug 793686) for causing reftest failures. CLOSED TREE
Backed out changeset b7e8fd18039a (bug 793686)
Backed out changeset fcf30cda2dce (bug 793686)
2022-08-10 05:20:08 +03:00
Ting-Yu Lin
912d9141fe Bug 793686 Part 1 - Don't set mIsTopOfPage on -moz-column-content during column-balancing. r=emilio
According to `nsContainerFrame::ShouldAvoidBreakInside`, we allow a frame to
break from inside when it is at the top of page/column, i.e. when `mIsTopOfPage`
is true.

This patch allows the content at the top of the column to honor the
break-inside:avoid during column balancing, so it can now propagate the
break-before status to nsColumnSetFrame if it needs to report such status.

We don't need to worry about disallowing an break-inside:avoid content from
breaking will trap the column balancing algorithm forever. If the content's
block-size is larger than the column container's available content-box
block-size, then the column balancing algorithm will give up and fill the
columns sequentially at
https://searchfox.org/mozilla-central/rev/4f2984be127d2e7c788cf1848d63dca63022beec/layout/generic/nsColumnSetFrame.cpp#1146-1162

The reference files are modified to reflect the rendering as of this patch. Note
that browsers do not agree on the rendering of `1420528-1.html`. Before this
patch, our rendering is the same as Chrome by placing "Spacer" in the first
column, but now we agree with webkit by placing it in the second column.

Differential Revision: https://phabricator.services.mozilla.com/D154048
2022-08-09 18:07:18 +00:00
Ting-Yu Lin
02e367f255 Bug 1782602 - No need to consider margin when computing -moz-column-content's origin. r=emilio
`-moz-column-content` is the anonymous frame under column set, and it has no
margin per its style in ua.css.

Differential Revision: https://phabricator.services.mozilla.com/D153404
2022-08-01 23:01:14 +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
Ting-Yu Lin
0a6b4c7ebb Bug 1464761 Part 3 - Remove IsTruncated() in nsColumnSetFrame::ReflowChildren(). r=dholbert
In nsReflowStatus::UpdateTruncated(), mTruncated can be true only when
mIsTopOfPage is false. However, when we reflow -moz-column-content, we always
set mIsTopOfPage to true. Therefore, IsTruncated() always returns false, i.e.
`!IsTruncated()` is always true.

Differential Revision: https://phabricator.services.mozilla.com/D151460
2022-07-27 21:55:17 +00:00
Ting-Yu Lin
631b3a60a0 Bug 1756008 Part 2 - Fix a comment in nsColumnSetFrame. r=emilio
nsBlockFrame::ReflowBlockFrame() creates a ReflowInput for its block child, not
BlockReflowInput.

Differential Revision: https://phabricator.services.mozilla.com/D139437
2022-02-23 21:22:43 +00:00
Daniel Holbert
d05867cc4e Bug 1730774 part 2: Add includes and forward-decls to fix non-unified-build bustage in layout/generic. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D125611
2021-09-15 16:15:02 +00:00
criss
196daa1700 Backed out changeset 007ff7f371c9 (bug 1730774) for causing bustages on Bp-hybrid. CLOSED TREE 2021-09-15 09:14:41 +03:00
Daniel Holbert
522de8e4d7 Bug 1730774 part 2: Add includes and forward-decls to fix non-unified-build bustage in layout/generic, and remove REQUIRES_UNIFIED_BUILD declaration. r=TYLin
After the fixes in this patch, the REQUIRES_UNIFIED_BUILD declaration is no
longer needed, so I'm removing it here.  This directory now builds successfully
with that removed and with ac_add_options --disable-unified-build in the
mozconfig.

Depends on D125610

Differential Revision: https://phabricator.services.mozilla.com/D125611
2021-09-15 00:04:16 +00:00
Matt Woodrow
3be3d71f55 Bug 1729236 - Don't use GetPaintRect for CreateWebRenderCommands. r=jrmuizel
WebRender prefers to know the full bounds of the primitive, since it makes invalidation easier (and doesn't increase the size of the commands we send).

Differential Revision: https://phabricator.services.mozilla.com/D124588
2021-09-13 05:01:35 +00:00
criss
9640d7f5f3 Backed out 10 changesets (bug 1714138, bug 1542929, bug 1728232, bug 1729236, bug 1728258, bug 1728251, bug 1728050) for causing bug 1424348 a=backout
Backed out changeset c5b71e6ce0e5 (bug 1729236)
Backed out changeset c6bcc4ed3d2e (bug 1729236)
Backed out changeset 7e292895282a (bug 1729236)
Backed out changeset d9ddd915e0c2 (bug 1714138)
Backed out changeset 82b98d2f0dcf (bug 1728258)
Backed out changeset 9a84a36b9dc4 (bug 1542929)
Backed out changeset 96be978630ff (bug 1728251)
Backed out changeset d7a8bf19d849 (bug 1728251)
Backed out changeset cce0c53b439f (bug 1728232)
Backed out changeset 3afd6aee7849 (bug 1728050)
2021-09-12 12:00:30 +03:00
Matt Woodrow
a0a81ab3ce Bug 1729236 - Don't use GetPaintRect for CreateWebRenderCommands. r=jrmuizel
WebRender prefers to know the full bounds of the primitive, since it makes invalidation easier (and doesn't increase the size of the commands we send).

Differential Revision: https://phabricator.services.mozilla.com/D124588
2021-09-10 03:43:35 +00:00
Sandor Molnar
e259e004de Backed out 3 changesets (bug 1729236) for causing reftest failures in layout/reftests/svg/filters/filter-giant.
Backed out changeset 1333d00d417c (bug 1729236)
Backed out changeset a3021a3499e1 (bug 1729236)
Backed out changeset 49a5aa4c8eb7 (bug 1729236)
2021-09-06 19:31:31 +03:00
Matt Woodrow
3cdf8e4aeb Bug 1729236 - Don't use GetPaintRect for CreateWebRenderCommands. r=jrmuizel
WebRender prefers to know the full bounds of the primitive, since it makes invalidation easier (and doesn't increase the size of the commands we send).

Differential Revision: https://phabricator.services.mozilla.com/D124588
2021-09-06 06:26:07 +00:00
Iulian Moraru
80b969f9fe Backed out 3 changesets (bug 1729236) for causing multiple failures. CLOSED TREE
Backed out changeset 8ebf965d624b (bug 1729236)
Backed out changeset 0d26dce41a12 (bug 1729236)
Backed out changeset bf228d1f3b49 (bug 1729236)
2021-09-06 07:32:43 +03:00
Matt Woodrow
87fc1d4890 Bug 1729236 - Don't use GetPaintRect for CreateWebRenderCommands. r=jrmuizel
WebRender prefers to know the full bounds of the primitive, since it makes invalidation easier (and doesn't increase the size of the commands we send).

Differential Revision: https://phabricator.services.mozilla.com/D124588
2021-09-06 03:42:25 +00:00
Matt Woodrow
a1f669f3aa Bug 1728709 - Add nsDisplayItem::GetPaintRect that computes a value using the current clip extents. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D124299
2021-09-03 18:58:18 +00:00
Mats Palmgren
fbd78876d2 Bug 1728497 - Remove nsColumnSetFrame::CalculateColumnRuleBounds and just return InkOverflowRect() instead. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D124202
2021-09-02 15:42:04 +00:00
Emilio Cobos Álvarez
a4e7c9e510 Bug 1722945 - Support break-inside: avoid-{page,column}. r=TYLin
break-before/after: page|column seem harder because you need to deal
with nested breaks, I think, but this should be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D121206
2021-08-03 17:56:58 +00:00
Noemi Erli
89a565ea85 Backed out changeset 67c33ba5566e (bug 1722945) for causing bustage in nsContainerFrame.cpp 2021-08-03 20:35:10 +03:00
Emilio Cobos Álvarez
3d1b4f252f Bug 1722945 - Support break-inside: avoid-{page,column}. r=TYLin
break-before/after: page|column seem harder because you need to deal
with nested breaks, I think, but this should be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D121206
2021-08-03 13:59:47 +00:00
Ting-Yu Lin
97b5489509 Bug 1716212 Part 1 - Rename CalcLineHeight to GetLineHeight, and cache used line height in ReflowInput. r=emilio
This patch introduces `mLineHeight`, and it opens the possibility to
override it in Part 2.

Differential Revision: https://phabricator.services.mozilla.com/D120876
2021-07-28 18:41:18 +00:00
Ting-Yu Lin
545a6376cd Bug 1677635 Part 4 - Rename nsOverflowAreas to OverflowAreas, and move it into mozilla namespace. r=layout-reviewers,emilio
This patch is generated via the rename functionality in my editor; add
`mozilla::` prefix to `OverflowAreas` in headers; and remove the
`OverflowType` alias added in Part 1.

Differential Revision: https://phabricator.services.mozilla.com/D97235
2020-11-18 00:08:12 +00:00
Ting-Yu Lin
1c052b9ff3 Bug 1674931 Part 2 - Add WritingMode argument to SizeComputationInput::ComputedLogicalBorderPadding(), and adapt callers. r=jfkthame
This patch is similar to Part 1, but for ComputedLogicalBorderPadding().

Differential Revision: https://phabricator.services.mozilla.com/D95662
2020-11-03 19:57:40 +00:00
Ting-Yu Lin
9910d9e651 Bug 1674931 Part 1 - Add WritingMode argument to SizeComputationInput::ComputedLogicalMargin(), and adapt callers. r=jfkthame
It's straightforward to determine which writing mode is required to pass
to ComputedLogicalMargin() by looking at any subsequent method called on
the margin.

For example, if we see

```
ComputedLogicalMargin().BStartEnd(wm);
```

the writing mode needed to pass to `ComputedLogicalMargin()` is `wm`.

Differential Revision: https://phabricator.services.mozilla.com/D95661
2020-11-03 19:44:58 +00:00
Ting-Yu Lin
709e05b496 Bug 1671319 - Remove GetAvailableContentISize in nsColumnSetFrame.cpp. r=emilio
nsColumnSetFrame won't have any border and padding because it's an inner
frame under ColumnSetWrapper. We've already asserted this fact at the
beginning of nsColumnSetFrame::Reflow().

This change shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D93626
2020-10-15 17:30:28 +00:00