Commit graph

197 commits

Author SHA1 Message Date
Mirko Brodesser
c47bb134d2 Bug 1825807: part 1) Replace popover's ':open' and ':closed' pseudo-classes with ':popover-open'. r=emilio
See https://github.com/whatwg/html/pull/9077.

Differential Revision: https://phabricator.services.mozilla.com/D175223
2023-04-17 12:18:03 +00:00
Noemi Erli
e75f4068fb Backed out 2 changesets (bug 1825807) for causing failures in /browser_parsable_css.js CLOSED TREE
Backed out changeset 454a01f16f5b (bug 1825807)
Backed out changeset a82344255795 (bug 1825807)
2023-04-13 12:24:41 +03:00
Mirko Brodesser
c888f7c357 Bug 1825807: part 1) Replace popover's ':open' and ':closed' pseudo-classes with ':popover-open'. r=emilio
See https://github.com/whatwg/html/pull/9077.

Differential Revision: https://phabricator.services.mozilla.com/D175223
2023-04-13 07:43:57 +00:00
Emilio Cobos Álvarez
3a961b3d9a Bug 1121792 - Allow to use ThinVec/nsTArray in the style crate. r=jfkthame,layout-reviewers
This allows to clean-up the previous patches by using a single ThinVec
(which stores length / capacity along with the allocation).

Differential Revision: https://phabricator.services.mozilla.com/D175029
2023-04-12 21:58:29 +00:00
Jonathan Kew
40a813f9c6 Bug 1121792 - Accept a comma-separated list of language codes in the :lang() pseudo. r=emilio
This is the other extension to the :lang() pseudo-class in  Selectors-4.
(Also supported in Safari.)

Depends on D174999

Differential Revision: https://phabricator.services.mozilla.com/D175000
2023-04-12 21:46:47 +00:00
Narcis Beleuzu
8d21434933 Backed out 6 changesets (bug 1121792) for mochitest failures in malloc_usable_size . CLOSED TREE
Backed out changeset 879211a561cc (bug 1121792)
Backed out changeset 195d689a6b12 (bug 1121792)
Backed out changeset 9726f4b6035a (bug 1121792)
Backed out changeset be24fa5c3e70 (bug 1121792)
Backed out changeset 2e4e3ae6cddd (bug 1121792)
Backed out changeset e535870263d8 (bug 1121792)
2023-04-12 22:26:19 +03:00
Emilio Cobos Álvarez
60a3fc507d Bug 1121792 - Allow to use ThinVec/nsTArray in the style crate. r=jfkthame,layout-reviewers
This allows to clean-up the previous patches by using a single ThinVec
(which stores length / capacity along with the allocation).

Differential Revision: https://phabricator.services.mozilla.com/D175029
2023-04-12 16:05:13 +00:00
Jonathan Kew
a3fca4a96b Bug 1121792 - Accept a comma-separated list of language codes in the :lang() pseudo. r=emilio
This is the other extension to the :lang() pseudo-class in  Selectors-4.
(Also supported in Safari.)

Depends on D174999

Differential Revision: https://phabricator.services.mozilla.com/D175000
2023-04-12 16:05:11 +00:00
Ziran Sun
e1b24f642b Bug 1820544 - Add popover attribute and part of basic popover functionality. r=emilio
Starts to add part of the basic functionality for popover. Including
[1] :open & :closed CSS pseudo class
[2] showPopover(), hidePopover() and togglePopover() interfaces. Much of the
functionality is still to-do.
[3] PopoverData interface

Differential Revision: https://phabricator.services.mozilla.com/D171719
2023-03-10 10:52:20 +00:00
Jan-Niklas Jaeschke
fa75d3a60f Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-27 11:42:18 +00:00
Sandor Molnar
4c4d29b581 Backed out changeset d7f27aa40260 (bug 1803355) for causing win build bustage. 2023-01-24 18:07:50 +02:00
Jan-Niklas Jaeschke
1b3bff372b Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 11:46:28 +00:00
Sandor Molnar
a610ef723a Backed out changeset 54771a1963b6 (bug 1803355) for causing win build bustage. CLOSED TREE 2023-01-24 12:17:49 +02:00
Jan-Niklas Jaeschke
99eb703228 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 07:36:13 +00:00
Noemi Erli
aec839cbc8 Backed out changeset 759d4948ed8b (bug 1803355) for causing build bustages CLOSED TREE 2023-01-22 05:03:04 +02:00
Jan-Niklas Jaeschke
0a52844148 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-22 02:04:43 +00:00
Zach Hoffman
d2cd09a679 Bug 1808227 - Implement parsing and serialization for nth-child(An+B of selector list) and :nth-last-child(An+B of selector list) r=emilio
:nth-{,last-}child parsing is disabled by default for now by pref
layout.css.nth-child-of.enabled.

