Commit Graph

1999 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
c852e76f3c Bug 1685078 - Support full <image> syntax in list-style-image as per spec. r=jrmuizel,TYLin
This allows supporting image-set(), etc, and simplifies the bullet frame
code significantly, too thanks to two changes:

  * Instead of manually managing the image request, use the CSS image
    loader, with the `REQUEST_REQUIRES_REFLOW` flag, to handle image
    loads correctly. This didn't exist when this code was initially
    implemented, but we can nicely use it now.

  * Instead of re-implementing another WebRender command-builder thing,
    we can just reuse the nsImageRenderer code.

Differential Revision: https://phabricator.services.mozilla.com/D100774
2021-01-08 09:44:24 +00:00
Dorel Luca
4ff8c8e84e Backed out changeset 47c73e5e08a4 (bug 1685078) for multiple failures related to CSS. CLOSED TREE 2021-01-07 10:44:10 +02:00
Emilio Cobos Álvarez
516069d5c1 Bug 1685078 - Support full <image> syntax in list-style-image as per spec. r=jrmuizel,TYLin
This allows supporting image-set(), etc, and simplifies the bullet frame
code significantly, too thanks to two changes:

  * Instead of manually managing the image request, use the CSS image
    loader, with the `REQUEST_REQUIRES_REFLOW` flag, to handle image
    loads correctly. This didn't exist when this code was initially
    implemented, but we can nicely use it now.

  * Instead of re-implementing another WebRender command-builder thing,
    we can just reuse the nsImageRenderer code.

Differential Revision: https://phabricator.services.mozilla.com/D100774
2021-01-07 04:15:01 +00:00
Mats Palmgren
aaec895cdf Bug 1663222 - Move any overflow-container continuations on the OverflowContainers list for the children we pull from our prev-in-flow to the ExcessOverflowContainers to keep frames ordered. r=TYLin CLOSED TREE
Making them non-overflow containers is valid but then we can't just
append them to mFrames since that'll put them on the last line which
may result in some lines in-between the pulled child and its
continuation.  That violates the invariant that in-flow continuations
in the same parent must be on consecutive lines (unless they are
overflow containers in which case they need to be on the
[Excess]OverflowContainers lists).

(The crash happens because if we push the lines in-between the two
continuations to the OverflowLines, then we won't find the 2nd
continuation on the first line of OverflowLines.)

(Note also that this change triggers the assertion in
DrainExcessOverflowContainersList, and depends on bug 1680406
to fix that and merge the lists.)

Differential Revision: https://phabricator.services.mozilla.com/D99560
2020-12-14 15:13:35 +00:00
smolnar
f11b3172ce Backed out 2 changesets (bug 1680406, bug 1663222) for causing mochitest failures. CLOSED TREE
Backed out changeset 6de49379342e (bug 1663222)
Backed out changeset 0ad0d59dbeec (bug 1680406)
2020-12-15 06:22:49 +02:00
Mats Palmgren
815f21636e Bug 1663222 - Move any overflow-container continuations on the OverflowContainers list for the children we pull from our prev-in-flow to the ExcessOverflowContainers to keep frames ordered. r=TYLin
Making them non-overflow containers is valid but then we can't just
append them to mFrames since that'll put them on the last line which
may result in some lines in-between the pulled child and its
continuation.  That violates the invariant that in-flow continuations
in the same parent must be on consecutive lines (unless they are
overflow containers in which case they need to be on the
[Excess]OverflowContainers lists).

(The crash happens because if we push the lines in-between the two
continuations to the OverflowLines, then we won't find the 2nd
continuation on the first line of OverflowLines.)

(Note also that this change triggers the assertion in
DrainExcessOverflowContainersList, and depends on bug 1680406
to fix that and merge the lists.)

