aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
Commit message (Collapse)AuthorAgeFilesLines
* script: No longer do explicit reflows for display (#34599)Martin Robinson2024-12-136-175/+156
| | | | | | | | | | | | | | | | | | | | | | | 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>
* script: Remove `note_rendering_opportunity` and `rendering_opportunity` (#34575)Martin Robinson2024-12-124-8/+10
| | | | | | | | | | | | | | | A rendering opportunity is now unconditionally triggered by handling IPC messages in the `ScriptThread`, unless animations are running in which case it's driven by the compositor. We can now remove calls to `note_rendering_opportunity` and `rendering_opportunity`. There is one tricky case, which is when a promise completion during a microtask checkpoint dirties the page again. In this case we need to trigger a new rendering opportunity, unless animations are running. In a followup change, when not driven by the compositor, rendering opportunities will be driven by a timed task, meaning we can remove this workaround. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add embedder event for preferred color scheme and respond to it in the ↵arthmis2024-12-121-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | LayoutThread (#34532) * respond to winit platform theme changed event and send it to the layout thread Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactoring viewport and theme change handling functions based on feedback Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fixing issues reported by test-tidy Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update stylo in order to use color_scheme function on Device Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
* script: Do not do explicit reflows when handing rAFs (#34576)Martin Robinson2024-12-111-17/+15
| | | | | | | | | | This removes two explicit calls to reflow to detect rAFs that do not modify the DOM and to trigger reflows when the page isn't dirty. This can cause extra reflows, especially when animations are running. This change removes them, relying on *update the rendering* to properly trigger reflows, shortly after running rAF callbacks and after animations are updated. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* tidy: Update pattern for checking for missing specification links. (#34552)Josh Matthews2024-12-111-0/+1
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Remove 'pending reflow' concept and some explicit reflows (#34558)Martin Robinson2024-12-114-57/+29
| | | | | | | | | | | | | | | | | | The `pending reflow` concept isn't necessary now that *update the rendering* is taking care of triggering reflows at the correct time. `Window::reflow` already avoids reflows if the page is not dirty, so pending reflows is now just an extraneous check as long as *update the rendering* runs properly. This change also removes some explicit reflows, which now wait until the appropriate moment during *update the rendering*. This should remove some extra reflows that are not necessary. Servo needs some way to track that resizing the web view needs to re-layout due to the initial containing block changing. Move handling of `Document::needs_paint` to the script thread and use this, expanding the rustdoc to explain what it is for a bit more clearly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Rewrite From/TryFrom conversions on generated types to avoid future orphan ↵Josh Matthews2024-12-1137-365/+400
| | | | | | | | | | | | | | | rule violations (#34554) * script: Add traits to allow converting between types that are not defined in the script crate. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Rewrite all From/TryFrom implementations on generated WebIDL types to use new Convert/TryConvert traits. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Do not prioritize *update-the-rendering* in `ScriptThread` message ↵Martin Robinson2024-12-101-2/+46
| | | | | | | | | | | | | | | | | | | | loop (#34539) Instead run *update the rendering* at the end of every process of gathering messages sent to the `ScriptThread`. This ensures that the thread is in a consistent state when the update is finally run and prevents running more than one instance of *update the rendering* per spin of the message loop. In addition: - Move the *run the resize steps* implementation to `Window` and ensure that the realm is active when it is run. - Profile the queueing of the resize message instead of handling it. I think this makes more sense as the profiling seems to be targeting message handling and not *update the rendering*. Additionally, it's difficult to profile from the context of `Window`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Add stub interface for AbortController. (#34519)Josh Matthews2024-12-103-0/+67
| | | | Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: syvb <me@iter.ca>
* retire deprecated MouseEvent::InitMouseEvent (#34538)Jay Wang2024-12-092-20/+31
| | | | Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com> Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
* script: Update the rendering when receiving IPC messages instead of just ↵Martin Robinson2024-12-092-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | reflowing (#34486) This changes fixes two issues: 1. A reflow of all `Document`s currently done unconditionally after receving IPC messages in the `ScriptThread`. Reflowing without first updating the animation timeline can lead to transitions finshing as soon as they start (because it looks like time advancement is measaured between calls to `update-the-rendering`). 2. Fix an issue where not all `Pipeline`s were updated during *update the rendering*. The previous code only took into account top level frames and their children. It's not guaranteed that a particular `ScriptThread` is managing any top level frames, depending on the origens of those frames. We should update the rendering of those non-top-level iframes regardless. The new code attempts to order the frames according to the specification as much as possible without knowing the entire frame tree, without skipping any documents managed by the `ScriptThread` in question. In addition, `Documents` is pulled out the `script_thread.rs` and renamed to `DocumentCollection`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* traverse Shadow DOM boundaries when determining element lang (#34529)Ville Lindholm2024-12-081-1/+1
| | | Signed-off-by: Ville Lindholm <ville@lindholm.dev>
* Add ReferrerPolicy IDL attribute to iframes (#34526)shanehandley2024-12-082-4/+29
| | | Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* script: add `initialize_ui_event` method (#34524)Jay Wang2024-12-082-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | * retire UIEvent::InitUIEvent Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com> * fix fmt Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com> * remove unused changes Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com> * reimplement the spec and reuse wherever we can Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com> * fix lint Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com> --------- Signed-off-by: Jay Wang <xdddxyyyxzzz123@gmail.com>
* Add XPath parser/evaluator (#34463)Ville Lindholm2024-12-0811-7/+617
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add XPath parser/evaluator Signed-off-by: Ville Lindholm <ville@lindholm.dev> * Correctly annotate XPathEvaluator IDL Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: have bindings pass in `can_gc` Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: add docstrings Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: implement PartialEq for Value for readability Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: add docstrings for CoreFunctions Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: simplify node test code Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: add unit tests for string handling xpath functions Signed-off-by: Ville Lindholm <ville@lindholm.dev> * put xpath features behind dom.xpath.enabled pref Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review] remove rstest and insta dev-deps Signed-off-by: Ville Lindholm <ville@lindholm.dev> * update wpt test expectations Signed-off-by: Ville Lindholm <ville@lindholm.dev> * [PR review]: tweak metadata files Signed-off-by: Ville Lindholm <ville@lindholm.dev> * update wpt test expectations AGAIN Signed-off-by: Ville Lindholm <ville@lindholm.dev> --------- Signed-off-by: Ville Lindholm <ville@lindholm.dev>
* Implement `ShadowRoot.clonable` attribute (#34514)Simon Wülker2024-12-076-15/+81
| | | | | | | | | | | | | | | | | | | | | | | | | * Implement ShadowRoot clonable attribute Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * ./mach test-tidy fixes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * fix clippy warnings Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* net: correct handling of the empty string referrer policy when provided in ↵shanehandley2024-12-071-1/+1
| | | | | requestInit (#34518) Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Make traverse_preorder follow shadow roots (#34503)Josh Matthews2024-12-073-17/+17
| | | | | | | | | | | | | | | | | * script: Ensure shadow-inclusve preorder traversals follow hosted shadow roots. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Handle unregistering element id/name values inside of a shadow root. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Merge shadow root tree iteration logic. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Create two-phase initialization for generated JS engine bindings (#34366)Josh Matthews2024-12-064-108/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Generate a runtime initialization for static JS binding information. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Replace dummy static initializers with OnceLock. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Only initialize statics for DOM interfaces with interface objects. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Remove one unnecessary Box::leak usage. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide thread-unsafe OnceLock usage inside of a wrapper type. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mark ThreadUnsafeOnceLock::get unsafe. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Simplify ThreadUnsafeOnceLock internals. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Update animations once per-Document during `update_the_rendering()` ↵Martin Robinson2024-12-051-40/+44
| | | | | | | | | | | | | | | | | | (#34489) Before, `update_the_rendering()` would update all animations for all Documents once per-Document. Apart from being generally wrong, the specification says this should be done once per-Document. This theoretically means that `update_the_rendering()` is just doing less work every time it runs. In addition: - Don't redirty animations nodes when running rAF callbacks. They should already be dirty when animations are updated. - Perform a microtask checkpoint while updating animations as dictacted by the specification. - Update comments to reflect the specification text. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add `webgpu` feature flag (#34444)atbrakhi2024-12-0539-94/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move script gpu files into webgpu folder Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Modify gpu webidls Signed-off-by: atbrakhi <atbrakhi@igalia.com> * move gpu realted webidl Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add webgpu feature to script Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add dummy implementation for gpucanvascontext Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add skip-if CARGO_FEATURE_WEBGPU Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Move NavigatorGPU and workerNavigator GPU to webgpu idl Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt and cleanup Signed-off-by: atbrakhi <atbrakhi@igalia.com> * review fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> * enable webgpu by default and also some fmt fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Add pref back, fix imports, small cleanups Signed-off-by: atbrakhi <atbrakhi@igalia.com> --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Don't register unconnected shadow roots with their owner document (#34361)Simon Wülker2024-12-024-21/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | * Don't falsely register Shadow Roots as connected Previously, a shadowroot would be registered as connected during the shadow hosts bind_to_tree call, even if the host was being bound to an element that was not itself connected to a document. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Move bind/unbind methods into a VirtualMethod impl Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Add DocumentFragment/Shadowroot to vtable_for Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: add PointerEvent (#34437)Ngo Iok Ui (Wu Yu Wei)2024-12-024-6/+454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add PointerEvent webIDL Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Implement all new methods Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Cleanup warnings Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Update wpt meta Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Update interface list Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Update manifest Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Update doc links Signed-off-by: Wu Wayne <yuweiwu@pm.me> --------- Signed-off-by: Wu Yuwei <yuweiwu@pm.me> Signed-off-by: Wu Wayne <yuweiwu@pm.me>
* script: Dirty video element when clearing video frame data. (#34435)Josh Matthews2024-11-301-1/+2
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Move script gpu files into webgpu folder (#34415)atbrakhi2024-11-2844-118/+108
| | | Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Differentiate between missing/invalid value in `make_enumerated_getter!` ↵Simon Wülker2024-11-286-27/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#34412) * Create spec-compliant version of create_enumerated_getter Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Use new make_enumerated_getter! macro everywhere Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Remove old make_enumerated_getter macro Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Return lowercased value from make_enumerated_getter macro Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Use `webrender_api::units::DevicePixel` rather than ↵Nico Burns2024-11-253-4/+6
| | | | | | | | | | | | | | | `style_traits::DevicePixel` unless interfacing with Stylo (#34353) * Use webrender_api::units::DevicePixel rather than style_traits::DevicePixel unless interfacing with Stylo Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix OpenHarmony build Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
* Implement `DataTransfer` and related interfaces (#34205)Gae242024-11-259-0/+586
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add datatransfer interfaces Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * implement DataTransfer interface implemented Constructor, setter and getter for drop_effect and effect_allowed, Items and SetDragImage Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * implement DataTransferItem interface Implemented Kind, Type, GetAsString, GetAsFile. Marked DataTransfer as weakReferenceable to access its field inside DataTransferItemList and DataTransferItem. Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * implement DataTransferItemList interface implemented Lenght, Getter, Add, Remove, Clear Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * added DataTransfer's old interface Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * DataTransfer: implemented GetData, SetData, SetData Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * set Weakref to DataTransfer in DataTransferItemList and DataTransferItem Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * DataTransfer: implemented Types and Files Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * cleanup get_data, set_data, clear_data Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix clippy warning Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * add drag data store Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix DataTransfer's Types() behaviour Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * DataTransferItem: use the underlying drag data store Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix DataTransferItemList's getter and remove Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix clippy warnings Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * update test expectations Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
* Support custom derives for generated types (#34356)Josh Matthews2024-11-249-128/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Derive more Default implementations for dictionaries. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Support arbitrary derives on generated enums. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Support arbitrary derives for generated dictionaries. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Support arbitrary derives for generated unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Derive more impls for generated dicts and unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Implement FromStr for generated enums. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * crown: Allow returning unrooted values from Default::default. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Filter out webidl files based on special comments, and feature-gate webxr ↵Josh Matthews2024-11-2491-52/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interfaces. (#34348) * Filter out webidl files based on skip-if directives. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Don't build XR functionality without webxr feature. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Adjust imports for file movement. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Clean up webxr module import. Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* Generate a trait abstracting over all known DOM interfaces (#34357)Josh Matthews2024-11-24382-385/+548
| | | | | | | | | | | | | | | | | * 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>
* Implement `ShadowRoot.innerHtml` attribute (#34335)Simon Wülker2024-11-226-53/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement DocumentFragment::fragment_serialization_algorithm Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement ShadowRoot innerHtml attribute Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * cargo-clippy Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reuse existing serialization code and move helpers into Node Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix typo Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fork Stylo's `malloc_size_of` into Servo (#34332)Martin Robinson2024-11-221-0/+8
| | | | | | | | | | | | | | | | 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>
* Plumb URL into interval profiler tracing events (#34337)Delan Azabani2024-11-221-1/+6
| | | Signed-off-by: Delan Azabani <dazabani@igalia.com>
* script: Throw a `TypeError` when trying to create an `OffscreenCanvas` with ↵chickenleaf2024-11-212-6/+8
| | | | | | | | | | | | | | | | | | | an unknown context type (#34276) * fixing test failures that involves throwing TypeError Signed-off-by: L Ashwin B <lashwinib@gmail.com> * handle all unknown values in a single fallback case Signed-off-by: L Ashwin B <lashwinib@gmail.com> * updating few more test- expectations Signed-off-by: L Ashwin B <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* crypto: Fix 192-bit checks for AES-GCM encrypt/decrypt (#34333)Daniel Adams2024-11-211-4/+4
| | | | | | | | | | | | | | | | | | | * Fix 192-bit key length check for AES-GCM encrypt/decrypt Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update expectations - Regenerated legacy ones as they had outdated expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add missed expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
* crypto: Include `key_ops` in exported JWKs, support JWK for HMAC import (#34317)Daniel Adams2024-11-211-24/+130
| | | | | | | | | | | | | | | | | * Improve JWK handling, HMAC import Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Fix logic in parse_jwk, properly stringify key_ops Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Implement `element.shadowRoot` attribute (#34306)Simon Wülker2024-11-215-17/+57
| | | | | | | | | | | | | | | | | | | * Implement Element.shadowRoot attribute Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Remove comments about shadowdom not being exposed for web content This is obviously not the case anymore. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Replace `sparkle` with `glow` in `components/canvas` (#33918)Samson2024-11-203-10/+15
| | | | | | | | | | | | | * Replace sparkle with glow in components/canvas Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Replace safe_gl with #34300 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Preference-gate `crypto.subtle` (#34295)Simon Wülker2024-11-192-16/+8
| | | | | | | | | | | | | * Update Crypto idl bindings Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Pref-gate Crypto.subtle attribute Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Remove referrer policy from document (#34263)shanehandley2024-11-1915-65/+44
| | | | | | | | | | | | | | | | | | | | | * Remove the referrer policy from document and rely on its policy container Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Make ReferrerPolicy non-optional, instead using a new enum value to represent the empty string case Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Fix clippy issue Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Fix usage of Option<ReferrerPolicy> in unit test Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Implement AES-GCM support for subtlecrypto (#34269)Simon Wülker2024-11-192-22/+343
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support normalizing AES-GCM for encryption Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement "encrypt" operation for AES-GCM Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow importing AES-GCM keys Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement AES-GCM decryption Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow normalizing AES-GCM for "generate key" Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * fmt Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix clippy errors Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Remove silly checks Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Support AES-GCM 128-bit encryption with 128 bit IV Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Support AES-GCM with wrapKey/unwrapKey Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations (again) Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Make ScriptEvaluate count script execution in DOM events and timers (#34286)Delan Azabani2024-11-192-80/+68
| | | Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Make ScriptParseHTML and ScriptParseXML only count actual parsing time (#34273)Delan Azabani2024-11-191-35/+66
| | | Signed-off-by: Delan Azabani <dazabani@igalia.com>
* crypto: Support key wrap operations + AES-KW (#34262)Daniel Adams2024-11-183-59/+520
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support key wrapping operations + AES-KW Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * tidy Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add allow for clippy Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add missing spec links Signed-off-by: Daniel Adams <msub2official@gmail.com> * Improve JWK handling Signed-off-by: Daniel Adams <msub2official@gmail.com> * Fix clippy warnings Signed-off-by: Daniel Adams <msub2official@gmail.com> * ./mach fmt Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Implement HMAC key generation (#34278)Simon Wülker2024-11-182-2/+119
| | | | | | | | | | | | | * Implement HMAC key generation Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* subtlecrypto: Don't throw exceptions twice when converting to Algorithm ↵Simon Wülker2024-11-151-25/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | object (#34239) * Don't throw exceptions twice when converting to Algorithm object Removes match statements like ```rust let Ok(ConversionResult::Success(algorithm)) = Algorithm::new(cx, value.handle()) else { return Err(Error::Syntax); }; ``` These don't cause issues if `Algorithm::new` returns `Ok(ConversionResult::Failure`, but in the case of `Err(())` the implementation already called `throw_type_error` and we must not throw an additional Syntax error, otherwise we'll crash. Luckily, this case is already handled elsewhere by the `value_from_js_object` macro. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Test that calling subtlecrypto methods with empty algorithm objects throws a TypeError The WebCryptoAPI spec does not tell us which error to throw exactly, but according to https://webidl.spec.whatwg.org/ it should be a TypeError. This previously crashed servo. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Plumb time profiler output into tracing (#34238)Delan Azabani2024-11-152-22/+30
| | | | | | | | | | | | | | | | | * Plumb time profiler output into tracing Signed-off-by: Delan Azabani <dazabani@igalia.com> * Enter the span tightly around the callback Signed-off-by: Delan Azabani <dazabani@igalia.com> * Use `info_span!()` shorthand Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
* fix: allow form submission for input [type=image] (#34203)shanehandley2024-11-141-23/+51
| | | | | | | | | | | | | * fix: allow form submission for input [type=image] Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Fix comments and use existing can_gc where available Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Add some more CanGc arguments for compiling module scripts. (#34182)Josh Matthews2024-11-131-1/+1
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>