Commit graph

339 commits

Author SHA1 Message Date
Ting-Yu Lin
a7df850035 Bug 1869722 Part 1 - Cleanup after fixing tables as flex items. r=dholbert
Flex containers do not need the `alignCB` tweak for table frames in
`ReflowInput::InitConstraints`, so I remove the comment, and improve it so that
we don't need to call `alignCB->GetParent()` multiple times.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D196257
2023-12-13 22:50:36 +00:00
Ting-Yu Lin
c003be8b97 Bug 1867784 - Force reflow all kids in the last column balancing reflow. r=layout-reviewers,dholbert
The bug occurs because some abspos children are split, but not being reflowed
again in the last column balancing reflow where the available block-size of the
last column might be unconstrained.

This patch makes the callers utilizing `ReflowInput::ShouldReflowAllKids()`
always reflow in the last column balancing reflow to ensure the correctness of
the layout.

Note: the `mIsInLastColumnBalancingReflow` flag is inheriting from parent to
child reflow input, but it will stop at the nested `nsColumnSetFrame` because
the nested one will create its own `ReflowConfig::mIsLastBalancingReflow` and
assign that flag when creating the reflow input for the children.

Differential Revision: https://phabricator.services.mozilla.com/D195945
2023-12-10 03:16:55 +00:00
Ting-Yu Lin
7617f77ac4 Bug 1744363 Part 4 - Allow flex item's block-size to grow in fragmented context. r=dholbert
A flex item's block-size may grow as a result of fragmentation. If we detect its
block-size is allowed to grow, then we use 'auto' block-size in the
`StyleSizeOverrides` when creating a ReflowInput, and treat its original
block-size as the min-size (as a lower bound).

Differential Revision: https://phabricator.services.mozilla.com/D188532
2023-12-06 05:16:51 +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
Emilio Cobos Álvarez
a823c5fc0a Bug 1859186 - Simplify some frame property usage. r=TYLin
The border property is just useless, we only use it to store stuff
across border style changes, which makes zero sense because we clear it
when we start reflowing.

Differential Revision: https://phabricator.services.mozilla.com/D191177
2023-10-18 23:18:58 +00:00
David Shin
1baa1d1094 Bug 1855730: Move line-height from text to font style struct. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D189521
2023-09-28 20:07:49 +00:00
Emily McDonough
866896112c Bug 1828020 - Remove the layout.css.named-pages.enabled pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175438
2023-05-16 20:32:11 +00:00
Timothy Nikkel
390a1bd6f0 Bug 1832678. Avoid InitCBReflowInput's call to nsIFrame::GetContainingBlock, if our parent frame could not possibly be a containing block. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177866
2023-05-13 21:16:50 +00:00
Ting-Yu Lin
a2e0009587 Bug 1831976 - Fix typos in comments regarding CSS named pages pref. r=dholbert
Replace underscore with hyphen in the pref name.

Differential Revision: https://phabricator.services.mozilla.com/D177421
2023-05-09 00:10:44 +00:00
Robert Longson
7e65e06613 Bug 1826001 - Change SVGUtils::IsInSVGTextSubtree into a member function on nsIFrame r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D174375
2023-04-02 21:17:07 +00:00
Ting-Yu Lin
75a2789586 Bug 1825434 - Use containing block's inline-size as percentage basis when computing abspos hypothetical position. r=AlaskanEmily
The containing block's block-size (`blockContentSize.BSize(wm)`) can be
unconstrained if the block has `position:relative` at the time we call the
`CalculateBorderPaddingMargin()`. That triggers the warning further down in the
stack in `ComputeCBDependentValue`.

However, the percentage margin and padding should resolve against the containing
block's inline-size rather than the block-size. Hence this patch.

Differential Revision: https://phabricator.services.mozilla.com/D174340
2023-04-01 04:48:53 +00:00
Emilio Cobos Álvarez
2d0e69f4a1 Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin
And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
2023-03-29 21:23:55 +00:00
Emilio Cobos Álvarez
b9d1536d46 Bug 1824489 - Remove nsBoxFrame, nsBoxLayout and related code. r=jwatt
We still have some remnants of XUL layout due to nsBox / nsLeafBoxFrame
which XUL trees / nsTextBoxFrame still use.

However all this code can go away before we get rid of those.
nsSplitterFrame was the last thing inheriting from nsBoxFrame.

Differential Revision: https://phabricator.services.mozilla.com/D173601
2023-03-27 23:25:42 +00:00
Emilio Cobos Álvarez
e45a136429 Bug 1600542 - Remove redundant parens in ReflowInput. r=layout-reviewers,tlouw
Just minor nit I noticed while going through the code.

