Commit graph

276 commits

Author SHA1 Message Date
Boris Chiou
6c1d6cb52f 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
55bc8b2992 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
4150fa8a93 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
8545559775 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
f448377232 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
ea9685fb41 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
f01d9a4402 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
ed3ef63263 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
159428759d 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
838ff0af9f 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
5f5bebcbde 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
bebec20c7a 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
f6ef0ea044 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
689a7c82d0 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
ca5460eda2 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
60ba2b527c 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
a43cae175a 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
6e74b37f10 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
0492d8333a 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
ffce5ed7d6 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
d980c9bbf8 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
e64aef319f 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
b6b2f1e5f4 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
d0c462cb81 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
35b078ace3 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
33c0c70a2b 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
8d1403f488 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
912aeb9ab5 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
51ff79f7fa 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
50c2dfd847 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
c1cb73505a 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
f6311eea98 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
e4563f969a 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
cd4d90de10 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
c4f40b5e7a 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
a6da85e68b 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
fda5763ce6 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
d40b9823cd 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
5f0b63620e 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
Bogdan Tara
4a649093b9 Backed out changeset 3e90a3759639 (bug 1679208) for scrollbars-no-margin.html failures CLOSED TREE 2020-12-03 01:11:32 +02:00
Emilio Cobos Álvarez
aa15236426 Bug 1679208 - Don't assume int return values in nsITheme. r=mstange
This doesn't hold with fractional scale values. Right now GTK truncates
the scale factor, Windows rounds, and non-native theme rounds as well.

With this native theme will propagate correctly the floating point
values.

I tried to not change behavior meaningfully in any of the other themes,
mostly to avoid risk. GTK and Windows can be trivially tweaked to
support fractional scale factors properly if we wanted to, but seems
better to not do that as part of this patch.

Depends on D98099

Differential Revision: https://phabricator.services.mozilla.com/D98100
2020-12-02 21:40:05 +00:00
Mats Palmgren
0334aa2c5f Bug 1679471 - Demote fatal assertions to warnings since they depend on calculated nscoord values. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D98125
2020-11-30 18:08:16 +00:00
Boris Chiou
04d9986bd4 Bug 1651776 - aspect-ratio should be used for abspos when insets on the block axis are specified. r=TYLin
Based on https://github.com/w3c/csswg-drafts/issues/5151,
if the block size is auto, we still can use the insets to resolve the auto
block size on absoluate position elements, so we still can use this resolved
block size to calculate the inline size through aspect-ratio.

Differential Revision: https://phabricator.services.mozilla.com/D96277
2020-11-20 22:46:05 +00:00
Boris Chiou
d1895eafaa Bug 1651776 - Refine the terminology of writing modes when handling unconstrained block-size on out-of-flow boxes. r=TYLin
I'd like to handle aspect-ratio in those code block, so it'd be better
to always handle unconstrained block-size on the writing mode of the current
block. Besides, we move it as a method of ReflowInput.

Differential Revision: https://phabricator.services.mozilla.com/D97515
2020-11-20 22:38:38 +00:00
Ting-Yu Lin
ea437e0a57 Bug 1675128 Part 6 - Remove nsStylePosition::OffsetHasPercent(). r=emilio
Remove it to encourage people to use existing API to get logical side.

Differential Revision: https://phabricator.services.mozilla.com/D96160
2020-11-07 00:03:47 +00:00
Ting-Yu Lin
43e060b82e Bug 1675128 Part 4 - Remove ReflowInput::ComputedPhysicalOffsets() that returns a writable-reference. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D96128
2020-11-07 00:03:38 +00:00
Ting-Yu Lin
1fb3ba8f3e Bug 1675128 Part 3 - Make ReflowInput::ComputeRelativeOffsets() return the offset in LogicalMargin. r=emilio
Also, convert its implementation to use more logical APIs.

Differential Revision: https://phabricator.services.mozilla.com/D96127
2020-11-06 22:20:00 +00:00
Ting-Yu Lin
98cfb55831 Bug 1675128 Part 2 - Add WritingMode argument to ReflowInput::ComputedLogicalOffsets(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D96126
2020-11-06 09:12:00 +00:00
Ting-Yu Lin
7ffe5c7565 Bug 1675128 Part 1 - Add WritingMode argument to ReflowInput::SetComputedLogicalOffsets(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D96125
2020-11-06 09:11:49 +00:00
Ting-Yu Lin
15775521ac Bug 1674931 Part 3 - Add WritingMode argument to SizeComputationInput::ComputedLogicalPadding(), and adapt callers. r=jfkthame
This patch is similar to Part 1, but for ComputedLogicalPadding().

Differential Revision: https://phabricator.services.mozilla.com/D95663
2020-11-03 19:56:03 +00:00