Follow the specification and validate tokens of the "x/w/h" descriptors
before applying the rules for parsing float-pointing numbers or
non-negative integers.
https://html.spec.whatwg.org/multipage/#parsing-a-srcset-attribute (step
13)
Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
Vello has updated to wgpu v26 recently. It might be a good time for
servo to update as well. This PR should wait for #39015 and #38717
Testing: WebGPU CTS
Fixes: None
---------
Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
This sets a baseline of tests for fetch-related implementation of
AbortController.
Part of #34866
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
The min-content and max-content inline sizes of an inline formatting
contentext need to take `text-indent` into account. Note it can be set
to a negative amount, so the `ContentSizesComputation` logic needs some
tweaks to handle it well.
Testing: Fixes various WPT tests
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Also bumps mozjs to the latest version that has support for
`GStackVector` which is what this callback uses.
Part of #36258Fixes#38877
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
From IndexedDB spec, when we check whether a key path is valid, we have
to check whether it is an ECMAScript identifier name. We have not yet
implemented this logic, and always return true.
This patch uses the function `js::rust::wrappers::JS_IsIdentifier` to
achieve this checking.
Testing: Pass WPT tests that were expected to fail.
Fixes: #25324
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Parsing the 'srcset' attribute of an image element may result in a parse
error
indicating a non-fatal mismatch between the input and the requirements.
https://html.spec.whatwg.org/multipage/#concept-microsyntax-parse-errorhttps://html.spec.whatwg.org/multipage/#parse-a-srcset-attribute
This error should not be a reason to stop parsing and may be used by the
user agent to signal a syntax error.
Other browsers generally ignore this error, and we do the same.
Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
Implement scroll into view steps for all WebDriver command that requires
it (element click, element send keys, element clear, and take element
screenshot).
Testing: `element_send_keys/scroll_into_view.py`,
`element_click/scroll_into_view.py`, `element_clear/clear.py`
---------
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
This combines some access to the thread local variable for script
thread.
- We introduce a new UserInteractingScriptGuard which on drop handles
the resetting of was_interacting to the previous value. Sometimes
throughout the code `ScriptThread::is_user_interacting` was reset to the
previous value while sometimes just set to false. This should
remove this footgun.
- This also reduces the amount of thread local access for
MutationObservers and task queue.
Testing: WPT tests should cover this.
Fixes: This addresses part of
https://github.com/servo/servo/issues/37969 but there is probably still
stuff to be done.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Previously, the correct autoincremented and keypath parameters were only
being passed if the object store is being created. This PR queries this
info from the backend and passes it onto the constructor in
IDBTransaction. Furthermore it exposes keypath and index_names from
IDBObjectStore, mainly for WPT.
Testing: WPT
Fixes: None
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Uses the `zstd` support from `async-compression` to support zstd
Content-Encoding.
Testing: Covered by wpt tests.
Signed-off-by: webbeef <me@webbeef.org>
`InlineFormattingContextLayout::finish_current_line_and_reset()` has an
early return in case the line has no fragment. However, if the line only
has a forced line break, then we still need to set the baseline.
Testing: Adding new test.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Make several changes which should address panics and inconsistent
behavior around attempts to set extreme sizes:
1. Limit the minimum size of the `RenderingContext` to 1 pixel by 1
pixel. This should address problems where users of the API try to
directly set the size to a zero or negative dimension. In addition,
improve the documentation around `WebView::resize` to mention this.
2. Clamp values sent in the `WebViewDelegate::request_resize_to` method
to be at least 1x1. This prevents Servo from sending nonsense values
to embedders. Improve documentation in this method.
3. In servoshell:
- More consistently clamp inner and outer window size values.
- Clamp all resize values to the available screen size, so that
large screen sizes aren't processed directly.
Testing: This change fixes an existing WPT and adds two new API tests.
Fixes: #36763.
Fixes: #36841.
Fixes: #39141.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
There are many important changes here:
- Generalize the presentation buffer into standalone staging buffers
that hold their own state. This allow them to be used by getImage.
- Move all clear handling to the ScriptThread and send the configuration
on each request present/getimage, thus avoiding any recreate/clearing
messages. This means that we prepare staging buffers lazily, on the
first request.
Try run for this change:
https://github.com/sagudev/servo/actions/runs/17341982368
Testing: This is covered by existing WebGPU CTS tests. There are some
bad expectations updates, but they are also on main (presumably from
last update the rendering work) although I think CTS is actually wrong
(see https://github.com/gpuweb/cts/issues/4440).
Fixes: #36820Fixes: #37705Fixes: #33368 (we now keep reference alive in hashmap)
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Reincorporate the styles to help with the vertical alignment of textual
`<input>` element that was removed by #38775. Followed by adding Servo
specific WPTs to help with these kinds of problem.
Testing: New WPT
Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
This test crashes in Servo, and passes on Gecko, Blink and Webkit.
The crash should be addressed by #39204.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
To find scrolling ancestors, we need to walk up the flat tree and only
consider the elements that are in the chain of containing block
ancestors of an element. `scrollParent` now does this so we can use it
to properly implement `scrollIntoView`.
Testing: There are WPT tests for this change.
---------
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
The concept of a "resource header" is not well specced, since it is
unclear what a "resource" is. That said, it most closely matches a
"response" as part of the navigation params.
With this change, we now delay loading the document until either two
things happen:
1. We reached the end of the file
2. We processed 1445 bytes (as defined by spec)
We initially store bytes in the resource header and then after loading
parse the stored bytes. Any subsequent loading will process as before.
Part of #14024
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
While I adding spec comments to the CSP crate, I discovered two issues:
1. We should only use the last sandbox value (WPT test added)
2. We weren't checking for the scripting sandbox flag in document
Also, the autoplay test should have allowed scripts to run, otherwise
the test doesn't run. Since we weren't checking the flag before, the
test ran fine for Servo. However, it wouldn't run for other browsers.
Also realized that an existing test was pointing to a non-existent file
(since it doesn't have `.sub`). Updated that and confirmed that in other
browsers it now properly works (it no longer shows a 404). However,
Servo now fails that test as we don't fire an load event.
Part of #913
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Implement getAll and getAllKeys for IDBObjectStore.
Testing: WPT & Unit testing
Fixes: Part of #6963.
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
When encountering such an ancestor, we were returning null instead of
skipping it.
Testing: Adding new subtest for this. And while I'm at it, another one
for the root element, unrelated to this fix.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Removes a test related to autoplay and sandboxing which will always
fail.
In https://github.com/servo/servo/pull/39079 I introduced a wpt to test
autoplay functionality, but the test was flawed in its approach -
shortly after merge, myself and @TimvdLippe found that this test would
simulataneously require scripts to be enabled, as well as disabled for
the test to pass.
This slipped past me becuase we hadn't correctly implemented whether
scripting was enabled yet in Servo.
Testing: Removes a single WPT - this test has not been merged upstream.
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
The current implementation of evaluate_key_path_on_value was translated
from gecko, and it is incomplete. The unimplemented part occurs many
crashes in WPT tests.
This PR re-implements it according to the spec. It should eliminate many
crashed WPT tests, and increase the code readability.
Testing: Update WPT test expectation
Fixes: #38817 partially, and #25325
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Few webdriver subtests are quite unstable. But it is an overkill to mark
the entire test as intermittent, as the CI would permit buggy PRs that
sabotage other stable subtests. This PR mark these subtests and closes
the related intermittent issues.
Fixes: #39158Fixes: #39117Fixes: #39121Fixes: #39154
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Implements document's active sandboxing flags. These are currently
populated only from CSP-derived sandboxing flags for a new document,
when defined in the CSP.
Testing: 1 new pass, and some new wpt's are added to test points in the
spec where these flags influence behaviour.
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
While we don't perform any sniffing yet, it does now
check all relevant mime types. Before, we would only
check specific versions of specific mime types. However,
the specification is more elaborate, which MimeClassifier
already handles.
There are two new test failures, but they actually fail
in the same way in other browsers. These tests are still
being discussed what the correct behavior should be [1]
Part of #14024
[1]:
https://github.com/whatwg/mimesniff/issues/189#issuecomment-2081559661
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
More small geometry fixes.
Testing: Covered by WPT
(css/geometry/DOMMatrix-invert-preserves-2d.html)
---------
Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This new API allows getting the element which establishes an element's
scroll container. This will be used to properly implement
`scrollIntoView`. There is still work to do for this API and
`offsetParent` to properly handle ancestors which are
closed-shadow-hidden from the original query element.
In addition, fix an issue where inline boxes were establishing scrolling
containers (they shouldn't do that).
Testing: There are tests for this change.
Fixes: #39096.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Implements more of calculate_box_size, ensuring that the proper
rectangle is returned when the border box is requested.
Testing: WPT
Fixes: Partially #38811
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Co-authored-by: Jo Steven Novaryo <65610990+stevennovaryo@users.noreply.github.com>
We were performing a structured clone but throwing away any serializable
DOM interfaces included in the result. We need to instead serialize the
full structured clone result so we can deserialize the DOM interfaces
when getting the data out of the object store.
Testing: Existing WPT coverage is sufficient.
Fixes: #38818Fixed: #38842
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Since WebDriver is quite stable now, enable the `webdriver/classic`
tests on wpt CI.
---------
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
It was originally throwing a TypeError, which was making WPT fail.
Testing: Many happy WPT subtests
Fixes: #39050
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
Uses clipped time to convert dates that are stored as `f64`s into JS
values.
Testing: WPT
Fixes: #25327
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This makes future implementations easier where we will reuse most of
this code to parse Link headers.
Part of #35035
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Instead of panicking when doing a geometry script query on a node with
an uninvertible transform, return a zero-sized rectangle at the
untransformed position. This is similar to what Gecko and Blink do
(though it seems there are some differences in positioning this
zero-sized rectangle). Mostly importantly, do not panic.
Testing: This change adds a new WPT crash test.
Fixes: #38848.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Absolutely positioned elements get blockified, but their static position
still depends on the original display. Therefore, if we encounter an
abspos with an inline-level original display, we will now ensure that
it's handled in an inline formatting context. This way its static
position will correctly take into account things like `text-align`.
Testing: Several WPT tests are now passing.
Fixes: #39017
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
It's expected that script queries be able to interact with collapsed
table rows and columns, so this change starts laying them out. They
still do not affect table dimensions, nor are they painted.
This does not fix all interaction with collapsed rows and columns. For
instance, setting scroll offsets of contained scrolling nodes does not
work properly. It does fix the panic though, which is the most important
thing.
Testing: this change includes a new WPT crash test.
Fixes: #37421.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Implement raw export of HMAC keys. JWT export of HMAC keys will come in
a separate PR.
Testing: WPT
Fixes: Partially #39060
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Phantom line boxes should be treated as non-existing for most purposes,
so don't let them affect the baseline of their block container.
Testing: An existing test passes, and also adding a new one which
doesn't rely on `<button>`
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Autoincrementedness was previously being reported as always false. This
PR makes the state become queried from the backend, as the spec
specifies. Additionally this PR ensures the backend correctly handles an
object store which autoincrements.
Testing: WPT
Fixes: None
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>