Commit Graph

2100 Commits

Author SHA1 Message Date
David Shin
fa30ed0b4a Bug 1755565 - Implement contain: inline-size. r=emilio,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D143501
2022-04-19 17:44:16 +00:00
Daniel Holbert
a4f66e95ae Bug 1765209: Add braces to unbraced 'if' expressions in nsBlockFrame.cpp. r=emilio
This patch doesn't change behavior; it just improves coding-style
correctness. Our C++ coding style guide says "Always brace controlled
statements, even a single-line consequent of if else else."
https://firefox-source-docs.mozilla.org/code-quality/coding-style/coding_style_cpp.html#control-structures

Differential Revision: https://phabricator.services.mozilla.com/D143940
2022-04-18 21:14:06 +00:00
Emilio Cobos Álvarez
3b7891d06f Bug 1756826 - Simplify nsBlockFrame abspos cb size code to account for scrollbars correctly. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D139513
2022-02-24 12:29:12 +00:00
Marian-Vasile Laza
5ccc9ed06f Backed out changeset 6739837be6a8 (bug 1756826) for causing build bustages on nsBlockFrame.cpp. CLOSED TREE 2022-02-23 18:48:43 -08:00
Emilio Cobos Álvarez
2112825dbf Bug 1756826 - Simplify nsBlockFrame abspos cb size code to account for scrollbars correctly. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D139513
2022-02-23 23:15:26 +00:00
Ting-Yu Lin
e0d63d37cf Bug 1756008 Part 5 - Manual fix for comments and variables regarding BlockReflowState. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D139440
2022-02-23 21:22:44 +00:00
Ting-Yu Lin
d5aa579d88 Bug 1756008 Part 4 - Replace "BlockReflowInput" with "BlockReflowState". r=layout-reviewers,emilio
This patch is generated via:

```
rg -l 'BlockReflowInput' layout/ | xargs sed -i 's/BlockReflowInput/BlockReflowState/g'
```

Manual fixes are in the next part.

Differential Revision: https://phabricator.services.mozilla.com/D139439
2022-02-23 21:22:43 +00:00
Ting-Yu Lin
830637b4c9 Bug 1756008 Part 3 - Rename nsLineLayout::mBlockReflowInput. r=layout-reviewers,emilio
Its type is not `BlockReflowInput` but an ordinary `ReflowInput`. Rename it to
`mLineContainerRI` to match its accessor.

While I'm here, I change `mLineContainerRI` to be a reference since it cannot be
nullptr (see nsLineLayout's constructor); also, replace
`mLineContainerRI->mFrame` with `LineContainerFrame()`.

Differential Revision: https://phabricator.services.mozilla.com/D139438
2022-02-23 21:22:43 +00:00
Ting-Yu Lin
9db4ab3b6a Bug 1756008 Part 1 - Rename BlockReflowInput.{h,cpp} to BlockReflowState.{h,cpp}, and fix #includes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D139436
2022-02-23 21:22:42 +00:00
Ting-Yu Lin
fc01e38b3f Bug 1754598 Part 2 - Fix block frame's block-size and reflow status in ComputeFinalBSize(). r=dholbert
The code at the end of ComputeFinalBSize() does not handle
"box-decoration-break:clone" and the cases where the block frame's reflow status
can change from incomplete to complete. This patch is an attempt to fix all the
possible scenarios.

Differential Revision: https://phabricator.services.mozilla.com/D138967
2022-02-19 02:15:56 +00:00
Ting-Yu Lin
5d99b84010 Bug 1754598 Part 1 - Pass BlockReflowInput into nsBlockFrame::ComputeFinalBSize(). r=dholbert
ComputeFinalBSize() gets most of its input parameters from BlockReflowInput's
members. Passing BlockReflowInput into it directly so that it can access more
precomputed data in BlockReflowInput such as `ContentBEnd()`.

This is a preparation for the next part that is going to rewrite a large portion
of ComputeFinalBSize().

Differential Revision: https://phabricator.services.mozilla.com/D138966
2022-02-19 02:15:56 +00:00
Ting-Yu Lin
3ba2a84ee6 Bug 1564726 Part 2 - Fix available block-size for block children in block container with box-decoration-break:clone. r=dholbert,emilio
If a block container has box-decoration-break:clone, its block-end border and
padding (BP) are *usually* drawn at the block-end edge of the current
column/page. Thus, when computing the available block-size for its children, we
should subtract its block-end border BP from it.

When I claim the block-end BP are *usually* drawn at the block-end edge of the
column/page, the exception is when a block container with a definite block-size
runs out of its block-size in a column/page. In this case, the block-end BP is
drawn at the block-end edge of its content-box. This patch wires the effective
content-box block-size computed in nsBlockFrame::Reflow() into
BlockReflowInput's constructor, and we do not subtract its block-end border BP
from the `mContentArea.BSize(wm)` when this case happens.

`BlockReflowInput::ContentBSize()` is the correct available block-size to reflow
the children, precomputed in BlockReflowInput's constructor. See
https://searchfox.org/mozilla-central/rev/c12a59323ee46b29b90c9917a3a7a70ea714ffec/layout/generic/BlockReflowInput.cpp#118-126

The remove hunk was a hack, working only for ColumnSetWrapper with
`box-decoration-break:clone`. It's no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D138367
2022-02-12 02:56:17 +00:00
Ting-Yu Lin
7c92bc3804 Bug 1564726 Part 1 - Make BlockReflowInput::ComputeBlockAvailSpace return the result rect. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D138366
2022-02-12 02:56:16 +00:00
Nicklas Boman
e196571381 Bug 1725363 - Replace PL_strcasecmp with nsCRT::strcasecmp layout/ r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D129075
2022-01-26 09:57:46 +00:00
Emilio Cobos Álvarez
aa17f409c6 Bug 1739699 - Use preferred color scheme when forcing colors with system colors (except windows HCM). r=morgan
This causes (among other things) pages to be dark when using regular
windows system colors and forcing colors to "always", which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D131165
2021-11-16 22:30:26 +00:00
Jonathan Kew
be38903007 Bug 1732268 - Remove redundant failure-checks from nsLineIterator initialization, as it uses infallible allocation. r=dholbert
This means nsBlockFrame::GetLineIterator is also infallible, so callers that know
they're dealing with an nsBlockFrame (not an arbitrary nsIFrame) don't need to
check for null.

Differential Revision: https://phabricator.services.mozilla.com/D126470
2021-09-24 14:20:05 +00:00
Emilio Cobos Álvarez
492104511b Bug 1730603 - Blend with ancestor backgrounds until we compute an opaque backplate color. r=morgan
This should ensure the correct behavior when system colors are
semi-transparent, like on macOS on dark mode.

Testing this without hard-coding the system color seems hard (and I
think macOS on automation might not even hard native dark mode support
anyways).

In fact, if it did I think backplat-bg-image-006 would've caught it.

Differential Revision: https://phabricator.services.mozilla.com/D125475
2021-09-13 23:49:55 +00:00
Nicklas Boman
67ab9c6644 Bug 1724526 - Remove uses of PL_strchr in layout code r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D122060
2021-08-18 08:28:49 +00:00
Daniel Holbert
f48b33313c Bug 1672640 part 3: Adjust GetNaturalBaselineBOffset implementations to bail (report no baseline) if the frame has 'contain:layout'. r=TYLin
Some of our GetNaturalBaselineBOffset implementations already have this; others
don't.  But they all should have it, or else a caller might improperly query
their baseline and use it for layout despite the frame having 'contain:layout'.

Without this patch, the rest of this patch-stack makes us fail WPT test
contain-layout-suppress-baseline-002.html because we improperly honor the
baseline for the 'contain:layout' buttons at the top of the test.

Differential Revision: https://phabricator.services.mozilla.com/D121938
2021-08-06 18:46:22 +00:00
Emilio Cobos Álvarez
8e9f64104c Bug 1723938 - Keep looking for background-colors when finding a background-image with transparent background-color. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D121770
2021-08-06 09:52:23 +00:00
Emilio Cobos Álvarez
5fa1a49381 Bug 1721262 - Make sure to reflow the line again if we bail out of reflow due to break-inside: avoid. r=dholbert
The issue is that we mark the second input as dirty when it gets the
reflow request (this is as expected), but then during multicol reflow
everything seems to go smoothly, but we hit this code:

  https://searchfox.org/mozilla-central/rev/00977c4e37865a92f1c15572ae4aea90e934b25b/layout/generic/nsBlockFrame.cpp#3745

And bail out, leaving the line marked as not dirty, and as such the
stuff inside the page-break-inside: avoid dirty.

When it changes further, we think it's already dirty so don't bother
adding it to the dirty root list anymore and the text frame remains with
its original tiny width.

Differential Revision: https://phabricator.services.mozilla.com/D121869
2021-08-05 18:21:55 +00:00
Dorel Luca
9060712988 Backed out changeset db4aa060f966 (bug 1723938) for Reftest failures in layout/reftests/high-contrast/bg-image-div-002.html. CLOSED TREE 2021-08-05 15:36:57 +03:00
Emilio Cobos Álvarez
a14e48ea16 Bug 1723938 - Keep looking for background-colors when finding a background-image with transparent background-color. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D121770
2021-08-05 11:21:29 +00:00
Mats Palmgren
fe7d54a1b4 Bug 1605473 - Implement 'content: none' for ::marker. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D111707
2021-06-23 02:52:42 +00:00
Emilio Cobos Alvarez
360df3429e Bug 1715783 - Use nsCSSRendering::DetermineBackgroundColor in backplate color computation. r=morgan
This is more correct as it takes care about falling back to white as needed in
printing mode.

This is still not perfect because themed frames still get black-on-black text.

I'm not super-sure what's the right way to fix that, will
file a follow-up for that. In particular, when you have a themed
button, we use the system colors (i.e., black) to paint
it, but nsLayoutUtils::DarkenColorIfNeeded doesn't know it
and darkens the text color anyways.

Easiest fix is just not use the system colors when
printing, but that feels not-amazing...

Differential Revision: https://phabricator.services.mozilla.com/D118275
2021-06-22 10:42:26 +00:00
Butkovits Atila
bec38e49b2 Backed out changeset b4e4f16482fe (bug 1715783) for causing failures at backplate-bg-image-006.html. CLOSED TREE 2021-06-22 00:32:21 +03:00
Emilio Cobos Alvarez
a48253a949 Bug 1715783 - Use nsCSSRendering::DetermineBackgroundColor in backplate color computation. r=morgan
This is more correct as it takes care about falling back to white as needed in
printing mode.

This is still not perfect because themed frames still get black-on-black text.

I'm not super-sure what's the right way to fix that, will
file a follow-up for that. In particular, when you have a themed
button, we use the system colors (i.e., black) to paint
it, but nsLayoutUtils::DarkenColorIfNeeded doesn't know it
and darkens the text color anyways.

Easiest fix is just not use the system colors when
printing, but that feels not-amazing...

Differential Revision: https://phabricator.services.mozilla.com/D118275
2021-06-21 19:56:13 +00:00
Emilio Cobos Alvarez
fb26abf708 Bug 1715783 - Do not backplate using a background-color that isn't drawn due to print settings. r=morgan
When printing, we lighten backgrounds and darken colors, unless color-adjust:
exact is used. So with the current backplating logic we might end up using a dark
system color background for a backplate, but then darkening the test, ending up
in both more ink being used, and the text being unreadable.

We don't have a great test story for these but I can try...

Differential Revision: https://phabricator.services.mozilla.com/D117729
2021-06-17 11:15:14 +00:00
Mats Palmgren
9b44303ed1 Bug 1542807 part 1 - Create generated content and use normal box construction for list-style-type/list-style-image ::markers. r=emilio
The change from 0x25FE to 0x25AA for list-style-type:square
was approved here:
https://github.com/w3c/csswg-drafts/issues/6200#issuecomment-828616747

Differential Revision: https://phabricator.services.mozilla.com/D111691
2021-06-14 01:22:04 +00:00
Butkovits Atila
c8f6a1fcf4 Backed out 7 changesets (bug 1542807) for causing failures at inert-retargeting-iframe.tentative.html. CLOSED TREE
Backed out changeset e9ef32fa2f2e (bug 1542807)
Backed out changeset 8fa0cb199975 (bug 1542807)
Backed out changeset 38daf64afe59 (bug 1542807)
Backed out changeset e3aee052c495 (bug 1542807)
Backed out changeset a71056d4c7cc (bug 1542807)
Backed out changeset cf91e7d0a37f (bug 1542807)
Backed out changeset eee949e5fd67 (bug 1542807)
2021-06-12 01:38:25 +03:00
Mats Palmgren
d43697a633 Bug 1542807 part 1 - Create generated content and use normal box construction for list-style-type/list-style-image ::markers. r=emilio
The change from 0x25FE to 0x25AA for list-style-type:square
was approved here:
https://github.com/w3c/csswg-drafts/issues/6200#issuecomment-828616747

Differential Revision: https://phabricator.services.mozilla.com/D111691
2021-06-11 18:10:38 +00:00
Daniel Holbert
ff1fed8bfa Bug 1695509 followup: adjust terminology in code-comment, for consistency. (no review, just minor change to a code-comment)
DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D117390
2021-06-10 04:58:54 +00:00
Daniel Holbert
a36c1deeb0 Bug 1695509: Don't inflate overflow areas with stale positions of pushed floats that we drained but weren't able to place. r=TYLin
Before this patch, there's an edge case where we may drain a pushed float (with
a stale position), and then discover that it won't fit in the current block (so
we push it and leave its position untouched), but we still inadvertently
include its rect in the current block's overflow areas.  This means we're
feeding stale/bogus position into the overflow areas, which can make them
unnecessarily huge.

