Commit graph

957 commits

Author SHA1 Message Date
Simon Wülker
dabe162d44
Implement shadow dom slots (#35013)
* Implement slot-related algorithms

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Hook up slot elements to DOM creation logic

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Set a slot assignment mode for servo-internal shadow roots

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Assign slots when a slottable's slot attribute changes

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Properly compute slot name

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* ./mach test-tidy

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update <slot> name when name attribute changes

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement fast path for Node::assign_slottables_for_a_tree

assign_slottables_for_a_tree traverses all descendants of the node
and is potentially very expensive. If the node is not a shadow root
then assigning slottables to it won't have any effect, so we
take a fast path out.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Move slottable data into ElementRareData

This shrinks all element descendants back to their
original size.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Address review comments

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>
2025-01-19 14:05:05 +00:00
Josh Matthews
875e387004
script: Feature-gate all crown support. (#35055)
* script: Feature-gate all crown support.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Use cfg(crown) instead of a cargo feature.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-18 21:36:15 +00:00
Josh Matthews
c94d909a86
script: Limit public exports. (#34915)
* 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>
2025-01-10 08:19:19 +00:00
Simon Wülker
b6a5eaa3db
Add shadow tree flags to Bind/UnbindContext (#34863)
* Rename IS_IN_DOC flag to IS_IN_A_DOCUMENT_TREE

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add BindContext::is_in_a_shadow_tree

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add UnbindContext::tree_is_in_shadow_tree

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* ./mach fmt

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update test expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* fix build after rebasing

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-01-07 00:00:43 +00:00
Simon Wülker
75a22cfe2e
Ensure Element ID modifications inside disconnected shadow roots are registered (#34834)
* Add test for modifying element IDs in disconnected shadow roots

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Register element ID modifications inside disconnected shadow roots

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Don't crash when registering named elements in disconnected shadow roots

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fix test title

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-01-04 05:45:27 +00:00
Simon Wülker
1ab55e6b11
Fix IS_IN_SHADOW_TREE flag for descendants after Node::remove call (#34803)
* Consider a UnbindContext to be tree-connected if its in a shadow root

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Properly track whether a node is in a shadow tree after removing subtree

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>
2025-01-03 23:27:43 +00:00
Martin Robinson
e8f75c9aea
script: Expose node helpers as NodeTraits and give more descriptive names (#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>
2025-01-03 18:55:01 +00:00
Martin Robinson
621ddd749c
Elide lifetimes where possible after rustup (#34824)
The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.

Fixes #34804.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-03 18:54:44 +00:00
Steven Novaryo
d8b7195c75
Add check for valid custom element name in element::attach_shadow (#34749)
* Add valid custom element name check

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Update wpt test expectation

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

---------

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
2024-12-24 03:36:57 +00:00
Martin Robinson
50c9c72778
layout: Lay out Shadow DOM elements (#34701)
When an element is a shadow root, lay out the shadow root elements
instead of the non-shadow children.

This fixes some tests and introduces some failures, due to bugs in the
Shadow DOM implementation. In general, this is very low impact as the
Shadow DOM is still disabled by default. At least this gets elements
rendering when the preference is turned on though.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-12-19 19:24:42 +00:00
Martin Robinson
471d3572b7
script: No longer do explicit reflows for display (#34599)
These all happen now in *update the rendering*, typically after the
message that triggered this code is processed, though in two cases
reflow needs to be triggered explicitly. This makes `ReflowReason`
redundant though perhaps `ReflowCondition` can be expanded later to give
more insight into why the page is dirty.

- Handling of the "reflow timer" concept has been explained a bit more via
  data structures and rustdoc comments.
- Theme changes are cleaned up a little to simplify what happens during
  reflow and to avoid unecessary reflows when the theme doesn't change.

Notably, layout queries and scrolling still trigger normal reflows and
don't update the rendering. This needs more investigation as it's
unclear to me currently whether or not they should update the rendering
and simply delay event dispatch or only reflow.

In general, this is a simplfication of the code.

Fixes #31871.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-12-13 13:25:47 +00:00
Ville Lindholm
af8f35f5ef
traverse Shadow DOM boundaries when determining element lang (#34529)
Signed-off-by: Ville Lindholm <ville@lindholm.dev>
2024-12-08 16:50:28 +00:00
Simon Wülker
97e9841d47
Implement ShadowRoot.clonable attribute (#34514)
* Implement ShadowRoot clonable attribute

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* ./mach test-tidy fixes

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* fix clippy warnings

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-12-07 14:24:18 +00:00
Josh Matthews
4242ff9626
Make traverse_preorder follow shadow roots (#34503)
* script: Ensure shadow-inclusve preorder traversals follow hosted shadow roots.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Handle unregistering element id/name values inside of a shadow root.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Merge shadow root tree iteration logic.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-12-07 04:28:34 +00:00
Simon Wülker
f1e89c58a6
Don't register unconnected shadow roots with their owner document (#34361)
* Don't falsely register Shadow Roots as connected

Previously, a shadowroot would be registered as connected
during the shadow hosts bind_to_tree call, even if the host
was being bound to an element that was not itself
connected to a document.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Move bind/unbind methods into a VirtualMethod impl

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add DocumentFragment/Shadowroot to vtable_for

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-12-02 18:33:25 +00:00
Josh Matthews
e956f3124c
Generate a trait abstracting over all known DOM interfaces (#34357)
* 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>
2024-11-24 07:35:14 +00:00
Simon Wülker
1198b26ec9
Implement ShadowRoot.innerHtml attribute (#34335)
* Implement DocumentFragment::fragment_serialization_algorithm

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement ShadowRoot innerHtml attribute

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* cargo-clippy

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reuse existing serialization code and move helpers into Node

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fix typo

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-11-22 17:07:01 +00:00
Simon Wülker
527e2d426d
Implement element.shadowRoot attribute (#34306)
* Implement Element.shadowRoot attribute

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Remove comments about shadowdom not being exposed for web content

This is obviously not the case anymore.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-11-21 00:22:42 +00:00
shanehandley
975e2ae859
Remove referrer policy from document (#34263)
* Remove the referrer policy from document and rely on its policy container

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Make ReferrerPolicy non-optional, instead using a new enum value to represent the empty string case

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix clippy issue

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix usage of Option<ReferrerPolicy> in unit test

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-11-19 12:45:10 +00:00
chickenleaf
257f4b84db
DOMRectList interface implementation (#34025)
* rechecking all file changes and additions

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* added comments with specification links

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* added space before the links

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* modified the doc link format

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* suggested changes + updated interfaces.https.html + updated passing test expectations

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* needed to do an update-manifest

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* updated the idlharness.any.html expectations

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-11-01 15:58:30 +00:00
eri
01820e2a8a
Improve how intrinsic sizes work for videos (#31746)
* feat: patch for video layout sizes

added rebase from main 2024/10/05

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: eri <epazos@igalia.com>

* feat: take width and height parameters if provided

Signed-off-by: eri <epazos@igalia.com>

* chore: tidy the code and update test expectations

Signed-off-by: eri <epazos@igalia.com>

* feat: handle removing poster

Signed-off-by: eri <epazos@igalia.com>

* chore: update test expectations and remove debug code

Signed-off-by: eri <epazos@igalia.com>

* fix: issues after rebasing to main

Signed-off-by: eri <epazos@igalia.com>

* feat: pass src remove test and tidy

Signed-off-by: eri <epazos@igalia.com>

* chore: clippy fixes

Signed-off-by: eri <epazos@igalia.com>

* chore: update passing test expectations

Signed-off-by: eri <epazos@igalia.com>

* fix object-position-svg test

Signed-off-by: eri <epazos@igalia.com>

* fix unintentional override of video size and resize events

Signed-off-by: eri <epazos@igalia.com>

* change how resize events are sent to better match the spec

Signed-off-by: eri <epazos@igalia.com>

* simplify poster mutation handling

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: eri <eri@inventati.org>

* improved handling of intrinsic sizes

- differentiate between natural size and css size
- presentational attributes
- fallback ratio for video element
- handle more cases where the src/poster are added/removed
- aspect ratio hints

Signed-off-by: eri <epazos@igalia.com>

* update test expectations

Signed-off-by: eri <epazos@igalia.com>

* fix cleaning current frame

Signed-off-by: eri <epazos@igalia.com>

* update test expectations

Signed-off-by: eri <epazos@igalia.com>

* Apply suggestions from code review

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: eri <eri@inventati.org>

* More code review suggestions

Signed-off-by: eri <epazos@igalia.com>

* Prevent aspect-ratio:auto from pulling the ratio from the default object size

As resolved in https://github.com/w3c/csswg-drafts/issues/7524#issuecomment-1204462924

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

---------

Signed-off-by: eri <epazos@igalia.com>
Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-10-29 22:42:22 +00:00
tanishka
ea875f0a51
CanGc fixes from EventTarget::fire_event (#33985)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-23 22:48:19 +00:00
chickenleaf
bb4932026c
cangc fixes in node.rs (#33984)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-10-23 22:44:50 +00:00
Josh Matthews
575e885529
Mark promise creation methods with CanGc (#33928)
* Add CanGc annotations to promise constructor.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc arguments for Promise::new_in_current_realm.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix out-of-order entries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc from Promise::new.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Suppress clippy warning.

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>
2024-10-22 09:35:20 +00:00
chickenleaf
9acb25521e
CanGc changes from fontfaceset.rs (#33920)
* 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>
2024-10-21 12:28:56 +00:00
tanishka
a57b6a3f79
CanGc fixes through focusevent.rs & hashchangeevent.rs (#33921)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-20 08:05:11 +00:00
webbeef
2b71130a8a
Various CanGc fixes (#33800)
* CanGc fix for pagetransitionevent

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for dom/node

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for gamepad

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for gpu

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for dom/element

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for xhr

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for dom/worker

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for rtcdatachannel

Signed-off-by: webbeef <me@webbeef.org>

* CanGc fix for rtcerror

Signed-off-by: webbeef <me@webbeef.org>

* Address review comments

Signed-off-by: webbeef <me@webbeef.org>

---------

Signed-off-by: webbeef <me@webbeef.org>
2024-10-11 03:53:39 +00:00
tanishka
39133a5478
Replace CanGc::note() calls with arguments in components/script/dom (#33692)
* Replace CanGc::note() calls with arguments in components/script/dom

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* Add methods to Bindings.conf

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* Modify existing interface sections

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* Resolve conflicts

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

---------

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-08 12:58:09 +00:00
Simon Wülker
7df30f3788
Replace .map_or(false with Option::is_some_and (#33468)
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-16 10:03:52 +00:00
Oriol Brufau
4839cdf176
Add width and height presentational hints for table-related elements (#33405)
We were only parsing the `width` attribute as a presentation hint for
`<table>`, `<td>` and `<th>`. This patch also handles `<colgroup>` and
`<col>`.

Also, we weren't parsing `height` at all, now we do it for `<table>`,
`<td>`, `<th>`, `<tr>`, `<tbody>`, `<thead>` and `<tfoot>`.

One test is now crashing, but this was an existing issue: #33423

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-12 13:34:20 +00:00
Taym Haddadi
747e562ff0
Make CanGc derive Copy and Clone (#33407)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-12 10:24:44 +00:00
Andriy Sultanov
e5150dbda1
Propagate CanGc from Document::new() (#33386)
* 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>
2024-09-09 22:38:01 +00:00
Oriol Brufau
f810983fd2
Remove unused import (#33226)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-28 14:09:25 +00:00
Oriol Brufau
9639d36550
Remove width and height presentational hints for <canvas> (#33211)
According to HTML, the `width` and `height` attributes should only set
the natural sizes and the aspect ratio.
The `width` and `height` properties should stay as `initial` by default.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-28 10:20:18 +00:00
Martin Robinson
7582afebec
script: Update list of non-TS pseudo classes supported by Servo (#33165)
Also remove some code duplication by moving some of the code into the
`Element` impl.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-24 08:43:54 +00:00
Josh Matthews
3d3621b652
Update stylo for latest changes. (#33079)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-16 10:47:12 +00:00
Martin Robinson
569fd5d8b5
Upgrade stylo to 2024-07-16 (#32812)
* Upgrade stylo to 2024-07-16

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

* Use the new `dom` crate from stylo

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-07-24 14:37:08 +00:00
Martin Robinson
26624a109f
clippy: Fix a bunch of warnings in script (#32680)
This is just a portion of the errors that are remaining to be fixed.
2024-07-04 11:40:23 +00:00
Martin Robinson
da2de4fc68
html: Parse a comma-separated list of faces in the <font> tag (#32622)
This change parses a comma-separated list of faces in the `<font>` tag
and also moves the parsing code from `stylo` to Servo. This means that
the servo-specific code can be removed from stylo decreasing the
differences between Gecko and Servo's version of `stylo`.
2024-06-26 18:28:35 +00:00
Martin Robinson
3398fc017b
Move non-gfx things out of gfx_traits and create a base crate (#32296)
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`.
2024-05-17 12:28:58 +00:00
Nolan Lawson
02b3dd0b61
feat: implement ARIA string reflection on Element (#32080)
* feat: implement ARIA string reflection

* Update components/script/dom/element.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* fix: respond to PR comments

* fix: make functions non-public

* fix: use proper ARIAMixin mixin

* fix: tidy issues

* fix: double newline at end of file

* fix: move role before aria-* to match spec order

* fix: fix link to spec and format as spec does

* fix: delete now-passing WPT tests

* fix: remove legacy-layout test

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-04-27 16:31:32 +00:00
Oriol Brufau
401e49010f
Upgrade Stylo to 2024-04-16 (#32128)
* Upgrade Stylo to 2024-04-16

* Fixup for https://phabricator.services.mozilla.com/D205051

* Fixup for https://phabricator.services.mozilla.com/D203153

* Fixup for https://phabricator.services.mozilla.com/D202460

* Fixup for https://phabricator.services.mozilla.com/D205718

* Fixup for https://phabricator.services.mozilla.com/D206428

* Update test expectations
2024-04-25 14:48:07 +00:00
Martin Robinson
7d63c7607f
script_layout: Remove script to layout messages (#32081)
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. -->
2024-04-22 15:28:14 +00:00
Kitsu
67f239d1ba
clippy: fix several lint warns (#32126)
As seems #31500 still remain opened here's the next partial fix.

Fixed list: `unused_mut`, `clippy::needless_borrow`,
`clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`,
`clippy::unnecessary_cast`, `clippy::derivable_impls`,
`clippy::collapsible_match`, `clippy::extra_unused_lifetimes`,
`clippy::map_clone`, `clippy::manual_filter`.


- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes are part of #31500.
- [x] These changes do not require tests because are only cosmetic.
2024-04-22 06:45:39 +00:00
Oriol Brufau
f5bdfdfe94
Upgrade Stylo to 2024-03-01 (#32089)
* Upgrade Stylo to 2024-03-01

* Fixup for https://bugzil.la/1882754

* Update test expectations
2024-04-16 12:27:51 +00:00
cathiechen
4e4a4c0a28
Implement form-associated custom elements and their ElementInternals (#31980)
* 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>
2024-04-11 13:17:11 +00:00
Oluwatobi Sofela
b228d7869d
clippy: Fix option_map_or_none warnings (#31983) 2024-04-03 11:39:52 +00:00
Martin Robinson
18b37e676b
script: Reduce the use of unsafe in LayoutDom (#31979)
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.
2024-04-03 08:41:19 +00:00
Oriol Brufau
fff9ef87e6
Update Stylo to 2023-10-16 (#31932)
* Update Stylo to 2023-10-16

* Fixup for https://phabricator.services.mozilla.com/D185154

* Fixup for https://phabricator.services.mozilla.com/D188216

* Fixup for https://phabricator.services.mozilla.com/D185677

* Fixup for https://phabricator.services.mozilla.com/D188566

* Fixup for https://phabricator.services.mozilla.com/D188727

* Fixup for https://phabricator.services.mozilla.com/D189475

* Fixup for https://phabricator.services.mozilla.com/D189521

* Fixup for https://phabricator.services.mozilla.com/D188812

* Fixup for https://phabricator.services.mozilla.com/D189484

* Update test expectations
2024-03-30 13:30:13 +00:00
eri
e3d6b66d5f
clippy: Fix match_like_matches warnings (#31947)
* clippy: Fix `match_like_matches` warnings

* Fix link to custom element state in specification.

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-30 10:06:26 +00:00