Commit Graph

287 Commits

Author SHA1 Message Date
Ting-Yu Lin
18aafa5d33 Bug 1725973 Part 2 - Mark flex items with percentage flex-basis in column flex container as depending on CB's block-size. r=dholbert
If so, `dependsOnCBBSize` will be set to true, and later in
`ReflowInput::InitResizeFlags()` we will add
`NS_FRAME_CONTAINS_RELATIVE_BSIZE` to the appropriate ancestor.

Sorted the #include statements in ReflowInput.cpp because I added
nsFlexContainerFrame.h.

Differential Revision: https://phabricator.services.mozilla.com/D123703
2021-08-26 22:43:10 +00:00
Emilio Cobos Álvarez
33b69a5c9a 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
8522453839 Backed out changeset 67c33ba5566e (bug 1722945) for causing bustage in nsContainerFrame.cpp 2021-08-03 20:35:10 +03:00
Emilio Cobos Álvarez
9d7e971d84 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
267c7a04f9 Bug 1716212 Part 2 - Carry nsComboboxControlFrame's line-height to nsComboboxDisplayFrame when it has auto block-size. r=emilio
The issue is that combobox display may contain some non-Latin characters
that need extra block-size to display than the one line-height
calculate by using a Latin font spec in combobox control's style.

Before this patch, when a combobox control has unconstrained block-size,
we set combobox display's block-size to combobox control's one
line-height in Reflow(), which is intended to properly initialize
`BlockReflowInput::mMinLineHeight` since combobox display has
`line-height:-moz-block-height`. However, this simply prevents the
combobox display from choosing a larger block-size after the reflow. See
bug 1716212 comment 11 for an analysis.

This patch fixes the issue by carrying combox control's computed line
height to combobox display so that its computed block-size is still
unconstrained so that it can accommodate taller characters in the
display text.

After this patch, <select><option> containing non-Latin characters
should have the same block-size as <button>, and no characters should be
clipped. Modified test_unstyled_control_height.html to test this.

Differential Revision: https://phabricator.services.mozilla.com/D120877
2021-07-28 18:41:19 +00:00
Ting-Yu Lin
fed11cd20f 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
Boris Chiou
82977cea02 Bug 1679794 - Downgrade MOZ_ASSERT to NS_WARNING_ASSERTION for the resolved non-auto-insets block size on abs-positioned elements. r=dholbert
This is an known issue for nscoord because we don't have a better way to
distinguish between the unresolved size and the resolved super large size.
Using NS_WARNING_ASSERTION is the current acceptable way.

Differential Revision: https://phabricator.services.mozilla.com/D119470
2021-07-21 00:07:27 +00:00
Xidorn Quan
d9e5ba7d56 Bug 1714457 - Make predefined symbolic counter styles not overridable. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D116938
2021-06-07 11:39:31 +00:00
Butkovits Atila
4362aa038b Backed out changeset 1a6ee358d131 (bug 1714457) for causing failures at redefine-attr-mapping.html. CLOSED TREE 2021-06-07 00:31:38 +03:00
Xidorn Quan
af9fef8c60 Bug 1714457 - Make predefined symbolic counter styles not overridable. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D116938
2021-06-06 12:55:07 +00:00
Ting-Yu Lin
789d5567c3 Bug 1709491 Part 1 - Add SizeComputationInput::ComputedLogicalBorder(), and adapt callers. r=dholbert
The helper is going to be used in a later part.

I don't add the physical version ComputedPhysicalBorder() deliberately
because I don't want to promote the usage of physical coordinate.

Differential Revision: https://phabricator.services.mozilla.com/D114544
2021-05-12 06:32:40 +00:00
Boris Chiou
2726b0f540 Bug 1699263 - Fix the issue that we unconditionally use autoBSize when we specify the block size and aspect-ratio. r=TYLin
Also, rewrite CalculateAbsoluteSizeWithResolvedAutoBlockSize(). Move
all the aspect-ratio checks into this function, so make the caller simplier.

