Commit Graph

331 Commits

Author SHA1 Message Date
Boris Chiou
b50a4bfc11 Bug 1922078 - Retrieve the functional parameter from element when collecting rules. r=view-transitions-reviewers,emilio
In order to match the selectors for the view-transition pseudo element,
we have to make sure we are using the correct `PseudoElement` (which includes
the functional parameter) when collecting the rules.

Note that this function is also used when matching the pseudo element in
the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D230024
2024-11-28 09:54:36 +00:00
Boris Chiou
f1d23dbbfb Bug 1921553 - Use PseudoStyleRequest in nsTransitionManager. r=view-transitions-reviewers,layout-reviewers,emilio
Even though we don't support CSS Transitions on view transition
pseudo-elements, it's better to use PseudoStyleRequest for consistency
and avoid allocating unnecessary objects.

Also, make sure we use the correct element to retrieve the transition
collection.

Differential Revision: https://phabricator.services.mozilla.com/D228229
2024-11-25 23:46:33 +00:00
Boris Chiou
ab6b2a337d Bug 1921553 - Use PseudoStyleRequest in AnimationCollection and TimelineCollection. r=view-transitions-reviewers,layout-reviewers,emilio
Just like what we do for EffectSet. Also, we will update
ElementAnimationData later, so for now only change the APIs of
AnimationCollection and TimelineCollection (and their callers).

Differential Revision: https://phabricator.services.mozilla.com/D228227
2024-11-25 23:46:33 +00:00
Boris Chiou
48af9b2a00 Bug 1921553 - Use PseudoStyleRequest in EffectSet. r=view-transitions-reviewers,layout-reviewers,emilio
Use `PseudoStyleRequest` in the APIs of EffectSet. We would like to
store the animation in the originating element, so need to use
`PseudoStyleRequest`.

Differential Revision: https://phabricator.services.mozilla.com/D228226
2024-11-25 23:46:32 +00:00
Boris Chiou
cf4401d376 Bug 1921553 - Use PseudoStyleRequest in AnimationUtils and EffectCompositor. r=view-transitions-reviewers,layout-reviewers,emilio
Basically, we'd like to separate the originating element and its pseudo
element request in Animation code (for better compatibility with Web
Animations APIs and other pseudo types), and store the animations and
keyframe effects in the origninating element as well.

In this patch, we reuse `Element::GetPseudoElement()`, and update the
function signatures in EffectCompositor and RestyleManager.

All the following patches will replace more places with
`PseudoStyleRequest`.

Differential Revision: https://phabricator.services.mozilla.com/D228223
2024-11-25 23:46:31 +00:00
Emilio Cobos Álvarez
b985e29a3f Bug 1930476 - Improve units in nsFrameLoader and related code. r=geckoview-reviewers,jwatt,ohall
Use LayoutDevice units for most these things, since it's what they are:

  ScreenIntSize(presContext->AppUnitsToDevPixels(size.width), ...

Is clearly a lie :)

Differential Revision: https://phabricator.services.mozilla.com/D228586
2024-11-12 15:16:50 +00:00
Emilio Cobos Álvarez
8e14e41db9 Bug 1917703 - Make sure visited style computation color-scheme matches unvisited style. r=dshin
Plumb it via the StyleBuilder like we do for the writing_mode for the
same reasons.

Differential Revision: https://phabricator.services.mozilla.com/D222328
2024-09-18 20:16:17 +00:00
Sandor Molnar
89302cd2ce Backed out changeset 0c3885fa675f (bug 1917703) for causing reftest failures. CLOSED TREE 2024-09-18 21:19:16 +03:00
Emilio Cobos Álvarez
35a06f02b9 Bug 1917703 - Make sure visited style computation color-scheme matches unvisited style. r=dshin
Plumb it via the StyleBuilder like we do for the writing_mode for the
same reasons.

Differential Revision: https://phabricator.services.mozilla.com/D222328
2024-09-18 15:02:25 +00:00
Emilio Cobos Álvarez
baba6ff61c Bug 1914449 - Fix stylesheet cloning in presence of both @layer and @import. r=zrhoffman,firefox-style-system-reviewers
Hopefully the test for bug 1912996 would catch this.

Differential Revision: https://phabricator.services.mozilla.com/D220083
2024-08-26 13:01:59 +00:00
Emilio Cobos Álvarez
a19a2e128b Bug 1912996 - Make sure to honor the sheet clone parent. r=firefox-style-system-reviewers,zrhoffman
We've never passed it down even though it was clearly the intention.

This made the invalidation code think the stylesheet was already
detached.

Differential Revision: https://phabricator.services.mozilla.com/D219638
2024-08-21 20:53:14 +00:00
Emilio Cobos Álvarez
e1ad6294bf Bug 1910698 - Remove nsIScriptError.sourceLine. r=smaug,devtools-reviewers,webdriver-reviewers,necko-reviewers,nchevobbe,kershaw,jdescottes,credential-management-reviewers,dimi
Afaict the source lines are not exposed anywhere in the UI.

Differential Revision: https://phabricator.services.mozilla.com/D218115
2024-08-01 17:12:48 +00:00
David Shin
e9208e701c Bug 1886441: Part 4 - Add support for implicit scope. r=firefox-style-system-reviewers,emilio
Keep track of implicit scopes for shadow DOM styled separately,
as cascade data for shadow DOM are shared.

Differential Revision: https://phabricator.services.mozilla.com/D207781
2024-05-30 15:23:41 +00:00
Emilio Cobos Álvarez
297dfea1e6 Bug 1899187 - Use a real percentage for -moz-min-font-size-ratio. r=firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D211780
2024-05-28 09:37:21 +00:00
Emilio Cobos Álvarez
f9454c2afe Bug 1897361 - Share counter-style / list-style-type representation between Servo and Gecko. r=jwatt
It's not clear to me what is going on there or what caused it. I suspect
it might be:

  https://searchfox.org/mozilla-central/rev/1f46481d6c16f27c989e72b898fd1fddce9f445f/servo/components/style/gecko/values.rs#69

Which is the only potential from_raw_parts caller there. But hard to say
without a regression range.

However I've been wanting to get rid of that code for a while, and
this is a good opportunity for that.

The WithCounterStyleNameOrSymbols stuff isn't super pretty, but it has
only two callers, and something more complicated might require further
refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D210814
2024-05-19 21:24:16 +00:00
Cristian Tuns
e65d93ace2 Backed out changeset dffe004546c6 (bug 1897361) for causing reftest failures in /list-1.html CLOSED TREE 2024-05-19 17:09:47 -04:00
Emilio Cobos Álvarez
f3519ac0d9 Bug 1897361 - Share counter-style / list-style-type representation between Servo and Gecko. r=jwatt
It's not clear to me what is going on there or what caused it. I suspect
it might be:

  https://searchfox.org/mozilla-central/rev/1f46481d6c16f27c989e72b898fd1fddce9f445f/servo/components/style/gecko/values.rs#69

Which is the only potential from_raw_parts caller there. But hard to say
without a regression range.

However I've been wanting to get rid of that code for a while, and
this is a good opportunity for that.

The WithCounterStyleNameOrSymbols stuff isn't super pretty, but it has
only two callers, and something more complicated might require further
refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D210814
2024-05-19 19:42:38 +00:00
Daniel Holbert
0cde7ece00 Bug 1896711 part 5: Use MakeRefPtr/MakeAndAddRef to reduce boilerplate, in layout/style. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D210390
2024-05-15 07:29:21 +00:00
Emilio Cobos Álvarez
dc9b47aecf Bug 1281158 - Improve interaction of ThinVec in the style system. r=dshin
This is the logical continuation of bug 1121792. This improves on the
existing support by totally removing all the manual nsTArray bindings,
which have always been a bit clumsy.

This is a prerequisite for bug 1281158 because I want to use ThinVec to
avoid a few extra heap allocations in the computed values of the Content
property.

Differential Revision: https://phabricator.services.mozilla.com/D209689
2024-05-08 16:06:46 +00:00
Artur Iunusov
3a0843a675 Bug 1770944 - Remove nsIMozBrowserFrame. r=smaug
Depends on D155254