Differential Revision: https://phabricator.services.mozilla.com/D165895
2023-01-07 14:32:42 +00:00
Emilio Cobos Álvarez
218c654e19 Bug 1806273 - Avoid generic soup and extra reference count bumps. r=dshin
This makes me a bit happier about the previous patch :)

Differential Revision: https://phabricator.services.mozilla.com/D165236
2022-12-29 00:23:28 +00:00
Butkovits Atila
2166d21f30 Backed out changeset b99441011750 (bug 1806273) for causing MinGW bustages. CLOSED TREE 2022-12-27 22:57:21 +02:00
Emilio Cobos Álvarez
3dbdf02d3d Bug 1806273 - Avoid generic soup and extra reference count bumps. r=dshin
This makes me a bit happier about the previous patch :)

Differential Revision: https://phabricator.services.mozilla.com/D165236
2022-12-27 15:41:42 +00:00
Oriol Brufau
a288e5d423 Bug 1805898 - Fix elements not being query containers for the pseudo-element they originate. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164807
2022-12-17 02:04:02 +00:00
Emilio Cobos Álvarez
4c7dc0668f Bug 1790652 - Allow propagating computed style bits from the selector-matching process. r=dshin
This allows us to propagate flags from the container query styles all the
way to the computed style of the element.

The flag for viewport units in container queries has to be different
because it requires rematching, see comments.

Depends on D159851

Differential Revision: https://phabricator.services.mozilla.com/D159852
2022-10-20 14:24:36 +00:00
Emilio Cobos Álvarez
32728dff0f Bug 1790652 - Make a wrapper struct for extra matching data. r=dshin
No behavior change but we're about to add some extra field to it.

Differential Revision: https://phabricator.services.mozilla.com/D159850
2022-10-20 14:24:35 +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
Tiaan Louw
2a83b583b1 Bug 1771896 - Add simple parsing and matching support for :has r=emilio
Parsing is behind a config value `layout.css.has-selectors.enabled`. This
change does not support p:has(> a) combinators, but will handle them
gracefully, just not matching on them.

Differential Revision: https://phabricator.services.mozilla.com/D149515
2022-06-20 08:53:02 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Emilio Cobos Álvarez
96360cdae3 Bug 1768905 - Move size of tests to compile-time tests in the style crate. r=dshin
Same reasoning as the previous commit.

Differential Revision: https://phabricator.services.mozilla.com/D146104
2022-05-11 19:02:58 +00:00
Emilio Cobos Álvarez
829400449f Bug 1760579 - layout.css.moz-locale-dir.content.enabled. r=dholbert
We successfully removed these from content in bug 1740230 (Firefox 96).

Differential Revision: https://phabricator.services.mozilla.com/D141727
2022-03-25 14:59:00 +00:00
Emilio Cobos Álvarez
dd020d602a Bug 1760342 - Remove :-moz-lwtheme-{brighttext,darktext}. r=dao,Gijs
They are just convenience for :root[lwthemetextcolor="light"] (and dark,
respectively), but they generally shouldn't be used for dark mode
theming. In the past it was the only way to do it but now we have
prefers-color-scheme.

While at it, change lwthemetextcolor to be "lwtheme-brighttext" for
consistency with similar code we have for popups etc, and move it to
_setDarkModeAttributes.

While at it, remove layout.css.moz-lwtheme.content.enabled (which is
false always, we unshipped these from content successfully).

Differential Revision: https://phabricator.services.mozilla.com/D141593
2022-03-25 14:58:59 +00:00
Emily McDonough
7dade2da45 Bug 1750884 - Add style_traits::ToCss for AtomIdent r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D136290
2022-01-24 17:29:20 +00:00
Ting-Yu Lin
ca1b688007 Bug 1741990 - Run rustfmt on servo/components/style and servo/ports/geckolib. r=emilio,layout-reviewers
This patch is generated by running `cargo +nightly fmt` under
`servo/components/style/` and `servo/ports/geckolib` against mozilla-central
https://hg.mozilla.org/mozilla-central/rev/b193f2e7a6a5d1f042c957ea4acd5c89bf210512

