Commit graph

8711 commits

Author SHA1 Message Date
David Shin
09fc10c5c2 style: linear(...) Easing: First linear entry should Get 0.0 assigned for input if not specified
Previously, had the smallest input value over all entries was assigned. However,
that does not match the behaviour of `linear-gradient(...)`, which this easing
function is modeled after.

Differential Revision: https://phabricator.services.mozilla.com/D149916
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
bb5de5833c style: Improve LookAndFeel color caching
To be honest, I'm a bit baffled that bug 1773795 caused a performance
regression, but I think it's because the standins codepath is not really
cached, so system colors that are "spoofed" always go through the
massive switch, which could potentially be expensive.

To fix, this, rejigger a bit the caches so that we key on both
color-scheme and use-standins. Also, while at it, make the set of colors
we spoof a single bitflag check, rather than relying on the compiler to
do something potentially smart with it.

I had to shuffle the order of colors around so that the expression to
initialize the bitfield is constexpr (doesn't go over 1 << 64), but
other than that this patch should be relatively straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D150100
2023-10-02 14:37:19 +00:00
Oriol Brufau
34c3767560 Further changes required by Servo 2023-10-02 14:37:19 +00:00
David Shin
5d528ec8be style: Use Rust's ComputedTimingFunction for IPDL
Differential Revision: https://phabricator.services.mozilla.com/D149663
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
a19674a5a7 style: Use style interpolation code for gradients
This ensures they're clamped on Animated -> sRGB conversion, and in the
future we'll have to implement different color spaces so we'll need to
use it anyways.

Differential Revision: https://phabricator.services.mozilla.com/D149792
2023-10-02 14:37:19 +00:00
Oriol Brufau
189039bea5 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Martin Robinson
64febfbe9a style: Implement CSS 'contain: style'
Add an implementation of CSS `contain: style`. This introduces two new
data structures, the ContainStyleScope and ContainStyleScopeManager.

ContainStyleScope manages one `contain: style` "world" which has its own
counter and quote lists. The contents of these lists depend on their
parent scopes, but are not affected by their children.
ContainStyleScopeManager manages a tree of scopes starting at a root
scope which is outside of any `contain: style` element.

Scopes are stored in a hash table that is keyed off of the nsIContent
which establishes the `contain: style` scope. When modifying quote or
content lists, the ContainStyleScopeManager is responsible for finding
the appropriate `contain: style` scope to modify.

Perhaps the most complex part of this is that counters and quotes have
read access to the state of counters and quotes that are in ancestor
`contain: style` scopes. In the case of counters, USE nodes that are at
the beginning of counter lists might have a counter scope that starts in
an ancestor `contain: style` scope. When nsCounterNode::SetScope() is
called, the code may look upward in the `contain: style` scope tree to
find the start of the counter scope. In the case of quotes, the first
node in the quote list must look for the state of quotes in ancestor
`contain: style` scopes.

Differential Revision: https://phabricator.services.mozilla.com/D149508
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
ad68880627 style: Implement AccentColor/AccentColorText and remove -moz-prefixed version of the color
As per https://github.com/w3c/csswg-drafts/issues/7347.

Mostly renaming, doesn't change behavior other than exposing the new
color keywords (tested in wpt).

Differential Revision: https://phabricator.services.mozilla.com/D149876
2023-10-02 14:37:19 +00:00
David Shin
ca6ad97159 style: Refactor function parsing branches for specified::easing::TimingFunction
Differential Revision: https://phabricator.services.mozilla.com/D149756
2023-10-02 14:37:19 +00:00
Oriol Brufau
3d02b4ef90 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
34373c2ac8 style: Check for allowed colors recursively in forced-colors mode
Differential Revision: https://phabricator.services.mozilla.com/D149733
2023-10-02 14:37:19 +00:00
Tiaan Louw
3d0cf4dbf9 style: Add simple parsing and matching support for :has
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
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
dcdf9f33d5 style: Fix grid shorthand parsing to not incorrectly ignore the last token in one case
Differential Revision: https://phabricator.services.mozilla.com/D149666
2023-10-02 14:37:19 +00:00
Mike Hommey
fb95cb7993 style: Update stylo to itertools:0.10, itoa:1.0 and toml:0.5
Differential Revision: https://phabricator.services.mozilla.com/D149454
2023-10-02 14:37:19 +00:00
Jonathan Kew
becb855b3a style: Only accept the CSS2 font-variant values (normal/small-caps) in the font shorthand; CSS Fonts 3/4 font-variant additions are not allowed
Differential Revision: https://phabricator.services.mozilla.com/D149440
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
6a5f012d3b style: Fix dynamic viewport size
Differential Revision: https://phabricator.services.mozilla.com/D149275
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
5de65d9f2c style: Make viewport-relative units zoomable via "zoom text only"
They're not font relative, so it we probably want them to be zoomed.

Differential Revision: https://phabricator.services.mozilla.com/D148796
2023-10-02 14:37:19 +00:00
Boris Chiou
82d7f2154d style: Hook named scroll timelines to animation-timeline
Basically, animation-timeline could be
1. auto
2. none
3. <timeline-name>

We extend the <timeline-name> to cover both @scroll-timeline rule and
scroll-timeline-name property. We check @scroll-timeline rule first. If
it doesn't exist, we check scroll-timeline-name of the element itself,
the previous silbings, and their ancestors.

Differential Revision: https://phabricator.services.mozilla.com/D146358
2023-10-02 14:37:19 +00:00
Boris Chiou
13acff77d1 style: Support scroll-timeline shorthand in style system
Implement
"scroll-timeline: <'scroll-timeline-axis'> || <'scroll-timeline-name'>".

Differential Revision: https://phabricator.services.mozilla.com/D146020
2023-10-02 14:37:19 +00:00
Boris Chiou
0c709f714b style: Support scroll-timeline-axis longhand in style system
Implement "scroll-timeline-axis: block | inline | vertical | horizontal".

Differential Revision: https://phabricator.services.mozilla.com/D146019
2023-10-02 14:37:19 +00:00
Boris Chiou
8d8594ef86 style: Support scroll-timeline-name longhand in style system
Implement "scroll-timeline-name: none | <custom-ident>".

Differential Revision: https://phabricator.services.mozilla.com/D146018
2023-10-02 14:37:19 +00:00
Oriol Brufau
105050d46d Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
dcafbde256 style: Move fixed-point font types to Rust
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2023-10-02 14:37:19 +00:00
Mike Hommey
48749641d3 style: Update derive_more to 0.99.17
Limit its features to those we actually use, which turns out is none for
webrender_api.

Differential Revision: https://phabricator.services.mozilla.com/D148734
2023-10-02 14:37:19 +00:00
Oriol Brufau
04a817c0d2 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
c283b32991 style: Add a low-priority selector list for pseudo-classes that have global rules
This avoids trying to match those global rules for most elements that
can't match them anyways.

Differential Revision: https://phabricator.services.mozilla.com/D147640
2023-10-02 14:37:19 +00:00
Tiaan Louw
1162204bad style: Rename :-moz-modal-dialog to :modal
Differential Revision: https://phabricator.services.mozilla.com/D148751
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
7f81cd4f7c style: While at it use some better names for some bits
Differential Revision: https://phabricator.services.mozilla.com/D148538
2023-10-02 14:37:19 +00:00
Oriol Brufau
6c3f92cb85 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
1ce75ff7dd style: Unify Gecko and Servo EventState/ElementState bits
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
2023-10-02 14:37:19 +00:00
David Shin
949fd0e172 style: Add parsing for linear easing function and gate it behind pref
Differential Revision: https://phabricator.services.mozilla.com/D146839
2023-10-02 14:37:19 +00:00
David Shin
b31be826c4 style: Hook up linear easing calculation for servo and expose it to C++
Differential Revision: https://phabricator.services.mozilla.com/D146838
2023-10-02 14:37:19 +00:00
David Shin
6326a384a8 style: Rust side plumbing work for linear easing function
Add LinearFunction to TimingFunction. Because the linear function is a
variable list of linear stops, the enum is no longer Copyable.

Differential Revision: https://phabricator.services.mozilla.com/D146837
2023-10-02 14:37:19 +00:00
Samson
aa41fbd8f6
Media query resolution (#30406)
* Add resolution and device-pixel-ratio media query

* Update expectations
2023-09-22 16:18:00 +00:00
dependabot[bot]
9c310b6d4e
build(deps): bump parking_lot from 0.11.2 to 0.12.0 (#30199)
* build(deps): bump parking_lot from 0.11.2 to 0.12.0

Bumps [parking_lot](https://github.com/Amanieu/parking_lot) from 0.11.2 to 0.12.0.
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.11.2...0.12.0)

---
updated-dependencies:
- dependency-name: parking_lot
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Upgrade parking-log in style and layout_thread* as well

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-25 12:19:13 +00:00
Samson
c0bee7cb86
Format toml files (#30112)
* Add taplo fmt config for toml fmt

* fmt toml files

* Add even-better-toml to extensions recommendations
2023-08-17 15:07:43 +00:00
Emilio Cobos Álvarez
9b16626a8f style: Add an input-region-margin to widgets, and implement it on Linux
Recompute the input region when resizing the widget and so on, and use
it to check for rollups.

Depends on D148211

Differential Revision: https://phabricator.services.mozilla.com/D148222
2023-08-16 17:46:41 +02:00
Oriol Brufau
274d273f50 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
b6e8088e8e style: Use ColorMix for interpolated colors in the computed style rather than ComplexColorRatios
This among other things preserves the right color-space when
interpolating currentColor.

Differential Revision: https://phabricator.services.mozilla.com/D147512
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
0ac6aaa357 style: Remove -moz-scrollbar-thumb-proportional
It unconditionally matches on all platforms, so it's not returning any useful information.

Depends on D147689

Differential Revision: https://phabricator.services.mozilla.com/D147690
2023-08-16 17:46:41 +02:00
Mike Hommey
56551bec58 style: Update style to uluru 3.0
Differential Revision: https://phabricator.services.mozilla.com/D147477
2023-08-16 17:46:41 +02:00
Mike Hommey
036b067d65 style: Update style to arrayvec 0.7
Differential Revision: https://phabricator.services.mozilla.com/D147476
2023-08-16 17:46:41 +02:00
Mike Hommey
7bc667f6b4 style: Fix warnings about whitelist/blocklist functions being deprecated in bindgen 0.59
Differential Revision: https://phabricator.services.mozilla.com/D147695
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
c0ecfde11c style: Remove some dead vibrancy code
Drive-by cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D147698
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
6ae56890b3 style: Improve Percentage -> LengthPercentage conversion
This doesn't change behavior because we only use them for images that
have no clamping.

Depends on D147008

Differential Revision: https://phabricator.services.mozilla.com/D147511
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
079fce37d2 style: Do hue interpolations in degrees rather than radians. r=barret
This gives us a bit more precision.

Differential Revision: https://phabricator.services.mozilla.com/D147007
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
bc1845a8f8 style: Fix hue adjustment to match the spec
The value to sum is tau, not pi. This was caught by some tests, see
https://drafts.csswg.org/css-color/#shorter

Differential Revision: https://phabricator.services.mozilla.com/D147006
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
1e5079ca00 style: Fix color-mix() percentage normalization
Differential Revision: https://phabricator.services.mozilla.com/D147005
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
6fc4355dc2 style: Implement more color-mix() color-spaces
We had code to convert between these and the latest draft supports them so...

Differential Revision: https://phabricator.services.mozilla.com/D147004
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
95e9898db4 style: Make the color interpolation code more generic
It's really piece-wise premultiplied interpolation, with a special-case
for hue, so centralize the implementation.

Differential Revision: https://phabricator.services.mozilla.com/D147003
2023-08-16 17:46:41 +02:00