Commit graph

25872 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
Oriol Brufau
f0b7f3aca2 Further changes required by Servo 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
Emilio Cobos Álvarez
898cafb5a5 style: Use debug_unreachable!() in matches_simple_selector
This shrinks the function by avoiding generating rather noisy panic
code.

Depends on D145486

Differential Revision: https://phabricator.services.mozilla.com/D145487
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
2302d828a5 style: Reorder some variants
This doesn't make a difference, I was hoping it would allow us to remove the
special-casey code we have here:

  https://searchfox.org/mozilla-central/rev/997a56b018662e2940c99bbaf57a6ac9d1aa5422/servo/components/selectors/matching.rs#610-632

But it doesn't. Still I think it doesn't hurt tho, shouldn't change behavior.

Depends on D145485

Differential Revision: https://phabricator.services.mozilla.com/D145486
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
2939bf1a12 style: Simplify a bit hot selector-matching loop
Note that element.clone() is just copying a couple pointers.

Have a single place where we compute the next element and check for linky-ness.
This saves a couple checks (very very minor win in the micro-benchmark I've
been looking at, but consistent).

Depends on D145484

Differential Revision: https://phabricator.services.mozilla.com/D145485
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
a21762fc5b style: Compute hover / active quirk state lazily
This makes the inner function much smaller which improves selector-matching
performance very mildly for the benchmarks I've been looking at. Also, this
should help selector matching on quirks mode by only doing this when we
actually find :hover / :active pseudo-classes.

Differential Revision: https://phabricator.services.mozilla.com/D145484
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
653245c94e style: Avoid some clone()s in selector parsing now that lifetimes are non-lexical
Differential Revision: https://phabricator.services.mozilla.com/D123622
2023-10-02 14:37:19 +00:00
Martin Robinson
921987048c
Implement pinch zoom with a display list (#30446)
In the most recent version of WebRender, the pinch zoom APIs have been
removed. We can recreate this functionality by creating a root display
list with a transform.
2023-10-02 10:24:16 +00:00
Samson
ddc47aa56b
Codegen support multiple interfaces in single webidl file & WebGPU single webidl (#30448)
* Codegen support multiple interfaces in single webidl file

* Merge GPU*.webidl into WebGPU.webidl

* Update gpu files to use WebGPUBinding module file
2023-09-30 12:30:12 +00:00
Samson
ebd41d4101
Use Foo_Binding instead of FooBinding for namespace modules (#30447)
* Update Codegen.py to emit Foo_Binding instead of FooBinding

* s/FooBinding/Foo_Binding/g
2023-09-30 00:52:04 +00:00
Ennui Langeweile
72313d90df
Make the dir attribute's getter follow the spec (#30435)
* Refactor the `dir` attribute's getter and setter

* Run `./mach fmt`

* disregard all the previous commits
i'm a genius!
2023-09-27 12:31:27 +00:00
Ennui Langeweile
80d9a2bb4f
Treat the keygen element as obsolete (#30429)
* Eradicate the `keygen` element

* Run `./mach fmt`

* Fix relevant Servo test

* Fix outdated manifest
2023-09-26 21:37:46 +00:00
Ennui Langeweile
6f0cba0855
Refactor the translatable attribute lightly (#30430) 2023-09-26 05:05:37 +00:00
Fabrice Desré
38c91b836a
Dedupe ron and base64 (#30415) 2023-09-23 11:30:57 +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
Samson
c9b1f35a36
Update mozjs to a version that includes SpiderMonkey ESR 115 (#30379)
* Update mozjs to sm115

* fix module stuff

https://phabricator.services.mozilla.com/D163949

* fix always allow cloning

https://bugzilla.mozilla.org/show_bug.cgi?id=1774866

* Update expectations

toStringTag now works on wasm object due to SM bump
2023-09-20 16:07:38 +00:00
Mukilan Thiyagarajan
c2502120cf
Fix webgl regression after WebRender upgrade (#30390)
Sending WebRender an explicit ResourceUpdate message
after every buffer swap invalidates the tile caches
that depend on the image resource created for the
webgl canvas.

The previous WebRender code that Servo was using
might have worked with WebGL only accidentally since
picture caching was disabled by [default][1] and so the
tiles were not cached between frames.

Fixes #30367

[1]: c385b3c973/third_party/webrender/webrender/src/renderer.rs (L7073)

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-09-20 13:21:02 +00:00
Samson
8b30d1a4b2
Update to syn 2 where possible (#30387)
* Update to syn 2 where possible

* Cleanups

* Better no_trace comment

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-19 15:57:37 +00:00