Commit graph

118 commits

Author SHA1 Message Date
Alex Touchet
5a0332f57e
Cargo.toml cleanup (#39403)
Cargo.toml cleanups. Mostly ordering fixes.

Testing: No tests for Cargo.toml edits.

---------

Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
2025-09-20 03:09:37 +00:00
Narfinger
84465e7768
Removed FnvHash and transformed the rest to FxHashmap (#39233)
This should be the final PR for the Hash Function series that is
trivial.

Of note: I decided to transform `HashMapTracedValues<Atom,..>` to use
FxBuildHasher. This is likely not going to improve performance as Atom's
already have a unique u32 that is used as the Hash but it safes a few
bytes for the RandomState that is normally in the HashMap.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Hash function changes should not change functionality, we
slightly decrease the size and unit tests still work.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-09-10 13:34:54 +00:00
Simon Wülker
fcf4beeac0
Seperate freetype face and named instance indices (#39213)
In servo, each `LocalFontIdentifier` has an `fn index() -> u32`, which
returns the index of the font within the font file in case it is a font
collection (`.ttc` instead of `.ttf`). The way this index is obtained is
platform-dependent.

On systems using `fontconfig`, we get the index by querying `FC_INDEX`:


d2c78db981/components/fonts/platform/freetype/font_list.rs (L109-L112)

There is a sneaky bug here: In addition to the aforementioned face
index, the value for `FC_INDEX` contains the index of the named instance
of the face in the upper 16 bits. This behaviour is completely
undocumented, but FreeType uses the same format:
https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_open_face.

This wasn't a problem for the longest time, because the only consumer of
the `index` value coming from fontconfig was FreeType. However, sometime
after
29e618dcf7,
we started also passing it to`read-fonts` . `read-fonts` expects only
the face index, causing it to return errors as seen in
https://github.com/servo/servo/issues/39209.

The fix is to seperate the two indices when storing them in a
`LocalFontDescriptor` and pass only the lower 16 bits to `read-fonts`.
I'm unsure whether we should continue passing the named instance index
to FreeType since we don't actually support variable fonts, but I've
opted to keep the current behaviour for now.

Fixes: https://github.com/servo/servo/issues/39209

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-08 22:29:33 +00:00
Euclid Ye
ff8be71335
font: Remove unused FontTable constructor for Windows (#39130)
#39112 restricts accessibility for some font functions, exposing some
functions that haven't been used for a long time. Now it is detected by
Lint as dead code.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-09-04 06:25:59 +00:00
Simon Wülker
73e39cf085
fonts: Reduce the public API surface (#39112)
This change marks all items that are not used by other crates as
`pub(crate)` instead of `pub`.

Additionally, I've removed all code that turned out to be unused. I
think most of it was used only by `layout-2013`.


Testing: The correctness of these changes is verified by the compiler,
so no tests are needed.

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-09-03 20:15:51 +00:00
Darryl Pogue
89e1357c75
fonts: Use Helvetica as the system-ui font on macOS (#39001)
Helvetica isn't quite right but it's a better default choice than a
monospaced font like Menlo (it should be some variant of Apple's San
Francisco font, but that isn't easily exposed)

Testing: Untested, but matches the font family used for `sans-serif` so
it should be safe

Signed-off-by: Darryl Pogue <darryl@dpogue.ca>
2025-08-29 11:20:39 +00:00
Jonathan Schwender
32aba08be7
Port StorageThreadMsg to GenericChannel (#38932)
This change includes the following additions to GenericChannel:
- Add a GenericSend trait which is meant to replace the `IpcSend` trait
over time, as channels are migrated. For the time being this means, that
we often need to use `GenericSend::send()` to disambiguate from the
`IpcSend::send` function, until all usages of `IpcSend` have been
replaced.
- Add an OpaqueSender impl for GenericSender
- Add a profiled version of GenericChannel. The profiling is 1:1 the
same as for the existing profiled IPC channel, namely that only the
blocked time during `recv` is measured.


Testing: No functional changes, covered by existing tests
Part of #38912

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-08-27 01:58:43 +00:00
Martin Robinson
4f68508624
script: Move FontContext from Window to GlobalScope (#38918)
This change makes it so that every `GlobalScope` can contain an optional
`FontContext`. This will be necessary for every `GlobalScope` that
accesses canvas. Currently, `FontContext` is created and accessed via
the canvas worker thread, but this means that web fonts are not
available to canvas. This change will eventually make it possible for
canvas to share web fonts with the `Document` that owns them.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-26 15:56:50 +00:00
Martin Robinson
3a97d4eed2
fonts: Add more types to fonts_traits (#38898)
This is necessary so that `constellation_traits` can get these types via
a
dependency on `fonts_traits`. This will allow sending IPC channels to
shared
workers so that they can have access to a shared `FontContext` from
`script`.

Testing: This just moves code between crates, so is covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-24 19:36:59 +00:00
Nico Burns
1fc857865f
Use Tag type from font-types crate to represent opentype tags (#38870)
The `font-types` crate is the tiny type-only base crate of `fontations`.
This uses a strongly typed representation of open type tags, and allows
us to remove our custom macro for creating them.

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-08-23 20:32:47 +00:00
Martin Robinson
bf5da330e1
fonts: Stop using deprecated functions in dwrote (#38856)
The new version of the functions return `Result` types.

Testing: No tests because this should not change behavior.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-22 16:28:54 +00:00
Martin Robinson
777373054f
fonts: Use fontations to read the OS/2 table of DirectWrite fonts (#38851)
Instead of copying the font table data in memory and parsing it with the
`truetype` crate, use a non-copying API from DirectWrite to implement a
`fontations` `TableProvider`. This has two benefits:

- We remove the dependency on the `truetype` crate finally.
- We do not have to make an in-memory copy of the table data when
  parsing the table.

The hope is that the `TableProvider` will be more generally useful in
the future.

Testing: There are no automated tests for Windows, but I manually
verified
that the data retrived via `fontations` matched that retrived by
`truetype`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-22 16:23:35 +00:00
Martin Robinson
2ac8665e03
fonts: Add font variations support for Windows (#38831)
Unlike other platforms where we read the default axis values and combine
it with variations from style to make the font face, we set the
variations from the style when creating the font face and then read the
final variations from the face. It seems that DirectWrite does the
normalization of variation values internally.

This depends on servo/dwrote-rs#68.

Testing: We currently don't have tests for Windows, but variation
support is
covered by the WPT tests.
Fixes: This is part of #38800.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-22 11:10:17 +00:00
Martin Robinson
16ba172ba8
fonts: Add support for format(*-variations) to @font-face (#38832)
This is necessary to fully support font variations.

Testing: This will be tested once variations are enabled.
Fixes: This is part of #38800.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-22 09:25:19 +00:00
Nico Burns
b18a65ed70
Shaper abstraction setup (#38755)
# Objective

- Reorganise Servo's shaper code in preparation for multiple shaping
backends
- Make it possible to keep https://github.com/servo/servo/pull/38707
up-to-date with `main` with minimal conflicts

## Changes made

- Split `components/fonts/shaper.rs` into
`components/fonts/shapers/mod.rs` and
`components/fonts/shapers/harfbuzz.rs`
- Add traits for generic shapers
- `ShapedGlyphData` now takes ownership of the HarfBuzz buffer
(`hb_buffer_t`). This allows it to be returned from
the`THarfShaper::shape_text` function. The buffer is now deallocated in
the `ShapedGlyphData`s `Drop` impl.
- Add traits for HarfBuzz-like shapers and move code from
`save_glyph_results` function to be generic over those traits so that it
can be shared by a future `HarfRust` backend.

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-08-21 20:44:39 +00:00
Martin Robinson
2022831e4f
fonts: Add font variation support for macOS (#38760)
This change adds font variation support for macOS. The main bulk of the
change is reading the default, min, and max values for each variation
axis from the font and instantiating a new CoreText font with the
appropriate values. 

In addition, fonts with variations are now properly cached in the
CoreText font cache.

Testing: There are no tests for this change as we do not run WPT tests
for
macOS and font variations are currently turned off by default.
Eventually,
when the feature is turned on there will be test for it. These changes
are just laying the groundwork for the full implementation.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-19 15:12:48 +00:00
Nico Burns
39629560c8
Fix loading raw data from .ttc files on macos (#38753)
# Objective

Ensure that functionality which uses the raw font data (such as
rendering text to canvas) works correctly on macOS when the specified
font is a system font that lives in an OpenType Collection (`.ttc`)
file.

## Changes made

- The `read_data_from_file` in each backend now returns a `index: u32`
in addition to `data: Vec<u8>`
- The `data` field on the `Font` type has been renamed to `raw` and the
`data` method on the `Font` type has been renamed to `raw_font`. This
allows the index to be cached as computing is moderately expensive on
macOS (on the order of 100 microseconds).
- Both of the above now store/return a `struct RawFont` instead of a
`FontData` where `RawFont` is defined as `struct RawFont { data:
FontData, index: u32 }`.
- The users of the `data` method have been updated to use the cached
index from `data` rather than calling `.index()` each time.

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-08-19 11:57:48 +00:00
webbeef
3225d19907
cargo: Bump rustc to 1.89 (#36818)
Update Rustc to 1.89.

Reviewable by commit.

Leftover work:
- #37330 
- #38777

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-08-19 11:07:53 +00:00
Simon Wülker
7471ad7730
fonts: Implement CSS font-variation-settings property for FreeType platforms (#38642)
This change adds support for variable fonts via the
[`font-variation-settings`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variation-settings)
property.

There are three areas where we need to set the variation values:
* Webrender (`compositor.rs`), for drawing the glyphs
* Harfbuzz (`shaper.rs`), for most shaping tasks
* PlatformFont (`fonts/platform/`), for horizontal advances and kerning

For now, freetype is the only platform shaper that supports variable
fonts. I can't easily test the fonts with non-freetype shapers. Thats
why variable fonts are behind the `layout_variable_fonts_enabled` pref,
which is disabled by default.

<img width="1250" height="710" alt="image"
src="https://github.com/user-attachments/assets/1aee1407-f3a2-42f6-a106-af0443fcd588"
/>

<details><summary>HTML test file</summary>

```html
<style>
@font-face {
  font-family: "Amstelvar VF";
  src: url("https://mdn.github.io/shared-assets/fonts/variable-fonts/AmstelvarAlpha-VF.woff2")
    format("woff2-variations");
  font-weight: 300 900;
  font-stretch: 35% 100%;
  font-style: normal;
  font-display: swap;
}

p {
  font:
    1.2em "Amstelvar VF",
    Georgia,
    serif;
  font-size: 4rem;
  margin: 1rem;
  display: inline-block;
}

.p1 {
  font-variation-settings: "wght" 300;
}

.p2 {
  font-variation-settings: "wght" 625;
}

.p3 {
  font-variation-settings: "wght" 900;
}

</style>
<div>
  <p class="p1">Weight</p>
  <span>(font-variation-settings: "wght" 300)</span>
</div>
<div>
  <p class="p2">Weight</p>
  <span>(font-variation-settings: "wght" 625)</span>
</div>
<div>
  <p class="p3">Weight</p>
  <span>(font-variation-settings: "wght" 900)</span>
</div>
</div>
```
</details>



https://github.com/user-attachments/assets/9e21101a-796a-49fe-b82c-8999d8fa9ee1


Testing: Needs decision on whether we want to enable the pref in CI
Works towards https://github.com/servo/servo/issues/37236

Depends on https://github.com/servo/stylo/pull/230

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-08-18 16:30:14 +00:00
Martin Robinson
5c885d61ad
fonts: Have CoreTextFontCache::core_text_font return a PlatformFont (#38758)
This will make it easier in a followup to include the normalized font
variations in the return value. This also make
`PlatformFont::ensure_h_kern_subtable` work on the instance instead of
being a struct method. Finally, all `PlatformFont` methods are combined
into a single impl block.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-08-18 12:32:20 +00:00
Nico Burns
7dcd89a6f9
Use built-in conversion function from unicode_script to convert script for harfbuzz (#38704)
Replaces a big match statement with a call to `unicode_script`'s
`Script::short_name` method which has the same big match statement. We
special case `Script::Unknown` because the `short_name` method returns
empty string for that variant, but harfbuzz represents it with `Zzzz`.

EDIT: `Zzzz` seems to be in the spec so I've sent a PR to
`unicode_script` to use it:
https://github.com/unicode-rs/unicode-script/pull/23
EDIT: And https://github.com/unicode-rs/unicode-script/pull/24 which
would allow us to remove this method entirely.

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-08-18 08:16:29 +00:00
Simon Wülker
e19fade481
Replace FreeTypeFaceHelpers with a safe wrapper struct (#38634)
Testing: only safety annotations change, no tests are required.
Fixes: https://github.com/servo/servo/issues/38627

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-08-17 21:46:16 +00:00
Josh Matthews
9da8142e2a
fonts: Measure more FontContext heap usage. (#38733)
Replace a hand-written MallocSizeOf implementation with an automatically
derived one. This exposes more than 1MB of previously-untracked heap
data on servo.org.

Testing: Compared about:memory output for servo.org before and after.
Part of: #11559

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-08-17 18:59:30 +00:00
Nico Burns
046dbd86a1
fonts: Use skrifa to get raw font table data on Linux (#38690)
Use skrifa instead of freetype for extracting raw table data. Allows us
to replace unsafe Freetype code with safe Skrifa code. Also allows us to
avoid copying the table data. Instead we return Arc'd data.

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-08-15 11:30:29 +00:00
Simon Wülker
dac34c0dfd
fonts: Unify letter-spacing/word-spacing implementations for harfbuzz and fast path (#38657)
Servo two shapers: harfbuzz and a "fast path" for simple cases that
don't have kerning or substitution tables. Both currently implement
`letter-spacing` and `word-spacing` seperately. Theres also a slight
difference, harfbuzz will apply word spacing to preserved newlines and
the fast path won't.

This change unifies the two implementations.

Testing: Covered by existing tests

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-08-13 18:55:28 +00:00
Gregory Terzian
70be996a29
net: Remove CoreResourceThread from FetchThread state (#38422)
In single process mode, there is a race condition on the initialization
of the global fetch thread: once initialized the global fetch thread
will always use a given core resource thread, and this will be
determined by the component who first initializes it. For example, if
the canvas paint thread first does an async fetch, then this will set
the public core resource as used for all future fetches, including those
coming from a pipeline in private mode.

In multi-process mode, there is a race condition per window event-loop:
the first pipeline to use the fetch will set the core resource thread
for all others.

To ensure the fetch thread uses the correct core resource thread(private
vs public), we need to
pass the core resource thread to each fetch thread operation for which
is it needed.

Testing: It should not break existing fetch WPT tests. The race
condition is not something that can be tested reliably, but it seems to
be based on solid logic.
Fixes: follow-up from
https://github.com/servo/servo/pull/38421/files#r2248950924

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-08-13 17:40:10 +00:00
Simon Wülker
abc549eff7
Reduce the size of some unsafe blocks in shaper.rs (#38597)
This change ensures that safe operations are done outside of unsafe
blocks as often as possible.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-08-11 13:39:07 +00:00
Gregory Terzian
b23cf9c6cd
net: clean shutdown of fetch thread (#38421)
The fetch thread is currently not shut down, meaning it is one of the
threads counted in the "threads are still running after shutdown (bad)"
counter shown when Servo has shut-down.

This PR introduces a mechanism to start, and shut-down, one fetch thread
per process that requires one.

Testing: WPT tests and unit tests(for font context). Also manually
tested loading and closing "about:blank": this change indeed brings down
the count of threads still running after shutdown by one.

Fixes: https://github.com/servo/servo/issues/34887

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-08-07 09:01:30 +00:00
Narfinger
6ace7ad577
OHOS: Clean up some compile warnings (#38240)
This cleans up some compile warnings about unused functions.

Testing: Does not change functionality, OHOS and Linux still compile
(hopefully the other builds too).

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-07-24 03:29:49 +00:00
Narfinger
4d35b69ffe
Clean up unused dependencies / features and centralize more feature selection into root Cargo.toml (#37720)
- Make feature flag of smallvec global.
- Removed unused dependency of thinvec.
- Removed unused flag of hyper-util.

Reduces the binary size by an astonishing 3.352k.

Testing: Compilation 'tests' this change.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-26 11:56:48 +00:00
Ashwin Naren
ed9a79f3f4
Initial IndexedDB Support (#33044)
Adds indexeddb support to servo. At the moment heed is being used as the
backend, although this can be swapped out by implementing `KvsEngine`.
This PR adds a thread + a thread pool for Indexeddb related operations.
Also `database_access_task_source` is added for Indexeddb related
operations.

This is a partial rewrite of #25214. (Reopened due to branching issue)

Fixes #6963

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Rasmus Viitanen <rasviitanen@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-06-19 05:19:07 +00:00
Bhuwan Pandit
04bcafa140
chore: Simplify tracing with servo_tracing macro (#36661) (#37497)
This pull request refactors existing tracing annotations to leverage the
new `servo_tracing::instrument` macro introduced in #36573.

Specifically, the following transformations were applied:
- Removed `#[cfg_attr(feature = "tracing", ...)]` wrappers.
- Replaced `tracing::instrument` with `servo_tracing::instrument`.
- Removed `level = "trace"`
- Removed `fields(servo_profiling = true)` from tracing attributes
however retained others like `name`. `skip type`

Closes: #36661

---------

Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
2025-06-18 16:18:04 +00:00
Narfinger
6159a11905
OHOS: Fixed some clippy lints (#37510)
Fixed some clippy lints which were in the OHOS code.

Testing: Normal testcases apply and changes are trivial.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-17 14:09:37 +00:00
Martin Robinson
29e618dcf7
fonts: Start using fontations to read font tables (#37287)
Use `read-fonts` to read font tables for FreeType fonts. This is the
first step to using fontations throughout Servo. The main benefit here
is that we no longer need to provide our own table data structures and
we can read tables from these fonts without making copies of the table
contents.

Testing: This should not change observable behavior and is covered by
existing WPT tests. I have run some manual microbenchmarks and have not
noticed any changes in performance that are larger than the general
noise.
This adds a new memory map of the font file for local fonts, but this
should be very cheap as FreeType is already doing this internally and
subsequent maps should just reuuse the existing memory-mapped file.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-16 11:29:50 +00:00
Ashwin Naren
cebb1619ae
chore: fix warnings for Windows-specific fonts code (#37063)
Fix warnings from `components/fonts/platform/windows/font.rs` and
`components/fonts/platform/windows/font_list.rs` due to deprecations
from dwrote.

Testing: none, should behave as it did before

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-05-21 16:30:43 +00:00
Martin Robinson
639eb7bc55
fonts: Fix calculation of font underline thickness on macOS (#37029)
There was a typo in how underline thickness (in pixels) was converted
to app units. It was interpreting the pixel value as an f64 app unit
value, which meant that the resulting thickness was 1/60 of the value
expected.

Testing: macOS does not currently run WPT tests, so it is difficult to
test
this one. I have manually confirmed that underlines now show up and are
the
expected thickness.
Fixes: #36945

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-05-16 18:23:02 +00:00
Josh Matthews
ba8f923201
Various memory measurement improvements (#36834)
The two significant changes here are 1) a commit that frees memory used
to perform memory reporting once the reporting is complete, 2) memory
reporting for the system font service. There are various other commits
that remove `#[ignore_malloc_size_of]` attributes for data that we are
now able to measure, but they do not significantly change our
measurements when testing servo.org.

Testing: Comparing the output of about:memory on servo.org.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-07 04:00:12 +00:00
Josh Matthews
c787688afc
layout: Report memory usage for fragment and box trees. (#36553)
Add memory reporter integration for the fragment and box trees that are
persisted in the layout thread.

Testing: Looked at the numbers for https://servo.org and
https://html.spec.whatwg.org/. The former was very small, but the latter
was 700mb.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-04-18 20:05:15 +00:00
Tim van der Lippe
85e4a2b5c7
Update FetchTaskTarget to propagate CSP violations. (#36409)
It also updates the FetchResponseListener to process CSP violations to
ensure that iframe elements (amongst others) properly generate the CSP
events. These iframe elements are used in the Trusted Types tests
themselves and weren't propagating the violations before.

However, the tests themselves are still not passing since they also use
Websockets, which currently aren't using the fetch machinery itself.
That is fixed as part of [1].

[1]: https://github.com/servo/servo/issues/35028

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-04-13 20:54:59 +00:00
Martin Robinson
0caa271176
compositing: Combine webrender_traits and compositing_traits (#36372)
These two traits both exposed different parts of the compositing API,
but now that the compositor doesn't depend directly on `script` any
longer and the `script_traits` crate has been split into the
`constellation_traits` crate, this can be finally be cleaned up without
causing circular dependencies. In addition, some unit tests for the
`IOPCompositor`'s scroll node tree are also moved into
`compositing_traits` as well.

Testing: This just combines two crates, so no new tests are necessary.
Fixes: #35984.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-06 17:34:18 +00:00
Alex Touchet
1aac377e62
Organize component Cargo.toml dependencies (#36224)
Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
2025-03-30 19:03:54 +00:00
Nico Burns
cee84c824f
Upgrade to Stylo e941241 (#36120)
* Upgrade to Stylo e941241

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Make test less fragile

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-03-25 10:45:40 +00:00
Oriol Brufau
4acaa08cf5
Cleanup Stylo dependencies (#36046)
Now that Stylo considers `servo` as the default feature, Servo doesn't
need to specify `features = ["servo"]`.

Also use the same crate names as Stylo, rather than renaming them with
`package`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-03-19 08:53:26 +00:00
Simon Wülker
bb0d08432e
Migrate to the 2024 edition (#35755)
* Migrate to 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Allow unsafe_op_in_unsafe_fn lint

This lint warns by default in the 2024
edition, but is *way* too noisy for servo.

We might enable it in the future, but not now.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Compile using the 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-13 10:28:11 +00:00
Nico Burns
f527217bdc
Use new stylo crate renames (#35898)
Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-03-12 00:02:12 +00:00
Oriol Brufau
0d0bcdeb4d
Upgrade Stylo to 2025-03-01 (#35782)
* Upgrade Stylo to 2025-03-01

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Fixup for https://phabricator.services.mozilla.com/D236733

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Update test expectations

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

---------

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-03-04 00:19:46 +00:00
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-03 11:26:53 +00:00
Martin Robinson
f949d2adc8
fonts: Remove the per-FontGroup cached fallback font (#35705)
Instead of keeping a per-FontGroup cache of the previously used fallback
font, cache this value in the caller of `FontGroup::find_by_codepoint`.
The problem with caching this value in the `FontGroup` is that it can
make one layout different from the next.

Still, it is important to cache the value somewhere so that, for
instance, Chinese character don't have to continuously walk through the
entire fallback list when laying out. The heuristic here is to try to
last used font first if the `Script`s match. At the very least this
should make one layout consistent with the next.

Fixes #35704.
Fixes #35697.
Fixes #35689.
Fixes #35679.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-28 14:33:21 +00:00
Martin Robinson
0e85d9f30a
clippy: Fix a couple clippy warnings on macOS (#35703)
The new version of rust has more checks trying to prevent mistakes
around order of operations and shifts.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-27 14:16:31 +00:00
Simon Wülker
be6765447d
Update to rust 1.85 (#35628)
* Update to rust 1.85

This is needed for cargo-deny

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Upgrade crown

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Clippy fixes

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Re-upgrade cargo-deny to 0.18

Keeping it locked to 0.18 just in case they
update their required rustc version again

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-02-24 17:44:35 +00:00