This patch accounts for this by only considering overflow from floats that we
actually successfully placed, in ReflowPushedFloats.

(Also: this patch removes a stale bit of documentation about aLineLayout being
possibly-null in AddFloat.  In actuality, AddFloat has a fatal assertion that
mandates that this arg is non-null.)

Differential Revision: https://phabricator.services.mozilla.com/D117218
2021-06-09 23:13:08 +00:00
Mats Palmgren
bbdad1b1b0 Bug 1711630 - Honor 'break-inside: avoid' also when 'min-block-size' causes the overflow. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D115604
2021-05-22 22:57:31 +00:00
Ting-Yu Lin
789d5567c3 Bug 1709491 Part 1 - Add SizeComputationInput::ComputedLogicalBorder(), and adapt callers. r=dholbert
The helper is going to be used in a later part.

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

Differential Revision: https://phabricator.services.mozilla.com/D114544
2021-05-12 06:32:40 +00:00
Ting-Yu Lin
51c9a4a70d Bug 1705616 - Fix aspect-ratio's auto content-based min size when the block frame has border and padding. r=boris,emilio
`aState.mBCoord` already includes block-start border and padding, so we
wrongly add the block-start border and padding twice when computing the
border-box content block-size. This patch fixed it, and rename
`contentBSize` variable to make it clearer.