My nightly version is: 1.58.0-nightly (c9c4b5d72 2021-11-17)

Manually remove the redundant braces in author_styles.rs to fix a warning.

Differential Revision: https://phabricator.services.mozilla.com/D131556
2021-11-19 00:14:27 +00:00
Norisz Fay
09cb6f5caa Backed out changeset 00651c04ba31 (bug 1741990) for causing build bustages CLOSED TREE 2021-11-19 01:03:56 +02:00
Ting-Yu Lin
6d43b0f7b8 Bug 1741990 - Run rustfmt on servo/components/style and servo/ports/geckolib. r=emilio,layout-reviewers
This patch is generated by running `cargo +nightly fmt` under
`servo/components/style/` and `servo/ports/geckolib` against mozilla-central
https://hg.mozilla.org/mozilla-central/rev/b193f2e7a6a5d1f042c957ea4acd5c89bf210512

My nightly version is: 1.58.0-nightly (c9c4b5d72 2021-11-17)

Differential Revision: https://phabricator.services.mozilla.com/D131556
2021-11-18 22:46:24 +00:00
Emilio Cobos Álvarez
a5f66c95e1 Bug 1740230 - Remove some prefs for pseudo-classes that we have shipped/unshipped successfully. r=dholbert
And remove code for :-moz-submit-invalid completely.

