Commit graph

14214 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
fa760a8139 Bug 1789191 - Add CSSContainerRule.queryContainerFor(Element). r=nchevobbe,dshin
This actually caught a bug in the existing selection logic.

Differential Revision: https://phabricator.services.mozilla.com/D156414
2022-09-10 12:25:22 +00:00
Sandor Molnar
e9d20af17e Backed out changeset 0552fd39333b (bug 1789191) for causing mochitest failures in layout/style/test/test_revert.html CLOSED TREE 2022-09-10 07:11:24 +03:00
Emilio Cobos Álvarez
841481eb39 Bug 1789191 - Add CSSContainerRule.queryContainerFor(Element). r=nchevobbe,dshin
This actually caught a bug in the existing selection logic.

Differential Revision: https://phabricator.services.mozilla.com/D156414
2022-09-10 02:37:44 +00:00
Sandor Molnar
371ce48f03 Backed out changeset 56c223bba6d6 (bug 1789191) for causing mochitest failures in layout/style/test/test_transitions_per_property.html CLOSED TREE 2022-09-09 23:42:13 +03:00
Emilio Cobos Álvarez
1ddadd5577 Bug 1789191 - Add CSSContainerRule.queryContainerFor(Element). r=nchevobbe,dshin
This actually caught a bug in the existing selection logic.

Differential Revision: https://phabricator.services.mozilla.com/D156414
2022-09-09 19:34:55 +00:00
Emilio Cobos Álvarez
3d0057e92d Bug 1789712 - Allow backplating if there's a background-image which is none. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D156756
2022-09-08 11:57:15 +00:00
Emilio Cobos Álvarez
b5c2fd645c Bug 1789123 - Make anonymous box wrapping inside XUL boxes be similar to modern flex boxes. r=dholbert
I haven't spotted any UI regression from this, and this should generally
make the XUL -> modern flex transition easier, and simplify some
of the relevant code.

This does fix a few layout issues with emulated flexbox.

For the most part, this shouldn't change behavior without that. This
changes behavior if you have mixed inline/non-inline content in the same
XUL box (before they'd get a single item, now you'd get the flexbox /
grid behavior of one item per inline run), and multiple inline-elements
(which would become their own flex items). But I pushed a patch with
some asserts and they didn't fire on our browser mochitests, so I think
we're good.

