Commit graph

2036 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2d8ab09b73 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
fb9588e175 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
1f6f8d1fee 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
ec22be8442 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
ea243fb10a 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
05cf2bb95e 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
4d98e7e79f 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
66288306a5 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
514930f998 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
c019c6f680 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
556f23b5a4 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
73519d40db 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
a659996a08 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
f7b37252ad 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
a901b05850 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
ed3da455ae 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
906fd4d388 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
01a9895bd6 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
18c31e716e 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
716685da84 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
91b3a53395 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
fec63d1ed4 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
c3ee9188d2 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
8f13019656 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
a5dfdac62f 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
4a2a5b277f 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
252b93c3a9 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
7e74c47006 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
c17b1c2e53 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
82efbb80e1 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
b5686164be 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
a43cae175a Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
This patch adds the struct as a parameter to various functions.

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

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

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

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

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

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

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

Backed out changeset 19cba7d34a7f (bug 1686603)
Backed out changeset 3a0d0155ea5e (bug 1686603)
Backed out changeset f1f672cdd0c6 (bug 1686603)
Backed out changeset 63020922e2fd (bug 1686603)
Backed out changeset 8766ce79ba5e (bug 1686603)
Backed out changeset 965dbe8de1e1 (bug 1686603)
Backed out changeset b1328ee45f43 (bug 1686603)
2021-01-21 09:21:12 +02:00
Ting-Yu Lin
d0c462cb81 Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert
This patch adds the struct as a parameter to various functions.

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

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

Differential Revision: https://phabricator.services.mozilla.com/D101793
2021-01-21 04:17:59 +00:00
Emilio Cobos Álvarez
c2f1413e6b 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
7d7078d54e 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
9fbf3695e7 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
69849dd1cc 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
007568029c 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
42d6c7ccea 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
205d403c70 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
c065c51a1b 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
49aa0d68f1 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
92bd3ac8f5 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
00226db676 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
d570280e88 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
f5c1a59332 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