Differential Revision: https://phabricator.services.mozilla.com/D109568
2021-04-05 19:33:05 +00:00
Mats Palmgren
09270e77d1 Bug 1699605 - Add missing !GetPrevInFlow() check. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D109220
2021-03-20 22:40:45 +00:00
Sean Feng
3cd3a20193 Bug 1669734 - For abspos frames, resolve intrinsic BSize keywords to the actual intrinsic BSize, instead of stretching to fill the available space r=emilio,dholbert
This patch creates a new behavior for absolute positioned frames such
that if they have intrinsic size keywords (-moz-fit-content, min-content,
max-content) for their BSize and the margins are auto, instead of taking
as much space as possible, use the actual intrinsic BSize as the BSize.

Users can still use `auto` keyword to make it to fill the available
space.

This change is to align with the spec text for these intrinsic sizing
keywords at https://drafts.csswg.org/css-sizing/#valdef-width-min-content,
per the changes resolved on in https://github.com/w3c/csswg-drafts/issues/3973

This patch modifies the centering.html WPT, to expand the test
cases to test the centering functionalities for not only explicitly specified
height and width, but also the default size and width, in this case the
intrinsic sizing keywords.

Differential Revision: https://phabricator.services.mozilla.com/D106497
2021-03-15 15:45:18 +00:00
Sean Feng
db613a561c Bug 1669734 - Factor out the logic of computing auto margins for abspos frames to its own method r=dholbert,emilio
Differential Revision: https://phabricator.services.mozilla.com/D107872
2021-03-15 15:45:17 +00:00
Boris Chiou
2021207c6c Bug 1682032 - aspect-ratio should be applied for auto block-size by default. r=emilio
Based on the discussion in
https://github.com/w3c/csswg-drafts/issues/5721#issuecomment-781702159,
the default ratio-dependent axis is block axis (though the spec issue is
for replaced elements, but I think the behavior should be consistent).
So we should apply aspect-ratio not matter what the inline size is (e.g.
nscoord_MAX, auto or other values).

In the test case, the min-block-size is 1073741823, and its transferred
min-inline-size is also 1073741823, so we get a 1073741823 (i.e. nscoord_MAX)
preferred inline size (i.e. result.ISize(aWM) == NS_UNCONSTRAINEDSIZE).
However, we still have to apply aspect-ratio because the style of block-size is
auto, and so mFlags.mBSizeIsSetByAspectRatio should be set unconditionally here.

I still keep this assertion because it helps me catch this potential
issue. (Just reword it anyway.)

