Commit graph

441 commits

Author SHA1 Message Date
Delan Azabani
6a3cd65bf2
Move servoshell code into an internal lib crate (#31439)
* Move servoshell code into an internal lib crate

* Fix name of Android port
2024-02-28 11:46:12 +00:00
Daniel Adams
c999d4546c
Implement non-XR Gamepad discovery and input (#31200)
* Create embedder event to send to constellation

* Handle gamepad message in constellation, send to script thread

* Handle GamepadEvent in script thread and dispatch event to document

* Add missing Clones, fix event

* Add gamepad task source

* Adjust GamepadIndex type, remove unused imports

* Add internal getter for gamepads list

* Update gamepad new methods

* Handle gamepad connect and disconnect events

* Proto will be none, no need for HandleObject

* Initialize buttons and axes to standard mapping

* Adjust update type index types

* Update GamepadButton update function

* Adjust Gamepad mapping comments to match spec, add update logic

* Amend comment

* Update button and axis inputs on Updated event

* Add GilRs as gamepad backend in servoshell

* Add spec links, queue gamepad updates on task source

* ./mach fmt

* Fix comment length

* Split out button init, update spec comments

* Move gamepad event handling from document to global

* Map and normalize axes/button values

* Use std::time for gamepad timestamp

* Adjust gamepad handling in event loop

* Move button press/touch check into map+normalize function

- Small change but is more in line with spec

* ./mach fmt

* Update comment spec links and warning messages

* Doc comments -> regular comments

* Add window event handlers for gamepad connect/disconnect

* Adjust gamepad disconnect behavior

* Add missing TODO's, adjust gamepad/gamepadbutton list methods and formatting

* Update button handling from gilrs, add comments

* Enable gamepad pref during WPT tests and update expectations

* Update WPT expectations in meta-legacy-layout
2024-02-17 18:42:31 +00:00
Daniel Alley
faaf9e9323
Fix resize event is not fired for window in headless mode (#26194)
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-02-16 10:54:36 +00:00
Martin Robinson
d7d0451424
libservo: Handle GL video decoding setup internally (#31209)
Instead of making the client set up GL video decoding, have this done
inside libservo. The details necessary for decoding are fetched via
Surfman now. This also removes the setup for the context on Android --
which has no GStreamer support now anyway. In the future, this could be
enabled, but should likely be done using Surfman, instead of passing on
all these details manually.
2024-02-03 14:38:48 +00:00
Martin Robinson
a07ad85eaa
dependencies: Upgrade surfman to 0.9 (#31224)
This upgrades surfman and webxr. The main benefit to this upgrade is
that surfman (and thus libservo) no longer depends on winit. servoshell
still does, but this should make upgrades a lot easier.
2024-01-30 12:22:23 +00:00
Martin Robinson
bc211f8ff3
gfx: Rename WebrenderSurfman to RenderingContext and move to gfx (#31184)
This is a small cleanup that moves and renames this class. The rename is
simply because we are exposing a lot about the details of Servo's
rendering in the API and it makes sense to start thinking about
abstracting that away a bit.

This also moves the struct to `gfx`, which does have an effect on
Servo's dependency graph. This adds a new dependency on gfx to
`compositing`, but `compositing` had a transitive dependency on
gfx before through `canvas`.
2024-01-27 17:58:34 +00:00
Ngo Iok Ui (Wu Yu Wei)
266a082206
Update Servo::get_events to return drain type (#31181)
* Update Servo::get_events to return drain type to prevent constant allocation

* Remove type alias for tlwc

* Fix libsimpleservo
2024-01-26 10:25:12 +00:00
Delan Azabani
eb95703325
constellation: focusing and closing webviews (#30842)
* constellation: focusing, closing, and native window visibility

* rename “browser” to “webview”, “unfocus” to “blur”

* remove native window visibility from constellation

* rename more “browser” to “webview”

* guard clauses

* don’t automatically focus when no webviews are focused

* comment spec steps for window.close()

* use format interpolation

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

* fix formatting

* rename “Webview” to “WebView” in types and type parameters

* remove unused method

* fix libsimpleservo

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-01-24 11:45:54 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
dependabot[bot]
7480f67497
build(deps): bump vergen from 8.3.0 to 8.3.1 (#31114)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.3.0 to 8.3.1.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.3.0...8.3.1)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-17 17:03:18 +00:00
dependabot[bot]
55bf020d89
build(deps): bump vergen from 8.2.10 to 8.3.0 (#31107)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.2.10 to 8.3.0.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.10...8.3.0)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 17:44:14 +00:00
dependabot[bot]
a75eec6fe4
build(deps): bump vergen from 8.2.7 to 8.2.10 (#31100)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.2.7 to 8.2.10.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.7...8.2.10)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 17:29:34 +00:00
dependabot[bot]
fdd9263cae
build(deps): bump vergen from 8.2.6 to 8.2.7 (#31081)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.2.6 to 8.2.7.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.6...8.2.7)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-12 16:40:49 +00:00
Delan Azabani
17f3c45d4f
Add initial support for offscreen rendering (#30767)
* Offscreen rendering

* shared memory case never actually rendered to backbuffer

* fix compile errors (in theory) when gl crate feature disabled

* update doc comments

* remove dark CentralPanel border covering edges of viewport

* clear to transparent, to avoid pink artifacts

* fix mouse input for browser being consumed by egui

* avoid destroying OpenGL resources unless resizing window

* clean up compositing::gl

* fix flickering around edges after resizing window

* unset invalidate_last_render_target after invalidating

* fix incorrect DRAW_FRAMEBUFFER name when blitting

* bind the widget surface fbo before painting egui

* make composite_specific_target take CompositeTarget, not Option

* compositing: remove cargo feature “gl”

* capitalise FBO in bind log message

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

* capitalise FBO in drop log message

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

* rename RenderTargetInfo fields and use OnceCell for next field

* rename RenderTargetInfo.read to read_back_from_gpu

* document servo_framebuffer_id in Minibrowser::update

* rename needs_fbo to use_offscreen_framebuffer

* capitalise FBO in unbind log message

* clarify the purpose of Minibrowser::on_event

* fix unused_must_use warning

* reduce nesting in Minibrowser::update

* use implicit format argument in panic

* store Minibrowser.widget_surface_fbo as glow type

* explain why servo_framebuffer_id is None in first call site

* rename output_framebuffer_id to offscreen_framebuffer_id

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-12-13 02:49:25 +00:00
Delan Azabani
8a226fdb19
constellation: notify embedder when events are hit-tested to browsers (#30841)
* constellation: notify embedder when events are hit-tested to browsers

* fix compile error in libsimpleservo

* impl From<&CompositorEvent> for CompositorEventVariant

* remove msg temporaries in Constellation::forward_event

* use single wildcard arm in EventDelivered case in handle_servo_events
2023-12-12 06:36:27 +00:00
atbrakhi
a326a60c16
Minibrowser: Add Back and Forward navigation (#30805)
* add back and forward button

* use left_to_right egui layout

* use nested allocate_ui_with_layout
2023-12-06 10:03:15 +00:00
atbrakhi
ea8cd36f0d
Fix the location url that reverts to the old value while loading (#30518)
* add PumpResult::HistoryChanged

* Fix the location url that reverts to the old value while loading

* fix spellings, undo self.location changes

* fmt

* Rework PumpResult

* fmt and update trace message as per PumpResult

* remove comment
2023-12-04 09:18:14 +00:00
Martin Robinson
20a122c2f6
Use git2 version of vergen (#30804)
When compiling Servo on MacOS, the version of libintl that comes bundled
with GStreamer is not compatible with the one used by Homebrew. This can
cause issues when adding GStreamer shared objects to the library
resolution path and then trying to run Homebrew git. Using libgit seems
to work around this issue.

The failure case means that the version compiled into Servo does not
properly include the git hash.
2023-12-01 16:05:17 +00:00
Ngo Iok Ui (Wu Yu Wei)
44d79269f4
Fix servoshell can't respond when there's no minibrowser (#30598)
* Fix servoshell can't respond when there's no minibrowser

* Remove external_field and update documentation

* Update documentation

* Fix crash when handling ReadyToPresent if it's headless mode

* Fix some wpt tests got timedout
2023-11-11 06:45:27 +00:00
atbrakhi
bbbdb77a7a
Handle URL without scheme (#30148)
* cleanup and move user input logix into servoshell

* fix fmt

* add more tests

* rename sanitize_url and add location bar test for unix system

* fmt and missing rename

* check for host, fix test-error

* remove println, add condtion for not-none

* fmt

* clean up

* review update

* fix build failure cause by embedder_traits::resources

* add cfg target-os windows

* fmt

* use to_file_path() instead of path()
2023-11-09 16:37:22 +00:00
dependabot[bot]
1ab2c7b127
build(deps): bump vergen from 8.2.5 to 8.2.6 (#30697)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.2.5 to 8.2.6.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.5...8.2.6)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 16:41:32 +00:00
Delan Azabani
a3d2f0c586
Enable debug assertions for all builds other than official releases (#30509)
* Run main and try jobs with debug assertions

* use single quotes in workflow expressions

* set force-debug-assertions in main.yml

* set force-debug-assertions as part of decision job

* fix typo in MachCommands.build

* fix more hardcoded profile names

* fix tidy

* split cargo_profile_option on windows

* Fix running servoshell and unit tests through a symlink

* rename steps to make them less confusing

* fix more hardcoded cargo profile options

* fix missing inputs in linux-wpt and mac-wpt

* make filename an inherent method of Resource

* rework release-with-debug-assertions profile to production profile

* rework resource logic to eliminate std_test_override

* set production flag in nightly release builds

* clean up servobuild.example and windows.yml

* oops forgot to check in embedder_traits/build.rs

* fix mach test-unit behaviour through symlink

* unit tests only need current_dir and ancestors

* fix macOS package smoketest breakage

* expect css/css-color/currentcolor-003 to crash under layout 2013

* fix more references to {force,release-with}-debug-assertions

* fix local build failures under --profile production
2023-10-26 08:22:14 +00:00
Delan Azabani
351b5036bf
Fix running servoshell and unit tests through a symlink (#30537)
* Fix running servoshell and unit tests through a symlink

* make filename an inherent method of Resource

* fix mach test-unit behaviour through symlink

* unit tests only need current_dir and ancestors

* fix macOS package smoketest breakage
2023-10-18 10:33:51 +00:00
Martin Robinson
dfd14aabef
Fix pinch zoom and enable it for TouchpadMagnify events (#30459)
Pinch zoom was broken because pinch zoom events were triggered at -1, -1
in the compositor. This change:

1. Differentiates between magnify and scroll events in the compositor to
   remove the question of where to trigger them.
2. Converts winit TouchpadMagnify events into pinch zoom events so that
   this works properly on MacOS.
2023-10-03 12:49:36 +00:00
dependabot[bot]
6b2edbac18
build(deps): bump winit from 0.28.6 to 0.28.7 (#30440)
Bumps [winit](https://github.com/rust-windowing/winit) from 0.28.6 to 0.28.7.
- [Release notes](https://github.com/rust-windowing/winit/releases)
- [Changelog](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/winit/compare/v0.28.6...v0.28.7)

---
updated-dependencies:
- dependency-name: winit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-28 23:48:16 +00:00
Delan Azabani
bb1a6c23c5
minibrowser: implement HiDPI support (#30343) 2023-09-14 13:24:38 +00:00
dependabot[bot]
59babea86a
build(deps): bump vergen from 8.2.4 to 8.2.5 (#30346)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.2.4 to 8.2.5.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.4...8.2.5)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 12:03:34 +00:00
Delan Azabani
95bf68df77
[NFC] servoshell: fix euclid units associated with winit geometry (#30344)
* [NFC] servoshell: fix euclid units associated with winit geometry

* rename locals in headed Window::get_coordinates
2023-09-14 10:39:36 +00:00
Delan Azabani
2076b5d789
servoshell: fix unwrap None during RedrawRequested (#30360) 2023-09-14 10:13:19 +00:00
Delan Azabani
5c8fd98aaf
[NFC] servoshell: clarify that device_pixels_per_px is an override (#30342) 2023-09-12 09:29:26 +00:00
Delan Azabani
90ad5920e2
[NFC] servoshell: fix rust-analyzer and rustfmt breakage (#30340) 2023-09-12 06:27:10 +00:00
Delan Azabani
1bbd0c1e6e
servoshell: fix lockups while animating (#30322)
* servoshell: fix lockups while animating

* move comment to external_present declaration

* disable needs_recomposite optimisation for now due to breakage

* fix compile error that only happens on ci

* fix more compile errors
2023-09-12 03:30:43 +00:00
Martin Robinson
a9d37cb85a
Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)
* Upgrade vendored version of WebRender

* Patch WebRender: upgrade version of gleam

* Restore hit testing implementation

* Fix WebRender warnings

* Adapt Servo to new WebRender

* Update results

* Add a workaround for #30313

This slightly expands text boundaries in order to take into account the
fact that layout isn't measuring glyph boundaries.
2023-09-10 12:38:56 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

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

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Delan Azabani
7336aab710
minibrowser: fix spurious update when location has not changed (#30309)
* minibrowser: fix spurious update when location has not changed

* refactor logic in update_location_in_toolbar
2023-09-07 09:09:12 +00:00
Atbrakhi
3df284cf54
Move user input logic into servoshell (#30238)
* cleanup and move user input logix into servoshell

* fix fmt

* moves test from servoshell file

* move command-line args into servoshell

* remove feature media-gstreamer

* fix fmt

* move user input logic code into lib to make it more testable

* remove opts_matches in fn instead get it from main2

* remove pub and fix import

* add licence in new file

* revert passing Matches, instead pass Option String

* review update, also move sanitize fn to parser file

* fmt fix

* review fix: remove extra line
2023-09-06 11:45:56 +00:00
Delan Azabani
c3c6c95a9b
constellation: crash to a new “sad tab” error page (#30290)
* constellation: crash to a new “sad tab” page

* check in resources/crash.html

* use a separate enum variant instead of keying on reason

* fmt + tidy

* rename Resource::Crash to Resource::CrashHTML

* clean up crash page and add details (reason + backtrace)

* avoid repeating crash errors in script::script_thread warn log

* make new LoadData init more idiomatic

* clarify comments and new fields

* fix doc comment style
2023-09-06 09:52:37 +00:00
Martin Robinson
0cf84f9f7c
Use arboard in servoshell instead of rust-clipboard (#30274)
rust-clipboard is unmaintained, which means that it pulls in very old
dependencies (including a version xcb with 3 critical security
vulnerabilities). In addition, we already depend on arboard. This
removes four crates from our dependency graph.
2023-09-06 09:15:21 +00:00
Samson
5e60088276
Always dummy (#30240) 2023-08-30 06:09:14 +00:00
Atbrakhi
2afb7c1975
make enter key equivalent to go button when location field is focused (#30126) 2023-08-29 09:27:53 +00:00
Atbrakhi
66567faeb2
Rename ports/winit package to servoshell (#30163)
* rename winit package to servoshell

* revert previous changes and rename only package
2023-08-28 14:36:57 +00:00