Commit graph

166 commits

Author SHA1 Message Date
Martin Robinson
37695c8c8c
script: Do not set up an IPC route for every image load (#35041)
Instead of setting up a route for every image load in the DOM / Layout,
route all incoming image cache responses through the `ScriptThread`.
This avoids creating a set of file descriptor for every image that is
loaded.

This change requires having the `ImageCache` track the `PipelineId` of
the original the listener so that the `ScriptThread` can route it
properly to the correct `Window`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-25 09:39:04 +00:00
Martin Robinson
7142a96d36
script: Move the FontContext to Window (#34845)
This will allow using layout's `FontContext` in `Window` letting script
manage font selection and download.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-01-07 04:44:31 +00:00
Nico Burns
deb819f233
Upgrade rustc to 1.83 (#34793)
* Upgrade rustc to 1.83

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

* Fix crown (change copied from linked clippy function)

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

* Fix named lifetime lint

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

* Bump shell.nix

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

* Fix non-local impl warnings

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

* Format with 1.83 formatting changes

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

* Fix manual non-local impl

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

* More fixes for crown

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

* Fix tidy

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

* Fix needless_return lints

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

* Fix doc comment lint

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

* Fix missing wait lint

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

* Allow needless_lifetimes lint

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

* more doc comments

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

* More needless_returns

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

* is_empty lint

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

* Fix needless_lifetime lints

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

* fix div_ceil lint

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

* Allow non-minimal bool

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

* Non-local impl in constellation

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

* Missing wait in constellation

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

* fmt

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

* remove useless lints table

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

* Fixup comments

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

* Allow non-local definition in sandboxing code to simplify feature flagging

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

* Remove wait calls and allow zombie_processes lint

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

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-01-01 09:38:28 +00:00
Martin Robinson
226299380d
script: Make timers per-process (#34581)
Before all timers were managed by the Constellation process, meaning
that they had to trigger IPC calls to be scheduled and fired. Currently,
timers are only used in the `ScriptThread`, so it makes sense that they
are per-process.

This change restores the timer thread functionality that existed before
avoided entirely. Completion is done using a callback that is sent to
the timer thread similarly to how fetch is done. This allows reusing the
existing task queue without making any new channels.

Fixes #15219.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-12-24 09:53:35 +00:00
Martin Robinson
471d3572b7
script: No longer do explicit reflows for display (#34599)
These all happen now in *update the rendering*, typically after the
message that triggered this code is processed, though in two cases
reflow needs to be triggered explicitly. This makes `ReflowReason`
redundant though perhaps `ReflowCondition` can be expanded later to give
more insight into why the page is dirty.

- Handling of the "reflow timer" concept has been explained a bit more via
  data structures and rustdoc comments.
- Theme changes are cleaned up a little to simplify what happens during
  reflow and to avoid unecessary reflows when the theme doesn't change.

Notably, layout queries and scrolling still trigger normal reflows and
don't update the rendering. This needs more investigation as it's
unclear to me currently whether or not they should update the rendering
and simply delay event dispatch or only reflow.

In general, this is a simplfication of the code.

Fixes #31871.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-12-13 13:25:47 +00:00
Nico Burns
a4caa0efcb
Implement MallocSizeOf for markup5ever rather than xml5ever. (#34403)
The QualName type which MallocSizeOf is implemented for is a markup5ever
type which is re-exported in both html5ever and xml5ever.

Signed-off-by: Nico Burns <nico@nicoburns.com>
2024-11-27 01:21:41 +00:00
Martin Robinson
a3c2471344
Fork Stylo's malloc_size_of into Servo (#34332)
This is unfortuante, but it's the only way to stop making Stylo's
`malloc_size_of` depend on so many of Servo's dependencies. This is an
important step on the way toward releasing Stylo as standalone software.
When possible, we defer to the implementation of `MallocSizeOf` that is
in the base class.

One benefit of this change is that we start properly measure the size of
WebRender types, which before were always set to zero.

In addition the `Measurable` class is removed in favor of simply
manually implementing `MallocSizeOf`, which doesn't require
uncomfortably modifying the shape of data structures.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-11-22 14:57:55 +00:00
Delan Azabani
faf754dfa6
Move Stylo to its own repo (#31350)
* Remove packages that were moved to external repo

* Add workspace dependencies pointing to 2023-06-14 branch

* Fix servo-tidy.toml errors

* Update commit to include #31346

* Update commit to include servo/stylo#2

* Move css-properties.json lookup to target/doc/stylo

* Remove dependency on vendored mako in favour of pypi dependency

This also removes etc/ci/generate_workflow.py, which has been unused
since at least 9e71bd6a70.

* Add temporary code to debug Windows test failures

* Fix failures on Windows due to custom target dir

* Update commit to include servo/stylo#3

* Fix license in tests/unit/style/build.rs

* Document how to build with local Stylo in Cargo.toml
2024-02-27 15:39:06 +00:00
Delan Azabani
f60e5e767b
Revert remaining Stylo changes (#31408)
* Revert remaining changes from Stylo split-into-commits branch

* Do the minimum amount of formatting to appease mach test-tidy
2024-02-22 09:56:26 +00:00
Delan Azabani
aeb2503fdb
style: Reduce diff with upstream derive_common and malloc_size_of (#31363) 2024-02-16 10:24:35 +00:00
Auguste Baum
9654363c18
script: Start replacing time with std::time and chrono (#30639)
* Replace `time` with `chrono` in `script/animation_timeline`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/script_thread.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` and `chrono` in `script/script_thread.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/script_runtime.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/script_runtime.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/dom/workerglobalscope.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `chrono` in `script/dom/workerglobalscope.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/dom/htmlmedialelement.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/dom/htmlmedialelement.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/dom/globalscope.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `chrono` in `script/dom/globalscope.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/dom/htmlformelement.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Replace `time` with `std::time` in `script/dom/htmlformelement.rs`

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>

* Increase precision of animation timeline

* Some fixes

Use Instant a bit more and stop using chrono. Do not transition
`navigation_start_precise` to Instant yet as we need to coordinate this
across all crates.

---------

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-01-16 12:23:18 +00:00
Taym Haddadi
92196d985d
Replace time with std::time in components/metrics & components/shared (#31020) 2024-01-10 19:23:47 +00:00
Emilio Cobos Álvarez
ad72081ac8 style: Rustfmt servo/. r=zrhoffman
$ find servo -name '*.rs' | xargs rustup run nightly rustfmt

Depends on D179380

Differential Revision: https://phabricator.services.mozilla.com/D179381
2023-11-24 08:57:14 +01:00
Oriol Brufau
d74a16d2ed Disable formatting for malloc_size_of, servo_arc, to_shmem 2023-11-21 15:36:35 +01:00
Oriol Brufau
b844a4e992 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
0709e13446 style: Allow to use ThinVec/nsTArray in the style crate
This allows to clean-up the previous patches by using a single ThinVec
(which stores length / capacity along with the allocation).

Differential Revision: https://phabricator.services.mozilla.com/D175029
2023-11-21 15:36:35 +01:00
David Shin
3756e3b027 style: :has relative selector matching, with no caching/filtering
Differential Revision: https://phabricator.services.mozilla.com/D172019
2023-11-21 15:36:35 +01:00
David Shin
f7b29ac432 style: Parsing for relative selectors in :has()
Differential Revision: https://phabricator.services.mozilla.com/D171358
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
29c6094c80 style: [css-nesting] Parse parent selector
This parses the ampersand as a parent selector behind an
(off-by-default) selectors feature.

The plan is to call replace_parent_selector while we're doing the
CascadeData rebuilds, which is where we can have all the ancestor
nesting information.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D167237
2023-11-06 09:35:57 +01:00
Zach Hoffman
1c8408e97e style: Implement parsing and serialization for nth-child(An+B of selector list) and :nth-last-child(An+B of selector list)
:nth-{,last-}child parsing is disabled by default for now by pref
layout.css.nth-child-of.enabled.

Differential Revision: https://phabricator.services.mozilla.com/D165895
2023-11-04 08:17:09 +01:00
Zach Hoffman
211761ad88 style: Represent FirstChild, FirstOfType, LastChild, LastOfType, OnlyChild, and OnlyOfType as functionless Nth variants
Like bug 1808226, this doesn't change any behavior, it just simplifies matching.

I also added a WPT JavaScript test for :only-of-type, since dedicated WPT
JavScript tests already exist for the other pseudo-classes this patch
touches.

Differential Revision: https://phabricator.services.mozilla.com/D165859
2023-11-04 08:17:09 +01:00
Zach Hoffman
281ae0748f style: Store values for :nth- selectors in dedicated struct NthSelectorData
To accomplish this, all :nth- Components were replaced with type Nth,
which uses NthSelectorData.

Using NthSelectorData will make it easier to add selector lists for :nth
selectors later on, but this change by itself shouldn't change any
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D165831
2023-11-04 08:17:09 +01: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
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
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Martin Robinson
a9d37cb85a
Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)
* Upgrade vendored version of WebRender

* Patch WebRender: upgrade version of gleam

* Restore hit testing implementation

* Fix WebRender warnings

* Adapt Servo to new WebRender

* Update results

* Add a workaround for #30313

This slightly expands text boundaries in order to take into account the
fact that layout isn't measuring glyph boundaries.
2023-09-10 12:38:56 +00:00
Samson
e0a6281e73
Impl Setlike and Maplike (#30237)
* MallocSizeOf for Index{Set, Map}

* like as iterable in WebIDL

* Codegen magic for like interfaces

* TestBinding for like

* Test for Setlike and Maplike test bindings

* Some fixes

* Switch to any.js

* nit

* Keep order
2023-09-06 13:08:45 +00:00
Martin Robinson
3230162fd0
Try to use WebRender types more
The newer versions of WebRender move types around between `webrender` and
`webrender_api` and this will reduce the churn during the upgrade.
2023-07-10 17:35:50 +02:00
Martin Robinson
49277f5c3f
Vendor the current version of WebRender
This is a step toward upgrading WebRender, which will be upgraded and
patched in the `third_party` directory. This change vendors the current
private branch of WebRender that we use and adds a `patches` directory
which tracks the changes on top of the upstream WebRender commit
described by third_party/webrender/patches/head.
2023-07-03 17:55:17 +02:00
Emilio Cobos Álvarez
5b62f66f6e style: Remove ThinBoxedSlice
The only remaining consumers are ::-moz-tree pseudo-elements (we used to
use ThinBoxedSlice for other data structures in the past).

Those are not particularly performance sensitive so I think just
double-boxing is fine. In the future, if we wanted to avoid the double
indirection, we could probably use the "thin" crate
(https://docs.rs/thin) or similar, which stores the length of the slice
along with the allocation, making the pointer thin in all
configurations, much like "ThinArc" does:

  https://searchfox.org/mozilla-central/rev/1ce2eea39442190a71a1f8f650d098f286bf4a01/servo/components/servo_arc/lib.rs#891

In practice though, I don't think it's particularly worth it for this
specific case.

Differential Revision: https://phabricator.services.mozilla.com/D134672
2023-06-09 10:22:25 +02:00
Emilio Cobos Álvarez
2b6fce1e57 style: Remove servo/components/{hashglobe,fallible} in favor of try_reserve
Differential Revision: https://phabricator.services.mozilla.com/D134194
2023-06-09 10:22:24 +02:00
Martin Robinson
2f4c47bfe7 Start the transition to workspace dependencies
This will ultimately make it simpler to update crate dependencies and
reduce duplicate when specifying requirements. Generally, this change
does not touch dependencies that are only used by a single crate. We
could consider moving them to workspace dependencies in the future.
2023-05-17 11:59:35 +02:00
Fabrice Desré
fec4c589b2 Switch to the sha2 crate for SRI digests.
This removes one (simple) use of OpenSSL
2023-02-24 18:38:06 -08:00
sagudev
9c2cc05a8e Upgrade remaining components to edition 2018 2023-02-18 09:42:37 +01:00
Federico Mena Quintero
8a0810ee74 */Cargo.toml: use the shmem feature for the dependency on the selectors cratre 2023-02-14 13:05:59 -06:00
Martin Robinson
423cc34cb0 Bump euclid to 0.22
- Also updates raqote to latest with an upgrade of font-kit to 0.11
  applied on as a patch
- Update lyon_geom to the latest version

Major change:

- All matrices are now stored in row major order. This means that
  parameters to rotation functions no longer should be negated.
- `post_...()` functions are now named `then()`. `pre_transform()` is removed,
  so `then()` is used and the order of operations changed.
2023-01-26 08:59:21 +01:00
Alex Touchet
9822075277 Use SPDX license format 2022-10-10 15:48:05 -07:00
Josh Matthews
0625ab92b8 Update cookie/hyper_serde. 2022-04-01 02:11:51 -04:00
Josh Matthews
9eaa27c946 Update html5ever/xml5ever. 2022-04-01 01:43:26 -04:00
Josh Matthews
471650ba90 Update keyboard-types. 2022-04-01 00:35:22 -04:00
Naveen Gattu
a48a111cee Upgrade Hyper 2022-01-16 09:34:17 -08:00
Naveen Gattu
903e0cd857 Non-blocking network IO 2021-12-23 11:16:24 -08:00
Lewin Probst
976f5b76bc Updated cssparser dependency to 0.29.
Signed-off-by: Lewin Probst <info@emirror.de>
2021-11-18 16:16:46 +01:00
teymour-aldridge
5b2cd844d7
Bump time to latest v0.1.x version. 2021-06-25 17:19:14 +01:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
Nicolas Silva
1f36216b59 style: Update euclid in stylo.
Differential Revision: https://phabricator.services.mozilla.com/D85762
2021-02-26 16:44:05 +01:00
Kunal Mohan
ce6e09a3aa Change ErrorScopeId type to NonZeroU64
And extract it from WebGPURequest
2020-08-03 01:45:29 +05:30
Paul Rouget
7653c6c9fc update keyboard-types crate 2020-06-29 10:27:54 +02:00