This allows us to use `uv` for:
1. Installing a pinned Python version
2. Installing the dependency packages using `uv`'s pip compatible interface.
4. Bootstrapping `mach` without a Python installion on the host, using `uv
run`
This change also introduces a new 'composite' GitHub action to setup
python in the different CI workflows. There is no support for externally
managed python installations and virtual environments. These could be
added in the future.
Fixes#34095, #34547
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Bump bindgen to 0.71.1
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Set SCCACHE_GHA_VERSION to allow purging cache
changing the version allows us to purge the cache.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* android CI: Enable sccache again
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This change uses Gradle's official `setup-gradle` action to allow the
caching of the downloaded gradle distribution and java dependencies in
the GitHub Actions cache. However, since the initial download of gradle
distribution is still handled by the `gradlew` wrapper script which
doesn't retry on network failures, this change also adds a simple retry
mechanism using shell scripting.
Fixes#34600
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This eliminates the way that crossbeam channels are used to send layout
results back to script, which should increase the efficiency of layout.
If asynchronous layout is re-established it can be written as a layer on
top of the layout interface, that way layout doesn't have to know so
many details of how the asynchronocity works.
Renames:
- `ScriptReflow` to `ReflowRequest`: Script is the only thing that
requests reflow.
- `ReflowComplete` to `ReflowResult`
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
It was a bit confusing that e.g. a float with `FloatSide::InlineStart`
would set `FloatBand::left`, or that `PlacementAmongFloats` would
compute `max_inline_start` from the various `FloatBand::left`.
So now all the float logic will consistently use logical terminoligy.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
These all happen now in *update the rendering*, typically after the
message that triggered this code is processed, though in two cases
reflow needs to be triggered explicitly. This makes `ReflowReason`
redundant though perhaps `ReflowCondition` can be expanded later to give
more insight into why the page is dirty.
- Handling of the "reflow timer" concept has been explained a bit more via
data structures and rustdoc comments.
- Theme changes are cleaned up a little to simplify what happens during
reflow and to avoid unecessary reflows when the theme doesn't change.
Notably, layout queries and scrolling still trigger normal reflows and
don't update the rendering. This needs more investigation as it's
unclear to me currently whether or not they should update the rendering
and simply delay event dispatch or only reflow.
In general, this is a simplfication of the code.
Fixes#31871.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Instead of parsing the `Cargo.lock` file directly in `tidy.py`. Use
`cargo-deny`, which we already use to detect unapproved licenses in the
dependency chain to detect duplicate and banned crates. In addition,
enable all other `cargo-deny` checks and add exceptions where necessary
for them. This depends on the latest release of `cargo-deny` which
depends on a recent verison of `rust`.
Fixes#34393.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Several structs and enums had a `inline_content_sizes()` method, but it
wasn't clear which ones would try to cache the result, and which ones
would always compute it.
Therefore, this performs some clarifying renaming:
- Cached ones stay as `inline_content_sizes()`
- Uncached ones become `compute_inline_content_sizes()`
Also, to simplify calls to `LayoutBoxBase::inline_content_sizes()`,
`compute_inline_content_sizes()` is moved into a new trait.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Due to a typo, the containing block established by a table row for the
table cells had its block size set to the its inline size. However,
this block size is currently unused, so no change in behavior.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Block-level elements that establish an independent formatting context
(or are replaced) need to avoid overlapping floats.
In the non-replaced case, we have two different subcases, depending on
whether the inline size of the element is known. This patch makes them
share more logic.
Then `solve_clearance_and_inline_margins_avoiding_floats()` would only
be used in the replaced case, so it's removed, inlining its logic.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Fix deprecated PanicInfo alias
Fixes:
```rust
use of deprecated type alias `std::panic::PanicInfo`: use `PanicHookInfo` instead
```
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* build: upgrade rustc to 1.82.0
Tracking issue for the silenced lints:
https://github.com/servo/servo/issues/34591
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
A rendering opportunity is now unconditionally triggered by handling IPC
messages in the `ScriptThread`, unless animations are running in which
case it's driven by the compositor. We can now remove calls to
`note_rendering_opportunity` and `rendering_opportunity`.
There is one tricky case, which is when a promise completion during a
microtask checkpoint dirties the page again. In this case we need to
trigger a new rendering opportunity, unless animations are running. In
a followup change, when not driven by the compositor, rendering
opportunities will be driven by a timed task, meaning we can remove this
workaround.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* respond to winit platform theme changed event and send it to the layout thread
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* refactoring viewport and theme change handling functions based on feedback
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* fixing issues reported by test-tidy
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* update stylo in order to use color_scheme function on Device
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
---------
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
* 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>
The refactoring in 264c0f972f stopped
caching the `inline_content_sizes()` calls from:
- `FlexItemBox::layout_for_block_content_size()`
- `IndependentFormattingContext::layout_float_or_atomic_inline()`
- `TaffyContainerContext::compute_child_layout()`
Also, the call from `OutsideMarker::layout()` was never cached.
This patch caches all of them.
It's not clear at all which `inline_content_sizes()` are cached and
which aren't, so I plan to improve the situation in a follow-up.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Make servodriver a thin wrapper over the base webdriver browser/executor classes.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Make ServoWebDriverRefTestExecutor a thin shell over the webdriver reftest executor.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Wait for the initial load to complete when opening a new tab via webdriver.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Remove assumption of a single tab from the webdriver server.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Serialize all keys of JS objects when converting to webdriver values.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Cleanup, docs, etc.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Use webview terminology more consistently.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix flake8 errors.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This removes two explicit calls to reflow to detect rAFs that do not
modify the DOM and to trigger reflows when the page isn't dirty. This
can cause extra reflows, especially when animations are running. This
change removes them, relying on *update the rendering* to properly
trigger reflows, shortly after running rAF callbacks and after
animations are updated.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
- Remove the `LayoutBox::InlineBox` variant that was only used for
inline level boxes. Now they are stored in `LayoutBox::InlineLevel`
along with other kinds of out-of-flow and atomic inline items.
- Reduce the size of `InlineItem` by 260 bytes per item by using atomic
indirection / pointers. This adds a bit of overhead to access items in
exchange for a lot of memory saved.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This might make caching these values a bit easier in the future.
Correcting the visibility of `ContainingBlock` also exposed some new
rustc and clippy warnings that are fixed here.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
The `pending reflow` concept isn't necessary now that *update the
rendering* is taking care of triggering reflows at the correct time.
`Window::reflow` already avoids reflows if the page is not dirty, so
pending reflows is now just an extraneous check as long as *update the
rendering* runs properly.
This change also removes some explicit reflows, which now wait until the
appropriate moment during *update the rendering*. This should remove
some extra reflows that are not necessary.
Servo needs some way to track that resizing the web view needs to
re-layout due to the initial containing block changing. Move handling
of `Document::needs_paint` to the script thread and use this, expanding
the rustdoc to explain what it is for a bit more clearly.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This is to see if #34571 is related to caching in anyway. There is no
easy way to delete all Github Action caches using Github UI or cli.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* script: Add traits to allow converting between types that are not defined in the script crate.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Rewrite all From/TryFrom implementations on generated WebIDL types to use new Convert/TryConvert traits.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Consider this testcase:
```html
<canvas style="aspect-ratio: 1; height: stretch; background: cyan"
width="200" height="100"></canvas>
```
To compute the intrinsic inline sizes we were treating `height: stretch`
as the natural height (100px) and then transferring that to the inline
axis through the preferred aspect ratio. So the element was 100px wide.
However, an indefinite `stretch` should be treated as an automatic size,
which wouldn't be transferred to the inline axis.
The fix actually makes the code slightly simpler.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Instead run *update the rendering* at the end of every process of
gathering messages sent to the `ScriptThread`. This ensures that the
thread is in a consistent state when the update is finally run and
prevents running more than one instance of *update the rendering* per
spin of the message loop.
In addition:
- Move the *run the resize steps* implementation to `Window` and ensure
that the realm is active when it is run.
- Profile the queueing of the resize message instead of handling it. I
think this makes more sense as the profiling seems to be targeting
message handling and not *update the rendering*. Additionally, it's
difficult to profile from the context of `Window`.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>