Differential Revision: https://phabricator.services.mozilla.com/D170397
2024-03-07 13:04:21 +00:00
Ryan VanderMeulen
f12637ef11 Bug 1883927 - Add ClearOnShutdown.h includes to a couple files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D203793
2024-03-06 17:55:34 +00:00
Narcis Beleuzu
7eae8c1064 Backed out 16 changesets (bug 1770944) as req by asuth.
Backed out changeset 61af32f40777 (bug 1770944)
Backed out changeset 4ff0c45db93b (bug 1770944)
Backed out changeset 8a217eff7bcd (bug 1770944)
Backed out changeset 6435f48c96bf (bug 1770944)
Backed out changeset 0d2432765ca0 (bug 1770944)
Backed out changeset 58e02566db85 (bug 1770944)
Backed out changeset 0a8c4c2460ee (bug 1770944)
Backed out changeset 9416bafd9982 (bug 1770944)
Backed out changeset 79de4f83fe2e (bug 1770944)
Backed out changeset 63ac518aceb0 (bug 1770944)
Backed out changeset 14952f872b77 (bug 1770944)
Backed out changeset f65e0967ad75 (bug 1770944)
Backed out changeset bd53c42038f7 (bug 1770944)
Backed out changeset 36c378ba8212 (bug 1770944)
Backed out changeset 9ba54ab06348 (bug 1770944)
Backed out changeset fb5a54b3cbe9 (bug 1770944)
2024-02-23 21:11:08 +02:00
Artur Iunusov
b4d482e568 Bug 1770944 - Remove nsIMozBrowserFrame. r=smaug
Depends on D155254

Differential Revision: https://phabricator.services.mozilla.com/D170397
2024-02-22 10:13:13 +00:00
Sandor Molnar
be27c149eb Backed out 16 changesets (bug 1770944) for causing asan failures @ dom/base/InProcessBrowserChildMessageManager.cpp
Backed out changeset b73885731e73 (bug 1770944)
Backed out changeset 23d0dc98eb51 (bug 1770944)
Backed out changeset 15661e24d8e1 (bug 1770944)
Backed out changeset 97aa839dc200 (bug 1770944)
Backed out changeset 0d4318bf3239 (bug 1770944)
Backed out changeset be28bb62e9f3 (bug 1770944)
Backed out changeset 708b2671410e (bug 1770944)
Backed out changeset 0a138f3b56b9 (bug 1770944)
Backed out changeset 3a149ef794c2 (bug 1770944)
Backed out changeset 4b6ae7dd0e69 (bug 1770944)
Backed out changeset e3960ad85182 (bug 1770944)
Backed out changeset 9ea253525227 (bug 1770944)
Backed out changeset 1828b66c2f7c (bug 1770944)
Backed out changeset 55b0886f9025 (bug 1770944)
Backed out changeset a4197071d10a (bug 1770944)
Backed out changeset 9b18524f541e (bug 1770944)
2024-02-20 20:34:55 +02:00
Artur Iunusov
e6a0102a3b Bug 1770944 - Remove nsIMozBrowserFrame. r=smaug
Depends on D155254

Differential Revision: https://phabricator.services.mozilla.com/D170397
2024-02-20 16:53:22 +00:00
Emilio Cobos Álvarez
fb4b456d4f Bug 1870832 - Use cbindgen for animation-{name,composition,fill-mode,direction}. r=firefox-style-system-reviewers,zrhoffman
Same amount of code, but more boring code (and I've probably missed
removing some), which is better.

Differential Revision: https://phabricator.services.mozilla.com/D196843
2023-12-20 10:52:25 +00:00
Emilio Cobos Álvarez
bab145128a Bug 1870832 - Auto-generate transition-property. r=firefox-style-system-reviewers,zrhoffman
Now that NonCustomPropertyId is not in mako, it can be auto-generated by
cbindgen. This allows simplifying some code.

Differential Revision: https://phabricator.services.mozilla.com/D196842
2023-12-20 10:52:24 +00:00
Emilio Cobos Álvarez
c97f9d30c4 Bug 1852465 - Check shutdown phase in Gecko_ComputeBoolPrefMediaQuery. r=jstutte
Differential Revision: https://phabricator.services.mozilla.com/D196911
2023-12-20 10:06:49 +00:00
Zach Hoffman
0060ff08b2 Bug 1846516 - [css-properties-values-api] Animate custom properties in a discrete way. r=firefox-style-system-reviewers,emilio
This patch also updates the bug ID for a FIXME leftover from bug 1840478
to bug 1869476, since the same FIXME is added in D190758.

