Commit graph

17 commits

Author SHA1 Message Date
Ashwin Naren
be6105a202
wrap tests with #[cfg(test)]
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-05-23 21:37:12 -07:00
Tony
5a76906d64
Allow setting userscripts directly without the need of files (#35388)
* Allow settings userscripts through preferences

Signed-off-by: Tony <legendmastertony@gmail.com>

* mach fmt instead of cargo fmt

Signed-off-by: Tony <legendmastertony@gmail.com>

* Fix pref loading not working for array values

Signed-off-by: Tony <legendmastertony@gmail.com>

* Use pref! in userscripts instead

Signed-off-by: Tony <legendmastertony@gmail.com>

* Implement the model jdm suggested
- Remove userscripts from all places and move it to servoshell
- Add in `UserContentManager` struct and passing it through `Servo::new`
all the way down to script thread

Signed-off-by: Tony <legendmastertony@gmail.com>

* Apply suggestions from code review and format

Signed-off-by: Tony <legendmastertony@gmail.com>

* Revert unrelated change

Signed-off-by: Tony <legendmastertony@gmail.com>

---------

Signed-off-by: Tony <legendmastertony@gmail.com>
Signed-off-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2025-03-27 03:00:08 +00:00
boluochoufeng
1200617683
Fix the parsing error of PrefValue::Array, which is used for the parsing of Preferences shell_background_color_rgba field (#35865)
Signed-off-by: blycf <1355990831@qq.com>
2025-03-10 15:16:11 +00:00
Martin Robinson
0e616e0c5d
api: Flatten and simplify Servo preferences (#34966)
Flatten and simplify Servo's preferences code. In addition, have both
preferences and options passed in as arguments to `Servo::new()` and
make sure not to use the globally set preferences in `servoshell` (as
much as possible now).

Instead of a complex procedural macro to generate preferences, just
expose a very simple derive macro that adds string based getters and
setters.

- All command-line parsing is moved to servoshell.
- There is no longer the concept of a missing preference.
- Preferences no longer have to be part of the resources bundle because
  they now have reasonable default values.
- servoshell specific preferences are no longer part of the preferences
  exposed by the Servo API.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 13:54:06 +00:00
Hayashi Mikihiro
016ff5dfa6
Replace lazy_static crate with std::sync::LazyLock in layout and config (#33065)
* replace in layout_thread_2020

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in layout_thread

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in layout

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in config

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in config_plugins

The macro of config_plugins require Send trait bounds

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-15 16:28:04 +00:00
Martin Robinson
4b63043c6a
clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
Mukilan Thiyagarajan
ee2acaeacf
config: fix panic in PrefValue to [f64; 4] conversion (#32571)
The `Iterator::all` method consumes the input iterator `f` so when
we reuse `f` in `f.flatten().collect()` it yields an empty Vector
in the case where all the elements are successfully converted using
try_into(). This causes out of bounds access when indexing into
the resulting Vector to extract the individual components.

Fixes #32570.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-06-20 08:47:13 +00:00
eri
ef3dad3a61
clippy: fix warnings in components/config* (#31562) 2024-03-08 07:15:56 +00:00
Ngo Iok Ui (Wu Yu Wei)
38a325cc1c
Add shell.background-color.rgba to prefs (#30488)
* Add shell.transparent-background.enabled to prefs

* Rename config to background_color

* Rename to background-color and.rgba add PrefValue::Array variant
2023-10-04 13:16:16 +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
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

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

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Emilio Cobos Álvarez
cb76dbabf4
Remove an unneeded arc reference count bump on each pref access. 2023-06-08 11:09:25 +02:00
Simon Sapin
a0d9f97c8e Fix warnings introduced in newer Rust Nightly
This does not (yet) upgrade ./rust-toolchain

The warnings:

* dead_code "field is never read"
* redundant_semicolons "unnecessary trailing semicolon"
* non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021"
* unstable_name_collisions "a method with this name may be added to the standard library in the future"
* legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
2021-02-25 15:36:03 +01:00
Paul Rouget
479afcfb8e Embedding API: prefs r/w 2020-06-10 09:38:13 +02:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02:00
Simon Sapin
1d38bc0419 Fix some new warnings 2019-06-22 14:59:09 +02:00
Peter Hall
8bfd4dc1e2 #8539 Config preferences backend restructure 2019-03-20 15:01:26 +00:00