Differential Revision: https://phabricator.services.mozilla.com/D112313
2021-04-16 18:22:07 +00:00
Ting-Yu Lin
c71398b140 Bug 1527949 - Include the block container's block-end padding when computing its overflow area. r=emilio
Per spec, the scrollable overflow area is the union of the box's own
content and padding areas.
https://drafts.csswg.org/css-overflow-3/#scrollable

In this part, we add block container's block-end padding to its
children's block-end edge.

This patch reverts some of the test references modification in
https://hg.mozilla.org/mozilla-central/rev/905ef8691d96dce44120ba562d67754ceac8ff81

Differential Revision: https://phabricator.services.mozilla.com/D108890
2021-03-26 01:06:13 +00:00
Ting-Yu Lin
4e68582229 Bug 1699317 Part 2 - Make ConsiderBlockEndEdgeOfChildren() a nsBlockFrame method. r=emilio
In Bug 1527949, we are going to add block-end padding of the block
container to aBEndEdgeOfChildren, so we need this patch in order to
query GetLogicalUsedPadding().

Differential Revision: https://phabricator.services.mozilla.com/D108889
2021-03-18 04:41:14 +00:00
Ting-Yu Lin
3a499c548b Bug 1699317 Part 1 - Pass ReflowOutput::mOverflowAreas into nsBlockFrame::ComputeOverflowAreas. r=emilio
Also, swap the argument order of aBEndEdgeOfChildren and aDisplay,
because I'm going to make ConsiderBlockEndEdgeOfChildren() a
nsBlockFrame method, and make its arguments the same order.

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D108888
2021-03-18 04:41:14 +00:00
Ting-Yu Lin
7ec15d06cb Bug 1696584 - Make nsBlockFrame::ComputeOverflowAreas return OverflowAreas rather than though outparam. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D107314
2021-03-07 23:07:08 +00:00
Ting-Yu Lin
25a587f0bd Bug 1690701 Part 3 - Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsFloating(). r=emilio
Similar to Part 1, I assume nsIFrame::IsFloating()'s callers really want
to check whether a frame is a real float.

