Skip to content

Group media data into a struct + add getters/setters for the entire struct - #412

Open
nicoburns wants to merge 29 commits into
servo:mainfrom
nicoburns:better-media-update-api
Open

Group media data into a struct + add getters/setters for the entire struct#412
nicoburns wants to merge 29 commits into
servo:mainfrom
nicoburns:better-media-update-api

Conversation

@nicoburns

Copy link
Copy Markdown
Collaborator

This is aimed at trying to reduce the proliferation of getters/setters for individual media data properties by:

  • Grouping them into a struct
  • Adding getters/setters for the entire struct.

It also (IMO) makes the Device constructor a lot nicer as you get field names rather than having to try to match up function parameter order.

In future we could consider removing the individual getters/setters (or making them private where they are called internally by Stylo), but this PR does not yet do that.

This PR is implemented on top of:

delan and others added 29 commits June 5, 2026 19:26
Any ancestors of this commit are from upstream mozilla-central, with
some filtering and renaming. Our patches and sync tooling start here.

The sync tooling has all been squashed into this commit, based on:
https://github.com/servo/stylo/commits/64731e10dc8ef87ef52aa2fb9f988c3b2530f3a7
This is a rebase of 2453c41

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
The unit of (1 / 2px) is definitely not a px. Right now we disallow
dividing by non-numbers, so enforce it.

Once we implement unit math we could start tracking exponents (and
support something like squared pixels etc).

Differential Revision: https://phabricator.services.mozilla.com/D304694
Servo PR: servo/servo#44978

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
We were previously using a mix of f32 and f64. Then it could happen that
we would first check that `a < b` in f64, but when converting to f32,
they might become equal due to the precision loss. Thus this could break
invariants in the logic, making a `debug_unreachable!()` reachable.

Servo PR: servo/servo#45682

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@abandonedwig.info>
Reverts servo#368

More work is required in Servo to integrate this.
Fixes servo#390

This feature is quite impactful as it is required for Tailwind's hover
styles to work.

Servo PR: servo/servo#45681

Signed-off-by: Nico Burns <nico@nicoburns.com>
…servo#388)

It's not possible to properly calculate these only looking at style,
because the results depends on the used `overflow` value.

Servo PR: servo/servo#45629

Signed-off-by: Martin Robinson <martin@abandonedwig.info>
Fixes a compile warning from servo#388.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Performs some changes so that Servo will be able to use these:
- `ComputedFontWeightRange`
- `ComputedFontStretchRange`
- `ComputedFontStyleDescriptor`

Servo PR: servo/servo#45821

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
The implementation does the same as what gecko does (except that I
didn't add support for `device-aspect-ratio`, hence slightly simpler /
inlined.

Servo PR: servo/servo#45490

---------

Signed-off-by: Martin Robinson <martin@abandonedwig.info>
Co-authored-by: Martin Robinson <martin@abandonedwig.info>
…#400)

This method was performing a single iteration. But most callers want to
perform multiple iterations, so they were calling it in a loop.

So this patch replaces `iterate()` with `iterate_by()`, which takes the
desired number of iterations as a parameter, and returns the actual
number of iterations that were performed.

Servo PR: servo/servo#45978

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
servo#401)

It was only incremented for finite animations, but infinite animations
need to be incremented too.

Servo PR: servo/servo#45990

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Needed for servo/servo#45901

The servo PR is already approved, feel free to merge this immediately.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
I noticed a typo in the README file of the `selectors` library.

Signed-off-by: Vlad Negară <150728638+VladNegara@users.noreply.github.com>
Servo PR: servo/servo#44978

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Transitions can sometimes have 0 duration when the transition reversing
shortening factor is also calculated to be 0. When that happens, we
should always use 1.0 for the progress when calculating the value for
the transition. This avoid division by zero.

Servo PR: servo/servo#46016

Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
It's fine to subtract `n` when the value is `n`, we just don't want to
get negative.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
We were already passing viewport dimensions into Stylo as part of the
`Device` which is sufficient to determine, `width`, `height` and
`orientation`, but we were previously only exposing the `width` to CSS.|

Servo PR: servo/servo#45707

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
Fixes: servo#407

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
I'm implementing this in Blitz, so I would like to enable it here if
possible. Should be low cost/risk for Servo as it's just `u8` bitflags.

Servo PR: servo/servo#46159

Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants