Commit Graph

2158 Commits

Author SHA1 Message Date
Ting-Yu Lin
03f14da806 Bug 1794035 Part 1 - Rename nsFrameList::ExtractHead to TakeFramesBefore. r=emilio
I feel it's hard to understand the purpose of ExtractHead(), especially where
aFrame is going after the call. Therefore, I rename it to TakeFramesBefore(),
and have it complement the existing RemoveFramesAfter(), which will be rename
later. No behavioral change intended.

Also, slightly reword the method's documentation to reflect the its new
name. (Remove the "sibling" wording from the comment since it's an
implementation details that frames are actually a doubly linked list.)

Differential Revision: https://phabricator.services.mozilla.com/D158806
2022-10-07 01:41:40 +00:00
Ting-Yu Lin
6656a45e40 Bug 1793826 Part 1 - Change nsFrameList::ExtractHead and ExtractTail to take nsIFrame* argument. r=emilio
This is a preparation to remove nsFrameList::FrameLinkEnumerator in the next
part.

Differential Revision: https://phabricator.services.mozilla.com/D158700
2022-10-06 06:47:25 +00:00
Csoregi Natalia
52af6a2134 Backed out 2 changesets (bug 1793826) for causing build bustages. CLOSED TREE
Backed out changeset 9e398426c46f (bug 1793826)
Backed out changeset 01820845ab62 (bug 1793826)
2022-10-06 03:41:00 +03:00
Ting-Yu Lin
c1ba6068b9 Bug 1793826 Part 1 - Change nsFrameList::ExtractHead and ExtractTail to take nsIFrame* argument. r=emilio
This is a preparation to remove nsFrameList::FrameLinkEnumerator in the next
part.

FrameLinkEnumerator::Find() can be replaced with std::find/std::find_if.

Differential Revision: https://phabricator.services.mozilla.com/D158700
2022-10-06 00:19:41 +00:00
Emily McDonough
68042c67af Bug 1782597 Part 2 - Use null to indicate page value equal to the auto value for CSS named pages r=dholbert
This applies both to the individual mStartPageValue and mEndPageValue fields
of the nsIFrame::PageValues struct, and for the nsIFrame::PageValuesProperty
being null to indicate both mStartPageValue and mEndPageValue are auto.

Fetching this is handled by nsIFrame::GetStartPageValue and
nsIFrame::GetEndPageValue, which also ensure the use of first-in-flow frames.

Differential Revision: https://phabricator.services.mozilla.com/D157873
2022-10-05 22:07:47 +00:00
Ting-Yu Lin
78c77ab5fa Bug 1792134 Part 6 - More rename and clean up related to StyleClear. r=emilio
* Rename `mBreakType` to `mFloatClearType` in nsLineBox and nsReflowStatus and
  the methods around it.
* Rename `mBreakType` to `mClear` in nsStyleDisplay.
* Many other method parameters or local variables rename such as from
  `aBreakType` to `aClearType`.

