This crate is just using system APIs to get the resident and virtual
memory size of the current process. We can do this directly with
`mach2`, which also allows more flexibility if we want to fetch other
values in the future.
This does require duplicating `mach2` as the version used by `gilrs` is
older. Presumably, some future release of `gilrs` will upgrade soon.
Testing: There aren't really tests for this, but I tested it manually by
running the memory reporter and ensuring that both the old and new
values were
the same.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Changed some allow to expects and removed the unfulfilled expectations.
Testing: Refactor
Part of: #40383
Signed-off-by: anonmiraj <nabilmalek48@gmail.com>
Remove the public API to trigger shutdown and instead trigger the
process from `Servo`'s implementation of `Drop` trait.
This makes it hard to create issues involving the order of destruction
of `Servo` and `WebView`s. It will also allow us to implement
asynchronous shutdown in the future.
Testing: Should be covered by existing unit tests.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
As discussed in the tsc-channel, prepare for the next release by cutting
a version on the last day of the month.
Note: The actual release would happen ~ 2 weeks from now, when the blog
post for november is ready.
This commit was produced by running `./mach release 0.0.3`.
Testing: Not required. Additional pre-release testing will happen after
the version bump and before the release, with potential patches being
cherry-picked to a release branch.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This change is a major re-architecture of servoshell to support multiple
windows. Unfortunately it was not possible to do this incrementally, but
@mukilan and I did this together so we feel more confident about these
changes.
The main change here is that now the `HashMap` of windows that `App`
has can be filled with more than one `ServoShellWindow`.
`ServoShellWindow` is a wrapper around a `PlatformWindow` which can
either be headed, headless, or for embedded platforms. Embedded
platforms (Android and OHOS) are only expected to have a single window,
but there is no reason that more windows cannot be added.
There is still a little bit more work to be done in order to fully
enable
mulitple windows, so this change is just the architectural preparation.
This change enables the embedded and desktop versions of servoshell to
start to be fully integrated so that the entire `RunningAppState` is
shared between them.
Testing: servoshell is the test harness so these changes are covered
by the WPT tests.
---------
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This makes it mostly that the correct keyboard will be selected and we
don't start with an uppercase letter.
Testing: Compiled on OHOS and looked on the phone.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Instead of relying on `Sevo::animating()` in servoshell to drive the
event loop, it is sufficient to just let the `RefreshDriver` wake it up
when it is time to re-render.
This allows us to remove `Servo::animating()` completely. It is a bit
odd that there is a global API to track this, rather than per-`WebView`
or window, so this change just removes it entirely.
Testing: This should make the main loop of headless servoshell more
efficient,
but I do not think this difference is going to be observable in any way.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Ran ./mach release 0.0.2 to update the version number and update the
license.html
This is in preperation for the v0.0.2 release with the next nightly, as
discussed on zulip.
Testing: Not tested
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This adds an implementation of `VsyncRefreshDriver` ensuring that frame
updates are driven by the system compositor.
Testing: This should increase the smoothness of animations, but I'm
not sure how to test that exactly.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Change the installation directory to Servo.
This was discussed during the October TSC meeting
and removes the outdated reference to mozilla research.
Testing: Manually tested the windows installer
Fixes: #40068
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This change makes it so that Servo handles touch events on Android.
Flinging becomes a bit less native, but with two big benefits:
1. Before touch event handling on Android wasn't standards compliant,
because web content didn't get a chance to call `preventDefault()` on
touch events, whcih important for proper site behavior.
2. This unifies all touch event handling across Servo platforms. This
means that improvements to things like fling will benefit all
platforms equally. In addition, fling on Android can be integrated
into Servo's animation handler.
Generally, this also just makes things much simpler to reason about on
Android.
Testing: This kind of input handling isn't tested in Servo yet.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This change adds a full implementation of pinch zoom, including
center-aware zooming. Before this kind of pinch zooming was only enabled
on OpenHarmony. Now all pinch zooms must come with a focal point, which
determines the center point of the zoom. This enables full pinch zoom on
Android and has OpenHarmony use the same system for pinch zoom.
Every WebView now has a `PinchZoom` which describes the viewport of the
pinch zoom and handles panning with proper chaining of zoom viewport
panning to scroll layer scrolling. In addition, the collection of touch
actions is simplified by storing an array and turning each into a
ScrollZoomEvent when appropriate.
Caveats:
- We've noticed some hard to diagnose bugs with clamping the panning
viewport, but we'll tackle those later once we figure out how to
reliably reproduce them.
- Keyboard scroll events currently do not properly pan the pinch zoom
viewport. This will be handled in a followup.
Testing: There are currently no tests for this kind of touch interaction
as there's no way to read the pinch zoom from a WebView. It's processed
asynchronously. Once that API is added, we should be able to add some
simple tests, but many things are still unaccessible such as the pan
position in the pinch zoom viewport.
Fixes#4224.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
These commits add a new settings screen to the app, then add:
1) a setting to disable a developer-targeted UI element (an indicator
about whether the app is polling continuously for events)
2) a toggle for experimental web platform features
The page needs to be reloaded after switching the toggle before any
changes can be observed.
Testing: Manually tested by visiting https://developer.mozilla.org with
the setting enabled and disabled. No automated testing for Android yet.
Fixes: #39791
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Focusing the location bar in the Android app shows the onscreen
keyboard, but clicking on a link in the current document does not make
it disappear. This change ensures the input focus is reset appropriately
and ensures the keyboard disappear when the location bar is not being
edited.
Testing: Manually tested. No automated tests for Android app at this
time.
Fixes: #40008
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Use Release mode for gradle for production builds and Debug for any
other builds.
This fixes an exception when building for android with a custom cargo
profile.
`SERVO_TARGET_DIR` is read in `apk/jni/Android.mk` and specifies the
folder
libservoshell.so is expected to be in.
Testing: Tested manually with `./mach build --android --production`
Fixes: #34564
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
This is the most basic integration possible. Current limitations
include:
* the done button doesn't trigger form submission/keyboard hiding
* IME events don't trigger inputs (ie. pressing and holding a letter to
get more options)
However, it is infinitely better than the current integration.
Testing: Manually tested in the Android emulator.
Fixes: #12127 (we can open more specific issues after this)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Another tiny binary size win for Android! .webp assets are supported
since API level 17, and Servo is built against 33, so this shouldn't
cause issues.
Testing: Manual.
Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This shows up sometimes in code reviews, so it makes sense that tidy
enforces it. `rustfmt` supports this via comment normalization, but it
does many other things and is still an unstable feature (with bugs).
Testing: There are new tidy tests for this change.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Losslessly optimizes the Android resources. These are the only non-test
PNGs remaining in the project, to my knowledge.
Testing: Unnecessary, since this only optimizes assets.
Signed-off-by: maple! <averyrudelphe@gmail.com>
OHOS CI: Now we can benchmark specific files. These files need to be in
the runs.json and in the supprt/hitrace-bench folder.
A simple testcase of parsing html from string is included (taken from
https://github.com/servo/servo/issues/37223).
We copy all files in
support/hitrace-bench into the hap of the phone.
These files can use the console.log javascript command to get their
measured output.
Additionally, this now supports reporting resident-accordings-to-smaps
which is a slightly different memory than resident.
This needs update to hitrace-bench 0.7 which will be completed once the
PR is marked ready.
Testing: On action runner here:
https://github.com/Narfinger/servo/actions/runs/16118101025/job/45477031813
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Previously, our Servo-specific spatial tree scroll offsets were opposite
to
that of WebRender and also the web platform. This is due to the fact,
likely, that `winit` wheel directionality is also flipped. This change
has both the Servo spatial tree and the API take offsets that are
consistent with the web.
Any possible changes to the meaning of wheel directionality will be
handled in a followup change.
This is a breaking change to the Servo API.
Testing: This change updates unit tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Instead of printing a Rust compilation warning, simply print a message
before every build (when using `mach`) that shows the build
configuration and whether or not `crown` is enabled.
Fixes#32597.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Currently we just pause the compositor and replace the window in it
while having separate bookkeeping to remember which window belongs to
which tab.
Currently there are no tests for OHOS, so we cannot test the changes.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Uses the native ohos-api crates to get the required information for
starting servoshell.
This increases the minimum API version requirement to API-14.
Testing: Tested on device.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Split out `save_output_image_if_necessary` into its own file so the code
can be shared by servoshell on the desktop and ohos.
Additionally, hook it up to the loop in OHOS and have OHOS allow
exiting.
Testing: Manual testing on ohos and desktop.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
The `Column()` height and thus also the XComponent height extends beyond
the physical display for unknown reasons. This is a problem on websites
that have a footer bar, since the footer is partially below the display
end.
Using Flex with Column direction works as expected.
Testing: Manual inspection with DevEco Testing inspecting the height of
the children elements in ArkUI
Fixes: Part of the servoshell surface extending beyond the physical
screen on ohos
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Migrate to 2024 edition
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Allow unsafe_op_in_unsafe_fn lint
This lint warns by default in the 2024
edition, but is *way* too noisy for servo.
We might enable it in the future, but not now.
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Compile using the 2024 edition
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
The `shell` suffix causes issues with the startup profiling tools on
OpenHarmony. The profiler fails to detect the start of the app.
This is fixed by renaming the app. I tried various
different variations and identified the `shell`
suffix to be the culprit.
E.g. `org.servo.shell` has the same issue, so its not
a length issue.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This is the first step toward removing `WindowMethods`, which will
gradually be integrated into the `WebView` and `WebViewDelegate`. Sizing
of the `WebView` is now handled by the a size associated with a
`RenderingContext`. `WebView`s will eventually just paint the entire
size of their `RenderingContext`. Notes:
- This is transitionary step so now there is a `WebView::resize` and a
`WebView::move_resize`. The first is the future which will resize the
`WebView` and its associated `RenderingContext`. The second is a
function that the virtual `WebView`s that will soon be replaced by a
the one-`WebView` per `WebView` model.
- We do not need to call `WebView::move_resize` at as much any longer
because the default size of the `WebView` is to take up the whole
`RenderingContext`.
- `SurfmanRenderingContext` is no longer exposed in the API, as a
surfman context doesn't naturally have a size unless a surface is
bound to it.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Update to rust 1.85
This is needed for cargo-deny
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Upgrade crown
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Clippy fixes
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Re-upgrade cargo-deny to 0.18
Keeping it locked to 0.18 just in case they
update their required rustc version again
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Instead of telling the Constellation to tell the embedder that new
frames are ready, have the compositor tell the embedder directly. This
should reduce frame latency. Now, after processing compositor
updates, run any pending `WebView::new_frame_ready` delegate methods.
This change also removes the `refresh` call from the Java interface as
that was the only other place that the compositor was rendering the
WebRender scene outside of event looping spinning. This `refresh` call
was completely unused.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* crown: Support Rc<T::Promise> and callback objects parameterized over a trait..
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* crown: Verify that attributes match between trait associated types and impls.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* crown: Check type aliases as part of associated type checks.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* crown: Add periods to all diagnostic messages.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Tidy.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix compile-fail test expectations.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* android: Fix onScroll source
Scrolling should be based on `e2`, the second event, since dX and
dY are relative to e2 and not e1.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* android: Fix flinging down on android.
We need to ensure x and y are inside the window, otherwise servo will
not scroll!
Our fling implementation will set `mCurX` and `mCurY` to a very high
initial value when flinging with a negative velocity, since we don't
know the size of our content page and the android `OverScroller`
needs to know the size of the page.
Setting the page size to a ridiculously high value ensures that flinging
will not be cut of short, even if we fling farther then the edge of the
screen, starting from the touch up point.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This avoids future crashes if new unknown parameters
are passed by the runtime to the app.
It does make it slightly more inconvenient for the user,
since they must use `=` and space at the right place now.
This will also be updated in the book accordingly
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Override the `onBackPress` callback, which by default
brings the application to the background and instead
tell servo to go back one page.
Users can invoke this by swiping from the left edge to the middle.
There is no equivalent callback / gesture to go forward.
In the default browser swiping from the right side to the middle
also invokes the goBack callback.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>