* change http-network-or-cache-fetch to take FetchParams argument instead of request
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* change http-network-fetch to take fetchParams as an argument
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* run formatter
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* renaming variable to be similar to step in spec
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* refixing usage of http_request after rebasing
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
---------
Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
These will be a single method in the upcoming `WebView` delegate, so it
makes sense to also combine the internal message to match this. In
addition, since `LoadStatus` is now exposed to the API if there is ever
the need to add more statuses or to move to an event-based version, the
API is already set up for this.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The outer display type of a table element applies to the table wrapper
box. The table grid box needs to be block-level as defined in
https://drafts.csswg.org/css-tables/#table-grid-box
Therefore this sets `display: table` on table grid boxes, and then when
painting collapsed table borders we can use the usual logic to compute
the StackingContextSection.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
In #35075 I painted them in front of the decorations (backgrounds and
borders) of any block-level box in the same stacking context. I did that
because other browsers paint them in front of the decorations of the
descendants of the table, but my approach also painted them in front of
decorations of following siblings of the table, which was wrong.
This patch makes it so that collapsed table orders are painted in the
same step as decorations. However, tables defer painting their collapsed
borders after the decorations of their descendants.
This matches Blink and WebKit, and brings us closer to Gecko (which is
slightly different in some corner cases).
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Make Slottable match layout/alignment of NonNull<Node>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Implement ServoLayoutElement::slotted_nodes
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Bump mozjs
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Layout the contents of slot elements
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Implement ServoLayoutElement::assigned_slot
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* implement ServoLayoutElement::traversal_parent
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Simplify slottable name update
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Don't iterate over children of shadow hosts
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Recompute slot style when contents change
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Change match_slottable to a function instead of a macro
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fix crown errors
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update WPT expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Reset a slottable's assigned slot when it's removed from the slot
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Removes the `Arc<Mutex<T>>` usage in `winit_minimal` given that `EventLoopProxy` has `Send` and `Sync` traits.
re #35252
Signed-off-by: Roberto Huertas <roberto.huertas@outlook.com>
Bumps Stylo to https://github.com/servo/stylo/pull/116
This way the callers don't have to clone it if they don't have ownership
or want to use the value later.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
- Run `cargo fmt` on `webxr` and `webxr-api`
- Fix clippy warnings in the existing `webxr` code
- Integrate the new crates into the workspace
- Expose `webxr` via the libservo API rather than requiring embedders to
depend on it explicitly.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Instead of casting the window client rect to `u32`, keep it as `i32` and just cast the size dimensions to `u32`.
Signed-off-by: webbeef <me@webbeef.org>
At some point in the past this message was only sent from the
`Constellation` to `script`, but nowadays this is sent from various
parts of servo to the `ScriptThread`, so this is a better name. In
particular, the current name makes it seeem like this message controls
the `Constellation`, which it does not.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The conversion of an integer into a `MediaSessionAction` is
Android-specific and thus shouldn't be used throughout the source code.
This change moves the conversion to the Android port of servoshell.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Don't fire slotchange events if there is already a pending event for the same slot
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update WPT expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
`EmbedderMsg` was previously paired with an implicit
`Option<WebViewId>`, even though almost all variants were either always
`Some` or always `None`, depending on whether there was a `WebView
involved.
This patch adds the `WebViewId` to as many `EmbedderMsg` variants as
possible, so we can call their associated `WebView` delegate methods
without needing to check and unwrap the `Option`. In many cases, this
required more changes to plumb through the `WebViewId`.
Notably, all `Request`s now explicitly need a `WebView` or not, in order
to ensure that it is passed when appropriate.
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Potentially signal a slot change in Node::insert
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update WPT expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
When we try to place a table next to some floats, and it doesn't fit
vertically, then we try again considering more floats. And as an
optimization we were using the previous width of the table as a minimum.
However, this was wrong, because the table might accept a smaller width
when the available space is smaller than beforehand.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
A window resize requires to also resize the webview,
otherwise it will stay at the original size.
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
There is some interesting history to this change:
* https://github.com/servo/servo/issues/33495: Servo crashes on
Cloudflare's turnstile, because we didn't compute style for
elements inside shadow trees
* https://github.com/servo/servo/pull/34298: Resolves the issue
by computing style for children of a potential shadow root,
in addition to the children of an element
* https://github.com/servo/servo/pull/34701: Changes layout
of elements with shadow roots such that only the contents
of the shadow root are laid out
Now, we compute style for both the children of the element
and a potential shadow root, but only lay out the contents
of the shadow tree (if there is one).
This behaviour is not technically incorrect,
since regular children are not included in layout
their style doesn't matter. However, it is
inefficient: the only case where we need to compute
style for a child of a shadow host is when
that child is an assigned slottable in a slot
somewhere else.
This part 1/n of upstreaming the changes necessary
to lay out `<slot>` contents. Note that trying to compute
style for `<slot>` contents *and* children of shadow hosts
will crash in stylo, since it expects to see each
element only once.
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This removes all uses of `EmbedderEvent` in the desktop servoshell to
use the new `WebView` API -- filling it out when necessary.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
Many types used directly in the `libservo` API are in the
`script_traits` crate, which was created to break circular dependencies.
Move all API exposed types to `embedder_traits` which now contains types
exposed via the `libservo` embedding API. Also expose these at the root
of the `libservo` `servo` crate so that the API won't break when they
move around in the future.
The idea with `embedder_traits` in the future is that it contains types
that are available throughout servo because they are used in the
embedding API and thus should have minimal dependencies on other Servo
crates (a bit like `base`).
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
We were painting collapsed borders without taking into account that some
tracks might have been "removed" by `visibility: collapse`.
This just sets the sizes of these tracks to zero. Note this implies that
collapsed borders may overlap each other, or overlap cell contents, but
this seems to match Blink.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
If a collapsed border has the `currentcolor` color, we were resolving it
using the color of the table. Now we resolve it using the color of the
box which owns the border that wins and becomes the collapsed border.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Propagate events from slottables to their assigned slot instead of their parent
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update WPT expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
The specification doesn't say how to deal with percentages when
determining the minimum and maximum size of a table grid, so follow the
approach that Chromium uses.
Essentially, figure out the "missing" percentage from the non-percentage
columns and then use that to work backwards to fine the size of the
percentage ones.
This change is larger than one might expect, because this percentage
approach shouldn't happen for tables that are descendants of a flex,
grid or table container (except when there is an interceding absolute).
We have to pass this information down when building the box tree. This
will also make it easier to improve propagated text decorations in the
future.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
If `width` is indefinite, treat the outer size as zero, instead of
treating the content size as zero and then adding padding and borders.
Also, we don't want a default minimum of zero to get added padding and
borders, and then defeat the point baove. So just ignore minimums and
maximums.
That seems to roughly match what other browsers do, but as usual, the
details are not interoperable, e.g. some browsers may obey min or max
sizing properties in some cases.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Add the onslotchange attribute to ShadowRoot
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add spec comments to MutationObserver::queue_mutation_observer_microtask
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add DomRefCell::take
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add spec comments to notify_mutation_observers
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fire slotchange events when a slot changes
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* ./mach fmt
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fix check for when to dispatch slot events
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Potentially fire slot change events in Node::remove
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update WPT expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* ./mach fmt
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Bump stylo
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Move "signal a slot change" into ScriptThread impl
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Instead of setting up a route for every image load in the DOM / Layout,
route all incoming image cache responses through the `ScriptThread`.
This avoids creating a set of file descriptor for every image that is
loaded.
This change requires having the `ImageCache` track the `PipelineId` of
the original the listener so that the `ScriptThread` can route it
properly to the correct `Window`.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This patch introduces a new handle-based webview API to libservo, with
two main design goals:
1. The lifetime of the handles controls the lifetime of the webview,
giving the embedder full control over exactly when webviews are
created and destroyed. This is consistent with how WebKitGTK’s
WebView works; the engine can only create webviews via a create
request, and can only destroy them via a close request.
2. All methods are infallible; if the constellation dies, the embedder
finds out when calling Servo::handle_events.
For the moment, the embedder is only responsible for creating the
WebView id, and not the internal TopLevelBrowsingContext data
structures. This is so that the ScriptThread is able to get a handle on
the new WebView's WindowProxy in the case that it's an auxiliary
browsing context. In the future, the embedder should also be responsible
for creating the TopLevelBrowsingContext and the ScriptThread should
have mechanism to associate the two views so that WebView creation is
always executed through the same code path in the embedding layer. For
now, it's enough that the embedder can get a handle to the new WebView
when it's creation is requested.
Once we replace EmbedderMsg with a webview delegate trait, we will pass
WebView handles to the embedder, rather than webview ids. We’ll also add
detailed docs, once the design settles.
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* bindings: Start making generated bindings methods generic over DOM trait.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* bindings: Make binding initialization generic over the DOM types trait.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* bindings: Start making proxyhandler code generic over DOM types.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Thanks to #34946 we don't have to recompute the min and max sizes, we
can get them from the `ContainingBlock`.
And then in `FlexContext` there is no need to store both the definite
and the min & max sizes of the container`, we can instead make do with
a single `FlexRelativeVec2<SizeConstraint>`.
This removes 1 of the 3 usages of `ContentBoxSizesAndPBMDeprecated`,
which is also good.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>