Differential Revision: https://phabricator.services.mozilla.com/D130737
2021-11-10 13:27:47 +00:00
Emilio Cobos Álvarez
f2318b3299 Bug 1740230 - Unexpose :-moz-locale-dir and :-moz-lwtheme* from content. r=dholbert
Behind a pref for now. Given these selectors do nothing on non-chrome
documents (they just don't match) it seems worth trying.

A cursory search seems to indicate they're not used for UA detection or
something like that (or at least I haven't found such an usage).

Differential Revision: https://phabricator.services.mozilla.com/D130736
2021-11-10 13:00:17 +00:00
Butkovits Atila
3a33d047e8 Backed out 2 changesets (bug 1740230) for causing build bustages.
Backed out changeset ba8e644ee9d2 (bug 1740230)
Backed out changeset 180d03015fd1 (bug 1740230)
2021-11-10 02:12:26 +02:00
Emilio Cobos Álvarez
c11619252a Bug 1740230 - Unexpose :-moz-locale-dir and :-moz-lwtheme* from content. r=dholbert
Behind a pref for now. Given these selectors do nothing on non-chrome
documents (they just don't match) it seems worth trying.

A cursory search seems to indicate they're not used for UA detection or
something like that (or at least I haven't found such an usage).

Differential Revision: https://phabricator.services.mozilla.com/D130736
2021-11-09 22:51:05 +00:00
Emilio Cobos Álvarez
a3a1b27924 Bug 1740230 - Refactor :-moz-lwtheme pseudo-classes to get invalidated correctly. r=dholbert
Use the same document state mechanism we have for :moz-locale-dir. Also,
simplify the setup of the later to be the same as :dir(), allowing the
matching code to be less repetitive.

This should fix some flakiness in chrome mochitests, but we have no existing
tests for these pseudo-classes more generally and since they're just
chrome-only I'm not super-excited about adding more.

Differential Revision: https://phabricator.services.mozilla.com/D130735
2021-11-09 20:59:11 +00:00
Emilio Cobos Álvarez
9b27f32101 Bug 1740230 - Simplify :dir() implementation. r=dholbert
This I noticed while working on the following patches. Shouldn't have
any behavior change: the behavior does in fact match the element state
flag semantics correctly if we do this. We did split the dir flags into
two element bits a while ago.

:not(:dir()) still behaves correctly of course, and we have tests for that.

Differential Revision: https://phabricator.services.mozilla.com/D130734
2021-11-09 20:53:13 +00:00
Emilio Cobos Álvarez
7bd3a20ff4 Bug 1728851 - Add attributes to the rule hash. r=boris
See the discussion here: https://twitter.com/Rich_Harris/status/1433153204678799365

This should make attribute selectors roughly as fast as class selectors.

I think it's worth trying and see if perf bots complain on
micro-benchmarks and stylebench and such.

I made attributes more specific than local names, but less specific than
classes, which I think makes sense. When doing something like
foo[data-bar], filtering by data-bar seems likely to yield less elements
than filtering by foo.

While at it, remove the bloom filter pref since we shipped it in
bug 1704551 for 87 and we haven't heard complaints.

Differential Revision: https://phabricator.services.mozilla.com/D124383
2021-09-03 15:57:30 +00:00
criss
c6ef85e3b3 Backed out changeset 876e53ec90c4 (bug 1728851) as requested by Emilio. CLOSED TREE 2021-09-03 12:13:11 +03:00
Emilio Cobos Álvarez
f28b5935c0 Bug 1728851 - Add attributes to the rule hash. r=boris
See the discussion here: https://twitter.com/Rich_Harris/status/1433153204678799365

This should make attribute selectors roughly as fast as class selectors.

I think it's worth trying and see if perf bots complain on
micro-benchmarks and stylebench and such.

I made attributes more specific than local names, but less specific than
classes, which I think makes sense. When doing something like
foo[data-bar], filtering by data-bar seems likely to yield less elements
than filtering by foo.

While at it, remove the bloom filter pref since we shipped it in
bug 1704551 for 87 and we haven't heard complaints.

Differential Revision: https://phabricator.services.mozilla.com/D124383
2021-09-03 08:58:20 +00:00
Emilio Cobos Álvarez
01aa139f4a Bug 1727537 - Remove layout.css.is-and-where-better-error-recovery.enabled. r=hiro
We shipped this in 84

Differential Revision: https://phabricator.services.mozilla.com/D123623
2021-08-30 11:08:40 +00:00
Emilio Cobos Álvarez
210b1fa8e8 Bug 1704551 - Add attribute names to the bloom filter. r=boris
Safari does this. This reduces the runtime in the example linked from
comment 0 quite a lot (40ms on a local opt build, from ~130ms on a
release nightly build).

I added a pref because there's a slight chance of performance
regressions on pages that do not use attribute selectors, as we're now
doing more unconditional work per element (adding the attributes to the
bloom filter). But the trade-off should be worth it, I think.

Differential Revision: https://phabricator.services.mozilla.com/D111689
2021-04-13 10:53:40 +00:00
Emilio Cobos Álvarez
50404c19c1 Bug 1695251 - Cherry-pick various servo changes.
All formatting and not-part-of-the-gecko-build changes.

Differential Revision: https://phabricator.services.mozilla.com/D106634
2021-02-26 17:00:55 +00:00
Emilio Cobos Álvarez
97e19087ff Bug 1694141 - Implement :user-valid and :user-invalid. r=xidorn
And alias :-moz-ui-valid and :-moz-ui-invalid to them.

There are CSSWG resolutions for these for quite a while, and spec for
user-invalid.

Differential Revision: https://phabricator.services.mozilla.com/D105966
2021-02-24 01:11:40 +00:00
Emilio Cobos Álvarez
89b87d3c09 Bug 1694129 - Hide :-moz-submit-invalid behind a pref. r=hiro
No other browser supports anything like this and we don't even have
internal users. Only uses of this I've found on the wild were just
resetting the box shadow internal styling we added in bug 582277 (and
since removed in bug 600151).

Differential Revision: https://phabricator.services.mozilla.com/D105955
2021-02-23 00:46:36 +00:00
Emilio Cobos Álvarez
217ddbe75f Bug 1690225 - Remove focus-visible feature flag. r=edgar
This shipped in 85, we can remove the feature flag now. Keep
:-moz-focusring as an alias to :focus-visible at parse time.

Differential Revision: https://phabricator.services.mozilla.com/D103752
2021-02-02 23:45:25 +00:00
Mihai Alexandru Michis
ac5549ffd4 Backed out 2 changesets (bug 1690225) for causing multiple bc failures.
CLOSED TREE

Backed out changeset 381ee01f5034 (bug 1690225)
Backed out changeset cde1d10aae1c (bug 1690225)
2021-02-03 01:42:37 +02:00
Emilio Cobos Álvarez
df079e8f9d Bug 1690225 - Remove focus-visible feature flag. r=edgar
This shipped in 85, we can remove the feature flag now. Keep
:-moz-focusring as an alias to :focus-visible at parse time.

Differential Revision: https://phabricator.services.mozilla.com/D103752
2021-02-02 22:28:40 +00:00