Differential Revision: https://phabricator.services.mozilla.com/D158276
2022-09-29 03:40:56 +00:00
Ting-Yu Lin
3ce44b3c06 Bug 1792134 Part 3 - Remove StyleClear::Line. r=emilio
Before this patch, StyleClear::Line indicates that the nsLineBox has break-after
but no float clearance (note we don't allow line break-before with clear:none);
StyleClear::None indicates the line has no break-before nor break-after.

In this patch, I added `mHasForcedLineBreak` bit in nsLineBox to indicate the
line has a break so that StyleClear can serve its original meaning -- the float
clearance. In Part 6, I'll rename more existing methods and variables related to
float clearance.

Now, instead of using StyleClear::None to clear the line break status, the
caller should use ClearForcedLineBreak(); Similar to set
SetInlineLineBreakBeforeAndReset() and SetInlineLineBreakAfter on
nsReflowStatus, SetBreakTypeBefore/SetBreakTypeAfter on nsLineBox always sets
break status with an optional float clearance parameter.

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D158224
2022-09-29 03:40:55 +00:00
Ting-Yu Lin
d81a6c0a31 Bug 1792134 Part 2 - Simplify two callsites with nsLineBox::HasBreakBefore. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158222
2022-09-29 03:40:55 +00:00
Ting-Yu Lin
f76b468723 Bug 1792134 Part 1 - Clean up around BR clearance handling. r=emilio
This patch shouldn't change the behavior.

* Rename BlockReflowState's `mFloatBreakType` to `mTrailingClearFromPIF` since
  it's the cached result of `FindTrailingClear()` from the block's prev-in-flow.
  Note that `mTrailingClearFromPIF` can have `StyleClear::Line`, which is
  not a float clear value. We'll remove `StyleClear::Line` in a later part to
  make this 100% correct.
* Rename `nsLayoutUtils::CombineBreakType` to `CombineClearType` as well as its
  arguments.
* Simplify FindTrailingClear()'s implementation.

Differential Revision: https://phabricator.services.mozilla.com/D158221
2022-09-29 03:40:54 +00:00
Ting-Yu Lin
602a614514 Bug 498986 Part 1 - Use nsTArray<nsIFrame*> to store float list in nsLineBox and BlockReflowState. r=emilio
Nowadays, nsFloatCache stores no extra information but `nsIFrame*`, which makes
nsFloatCacheList and nsFloatCacheFreeList are just singly and doubly linked
list of frames, respectively.

Most of this patch is a plain rewrite to use nsTArray APIs. There are two
rewrite that need more explanation.

1. `BlockReflowState::mFloatCacheFreeList` is served as a temporarily list to
   avoid extra allocations of nsFloatCache. It takes the ownership of floats
   from a line via FreeFloats(), and later reuses the cache in AddFloat().
   We don't need this anymore, so we remove it.

2. In `PlaceBelowCurrentLineFloats()`, the old code removes a float which
   needs to be pushed to next continuation from `mBelowCurrentLineFloats`.
   After looking through all of the floats, the remaining of
   `mBelowCurrentLineFloats` are moved to the line because they belong to the
   line. In this patch, rather than removing the pushed floats one by one from
   `mBelowCurrentLineFloats`, I use a new list to collect the floats that need
   to be added to the line, and just clear `mBelowCurrentLineFloats` at the
   end of the method.

Differential Revision: https://phabricator.services.mozilla.com/D157976
2022-09-23 06:42:09 +00:00
Emily McDonough
5464ceedde Bug 1764437 - Check for prev/next sibling when propagating start/end page values for frames r=dholbert
This also properly handles placeholder frames, and ensures that when checking
next/prev sibling we ignore placeholder frames.

To properly test this for multiple levels of page value propagation, we also
need to use FirstInFlow to get page values when checking for breaks in block
frames.

Differential Revision: https://phabricator.services.mozilla.com/D157175
2022-09-20 21:42:34 +00:00
Martin Robinson
d6b19e86ff Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D157306
2022-09-15 20:32:27 +00:00
Norisz Fay
59f059dd2d Backed out changeset c3780baf6f24 (bug 1789255) for causing build bustages CLOSED TREE 2022-09-15 21:14:04 +03:00
Martin Robinson
a7d2990285 Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D157306
2022-09-15 17:56:42 +00:00
Emilio Cobos Álvarez
760d857306 Bug 1790882 - Call ApplyLineClamp even with a definite computed block-size. r=dholbert
The previous implementation of line-clamp was relying on the flex
measuring reflow.

Differential Revision: https://phabricator.services.mozilla.com/D157371
2022-09-15 15:06:14 +00:00
Sandor Molnar
12e1fb9746 Backed out changeset 3a5759eabb42 (bug 1789255) for causing wpt failures in netwerk/protocol/http/Http2Session.cpp CLOSED TREE 2022-09-14 02:01:36 +03:00
Emily McDonough
e248fcfa7a Bug 1779645 Part 1 - Switch CSS named page fragmentation to happen at reflow instead of frame construction r=dholbert
This also adds a small post-processing step for frame-construction to ensure
that replaced frames (or more generally frames with content but no children)
have the auto page-name set on them.

When page-name value tracking is switched to be lazy, this post-processing step
will likely be redundant and can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D152701
2022-09-13 21:29:37 +00:00
Martin Robinson
00e3cff6d7 Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D156473
2022-09-13 20:01:35 +00:00
criss
51143b2b24 Backed out 3 changesets (bug 1786399, bug 1779645) for causing reftest failures on page-name-zero-height-001.html. CLOSED TREE
Backed out changeset 81c8d6a2d6f9 (bug 1786399)
Backed out changeset 3ee5fb016aa0 (bug 1779645)
Backed out changeset b626e11a262d (bug 1779645)
2022-09-13 04:19:42 +03:00
Emily McDonough
e114010ff0 Bug 1779645 Part 1 - Switch CSS named page fragmentation to happen at reflow instead of frame construction r=dholbert
This also adds a small post-processing step for frame-construction to ensure
that replaced frames (or more generally frames with content but no children)
have the auto page-name set on them.

When page-name value tracking is switched to be lazy, this post-processing step
will likely be redundant and can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D152701
2022-09-12 22:44:48 +00:00
Emilio Cobos Álvarez
d9361c3825 Bug 1786147 - Remove layout.css.webkit-line-clamp.enabled, and add a new pref to apply line-clamp to all BFCs. r=dholbert
It's always true, so remove it.

Add another pref to allow -webkit-line-clamp to work on all blocks
rather than just legacy -webkit-boxes, which seems something we should
try to look into, eventually.

Depends on D155181

Differential Revision: https://phabricator.services.mozilla.com/D155182
2022-09-07 23:57:18 +00:00
Emilio Cobos Álvarez
777e2aa014 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
Oriol Brufau
f85f41e4f4 Bug 1788068 - Obey contain-intrinsic-size in single-select list boxes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D155984
2022-08-30 20:23:37 +00:00
Martin Robinson
55b9a9cfe0 Bug 1767262 - Lazily layout content that is hidden via content-visibility: hidden r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D145949
2022-08-29 14:41:36 +00:00
Sandor Molnar
7f2f31094b Backed out changeset f67c8298a104 (bug 1767262) for causing wpt assertion failures in layout/base/PresShell.cpp CLOSED TREE 2022-08-24 20:39:45 +03:00
Martin Robinson
310b1a4bb1 Bug 1767262 - Lazily layout content that is hidden via content-visibility: hidden r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D145949
2022-08-24 13:30:55 +00:00
Nathan LaPre
ca16d83e39 Bug 1776928 - avoid backplating text that is entirely whitespace in HCM, r=morgan
Some sites use text content that consists entirely of whitespace, which can
lead to unexpected rendering in High Contrast Mode - namely, backplating of
invisible characters. This commit adds logic that detects text nodes consisting
entirely of whitespace and reports their text area as 0. This commit also adds
a test for the behavior, and modifies an existing test to reflect the new
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D155248
2022-08-23 19:41:59 +00:00
Butkovits Atila
22dc8215a9 Backed out changeset 5a4a5749f8dc (bug 1767262) for causing wpt failures. 2022-08-23 18:33:04 +03:00
Martin Robinson
435040acc6 Bug 1767262 - Lazily layout content that is hidden via content-visibility: hidden r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D145949
2022-08-23 14:16:10 +00:00
Ting-Yu Lin
c604e86515 Bug 1441048 Part 2 - Use NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR to detect block-fragmented context when marking a line dirty. r=emilio
We can move a float frame into its block parent's PushedFloatsList during column
balancing when it cannot fit in the available block-size.

Later, when the column balancing algorithm reflows the last column in an
unconstrained block-size (in the very last reflow if needed [1]), we have to
reflow the line which contains the float's placeholder. The old code uses
`GetPrevInFlow() || GetNextInFlow()` to detect this scenario, which is
insufficient because the float's block parent might not have any continuation.
This patch uses `NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR` bit to detect this instead.

[1] https://searchfox.org/mozilla-central/rev/5c04fc7016eb7f52cf835d482f1125c8f139c959/layout/generic/nsColumnSetFrame.cpp#1144-1154

Differential Revision: https://phabricator.services.mozilla.com/D154860
2022-08-17 17:18:00 +00:00
Butkovits Atila
7925e56c67 Backed out changeset 7538d23ee88e (bug 1767262) for causing failures at content-visibility-081.html. CLOSED TREE 2022-08-15 20:37:49 +03:00
Martin Robinson
1b3e552693 Bug 1767262 - Lazily layout content that is hidden via content-visibility: hidden r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D145949
2022-08-15 16:18:43 +00:00
Ting-Yu Lin
06ddbd2b65 Bug 1464761 Part 4 - Remove nsReflowStatus::mTruncated bit. r=dholbert
In the description of the mTruncated bit, its purpose is the same as calling
SetInlineLineBreakBeforeAndReset(). We've removed all its usages in previous
patches, so the bit is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D151461
2022-07-27 21:55:18 +00:00
Ting-Yu Lin
7c8f078be7 Bug 1778931 Part 3 - Tweak floatRI's mIsTopOfPage bit in FlowAndPlaceFloat(). r=dholbert
The old code tweaks mIsTopOfPage in ReflowFloat(). However
`aAvailableSize.ISize()` (in containing block's writing-mode) always equals to
ContentISize() because it is computed via ComputeAvailableSizeForFloat().
Therefore, the only reason the floatRI's mIsTopOfPage can be `false` is when
some floats are already being placed, and we only check this in the
`!earlyFloatReflow` branch.

By tweaking mIsTopOfPage bit in FlowAndPlaceFloat(), we can also remove two
unused parameters in ReflowFloat().

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151457
2022-07-26 04:54:37 +00:00
Ting-Yu Lin
ec5a3f5850 Bug 1778931 Part 2 - Revise two if branches checking float's reflow status. r=dholbert
The if-branch is incorrect because ShouldAvoidBreakInside() [1] is called via
the parent block instance with float child's ReflowInput as the argument. In
principle, the child frame should report break-before status if it cannot fit
the page/column and wants to avoid breaking. Removing this if-branch is
potentially a behavior change, but it is the correct thing to do. (Note that
ReflowFloat()'s caller FlowAndPlaceFloat() already handles
IsInlineBreakBefore(). If the float frame type already implements break-avoid,
we are fine.)

The else-if branch can never be reached except when the float is a letter frame,
and we've tested that scenario a few lines just before the this added assertion.
The code coverage also shows this branch in never reached.
https://coverage.moz.tools/#revision=e6e2286d2ac25001127a1cf54a87a95fb435c734&path=layout%2Fgeneric%2FnsBlockFrame.cpp&view=file&line=6682

[1] Note: ShouldAvoidBreakInside() is a protected member function, which can
only be called for concrete frame classes inheriting from nsContainerFrame.

Differential Revision: https://phabricator.services.mozilla.com/D151456
2022-07-26 04:54:37 +00:00
Ting-Yu Lin
86b181ef13 Bug 1778931 Part 1 - Create a float's ReflowInput in FlowAndPlaceFloat() and pass it into ReflowFloat(). r=dholbert
There is some advantage to creating the float's ReflowInput in
FlowAndPlaceFloat().

1. ReflowFloat() doesn't need to output the float's margin and offset via the
   output arguments. FlowAndPlaceFloat() can get them from the local ReflowInput
   directly.

2. Since we are going to reflow the float, we have to create a ReflowInput
   anyway. FloatMarginISize() can take the ReflowInput and be simplified. No need
   to waste time to create a separate SizeComputationInput.

Also, delete the comment "Pass floatRS so the frame hierarchy can be
used (redoFloatRS has the same hierarchy)" because I believe it is obsolete.

This patch also lays the foundation for other improvements in the later patches.

Differential Revision: https://phabricator.services.mozilla.com/D151455
2022-07-26 04:54:36 +00:00
Oriol Brufau
28baac1494 Bug 1781097 - Obey contain-intrinsic-size in block containers. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D152666
2022-07-25 16:40:07 +00:00
Ting-Yu Lin
96290d8f52 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
8bea68a2bc 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
9b273b89f7 Bug 1323517 Part 7 - Fix the placement of an orthogonal float with an auto block-size. r=jfkthame
The old code in AddFloat() used to call nsBlockFrame::ComputeFloatISize() to
compute a float's inline-size, compare it with current line's available
inline-size, and determine whether FlowAndPlaceFloat() should be called.
However, it doesn't handle an orthogonal float with an auto block-size.

Luckily, FlowAndPlaceFloat() already has logic dealing with orthogonal
floats (bug 1141867), so this patch defers the decision to place a float below
the current line until the float's margin inline-size is computed in
FlowAndPlaceFloat().

Differential Revision: https://phabricator.services.mozilla.com/D151209
2022-07-07 19:01:56 +00:00
Ting-Yu Lin
ca47f69ffd Bug 1323517 Part 6 - Change FlowAndPlaceFloat()'s return value to a tri-state enum. r=jfkthame
This patch is a preparation for the next part, and doesn't change the behavior
yet.

FlowAndPlaceFloat() is used to return true and false. This patch changes its
return value `true` to `PlaceFloatResult::Placed` and `false` to
`PlaceFloatResult::ShouldPlaceInNextContinuation`.

In the next part, we'll move the logic dealing with "below the current line
floats" into FlowAndPlaceFloat(), and make it return
`PlaceFloatResult::ShouldPlaceBelowCurrentLine`.

Differential Revision: https://phabricator.services.mozilla.com/D151208
2022-07-07 19:01:56 +00:00
Ting-Yu Lin
2dbfe793c8 Bug 1323517 Part 5 - Improve the available size computation for reflowing a float. r=jfkthame
First of all, `nsBlockFrame::AdjustFloatAvailableSpace()` is misleading. It
doesn't adjust the argument `aFloatAvailableSpace` at all, nor does it use any
fields in nsBlockFrame. It simply returns the available space in the parent
block's content area. Thus, I move it into BlockReflowState, and have it return
the available size rather than a rect because a size is sufficient for reflowing
a float.

Also, nsBlockFrame::ReflowFloat() only cares about the available size, but not
the position of the available space, so it is sufficient to pass a LogicalSize
computed by the new method ComputeAvailableSizeForFloat().

In FlowAndPlaceFloat(), there is a loop searching for a wide enough band to
place the float. We don't need to adjust availSize every time mBCoord is changed
in the loop. We can just call ComputeAvailableSizeForFloat() to get a new
available size before reflowing the float in the `!earlyFloatReflow` branch.

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151207
2022-07-07 19:01:56 +00:00
Ting-Yu Lin
a8694362c7 Bug 1323517 Part 4 - Pass a dummy rect into ReflowBlock() when reflowing a float. r=jfkthame
This is a preparation for the next part.

Differential Revision: https://phabricator.services.mozilla.com/D151206
2022-07-07 19:01:55 +00:00
Ting-Yu Lin
943ce7a0a9 Bug 1323517 Part 2 - Remove float debug log that requires manual #define. r=jfkthame
These are small printf statements that are not build by CI, which increase
maintenance burden.

Differential Revision: https://phabricator.services.mozilla.com/D151204
2022-07-07 19:01:54 +00:00
Ting-Yu Lin
1616732643 Bug 1323517 Part 1 - Remove a duplicate assertion, and assert a fresh reflow status in ReflowFloat(). r=jfkthame
In FlowAndPlaceFloat(), condense two identical assertions about float frame
parent into one.

FlowAndPlaceFloat() calls ReflowFloat() only once, either an early reflow (when
`earlyFloatReflow` is `true`) or a late reflow (when `earlyFloatReflow` is
`false`), so the reflow status is always fresh.

Differential Revision: https://phabricator.services.mozilla.com/D151203
2022-07-07 19:01:54 +00:00
Ting-Yu Lin
2d4bcecd2c 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
Ting-Yu Lin
c4196fa05f Bug 1777627 Part 2 - Remove aIsAdjacentWithBStart argument on nsBlockReflowContext::ReflowBlock(). r=emilio
aIsAdjacentWithBStart is used to clear the mIsTopOfPage bit for the ReflowInput
argument `aFrameRI`. However, ReflowBlock() already has aState argument to query
IsAdjacentWithBStart(), so there's no need for aIsAdjacentWithBStart argument.

Differential Revision: https://phabricator.services.mozilla.com/D150832
2022-07-05 23:43:52 +00:00
Ting-Yu Lin
1bf987f785 Bug 1777627 Part 1 - Improve BlockReflowState::IsAdjacentWithTop(). r=emilio
I rename and add a comment to the helper, and rewrite it to make it closer to
what the comment describes. The behavior is the same because `mBCoord` and
`mContentArea.BStart(wm)` are both initialized as `mBorderPadding.BStart(wm)`
[1].

Note `isAdjacentWithTop` local variable in ReflowFloat() is not changed because
it's going to be removed in the next patch.

[1] https://searchfox.org/mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b/layout/generic/BlockReflowState.cpp#142

Differential Revision: https://phabricator.services.mozilla.com/D150831
2022-07-05 23:43:51 +00:00
Ting-Yu Lin
b4f3e5a6f9 Bug 847368 - Reset floating first letter's reflow status before checking break-inside:avoid. r=emilio
As the comment in the moved hunk said, a floating first letter frame's
incomplete status means that there is more content to be reflowed on the line.
If the block containing the floating first letter has `break-inside:avoid`
style, the old code would call `SetInlineLineBreakBeforeAndReset()`, and the
block's parent frame would misinterpret the status as "this block needs to be
push to the next fragment" even if we are *not* in a paginated environment.
Hence the assertion "Shouldn't be incomplete if availableBSize is
UNCONSTRAINED."

To fix this bug, we can reset the float's reflow status for a first letter frame
before checking `ShouldAvoidBreakInside`.

Differential Revision: https://phabricator.services.mozilla.com/D149712
2022-06-20 23:04:50 +00:00
Daniel Holbert
8598c8b0fd Bug 1774879 part 3: Add 'const' to local var ComputedStyle pointers that we pass to DetermineBackgroundColor and IsTransparent (which now accept const). r=emilio
This patch does not affect behavior; it's just a const-correctness fix.

Differential Revision: https://phabricator.services.mozilla.com/D149676
2022-06-18 00:45:20 +00:00