This adds a delay of 2 seconds for loading a valid image. This is added
to potentially overcome the race condition happening while reporting
LCP, to save from false positive result.
Testing: WPT tests is `TIMED OUT` as expected.
Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
Follow the spec and tightenings storage event routing in Constellation
by validating that a BroadcastStorageEvent comes from the same origin as
its source pipeline, while preserving existing localStorage fanout
behavior.
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Notify embedder the coalesced wheel/mousemove event.
We also stop cloning every single entry in `pending_input_event`.
Testing: This should unblock the potential WebDriver thread deadlock
when receiving simultaneous wheel or pointer inputs from multiple
sources.
We added a new test that stably deadlock on
74c16ffd8a.
Firefox/Safari/Chrome all pass the new test.
Fixes:
https://github.com/servo/servo/issues/43136#issuecomment-4031702204
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Some WPT tests [^1] rely on the user agent reflecting that of a real
browser or platform. This change makes it so that the user agent that
Servo uses when running the WPT is the default one, which includes the
platform.
[^1]:
aae5c4cd97/tests/wpt/tests/resources/accesskey.js (L16)
Testing: This causes some access key tests to pass on macOS.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Scroll and PointerMove is quite similar. We did so for `PointeMove` in
https://github.com/servo/servo/pull/42289 +
https://github.com/servo/servo/pull/42946.
Imagine having 3 non-zero duration scroll actions with origin at
different Elements.
Previously we would wait for one to be fully dispatched before moving to
next action,
instead of interspersed.
We also consolidate `PendingPointerMove` and
newly added `PendingScroll` into `enum PendingActions`.
Testing:
[Existing tests behaviour not
changing.](https://github.com/servo/servo/actions/runs/22887005716).
Added a wdspec test.
Previously: `['wheel', 'wheel', 'wheel', 'wheel', 'wheel', 'wheel',
'wheel', 'wheel', 'wheel', 'move']`
Now: `['wheel', 'move', 'wheel', 'move', 'wheel', 'move', 'move',
'wheel', 'wheel', 'move', 'move', 'wheel', 'wheel', 'move', 'move',
'wheel']`
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
In layout calculation within script, Instead of relying on the computed
values for overflow, query the overflow from layout for its used value
to accurately reflect whether an element establish a scroll container.
This query will be used for `IntersectionObserver` as well.
Testing: There are new `IntersectionObserver` WPT failures:
- `intersection-observer/isIntersecting-change-events.html`
- `intersection-observer/containing-block.html`
The failures are more than likely a false positive because intersection
observation steps wasn't supposed to trigger a reflow, but it was
before. It could be caused by the implementation of
`IntersectionObserver` in major UAs being a little bit different from
the spec in the calculation of `threshold` and `isIntersecting` .
---------
Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Ensure that the screenshot rectangle is bounded by the width and height
of the viewport.
Testing: The WPT test `test_clip_huge_element_to_viewport` now passes
instead of crashing. It is also fixed so that the returned screenshot
size is the expected 800x600; it would otherwise be 792x600 due to the
body margin.
Fixes: #42530
---------
Signed-off-by: Loic Denuziere <loic@denuziere.net>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Co-authored-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Instead of unwrapping in `GStreamerMediaStream::encoded`, properly
propagate errors to callers. This prevents panics when we fail to
build GStreamer pipelines in this code path. This is probably the first
of many changes to avoid `unwrap()`ing in this code.
Testing: This change adds a WPT crash test.
Fixes: #36844.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
In order to know whether a block box can collapse its bottom margin with
the bottom margin of its last child, we need to check its tentative
block size. Most usually, this will be the block size of the containing
block that is used when laying out the children.
However, anonymous blocks do not establish a containing block. So using
the containing block for children meant that we were using the tentative
block size of its parent. If that parent had a definite size, this would
prevent the anonymous block from collapsing bottom margins with its
children. This situation could happen when placing a block-level inside
of an inline box.
This patch fixes the problem by using an indefinite tentative block size
for anonymous blocks, instead of the containing block for children.
Testing: Adding new test
Fixes: #42469
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This fixes an oversight from #42783: when detecting that a box can be
reused, we weren't clearing the box damage propagated to ancestors, so
ancestors were still recollecting children.
This exposed some problems in
`rebuild_box_tree_from_independent_formatting_context()`:
1. When reusing a block-level box that established an independent
formatting context, we weren't checking that the new style was still
block-level.
2. When reusing a block-level abspos box, we weren't checking if the new
original display was inline-level, preventing it from being handled as a
block-level because of the static position.
3. When reusing a flex item, we weren't checking if the `order` had
changed.
Testing: we have test coverage for the 3 problems above:
1. Covered by
`/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display.html`,
and also adding a new `/css/css-display/display-flow-root-dynamic.html`.
2. Covered by `/css/CSS2/abspos/hypothetical-box-dynamic.html`
3. Covered by `/css/css-display/order-dynamic.html`.
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Luke Warlow <lwarlow@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
The static position of an abspos is the hypothetical position that it
would have had in the normal flow. If the abspos is inside inline layout
and it had a block-level original display, then the static position is
computed as if the abspos was a block-level that breaks the inline.
Usually this places the static position after the current line. However,
if the abspos is not preceded by any text, padding, border, margin,
preserved newline or atomic inline, then the static position should be
as if the abspos was preceded by a 0px tall phantom line. Previously we
weren't taking that into account.
Note that browsers aren't completely interoperable in corner cases.
Testing: Adding 3 new tests. Blink fails the 2nd one and Gecko fails the
3rd one. WebKit and Servo pass them all.
Fixes: #41990
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
`OutsideMarker` was storing the `BlockFormattingContext` and the
`LayoutBoxBase` in separate fields. Now it will store an entire
`IndependentFormattingContext` in a single field.
In particular, this fixes the issue that `OutsideMarker::repair_style()`
wasn't calling `BlockFormattingContext::repair_style()`. Now we can just
rely on `IndependentFormattingContext::repair_style()`, which correctly
repairs the style of both the `BlockFormattingContext` and the
`LayoutBoxBase`.
Also, the `BlockLevelBox::repair_style()` was repairing the style of the
`LayoutBoxBase` twice, for all kinds of block-level boxes. This removes
the duplication.
Testing: Adding a new test
Fixes: #42779
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Align with the spec and implement part of its lazy loading
steps. Most tests use non-srcdoc lazy loading URLs, so most
tests will not pass until the other parts are implemented
as well.
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
`OutsideMarker::repair_style()` was setting `list_item_style` to the
style of the marker, not the style of the list item.
This patch sets it to `node.parent_style(context)` instead, and it fixes
`ServoThreadSafeLayoutNode::parent_style()` to take the pseudo-element
chain into account. This requires modifying a bunch of logic to pass the
`SharedStyleContext` around.
Testing: Adding a new test
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This should prevent recurring issues with exported WPT changes being
prevented from merging due to failing linting checks upstream.
Testing: Can't test WPT linting integration at this point in time.
Fixes: #40662
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
`TableSlotCell` was storing the `BlockFormattingContext` and the
`LayoutBoxBase` in separate fields. Now it will store an entire
`IndependentFormattingContext` in a single field.
In particular, this fixes the issue that `TableSlotCell::repair_style()`
wasn't calling `BlockFormattingContext::repair_style()`. Now we can just
rely on the correct `IndependentFormattingContext::repair_style()`.
Testing: Adding a new test
Fixes: #42777
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
I like `servo` runner, or better known as its previous name
`servodriver` to some people.
However, it is getting quite often that I use `legacy`, or better known
as its previous name `servo`.
This is because `servo (previously servodriver)` harness shutdown very
slowly due to its shutdown command
https://github.com/servo/servo/pull/40455
- This PR improves the shutdown command in the way as titled.
- Avoids accidental Prockill that may happen after regular shutdown.
This may be related to @jschwe's report that coverage for WPT still
reports empty more often than it should.
Previously, shutdown is like:
```
0:15.06 INFO Trying to shut down gracefully by extension command
0:18.13 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=8378): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=8378): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it"))
0:18.13 DEBUG Stopping WebDriver
0:20.19 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=8378): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=8378): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it"))
0:22.24 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=8378): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=8378): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it"))
0:14.99 DEBUG Hanging up on WebDriver session
```
Now:
```
INFO Trying to shut down gracefully by extension command
0:18.41 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=9098): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=9098): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it"))
0:18.41 DEBUG TestRunnerManager cleanup
0:15.30 DEBUG Hanging up on WebDriver session
```
Testing: Locally, this reduce shutdown time from about 5 sec to 1 sec,
counting from "Trying to shut down gracefully by extension command".
[Try](https://github.com/servo/servo/actions/runs/22295662553/job/64492009162).
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This actually happens at a very early stage:
https://w3c.github.io/webdriver/#dfn-process-a-wheel-action
However, for some reason webdriver crate does not check it for this
particular case.
This PR moves the check to the beginning of dispatch scroll action.
Testing: Added a wdspec test.
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
There is no specification for this, but there are relevant
WPT tests in `selection/contenteditable`. This PR implements
the required changes to make sure that when such an element
is focused (programmatically), it selects the correct node.
The implementation is therefore entirely reverse-engineered
based on existing browser behavior and commented to hopefully
make it make sense.
Part of #7492
Part of #12776
Part of #25005
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
`ImportMap` _integrity_ entry was practically unused, since it is only
needed for [resolving a module integrity
metadata](https://html.spec.whatwg.org/multipage/#resolving-a-module-integrity-metadata).
Now, we correctly initialize `ScriptFetchOptions` when loading a
module's descendants.
I slightly modified `nonimport-integrity.html` test to run
`modulepreload` test cases at the end. Since we haven't an
implementation for it, the test timeout, making the test cases that
comes after them not run.
Testing: More tests start passing
Part of #37553
---------
Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This change fixes an issue where layout damage to a node was not
clearing the inline content size cache of the parent node. In addition
it starts to clean up the damage traversal logic in preparation for
changes to the way that damage is processed and box tree layout is done.
Testing: This change adds a new WPT test.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Luke Warlow <lwarlow@igalia.com>
This logic was (accidentally?) changed in #40761. Revert it back to the
original one, which is simpler, and matches Blink and WebKit.
Testing: Adding new test
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Remaining failures are due to the missing implementation of the pointer
capture and pointer lock APIs, as well as:
Requires User Activation support:
/html/user-activation/activation-trigger-pointerevent.html?mouse
Blocked on https://github.com/servo/servo/issues/41227 :
/pointerevents/compat/pointerevent_mouse-pointer-on-scrollbar.html
Requires persistentDeviceId:
/pointerevents/persistentDeviceId/get-persistendeviceid-from-pointer-event.tentative.html
/pointerevents/persistentDeviceId/get-persistendeviceid-from-pointer-mouse-event.tentative.html
Requires pointerenter, pointerover, pointerout, pointerleave events:
/pointerevents/pointerevent_pointerId_scope.html
Requires pointerrawupdate event:
/pointerevents/pointerevent_pointerrawupdate.html
/pointerevents/pointerevent_pointerrawupdate.https.html
Consider implementing non-standard attributes toElement and fromElement:
See https://w3c.github.io/pointerevents/#attributes-and-default-actions
Fails because the pointerId is always 0 for pointermove, maybe caused by
commit 7b00b54ee8 :
/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html?touch
https://github.com/servo/servo/issues/41250
Testing: Updated wpt expectations
Fixes: https://github.com/servo/servo/issues/38435
Signed-off-by: webbeef <me@webbeef.org>
Most likely a regression introduced in #42208 where the pending loads
counter has been reset. For successful request this wasn't an issue, but
for failed requests it was. Therefore, guard against these generation
request problems by bailing out as soon as we post-process the request
(which we do for all failed requests).
Fixes#42477
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
There has been a weird discrepancy between headed/headless test
automation,
as stated in #42386 and
https://github.com/servo/servo/issues/42320#issuecomment-3846005540.
The problem identified is more general than the intial issue:
we need to use CSS Pixel and Device Pixel consistently in these cases.
- Convert threshold unit to ensure cross-platform consistency.
- Adjust `TOUCH_PAN_MIN_SCREEN_PX`: this is tested on Android/Ohos,
to match the pinch/scrolling threshold of Firefox/Chrome.
This is critical for test automation which always relies on CSS pixel.
Testing: Added which ensures pinch zoom does happen, and there is no
crash for #42320.
Fixes: #42386
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
When an element has an image content value or list-style-image value
they end up duplicating the content of the element inside the generated
'::marker'.
This is caused by code inside IndependentFormattingContext for user
agent widgets (all user agent shadow dom), this code is specifically
aimed at video and audio elements.
This patch adapts that code to be more specific to elements without a
pseudo-element chain (e.g. audio and video)
Testing: newly added test crashes on main servo (slightly flakily), but
passes consistently now.
Fixes: #42329Fixes: #41231
---------
Signed-off-by: Luke Warlow <lwarlow@igalia.com>
The specification says that the rounding of the tile size should only
happen
when the positioning size is not zero. This change makes us follow the
specification in this case.
Testing: This PR adds a new WPT crash test.
Fixes: #42216
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
We weren't removing stylesheets when we should be doing so. This most
notably happens when the stylesheet no longer has a href or its "rel"
changes.
The crash is also fixed, since the issue was that we were passing the
value of the attribute that was changed as if it were an href. However,
if we set the type attribute, then that's not the href.
To fix that, we now retrieve the href inside the method so we always
have the correct value.
Fixes#42259
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
A template element should set the host of a DocumentFragment. However,
it didn't have a host yet. That's because ShadowRoot declares a host
attribute which returns Element, but its property is declared on
DocumentFragment.
Therefore, define the host on DocumentFragment instead and use it in all
relevant points for shadow roots. Then, update the pre-insert validity
check to use the correct host-including variant of inclusive ancestors.
Lastly, set the host of the template to wire it all up.
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>