Depends on D172873

Differential Revision: https://phabricator.services.mozilla.com/D172874
2023-03-20 16:42:52 +00:00
Emily McDonough
4f8bac149f Bug 1816570 - Clear ReflowInput's mCanHaveClassABreakpoints for subtrees that have out-of-flow roots. r=dholbert
The expectations in page-name-propagated-003.html have turned out to be wrong
now that we have more correct abspos support.

We also need to check for placeholders in block reflow to actually support
named pages causing breakpoints where in-flow frames meet placeholders for out-
of-frame siblings.

Differential Revision: https://phabricator.services.mozilla.com/D170821
2023-03-16 20:01:02 +00:00
Emily McDonough
543eb5e869 Bug 1804794 - Do not allow CSS named page breaks except in specific subtrees. r=dholbert
This currently only includes block frames, grid containers, and flex
containers, and the document and pagination frames. It is possible more frames
will need to be added or more advanced checks in the future.

This adds some related tests to ignoring some subtrees, but are expected fails
until bug 1816570 is fixed.

Differential Revision: https://phabricator.services.mozilla.com/D169018
2023-02-22 23:49:51 +00:00
Butkovits Atila
9159bcd837 Backed out changeset 70a0f82267f1 (bug 1804794) for causing build bustages at ReflowInput.cpp. CLOSED TREE 2023-02-22 06:48:12 +02:00
Emily McDonough
75a6f4f11e Bug 1804794 - Do not allow CSS named page breaks except in specific subtrees. r=dholbert
This currently only includes block frames, grid containers, and flex
containers, and the document and pagination frames. It is possible more frames
will need to be added or more advanced checks in the future.

This adds some related tests to ignoring some subtrees, but are expected fails
until bug 1816570 is fixed.

Differential Revision: https://phabricator.services.mozilla.com/D169018
2023-02-22 02:29:31 +00:00
Emilio Cobos Álvarez
eb823eb895 Bug 1814626 - Expose line-height resolution to style, and use it from ToResolvedValue. r=jfkthame
For ToResolvedValue implementation purposes we wouldn't need to split
out the vertical / font / line-height arguments and we could just pass
around the ComputedStyle, but the lh unit would need that distinction,
(because computing lh on font properties should use the parent style).

Differential Revision: https://phabricator.services.mozilla.com/D168705
2023-02-14 22:36:31 +00:00
Ting-Yu Lin
a550ab4c13 Bug 1637091 - Always reflow a flex item in a fragmented context. r=dholbert
nsColumnSetFrame can reflow its last column in an unconstrained available
block-size to measure the total block-size of the content [1]. This patch adds a
helper method in ReflowInput for that.

For flex items in a fragmented context, we *cannot* skip its final reflow
because fragmentation might grow its block-size if there's any force break in
it (bug 1663079), or if it has repeated table header/footer (bug 1744363).

This patch doesn't change observable behavior for now. Before this patch, we may
skip an item's final reflow if it is in a flex container's continuation that is
in the last column with an unconstrained available block-size. As of this patch,
the item will be reflowed. This is a partial step towards fixing the above bugs
where the item's block-size may grow.

[1] https://searchfox.org/mozilla-central/rev/daf613efc5c358f3a94961d73b90472c00703838/layout/generic/nsColumnSetFrame.cpp#614-621

Differential Revision: https://phabricator.services.mozilla.com/D167207
2023-02-06 22:04:21 +00:00
Emilio Cobos Álvarez
3ad7017163 Bug 1807963 - Remove non-standard values of caption-side for good. r=TYLin,layout-reviewers
They have been disabled since bug 1688695. There's a variety of
table-caption bugs that would be easier to fix if we didn't have to
account for side-captions.

Differential Revision: https://phabricator.services.mozilla.com/D165690
2023-01-09 18:02:23 +00:00
Cosmin Sabou
4ab6fc29e0 Backed out changeset c34c31220275 (bug 1807963) for causing reftest unexpected passes on 446100-1c.html. 2023-01-09 15:01:55 +02:00
Emilio Cobos Álvarez
7b821c0133 Bug 1807963 - Remove non-standard values of caption-side for good. r=TYLin,layout-reviewers
They have been disabled since bug 1688695. There's a variety of
table-caption bugs that would be easier to fix if we didn't have to
account for side-captions.