Co-authored-by: Frederic Wang <fred.wang@free.fr>

Depends on D191322

Differential Revision: https://phabricator.services.mozilla.com/D190758
2023-12-18 09:24:08 +00:00
Zach Hoffman
7653a4f1c2 Bug 1846516 - [css-properties-values-api] Use AnimatedPropertyID to communicate between Gecko and Servo. r=emilio,layout-reviewers,firefox-style-system-reviewers
Co-authored-by: Frederic Wang <fred.wang@free.fr>
Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

Depends on D191059

Differential Revision: https://phabricator.services.mozilla.com/D191322
2023-12-18 09:24:08 +00:00
Zach Hoffman
cd5747dfbf Bug 1846516 - [css-properties-values-api] Introduce AnimatedPropertyID/AnimatedPropertIDSet. r=firefox-animation-reviewers,firefox-style-system-reviewers,layout-reviewers,emilio,hiro
This will make possible to animate custom properties on Gecko side. For now, the
animation code keeps only dealing with nsCSSPropertyID, so behavior is unchanged.

Co-authored-by: Frederic Wang <fred.wang@free.fr>

Depends on D190816

Differential Revision: https://phabricator.services.mozilla.com/D191059
2023-12-18 09:24:08 +00:00
Emilio Cobos Álvarez
3749933d04 Bug 1867504 - Remove :-moz-browser-frame pseudo-class. r=jwatt
This pseudo-class is unused other than in the ua sheet. MozBrowser is
gone (getting actively removed in bug 1770944). Let's just do this since
that is taking a bit.

Differential Revision: https://phabricator.services.mozilla.com/D195095
2023-11-30 16:30:07 +00:00
Emilio Cobos Álvarez
f3cfe85712 Bug 1789214 - When forcing colors without a color-scheme, compute prefers-color-scheme based on them. r=morgan
This requires moving some code around to PreferenceSheet, but that makes
stuff actually a bit simpler.

Depends on D192574

Differential Revision: https://phabricator.services.mozilla.com/D192575
2023-11-06 19:59:38 +00:00
Jonathan Kew
41ce345193 Bug 1472876 - Make empty URL in CSS compute to empty (rather than about:invalid), as required by the spec. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D192809
2023-11-06 10:15:27 +00:00
Emilio Cobos Álvarez
325bc7b486 Bug 1859538 - Allow chrome stylesheets to be parsed in parallel. r=layout-reviewers,desktop-theme-reviewers,dao,Gijs,tlouw
This changes -moz-bool-pref from @supports to @media, bringing various
improvements:

 * @media (-moz-bool-pref) properly reacts to dynamic changes.
 * We no longer need to parse chrome:// stylesheets in the main thread
   (-moz-bool-pref was the only thing that forced us to do that).

This makes privileged and non-privileged stylesheets more similar.

Differential Revision: https://phabricator.services.mozilla.com/D191196
2023-10-19 10:50:27 +00:00
Emilio Cobos Álvarez
4eb3dda25e Bug 1859427 - Cache number parsers and formatters per language. r=smaug
This makes number localization cheaper / halves the time in the
microbenchmark.

Change the content-language handling to use atoms. This exposes some
interesting inconsistencies but I tried not to change behavior there.

Differential Revision: https://phabricator.services.mozilla.com/D191174
2023-10-17 11:01:13 +00:00
Jamie Nicol
71529c856c Bug 1850573 - Override number of style threads on systems with heterogeneous CPUs. r=emilio
If there are 2 or more "big" CPUs then use the number of big CPUs as
the number of threads. If there are fewer than 2 then use the number
of big plus the number of "medium".

Currently this only affects android, as hal::GetHeterogeneousCpuInfo
is not implemented on other platforms.

Differential Revision: https://phabricator.services.mozilla.com/D188480
2023-09-26 12:55:38 +00:00
Emilio Cobos Álvarez
87b30b70df Bug 1854834 - Remove unnecessary atom -> id conversion in GetAllElementsForId. r=TYLin
That also allows us to use the precomputed atom hash.