Differential Revision: https://phabricator.services.mozilla.com/D107764
2021-03-10 23:20:49 +00:00
Ting-Yu Lin
80fb40f901 Bug 1690701 Part 4 - Replace rarely used ReflowInput::IsFloating() with nsStyleDisplay::IsFloating(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D106583
2021-03-04 00:34:04 +00:00
Mats Palmgren
c9ac4f3432 Bug 1694729 - Fix sizing issues for display:table-* on <fieldset> and replaced elements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D106656
2021-03-01 15:37:00 +00:00
Ting-Yu Lin
073b7c6843 Bug 1692116 Part 3 - Fix table flex item's content block-size measurement by removing mIsFlexContainerMeasuringBSize flag. r=dholbert
The mIsFlexContainerMeasuringBSize flag serves two purposes:

(1) Tell ReflowInput::ComputeMinMaxValues() to treat min-block-size and
max-block-size like the initial value.

We can just set both sizes after creating the ReflowInput, like this
patch does.

(2) Add `ComputeSizeFlag::UseAutoBSize` to mComputeSizeFlags.

Similar to the reasoning in Bug 1674302 Part 2
https://hg.mozilla.org/mozilla-central/rev/23aff0f21a1d, the
UseAutoBSize flag is buggy when used on table flex items because it
never propagates to inner table frame. We can fix it by providing an
'auto' mStyleBSize in StyleSizeOverrides.

This fixed table flex item's content block-size measurement. As
described in table-as-item-specified-height.html, the specified height
on <table> now won't count as another min-height anymore.

Differential Revision: https://phabricator.services.mozilla.com/D106157
2021-02-25 20:06:11 +00:00
Tim Nguyen
835adf38d8 Bug 1590884 - Move XUL accesskey handling to DOM and remove nsXULLabelFrame. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D106233
2021-02-24 14:46:28 +00:00
Ting-Yu Lin
a1372e0618 Bug 1689504 Part 4 - Set zero margins for table frame in ComputeMargin(). r=emilio
The old code used to compute margins for table frame, and nuke it
afterwards. We can save time by moving the code that sets zero margins
into ComputeMargin() before looking into margin property.

Differential Revision: https://phabricator.services.mozilla.com/D104351
2021-02-08 10:28:19 +00:00
Ting-Yu Lin
deedb71ce5 Bug 1689504 Part 3 - Remove the specialized code to set a collapsed table's border & padding in SizeComputationInput. r=emilio
When creating a ReflowInput for inner table frame in
CreateReflowInputForInnerTable(), we pass the customize border & padding
if the table frame is border-collapsed.

Similarly, when creating a SizeComputationInput for inner table frame,
we should be able to pass border & padding rather than having a
specialized logic in SizeComputationInput::InitOffsets(). This patch
makes this a reality.

Differential Revision: https://phabricator.services.mozilla.com/D104350
2021-02-08 10:26:41 +00:00
Emilio Cobos Álvarez
17fdf21358 Bug 1690706 - Move caption-side outside of mako. r=TYLin
Make it an enum class, etc.

Differential Revision: https://phabricator.services.mozilla.com/D103978
2021-02-07 12:33:45 +00:00
Mats Palmgren
bb9370d964 Bug 1683748 - Support Grid/Flex/Table/Column layout for the rendered legend of a fieldset. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101555
2021-01-30 13:47:10 +00:00
Dorel Luca
5092d0515f Backed out changeset 2d16e9e90401 (bug 1683748) for WPT failures in html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol.html. CLOSED TREE 2021-01-29 22:07:09 +02:00
Mats Palmgren
7deb159ea6 Bug 1683748 - Support Grid/Flex/Table/Column layout for the rendered legend of a fieldset. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101555
2021-01-29 15:45:42 +00:00
Ting-Yu Lin
10c10c1b52 Bug 1688690 Part 2 - Ensure nsTableFrame's computed margins are all zero. r=emilio
This patch makes the following changes:

1. Don't call ReflowInput::CalculateBlockSideMargins() for nsTableFrame
so that setting nsTableFrame's computed margins to zero in
SizeComputationInput::InitOffsets() remains true. Also, add an assertion
in nsTableFrame::Reflow() to ensure that.

2. Remove useless nsTableFrameWrapper::GetChildMargin() because the
method is used to get nsTableFrame's margins, which are now all zero.
Also, the old code that subtracts the block-axis margin from available
block-size doesn't really make sense.

3. Pass all-zero innerMargins to nsTableWrapperFrame::SetDesiredSize(),
and use table wrapper's content-box inline-size as the final desired
border-box inline-size rather than reconstructing it from caption and
inner table's inline-size & margin like the old code.

This inline-size already takes inner table's intrinsic size and
caption's inline-size into consideration in
nsTableWrapperFrame::ComputeAutoSize(), and is the final inline-size we
want to use.

In the next part, we are going to simplify all nsTableWrapperFrame's
methods that take inner frame's margin.

Differential Revision: https://phabricator.services.mozilla.com/D103065
2021-01-27 01:53:36 +00:00
Ting-Yu Lin
4212852170 Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
This patch adds the struct as a parameter to various functions.

The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.

In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.

Differential Revision: https://phabricator.services.mozilla.com/D101793
2021-01-26 02:47:40 +00:00
Ting-Yu Lin
f92ebafa1b Bug 1686603 Part 1 - Remove unused ReflowInput::GetContainingBlockContentISize(). r=emilio
The last consumer was removed in
https://hg.mozilla.org/mozilla-central/rev/2775681c72a3

Differential Revision: https://phabricator.services.mozilla.com/D101791
2021-01-26 02:47:26 +00:00
Csoregi Natalia
c578110922 Backed out 8 changesets (bug 1686603) for causing crashtest failures. CLOSED TREE
Backed out changeset 94b5d0986d27 (bug 1686603)
Backed out changeset e7edf6fcc41d (bug 1686603)
Backed out changeset 4c9271f07178 (bug 1686603)
Backed out changeset 7013b95266ae (bug 1686603)
Backed out changeset cf7a55638aef (bug 1686603)
Backed out changeset 7717a0f2a37b (bug 1686603)
Backed out changeset c82593b13a61 (bug 1686603)
Backed out changeset fd1d95a1e706 (bug 1686603)
2021-01-26 04:32:13 +02:00
Ting-Yu Lin
e938d6265e Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
This patch adds the struct as a parameter to various functions.

The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.

In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.

Differential Revision: https://phabricator.services.mozilla.com/D101793
2021-01-25 22:29:31 +00:00
Ting-Yu Lin
093704deb3 Bug 1686603 Part 1 - Remove unused ReflowInput::GetContainingBlockContentISize(). r=emilio
The last consumer was removed in
https://hg.mozilla.org/mozilla-central/rev/2775681c72a3

Differential Revision: https://phabricator.services.mozilla.com/D101791
2021-01-25 22:03:11 +00:00
Ting-Yu Lin
404df07751 Bug 1687795 - Rename the flag tracking whether block-size is set by aspect-ratio and inline-size, and improve comments. r=boris
* Follow other flags' naming by putting "Is" at the beginning.
* Delete the accessor because we just access other flags directly.

Differential Revision: https://phabricator.services.mozilla.com/D102480
2021-01-22 04:41:37 +00:00
Mihai Alexandru Michis
0f4955060c Backed out 7 changesets (bug 1686603) for causing crashtest assertion failures.
CLOSED TREE

Backed out changeset 19cba7d34a7f (bug 1686603)
Backed out changeset 3a0d0155ea5e (bug 1686603)
Backed out changeset f1f672cdd0c6 (bug 1686603)
Backed out changeset 63020922e2fd (bug 1686603)
Backed out changeset 8766ce79ba5e (bug 1686603)
Backed out changeset 965dbe8de1e1 (bug 1686603)
Backed out changeset b1328ee45f43 (bug 1686603)
2021-01-21 09:21:12 +02:00
Ting-Yu Lin
f8c6caafee Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
This patch adds the struct as a parameter to various functions.

The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.

In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.

Differential Revision: https://phabricator.services.mozilla.com/D101793
2021-01-21 04:17:59 +00:00
Ting-Yu Lin
6325a35299 Bug 1686603 Part 1 - Remove unused ReflowInput::GetContainingBlockContentISize(). r=emilio
The last consumer was removed in
https://hg.mozilla.org/mozilla-central/rev/2775681c72a3

Differential Revision: https://phabricator.services.mozilla.com/D101791
2021-01-21 03:56:21 +00:00
Boris Chiou
aa981f5af7 Bug 1646100 - min-width:auto together with apect-ratio should take the intrinsic content size into account when width is {min|max|fit}-content or auto. r=TYLin
We have to set the flag, AspectRatioUsage::ToComputedISize if we
resolve the min-content/max-content/fit-content by aspect-ratio, so that
we can handle min-width:auto well.

Differential Revision: https://phabricator.services.mozilla.com/D99406
2021-01-19 21:47:55 +00:00
Boris Chiou
35fcb53f95 Bug 1646100 - Take LogicalSize type for containing block and boxing size adjustment for ComputeISizeValue. r=TYLin
We may use the block size to compute the inline size if there is a
non-auto finite aspect-ratio and definite block size, so we need more
information on the block axis. Therefore, we have to pass LogicalSize
for containing block and boxing size adjustment.

Differential Revision: https://phabricator.services.mozilla.com/D99289
2021-01-19 21:51:04 +00:00
Sylvestre Ledru
ddcb9eb4bc Bug 1519636 - Reformat recent changes to the Google coding style r=andi
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D102084
2021-01-18 16:50:16 +00:00
Mats Palmgren
8f74771937 Bug 1686310 part 7 - Remove ReflowInput::mFrameType and associated code, which is now dead code. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101554
2021-01-14 03:23:40 +00:00
Mats Palmgren
b61378664c Bug 1686310 part 6 - Remove NS_CSS_FRAME_TYPE_INLINE. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101553
2021-01-14 03:17:46 +00:00
Mats Palmgren
68b140981c Bug 1686310 part 5 - Remove NS_CSS_FRAME_TYPE_BLOCK. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101552
2021-01-14 03:46:03 +00:00
Mats Palmgren
702a0b82dd Bug 1686310 part 4 - Remove NS_CSS_FRAME_TYPE_ABSOLUTE. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101551
2021-01-14 03:23:58 +00:00
Mats Palmgren
0cca969684 Bug 1686310 part 3 - Replace NS_CSS_FRAME_TYPE_INTERNAL_TABLE with checks of the actual frame class, which is more correct. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101550
2021-01-14 03:47:42 +00:00
Mats Palmgren
df939c4df3 Bug 1686310 part 2 - Replace NS_FRAME_IS_REPLACED* with a bit that caches the corresponding IsFrameOfType result. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101549
2021-01-14 03:15:31 +00:00
Mats Palmgren
883fbde1a0 Bug 1686310 part 1 - Remove NS_CSS_FRAME_TYPE_FLOATING. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101548
2021-01-13 07:10:39 +00:00
Emilio Cobos Álvarez
b845704b66 Bug 1577530 - Cache theming values from nsTextControlFrame correctly. r=heycam
The issue is that nsTextControlFrame might have a different used padding
then the editing root block and thus the editing root's scrolled
content, etc, because its padding doesn't match the style.

This causes TextOverflow code to miscompute the content area size, which
is sadness and causes the overflow markers to go over the padding box.

The REFLOW_ROOT condition was introduced in bug 157846 and only
partially takes care of the issue. This fix supersedes it, so we can
remove it.

Differential Revision: https://phabricator.services.mozilla.com/D99838
2020-12-16 21:23:17 +00:00
Ting-Yu Lin
5dd6cb9bca Bug 1681849 Part 4 - Change computed min-size and max-size to store in LogicalSize. r=emilio
Remove unused ComputedMinWidth(), ComputedMaxWidth(),
ComputedMinHeight(), and ComputedMaxHeight() that return
writable-references.

Differential Revision: https://phabricator.services.mozilla.com/D99502
2020-12-12 22:12:49 +00:00
Ting-Yu Lin
85519809bd Bug 1681849 Part 2 - Reimplement SetComputedISize() and SetComputedBSize(). r=emilio
We can use them to implement SetComputedWidth() and SetComputedHeight()
rather than the other way around.

The logic involving whether to call InitResizeFlags() for viewport frame
can be simplified. That is, we don't want to call InitResizeFlags() for
viewport frame in SetComputedISize().

Remove unused ComputedWidth() and ComputedHeight() that return
writable-references.

Differential Revision: https://phabricator.services.mozilla.com/D99500
2020-12-12 22:09:54 +00:00
Ting-Yu Lin
c9e78355eb Bug 1681849 Part 1 - Change available block and inline size to store in LogicalSize. r=layout-reviewers,emilio
I put the private member section at the end of ReflowInput's
declarations. In later patches, other members are going to live there
when they're converted to logical coordinates.

Remove unused AvailableWidth() and AvailableHeight() that return
writable-references.

I didn't port the comment section verbatim, but revise them according to
the best of my knowledge.

Differential Revision: https://phabricator.services.mozilla.com/D99499
2020-12-12 14:56:47 +00:00