A lot (and I mean, really a lot) depends on these constructors.
Therefore, this is the one spaghetti ball that I could extract and
convert all `can_gc` to `cx`. There are some new introductions of
`temp_cx` in the callbacks of the servo parser, but we already had some
in other callbacks.
Part of #40600
Testing: It compiles
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
It pushes the `temp_cx` 1 level up to `element.rs` where the calling
chain begins. Other than that this was purely a mechanical change where
I used regexes to replace all patterns with the new ones.
Part of #42812
Testing: It compiles
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This method is the same as `DOMString::from` with a `String` argument
and `From` and `Into` are preferred when writing modern Rust.
Testing: This should not change behavior and is thus covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This changes makes it so that keyboard and click focusability are two
separate concepts in `script`. Some elements may be focusable only by
the keyboard and some only by the click events.
In addition, the `SEQUENTIALLY_FOCUSABLE` `Node` flag is removed in
favor of a
more specification-aligned approach of checking lazily if an element is
a focusable area. This allows moving the focus fixup steps to their
correct place, asynchronously during "update the rendering" and
synchronously during `unbind_from_tree`.
Testing: This causes some WPT tests to start passing and some to start
failing:
- Two subtests tests in
`tests/wpt/meta/css/css-conditional/container-queries/` because
we do not implement support for container queries. These are legitimate
failures
and they are compensated by a good subtest pass in the same file.
- A few subtests in `/html/interaction/focus/tabindex-focus-flag.html`
because now
we do not allow focusing non-rendering elements. The failures are HTML
elements with
`<svg>` which we do not rendering and `<summary>` elements of
`<details>` which
need special handling we do not implement yet.
- `html/semantics/forms/the-fieldset-element/disabled-003.html`: Some of
these tests
start to fail, but they are not spec compliant and browser properly
implementing
the asynchronous focus fixup rule also fail them.
Fixes: #31870.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This is part of replacing can_gc with the new &JSContext/&mut JSContext
method.
We modify CheckValidity and ReportValidity in various HTML Elements to
use the context instead of CanGc.
Testing: Compilation is the test as this is mostly mechanical.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
For some specific cases (one of them see below) where are requirement to
identify the reason of the attribute mutation (by whom/why it was
changed - by cloning, parser or directly), so the following `reason`
parameter was added to `AttributeMutation::Set` option.
Note that for the HTMLMediaElement the internal `muted` state should be
set to true when the element is created and the element has a `muted`
content attribute specified (should be done once on the first attribute
mutation caused by parser or cloning).
See https://html.spec.whatwg.org/multipage/#dom-media-muted
Testing: Improvements in the following tests
-
html/semantics/embedded-content/media-elements/user-interface/muted.html
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
Servo has a lot of comments like this:
```rust
// https://example-spec.com/#do-the-thing
fn do_the_thing() {}
```
and I keep turning these into doc comments whenever I'm working close to
one of them. Doing so allows me to hover over a function call in an IDE
and open its specification without having to jump to the function
definition first. This change fixes all of these comments at once.
This was done using `find components -name '*.rs' -exec perl -i -0777
-pe 's|^([ \t]*)// (https?://.*)\n\1(fn )|\1/// <$2>\n\1$3|mg' {} +`.
Note that these comments should be doc comments even within trait `impl`
blocks, because rustdoc will use them as fallback documentation when the
method definition on the trait does not have documentation.
Testing: Comments only, no testing required
Preparation for https://github.com/servo/servo/pull/39552
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>