Gated behind the feature flag `dom_navigator_sendbeacon_enabled` as the
`keep-alive` fetch parameter is crucial for real-life use cases such as
analytics requests.
Part of #4577
Part of #38302
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
["When applicable, unstable sorting is preferred because it is generally
faster than stable sorting and it doesn’t allocate auxiliary
memory."](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.sort)
Binary also reduced by 1KB in Release.
Testing: No behaviour change as semantically all current usage does not
have any pair with `std::cmp::Ordering::Equal`.
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
With some adjustment for `NamedKey`. The two crates need to be bumped
together to avoid duplicate of `keyboard-types` action.
---------
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
Also added some comments to make things clear.
For details, see
https://github.com/servo/servo/issues/38369#issuecomment-3138378527
Testing: Tested on X11 Ubuntu, Wayland Ubuntu, macOS, Windows.
Fixes: #38369
Co-authored-by: minghuaw <michael.wu1107@gmail.com>
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Co-authored-by: minghuaw <michael.wu1107@gmail.com>
to use the [SpiderMonkey Debugger
API](https://firefox-source-docs.mozilla.org/js/Debugger/), we need to
call it from an internal debugger script that we will supply. this
script must run in the same runtime as the debuggee(s), but in a
separate
[compartment](https://udn.realityripple.com/docs/Mozilla/Projects/SpiderMonkey/Compartments)
([more
details](https://hacks.mozilla.org/2020/03/future-proofing-firefoxs-javascript-debugger-implementation/)).
this patch defines a new DebuggerGlobalScope type and a new debugger
script resource. when creating each script thread, we create a debugger
global, load the debugger script from resources/debugger.js, and run
that script in the global to initialise the Debugger API.
subsequent patches will use the debugger script as an RPC mechanism for
the Debugger API.
Testing: no testable effects yet, but will be used in #37667
Fixes: part of #36027
---------
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
For current implementation, when a command may trigger a navigation,
webdriver only waits for document readiness state.
However, not all navigations make change in document.
This PR handles more cases for waiting for a navigation, and apply to
`element_click`.
- Before sending a command which may trigger a navigation, `webdriver`
sets `load status send` to `embedder`, `constelltation` and `script
thread` to listen to `navigation events`.
- Webdriver check if there is a navigation with `script thread`.
- If the navigation is loading a new url, webdriver checks if the
request is approved with `constellation`, then waits for document
readiness state.
- If the navigation is a hashchange, webdriver waits untill all new
generated dom events have been processed.
Testing:
`tests/wpt/tests/webdriver/tests/classic/element_click/navigate.py`
`tests/wpt/tests/webdriver/tests/classic/element_click/user_prompts.py`
https://github.com/longvatrong111/servo/actions/runs/16488690749
cc: @xiaochengh
---------
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Keep Constellation alive even when all browsing context closed in
WebDriver mode. In this case, when creating a new session, we would open
a new top-level browsing context.
Fixes: #37408
Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\close_window\close.py
--product servodriver`
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Use workspace dependency to sync the `winit` version between examples &
libservo.
Upgrade winit to 0.30.12.
Fixes: The hope is lost as it doesn't fix anything..
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
They are redundant as marked in #38174 as rendering related rect already
updated in `minibrowser::update`. As a result, we are able to remove
`window_rendering_context` and `inner_size` fields from `struct Window`.
Testing: No regression/behaviour change in all tests running with headed
window.
Fixes:
https://github.com/servo/servo/issues/38255#issuecomment-3117642340
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
The feature which enables optional dependency & function is never used
and can be safely removed.
Testing: It can still builds.
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
We want to eventually remove raqote backend, but for now we can gate it
behind a feature (still enabled by default in servoshell) like the rest
of backends. `dom_canvas_backend=auto` will select first available
backend. Builds on top of https://github.com/servo/servo/pull/38310 to
support cases where no backend is available.
Testing: It compiles with or without feature
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
vello_cpu does not have any tests timeouts, because we do not need
download stuff from GPU as all work happens on CPU. So performance wise
it's better then classic vello at least for our usecase. There are some
vello bugs, but I think we will be able to sort them out within
upstream, eventually. Interestingly enough there are no new PASS like
they were with classic vello.
Difference with raqote can be observed here:
https://github.com/sagudev/servo/actions/runs/16549241085/attempts/1#summary-46802486798
## Known vello problems:
- https://github.com/linebender/vello/issues/1119
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
- `/html/canvas/element/line-styles/2d.line.cross.html`
- `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
- `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- `putImageData(getImageData(...), ...)` is lossy (precision problems,
might be due to ImageData being unmultiplied)
-
`/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html`
Testing: Tested using vello_cpu_canvas subsuite
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
- Implement [Maximize
Window](https://w3c.github.io/webdriver/#maximize-window)
- Previously, headless window screen size is same as inner size if not
specified in preference. We make it double as required by the test to
not have max window initially.
- Some other random cleanup.
Testing: webdriver Stress test for maximize window (headed + headless).
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Add vello backend by implementing Backend traits in canvas crate (so
this lives in canvas_paint_thread - embedded process). Current
implementation uses normal wgpu, so we block on GPU work. Vello backend
is gated behind `vello` feature and `dom_canvas_vello_enabled` pref.
Feature-wise this backend is on on par with raqote (sometimes better
sometimes worse), but performance wise it's worse.
## Known vello problems:
- image roundtrip does not work (fixed in
https://github.com/linebender/vello/pull/974)
- https://github.com/linebender/vello/issues/1066 (fixed)
- clip layers are not working properly:
https://github.com/linebender/vello/issues/1061
- `/html/canvas/element/pixel-manipulation/2d.imageData.put.*`
- `/html/canvas/element/path-objects/2d.path.clip.intersect.html`
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
- `/html/canvas/element/line-styles/2d.line.cross.html`
- `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
- `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- There is currently no way to do put image properly in vello as we
would need to ignore all clips and other stuff (we try to work around
this on best effort basis)
https://github.com/linebender/vello/issues/1088
- `/html/canvas/element/pixel-manipulation/2d.imageData.put.*`
- precision problems
- `/html/canvas/element/path-objects/2d.path.stroke.scale2.html`
- `/html/canvas/element/path-objects/2d.path.arc.scale.1.html`
## Known servo problems
- bad performance due to blocking on GPU work
- some get/put intensive tests `TIMEOUT`
- proper shadow support (non-blocker as we already are living without it
now)
- support for rect shadow is there but unimplemented currently as that's
the state in raqote
Testing: `mach try vello` will run normal WPT (with raqote) +
vello_canvas subsuite that runs only on `/html/canvas/element`. All
subsuite expectations are stored separately.
Fixes: #36823Fixes: #35230
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
The tab bar would disappear on resizes, this just reverts the change
which introduced the bug.
Testing: servoshell doesn't currently have tests, so this change does
not come with a test.
Fixes: https://github.com/servo/servo/issues/38255
Signed-off-by: Leo Ring <leoring03@gmail.com>
- We no longer pretend that resize is always successful and simplify the
result computation.
- Adjust minimum window size to match other browsers and the test
expectation.
- Restrict some unnecessary access specifier.
Testing: ` ./mach test-wpt -r
"tests\wpt\tests\webdriver\tests\classic\set_window_rect\set.py"
--log-raw "D:\servo test log\set.txt" --product servodriver
{--headless}`
Fixes: #37804 as Task 8 is last task.
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Add virtual `window_position` to headless window so that `moveTo` and
WebDriver window command can work properly.
Testing: `./mach test-wpt -r
"tests\wpt\tests\webdriver\tests\classic\set_window_rect\set.py"
--product servodriver --headless`
Fixes: Task 7 of #37804.
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
https://github.com/servo/servo/pull/38160 added a webdriver-specific API
to support waiting on focus operations to complete. These changes
replace that with a generalized pattern, where a unique ID is created
for each focus operation and the embedder can receive notifications
about each focus operation when it is complete, regardless of whether
the focus was actually changed.
Testing: Existing test coverage from
https://github.com/servo/servo/pull/38160/ is unchanged.
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This cleans up some compile warnings about unused functions.
Testing: Does not change functionality, OHOS and Linux still compile
(hopefully the other builds too).
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Previously, we pretend we are able to set position in response. Now we
can really do it.
Testing: Able to set position accurately when tested locally.
Fixes: Task 5 of #37804.
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
`WebDriverCommandMsg::TakeScreenshot` was the last thing blocking us
from removing constellation access in webdriver server. Now we can
happily remove it.
Surprisingly, this reduces binary size by 185KB for release profile in
Windows. #37737 removes a net total of 300 lines, but only reduced 98KB.
Testing: No regression after testing.
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Previously the webdriver do not wait for focus to complete, which can
cause some instability.
No matter interact as human or webdriver, the focus chain always goes
as: Embedder forwards -> Constellation (do some updates) -> Embedder (do
some updates).
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
According to discussion
https://github.com/servo/servo/pull/34063#discussion_r2187147615, this
PR
1. adds `PIXEL_DELTA_FACTOR` to increase scroll speed for
`MouseScrollDelta::PixelDelta`, which is used by macOS and
high-precision mouse.
2. adds `LINE_WIDTH` to increase x-axis scroll speed for
`MouseScrollDelta::LineDelta`, which is used by Linux and Windows.
3. Increase mouse scroll speed in general to match other browsers
4. Reduce keyboard scroll offset to scroll exactly "one line", to match
other browsers.
Testing: Example in #35037 can now scroll in x-axis as fast as y-axis,
similar to other browsers.
Fixes: part of #38072.
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
- Add `handler any user prompt` step for all commands.
- Enable webdriver tests which were blocked by `handle any user prompt`
step.
---------
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
We also need to bump egui-file-dialog and accesskit_winit. Changes are
done based on migration paths provided by egui.
Testing: No tests for servoshell
Fixes: #38117
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Sending all mouse button events (Left, Right, Middle, Back, Forward) to
the constellation for processing. Before, only left and right mouse
buttons were handled.
Testing: There is no new test for this. Manually testing was done. We
currently
do not have a good way to test user interaction in servoshell.
Fixes: #37996
Signed-off-by: abdelrahman1234567 <abdelrahman.hossameldin.awadalla@huawei.com>
1. Create `get_origin_relative_coordinates` according to
[spec](https://w3c.github.io/webdriver/#dfn-get-coordinates-relative-to-an-origin)
to be reused
2. Add previously missing offset for PointerOrigin::Element
3. Refactor code for perform pointermove/wheel to be closer to spec.
4. Handle some issues with spec:
https://github.com/w3c/webdriver/issues/1758
Testing: Several new passing cases as we are more precise with
coordinates now.
Fixes: Part of #38042.
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
With helper functions introduced in #38020, this is now becoming
reality.
Testing: No behaviour change.
Fixes: #37937
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
After sending `GoBack` or `GoForward` command, webdriver wait for the
navigation complete.
It can be achieved by waiting for
`WebViewDelegate::notify_history_changed`
Testing:
`tests/wpt/meta/webdriver/tests/classic/back/back.py`
`tests/wpt/meta/webdriver/tests/classic/forward/forward.py`
---------
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Enable by default the DOM "ImageBitmap" interface previously gated
behind
"dom.imagebitmap.enabled" preference as experimental web platform
feature.
https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap
NOTE: Non blocking non supported functionality:
- vector HTMImageElement, bitmap/vector SVGImageElement
- EXIF image orientation
Testing: Covered by existing WPT tests
Fixes: #34112
Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
I'm trying to use Servo as a daily driver. I like to pin the most often
used apps to the my taskbar (Dash to Panel in Gnome). I also launch apps
from the menu (Arc Menu). Adding a .desktop file make it show up in the
menu. I could not get pinning to work until I set the name with `winit`.
This is because the name is used to match it with the icon. I used the
Gnome Looking Glass (lg) command to determine that the name was not set.
Testing: I followed the instructions that I put in the .desktop file. I
copied the .desktop file to the right folder, set up a link to the svg
icon, and adjusted the paths to point to the compiled executable.
---------
Signed-off-by: Michael Mc Donnell <michael@mcdonnell.dk>
Previously, `screenX`, `screenY`, `outerHeight`, `outerWidth`, `moveBy`,
`resizeBy` ask compositor for window rectangle, which then return
"inner" rectangle after consulting Embedder.
This PR
1. removes `GetClientWindowRect` from compositor, and directly let
script ask embedder.
2. add `window_size` to `ScreenGeometry`
3. add a lot of docs to `ScreenGeometry`
Testing: `tests\wpt\mozilla\tests\mozilla\window_resizeTo.html` can now
pass for Headed Window.
Fixes: #37824
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This fixes the speedometer hang on CI.
Sometimes on CI we have the servoshell app not being in the foreground
(because popups have higher priority). Then, for some reason the
eventloop does not get pumped after some time.
This fixes this and is consistent with the current code in android.
Here is a succesful run
https://github.com/Narfinger/servo/actions/runs/16214904687/job/45782241427.
This needs also https://github.com/servo/servo/pull/37994 to be
successful but these two PR are independent.
Testing: Having the usb popup on the screen while running speedometer
without this changes hangs consistently (until input which calls
present_if_needed). With this change the hang does not occur anymore.
Fixes: I think https://github.com/servo/servo/issues/37727 is the same
issue and I confirmed that in the above case testinput does nothing
useful. We will see if this occurs again.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Previously, we SendKeys will be forwarded to constellation by the
embedder. Now we use webview.notify_input_event, which will send
WebDriverCommandMsg::ForwardInputEvent for the KeyboardEvent and
CompositionEvent.
Fixes: part of https://github.com/servo/servo/issues/37370
---------
Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
Let `WebDriverCommandMsg::ScriptCommand` goes through embedder first.
Give `embedder` the ability to release `webdriver` from waiting for a
response of `ExecuteScript`.
Tests: https://github.com/longvatrong111/servo/actions/runs/16071375821
No regression compared to CI run on main branch.
Fixes: https://github.com/servo/servo/issues/37370
cc: @xiaochengh
---------
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
OHOS: Allow ime to be more robust against errors. For example, when a
system popup is in front, no keyboard can be displayed, hence, erroring
out. Before we panicked, now we just log the error and continue.
This should hopefully fix some of the recent ohos ci errors.
Testing: Tested on a certain CI device that shows a popup.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Previously, we only consider OS decoration height. But when testing
#37960, I find that the decoration width is also non-zero.
Testing: Need to wait W3C spec change
https://github.com/web-platform-tests/wpt/pull/53421 related to
webdriver rectangle. When combined with #37960, this can fix at least
`window_resizeTo.html`.
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This function is used to compute `screenLeft`, `screenTop`, `screenY`,
`screenX`. Previously, it wrongly computes viewport position instead of
window position, which didn't match
f7c86c4393/components/shared/embedder/lib.rs (L717-L720)
Testing: More webdriver test would pass once #37893 is merged.
Fixes: the position part of #37824.
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Previously, we KeyboardAction will be forwarded to constellation by the
embedder. Now we use `webview.notify_input_event`, which will send
`WebDriverCommandMsg::ForwardInputEvent` for KeyboardAction
Fixes: part of https://github.com/servo/servo/issues/37370
---------
Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
Using DYLD_FALLBACK_LIBRARY_PATH means we first try to link to the
normal libraries and only fallback to looking up symbols in gstreamer if
the symbols were not found elsewhere.
This prevents some linking issues.
Testing: Covered by existing tests. Fix for issue #37811 manually
verified by the reporter.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>