aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/screen.rs
Commit message (Collapse)AuthorAgeFilesLines
* Revert "compositor: Unify the cross process and in-process API (#36443)" ↵Martin Robinson10 days1-3/+3
| | | | | | | | | | | | | (#36533) This reverts commit 4c55104b36c7b858a117a6dd90a5dc21b74324d1. This commit introduced an issue where messages from script to the compositor no longer woke up the embedder. There is a larger issue here, but this change exacerbated it. Fixes #36528. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* compositor: Unify the cross process and in-process API (#36443)Martin Robinson12 days1-3/+3
| | | | | | | | | | | | | | | | | | | | | | Because there used to be two traits exposing messages to the compositor, there were two kinds of messages that could be sent: 1. In-process messages from the `Constellation` 2. Cross-process messages from other parts of Servo Now these two types of messages can be unified into one type. With that done the compositor can simply keep a single `IpcReceiver` for all messages, instead of having to set up a route for the cross-process messsages. This decreases overhead of cross proceses messages a bit, but more importantly solves an issue where Servo would rely on the compositor's cross-process message route after the `Constellation` had called `ROUTER.shutdown()`. This is part of #36442. Testing: This is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* `compositing`: Combine `webrender_traits` and `compositing_traits` (#36372)Martin Robinson2025-04-061-1/+1
| | | | | | | | | | | | | | | 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>
* libservo: Start moving `WindowMethods` to `WebViewDelegate` (#36223)Martin Robinson2025-04-021-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `WindowMethods` is used by the embedding layer to get information from the embedder. This change moves the functionality for getting screen size and `WebView` offsets to `WebViewDelegate`. This is important because `WebView`s might be on different screens or have different offsets on the screen itself, so it makes sense for this to be per-`WebView` and not global to the embedder. HiDPI and animation state functionality will move to the embedder in subsequent changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> <!-- 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 do not require tests because they just modify the `WebView` API surface a bit. <!-- 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: Martin Robinson <mrobinson@igalia.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-1/+1
| | | | | | | | | | | | | * 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>
* Propagate `CanGc` arguments through callers in constructors (#35541)Auguste Baum2025-02-201-6/+2
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* 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>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add CanGc argument to reflect_dom_object (#34606)Domenico Rizzo2024-12-131-1/+6
| | | | | | | | | | | | | | | | | | | | | * applied mach fmt Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Refinements Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Modified reflect_dom_object signature and all its calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * fix function calls when parameter is passed up Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* Generate a trait abstracting over all known DOM interfaces (#34357)Josh Matthews2024-11-241-1/+1
| | | | | | | | | | | | | | | | | * script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Update trait implementations with new generic type. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* servoshell: Allow overriding screen resolution with a command-line argument ↵Martin Robinson2024-10-301-9/+9
| | | | | | | | | | | | | | | | | | | | | (#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>
* compositor: Create a single cross-process compositor API (#33619) (#33660)Martin Robinson2024-10-091-9/+7
| | | | | | | | | | | | | | | | | | | | | | Instead of exposing many different kinds of messages to the compositor that are routed through the constellation, expose a single message type which can be sent across IPC channels. In addition, this IPC channel and the route to the crossbeam channel with the compositor is created along with the `CompositorProxy`, simplifying what needs to be passed around during pipeline initialization. Previously, some image updates (from video) were sent over IPC with a special serialization routine and some were sent via crossbeam channels (canvas). Now all updates go over the IPC channel `IpcSharedMemory` is used to avoid serialization penalties. This should improve performance and reduce copies for video, but add a memory copy overhead for canvas. This will improve in the future when canvas renders directly into a texture. All-in-all this is a simplification which opens the path toward having a standard compositor API and reduces the number of duplicate messages and proxying that had to happen in libservo. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Revert "compositor: Create a single cross-process compositor API (#33619)" ↵Martin Robinson2024-10-041-7/+9
| | | | | | | | | (#33645) This reverts commit f2f5614ad64927aa82aa8937ae14a6086df49d2b. This is causing intermittent crashes: https://github.com/servo/servo/actions/runs/11167043809/job/31044255019 Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* compositor: Create a single cross-process compositor API (#33619)Martin Robinson2024-10-031-9/+7
| | | | | | | | | | | | | | | | | | | | | | Instead of exposing many different kinds of messages to the compositor that are routed through the constellation, expose a single message type which can be sent across IPC channels. In addition, this IPC channel and the route to the crossbeam channel with the compositor is created along with the `CompositorProxy`, simplifying what needs to be passed around during pipeline initialization. Previously, some image updates (from video) were sent over IPC with a special serialization routine and some were sent via crossbeam channels (canvas). Now all updates go over the IPC channel `IpcSharedMemory` is used to avoid serialization penalties. This should improve performance and reduce copies for video, but add a memory copy overhead for canvas. This will improve in the future when canvas renders directly into a texture. All-in-all this is a simplification which opens the path toward having a standard compositor API and reduces the number of duplicate messages and proxying that had to happen in libservo. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* clippy: Fix dereferenced warnings (#31770)Oluwatobi Sofela2024-03-201-1/+1
|
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-8/+8
| | | | | * strict imports formatting * Reformat all imports
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-6/+1
|
* Update euclid.Emilio Cobos Álvarez2019-07-231-5/+5
| | | | | | | | There are a few canvas2d-related dependencies that haven't updated, but they only use euclid internally so that's not blocking landing the rest of the changes. Given the size of this patch, I think it's useful to get this landed as-is.
* WebRender units are no longer reexported.Patrick Walton2019-07-091-1/+1
|
* Update webrenderManish Goregaokar2018-11-271-3/+3
|
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Reorder importsPyfisch2018-11-061-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-9/+9
|
* Format script componentchansuke2018-09-191-9/+19
|
* Implements profiler for blocked recvNakul Jindal2018-03-221-3/+4
|
* alias some euclid typesPaul Rouget2018-03-161-3/+4
|
* Use typed coordinates.Paul Rouget2018-03-161-7/+12
| | | | | | | | We use Size2D and Point2D across compositing, constellation and script, losing the type of pixels we use (DevicePixel, DeviceIndepententPixel or CSSPixel) along the way, which might lead to bugs like window.outerHeight not taking into account the page zoom (using DeviceIndepententPixel instead of CSSPixel).
* Fix some "unnecessary parentheses" warningsSimon Sapin2018-01-221-2/+2
|
* Enable screen.availHeight/availWidth/Height/WidthShing Lyu2017-11-131-3/+45
|
* Remove use of unstable box syntax.Simon Sapin2017-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | http://www.robohornet.org gives a score of 101.36 on master, and 102.68 with this PR. The latter is slightly better, but probably within noise level. So it looks like this PR does not affect DOM performance. This is expected since `Box::new` is defined as: ```rust impl<T> Box<T> { #[inline(always)] pub fn new(x: T) -> Box<T> { box x } } ``` With inlining, it should compile to the same as box syntax.
* Rename Root<T> to DomRoot<T>Anthony Ramine2017-09-261-2/+2
| | | | | | | In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned.
* Rename dom::bindings::js to dom::bindings::rootAnthony Ramine2017-09-261-1/+1
|
* Make #[dom_struct] a proc_macro attributeAnthony Ramine2017-02-241-0/+1
|
* Make reflect_dom_object take a &GlobalScopeAnthony Ramine2016-10-061-2/+1
|
* more refactoringrohan.prinja2015-10-301-1/+1
|
* Make the traits for the IDL interfaces take &selfAnthony Ramine2015-08-271-3/+3
|
* make dom_struct derive HeapSizeOf,João Oliveira2015-08-271-2/+0
| | | | closes #7357
* Measure heap memory usage for more types. Fixes #6951Bogdan Cuza2015-08-131-0/+1
|
* Add spec linksBogdan Cuza2015-07-281-0/+2
|
* Upgrade to SM 39Michael Wu2015-06-191-3/+3
|
* Remove manual impls of Reflectors (autogen)Manish Goregaokar2014-12-271-6/+1
| | | | | | | | | Obtained via: `find . -maxdepth 1 -type f -print0 | xargs -0 sed -z -i "s/\\nimpl Reflectable for[^{]*{[^}]*}[^}]*}\\n//"` `find . -maxdepth 1 -type f -print0 |xargs -0 grep -lZ dom_struct | xargs -0 grep -LZ "reflector()\\|Reflector::new" |xargs -0 sed -z -i "s/use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};/use dom::bindings::utils::reflect_dom_object;/"` followed by semi-automated removal of leftover imports
* script: Remove glob imports added in #4405Tetsuharu OHZEKI2014-12-191-2/+2
|
* Updated reflect_dom_object to be passed by valueMichael Booth2014-11-301-1/+1
|
* Use #[dom_struct] everywhereManish Goregaokar2014-10-161-3/+1
|
* Simple privatizationsTim Taubert2014-10-131-0/+1
|
* Upgrade to rustc d2b30f7d3 2014-09-23Simon Sapin2014-09-291-2/+2
|
* Made some DOM fields private.ProgramFOX2014-09-261-1/+1
| | | | Relevant to #2242.
* Use JSTraceable everywhereManish Goregaokar2014-09-241-1/+1
|
* More progress in the &JSRef -> JSRef conversionCameron Zwarich2014-09-201-2/+2
| | | | | Change all of the <Class>Methods traits to take `self` instead of `&self`.
* First steps of &JSRef -> JSRef conversionCameron Zwarich2014-09-191-2/+2
| | | | | | | | | Replace &JSRef with JSRef in the bulk of the generated code. This will remove a level of indirection throughout all DOM code. This patch doesn't change methods implemented on JSRef<T> to take `self` rather than `&self`, and it leaves a few other uses of &JSRef, but those changes can be made incrementally.