aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/resizeobserver.rs
Commit message (Collapse)AuthorAgeFilesLines
* script: Fix resize observer depth calculation for Shadow DOM. (#36230)Josh Matthews2025-03-311-1/+1
| | | | | | | | | Follow the specification more closely by using the flat tree when calculating depth for the resize observer. Testing: Newly passing WPT test. Fixes: #36092 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Remove interior mutability from `ResizeObservation` (#36233)Simon Wülker2025-03-311-17/+16
| | | | | | This is struct is always already wrapped in a RefCell by `ResizeObserver`. It is not exposed to JS itself, so it doesn't need `RefCell`s. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Only invoke resize observer callback when the observed element changed its ↵Simon Wülker2025-03-311-3/+41
| | | | | | | | | | | size (#36226) This change also adds a bunch of spec comments, because our ResizeObserver implementation deviates from the spec significantly in ways that are not immediately intuitive. Fixes https://github.com/servo/servo/issues/36096 Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: Mark callback methods with CanGc. (#35753)Josh Matthews2025-03-031-1/+1
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-6/+2
| | | | | | | | | | | | | * 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>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 node helpers as `NodeTraits` and give more descriptive names ↵Martin Robinson2025-01-031-2/+2
| | | | | | | | | | | | | (#34832) This puts a few commonly used `Node` helpers into a trait (`NodeTraits`) and gives them more descriptive names and documentation. The renames: - `document_from_node` -> `NodeTraits::owner_document` - `window_from_node` -> `NodeTraits::owner_window` - `stylesheets_owner_from_node<T:` -> `NodeTraits::stylesheet_list_owner` - `containing_shadow_root` -> `NodeTraits::containing_shadow_root` Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Upgrade rustc to 1.83 (#34793)Nico Burns2025-01-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* script: Remove `note_rendering_opportunity` and `rendering_opportunity` (#34575)Martin Robinson2024-12-121-5/+0
| | | | | | | | | | | | | | | 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>
* 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>
* CanGc changes from fontfaceset.rs (#33920)chickenleaf2024-10-211-5/+10
| | | | | | | | | | | | | | | | * CanGc changes from fontfaceset.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * Update components/script/dom/bindings/codegen/Bindings.conf Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: chickenleaf <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com> Signed-off-by: chickenleaf <lashwinib@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Fix GC borrow hazard in ResizeObserver::broadcast_active_resize_observations ↵tanishka2024-10-191-16/+20
| | | | | | | | | | | | | | | | | | | | | | | (#33875) * Fix GC borrow hazard in ResizeObserver Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Use borrow instead of borrow_mut Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Refactor to avoid borrow conflicts Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Copy value out of borrowed value Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
* More CanGc fixes (#33888)chickenleaf2024-10-171-0/+1
| | | Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* CanGc fixes in components/script/dom (#33862)tanishka2024-10-161-1/+1
| | | Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
* CanGc fixes in focusevent.rs oscillartornode.rs response.rs ↵chickenleaf2024-10-131-1/+2
| | | | | resizeobserversize.rs animationevent.rs (#33827) Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* script: Include constructors and static methods in generated DOM traits (#33665)Josh Matthews2024-10-081-14/+13
| | | | | | | | | | | | | | | | | * Add all constructors, special operations, and static methods to generated DOM interface traits. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Add missing doc links. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* tidy: Fix rustdoc warnings and add a tidy check for a common URL issue (#33366)Martin Robinson2024-09-081-1/+1
| | | | | | | | This change fixes all rustdoc errors and also adds a tidy check for a very common rustdoc URL issue. Eventually rustdoc warnings should likely cause the build to fail, but this catches those issues sooner in order to not waste so much developer time. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Start marking functions that can transitively trigger a GC (#33144)Josh Matthews2024-08-221-2/+6
| | | | | | | | | | | | | | | | | * Mark JS reflector wrappers as CanGc. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from reflect_dom_object_with_proto. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Mark DOM constructors as GC operations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* clippy: Fix four warnings (#32789)Danila Matveev2024-07-171-1/+1
| | | | | | | | | | | | | | | | | * Fixes 4 clippy rules Signed-off-by: Danila Matveev <usurname.r@gmail.com> * Rollbacks changes in range.rs and silences clippy::neg_cmp_op_on_partial_ord Signed-off-by: Danila Matveev <usurname.r@gmail.com> * Fixes a fmt issue Signed-off-by: Danila Matveev <usurname.r@gmail.com> --------- Signed-off-by: Danila Matveev <usurname.r@gmail.com>
* Fix more clippy (#32740)石蕊 (Pi-Cla)2024-07-091-4/+4
|
* implement basic infra for ResizeObserver (#31108)Gregory Terzian2024-06-171-0/+280