Differential Revision: https://phabricator.services.mozilla.com/D99560
2020-12-14 15:13:35 +00:00
Ting-Yu Lin
cf38e8909f Bug 1679931 Part 3 - Recompute overflow container children's overflow area after moving them in vertical-rl writing-mode. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D98517
2020-12-07 23:30:51 +00:00
Ting-Yu Lin
552c8b9ca6 Bug 1679931 Part 2 - Recompute float children's overflow area after moving them in vertical-rl writing-mode. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D98516
2020-12-07 23:31:37 +00:00
Ting-Yu Lin
86c6cd4507 Bug 1679931 Part 1 - Remove unused nsReflowStatus parameter in nsBlockFrame::ReflowPushedFloats(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D98515
2020-12-03 00:24:56 +00:00
Emilio Cobos Álvarez
ef6e9c3f63 Bug 1677917 - Change BlockReflowInput's skipsides setup to be sane. r=mats,TYLin
Precomputing the skipBEnd bit is odd / wrong. Using the PreReflow
version causes no regression, and allows us to simplify the code.

It also reverts the test annotations added to bug 1675376 which were
caused by the extra argument to GetLogicalSkipSides() somehow.

Differential Revision: https://phabricator.services.mozilla.com/D97418
2020-11-30 17:49:04 +00:00
Razvan Maries
b3a43ce709 Backed out changeset b2da4b644dd9 (bug 1677917) for perma failures on break-at-end-container-edge-000.html. CLOSED TREE 2020-11-21 19:23:33 +02:00
Emilio Cobos Álvarez
c758e812ea Bug 1677917 - Change BlockReflowInput's skipsides setup to be sane. r=mats,TYLin
Precomputing the skipBEnd bit is odd / wrong. Using the PreReflow
version causes no regression, and allows us to simplify the code.

It also reverts the test annotations added to bug 1675376 which were
caused by the extra argument to GetLogicalSkipSides() somehow.

Differential Revision: https://phabricator.services.mozilla.com/D97418
2020-11-21 15:53:16 +00:00
Jon Bauman
5deeb97781 Bug 1675987 - No derogatory language: Remove references to "crazy" in layout module r=emilio,AlaskanEmily
Differential Revision: https://phabricator.services.mozilla.com/D97657
2020-11-20 21:21:03 +00:00
Emilio Cobos Álvarez
11b409ac36 Bug 1677920 - Remove writing mode argument from CalcAndCacheConsumedBSize(). r=TYLin
Always matches the frame's writing-mode.

Differential Revision: https://phabricator.services.mozilla.com/D97390
2020-11-18 11:06:29 +00:00
Emilio Cobos Álvarez
75545749a5 Bug 1675376 - Lift IsBidiEnabled check up to the caller. r=mats
That avoids going all the way to the first continuation to call ResolveBidi on
it. This shaves a bunch of time when there are a lot of pages.

This is more problematic than it seems specially when there's no bidi, because
in the "bidi not enabled" case we never remove the flag, which is bad. When
bidi is actually enabled we usually have done the resolution already.

Differential Revision: https://phabricator.services.mozilla.com/D97358
2020-11-18 11:04:42 +00:00
Emilio Cobos Álvarez
14c2fc9d28 Bug 1675376 - Cache consumed BSize in a frame property for non-first continuations. r=mats
This removes virtually all the time under ConsumedBSize. See the comment for
what ensures the correctness of the cache: Basically, we refresh the cache for
a frame continuation every time we reflow it, which means that when next
continuations go look for it it should be up-to-date (we rely on that already
because we're looking at the content rect).

Differential Revision: https://phabricator.services.mozilla.com/D97357
2020-11-18 11:04:35 +00:00
Bogdan Tara
1e43b9d1ba Backed out 3 changesets (bug 1675376) for asan crashtest failures CLOSED TREE
Backed out changeset b276c591ea2d (bug 1675376)
Backed out changeset 20d5c7217304 (bug 1675376)
Backed out changeset e3aa6fb62422 (bug 1675376)
2020-11-18 08:00:38 +02:00
Emilio Cobos Álvarez
8ff121017e Bug 1675376 - Lift IsBidiEnabled check up to the caller. r=mats
That avoids going all the way to the first continuation to call ResolveBidi on
it. This shaves a bunch of time when there are a lot of pages.

This is more problematic than it seems specially when there's no bidi, because
in the "bidi not enabled" case we never remove the flag, which is bad. When
bidi is actually enabled we usually have done the resolution already.

Differential Revision: https://phabricator.services.mozilla.com/D97358
2020-11-18 03:08:31 +00:00
Emilio Cobos Álvarez
8275e5a5ec Bug 1675376 - Cache consumed BSize in a frame property for non-first continuations. r=mats
This removes virtually all the time under ConsumedBSize. See the comment for
what ensures the correctness of the cache: Basically, we refresh the cache for
a frame continuation every time we reflow it, which means that when next
continuations go look for it it should be up-to-date (we rely on that already
because we're looking at the content rect).

Differential Revision: https://phabricator.services.mozilla.com/D97357
2020-11-18 03:08:13 +00:00
Ting-Yu Lin
558d6cf95c 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
ae2e84888c Bug 1677635 Part 2 - Remove all external users of the obsolete nsOverflowType. r=layout-reviewers,emilio
In the next part, we are going to remove `nsOverflowType` in
OverflowAreas' implementation.

Differential Revision: https://phabricator.services.mozilla.com/D97233
2020-11-17 23:43:33 +00:00
Ting-Yu Lin
03b90b8cfb Bug 1677635 Part 1 - Add an enum class mozilla::OverflowType, and remove NS_FOR_FRAME_OVERFLOW_TYPES. r=layout-reviewers,emilio
The existing nsOverflowType will be removed in the next part.

Also, I change `UnionRectIncludeEmpty` to `UnionRectEdges` in two FIXME
comments because the method is renamed in Bug 641426 Part 5
https://hg.mozilla.org/mozilla-central/rev/90e46b3e8e6f

Differential Revision: https://phabricator.services.mozilla.com/D97232
2020-11-17 23:45:09 +00:00
Ting-Yu Lin
7dfa343264 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
5d700958b5 Bug 1674931 Part 5 - Remove zero-argument ReflowInput::ComputedSizeWithBorderPadding(). r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D95665
2020-11-03 20:07:18 +00:00
Ting-Yu Lin
04bfc9cd34 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
Ting-Yu Lin
aca4ad21ab 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
ca224f13ee 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
0f9141f939 Bug 1669393 - Fix up position of overflow container children in a vertical-rl block once we know the final block size. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D93727
2020-10-28 18:07:22 +00:00
Ting-Yu Lin
b39ea72da3 Bug 1673056 - Remove nsLayoutUtils::MIN_ISIZE and nsLayoutUtils::PREF_ISIZE. r=mats
Both are aliases to IntrinsicISizeType::MinISize and
IntrinsicISizeType::PrefISize.

Remove MOZ_ASSERT in nsLayoutUtils::IntrinsicForAxis and
nsContainerFrame::DoInlineIntrinsicISize since IntrinsicISizeType is a
enum class nowadays, which cannot have other values.

I've compiled this patch with DEBUG_INTRINSIC_WIDTH defined in
nsLayoutUtils.cpp, and fixed aWM undefined in
nsLayoutUtils::MinSizeContributionForAxis().

Differential Revision: https://phabricator.services.mozilla.com/D94618
2020-10-23 22:52:02 +00:00
Mats Palmgren
5d4ae94a48 Bug 1426747 - Remove the IE compat quirk for <table align=left>. r=emilio
Chrome and Safari don't implement this quirk.

Differential Revision: https://phabricator.services.mozilla.com/D94330
2020-10-21 16:31:29 +00:00
Ting-Yu Lin
d61944a521 Bug 499229 - Change NS_WARNING in nsBlockFrame::CheckFloats to NS_ERROR. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D94208
2020-10-21 00:21:44 +00:00
Ting-Yu Lin
9043d0cab7 Bug 1668411 - Change IS_TRUE_OVERFLOW_CONTAINER macro into a nsIFrame's inline method. r=emilio
`IS_TRUE_OVERFLOW_CONTAINER` is defined in nsContainerFrame.h, but is
already used in several places in nsIFrame. It really should be an
nsIFrame's method.

Differential Revision: https://phabricator.services.mozilla.com/D92007
2020-10-01 02:39:40 +00:00
Ting-Yu Lin
de9b07e22e Bug 1668387 - Make nsContainerFrame::StealFrame() return void since it shouldn't fail. r=emilio
The three implementations of StealFrame() -- nsContainerFrame,
nsBlockFrame, and nsInlineFrame -- all have assertions to guarantee
aChild can be found, so the operation shouldn't fail.

This change shouldn't change behavior at all.

Differential Revision: https://phabricator.services.mozilla.com/D91996
2020-09-30 23:38:41 +00:00
Emilio Cobos Álvarez
b78b1ffdbf Bug 1668029 - When resetting background color for high contrast, preserve alpha channel appropriately. r=morgan
But discard it when backplating behind text, so that text is readable.

This should be uncontroversial... Dealing with widgets is a bit harder
so TBD.

Differential Revision: https://phabricator.services.mozilla.com/D91779
2020-09-29 22:04:56 +00:00
Razvan Maries
217842dc9d Backed out changeset f1130dfcdbc4 (bug 1668029) for perma failures on backplate-select-001.html. CLOSED TREE 2020-09-30 00:20:09 +03:00
Emilio Cobos Álvarez
53254aa1e6 Bug 1668029 - When resetting background color for high contrast, preserve alpha channel appropriately. r=morgan
But discard it when backplating behind text, so that text is readable.

This should be uncontroversial... Dealing with widgets is a bit harder
so TBD.

Differential Revision: https://phabricator.services.mozilla.com/D91779
2020-09-29 17:33:55 +00:00
Ting-Yu Lin
9ef3f5d242 Bug 1663822 Part 6 - Convert the anonymous enum controlling ReflowInput's behavior into an EnumSet. r=dholbert
This change shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D89545
2020-09-11 17:59:21 +00:00
Ting-Yu Lin
0d2a9d6e31 Bug 1663822 Part 4 - Add a ComputeSizeFlags parameter to ReflowInput's constructor, and store it in ReflowInput. r=dholbert
Currently, to set ComputeSizeFlags, the caller uses an anonymous enum as
a parameter to ReflowInput constructor to set ReflowInputFlags fields,
and then ReflowInput creates a ComputeSizeFlags from the relevant
ReflowInputFlags fields in Init().

This patch simplifies this flags handover by adding ComputeSizeFlags
parameter to ReflowInput so that the caller can create the flags and
pass it to ReflowInput directly. The can also simplifies the process
needed to add a new ComputeSizeFlag.

We still need to store ComputeSizeFlags in ReflowInput since there's one
caller in `nsBlockFrame::ComputeFinalSize` wanting to checking
`ComputeSizeFlag::BClampMarginBoxMinSize`.

Note 1: ComputeSizeFlags is added only to the ReflowInput's constructor
that also takes parent ReflowInput. The other constructor's existing
callers don't need it.

Note 2: I don't bother adjust the value of DUMMY_PARENT_REFLOW_INPUT,
CALLER_WILL_INIT, and STATIC_POS_IS_CB_ORIGIN because they are going to
be converted into a enum class in a later patch.

This change shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D89543
2020-09-11 18:17:51 +00:00
Narcis Beleuzu
fbf78b38f3 Backed out 3 changesets (bug 1308104) for bustages on nsHttp.cpp . CLOSED TREE
Backed out changeset e78791b93526 (bug 1308104)
Backed out changeset b5c1875c11c7 (bug 1308104)
Backed out changeset 9c8433be706e (bug 1308104)
2020-09-10 22:43:25 +03:00
Nicklas Boman
914bd8a6e3 Bug 1308104 - Replace PL_strchr with a safer Gecko string class or function layout/ r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D89327
2020-09-10 17:38:55 +00:00
Ting-Yu Lin
6b3750fd7c Bug 1641085 Part 6 - Remove GetPropTableFrames() and RemovePropTableFrames() in nsContainerFrame. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D88460
2020-08-29 00:22:43 +00:00
Ting-Yu Lin
c4487abfeb Bug 1641085 Part 5 - Remove SetPropTableFrames() in nsContainerFrame. r=mats
We already use SetProperty() extensively for nsFrameList properties like
OutsideMarkerProperty(), BackdropProperty(), etc, so we can simplify the
interface by removing SetPropTableFrames().

Differential Revision: https://phabricator.services.mozilla.com/D88459
2020-08-29 00:22:41 +00:00
Ting-Yu Lin
cffa4de638 Bug 1641085 Part 3 - Add APIs to manipulate excess overflow containers list. r=mats
This patch is similar to Part 2, but for adding APIs for
ExcessOverflowContainersProperty().

Differential Revision: https://phabricator.services.mozilla.com/D88457
2020-08-29 00:22:31 +00:00
Ting-Yu Lin
25be1557e1 Bug 1641085 Part 2 - Add APIs to manipulate overflow containers list. r=mats
Not all APIs added in this patch are used immediately, but for the sake of
completeness, they are all added.

Their document will be updated in Part 3 after adding the relevant APIs for
ExcessOverflowContainersProperty().

nsContainerFrame::DrainExcessOverflowContainersList() has several calls to set
OverflowContainersProperty() whose life cycle need special attention. We will
deal with them later in Part 4.

Differential Revision: https://phabricator.services.mozilla.com/D88456
2020-08-29 00:22:23 +00:00
Boris Chiou
b712966ccd Bug 1639963 - Apply Automatic content-based minimum sizes for aspect-ratio. r=emilio
Basically, if the overflow is visible and its min-height/min-width is
auto, we have to get the maximal value between the content size and
the size of the ratio-depentent axis.

https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum

Differential Revision: https://phabricator.services.mozilla.com/D78965
2020-08-17 07:02:25 +00:00
Boris Chiou
0b3f881ab4 Bug 1639963 - Fix margin collapsing with aspect-ratio. r=emilio
Basically, we treat aspect-ratio (together with inline size) as a
non-auto block size. This means the block is not empty when using
aspect-ratio.

Also, add 2 tentative wpts for this, based on the current spec issue
examples.

https://github.com/w3c/csswg-drafts/issues/5328

Differential Revision: https://phabricator.services.mozilla.com/D84452
2020-08-17 06:26:19 +00:00
Ting-Yu Lin
496ddb7698 Bug 1559961 Part 4 - Reflow lines with pushed floats under constrained available block-size or in paginated context. r=dholbert
When a clearance frame is discovered in a BFC
subtree (`ReflowInput::WillReflowAgainForClearance()` is true), all the
block descendants of the BFC return from `ReflowBlockFrame` immediately
without placing their children or requesting continuation for their
children, etc., because the BFC is going to reflow the subtree a
second time.

When this happens, any block descendant whose lines contain pushed
floats should be marked dirty and reflowed again so that they can go
through all the split floats logic and set their nsReflowStatus to
incomplete/overflow-incomplete correctly. (We may develop a smarter way
in bug 851629 to make the performance better.)

The condition `aState.mPresContext->IsPaginated()` is added to prevent
1406291-1.html from failing. In 1406291-1.html, the table containing the
float in its subtree is being pushed to the second page due to force
break, and the float is in PushedFloatsList of its parent block. When we
reflow the block again (in the second page), it is reflowed under the
measuring stage of the table layout with unconstrained available
block-size. nsBlockFrame::DrainSelfPushedFloats() deliberately doesn't
drain pushed floats if their placehoder are in the same block, and
expect the floats to be reflowed again. Before this patch, the line can
be marked dirty via HasPushedFloats(), but in this patch,
HasPushedFloats() is moved into the nested if-else, so we need
`aState.mPresContext->IsPaginated()` to let the block know that it's in
a paginated context, and needs to reflow any line that contains pushed
floats.

Differential Revision: https://phabricator.services.mozilla.com/D85480
2020-08-08 01:13:15 +00:00
Ting-Yu Lin
e5adefa64d Bug 1559961 Part 3 - Refactor the conditions to mark a line dirty under constrained available block-size. r=dholbert
This change cleans up the complex logic with additional comments added.
It shouldn't alter the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D86068
2020-08-07 22:16:29 +00:00
Ting-Yu Lin
bd63dbabff Bug 1559961 Part 2 - Consider a line's scrollable overflow when marking a line dirty. r=dholbert
Before this patch, a block frame considers a line dirty only if the line's
block-end is larger than content area's block-end.

However, scrollable overflow area should be broken in paginated environment
(both in a column container and in printing). We should take this into account
when marking a line dirty.

The dynamic wpt reftests are written with the following conditions in mind to
expose the bug:

1. Initially, all the elements fit into the first column.

2. After shrinking the multicol height, the block itself still fits into
the first column, but its tall child (either a simple tall block or a
tall float), which overflows the smaller multicol height, needs to be
broken.

The flexbox printing reftest are similar. A flex container uses
unconstrained available block-size to measure flex items' block-size,
and then performs a final reflow with constrained available block-size,
which is similar to the dynamic scenario above. One caveat is that flex
items usually have IsBResize() set. So to expose this bug, a float
element needs to be deeply nested under a flex item.

Differential Revision: https://phabricator.services.mozilla.com/D85479
2020-08-07 22:16:21 +00:00
Mats Palmgren
f6b107c48e Bug 1531609 part 2 - Implement overflow:clip/visible combinations. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73717
2020-08-01 01:57:41 +00:00