aboutsummaryrefslogtreecommitdiffstats
path: root/components
Commit message (Collapse)AuthorAgeFilesLines
...
* script: Set HTTP status code when aborting an `XMLHttpRequest` (#37190)Tunahan Karlibas10 days1-0/+3
| | | | | | | | | Correctly set status when aborting a XMLHttpRequest. Testing: WPT test xhr/abort-during-done.window.html --------- Signed-off-by: Tunahan Karlibas <dvt.tnhn.krlbs@icloud.com>
* Split handle_player_event into smaller functions (#37113)Michael Rees10 days1-354/+380
| | | | | | | | | | | | | | | | Split HTMLMediaElement::handle_player_event into smaller functions (#37109) As requested, I also did a quick pass over the entire file looking for if/else blocks that could be converted into early returns, but only found two. Both of those have been changed here. Testing: This doesn't require (new) tests because it is a reorganization of existing code. Fixes: #37109: HTMLMediaElement::handle_player_event is too big --------- Signed-off-by: Michael Rees <mrees@noeontheend.com>
* DevTools: Fix empty `debugger > source` panel (#37197)atbrakhi11 days3-1/+62
| | | | | | | | | | | | | | | | | | | | | This patch fixes the source panel in the DevTools that was broken due to missing breakpoint actor implementation. The client was sending messages to the breakpoint actor that didn't exist in Servo, resulting in "unknown actor" warnings in the logs(See logs in issue description) To fix this this patch implements the `BreakpointListActor` that handles `setBreakpoint` and `setActiveEventBreakpoints` messages with empty replies. This PR does not implement `breakpoint` functionality <img width="1512" alt="image" src="https://github.com/user-attachments/assets/ac4985a6-9fd3-4854-a491-b39241e19d13" /> Fixes: https://github.com/servo/servo/issues/37196 Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* dom: implement signal abort on controller and signal (#37192)Gregory Terzian11 days3-9/+101
| | | | | | | Part of https://github.com/servo/servo/issues/34866 Implement signal abort, and part of running abort steps. Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* layout: Split overflow calculation after fragment tree construction (#37203)Oriol Brufau11 days9-82/+136
| | | | | | | | | | | | | | Instead of computing scrollable overflow while constructing the fragment tree, we will now do it later. In the future this will also allow to only recalculate the overflow without rebuilding the tree when transform properties change, but that's left for a follow-up. Stylo PR: https://github.com/servo/stylo/pull/194 Testing: One test is now passing (more investigation is needed), but otherwise this isn't expected to have any effect. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Constellation can now optionally report memory usage when the page is ↵Narfinger12 days5-1/+14
| | | | | | | | | | | | | | | | | | loaded. (#37151) The constellation can now tell the memory reporter to report the memory to a trace file when a page is loaded. Additionally, we amend the memory reporter to allow a simple message where it will report the memory to a tracing provider (at the moment only OHOS/hitrace is supported but easy extension is possible). I am not sure if this is the right approach or if the embedder should decide to have the memory reporting done. Testing: This does not change functionality of any of the rendering. --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
* Implement Input `type=text` UA Shadow DOM (#37065)Steven Novaryo12 days6-36/+313
| | | | | | | | | | | | | | | | | | | | | | | | Implement Shadow Tree construction for input `type=text`, adding a text control inner editor container and placeholder container. Subsequently, due to the changes of the DOM tree structure, the changes will add a new NodeFlag `IS_TEXT_CONTROL_INNER_EDITOR` to handle the following cases. - If a mouse click button event hits a text control inner editor, it will redirect the focus target to its shadow host. - In text run's construction, the text control inner editor container queries the selection from its shadow host. This is later used to resolve caret and selection painting in the display list. This will be the first step of fixing input `type=text` and other single-line text input element widgets. Such as, implementing `::placeholder` selector. Testing: Existing WPT test and new Servo specific appearance WPT. Fixes: #36307 --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* constellation: Wait for canvas thread to shut down before shutting down ↵Martin Robinson12 days3-3/+14
| | | | | | | | | | | | | | system font service (#37182) The canvas thread might need access to the system font service before it shuts down. Ensure that it finishes shutting down before triggering the shutdown of the system font service. This should avoid issues where canvas tries to access fonts right before shutting down. Fixes: #36849. Testing: Since this fixes a flaky crash on shutdown, there isn't a good way to write a test for it. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Send synthetic keydown/keyup at ime_insert_text (#37175)Kenzie Raditya Tirtarahardja12 days1-0/+3
| | | | | | | | | | | | | | | | | | At `egl/app_state.rs`, send keydown and keyup with PROCESS KEY when inserting text. This fixes OHOS input event, but maybe also for Android in the future (if it implements `ime_insert_text`). We will get input event since keydown is dispatched (https://github.com/servo/servo/pull/37078). This implementation is similar to [Chromium's](https://source.chromium.org/chromium/chromium/src/+/main:content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java;drc=404e8d654e8b26336d2cb103b9c21faecbf7f73a;bpv=1;bpt=1;l=851?gsn=sendCompositionToNative&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fchromium.googlesource.com%2Fcodesearch%2Fchromium%2Fsrc%2F%2Fmain%3Flang%3Djava%3Fpath%3Dorg.chromium.content.browser.input.ImeAdapterImpl%23d840961d441fd4bb569f9689c86da91fb714c0c153366e3198a85e9c7a098dce) Android key event. Testing: manually checked on OHOS device For: https://github.com/servo/servo/issues/36259, but only in OHOS Signed-off-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com> Co-authored-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com> Co-authored-by: stevennovaryo <steven.novaryo@gmail.com>
* script: Let canvas serialization to image fail gracefully (#37184)Martin Robinson13 days1-40/+62
| | | | | | | | | | | | Instead of panicking when serialization of canvas to image data (whether through `toBlob()` or via `toDataURL()`), properly handle failed serialization. This is an implementation of the appropriate error handling from the specification text. Testing: This change includes a new Serov-specific test, because it is impossible to know what the canvas size limits are of all browsers. Fixes: #36840. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Implement basics of link preloading (#37036)Tim van der Lippe13 days116-356/+742
| | | | | | | | | | | These changes allow a minimal set of checks for font-src CSP checks to pass. Part of #4577 Part of #35035 --------- Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
* compositor: Add an initial RefreshDriver (#37169)Martin Robinson13 days5-69/+291
| | | | | | | | | | | | | | | This adds a *very* basic implementation of the `RefreshDriver` concept to the Servo renderer. The initial idea is that controls the frequency of display during animations. It eliminates the "slowdown" workaround for WPT tests and now Servo animations don't move faster than 120 FPS (observed to be slower in practice). This establishes a base change which will be used to implement non-display-list-producing layouts in a followup change. Fixes #3406. (though much more work remains) Testing: Covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* pixels: Add limitation to max image total bytes length (#37172)Andrei Volykhin13 days5-27/+54
| | | | | | | | | | | | | | | | | | | Limit the maximum image allocation size to 2GB to minimize the possibility of out of memory errors on some `ImageBitmap`, `ImageData`, `Canvas`, and `OffscreenCanvas` operations such as construction, `toBlob`, and `toDataURL`. Other browsers have similar limits: - Chromium: 2^32-1 (~4GB) - Firefox: 2^31-1 (~2GB) Testing: Improvements to the following tests: - `html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html` assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(1 << 31, 1 << 31); }); - `html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html` makeOversizedCanvas + makeOversizedOffscreenCanvas Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Add a user agent style for the `<slot>` element (#37174)Fuguo13 days1-0/+4
| | | | | | | | | In Chromium, the slot user agent stylesheet is located in [html.css](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/resources/html.css;l=1654). Testing: This change fixes `tests/wpt/meta/shadow-dom/directionality-001.tentative.html.ini`. Signed-off-by: kongbai1996 <1782765876@qq.com>
* Refactoring `HTMLOptionElement::Text` into iterative style (#37167)Kingsley Yung14 days2-21/+26
| | | | | | | | | | | | | | | | | | | | | | | The original implementation of `HTMLOptionElement::Text` is recursive, and the program may run out of stack space for a sufficiently large number of iterations. The patch switches to an iterative implementation, with `TreeIterator`. Note that, instead of the usual `while let Some(node) = iterator.next()` approach, we use `while let Some(node) = iterator.peek()` with the newly added `TreeIterator::peek` function. This is because the choice of the next node depends on some checks performed inside the `while` block, whereas the `next` function determines the next node before entering the block. Moreover, the `TreeIterator::peek` function is added, instead of wrapping the iterator into `Peekable`. This is because we will lose access to the `TreeIterator::next_skipping_children` function if we wrap it into `Peekable`. Testing: This refactoring has to pass the existing tests. Fixes: #36959 Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
* canvas: Add HTMLVideoElement to CanvasImageSource union type (#37135)Andrei Volykhin14 days6-31/+177
| | | | | | | | | | | | | | | | | | | | | Follow to the specification and add HTMLVideoElement to CanvasImageSource union type to allow use it as image source for createPattern/drawImage operations. https://html.spec.whatwg.org/multipage/#canvasimagesource https://html.spec.whatwg.org/multipage/#dom-context-2d-createpattern https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage The HTMLVideoElement media resource has an associated origin: - media provider object (MediaStream/MediaSource/Blob): CORS-same-origin - URL record: CORS-cross-origin/CORS-same-origin https://html.spec.whatwg.org/multipage/media.html#media-resource Testing: - html/canvas/element/* - html/semantics/embedded-content/the-canvas-element/* Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Let `input` JS event be dispatched by `keydown` instead of `keypress` (#37078)Euclid Ye14 days4-28/+51
| | | | | | | | | | | | 1. Let `input` JS event be dispatched by `keydown` instead of `keypress`, according to spec 2. Fire `input` event for Backspace and Delete. But do so only when something is actually deleted Testing: Manually tested and compared with other browsers. Fixes: #37051 cc @xiaochengh Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Refactor the memory profiler code to return the struct. (#37155)Narfinger2025-05-283-18/+21
| | | | | | | | | | | | Refactor the memory profiler code to return the struct and handle the serializing in servointernal page. This allows other users of the memory profiler to see the whole report without parsing json. Testing: I do not know if the memory page is covered by tests. --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
* layout: Fix logic for transforms with non-invertible matrix (#37147)Oriol Brufau2025-05-271-24/+7
| | | | | | | | | | | | | | | | | When the the current transformation matrix of a box isn't invertible, the box and its content shouldn't be displayed. However, the logic was broken: - It was only checking the `transform` property, but not individual transform properties like `scale`. - It was treating matrices with m₁₁=0 or m₂₂=0 and non-invertible, even when they can still be invertible and have a visible outcome. - When m₁₁=0 or m₂₂=0 weren't caused by `transform`, it was replacing the matrix with the identity. Testing: Adding new WPT Fixes: #37146 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* [#26488] Moved Droppable code into a separate struct for ↵Domenico Rizzo2025-05-271-16/+28
| | | | | | | | | | | CanvasRenderingContext2D (#37136) This is part of incremental implementation of #26488 . The interface involved in this PR is CanvasRenderingContext2D. Testing: Test should be just implemented. Fixes: Partially #26488 Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* Add support for static SVG images using `resvg` crate (#36721)Mukilan Thiyagarajan2025-05-2734-302/+888
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds support for rendering static SVG images using the `resvg` crate, allowing svg sources in the `img` tag and in CSS `background` and `content` properties. There are some limitations in using resvg: 1. There is no support for animations or interactivity as these would require implementing the full DOM layer of SVG specification. 2. Only system fonts can be used for text rendering. There is some mechanism to provide a custom font resolver to usvg, but that is not explored in this change. 3. resvg's handling of certain edge cases involving lack of explicit `width` and `height` on the root svg element deviates from what the specification expects from browsers. For example, resvg uses the values in `viewBox` to derive the missing width or height dimension, but without scaling that dimension to preserve the aspect ratio. It also doesn't allow overriding this behavior. Demo screenshot: ![servo - resvg img](https://github.com/user-attachments/assets/8ecb2de2-ab7c-48e2-9f08-2d09d2cb8791) <details> <summary>Source</summary> ``` <style> #svg1 { border: 1px solid red; } #svg2 { border: 1px solid red; width: 300px; } #svg3 { border: 1px solid red; width: 300px; height: 200px; object-fit: contain; } #svg4 { border: 1px solid red; width: 300px; height: 200px; object-fit: cover; } #svg5 { border: 1px solid red; width: 300px; height: 200px; object-fit: fill; } #svg6 { border: 1px solid red; width: 300px; height: 200px; object-fit: none; } </style> </head> <body> <div> <img id="svg1" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo"> </div> <div> <img id="svg2" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo"> <img id="svg3" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo"> <img id="svg4" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo"> </div> <div> <img id="svg5" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo"> <img id="svg6" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo"> </div> </body> ``` </details> --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: stub `AbortSignal` (#37033)Gregory Terzian2025-05-273-0/+86
| | | | | | | | | | | | This is a stub for `AbortSignal`, which we would like to merge first in order to work in parallel on https://github.com/servo/servo/issues/34866, and perhaps also https://github.com/servo/servo/issues/36936 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com>
* imagebitmap: Use snapshot::Snapshot as bitmap data (#37131)Andrei Volykhin2025-05-276-47/+47
| | | | | | | | | | | | | | | Replace the holder of actual pixel data of the ImageBitmap interface ([[BitmapData]] slot) from Vec<u8> to snapshot::Snapshot (image bitmap with metadata). https://html.spec.whatwg.org/multipage/#the-imagebitmap-interface It will allow to have all required information (e.g. size, pixel format, alpha mode) for further drawing processing to/from canvas2D output bitmap. Testing: No required tests Fixes: https://github.com/servo/servo/issues/34112 Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* refactor: merge `cross_realm_transform_*` fields into one (#37102)Jason Tsai2025-05-272-61/+68
| | | | | | | | | | | | | | | | | In https://github.com/servo/servo/pull/36977, when transferring `TransformStream`, `CrossRealmTransform::Writable` and `CrossRealmTransform::Readable` are set to different message ports. The message port will not be readable and writable at the same time when transferring the stream, so we can now merge `cross_realm_transform_readable` and `cross_realm_transform_writable` into a single field `cross_realm_transform`. Testing: WPT ([passed on try branch](https://github.com/pewsheen/servo/actions/runs/15209389525/job/42784179519)) Fixes: https://github.com/servo/servo/issues/37084 --------- Signed-off-by: Jason Tsai <git@pews.dev>
* constellation: Pass system theme to new Pipelines (#37132)Martin Robinson2025-05-2618-74/+200
| | | | | | | | | | | | Previously, when the theme was set it was only set on currently active `Window`s. This change makes setting the `Theme` stateful. Now the `Constellation` tracks what theme is applied to a `WebView` and properly passes that value to new `Pipeline`s when they are constructed. In addition, the value is passed to layout when that is constructed as well. Testing: this change adds a unit test. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Rename `Stylesheet::Type_` to `Stylesheet::Type` (#37126)Simon Wülker2025-05-252-3/+3
| | | | | | | | | | | | I'm not sure if `CodegenRust.py` was supposed to remove the underscore, but we end up exposing `type_` to javascript which is obviously wrong. There's no need to rename the method in the first place, because `Type` (with a capital T) is not a rust keyword. Testing: Covered by existing web platform tests --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Complete keyword list in `CodegenRust.py` (#37127)Simon Wülker2025-05-251-8/+59
| | | | | | | | | | Newer keywords such as `async`/`await`/`gen` were missing from the list There are no web platform APIs with these names, but it doesn't hurt to keep the list up to date. --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: Return global objects for DOM objects in the relevant realm (#37120)Josh Matthews2025-05-252-14/+13
| | | | | | | | | | | | | | | | | | | DomObject::global is a tricky API because it's used pervasively but has subtle requirements that are not documented and not yet enforced by the type system (#36116). The method returns the relevant global object for a given DOM object, but that operation is only meaningful if there is an active realm. We usually, but not always, have an active realm. This change avoids a footgun by following the principle of least surprise. Rather than making every single caller of `something.global()` both prove that there is an active realm and think about which realm they want active, we implement the obvious behaviour: always activate the realm of the callee before obtaining the relevant global. Testing: Existing WPT coverage is sufficient; this method is called all over the codebase. Fixes: #37070 #27037 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Don't set a prototype for unscopable objects (#37122)Simon Wülker2025-05-251-6/+10
| | | | | | | | Testing: Covered by existing web platform tests Fixes: https://github.com/servo/servo/issues/25022 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Make unscopable objects writable and enumerable (#37119)Simon Wülker2025-05-241-4/+4
| | | | | | | | Testing: Covered by existing web platform tests Fixes: https://github.com/servo/servo/issues/37118 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Unconditionally enable the URLPattern API (#37116)Simon Wülker2025-05-242-6/+1
| | | | | | We fail only a couple of the URLPattern tests and I think that's mostly due to bugs in the `urlpattern` crate. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Implement `URLPattern::{text, exec}` (#37044)Simon Wülker2025-05-243-59/+171
| | | | | | | | | | | | With this change the URLPattern API is fully implemented. I'll look into the remaining failures and then enable the preference by default. Testing: Covered by web platform tests Depends on https://github.com/servo/servo/pull/37042 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: Add support for polygons in `HtmlAreaElement::hit_test` (#37064)Ashwin Naren2025-05-241-2/+24
| | | | | | | | | | Uses raycasting to determine whether point is in polygon Testing: Added unittest Fixes: None to my knowledge --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
* ImageBitmap::new returns without Fallible (#37114)Kingsley Yung2025-05-242-11/+6
| | | | | | | | | | | ImageBitmap::new always returns Ok. Simplify it by changing to return DomRoot<ImageBitmap> directly. The #[allow(dead_code)] seems unnecessary. This patch also removes it. Testing: No test is needed. Fixes: #37105 Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
* layout: Use the viewport size as the `background-attachment: fixed` ↵Martin Robinson2025-05-241-13/+5
| | | | | | | | | | | | | | | | positioning area (#37097) This fixes the combination of `background-attachment: fixed` and `no-repeat`. The positioning of the background should be relative to the viewport, so using an infinite rectangle breaks things like `center`. I'm not sure what the original motivation of using an infinite rectangle here and it doesn't seem to break any tests to stop using it. Testing: This fixes `/css/CSS2/backgrounds/background-bg-pos-206.xht`. Fixes #37082. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add another incremental layout that starts at stacking tree construction ↵Oriol Brufau2025-05-232-10/+14
| | | | | | | | | | | | | | (#37088) This allows to skip rebuilding the box tree when it's only necessary to rebuild the stacking context tree. Bumps Stylo to https://github.com/servo/stylo/pull/187 Testing: Unneeded (no behavior change). Just improving performance. However, this adds a new test for dynamic changes of `z-index`, which we were breaking in an earlier iteration of this patch. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* imagebitmap: Make ImageBitmap serializable and transferable (#37101)Andrei Volykhin2025-05-237-9/+195
| | | | | | | | | | | | | | According to specification ImageBitmap objects are serializable objects and transferable objects. https://html.spec.whatwg.org/multipage/#the-imagebitmap-interface:imagebitmap-11 Testing: - html/canvas/element/manual/imagebitmap/* - html/infrastructure/safe-passing-of-structured-data/* - html/webappapis/structured-clone/* - workers/semantics/structured-clone/* Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Allow `undefined` variants in IDL unions (#37042)Simon Wülker2025-05-232-10/+37
| | | | | | | | | | Testing: Includes a test which ensures that unions with a `undefined` variant compile Fixes https://github.com/servo/servo/issues/28679 Part of https://github.com/servo/servo/issues/30287 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* layout: Regardless of restyle damage, always reflow when viewport changes ↵Martin Robinson2025-05-232-34/+21
| | | | | | | | | | | | | | | (#37099) This fixes an issue where a viewport change did not trigger a reflow, when the restyle damage was was otherwise REPAINT. Viewport changes mean changes to the initial containing block, which is one of the main inputs to layout. This should trigger a reflow always. Testing: Unfortunately, our testing infrastructure is not good enough yet to test changes to layout when resizing the `WebView`, so it is quite difficult to write tests for this change. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Removing unused dependencies in crates. (#37096)Narfinger2025-05-2316-20/+0
| | | | | | | | Removed unused dependencies in various crates using cargo-machete, grep and cargo-udeps. Testing: The CI tests if any dependencies were used that are removed. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
* Remove accidentally re-added logic to `WebDriverSession::input_cancel_list` ↵Euclid Ye2025-05-231-56/+0
| | | | | | | | | (#37081) Re-remove deleted logic from `WebDriverSession::input_cancel_list` logic in #37010 which was re-adedd during merge resolution in #36932. Otherwise, duplicate items would be registered in Release Actions. Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Animation: update image active frame when update the rendering (#36286)TIN TUN AUNG2025-05-237-8/+261
| | | | | | | | | | | | | | | | | | | | | When no CSS animation exist, register timer for image animation, update animated image active image frame as part of update_the_rendering, mark node as dirty if the corresponding image need update. Added unit test to test ImageAnimationState. Part of https://github.com/servo/servo/issues/36057, the last step to let the Animated Image "Move". Testing: Introduced new WPT RefTest for animated image, but fail because of https://github.com/servo/servo/issues/36931. New unit test for `ImageAnimationState`. Fixes: https://github.com/servo/servo/issues/22903 https://github.com/servo/servo/issues/36057 [Try](https://github.com/rayguo17/servo/actions/runs/14724729664) --------- Signed-off-by: rayguo17 <rayguo17@gmail.com>
* layout: Support `wavy` and `double` for `text-decoration-line` (#37079)Martin Robinson2025-05-222-8/+43
| | | | | | | | | | | | | | | | - Add support for `text-decoration-line: double`: Line drawing is done similar to how it works in Firefox and Chromium. A gap of half of line thickness is added between each line. - Fix support for `text-decoration-line: wavy`: Wavy lines rectangles were not calcualted properly, which meant they were rendered as solid lines. Now the amplitude of the wave is 1.5 times line thickness. Testing: A manual test is updated `tests/html/text_deco_simple.html` to cover more cases. In general, rendering of text-decorations is difficult to test via reftesting. Fixes #17887. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Return the proper texture format for GetPreferredCanvasFormat (#37073)Ashwin Naren2025-05-211-2/+6
| | | | | | | | | This follows firefox's implementation: https://github.com/mozilla-firefox/firefox/blob/24d49101ce17b78c3ba1217d00297fe2891be6b3/dom/webgpu/Instance.h#L68 It changes the default on most systems to `Bgra8Unorm` but leaves it as `Rgba8Unorm` on android. Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
* script: Refactor dom/headers to match spec better (#36943)Sebastian C2025-05-212-138/+121
| | | | | | | | | | This includes removing an implementation of normalize for `ByteString`, because it is effectively duplicated in net under `trim_http_whitespace`. This is part of an attempt to cleanup and centralize code for header parsing and manipulation. Testing: Covered by existing WPT tests Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* layout: Move text decoration propagation to stacking context tree ↵Martin Robinson2025-05-2115-132/+146
| | | | | | | | | | | | | | | | | | | | | | | | construction (#37069) Text decorations have a special kind of propagation. Instead of propating these during box tree construction, move propagation to stacking context tree construction. This will allow for using a very easy type of incremental layout when text decorations change. For instance, when a link changes color during hovering over it, we can skip all of box and fragment tree construction. In addition, propagation works a bit better now and color and style properly move down from their originating `Fragment`s. This introduces three new failures, because now we are drawing the text-decoration with the correct color in more places, which exposes an issue we have with text-decorations not being drawn in relation to the baseline (taking into account `vertical-align`). Testing: There are tests for these changes. Fixes #31736. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* chore: fix warnings for Windows-specific fonts code (#37063)Ashwin Naren2025-05-212-7/+19
| | | | | | | | | | | | Fix warnings from `components/fonts/platform/windows/font.rs` and `components/fonts/platform/windows/font_list.rs` due to deprecations from dwrote. Testing: none, should behave as it did before --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: When there is no restyle damage, do not re-layout (#37048)Martin Robinson2025-05-216-9/+47
| | | | | | | | | | | | | | | When the computed restyle damage is empty, do not do a layout. Instead, just rebuild the display list. In the future, even that can be omitted, but that requires changes to the compositor. These kind of relayouts commonly happen when the cursor is moving around the page and no style rules cause changes to :hover. Testing: This is covered existing WPT tests and should only have performance impacts. Unfortunately there are currently no performance tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* htmlmediaelement: Make dirty element on any intrinsic size changes (#37056)Andrei Volykhin2025-05-211-3/+1
| | | | | | | | | | | | | | | | To properly compute (the video) element's content size for layout requires to dirty the element on any intrinstic size changes. Full list of the operations which cause layout invalidation: - media metadata update (NEW) - removing "src" attribute - video frame update - show poster image Testing: html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm Fixes: https://github.com/servo/servo/issues/34434 Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Synchronize `dispatch_actions` in WebDriver (#36932)batu_hoang2025-05-2111-118/+449
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement missing synchronization in `dispatch_actions` of `WebDriver`. https://w3c.github.io/webdriver/#dispatching-actions > The user agent event loop has spun enough times to process the DOM events generated by the last invocation of the >[dispatch tick actions](https://w3c.github.io/webdriver/#dfn-dispatch-tick-actions) steps. - Add a way for `ScriptThread` to notify `WebDriver` about the completion of input commands. - Add a `webdriver_id` field for `InputEvent`. `ScriptThread` uses it to distinguish WebDriver events and sends notification. Tests: `./mach test-wpt --product servodriver -r tests\wpt\tests\webdriver\tests\classic\element_click\events.py` pass if `hit_testing` pass. Check [issue](https://github.com/servo/servo/issues/36676#issuecomment-2882917136) cc: @xiaochengh --------- Signed-off-by: batu_hoang <longvatrong111@gmail.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>