Differential Revision: https://phabricator.services.mozilla.com/D106582
2021-03-04 00:34:04 +00:00
Ting-Yu Lin
aa9bf9391b Bug 1690701 Part 2 - Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsAbsolutelyPositioned(). r=emilio
I assume nsIFrame::IsAbsolutelyPositioned()'s callers really want to
check whether a frame is a real abspos frame, not just check a frame has
a abspos style. This could potentially change the behavior, but I feel
its the right thing to do.

Differential Revision: https://phabricator.services.mozilla.com/D106580
2021-03-04 00:34:03 +00:00
Emilio Cobos Álvarez
5f1f075c1e Bug 1695390 - Move extremum lengths to the individual Size / MaxSize types. r=boris
This will prevent growing them when introducing fit-content(<length>).

This can _almost_ be derived, if it wasn't because of the quirky stuff.
I think the macro is probably good enough for now but let me know if you
disagree.

Differential Revision: https://phabricator.services.mozilla.com/D106713
2021-03-02 12:11:35 +00:00
Brindusan Cristian
73ff4789e9 Backed out changeset be6d9849825d (bug 1695390) for wr failures in col-definite-max-size-001.html. CLOSED TREE 2021-03-02 13:41:40 +02:00
Emilio Cobos Álvarez
d8a9c9c169 Bug 1695390 - Move extremum lengths to the individual Size / MaxSize types. r=boris
This will prevent growing them when introducing fit-content(<length>).

This can _almost_ be derived, if it wasn't because of the quirky stuff.
I think the macro is probably good enough for now but let me know if you
disagree.

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

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

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

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

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

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

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

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

Backed out changeset 19cba7d34a7f (bug 1686603)
Backed out changeset 3a0d0155ea5e (bug 1686603)
Backed out changeset f1f672cdd0c6 (bug 1686603)
Backed out changeset 63020922e2fd (bug 1686603)
Backed out changeset 8766ce79ba5e (bug 1686603)
Backed out changeset 965dbe8de1e1 (bug 1686603)
Backed out changeset b1328ee45f43 (bug 1686603)
2021-01-21 09:21:12 +02:00