According to HTML specification the poster attribute determines the
element's poster frame
(regardless of the value of the element's show poster flag).
https://html.spec.whatwg.org/multipage/#poster-frame
So the poster frame and the show poster flag is orthogonal to each
other, the latest one only controls
when browser should display the poster frame and should do not block
accepting video frames
from media pipeline (e.g. on new_preroll callback from video sink).
During layout the video element should select the current frame which
will be presented
based on first matching condition from the list:
https://html.spec.whatwg.org/multipage/#the-video-element:the-video-element-7
Testing: Improvements in the following WPT tests
- html/canvas/element/manual/imagebitmap/createImageBitmap*
- html/semantics/embedded-content/the-canvas-element/*
Fixes: #37165
---------
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Fix wheel event, either dispatched from window or webdriver:
- Positive deltaY means scrolling down, negative deltaY means scrolling
up
- Positive deltaX means scrolling right, negative deltaX means scrolling
left
Tests: Many scrolling interaction test will depend on this.
Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
Adds indexeddb support to servo. At the moment heed is being used as the
backend, although this can be swapped out by implementing `KvsEngine`.
This PR adds a thread + a thread pool for Indexeddb related operations.
Also `database_access_task_source` is added for Indexeddb related
operations.
This is a partial rewrite of #25214. (Reopened due to branching issue)
Fixes#6963
---------
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Rasmus Viitanen <rasviitanen@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
using abort signal and abortcontroller in
Writablestreamdefaultcontroller
Part of https://github.com/servo/servo/issues/34866
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
1. `get_known_element`: Refactor to follow same step of spec (which
reduces unnecessary search) and implement previously missing step 4.2:
If node is stale return error with error code stale element reference.
An element is stale if its node document is not the active document or
if it is not connected.
2. Refactor `find_node_by_unique_id_in_document` to make it not check
error and really return a `Option<DomRoot<Node>>` as the name suggests.
This will greatly reduce duplication when implement [get a known shadow
root](https://w3c.github.io/webdriver/#dfn-get-a-known-shadow-root) soon
Testing: All WebDriver Conformance test after removing two problematic
commits in #37520
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Currently, the hover state will stay when the mouse moves out of the
webview, this PR fixes it
Testing: Hover on the `About` on servo.org, and then move the mouse up
to the browser UI, see the hover state resets
Signed-off-by: Tony <legendmastertony@gmail.com>
- Register import map when preparing HTML script element
- Added `import_map` to `GlobalScope`
Testing: should pass existing WPT
Fixes: part of https://github.com/servo/servo/issues/37316
---------
Signed-off-by: Jason Tsai <git@pews.dev>
This PR fixes some mistakes introduced in
https://github.com/servo/servo/pull/37332. Where Binding.conf and
WeakReferenceable trait were used badly
Testing: No test introduces
Fixes: It fixes mistake introduced in the incrementally implementation
of #26488
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
Follow the ImageBitmap specification and use the global scope bitmap
task source
to fulfill resolved promise (asynchronously).
https://html.spec.whatwg.org/multipage/#bitmap-task-source
Any promise rejection must be done synchronously.
Testing: Improvements in the following WPT test
-
html/canvas/element/manual/imagebitmap/createImageBitmap-resolves-in-task.any.js
Fixes (partially): #34112
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
Follow the ImageBitmap specification and make cropping of the bitmap
data to the source rectangle with formatting:
https://html.spec.whatwg.org/multipage/#cropped-to-the-source-rectangle-with-formatting
For now the next functionality not implemented:
- image orientation support (such as EXIF metadata)
- color space conversion (image, blob)
The convertion from ResizeQuality to "image" FilterType:
- pixelated/low/medium/high -> Nearest/Triangle/CatmullRom/Lanczos3
Other browsers use the following sample filtering:
- chromium (skia): Nearest/Linear/Linear/CatmullRom
- firefox (skia): Lanczos3
Testing: Improvements in the following WPT tests
- html/canvas/element/manual/imagebitmap/*
Fixes (partially): #34112
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
A document's named getter collects elements with either matching name or
id's (varies per element type) and returns them .
We implement this the following way:
* Create an iterator with elements whose `name` attribute matches
* Create an iterator with elements whose `id` attribute matches
* Concatenate both
The spec then asks us if there is more than one element in the list,
which we implement by checking whether the iterator returns `None` after
we get the first element. However, the same element can appear in both
iterators if it is a `img` element and both it's name and id attribute
match. Therefore, we need to check if there are more elements *which are
not equal to the first one*.
Testing: New web platform tests pass
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
The check was incorrect, where it was never matching and always
discarding the element. Instead, we should check the owner document,
which is the shadow-including root of the node.
Part of #4577
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This avoids various conversions back and forth between DOMString and
String. By using DOMString consistently, we avoid these
double-conversions. The only caveat are the USVString which are
initially passed into
TrustedScriptURL.
Part of #36258
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Move all report structs into the same file, to
keep them consistent and reuse functions such as stripping
of the URL and serialization of disposition. This is part
of modularizing security_manager, which contained various
logic related to CSP.
Part of #4577
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Stop DedicatedWorker from handling remaining messages after closed
Testing: WPT workers/WorkerGlobalScope-close.html
Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
Created a new method `HTMLElement::is_body_element` that replaces
`HTMLBodyElement::is_the_html_body_element`.
Testing: Existing WPT tests should pass.
Fixes: https://github.com/servo/servo/issues/37429
---------
Signed-off-by: iamlockon <xdddxyyyxzzz123@gmail.com>
Recently added WPT tests for this are now mostly passing. The remaining
tests fail on importmap support.
Part of #36258
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
There are currently five places that scroll offsets are stored:
- DOM: A set of scroll offsets used for script.
- Layout: An array of scroll offsets that is used for tracking
layout-side scroll offsets.
- Layout: The scroll offsets stored in the `ScrollTree`. These are
currently unset and unused.
- Compositor: The scroll offsets stored in the `ScrollTree` mirrored
from layout.
- WebRender: The scrolled offsets stored in the WebRender spatial tree.
This change is the first step in combining the first three into the
layout `ScrollTree`. It eliminates the extra array of scroll offsets
stored in layout in favor of the storing them in the `ScrollTree`. A
followup change will eliminate the ones stored in the DOM.
- In addition the `ScrollState` data structure is eliminated as these
are
now stored in a `HashMap` everywhere when passing them via IPC.
- The offsests stored in layout can now never scroll past the boundaries
of the scrolled content.
Testing: This should not change behavior and is thus covered by existing
WPT tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: stevennovaryo <steven.novaryo@gmail.com>
This patch adds support for showing source_content in `Debugger >
Source` panel. This works by handling the clients `source` messages in
the source actor. These source actors are already advertised as resource
via the watcher, populating the source list. We also update the
`sources` handler in thread actor for future work in thread debugging.
Note: while this PR also adds support for showing worker script
source_content, worker has been broken (See
https://github.com/servo/servo/issues/37012). I was able to confirm the
`content_type` and `source_content` for worker script in logs.

Fixes: part of https://github.com/servo/servo/issues/36027
---------
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
This change has two parts which depend on each other:
1. An early exit in the layout process, which allows for skipping
display list construction entirely when nothing would change.
2. A simplification and unification of the way that "fake" animation
frames are triggered. Now this happens on an entire ScriptThread at
once and is based on whether or not any Pipeline triggered a display
list update.
Animations are never canceled in the compositor when the Pipeline
isn't updating, instead the fake animation frame is triggered far
enough in the future that an unexpected compositor tick will cancel
it. This could happen, for instance, if some other Pipeline in some
other ScriptThread produced a new display list for a tick. This makes
everything simpler about these ticks.
The goal is that in a future change the ScriptThread-based animation
ticks will be made more generic so that they can throttle the number of
"update the rendering" calls triggered by script.
This should make Servo do a lot less work when moving the cursor over a
page. Before it would constantly produce new display lists.
Fixes: #17029.
Testing: This should not cause any web observable changes. The fact that
all WPT tests keep passing is the test for this change.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Implement `MicrotaskRunnable` for `DefaultTeeReadRequestMicrotask` to
run the microtask, instead of using its own ad-hoc mechanism via
`DefaultTeeReadRequestMicrotask::microtask_chunk_steps`.
Testing: No need for this refactoring.
Fixes: #37246
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This value was used when rendering was not done by WebRender. Nowadays,
we do not need this page clip rect concept and it is completely
unused.
Testing: This just remove dead code, so should be covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The default of `enum-variant-name-threshold` is 3, so adding any new
variants will lead to the lint being triggered, reference:
[enum_variant_names](https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names).
This PR fix this potential clippy lint warning for facilitate the
addition of new variant in following PR about incremental box tree
update.
Testing: No logic changed, just covered by existing WPT tests
Fixes: None
Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
I can't find any historical motivation for the use of UnsafeCell in the
implementation of WeakRangeVec from #8506. We can replace all the uses
of unsafe in this code by using RefCell, and the resulting code is
easier to understand.
Testing: Existing WPT tests using Ranges show no behaviour changes.
Fixes: #37276
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
For Desktop port of `request_open_auxiliary_webview`, stay on the
original WebView if the request originates WebDriver.
This is to make sure `webdriver_server::handle_new_window` does not
focus the new window, according to spec. See
c7eba2dbba/tests/wpt/tests/webdriver/tests/classic/new_window/new_window.py (L31-L37)
**To clarify**: this won't change the behaviour when user interacts, but
only affects WebDriver [New
Window](https://w3c.github.io/webdriver/#new-window).
Testing: `./mach test-wpt -r --log-raw "D:/servo log/all.txt"
./tests/wpt/tests/webdriver/tests/classic --product servodriver` based
on 96b0973037
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This is pretty much just wiring up the necessary stylo methods. Note
that the `exportparts` attribute is not yet supported, I'll do that in a
followup change
Testing: Covered by existing web platform tests.
This is the first half of https://github.com/servo/servo/issues/35349
Fixes https://github.com/servo/servo/issues/37325
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Replaces uses of `euclid::default::Size2D<u64>` with
`euclid::default::Size2D<u32>` for the canvas/context/snapshot.
This PR includes changes to the following components:
- canvas
- pixels
- script
- script_bindings
- shared/canvas
- shared/snapshot
Testing: https://github.com/hashcatHitman/servo/actions/runs/15426115391
(as of 892edc0048)
Fixes: #36706
---------
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Add static method `Supports` to `HTMLScriptElement`.
Part of #37262
Testing: relative WPT tests should become `PASS`
Signed-off-by: Jason Tsai <git@pews.dev>
This reverts commit 5580704438.
Let's re-land that fix when a working solution is found. Keeping that
regression makes it hard to evaluate other potential improvements.
Signed-off-by: webbeef <me@webbeef.org>
HTMLScriptElement: add `ScriptType::ImportMap`
Part of #37262
This covers most steps that are related to import map.
Testing: Existing WPT on HTMLScriptElement should remain the same.
---------
Signed-off-by: Yu Wei Wu <yuweiwu@YunoMacBook-Air.local>
Co-authored-by: Yu Wei Wu <yuweiwu@YunoMacBook-Air.local>
Fixes two silly bugs in the implementation of `<select>` elements.
* We did not fire `input` events
* We fired `change` events *before* updating the selected value
Both of these are only relevant when the embedder selects a value, so
due to our lack of webdriver support we can't test them.
With these changes it is possible to switch the language on
https://toolbox.googleapps.com/apps/main/.
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Align error message with WHATWG Streams spec by changing:
- `'stream is not locked'` to `'stream is locked'`
This will match the step 2 of the readablestream cancel method that
requires the correct TypeError when the stream is locked.
Signed-off-by: Alice Okingo <annekadiso@gmail.com>