Differential Revision: https://phabricator.services.mozilla.com/D189060
2023-09-26 07:10:04 +00:00
Emilio Cobos Álvarez
c6be271926 Bug 1847440 - Fix line numbers in CSS error reports.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2023-08-16 12:34:21 +02:00
Jonathan Kew
99602c82b2 Bug 1832955 - Support font-relative units when parsing letterSpacing/wordSpacing for offscreen canvas. r=gfx-reviewers,lsalzman,emilio
Differential Revision: https://phabricator.services.mozilla.com/D184938
2023-08-01 09:27:16 +00:00
Emilio Cobos Álvarez
e3aa78816f Bug 1845679 - Add an internal light-dark() function to allow defining colors reacting to color-scheme. r=dshin
This implement something like what's proposed in
https://github.com/w3c/csswg-drafts/issues/7561, but the simplest
version possible, until issues are resolved.

This will allow the front-end to experiment with it and use it (and we
can update to the standard feature once there's a spec for it).

Differential Revision: https://phabricator.services.mozilla.com/D184680
2023-07-27 18:04:23 +00:00
Emilio Cobos Álvarez
b5d6ad43a2 Bug 1844832 - Share document-independent struct allocations. r=boris
In bug 1844755, a bunch of the time is spent allocating initial values.

There used to be more document-dependent initial values before
bug 1834487, but now that's only about default-font and direction.

This improves the situation by sharing initial structs that don't depend
on the document.

Differential Revision: https://phabricator.services.mozilla.com/D184256
2023-07-26 09:16:26 +00:00
Emilio Cobos Álvarez
7bddcf9e5a Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 17:22:03 +00:00
Cristian Tuns
6957543e5e Backed out changeset a3e55d5f9f13 (bug 1839223) for causing multiple failures in Document.cpp CLOSED TREE 2023-06-22 11:34:15 -04:00
Emilio Cobos Álvarez
2c6de5f038 Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 14:31:16 +00:00
Jonathan Kew
695f595aef Bug 1839432 - Fix serialization of quoted family names for OffscreenCanvas font attribute. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D181535
2023-06-21 13:37:30 +00:00
Emilio Cobos Álvarez
1c92ed74cb Bug 1839255 - Clean up a bit the mapped attribute set-up. r=smaug
This doesn't change behavior on its own. It could be split up a bit more
if needed though over all it shouldn't be hard to follow.

Unify nsHTMLStyleSheet and nsHTMLCSSStyleSheet into AttributeStyles
because the fact that we have two right now is pretty silly. They are
also not stylesheets (they used to be pre-stylo).

Differential Revision: https://phabricator.services.mozilla.com/D181414
2023-06-20 10:02:44 +00:00
Emilio Cobos Álvarez
5113cc40e0 Bug 1837734 - Speed up / specialize attribute selector-matching. r=boris
Inline the attribute lookup code, and only branch on the attribute selector
type if we have found an attribute.

Differential Revision: https://phabricator.services.mozilla.com/D180531
2023-06-14 21:08:22 +00:00
Emilio Cobos Álvarez
9d38cfb2a9 Bug 1832803 - Remove some magic from the bindings. r=boris
This simplifies a tiny bit our bindings in some places, and complicates
it in others, but over all I think it's better.

It requires a bit more manual code in the rust side to drop and cast the
relevant pointers (which was done implicitly before), but it's a lot
less magic than it used to be, and that's all autogenerated so consumers
don't need to care about it.

The set up is still not ideal. I don't like that we rely on destructors
running in both sides of the FFI boundary, but that's for another day.

This is the last usage of RawOffsetArc, so remove that. We now support
proper Arc<> in structs (GridTemplateAreas uses it), so I don't think
we'll need it any time soon.

Differential Revision: https://phabricator.services.mozilla.com/D177905
2023-05-12 23:33:12 +00:00
Emilio Cobos Álvarez
a7526d2a34 Bug 1832173 - Finish removing HasArcFFI. r=boris
Use the actual Locked<T> types around (via a typedef, just for
convenience).

Differential Revision: https://phabricator.services.mozilla.com/D177824
2023-05-12 22:31:38 +00:00