The UA rule refactoring (removing the inherit from xul anon blocks)
shouldn't matter in practice, since we only have one item (so
box-ordinal is irrelevant) and they have overflow: visible (so
text-overflow and overflow-clip-box shouldn't have an effect).

Differential Revision: https://phabricator.services.mozilla.com/D156375
2022-09-08 11:51:15 +00:00
Emilio Cobos Álvarez
a11c622dc7 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
3c206e563a 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
Emilio Cobos Álvarez
c8f967f6ac Bug 1789248 - Remove @supports selector pref. r=firefox-style-system-reviewers,layout-reviewers,boris
We've shipped it for a while.

Differential Revision: https://phabricator.services.mozilla.com/D156469
2022-09-06 17:03:20 +00:00
Emilio Cobos Álvarez
3373b12663 Bug 1789248 - Disallow forgiving selector-parsing in @supports. r=firefox-style-system-reviewers,layout-reviewers,boris
As per spec, see https://github.com/w3c/csswg-drafts/issues/7280

Differential Revision: https://phabricator.services.mozilla.com/D156468
2022-09-06 17:00:33 +00:00
Frederic Wang
39dd537031 Bug 1588733 - Make maction/semantics elements behave as an mrow with the first child. r=emilio
See https://groups.google.com/forum/#!topic/mozilla.dev.platform/BWUvjERSXUM

Differential Revision: https://phabricator.services.mozilla.com/D49285
2022-09-06 04:32:15 +00:00
Frederic Wang
e5e1ea3245 Bug 1788645: Do not reset font-weight/font-style when mathvariant is specified. r=emilio
In the past, mathvariant was cancelling the effect of legacy
fontstyle/fontweight attributes by resetting the font-style/font-weight
properties. These legacy attributes have been removed in bug 1783841,
so remove this hack from Stylo and add corresponding WPT test.

Differential Revision: https://phabricator.services.mozilla.com/D156174
2022-09-03 07:09:44 +00:00
Emilio Cobos Álvarez
3b00b2f6db Bug 1786147 - Fix typo to avoid devtools property-db failures.
MANUAL PUSH: Orange fix CLOSED TREE
2022-08-31 15:43:26 +02:00
Emilio Cobos Álvarez
83c7733c7c Bug 1786147 - Move line-clamp out of mako and do some adjacent clean-up. r=boris
No behavior change, but simplifies the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D155180
2022-08-31 12:39:19 +00:00
Jonathan Kew
6187a4d845 Bug 1788036 - Update font-tech feature-* keywords to features-*, as per editorial fix in the spec. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D155962
2022-08-30 14:29:42 +00:00
Frederic Wang
e65e52a1da Bug 1187682 - Use ScriptPercentScaleDown and ScriptScriptPercentScaleDown constants. r=emilio
The math-depth implementation is refined to take into account the
ScriptPercentScaleDown and ScriptScriptPercentScaleDown constants (if the
parent's first valid font has a MATH table) in order to calculate the
scale factor between math-deth 0 and 1, and between 0 and 2 respectively.

Behavior is unchanged if the legacy scriptsizemultiplier attribute is
specified or if no MATH table is available.

The preference layout.css.math-depth.enabled remains disabled in nightly
until the remaining bit (support for font-size: math) is implemented in
bug 1667090.

Differential Revision: https://phabricator.services.mozilla.com/D91604
2022-08-30 10:16:33 +00:00
Connor Pearson
a6f8d9c1af Bug 1565111 Improve serialization of the outline shorthand. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D155569
2022-08-26 19:30:40 +00:00
AW255
4d7b018d55 Bug 1573830 - 0% values are not skipped when parsing CSS transform. r=emilio
Adds trait ZeroNoPercent to check for values that are 0 (such as 0px) but not 0%

Updated test css/css-transforms/animation/translate-interpolation.html and removed unnecessary formatting changes

Differential Revision: https://phabricator.services.mozilla.com/D154930
2022-08-26 11:11:30 +00:00
Emilio Cobos Álvarez
44438f746a Bug 1787173 - Improve CSS OM for CSSContainerRule. r=nchevobbe
This implements https://github.com/w3c/csswg-drafts/pull/7293, pending a
spec resolution, so landing test as tentative for now, but the change
makes sense.

Differential Revision: https://phabricator.services.mozilla.com/D155602
2022-08-26 10:31:38 +00:00
Jonathan Kew
5bcdc7cf69 Bug 1786493 - Implement CSS @supports font-format(...) and font-tech(...) functions. r=emilio
These are gated by the same layout.css.font-tech.enabled pref as the
closely-related `tech()` function for the @font-face src descriptor;
once the spec questions are settled, we should enable them all together.

Differential Revision: https://phabricator.services.mozilla.com/D155359
2022-08-25 12:19:21 +00:00
Marian-Vasile Laza
07de1f7c1b Backed out 2 changesets (bug 1786493) for causing build bustages. CLOSED TREE
Backed out changeset 077219c44704 (bug 1786493)
Backed out changeset b1b0464f9bed (bug 1786493)
2022-08-25 14:26:59 +03:00
Jonathan Kew
4642b812a4 Bug 1786493 - Implement CSS @supports font-format(...) and font-tech(...) functions. r=emilio
These are gated by the same layout.css.font-tech.enabled pref as the
closely-related `tech()` function for the @font-face src descriptor;
once the spec questions are settled, we should enable them all together.

Differential Revision: https://phabricator.services.mozilla.com/D155359
2022-08-25 11:09:10 +00:00
Jonathan Kew
9a9e4251de Bug 1786804 - Put the @font-face src tech() function behind a pref, enabled only on Nightly for now. r=emilio
There are a couple of current issues/discussions that may lead to a change in the set of supported keywords, so we may want to hold back a little on actually shipping this.

- In https://github.com/w3c/IFT/pull/113, the WebFonts WG proposes several new incremental-* keywords (and maybe implies dropping the currently-defined incremental?)

- In https://github.com/w3c/csswg-drafts/issues/7633, I just proposed renaming the feature-* keywords to features-* (plural) for better readability; I'd like to see a decision on that before we ship this to release.

Differential Revision: https://phabricator.services.mozilla.com/D155458
2022-08-24 11:27:42 +00:00
Boris Chiou
3897893bd1 Bug 1694741 - Part 6: Map width/height attributes to the style of img elements. r=emilio
This patch will use the width/height attributes from <source> to override
width/height/aspect-ratio CSS property values of <img> elements.

So basically, we need to introduce an extra nsMappedAttribtue member in
HTMLSourceElement (and it only stores width and height attributes).
And then we use it as an extra declarations (which are generated by
Gecko_GetExtraContentStyleDeclarations()) so we can override the
declarations created from presentation attributes of <img>.

Besides, we need to make sure <img> elements get restyled in the
following cases:
1. width/height attributes is changed in <source> elements
2. <source> is inserted as a <picture>'s child
3. <source> is removed from the child list of <picture>
4. <img> is inserted as a <picture>'s child
5. <img> is removed from the child list of <picture>

We make the responsive source synchronously get updated in the previous patch,
so now we can just restyle the image when updating its responsive source.

Note: We fix the reflection of percentages for width/height attributes in
the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D152586
2022-08-22 20:18:39 +00:00
Connor Pearson
781d2bbaca Bug 1134171 - When serializing background shorthand skip initial values and order values according to grammar. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D155077
2022-08-21 22:13:04 +00:00
Emilio Cobos Álvarez
6d0f2b63a9 Bug 1682444 - Add basic support for nan / infinity in calc(). r=boris
Fix some tests to:

 * Not assume `double` precision.
 * Account for recent working group resolution with regards to NaN: https://github.com/w3c/csswg-drafts/issues/7067#issuecomment-1111211295

Not sure I caught all, but normalizing to 0 was already our existing
behavior. This feature needs more work before it can be enabled more
generally, so make it nightly-only, for now.

Also, it's unclear per spec what the serialization for infinity*1s or so
should be. Right now we serialize to <very-big-number>s, which seems
reasonable, but some tests (but not others!) expect different behavior.

I left those untouched for now.

Differential Revision: https://phabricator.services.mozilla.com/D154883
2022-08-18 08:54:30 +00:00
Emilio Cobos Álvarez
9cb731ca93 Bug 1774589 - Implement atan2(), and enable calc() trigonometric functions by default on nightly. r=boris
We now have test coverage, so let's do this.

The remaining failures are just about infinity/nan, which is a
completely different feature.

Differential Revision: https://phabricator.services.mozilla.com/D154831
2022-08-18 08:49:30 +00:00
Marian-Vasile Laza
77fe747849 Backed out 5 changesets (bug 1682444, bug 1774589) for causing wpt failures on acos-asin-atan-atan2-serialize.html. CLOSED TREE
Backed out changeset 1d850765046a (bug 1774589)
Backed out changeset 08ec785b9923 (bug 1682444)
Backed out changeset bf0c0ff13cc1 (bug 1682444)
Backed out changeset bcf5fcb47b4a (bug 1774589)
Backed out changeset 03b2061c924b (bug 1774589)
2022-08-18 04:28:11 +03:00
Emilio Cobos Álvarez
5e73feeb12 Bug 1682444 - Add basic support for nan / infinity in calc(). r=boris
Fix some tests to:

 * Not assume `double` precision.
 * Account for recent working group resolution with regards to NaN: https://github.com/w3c/csswg-drafts/issues/7067#issuecomment-1111211295

Not sure I caught all, but normalizing to 0 was already our existing
behavior. This feature needs more work before it can be enabled more
generally, so make it nightly-only, for now.

Also, it's unclear per spec what the serialization for infinity*1s or so
should be. Right now we serialize to <very-big-number>s, which seems
reasonable, but some tests (but not others!) expect different behavior.

I left those untouched for now.

Differential Revision: https://phabricator.services.mozilla.com/D154883
2022-08-17 21:12:08 +00:00
Emilio Cobos Álvarez
3372ba4c5d Bug 1774589 - Implement atan2(), and enable calc() trigonometric functions by default on nightly. r=boris
We now have test coverage, so let's do this.

The remaining failures are just about infinity/nan, which is a
completely different feature.

Differential Revision: https://phabricator.services.mozilla.com/D154831
2022-08-17 20:56:38 +00:00
Emilio Cobos Álvarez
a7401488af Bug 1784265 - Drop support for flex attribute values other than 0 and 1. r=dholbert,mconley,preferences-reviewers
This makes it easier to get parity between legacy and regular flex
without having to either have tons of arbitrary attribute selectors in
the xul sheet, nor adding attribute lookup hacks to the html flexbox
layout.

Also, reimplement the remaining supported flex attribute-values (0 and 1)
purely in terms of CSS rules in xul.css (regardless of whether
emulate-moz-box-with-flex is enabled).

In practice these are pretty uncommon and the style attribute does the
trick in every case I've tried.

Add a debug-only assertion to ensure we preserve behavior for now.

Add a new test with another behavior difference between flexbox
emulation and old xul layout because the old reftest now passes. Use
replaced elements, which in modern flex are treated differently.

Differential Revision: https://phabricator.services.mozilla.com/D154394
2022-08-12 23:13:41 +00:00
Jonathan Kew
70dfa83f89 Bug 1715546 - Add support for the @font-face src descriptor's tech() function. r=emilio
WPT tests to be added in a following patch.

Differential Revision: https://phabricator.services.mozilla.com/D154399
2022-08-12 22:17:24 +00:00
Marian-Vasile Laza
7f5e2711c6 Backed out 3 changesets (bug 1784265) for causing reftest failures on flex-emulation-1.xhtml. CLOSED TREE
Backed out changeset 415da4b53bdd (bug 1784265)
Backed out changeset e27b21c54b1f (bug 1784265)
Backed out changeset fcb1a053fbe2 (bug 1784265)
2022-08-13 01:14:13 +03:00
Emilio Cobos Álvarez
a2ec6564f3 Bug 1784265 - Drop support for flex attribute values other than 0 and 1. r=dholbert,mconley,preferences-reviewers
This makes it easier to get parity between legacy and regular flex
without having to either have tons of arbitrary attribute selectors in
the xul sheet, nor adding attribute lookup hacks to the html flexbox
layout.

Also, reimplement the remaining supported flex attribute-values (0 and 1)
purely in terms of CSS rules in xul.css (regardless of whether
emulate-moz-box-with-flex is enabled).

In practice these are pretty uncommon and the style attribute does the
trick in every case I've tried.

Add a debug-only assertion to ensure we preserve behavior for now.

Add a new test with another behavior difference between flexbox
emulation and old xul layout because the old reftest now passes. Use
replaced elements, which in modern flex are treated differently.

Differential Revision: https://phabricator.services.mozilla.com/D154394
2022-08-12 19:34:34 +00:00
Jonathan Kew
99b0686d3d Bug 650372 - Use the style-system format hint directly in gfx, instead of mapping to a separate internal enum. r=gfx-reviewers,aosmond,lsalzman
Now that the style system has keywords for this, we don't need to define them in gfx
but can just use the enum directly. (No functional change, just code simplification.)

Depends on D154237

Differential Revision: https://phabricator.services.mozilla.com/D154238
2022-08-12 11:25:59 +00:00
Jonathan Kew
dfd2d5cda8 Bug 650372 - Accept keywords in addition to strings in the @font-face format() hint function. r=emilio
The CSS Fonts 4 spec requires this, and Safari (at least) has long supported it.

Depends on D154277

Differential Revision: https://phabricator.services.mozilla.com/D154237
2022-08-12 11:25:59 +00:00
Jonathan Kew
c435f5c7ab Bug 1784058 - Do not allow a list of strings in the @font-face src descriptor's format() function, only a single format string. r=emilio
This aligns with CSS Fonts 4 (rather than Fonts 3) and with behavior in other browsers;
I don't expect any significant breakage, given that specifying multiple format strings
was never supported in other engines AFAIK, and never served any useful purpose.

Depends on D154234

Differential Revision: https://phabricator.services.mozilla.com/D154235
2022-08-12 11:25:58 +00:00
Emilio Cobos Álvarez
ff538cab0e Bug 1784349 - Don't use -moz-bool-pref for flexbox -moz-box emulation. r=dholbert,perftest-reviewers,sparky
Use a bool pref media query which allows dynamic changes to get
reflected instantly.

Differential Revision: https://phabricator.services.mozilla.com/D154449
2022-08-11 23:22:52 +00:00
Iulian Moraru
6794af9029 Backed out 7 changesets (bug 1784058, bug 650372) for causing wpt failures on format-specifiers-variations.html. CLOSED TREE
Backed out changeset 2aa97ebc8593 (bug 650372)
Backed out changeset 41d1c62f11ac (bug 650372)
Backed out changeset 8340c08ff8b6 (bug 650372)
Backed out changeset cbe59d9bbcbb (bug 1784058)
Backed out changeset 40b00a214019 (bug 1784058)
Backed out changeset 714d84a2680a (bug 1784058)
Backed out changeset e5b24489d365 (bug 1784058)
2022-08-11 23:24:20 +03:00
Jonathan Kew
13890ac701 Bug 650372 - Use the style-system format hint directly in gfx, instead of mapping to a separate internal enum. r=gfx-reviewers,aosmond,lsalzman
Now that the style system has keywords for this, we don't need to define them in gfx
but can just use the enum directly. (No functional change, just code simplification.)

Depends on D154237

Differential Revision: https://phabricator.services.mozilla.com/D154238
2022-08-11 18:03:58 +00:00
Jonathan Kew
1ce43d55b7 Bug 650372 - Accept keywords in addition to strings in the @font-face format() hint function. r=emilio
The CSS Fonts 4 spec requires this, and Safari (at least) has long supported it.

Depends on D154277

Differential Revision: https://phabricator.services.mozilla.com/D154237
2022-08-11 18:03:58 +00:00
Jonathan Kew
08f7295a51 Bug 1784058 - Do not allow a list of strings in the @font-face src descriptor's format() function, only a single format string. r=emilio
This aligns with CSS Fonts 4 (rather than Fonts 3) and with behavior in other browsers;
I don't expect any significant breakage, given that specifying multiple format strings
was never supported in other engines AFAIK, and never served any useful purpose.

Depends on D154234

Differential Revision: https://phabricator.services.mozilla.com/D154235
2022-08-11 18:03:56 +00:00
Cristian Tuns
f124fa4b1e Backed out 7 changesets (bug 650372, bug 1784058) for causing reftest failures on variation-format-hint-1a.html CLOSED TREE
Backed out changeset c78a59ace7ec (bug 650372)
Backed out changeset eea47293ce56 (bug 650372)
Backed out changeset e978496c7ea0 (bug 650372)
Backed out changeset 597837e9753f (bug 1784058)
Backed out changeset 6d71bcfcc1a1 (bug 1784058)
Backed out changeset 5d21f6e4f8e0 (bug 1784058)
Backed out changeset 35634f66cb37 (bug 1784058)
2022-08-11 10:28:40 -04:00
Jonathan Kew
7e6bfba42c Bug 650372 - Use the style-system format hint directly in gfx, instead of mapping to a separate internal enum. r=gfx-reviewers,aosmond,lsalzman
Now that the style system has keywords for this, we don't need to define them in gfx
but can just use the enum directly. (No functional change, just code simplification.)

Differential Revision: https://phabricator.services.mozilla.com/D154238
2022-08-11 13:10:04 +00:00
Jonathan Kew
40c398325d Bug 650372 - Accept keywords in addition to strings in the @font-face format() hint function. r=emilio
The CSS Fonts 4 spec requires this, and Safari (at least) has long supported it.

Differential Revision: https://phabricator.services.mozilla.com/D154237
2022-08-11 13:10:03 +00:00
Jonathan Kew
91d8e38d70 Bug 1784058 - Do not allow a list of strings in the @font-face src descriptor's format() function, only a single format string. r=emilio
This aligns with CSS Fonts 4 (rather than Fonts 3) and with behavior in other browsers;
I don't expect any significant breakage, given that specifying multiple format strings
was never supported in other engines AFAIK, and never served any useful purpose.

Differential Revision: https://phabricator.services.mozilla.com/D154235
2022-08-11 13:10:01 +00:00
Emilio Cobos Álvarez
e23e2a0212 Bug 1783934 - Add a chrome-only -moz-box-layout: legacy | flex, and use that to implement flexbox emulation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D154153
2022-08-10 19:46:37 +00:00
Marian-Vasile Laza
8274331cda Backed out changeset 449fe2d946ea (bug 1783934) for causing mochitest failures on test_animation-type-longhand.html. CLOSED TREE 2022-08-10 19:48:38 +03:00
Emilio Cobos Álvarez
f4206bdde5 Bug 1783934 - Add a chrome-only -moz-box-layout: legacy | flex, and use that to implement flexbox emulation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D154153
2022-08-10 15:47:41 +00:00