Commit graph

1984 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
cdff7e9fe1 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
a051dd1b28 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
0703486d66 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
9c7552e958 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
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
6c3c98b004 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
05d16fd80b 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
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
a9354a2aef 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
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
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
b0d0dbd24b 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
b5d7c879c0 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
5f553183fe 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
fd7b62c01f 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
2eeff177cf 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
4041fe929c 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
0967845f95 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
396226431d 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
d9e54ec4ae 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
8763701634 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
edcb942efd 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
57fd870466 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
7576762235 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
71a0063df5 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
a69c3e6644 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
9cb3f93c40 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
45b86ae08f 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
38a854f9b9 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
4e7c9bc450 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
40c1643e91 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
34293ad0ff 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
c1ac1fc784 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
910e11aa99 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
Butkovits Atila
cc95b93cba Backed out 3 changesets (bug 1635473, bug 1531609) for reftest failures. CLOSED TREE
Backed out changeset 1e7b32808be8 (bug 1531609)
Backed out changeset e64a61869cdb (bug 1531609)
Backed out changeset 6da37d7f6dd3 (bug 1635473)
2020-07-31 23:56:54 +03:00
Mats Palmgren
c875610606 Bug 1531609 part 2 - Implement overflow:clip/visible combinations. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73717
2020-07-31 15:31:36 +00:00
Ting-Yu Lin
fdc00547f6 Bug 1637130 - Rename visual overflow to ink overflow. r=dbaron
This patch is generated by:

```
# Rename the nsOverflowType enum.
rg -l "eVisualOverflow" layout/ gfx/ | xargs sed -i "s/eVisualOverflow/eInkOverflow/g"

# Rename and drop the "Get" prefix from various functions.
rg -l "GetVisualOverflowRect" layout/ gfx/ | xargs sed -i "s/GetVisualOverflowRect/InkOverflowRect/g"
rg -l "GetPreEffectsVisualOverflowRect" layout/ gfx/ | xargs sed -i "s/GetPreEffectsVisualOverflowRect/PreEffectsInkOverflowRect/g"
rg -l "GetVisualOverflowFromDeltas" layout/ gfx/ | xargs sed -i "s/GetVisualOverflowFromDeltas/InkOverflowFromDeltas/g"
rg -l "GetScrollableOverflowRect" layout/ gfx/ | xargs sed -i "s/GetScrollableOverflowRect/ScrollableOverflowRect/g"

# Rename, drop the "Get" prefix, and change the suffix "Area" to "Rect"
# (because they return nsRect) for the two methods in nsLineBox.
rg -l "GetVisualOverflowArea" layout/ gfx/ | xargs sed -i "s/GetVisualOverflowArea/InkOverflowRect/g"
rg -l "GetScrollableOverflowArea" layout/ gfx/ | xargs sed -i "s/GetScrollableOverflowArea/ScrollableOverflowRect/g"

# Rename rest of the functions and variables.
rg -l "VisualOverflow" layout/ gfx/ | xargs sed -i "s/VisualOverflow/InkOverflow/g"
rg -l "visual overflow" layout/ gfx/ | xargs sed -i "s/visual overflow/ink overflow/g"
rg -l "visualOverflow" layout/ gfx/ | xargs sed -i "s/visualOverflow/inkOverflow/g"
rg -l "visOverflow" layout/ gfx/ | xargs sed -i "s/visOverflow/inkOverflow/g"
rg -l "vis-overflow" layout/ gfx/ python/ | xargs sed -i "s/vis-overflow/ink-overflow/g"

./mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D84231
2020-07-20 20:17:36 +00:00
longsonr
875f5e88ac Bug 1259861 - Move everything else into the mozilla namespace in layout/svg r=dholbert
Also: adjust include paths to be consistent for usages of various SVG headers,
and remove unused SVG includes (mostly for "utils" classes),
and drop stray "ns" from already-renamed SVG classes in various code comments.

Differential Revision: https://phabricator.services.mozilla.com/D83140
2020-07-11 02:20:20 +00:00
Ting-Yu Lin
ffcfb6dcec Bug 1651171 - Convert NS_SUBTREE_DIRTY to an inline method of nsIFrame. r=jfkthame
This is a straightforward conversion except that
`NS_SUBTREE_DIRTY(this)` can be written terser as `IsSubtreeDirty()`.

Differential Revision: https://phabricator.services.mozilla.com/D82811
2020-07-09 18:29:15 +00:00
Ting-Yu Lin
4ecda7f556 Bug 1651202 Part 2 - Minor format tweaks for block frame's frame tree output. r=heycam
Make the following tweak so that they are consistent with others.

* Add a space before the open angle bracket. This is at the end of
`Block(div)(1)@7f10e25de5d0 ... <`

* Tweak nsLineBox format.
`line 7f10e25de808: count=1` becomes `line@7f10e25de808 count=1`.

* Tweak child list format.
`AbsoluteList 0x7f10e3c7e560` becomes `AbsoluteList@7f10e3c7e560`

Differential Revision: https://phabricator.services.mozilla.com/D82603
2020-07-08 05:37:39 +00:00
Ting-Yu Lin
358c2f9ef1 Bug 1651202 Part 1 - Extract nsBlockFrame's printing child lists logic to a helper methods. r=heycam
`ListChildLists` lives in nsContainerFrame because I'm going to use it
to improve nsContainerFrame::List() in a later patch.

Differential Revision: https://phabricator.services.mozilla.com/D82602
2020-07-08 00:59:02 +00:00
Kagami Sascha Rosylight
1afcf4d621 Bug 1630704 - Part 27: Remove nsFrame from inheritance chain r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81864
2020-07-06 22:29:42 +00:00
Simon Giesecke
cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Kagami Sascha Rosylight
21f2b48e01 Bug 1647525 - Use HasAnyStateBits() in remaining layout files r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81230
2020-06-28 01:00:19 +00:00
Kagami Sascha Rosylight
3ae5939e53 Bug 1647525 - Use HasAnyStateBits() in nsBlockFrame.cpp r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81106
2020-06-25 16:12:44 +00:00
Kagami Sascha Rosylight
1eb0cddc4a Bug 1647525 - Use HasAllStateBits in nsBlockFrame.cpp r=emilio
Depends on D81104

Differential Revision: https://phabricator.services.mozilla.com/D81105
2020-06-25 14:48:46 +00:00
Kagami Sascha Rosylight
e5f8c2d951 Bug 1644997 - Make ShouldApplyOverflowClipping as a const member method r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D80572
2020-06-22 23:36:13 +00:00
Ting-Yu Lin
fe7de81c74 Bug 1574046 Part 5 - Prevent BlockReflowInput::ClearFloat from returning nscoord_MAX. r=dbaron
This effectively makes ClearFloat() act like it always has
DONT_CLEAR_PUSHED_FLOATS. Thus, the flag is no longer needed.

We need to add an early return condition when the block cannot fit in
ReflowBlockFrame(). Because we now don't return nscoord_MAX when floats
are pushed or split, the `availSpace.BSize(wm)` might equal to zero
rather than negative in this case. It's needed by
testing/web-platform/tests/css/CSS2/floats-clear/floats-clear-multicol-003.html
and layout/reftests/pagination/float-clear-003-print.html

Differential Revision: https://phabricator.services.mozilla.com/D74540
2020-06-16 18:33:02 +00:00
Ting-Yu Lin
4a29e002c7 Bug 1574046 Part 4 - Use BlockReflowInput::ClearFloatsResult to replace coordinate comparison. r=dbaron
The rules I used when replacing the block-dir coordinates comparison
between the one passing to ClearFloats() and the one returned by
ClearFloats().

- If they are equal, check the ClearFloatsResult is equal to `BCoordNoChange`.
- If they are not equal, check the ClearFloatsResult is not equal to `BCoordNoChange`.

We want to do this conversion because in the next patch, I want to stop
ClearFloats() from returning nscoord_MAX, which is equivalent to
checking `FloatsPushedOrSplit`.

Differential Revision: https://phabricator.services.mozilla.com/D74539
2020-06-03 00:11:13 +00:00