Differential Revision: https://phabricator.services.mozilla.com/D165690
2023-01-09 10:39:44 +00:00
Stanca Serban
81bfc93257 Backed out changeset e018ba23c07d (bug 1807963) for causing wpt failures in caption.html. CLOSED TREE 2023-01-09 10:42:21 +02:00
Ben Freist
476cccc35c Bug 1808888 - [refactor] Migrate NS_STYLE_LIST_STYLE_POSITION_* defines r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D166140
2023-01-09 07:07:13 +00:00
Emilio Cobos Álvarez
5b925c72c8 Bug 1807963 - Remove non-standard values of caption-side for good. r=TYLin,layout-reviewers
They have been disabled since bug 1688695. There's a variety of
table-caption bugs that would be easier to fix if we didn't have to
account for side-captions.

Differential Revision: https://phabricator.services.mozilla.com/D165690
2023-01-09 07:05:14 +00:00
Ting-Yu Lin
37ab1df467 Bug 1807958 - Exclude -moz-column-content from the block side margin calculation. r=emilio
-moz-column-content is the anonymous block under nsColumnSetFrame, and it
doesn't have any margin in UA stylesheet, so we don't need to call
CalculateBlockSideMargins() to compute its auto margin.

The assertion added in Bug 1782602 is triggered by the testcase because bogus
size leads to negative available inline-size, and CalculateBlockSideMargins()
can compute non-zero margin.

