aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
Commit message (Collapse)AuthorAgeFilesLines
* Ensure iframe load event occurs if initial about:blank is recreated with ↵Josh Matthews2024-10-021-37/+36
| | | | document.open.
* Only discard documents when no window replacement has occurred.Josh Matthews2024-09-271-2/+4
|
* Enter a realm when dispatching DOMContentLoaded.Josh Matthews2024-09-251-4/+5
|
* Don't suspend windows that have been replaced.Josh Matthews2024-09-251-1/+3
|
* Use existing window when navigating away from initial about:blank document.Josh Matthews2024-09-251-0/+10
|
* Only suppress load event dispatch.Josh Matthews2024-09-251-6/+8
|
* Hack: normalize all about:blank load behaviour and prevent load/pageshow ↵Josh Matthews2024-09-251-2/+11
| | | | events on the content documents.
* Replace .map_or(false with Option::is_some_and (#33468)Simon Wülker2024-09-161-7/+7
| | | Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* clippy: Fix suggestions in `script`, `libservo`, and `servoshell` (#33453)Ali2024-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * fix clone on copy warning in servoshell Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Remove unecessary borrow in libservo Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Ignore too many arguments warning on create_constellation() Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * fix explicit auto-deref warning Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Autofix multiple clippy warnings in components/script Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> --------- Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>
* Raf delivery: run rafs for all pipeline if tick received for any. (#33395)Gregory Terzian2024-09-111-2/+9
| | | | | | | | | | | | | * update the rendering: run rafs for all pipeline, if tick received for any Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * prioritize only one updating of the rendering per event-loop wake-up Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Stop using `time@0.1` in Servo (#33394)Martin Robinson2024-09-111-9/+9
| | | | | | | | This removes the last few uses of `time@0.1` in Servo. There are still dependencies from `style` and `webrender`, but they will be removed soon as well. The uses of this version of `time` are replaced with `std::time` types and `time@0.3` when negative `Duration` is necessary. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: fixed document title being set to Some("") instead of None (#33354)Ben2024-09-101-26/+30
| | | | | | | | | | | | | | | | * Fixed document title being set to "" instead of None Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de> * Update components/script/dom/document.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Ben <bennyschulenburg@gmx.de> --------- Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de> Signed-off-by: Ben <bennyschulenburg@gmx.de> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Propagate `CanGc` from `Document::new()` (#33386)Andriy Sultanov2024-09-091-20/+29
| | | | | | | | | | | | | * Add canGc as a parameter to autogenerated trait methods Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com> * Propagate CanGc from Document::new() Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com> --------- Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
* webgpu: Factor out swapchain to separate file (#33367)Samson2024-09-091-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move some stuff to swapchain.rs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Use typed WebGPUContextId instead of u64 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Extract create_swapchain function and move more stuff in it Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * extract destroy_swapchain Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * extract swapchain_present Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * extract update_wr_image callback Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* script: Create a `CrossProcessInstant` to enable serializable monotonic time ↵Martin Robinson2024-09-051-44/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#33282) Up until now, Servo was using a very old version of time to get a cross-process monotonic timestamp (using `time::precise_time_ns()`). This change replaces the usage of old time with a new serializable monotonic time called `CrossProcessInstant` and uses it where `u64` timestamps were stored before. The standard library doesn't provide this functionality because it isn't something you can do reliably on all platforms. The idea is that we do our best and then fall back gracefully. This is a big change, because Servo was using `u64` timestamps all over the place some as raw values taken from `time::precise_time_ns()` and some as relative offsets from the "navigation start," which is a concept similar to DOM's `timeOrigin` (but not exactly the same). It's very difficult to fix this situation without fixing it everywhere as the `Instant` concept is supposed to be opaque. The good thing is that this change clears up all ambiguity when passing times as a `time::Duration` is unit agnostic and a `CrossProcessInstant` represents an absolute moment in time. The `time` version of `Duration` is used because it can both be negative and is also serializable. Good things: - No need too pass around `time` and `time_precise` any longer. `CrossProcessInstant` is also precise and monotonic. - The distinction between a time that is unset or at `0` (at some kind of timer epoch) is now gone. There still a lot of work to do to clean up timing, but this is the first step. In general, I've tried to preserve existing behavior, even when not spec compliant, as much as possible. I plan to submit followup PRs fixing some of the issues I've noticed. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Stop using `time` in DOM timers (#33262)Martin Robinson2024-08-301-4/+3
| | | | | | This switches to using `std::time` types for DOM timer operations, which allows removing our custom time units in favor of `Duration`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Stop using legacy `time` for `Document::reflow_timeout` (#33258)Martin Robinson2024-08-301-17/+22
| | | | | | | Use `std::time` from the Rust standard library instead. This is one step toward removing our use of the legacy `time` crate which has security issues. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Start marking functions that can transitively trigger a GC (#33144)Josh Matthews2024-08-221-2/+7
| | | | | | | | | | | | | | | | | * 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>
* Various borrow hazard fixes (#33133)Josh Matthews2024-08-201-8/+8
| | | | | | | | | | | | | | | | | | | | | * 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>
* Support HTML parser reentrancy (#32820)Josh Matthews2024-08-161-12/+0
| | | | | | | | | | | | | | | | | | | | | * Update parser interface for reentrancy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove assertions around invoking scripts with active parser. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Add regression test. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Run test with normal and async html parser. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Remove many explicit reflow calls (#33067)Josh Matthews2024-08-151-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove explicit reflow for iframe content updates. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove explicit reflow for timers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove explicit reflow for MouseEvent. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove explicit reflow for key events. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove explicit reflow for document load. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove explicit reflow for iframe load. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove unused reflow reasons. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Replace the lazy_static crate whth `std::sync::LazyLock` in ↵Hayashi Mikihiro2024-08-121-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | components/script (#33004) * replace in str.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace navigator.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace htmlmetaelement.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace document.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace cssstyledeclaration.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace script_runtime.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace window_named_properties.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce dependency lazy_static Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce lazy in script_runtime.rs `Mutex::new()` is const contexts. I think that `JS_ENGINE` is need not lazy initialize. Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
* enhance: Add support for `unsafe-eval` and `wasm-unsafe-eval` (#32893)Chocolate Pie2024-08-011-0/+14
| | | Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
* Remove the WebXR dependency on ancient `time@0.1` crate (#32862)Martin Robinson2024-07-261-4/+0
| | | | | | | | | | | `webxr` depends on a very old verison of `time`, which allowed serializing monotonic clock output. This isn't possible on all platforms, so newer versions of `time` do not allow this. In order to stop using the old 0.1 versions of `time` we have to stop relying on times passed from `webxr` to Servo. This change does that, at the cost of removing the XR profiling feature. It has to be rewritten in another way in the `webxr` crate. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Gamepad: Implement GamepadHapticActuator (#32046)Daniel Adams2024-07-201-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement Servo side of GamepadHapticActuator Signed-off-by: Daniel Adams <msub2official@gmail.com> * Get build working Signed-off-by: Daniel Adams <msub2official@gmail.com> * Create effect handling on embedder side Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update tracing for GamepadHapticEffect Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update gilrs to point to commit with effect complete event Signed-off-by: Daniel Adams <msub2official@gmail.com> * Implement playing and preempting haptic effects Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update IDL to add trigger rumble Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update WPT expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Handle stopping haptic effects from reset() Signed-off-by: Daniel Adams <msub2official@gmail.com> * ./mach fmt, fix test-tidy issues Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add extra validity checks for trigger rumble Signed-off-by: Daniel Adams <msub2official@gmail.com> * Retrieve supported haptic effects from embedder Signed-off-by: Daniel Adams <msub2official@gmail.com> * Fix test expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add missing spec link, pin gilrs commit Signed-off-by: Daniel Adams <msub2official@gmail.com> * servoshell cargo formatting Signed-off-by: Daniel Adams <msub2official@gmail.com> * Fix Cargo.toml Signed-off-by: Daniel Adams <msub2official@gmail.com> * Additional comments, realm proof, naming Signed-off-by: Daniel Adams <msub2official@gmail.com> * ./mach fmt Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update gilrs rev to gilrs-core 0.5.12 release Signed-off-by: Daniel Adams <msub2official@gmail.com> * Implement sequence ids for gamepad haptic promises Signed-off-by: Daniel Adams <msub2official@gmail.com> * Take playing effect promise instead of cloning Signed-off-by: Daniel Adams <msub2official@gmail.com> * Implement listener for reset function Signed-off-by: Daniel Adams <msub2official@gmail.com> * Fix Cargo.lock Signed-off-by: Daniel Adams <msub2official@gmail.com> * Restructure IPC listeners, add comments, handle visibility change Signed-off-by: Daniel Adams <msub2official@gmail.com> * Check that haptic effect still exists before handling ff completion event Signed-off-by: Daniel Adams <msub2official@gmail.com> * Visibility steps, add InRealm bindings for promises Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add Gamepad EmbedderMsg arms to egl servo_glue Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
* script: `document.visibilityState` and `document.hidden` (#32635)Ngo Iok Ui (Wu Yu Wei)2024-07-121-8/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Squashed commit of the following: commit 5e0ea9996cb0d8137c3e1cd04487a1065b61289d Author: Wu Yu Wei <yuweiwu@pm.me> Date: Thu Jul 11 13:37:51 2024 +0900 Move lint to new_inherited Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> commit a8cbfb1eef2650d153ef41c232d9e80e1118fc37 Merge: b819968f3e 7a33f8f008 Author: Wu Yu Wei <yuweiwu@pm.me> Date: Thu Jul 11 13:32:18 2024 +0900 Merge branch 'main' into visibility commit b819968f3eaa361c8a2cf3af679943ae2065ab32 Merge: eda2ec4c22 1c6b74e1f1 Author: Wu Wayne <yuweiwu@pm.me> Date: Tue Jul 9 14:26:43 2024 +0900 Merge branch 'main' into visibility commit eda2ec4c225c63236d6851ea525455cad8874ce5 Author: Wu Wayne <yuweiwu@pm.me> Date: Thu Jul 4 14:25:05 2024 +0900 Include page-visibility tests to wpt commit 9da7b4ee39b141e59e4a21a64445c4b08499463f Author: Wu Yu Wei <yuweiwu@pm.me> Date: Thu Jul 4 12:50:40 2024 +0900 Add TODO comment for future update commit 11f55fea3ead0c8fa07f16557a63cc6a77c15c3f Author: Wu Yu Wei <yuweiwu@pm.me> Date: Wed Jul 3 11:01:51 2024 +0900 Add spaces between steps commit 408c3e51f25867e85f894cd77a6355bc32f2aa00 Author: Wu Wayne <yuweiwu@pm.me> Date: Tue Jul 2 18:33:53 2024 +0900 Update MANIFEST.json commit 679fe4ffdd28554b11b4018395fac22a08ccbc34 Author: Wu Wayne <yuweiwu@pm.me> Date: Tue Jul 2 18:27:02 2024 +0900 Add VisibilityStateEntry to mozilla/interfaces.html commit 4a456a2b4a473fa795274edf56ecf660616f90eb Author: Wu Wayne <yuweiwu@pm.me> Date: Tue Jul 2 14:28:11 2024 +0900 Update meta results commit cd191447ff61de392526e00c13f765c2df7a269e Merge: 7ff480a698 ad01342f00 Author: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me> Date: Tue Jul 2 13:47:49 2024 +0900 Merge branch 'main' into visibility commit 7ff480a698413ac5526edfb1b8731373bb9d04ae Author: Wu Yu Wei <yuweiwu@pm.me> Date: Tue Jul 2 13:12:44 2024 +0900 Update description text of update_visibility_state commit 0e496b7bce4fd5476a1919737b00e8f0c9e2fdc8 Author: Wu Yu Wei <yuweiwu@pm.me> Date: Tue Jul 2 12:59:40 2024 +0900 Add specification link to VisibilityStateEntry methods commit 3e4a061450621bd17f19ff81099dd4daaeaea478 Author: Wu Yu Wei <yuweiwu@pm.me> Date: Tue Jul 2 12:31:53 2024 +0900 Add descriptive text to each step commit 8bbdfcae97db5002b09e5f5ecec6ae80d080dc95 Author: Wu Wayne <yuweiwu@pm.me> Date: Fri Jun 28 19:15:34 2024 +0900 mach fmt commit dc1c7a4aec6aba56af7afcfee6feadbee242a643 Author: Wu Wayne <yuweiwu@pm.me> Date: Fri Jun 28 19:01:00 2024 +0900 Add update_visibility_state commit 6aa18143319044dc084a9585ab064cd853bccc21 Author: Wu Wayne <yuweiwu@pm.me> Date: Fri Jun 28 16:06:25 2024 +0900 Add VisibilityStateEntry.webidl commit 638ae3cd563004334d35cc3fbdc1f918d29833d0 Author: Wu Yu Wei <yuweiwu@pm.me> Date: Fri Jun 28 13:39:29 2024 +0900 Add visibilityState and hidden in Document.webidl Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> * Move creation into reflect call Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> --------- Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
* Fix more clippy (#32740)石蕊 (Pi-Cla)2024-07-091-3/+4
|
* clippy: Fix a bunch of warnings in `script` (#32680)Martin Robinson2024-07-041-7/+7
| | | This is just a portion of the errors that are remaining to be fixed.
* script: Implement the `FontFaceSet` DOM API (#32576)Mukilan Thiyagarajan2024-06-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a skeleton implementation of FontFaceSet interface with support for resolving the `document.fonts.ready` Promise when the loading of web fonts is completed. This change exposes new failures in the web platform tests. These were ERROR before the change because `document.fonts.ready` caused a `ReferenceError` causing the tests to be aborted and they now FAIL: - /css/CSS2/linebox/vertical-align-top-bottom-001.html - /css/css-flexbox/flex-one-sets-flex-basis-to-zero-px.html - /css/css-fonts/generic-family-keywords-001.html - /css/css-fonts/math-script-level-and-math-style/math-script-level-004.tentative.html - /css/css-fonts/math-script-level-and-math-style/math-script-level-002.tentative.html - /css/css-text/text-autospace/text-autospace-ligature-001.html - /css/css-values/calc-size/calc-size-width.tentative.html These were TIMEOUT before the change because `document.fonts.ready` was a ReferenceError and the tests were asynchronous (reftest-wait). These now FAIL because the assertions are now executed after fonts are loaded: - /css/css-fonts/matching/fixed-stretch-style-over-weight.html - /css/css-fonts/matching/range-descriptor-reversed.html - /css/css-fonts/matching/stretch-distance-over-weight-distance.html - /css/css-fonts/matching/style-ranges-over-weight-direction.html - /css/css-fonts/variations/variable-box-font.html - /css/css-fonts/variations/variable-gpos-m2b.html - /css/css-fonts/variations/variable-gsub.html - /css/css-fonts/variations/variable-opsz-size-adjust.html - /css/css-position/sticky/position-sticky-change-top.html - /css/css-position/sticky/position-sticky-fixed-ancestor.html - /css/css-position/sticky/position-sticky-flexbox.html - /css/css-position/sticky/position-sticky-grid.html - /css/css-position/sticky/position-sticky-inline.html - /css/css-position/sticky/position-sticky-rendering.html - /css/css-position/sticky/position-sticky-stacking-context.html - /css/css-position/sticky/position-sticky-table-td-left.html - /css/css-position/sticky/position-sticky-table-td-right.html - /css/css-position/sticky/position-sticky-table-tfoot-bottom.html - /css/css-position/sticky/position-sticky-table-th-right.html - /css/css-position/sticky/position-sticky-table-thead-top.html - /css/css-position/sticky/position-sticky-table-tr-bottom.html - /css/css-position/sticky/position-sticky-table-tr-top.html - /css/css-position/sticky/position-sticky-writing-modes.html - /css/css-pseudo/marker-intrinsic-contribution-001.html - /css/css-text/hyphens/hyphens-character.html These tests now PASS due to this patch: * FAIL -> PASS - /html/canvas/element/text/2d.text.draw.fill.maxWidth.fontface.html - /html/canvas/element/text/2d.text.measure.width.empty.html * TIMEOUT -> PASS - /css/css-fonts/variations/font-descriptor-range-reversed.html - /css/css-fonts/variations/variable-opsz.html - /css/css-position/sticky/position-sticky-table-th-left.html * ERROR -> PASS - /css/css-fonts/generic-family-keywords-002.html - /css/css-fonts/generic-family-keywords-003.html * These two tests only PASS in Layout 2020: - /css/CSS2/positioning/inline-static-position-001.html - /css/cssom-view/getBoundingClientRect-empty-inline.html These two tests have subtests that PASS intermittenttly: - /fetch/metadata/generated/css-font-face.sub.tentative.html - /css/css-fonts/generic-family-keywords-001.html These tests are new TIMEOUTS that used to FAIL because `documents.fonts.ready` was undefined: - /resource-timing/TAO-match.html - /resource-timing/content-type.html - /resource-timing/nextHopProtocol-is-tao-protected.https.html The failure in `/resize-observer/change-layout-in-error.html` could be due to an issue in the ResizeObserver implementation that is now exposed with this change, but this needs more investigation. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* servoshell: Reset link status when loading a new document (#32518)webbeef2024-06-181-0/+1
| | | | | * Reset link status when loading a new document * Reset hover link when navigating back or forward
* implement basic infra for ResizeObserver (#31108)Gregory Terzian2024-06-171-2/+70
|
* script: Have `Document` own `Layout` (#32316)Martin Robinson2024-05-201-26/+11
| | | | | | Have `Document` own `Layout`. This makes it impossible to have a `Document` without `Layout`, which was true, but now the compiler checks it. In addition, `Layout` is now released when the `Document` is, avoiding leaking the entire `Layout`.
* 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`.
* Fix RefCell borrows (#32276)Samson2024-05-131-3/+2
| | | | | | | * Fix RefCell borrows * Update document.rs fmt
* script: Start rework to better match the specification HTML event loop (#31505)Gregory Terzian2024-05-131-3/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix the HTML event-loop: add a update the rendering task add rendering task source sketch structure to update the rendering resize steps composition events fix warnings in rendering task source refactor handling of composition events: put window and doc for pipeline on top set script as user interacting in update the rendering task fmt add todos for other steps, put all compositor handling logic in one place update the rendering: evaluate media queries and report changes update the rendering: update animations and send events update the rendering: run animation frames update the rendering: order docs put rendering related info on documents map tidy update the rendering: add issue numbers to todos update the rendering: reflow as last step update the rendering: add todo for top layer removals note rendering opportunity when ticking animations for testing fix double borrow crash in css/basic-transition fix faster reversing of transitions test undo ordering of docs bypass not fully-active pipeline task throttling for rendering tasks ensure tasks are dequed from task queue prioritize update the rendering task remove servo media stuff from set activity tidy debug update the rendering: perform microtask checkpoint after task tidy-up only run evaluate media queries if resized re-add evaluation of media queries for each rendering task, re-prioritize rendering tasks, re-add microtask checkpoint for all sequential messages re-structure resize steps, and their interaction with evaluating media queries and reacting to environment changes update the rendering: remove reflow call at the end update webmessaging expectations update to FAIL /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html update to FAIL load-pageshow-events-window-open.html add issue number for ordering of docs nits move batching of mouse move event to document info nits add doc for mouse move event index reset mouse move event index when taking pending compositor events fix replacing mouse move event nits * move update the rendering related data to document * move re-taking of tasks to try_recv * address nits * change task queue try_recv into take_tasks_and_recv, with nits * refactor process_pending_compositor_events * when updating the rendering, return early if script cannot continue running * use an instant for the last render opportunity time * nits * remove handle_tick_all_animations * use a vec for pending resize and compositor events * fix spec links * Fix a few other nits before landing --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Fix some clippy warnings in `components/gfx` and `components/script` (#32215)Pi-Cla2024-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * clippy: Squish warnings and errors in gfx warning: redundant closure (gfx/font.rs:415:18) warning: useless conversion to the same type (gfx/font.rs:534:9) warning: the following explicit lifetimes could be elided: 'a (gfx/font.rs:619:16) error: this loop never actually loops (gfx/font_cache_thread.rs:112:9) warning: this expression creates a reference which is immediately dereferenced by the compiler (gfx/font_cache_thread.rs:229:51) warning: redundant closure (gfx/font_cache_thread.rs:551:18) 3 instances of: warning: casting integer literal to `f64` is unnecessary (gfx/platform/freetype/font_list.rs:271-273) * clippy: methods called `from_*` usually take no `self` It reports that by standard convention, from_* methods should not take any `&self` parameter * clippy: you should consider adding a `Default` implementation It reports that public types with a pub fn new() -> Self should have a Default implementation since they can be constructed without arguments * clippy: casting to the same type is unnecessary (`f32` -> `f32`) * clippy: use of `unwrap_or_else` to construct default value * clippy: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self` * clippy: manual `!RangeInclusive::contains` implementation contains expresses the intent better and has less failure modes (such as fencepost errors or using || instead of &&) * clippy: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]` * clippy: Fix some new warnings warning: this `if` statement can be collapsed (gfx/font.rs:468:130) warning: this lifetime isn't used in the impl (gfx/platform/freetype/font.rs:341:6) warning: field assignment outside of initializer for an instance created with Default::default() (compositor.rs:881:17)
* Fixe some clippy warnings (#32131)komuhangi2024-04-291-2/+4
|
* script: Prevent "scroll to fragment" from scrolling offscreen (#32129)Martin Robinson2024-04-251-19/+10
| | | | | | | | | Previously, the "scroll to fragment" operation could scroll past the end of the screen, because the scroll position was not clamped to viewport boundaries. Correct this by using the `Window::scroll()` method which handles this case. In addition, ensure that `Window`'s `current_viewport` member is initialized properly when it is created.
* script_layout: Remove script to layout messages (#32081)Martin Robinson2024-04-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of communicating with layout via messages, script can simply call methods on the layout trait. This simplifies the way that script communicates with layout and opens the path to sharing more data structures between the two systems. This is part of a continuing series of cleanups after removing the layout thread. <!-- 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 should not change behavior. <!-- 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. -->
* Implement form-associated custom elements and their ElementInternals (#31980)cathiechen2024-04-111-22/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * FACEs work, setFormValue test is awful so now has _mozilla backup * 1. Impl Validatable in ElementInternals instead of HTMLElement. 2. Reuse the code in Validatable trait. 3. The form associated custom element is not a customized built-in element. * add some comments * support readonly attribute and complete barred from constraint validation * Addressed the code review comments * Updated the legacy-layout results * Fixed the WPT failures in ElementInternals-validation.html * Addressed the code review comments * Review suggestions * Fixed silly mistakes and update the test result outside elementinternals * update the test results --------- Co-authored-by: Patrick Shaughnessy <pshaughn@comcast.net> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Add a `FontMetricsProvider` for resolving font-relative units (#31966)Martin Robinson2024-04-041-14/+8
| | | | | | | | | | | | | | | | | | | The only font relative unit that Servo knows how to resolve currently is `rem` (relative to the root font size). This is because Stylo cannot do any font queries. This adds a mechanism to allow this, exposing the ability to properly render `ex` units in Servo. This change only allows resolving some font size relative units thoug, as Servo doesn't collect all the FontMetrics it needs to resolve them all. This capability will be added in followup changes. Some new tests fail: - ex-unit-001.html: This test fails because Servo does not yet have support for setting the weight using @font-face rules on web fonts. - ex-unit-004.html: This test fails because Servo does not yet have support for setting the Unicode range of a web font using @font-face rules. - first-available-font-001.html: This test fails because the above two feature are missing.
* script: Reduce the use of `unsafe` in LayoutDom (#31979)Martin Robinson2024-04-031-10/+10
| | | | | | | | | | | | | Remove the use of unsafe code in the layout wrappers of the DOM. The main change here is that `unsafe_get()` no longer needs to be an unsafe method, which allows us to transitively remove or reduce unsafe blocks from callers. The function itself is not renamed, because it's still a bit dangerous to start removing the layers of abstraction from actual DOM nodes. In addition `init_style_and_opaque_layout_data` can be merged into `initialize_data`, which removes one more unsafe method. Finally, a "Safety" section is added to some unsafe methods.
* clippy: Allow `too_many_arguments` for existing functions (#31974)eri2024-04-021-0/+3
| | | | | * Allow `too_many_arguments` for existing functions * fix: Surround ASCII with code block in rustdoc
* clippy: Fix needless_borrow warnings in components/script (#31928)Azhar Ismagulova2024-03-291-1/+1
|
* clippy: Fix another set of clippy problems in `components/script/dom` (#31909)Rosemary Ajayi2024-03-281-8/+8
| | | | | | | | | * a reference to a reference * length comparison to zero * length comparison to zero * length comparison to zero
* fonts: Add support for WOFF2 and properly load web fonts from @imports (#31879)Martin Robinson2024-03-261-3/+10
| | | | | | | | | | | | This change also makes two fixes that are necessary to get WOFF2 fonts working: 1. It adds support for loading web fonts from stylesheets included via @import rules. 2. It ensure that when web fonts are loaded synchronusly they invalidate the font cache. This led to incorrect font rendering when running tests before. Fixes #31598.
* fixed the `unneeded return` statement warnings. (#31863)Aarya Khandelwal2024-03-261-1/+1
|
* fixes dereferencing on an immutable reference (#31864)Aarya Khandelwal2024-03-261-3/+3
|
* clippy: Fix collapsible_if warnings (#31852)Oluwatobi Sofela2024-03-251-4/+2
|
* changed `match` to 'matches!' (#31850)Aarya Khandelwal2024-03-251-27/+19
|