aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/windowproxy.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move `ScriptToConstellationMsg` to `constellation_traits` (#36364)Martin Robinson2025-04-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the last big change necessary to create the `constellation_traits` crate. This moves the data structure for messages that originate from the `ScriptThread` and are sent to the `Contellation` to `constellation_traits`, effectively splitting `script_traits` in half. Before, `script_traits` was responsible for exposing the API of both the `ScriptThread` and the `Constellation` to the rest of Servo. - Data structures that are used by `ScriptToConstellationMsg` are moved to `constellation_traits`. The dependency graph looks a bit like this: `script_layout_interface` depends on `script_traits` depends on `constellation_traits` depends on `embedder_traits`. - Data structures that are used in the embedding layer (`UntrustedNodeAddress`, `CompositorHitTestResult`, `TouchEventResult` and `AnimationState`) are moved to embedder_traits, to avoid a dependency cycle between `webrender_traits` and `constellation_traits`. - Types dealing with MessagePorts and serialization are moved to `constellation_traits::message_port`. Testing: This is covered by existing tests as it just moves types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Check all ancestor navigable trustworthiness for mixed content (#36157)Sebastian C2025-04-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Propagate through documents a flag that represents if any of the ancestor navigables has a potentially trustworthy origin. The "potentially trustworthy origin" concept appears to have gotten confused in a couple of places and we were instead testing if a URL had "potentially trustworthy" properties. The main test for the ancestor navigables is [mixed-content/nested-iframes](https://github.com/web-platform-tests/wpt/blob/master/mixed-content/nested-iframes.window.js) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #36108 <!-- Either: --> - [X] There are tests for these changes --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* constellation: Rename messages sent to the `Constellation` (#36341)Martin Robinson2025-04-041-4/+4
| | | | | | | | | | | | | | | | | | | | Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* constellation: Stop assuming that the viewport is shared by all WebViews ↵Martin Robinson2025-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#36312) The `Constellation` previously held a `window_size` member, but this assumes that all `WebView`s have the same size. This change removes that assumption as well as making sure that all `WebView`s pass their size and HiDIP scaling to the `Constellation` when they are created. In addition - `WindowSizeData` is renamed to `ViewportDetails`, as it was holding more than just the size and it didn't necessarily correspond to a "window." It's used for tracking viewport data, whether for an `<iframe>` or the main `WebView` viewport. - `ViewportDetails` is stored more consistently so that conceptually an `<iframe>` can also have its own HiDPI scaling. This isn't something we necessarily want, but it makes everything conceptually simpler. The goal with this change is to work toward allowing per-`WebView` HiDPI scaling and sizing. There are still some corresponding changes in the compositor to make that happen, but they will in a subsequent change. Testing: This is covered by existing tests. There should be no behavior changes. Fixes: This is part of #36232. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Use Window in new methods instead of GlobalScope for interfaces with … ↵Richard Dushime2025-04-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#36133) …Window-only constructors <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #36118 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: richarddushime <mudaherarich@gmail.com> Signed-off-by: Richard Dushime <45734838+richarddushime@users.noreply.github.com>
* Miscellaneous script splitting preparation changes (#36216)Josh Matthews2025-03-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Move num module to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make JS reflector creation generic over DOM trait. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move bindings-specific lock to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move DOM proto array code to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move finalizer implementations to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move some error routines to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move some DOM interface conversion routines to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make is_array_like generic over DOM trait. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Use generic interfaces for conditional exposure functions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move a bunch of routines used by codegen to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Replace some uses of window.global() with upcast. (#36179)Aniebiet Afia2025-03-271-1/+1
| | | Signed-off-by: aniebietafia <aniebietafia87@gmail.com>
* base: Finish rename of `TopLevelBrowsingContextId` to `WebViewId` (#35896)Martin Robinson2025-03-111-11/+11
| | | | | | The `WebViewId` name is a lot more descriptive these days to the casual reader, so I think we can go ahead and finish the rename. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-12/+14
| | | | | | | | | | | | | * 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>
* Make auxiliary webviews exist in the constellation immediately (#35672)Delan Azabani2025-02-261-58/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To allow embedders to interact with webviews as soon as they are created, we need to ensure that they exist in both the compositor and the constellation before those interactions happen. #35662 does this for the compositor, while this patch does this for the constellation. When a webview opens another webview (via <a target>, <form target>, window.open(), etc), the embedder creates an “auxiliary” webview, which previously went as follows: - script create_auxiliary_browsing_context - libservo AllowOpeningWebView - embedder request_open_auxiliary_webview (→ constellation FocusWebView) - script create_auxiliary_browsing_context - constellation ScriptNewAuxiliary In that model, the constellation may receive FocusWebView before it receives ScriptNewAuxiliary. Now they are created as follows: - script create_auxiliary_browsing_context - constellation CreateAuxiliaryWebView - libservo AllowOpeningWebView - embedder request_open_auxiliary_webview (→ constellation FocusWebView) - constellation CreateAuxiliaryWebView - script create_auxiliary_browsing_context Since these messages are all synchronous and the constellation will have set up the webview before handling any new messages, the webview will always exist by the time we handle the embedder’s FocusWebView. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* refactor: propagate CanGc arguments through callers (#35591)Auguste Baum2025-02-231-1/+1
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* refactor: add CanGc as argument to WindowProxy::set_window (#35609)Yerkebulan Tulibergenov2025-02-231-4/+5
| | | Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Add support for Upgrade request to a potentially trustworthy URL. (#34986)Shubham Gupta2025-02-051-0/+2
| | | | | | | | | | | | | | | | * Add support for Upgrade request to a potentially trustworthy URL. Signed-off-by: Shubham Gupta <shubham13297@gmail.com> * script: Support inheritable insecure request policy in documents and workers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Move various reflector types and traits to script_bindings (#35279)Josh Matthews2025-02-041-1/+1
| | | | | | | | | | | | | * script: Move Reflector to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Include `WebViewId` into EmbedderMsg variants where possible (#35211)Delan Azabani2025-01-301-1/+1
| | | | | | | | | | | | | | | | | `EmbedderMsg` was previously paired with an implicit `Option<WebViewId>`, even though almost all variants were either always `Some` or always `None`, depending on whether there was a `WebView involved. This patch adds the `WebViewId` to as many `EmbedderMsg` variants as possible, so we can call their associated `WebView` delegate methods without needing to check and unwrap the `Option`. In many cases, this required more changes to plumb through the `WebViewId`. Notably, all `Request`s now explicitly need a `WebView` or not, in order to ensure that it is passed when appropriate. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Add an initial WebView data structure to the API (#35119)Delan Azabani2025-01-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a new handle-based webview API to libservo, with two main design goals: 1. The lifetime of the handles controls the lifetime of the webview, giving the embedder full control over exactly when webviews are created and destroyed. This is consistent with how WebKitGTK’s WebView works; the engine can only create webviews via a create request, and can only destroy them via a close request. 2. All methods are infallible; if the constellation dies, the embedder finds out when calling Servo::handle_events. For the moment, the embedder is only responsible for creating the WebView id, and not the internal TopLevelBrowsingContext data structures. This is so that the ScriptThread is able to get a handle on the new WebView's WindowProxy in the case that it's an auxiliary browsing context. In the future, the embedder should also be responsible for creating the TopLevelBrowsingContext and the ScriptThread should have mechanism to associate the two views so that WebView creation is always executed through the same code path in the embedding layer. For now, it's enough that the embedder can get a handle to the new WebView when it's creation is requested. Once we replace EmbedderMsg with a webview delegate trait, we will pass WebView handles to the embedder, rather than webview ids. We’ll also add detailed docs, once the design settles. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-38/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Expose `NodeTraits::owner_global` / `Window::as_global_scope` (#34843)Martin Robinson2025-01-071-13/+12
| | | | | | | | | | | Expose two new helpers and start using them as much as possible. - `NodeTraits::owner_global`: which gets the `GlobalScope` that currenty owns a `Node`. This may be different than `.global()` in the case that the `Node` was adopted by a different `Document`. - `Window::as_global_scope`: A helper to avoid having to cast so much when treating a `Window` like a `GlobalScope`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Upgrade rustc to 1.83 (#34793)Nico Burns2025-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Replace HistoryEntryReplacement with NavigationHistoryBehavior from the ↵shanehandley2024-12-181-6/+7
| | | | | navigation API (#34681) Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Use out parameter for generated methods returning JSVal (#34087)Josh Matthews2024-11-051-10/+13
| | | | | | | | | | | | | | | | | | | | | * Make generated bindings that return a WebIDL `any` value use out parameters. Returning raw JSVal values makes it easier to create GC hazards in code that calls these methods. Accepting a MutableHandle argument instead ensures that the values are rooted by the caller. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update mozjs. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* CanGc fixes from constantsourcenode.rs & window.rs (#33931)tanishka2024-10-201-2/+3
| | | Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
* Stop sending EmbedderMsg::WebViewOpened from WindowProxy (#33514)webbeef2024-09-221-2/+0
| | | | | This is redundant since the constellation already sends this message. Signed-off-by: webbeef <me@webbeef.org>
* Various borrow hazard fixes (#33133)Josh Matthews2024-08-201-0/+3
| | | | | | | | | | | | | | | | | | | | | * Reduce the scope of the document tag map borrow. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Reduce scope of borrow when finishing a Response. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Avoid creating a File object while borrowing FormData's data. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Prevent the GC from seeing an uninitialized window proxy slot. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Update codegen for GetOpener:inRealms in Bindings.conf (#33062)Taym Haddadi2024-08-151-6/+3
| | | Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* Fix: Return error and avoid panicking in SetOpener function (#33002)Taym Haddadi2024-08-121-3/+6
| | | | | | | | | | | | | | | | | * Fix: Return error and avoid panicking in SetOpener function Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * eturn JSFailed onstead of InvalidState Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update wpt test result Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* fix: Memory leak from CreateProxyWindowHandler (#32773)Erik Hennig2024-08-011-21/+91
| | | | | | | | | | | | | | | | | * fix: Memory leak from CreateProxyWindowHandler Signed-off-by: ede1998 <online@erik-hennig.me> * fix: memory leak in WindowProxy Signed-off-by: ede1998 <online@erik-hennig.me> * fix: Memory leak in WindowProxyHandler through static Signed-off-by: ede1998 <online@erik-hennig.me> --------- Signed-off-by: ede1998 <online@erik-hennig.me>
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* clippy: fix several lint warns (#32126)Kitsu2024-04-221-1/+1
| | | | | | | | | | | | | | | As seems #31500 still remain opened here's the next partial fix. Fixed list: `unused_mut`, `clippy::needless_borrow`, `clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`, `clippy::unnecessary_cast`, `clippy::derivable_impls`, `clippy::collapsible_match`, `clippy::extra_unused_lifetimes`, `clippy::map_clone`, `clippy::manual_filter`. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes are part of #31500. - [x] These changes do not require tests because are only cosmetic.
* Fixed some clippy warnings in components (#32025)komuhangi2024-04-101-1/+1
| | | | | * Fixed some clippy warnings in components * Updated the simplification of bolean expressions in componets/script/dom/range.rs
* clippy:partialeq_to_none (#31972)Yashasvi Chaudhary2024-04-021-1/+1
|
* clippy: Fix more clippy warnings in `components/scripts/dom` (#31914)Rosemary Ajayi2024-03-281-1/+1
| | | | | * refrence to a reference * refrence to a reference
* clippy: Fix some clippy warnings in `components/script` (#31843)Rosemary Ajayi2024-03-251-3/+3
| | | | | | | * deref on an immutable reference * fix deref on an immutable reference * fix deref on an immutable reference
* fix redundant closure (#31842)Rosemary Ajayi2024-03-231-4/+4
|
* clippy: Fix `explicit_auto_deref` warnings in `components/script` (#31837)Oluwatobi Sofela2024-03-231-4/+4
| | | | | | | | | * clippy: Fix explicit auto-deref warnings * clippy: Fix explicit auto-deref warnings * refactor: Tidy up code * refactor: Fix method not found errors
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-7/+7
|
* clippy: Fix unneeded return statement warnings (#31776)Oluwatobi Sofela2024-03-201-2/+2
|
* clippy: Fix many warnings in `components/script` (#31717)Richard Dushime2024-03-191-3/+3
| | | | | | | | | | | | | | | | | * Fix Several clippy warnings * Fix Build errors * Fix Unused import * Fix requested changes * Fix rustfmt * Minor fixes --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Do not run layout in a thread (#31346)Martin Robinson2024-02-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Do not run layout in a thread Instead of spawning a thread for layout that almost always runs synchronously with script, simply run layout in the script thread. This is a resurrection of #28708, taking just the bits that remove the layout thread. It's a complex change and thus is just a first step toward cleaning up the interface between script and layout. Messages are still passed from script to layout via a `process()` method and script proxies some messages to layout from other threads as well. Big changes: 1. Layout is created in the script thread on Document load, thus every live document is guaranteed to have a layout. This isn't completely hidden in the interface, but we can safely `unwrap()` on a Document's layout. 2. Layout configuration is abstracted away into a LayoutConfig struct and the LayoutFactory is a struct passed around by the Constellation. This is to avoid having to monomorphize the entire script thread for each layout. 3. Instead of having the Constellation block on the layout thread to figure out the current epoch and whether there are pending web fonts loading, updates are sent synchronously to the Constellation when rendering to a screenshot. This practically only used by the WPT. A couple tests start to fail, which is probably inevitable since removing the layout thread has introduced timing changes in "exit after load" and screenshot behavior. Co-authored-by: Josh Matthews <josh@joshmatthews.net> * Update test expectations * Fix some issues found during review * Clarify some comments * Address review comments --------- Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* constellation: focusing and closing webviews (#30842)Delan Azabani2024-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * constellation: focusing, closing, and native window visibility * rename “browser” to “webview”, “unfocus” to “blur” * remove native window visibility from constellation * rename more “browser” to “webview” * guard clauses * don’t automatically focus when no webviews are focused * comment spec steps for window.close() * use format interpolation Co-authored-by: Martin Robinson <mrobinson@igalia.com> * fix formatting * rename “Webview” to “WebView” in types and type parameters * remove unused method * fix libsimpleservo --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-11/+11
| | | | 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.
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-38/+35
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+2
| | | | | | | | | | | * 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>
* No tracing of nop traceable fields (#29926)Samson2023-08-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add `no_trace` option to JSTraceable derive * NoTrace wrapper * Port some types to no_trace schematics * Fixing my unsafe mistakes (not tracing traceables) * Add docs & safety guards for no_trace Safety guards (trait shenanigans) guarantees safety usage of `no_trace` * Port canvas_traits to no_trace * Port servo_media to no_trace * Port net_traits to no_trace * Port style to no_trace * Port webgpu to no_trace * Port script_traits to no_trace * Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace * unrooted_must_root lint in seperate file * Add trace_in_no_trace_lint as script_plugin * Composable types in must_not_have_traceable * Introduced HashMapTracedValues wrapper * `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>` * Port rest of servo's types to no_trace * Port html5ever, euclid, mime and http to no_trace * Port remaining externals to no_trace * Port webxr and Arc<Mutex<_>> * Fix spelling in notrace doc
* Make GlobalScope.get_cx a static method.Josh Matthews2023-05-201-3/+3
|
* revert: Introduce `Untransplantable` trait to indicate transplantability at ↵Delan Azabani2023-03-231-45/+11
| | | | | | the type level (8f7b0cff87f0eab921e13e6990d76e12935e8675)
* apply yvt/servo/fix-named-window-getterDelan Azabani2023-03-231-11/+45
|
* apply pylbrecht/servo/named.window.getter (closes #27952)Delan Azabani2023-03-231-1/+1
|
* Format.Josh Matthews2022-11-231-4/+2
|
* Changes for spidermomkey upgrade.Josh Matthews2022-11-231-20/+17
|