Differential Revision: https://phabricator.services.mozilla.com/D165930
2023-01-04 23:09:57 +00:00
Ting-Yu Lin
556a172274 Bug 1795196 Part 3 - Remove the special case for viewport in SetComputedISize(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159539
2022-10-18 00:26:20 +00:00
Ting-Yu Lin
cd2c1471d2 Bug 1795196 Part 2 - Convert ComputedMin{I|B}Size() and ComputedMax{I|B}Size() that return writable references to setters. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159353
2022-10-18 00:26:20 +00:00
Ting-Yu Lin
261c24ebe5 Bug 1795196 Part 1 - Remove ComputedISize() and ComputedBSize() that return writable references. r=emilio
Users of these two getters should use setters such as SetComputedISize() instead.

Differential Revision: https://phabricator.services.mozilla.com/D159352
2022-10-18 00:26:19 +00:00
Emilio Cobos Álvarez
d5836162f2 Bug 1793700 - Improve widget-imposed min size handling. r=TYLin,layout-reviewers,dshin
Make it work as a min-size everywhere rather than only handling it in
nsIFrame::ComputeSize.

This is more similar to what XUL code does. In particular, it makes
makes it work for elements that don't have a definite size in
ComputeSize (like flex containers).

For web-exposed widgets this only matters for <input type=color> and
<input type=range>, which are the only exposed widgets that return a
minimum size that return a minimum size. This patch makes the minimum
size honored for `<input type="color" style="height: auto">`. Add a test
for that (though we might want to change it to match other browsers).

Without this fix, min/max/close buttons on Linux are zero-height with
flex emulation, because we fail to account for their minimum
widget-imposed size.

This allows us to remove the special case in nsFlexContainerFrame too,
since that should be handled by ReflowInput correctly now.

Differential Revision: https://phabricator.services.mozilla.com/D158612
2022-10-05 19:34:03 +00:00
Martin Robinson
3b0ff9fae9 Bug 1791760 - Move GetContainSizeAxes to nsIFrame r=emilio
This will allow this function to eventually return an appropriate value
depending on whether or not content is skipped via `content-visibility:
auto`. This change also starts looking directly at whether
content-visibility is skipping content or not, which should make it
compatible with a future `content-visibility: auto` implementation.

Differential Revision: https://phabricator.services.mozilla.com/D157831
2022-09-22 12:11:09 +00:00
Emilio Cobos Álvarez
3c206e563a Bug 1786147 - Make -webkit-line-clamp create a block container in the appropriate situations. r=dholbert
This is a hack, sorta, similar to Chromium's:

  https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/layout/layout_object.cc;l=356;drc=312b74e385e6aba98ab31fd911238c0dc16b396c

except at computed-value rather than used-value time, because it's both
simpler to reason about and prevents lying in the computed style.

This fixes the relevant test-case, and matches closer what Chromium does,
by not creating anonymous flex items for all elements inside the
line-clamp context.

The behavior change is covered by the test changes. I had to also fix a
couple pre-existing bugs that were caught by tests, now that the
line-clamped block is the -webkit-box-styled element rather than an anonymous
flex item (and thus now had padding).

Depends on D155180

Differential Revision: https://phabricator.services.mozilla.com/D155181
2022-09-07 23:57:18 +00:00
Emilio Cobos Álvarez
352d47e585 Bug 1786214 - Remove UseAutoBSize flag. r=TYLin
Use a more precise, grid-specific flag to avoid applying grid stretching
etc, and pass an unconstrained block size instead for baseline alignment
measuring, which will cause us to interpret relative sizes as auto.

This shouldn't cause any behavior change, but is a prerequisite
necessary for bug 1609403 (where we don't always want definite sizes
being ignored in measuring reflows for baseline alignment). It's also a
bit clearer, IMO.

Differential Revision: https://phabricator.services.mozilla.com/D155178
2022-08-23 09:17:38 +00:00
Ting-Yu Lin
8839aff8b8 Bug 1463977 Part 3 - Ensure {I|B}Size set in SetComputed{I|B}Size is non-negative, and downgrade the assertion. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D155322
2022-08-23 05:12:00 +00:00
Ting-Yu Lin
95fdc2379b Bug 1463977 Part 2 - Call SetComputedBSizeWithoutResettingResizeFlags() in SetComputedBSize(). r=dholbert
This is a preparation for the next part.

Differential Revision: https://phabricator.services.mozilla.com/D155321
2022-08-23 05:11:59 +00:00
Ting-Yu Lin
611db0b345 Bug 1463977 Part 1 - Mark SizeComputationInput::mFrame const, and assert its validity. r=dholbert
mFrame is public and used throughout the layout, but it shouldn't be modified
post constructor.

Differential Revision: https://phabricator.services.mozilla.com/D155320
2022-08-23 05:11:59 +00:00
Ting-Yu Lin
e4b537b53a Bug 1780264 Part 3 - Remove ReflowInput::mStyleText. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D152204
2022-07-20 00:48:22 +00:00
Ting-Yu Lin
efdf31a619 Bug 1780264 Part 2 - Remove ReflowInput::mStylePadding. r=emilio
While I'm here, rename the local variable `styleMargin` to `margin` to make the
naming consistent with the `padding` naming in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D152203
2022-07-20 00:48:22 +00:00
Ting-Yu Lin
991f16122f Bug 1780264 Part 1 - Remove ReflowInput::mStyleVisibility. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D152202
2022-07-20 00:48:21 +00:00
Ting-Yu Lin
291489917d Bug 1778178 - Convert ReflowInput's available size write-accessors to setters. r=layout-reviewers,jfkthame
This patch rewrites some callers, but they shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151042
2022-07-06 17:39:57 +00:00
Emilio Cobos Álvarez
9c190fff4b Bug 1771564 - Constify ComputedStyle usage in nsComputedDOMStyle. r=dholbert
None of the consumer need to mutate styles, and this saves some ugly
const_casting on the next patch.

Doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D147555
2022-05-28 01:04:24 +00:00
David Shin
d1cd6ae125 Bug 1765668: Fix border offset when the writing-mode of an abspos element's containing block differs from its absolute containing block. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D146095
2022-05-18 18:09:33 +00:00
Boris Chiou
035220bf4c Bug 1760658 - Part 1: Apply automatic content-based minimum on flex container. r=emilio
Basides, factor out the utility function to AspectRatio so everyone can
use it.

Differential Revision: https://phabricator.services.mozilla.com/D144891
2022-05-02 20:06:32 +00:00
Daniel Holbert
e0100e2b76 Bug 1765632: Coalesce two variables into one Maybe<> variable, in ReflowInput::CalculateHypotheticalPosition. r=dshin
This patch shouldn't change behavior; it's just refactoring/simplifying
existing code, without changing the logic.

Differential Revision: https://phabricator.services.mozilla.com/D144221
2022-04-20 22:35:20 +00:00
David Shin
ec93876623 Bug 1755565 - Implement contain: inline-size. r=emilio,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D143501
2022-04-19 17:44:16 +00:00
Ting-Yu Lin
b48196dcda Bug 1758018 Part 2 - Add helpers testing only "position:relative", and adapt them at some callsites. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D140274
2022-03-04 03:02:01 +00:00
Ting-Yu Lin
7e0c39f9b1 Bug 1758018 Part 1 - Rename the helpers testing "position:relative" or "position:sticky". r=emilio
`nsIFrame::IsRelativelyPositioned()` tests "position:relative" or
"position:sticky", but its naming is misleading until you've dug into the
underlying helper `nsStyleDisplay::IsRelativelyPositionedStyle()`.

Differential Revision: https://phabricator.services.mozilla.com/D140273
2022-03-04 03:02:00 +00:00
Ting-Yu Lin
017c34b54e Bug 1756008 Part 5 - Manual fix for comments and variables regarding BlockReflowState. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D139440
2022-02-23 21:22:44 +00:00
Ting-Yu Lin
7ec49f975f Bug 1735251 - Set ReflowInput::mComputeSize in one operation. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D128150
2021-10-12 17:51:11 +00:00