Commit graph

110 commits

Author SHA1 Message Date
Oriol Brufau
1499e2a874
Remove some references to layout 2013 vs layout 2020 (#37007)
We no longer have both layout systems.

Testing: not needed (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-05-14 19:53:48 +00: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
Oriol Brufau
7594dc6991
Remove legacy layout (layout 2013) (#35943)
We were already not compiling it and not running tests on it by default.
So it's simpler to just completely remove it.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-03-13 07:26:57 +00:00
webbeef
aa76847502
Remove obsolete memory profiler console output (#35861)
Signed-off-by: webbeef <me@webbeef.org>
2025-03-08 02:41:08 +00:00
Martin Robinson
54b5c7b632
compositing: Move image output and shutdown management out of the compositor (#35538)
This is a step toward the renderer-per-WebView goal. It moves various
details out of `IOCompositor`.

- Image output: This is moved to servoshell as now applications can
  access the image contents of a `WebView` via
  `RenderingContext::read_to_image`. Most options for this are moved to
  `ServoShellPreferences` apart from `wait_for_stable_image` as this
  requires a specific kind of coordination in the `ScriptThread` that is
  also very expensive. Instead, paint is now simply delayed until a
  stable image is reached and `WebView::paint()` returns a boolean.
  Maybe this can be revisited in the future.
- Shutdown: Shutdown is now managed by libservo itself. Shutdown state
  is shared between the compositor and `Servo` instance. In the future,
  this sharing might be unecessary.
- `CompositeTarget` has been removed entirely. This no longer needs to
   be passed when creating a Servo instance.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
2025-02-20 18:27:49 +00:00
Martin Robinson
118a813dba
servoshell: Move initial_window_size and screen_size_override into ServoShellPreferences from Opts (#35407)
These settings just configure `servoshell` so should be in
`ServoShellPreferences` instead.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-10 20:48:48 +00:00
Martin Robinson
75cf3d7265
dom: Always replace unpaired surrogates when handling page text (#35381)
Background:

> JavaScript strings are potentially ill-formed UTF-16 (arbitrary
> Vec<u16>) and can contain unpaired surrogates. Rust’s String type is
> well-formed UTF-8 and can not contain any surrogate. Surrogates are
> never emitted when decoding bytes from the network, but they can sneak
> in through document.write, the Element.innerHtml setter, or other DOM
> APIs.

In 2015, Servo launched an experiment to see if unpaired surrogates
cropped up in page content. That experiment caused Servo to panic if
unpaired surrogates were encountered with a request to report the page
to bug #6564. During that time several pages were reported with unpaired
surrogates, causing Servo to panic. In addition, when running the WPT
tests Servo will never panic due to the `-Z replace-surrogates` option
being passed by the test driver.

Motivation:

After this 10 year experiment, it's clear that unpaired surrogates are a
real concern in page content. Several reports were filed of Servo
panicking after encountering them in real world pages. A complete fix for
this issue would be to somehow maintain unpaired surrogates in the DOM,
but that is a much larger task than simply emitting U+FFD instead of an
unpaired surrogate.

Since it is clear that this kind of content exists, it is better for
Servo to try its best to handle the content rather than crash as
production browsers should not crash due to user content when possible.
In this change, I modify Servo to always replace unpaired surrogates.

It would have been ideal to only crash when debug assertions are
enabled, but debug assertions are enabled by default in release mode --
so this wouldn't be effective for WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-09 08:56:05 +00:00
Martin Robinson
e227e0913b
servoshell: Move headless setting to ServoShellPreferences (#35377)
This is only used in servoshell, even though it was plumbed through
script previously. It's just about how the `RenderingContext` is set up,
which is something managed entirely outside of servo itself.

In addition, make the name of `servo_shell_preferences` in `app.rs` more
consistent with the rest of the codebase.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-07 20:04:31 +00:00
Shalvin
ec6c4bc8fd
Consolidated opts into a manual Default trait implementation (#35257)
Signed-off-by: Shalvin Deo <shalvin.deo@live.com>
2025-02-01 20:18:09 +00:00
Josh Matthews
90cbb8abdb
config: Derive defaults for Opts. (#35057)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-18 09:23:36 +00:00
Martin Robinson
2d09552234
prefs: Move some DebugOptions to Preferences and clean up (#34998)
- Move options configuring antialiasing and WebRender shader precache to
  the `Preferences` to group them with other related WebRender and DOM
  settings.
- Remove the option to disable antialiasing for canvases. This was
  unused.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-17 11:47:47 +00:00
Martin Robinson
28c9ceedf6
fonts: Remove synchronous web font loading functionality (#35000)
Synchronous web font loading is not specification compliant and was
added in #8341 to work around issues that do not exist any longer. This
change removes the functionality and ensures that WPT tests are run with
the spec compliant loader.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-15 11:16:43 +00:00
Martin Robinson
f5ef8aaed3
config: Remove legacy-layout and unused Preferences and Opts (#34994)
There are some preferences and options that are only used by legacy
layout or not used at all. This PR removes them.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 20:12:14 +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
Martin Robinson
850e59f98e
servoshell: Allow overriding screen resolution with a command-line argument (#34038)
There is a command-line argument to override the default window size,
but not one for overriding the default screen resolution. This is
important for testing pages that use screen size to have different
behavior.

In addition to adding the new option this change:

 - Renames the `--resolution` command-line argument to `--window-size`
   to remove ambiguity with the `--screen-size` argument.
 - Passes the screen size as device independent (device pixels scaled by
   HiDPI factor) to Servo internals. Not only it make it simpler to pass
   the `--window-size` override, it makes more sense. Different screens
   can have different HiDPI factors and these can be different from the
   scale of the window. This makes the screen HiDPI factor totally
   independent of the one that Servo uses for the window.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-10-30 11:54:13 +00:00
Taym Haddadi
ee68dc2589
Support persisting unminified external stylesheets (#33919)
* Support local tweaking of external stylesheets

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Remove duplicated code between unminify_css and unminify_js

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Add License

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Use js-beautify instead of npx

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Fix clippy warning

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-10-30 11:12:20 +00:00
Taym Haddadi
6aaca118a9
Drop support for '--no-minibrowser' mode (#33677)
* Drop support for '--no-minibrowser' mode

Signed-off-by: Taym <haddadi.taym@gmail.com>

* remove unused import

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-10-07 08:00:32 +00:00
Martin Robinson
7b7020a8d4
layout: Enable flexbox by default on non-legacy layout (#33186)
Flexbox is still very much in progress, but things are working well
enough that we can enable it by default. It improves most pages that use
flexbox now.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-26 13:50:52 +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
55f908653f
compositor: Remove the is_running_problem_test setting (#31589)
These tests don't seem to time out any longer and this mechanism is
probably better served by some sort of adjustment to `RUST_LOG` in the
WPT harness.
2024-03-09 02:29:43 +00:00
eri
ef3dad3a61
clippy: fix warnings in components/config* (#31562) 2024-03-08 07:15:56 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
Delan Azabani
afe4faa09a
Fix painting order of atomic inline stacking containers (#30458)
* Sort stacking contexts and stacking containers by painting order

* fix stealing of stacking containers; fix interleaving with fragments

* actually positioned stacking containers should be stolen too

* update expectations and clean up panic changes

* rework naming and docs

* rename s_c_a_p_s_c to real_s_c_a_p_s_c; fix docs

* rename InlineStackingContainer to AtomicInlineStackingContainer

* rework debug logging to use PrintTree

* clean up docs and PrintTree output

* don't panic unless cfg!(debug_assertions) is true

* update expectations
2023-10-06 16:00:00 +00:00
Atbrakhi
c066f6a226
Enable minibrowser by default but also keep the option to disable it (#30338)
* enable minibrowser by default

* review fix

* rename no_minibrowser to no-minibrowser

* review fix
2023-09-13 06:31: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
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
Atbrakhi
3df284cf54
Move user input logic into servoshell (#30238)
* cleanup and move user input logix into servoshell

* fix fmt

* moves test from servoshell file

* move command-line args into servoshell

* remove feature media-gstreamer

* fix fmt

* move user input logic code into lib to make it more testable

* remove opts_matches in fn instead get it from main2

* remove pub and fix import

* add licence in new file

* revert passing Matches, instead pass Option String

* review update, also move sanitize fn to parser file

* fmt fix

* review fix: remove extra line
2023-09-06 11:45:56 +00:00
Martin Robinson
bce7622cde
Switch to rustls and webpki-roots (#30025)
This change replaces OpenSSL with rustls and also the manually curated
CA certs file with webpki-roots (effectively the same thing, but as a
crate).

Generally speaking the design of the network stack is the same. Changes:

- Code around certificate overrides needed to be refactored to work with
  rustls so the various thread-safe list of certificates is refactored
  into `CertificateErrorOverrideManager`
- hyper-rustls takes care of setting ALPN protocols for HTTP requests,
  so for WebSockets this is moved to the WebSocket code.
- The safe set of cypher suites is chosen, which seem to correspond to
  the "Modern" configuration from [1]. This can be adjusted later.
- Instead of passing a string of PEM CA certificates around, an enum is
  used that includes parsed Certificates (or the default which reads
  them from webpki-roots).
- Code for starting up an SSL server for testing is cleaned up a little,
  due to the fact that the certificates need to be overriden explicitly
  now. This is due to the fact that the `webpki` crate is more stringent
  with self-signed certificates than SSL (CA certificates cannot used as
  end-entity certificates). [2]

1. https://wiki.mozilla.org/Security/Server_Side_TLS
2. https://github.com/briansmith/webpki/issues/114

Fixes #7888.
Fixes #13749.
Fixes #26835.
Fixes #29291.
2023-08-08 14:00:10 +00:00
Atbrakhi
25e2a6dfa1
Allow enabling minibrowser from command line (#30042) 2023-07-28 13:20:44 +00:00
Martin Robinson
628aeec95a
Remove some unused options (#30028)
These are no longer used and some of them no longer make sense with
WebRender.
2023-07-26 15:07:44 +00:00
Martin Robinson
d31cdb682f
Make the choice of layout runtime setting
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
2023-07-06 14:49:24 +02:00
Martin Robinson
dc192172ad Clean up debug options 2023-05-01 14:09:28 +02:00
michaelgrigoryan25
6347bcf83f Replaced some Opts struct fields with shorthand initializers. 2022-12-06 21:01:27 +04:00
michaelgrigoryan25
3a99a733cd Removed unnecessary type bindings. 2022-12-06 20:41:32 +04:00
Teymour Aldridge
3e5cd8815d Fix some Clippy lints. 2022-08-04 00:13:36 +08:00
Josh Matthews
79b3cc2a28 Remove stub debugger server. 2020-08-10 10:37:00 -04:00
Paul Rouget
2c36754bf7 Configure devtools server via preferences 2020-07-17 08:31:26 +02:00
Paul Rouget
479afcfb8e Embedding API: prefs r/w 2020-06-10 09:38:13 +02:00
Simon Sapin
b282bd3a44 Remove support for heartbeats profiling 2020-06-04 22:53:56 +02:00
skrzyp1
ee6906443f reading unminified scripts from disk 2020-06-02 21:23:45 +02:00
Bastien Orivel
97eaea4e68 Remove influxDB support for profile
It's apparently unused. Influent is unmaintained. Let's remove it
2020-05-04 22:26:12 +02:00
Simon Sapin
bbed751bbc Remove use of webrender::RendererKind
It appears to be unused since 2017 with https://github.com/servo/webrender/pull/1587
CC https://bugzilla.mozilla.org/show_bug.cgi?id=1631579
2020-04-20 22:05:59 +02:00
Utsav Oza
2c306227e9 Extract user_agent from global opts 2020-04-06 21:29:58 +05:30
Kunal Mohan
94db0d61cb
Add support for launching devtools server on random port
Assign random port to devtools server in case user does not specify a
port explicitly and report it to the embedding layer for display to user.
2020-03-16 15:30:26 +05:30
Kunal Mohan
a05553f188
Make Background Hang Monitor Optional
This is done by wrapping all channels of communication
and related objects inside Option which are configured
using flag inside servo_config.
2020-02-23 01:45:52 +05:30
Alex Touchet
77a9ff9074
Update user agent info 2020-01-31 14:32:42 -08:00
Alex Touchet
f634100c69
Use Windows 10 instead of 7 in user agent string 2019-12-16 10:34:18 -08:00
Zakor Gyula
12893aa010 Initial implementation of WebGPU API 2019-11-21 08:30:26 +01:00
Fernando Jimenez Moreno
e1b6719384 Allow setting Visual Studio logger level from cli arg 2019-10-28 17:29:20 +01:00
glowe
0ee300479e Extract device_pixels_per_px from global opts
This is also an embedder specific option, so removing it from the
global options makes sense.
2019-10-26 12:00:14 -04:00