aboutsummaryrefslogtreecommitdiffstats
path: root/components
Commit message (Collapse)AuthorAgeFilesLines
...
* Make DOMPoint and DOMPointReadOnly serializable (#35989)Josh Matthews2025-03-2712-21/+224
| | | | | | | | | | | | | | | | | | | | | | | * script: Make DOMPointReadOnly serializable. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make DOMPoint serializable. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Shrink worker script event. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update components/script/dom/dompoint.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Expose new methods for obtaining a global that require a realm. (#36116)Josh Matthews2025-03-267-19/+42
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* chore: Remove unused generation counter field from LayoutThread (#36172)Kelechi Ebiri2025-03-261-7/+0
| | | Signed-off-by: TG <ebiritg@gmail.com>
* Fix Backspace deleting entire previous line in `<textarea>` (#36112)elomscansio2025-03-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test(textinput): Add test for backspace at beginning of line in textarea Introduce a test to reproduce and verify the fix for backspacing at the beginning of a line in a multiline textarea. This ensures that pressing Backspace when the cursor is at the start of a line correctly removes the newline without deleting the entire previous line’s content. Related to: #27523 Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com> * fix(textinput): Preserve selection origin when adjusting vertical position Fixes an issue where pressing Backspace at the beginning of a line in a textarea incorrectly deleted the entire previous line's content. This happened because `self.adjust_vertical(-1, select)` modified `selection_origin` and `edit_point`, but `selection_origin` was not restored before performing the horizontal adjustment. As a result, `self.selection_start()` and `self.selection_end()` were inconsistent, leading to `replace_operation` erasing the entire line. Now, we temporarily store `selection_origin` before adjusting vertical position and restore it afterward to ensure proper cursor and selection behavior. Fixes: #27523 Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com> --------- Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Add `Path2D` (#35783)Lukas Lihotzki2025-03-2616-77/+1519
| | | Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* Stop using MutableHandle's DerefMut impl (#36160)Greg Morenz2025-03-261-2/+2
| | | Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* Use read all bytes when consuming body (#36048)Gregory Terzian2025-03-261-192/+104
| | | | | | | | | * use read_all_bytes when consuming body pass realm as argument to dom method re-structure consume_body into one function Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * enter the realm of the object whose body is being consumed Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Stop using JS::MutableHandle's DerefMut impl (#36161)Greg Morenz2025-03-261-1/+1
| | | Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* script: Eliminate `PseudoElementType` (#36146)Martin Robinson2025-03-267-145/+75
| | | | | | | | | | | | | Servo has a `PseudoElementType` which more or less duplicate's Stylo's `PseudoElement` with the addition of a non-pseudo element variant. This type needs to be converted into `PseudoElement` anyway when asking for the style of an element from Stylo, so eliminate Servo's version and simply use `Option<PseudoElement>` with the `None` variant meaning the non-pseudo. This is preparation for adding support for the `::marker` pseudo element. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Fix check in get_array_index_from_id to return early on ASCII char (#36136)Michael Rees2025-03-251-1/+1
| | | | | | | | | | | | | * fix: wrong ascii check in get_array_index_from_id Signed-off-by: Michael Rees <mrees@noeontheend.com> * Update WPT expectations Signed-off-by: Michael Rees <mrees@noeontheend.com> --------- Signed-off-by: Michael Rees <mrees@noeontheend.com>
* feat: add CanGc argument in get_dictionary_property (#36156)Arya Nair2025-03-256-15/+29
| | | | | | | | | | | | | * feat: add CanGc argument in get_dictionary_property Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * feat: add CanGc argument in get_dictionary_property Signed-off-by: Arya Nair <aryaajitnair@gmail.com> --------- Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
* script: Support converting JS values to Rc<Promise> with ↵Josh Matthews2025-03-254-2/+25
| | | | | FromJSValConvertible. (#36097) Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Upgrade to Stylo e941241 (#36120)Nico Burns2025-03-251-16/+3
| | | | | | | | | | | | | * Upgrade to Stylo e941241 Signed-off-by: Nico Burns <nico@nicoburns.com> * Make test less fragile Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
* layout: Ensure compatible positioning context during flexbox block content ↵Martin Robinson2025-03-251-5/+8
| | | | | | | | | | | | | | | sizing calculation (#36123) Sometimes column Flexbox needs to do an early layout pass to determine the preferred block content size of flex items. Previously the absolutely positioned children created during this pass were discarded, but now they are cached to be possibly used during the final layout phase of the flex item. Since they are not thrown away, it is necessary that the `PositioningContext` used to collect them is compatible with their final `PositioningContext`. Fixes #36121. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* canvas: Update the image as part of update the rendering (#35996)sagudev2025-03-2511-51/+72
| | | | | | | | | | | | | | | | | | | | | | | * Create `update_rendering` in `CanvasState` instead of manually updating in layout Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Mark as dirty and do flushes Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup rebase Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update components/script/dom/htmlcanvaselement.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* fix: does_settings_prohibit_mixed_security_contexts typo (#36135)Arya Nair2025-03-241-2/+2
| | | Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
* feat(notification): add `EmbedderMsg::ShowNotification` (#36055)Jason Tsai2025-03-246-20/+151
| | | Signed-off-by: Jason Tsai <git@pews.dev>
* layout: Cache `IndependentNonReplacedContents::layout()` (#36082)Oriol Brufau2025-03-2412-160/+216
| | | | | | | | | | | | | | | This replaces `IndependentLayout` with `CacheableLayoutResult` and stores it in `LayoutBoxBase` so it can be reused when we need to lay out a box multiple times. This is a generalization of the caching that we had for flexbox, which is now removed in favor of the new one. With this, the number of runs per second in the Chromium perf test `flexbox-deeply-nested-column-flow.html` are multiplied by 3. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* fix: radio input element don't trigger validity state (#36103)Jerens Lensun2025-03-231-2/+4
| | | Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>
* script: Implement `Element::GetHTML` and `ShadowRoot::GetHTML` (#36106)Simon Wülker2025-03-239-101/+276
| | | | | | | | | | | | | | | | | | | | | * Serialize html fragments without going through html5ever Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement ShadowRoot::GetHtml / Element::GetHtml Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Propagate CanGc annotations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* webgpu: leverage routed_promise in calls returning promises (#35859)webbeef2025-03-2315-263/+221
| | | | | | | Using the RoutedPromiseListener let us define a different response type for each promise. This removes unreachable branches that used to exist when they all shared the same WebGPUResponse. Signed-off-by: webbeef <me@webbeef.org>
* script: Ensure promises are considered DOM interfaces when generating ↵Josh Matthews2025-03-232-3/+5
| | | | | bindings. (#36107) Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* layout: Implement the `fit-content()` sizing function (#36056)Oriol Brufau2025-03-236-46/+88
| | | | | | | | | | | | | | Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of https://github.com/w3c/csswg-drafts/issues/11805 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Don't clear children of declarative shadow hosts when imperatively attaching ↵Simon Wülker2025-03-231-2/+1
| | | | | | | | | | | | | | | | | another shadow root (#36104) * Don't remove a declarative shadow hosts children when attaching an imperative shadow root Instead we should remove all children of the shadowroot. 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>
* compositor: Remove the script channel from the compositor (#36089)Martin Robinson2025-03-235-19/+12
| | | | | | | | | | | | This is a clean up after #36062 and #35985. It removes the script channel for each pipeline from the compositor. Now all messages are sent via the `Constellation` first, which will allow breaking the dependency on script in the compositor. In addition, scroll states are actually sent via the `Constellation`, which was an oversight from #36062. Finally, a typo in a method name is fixed. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Remove `components/shared/compositing/constellation_msg.rs` (#36102)Martin Robinson2025-03-231-92/+0
| | | | | This file is dead code and I mistakenly did not remove it in #36088. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Allow opening links in a new `WebView` (#35017)webbeef2025-03-235-25/+114
| | | | | | | | | | | | | This changes starts tracking the keyboard modifier state in the `Constellation` and forwards it with every input event. The state is used to modify the target of link click so when the platform-dependent alternate action key is enabled, the target is overriden to "_blank". In addition, specification step numbers and text is updated. Signed-off-by: webbeef <me@webbeef.org> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Use explicit reborrows with mozjs::MutableHandle (#35892)Greg Morenz2025-03-2313-32/+56
| | | | | | | | | | | | | | | | | | | | | * Explicitly reborrow MutableHandles Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * Unify jsapi_wrappers Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * Format mozjs changes Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * Update mozjs version Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> --------- Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* Make input element display-inside always flow-root (#35908)Kenzie Raditya Tirtarahardja2025-03-234-16/+62
| | | | Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com> Co-authored-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com>
* Max assign outer block size to cell measures (#36064)Kenzie Raditya Tirtarahardja2025-03-231-1/+1
| | | | Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com> Co-authored-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com>
* crown: Do not check trait item projections. (#36095)Josh Matthews2025-03-2210-20/+0
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix form validation for readonly inputs and update WPT expectations (#36090)elomscansio2025-03-221-19/+1
| | | | | | | | | | | | | | | | | | | The HTML specification states that an input element with the `readonly` attribute must be barred from constraint validation. Our implementation previously included an extra check (`does_readonly_apply()`) to verify if `readonly` applies to the input type, which is unnecessary. This caused three test failures in: tests/wpt/meta/html/semantics/forms/constraints/form-validation-willValidate.html.ini - Removed `does_readonly_apply()` as it is not required for validation. - Removed `tests/wpt/meta/html/semantics/forms/constraints/form-validation-willValidate.html.ini` since the test now passes. To update the Web Platform Test expectations, see: https://book.servo.org/hacking/testing.html#updating-web-platform-test-expectations Fixes servo/servo#36076 Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com>
* Create a `constellation_traits` crate (#36088)Martin Robinson2025-03-2250-267/+371
| | | | | | | | | | | | | | This change creates a `constellation_traits` crate. Previously messages to the `Constellation` were in the `compositing_traits` crate, which came about organically. This change moves these to a new crate which also contains data types that are used in both compositing/libservo and script (ie types that cross the process boundary). The idea is similar to `embedding_traits`, but this is meant for types not exposed to the API. This change allows deduplicating `UntrustedNodeAddress`, which previously had two versions to avoid circular dependencies. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* devtools: refactor network related (#36093)Jerens Lensun2025-03-222-143/+175
| | | | | | | | | | | | | | | | | * devtools: extract network related into new file Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> * devtools: fix missing license and linting error Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> * fixup! devtools: extract network related into new file Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> --------- Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>
* metrics: Simplify `ProgressiveWebMetrics` (#35985)Martin Robinson2025-03-2120-486/+405
| | | | | | | | | | | | | | | | Simply how `ProgressiveWebMetrics` works: 1. Keep only a single struct instead of one in layout and one script that both implement the `ProgressiveWebMetrics` trait. Since layout and script are the same thread these can now just be a single `ProgressiveWebMetrics` struct stored in script. 2. Have the compositor be responsible for informing the Constellation (which informs the ScripThread) about paint metrics. This makes communication flow one way and removes one dependency between the compositor and script (of two). 3. All units tests are moved into the `metrics` crate itself since there is only one struct there now. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* constellation: Proxy `ScrollState` through the `Constellation` (#36062)Martin Robinson2025-03-2110-33/+60
| | | | | | | | | This will allow removing the dependency of the compositor on `script_traits`, which should make our internal dependency chain a lot easier to deal with. Part of #35984. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* pixels: Extend Image to allow for multiple frames (#36058)TIN TUN AUNG2025-03-216-28/+119
| | | Signed-off-by: rayguo17 <rayguo17@gmail.com>
* feat: add can_gc argument to to_frozen_array (#36043)Arya Nair2025-03-1921-43/+97
| | | | | | | | | | | | | | | | | | | | | * feat: add can_gc argument to to_frozen_array Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * fix: linting issues Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * feat: add can_gc in binding.conf Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * fix: linting issues Signed-off-by: Arya Nair <aryaajitnair@gmail.com> --------- Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
* Make Element::attach_shadow() and ShadowRoot closer to spec (#36024)batu_hoang2025-03-1910-19/+117
| | | Signed-off-by: batu_hoang <longvatrong111@gmail.com>
* layout: Stop ignoring containing block padding for the static position (#36051)Oriol Brufau2025-03-191-4/+16
| | | | | | | | The static position rect is calculated assuming that the containing block would be established by the content box of some ancestor, but the actual containing block is established by the padding box. So we need to add the padding of that ancestor. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Obey sizing keywords in `layout_for_block_content_size()` (#36015)Oriol Brufau2025-03-191-83/+53
| | | | | | We were ignoring sizing keywords on the min and max sizing properties. With this, flexbox layout has full support for sizing keywords. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Support min/max main keyword sizes in flexbox (#35961)Oriol Brufau2025-03-192-289/+159
| | | | | | | | | | Adds support for min-content, max-content, fit-content and stretch on the min and max main size properties of a flex item. I'm removing `automatic_min_size()` and `flex_base_size()` because they would need to share so much code among themselves and their one caller that it's simpler to just inline the code. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* devtools: Use `webview_id` as `browser_id` (#35956)atbrakhi2025-03-197-17/+43
| | | | | | | | | | | | | | | | | | | | | * use `webview_id` as `browser_id` Signed-off-by: atbrakhi <atbrakhi@igalia.com> * use correct webview id Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt Signed-off-by: atbrakhi <atbrakhi@igalia.com> * review fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Cleanup Stylo dependencies (#36046)Oriol Brufau2025-03-1919-57/+57
| | | | | | | | | Now that Stylo considers `servo` as the default feature, Servo doesn't need to specify `features = ["servo"]`. Also use the same crate names as Stylo, rather than renaming them with `package`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Don't consider a definite `stretch` size as intrinsic (#36045)Oriol Brufau2025-03-191-5/+7
| | | | | | | | `block_size_is_zero_or_intrinsic()` was always returning true for `stretch`. This function is used for the margin collapse heuristics in block layout, so we were considering that an empty element with `height: stretch` would self-collapse. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* script: Implement `Range::getClientRects` and `Range::getBoundingClientRect` ↵Simon Wülker2025-03-195-5/+73
| | | | | | | | | | | | | | | | | | | | | | | (#35993) * Add doc comments to boundary point Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow querying content box of text fragments Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement Range::getBoundingClientRect 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>
* Support align attribute on HTMLParagraphElement interface (#36054)Stephen Muss2025-03-192-2/+11
| | | Signed-off-by: Stephen Muss <stephenmuss@gmail.com>
* libservo: Notify delegates of send errors in request objects (#35668)Delan Azabani2025-03-196-27/+355
| | | | | | | | | | | | | | | | | | | | | | | | | * libservo: Notify delegates of send errors in request objects Signed-off-by: Delan Azabani <dazabani@igalia.com> * Remove webview error sender for simplicity Signed-off-by: Delan Azabani <dazabani@igalia.com> * Remove error sender trait, now that there is only one impl Signed-off-by: Delan Azabani <dazabani@igalia.com> * Address review feedback Signed-off-by: Delan Azabani <dazabani@igalia.com> * Add unit tests Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
* feat: fetch notification image resources (#35878)Jason Tsai2025-03-191-4/+406
| | | | | | | | | | | | | | | | | | | | | * feat: fetch notification image resources Signed-off-by: Jason Tsai <git@pews.dev> * docs: more specific for `ResourceFetchListener` Signed-off-by: Jason Tsai <git@pews.dev> * feat(notification): queue show event Signed-off-by: Jason Tsai <git@pews.dev> * chore: set shown step to TODO until we are using the variable Signed-off-by: Jason Tsai <git@pews.dev> --------- Signed-off-by: Jason Tsai <git@pews.dev>
* layout: Fix intrinsic contributions of indefinite `stretch` keyword (#36030)Oriol Brufau2025-03-181-10/+11
| | | | | | | | | | | In #35630 I treated an indefinite `stretch` as 0px on min sizing properties, and as `none` on max sizing properties. However, this was only for final layout sizes, I forgot about intrinsic contributions. Blink already modified the relevant test, I'm just reordering it a bit since we are no longer treating `stretch` as `fit-content`, so it seems better to test it at the end. Signed-off-by: Oriol Brufau <obrufau@igalia.com>