Commit graph

9943 commits

Author SHA1 Message Date
Martin Robinson
ef229b9386
layout: Ensure that <caption>'s support position: relative (#33426)
This change adds support for `position: relative` to table `<caption>`.
In addition to adjusting their position according to inset values, table
captions must also establish containing blocks for descendants that are
absolutely positioned.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-19 12:43:29 +00:00
shanehandley
06f0893b94
fetch: add an accept encoding header when the range header exists (#33496)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-09-19 11:35:52 +00:00
Josh Matthews
aa5bf94b35
dom: Append stream chunks in the correct order. (#33487)
* Append stream chunks in the correct order.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Run mimesniff tests in CI.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Delete tests/wpt/meta/mimesniff/media/media-sniff.window.js.ini

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-09-18 10:09:15 +00:00
Martin Robinson
bd632fc814
layout: Add support for object-fit and object-position (#33479)
This also makes a couple small improvements:
 - Rename `IntrinsicSizes` to `NaturalSizes` which reflects more
   modern spec language.
 - Move the conversion of Stylo's `ImageRendering` to WebRender's
   version to a `ToWebRender` trait implementation.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-18 06:20:28 +00:00
Daniel Adams
632d832704
Add checks for BigInt/BigUint in getRandomValues (#33485)
Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-18 04:07:05 +00:00
Martin Robinson
aa0029c11c
Add rust-version to all Cargo.toml files (#33483)
This is another step preparing for building Servo without `mach`.

Fixes #33430.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-17 16:39:07 +00:00
Simon Wülker
7cbc5f6ee6
Update CustomEvent webidl interface (#33481)
The [idl interface](https://dom.spec.whatwg.org/#interface-customevent) and servo's implementation had diverged.

* Extra arguments to initCustomEvent are optional (fixes `dom/events/CustomEvent.html`)
* The CustomEvent constructor is infallible
* "[Exposed=*]" (and the same for the "Event" interface since it's
  CustomEvent's parent.)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-17 12:02:42 +00:00
Daniel Adams
4c3b3529a8
servoshell: Update gilrs version, enable gamepad pref by default (#33466)
* Update gilrs version, enable pref by default

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Add core-foundation to servo-tidy ignore

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update manifest

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-17 05:52:19 +00:00
Daniel Adams
f8e0fde044
webxr: Implement reference space reset events (#33460)
* Initial interface implementation

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Add event handler

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update FakeXRDevice interface

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Implement reset event

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Downcast bounded spaces

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update expectations

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update webxr commit

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* fmt

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Adjust DomRoot usage

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* fmt

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update manifest

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-17 02:22:15 +00:00
Oriol Brufau
5b6a9110c7
Clear self.pending_whitespace.max_content in forced_line_break() (#33469)
If we encountered a preserved line break after some whitespace, we were
including the space in the max-content size of the following line.

So just like `line_break_opportunity()` was already clearing
`self.pending_whitespace.min_content`, `forced_line_break()` needs to
clear `self.pending_whitespace.max_content` too.

Also some cosmetic refactoring.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-16 10:57:56 +00:00
Oriol Brufau
b12cebd1ac
Small improvements for table border collapse (#33452)
We were only collapsing the borders from adjacent cells. This patch also
handles the borders from rows, row groups, columns, and column groups.
Additionally, it takes the border style into account in order to decide
which border wins.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-16 08:20:22 +00:00
Oriol Brufau
679afe5195
Do not remove extra columns at the end of the table (#33451)
<col> and <colgroup> elements can be used to create extra columns that
have no cell. We were removing these columns and column groups, but in
general we shouldn't do that.

Now we will only remove them if the table has no row nor row group.
matching WebKit and the expectations of some tests. But note that Gecko
and Blink never remove them.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-16 08:11:36 +00:00
Servo WPT Sync
9f2306f760
Update web-platform-tests to revision b'4c3d068f942231dc905ea283e4f82bd70801c37c' (#33461)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-09-15 01:26:41 +00:00
shanehandley
6a3cdc47ec
Improve spec conformance around request header validation (#33418)
* fix: improve spec conformance around request header validation

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* account for additional test passes

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* fix: remove redundant .to_vec call

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-09-14 03:01:22 +00:00
Oriol Brufau
a2b8bdb903
Allow table-layout:fixed to shrink cells to less than the border+padding (#33442)
A table cell with `width: auto` in fixed layout will now have an outer
min-content width of zero, even if it has borders or padding. In a way,
this is like allowing the content-box width to become negative.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-13 17:57:54 +00:00
Oriol Brufau
fa8752df6a
Fix precision issue with line heights (#33438)
When computing the ascent and descent in an inline formatting context,
we weren't taking into account that app units have precision limitations.
Therefore, in some cases we were getting a line height that was slightly
taller than the value specified in `line-height`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-13 16:56:14 +00:00
Oriol Brufau
a76daaf04c
Upgrade stylo to 2024-09-02 (#33370)
* Upgrade stylo to 2024-09-02

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Fixup for https://phabricator.services.mozilla.com/D217308

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Fixup for https://phabricator.services.mozilla.com/D217626

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Fixup for https://phabricator.services.mozilla.com/D218488

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Fixup for https://phabricator.services.mozilla.com/D219537

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Update test expectations

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

---------

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-13 15:59:57 +00:00
atbrakhi
f76692035b
uses app units in display_list (#33420)
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-13 10:49:59 +00:00
Oriol Brufau
52f89c95b9
Fix inset box-shadow to use the padding box (#33433)
As specified in https://drafts.csswg.org/css-backgrounds-3/#shadow-shape

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-13 10:47:50 +00:00
Martin Robinson
03abf7751a
compositor: Do not allow script to scroll past maximum scroll node offsets (#33428)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-13 03:52:17 +00:00
Martin Robinson
db0aee6b58
layout: <th> should have text-align: center when the child of an element with text-align: initial (#33427)
This behavir is enabled via a special CSS value that we can share with
Gecko.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-12 19:28:31 +00:00
Oriol Brufau
219a2f2038
Cleanup after #33396 (#33429)
Mostly formatting improvements, but also recovering a pair of parenthesis
that was accidentally removed, changing the logic.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-12 19:23:17 +00:00
Oriol Brufau
dc018b5f9f
Add support for table-layout: fixed (#33384)
More details might be needed to fully support the feature, but this
covers the basic functionality.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-12 16:33:13 +00:00
Oriol Brufau
52e495c1a6
Avoid crash with large table column widths (#33424)
Fixes #33423

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-12 15:11:22 +00:00
Oriol Brufau
b048bf80a4
Accept zero values on some width/height attributes on table elements (#33425)
We were incorrectly using `AttrValue::from_nonzero_dimension` to parse
some attributes, instead of `AttrValue::from_dimension`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-12 15:10:11 +00:00
Oriol Brufau
4839cdf176
Add width and height presentational hints for table-related elements (#33405)
We were only parsing the `width` attribute as a presentation hint for
`<table>`, `<td>` and `<th>`. This patch also handles `<colgroup>` and
`<col>`.

Also, we weren't parsing `height` at all, now we do it for `<table>`,
`<td>`, `<th>`, `<tr>`, `<tbody>`, `<thead>` and `<tfoot>`.

One test is now crashing, but this was an existing issue: #33423

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-12 13:34:20 +00:00
Daniel Adams
08a4d751d7
webxr: Update XRInputSource Gamepad handling, FakeXRInputController (#33403)
* Disconnect XRInputSource gamepads on removal

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update Cargo.lock

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Comments, adjustments

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update expectations

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-12 01:52:16 +00:00
Oriol Brufau
d9be9d6bd4
Handle all white-space values when intrinsically sizing an IFC (#33343)
There were various cases like `text-wrap-mode: nowrap` and
`white-space-collapse: break-spaces` that weren't handled well.

Fixes #33335

flexbox_flex-formatting-interop.html fails now because we don't support
`table-layout: fixed`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-11 23:50:45 +00:00
Martin Robinson
ed5dc43f16
layout: Reverse space-between alignment properly for absolute children of flex containers (#33406)
When aligning with `space-between` the space should be allocated on the
`flex-end` side of the container ie it should be mapped to `flex-start`
(`start` and reversing if necssary).

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-11 17:51:56 +00:00
Gregory Terzian
23b0dc603c
Raf delivery: run rafs for all pipeline if tick received for any. (#33395)
* update the rendering: run rafs for all pipeline, if tick received for any

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* prioritize only one updating of the rendering per event-loop wake-up

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2024-09-11 16:23:20 +00:00
Oriol Brufau
9175e598ad
Let table-related boxes adjust their overflow values (#33400)
The `overflow` property doesn't apply to table track and track groups,
and table elements only accept a few `overflow` values.

Therefore, this patch adds an `effective_overflow()` method to get the
actual value that needs to be used.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-11 15:30:17 +00:00
Martin Robinson
027fc53e2f
layout: Right-to-left support for other layout modes (#33375)
This change removes the `effective_writing_mode` concept and tries to
properly implement right-to-left layout support for all non-inline
writing modes. In general, what needs to happen is that rectangles
need to be converted to physical rectangles using the containing block.
A right-to-left rectangle's inline start is on the right physical side
of the containing block. Likewise a positive inline offset in
right-to-left text is a negative physical one.

The implementation here is pretty good for most layout modes, but floats
are still a bit in process. Currently, floats are processed in the
logical layout of the block container, but there still might be issues
with float interaction with mixed RTL and LTR.

While this does move us closer to supporting vertical writing modes,
this is still unsupported.

New failures:
 - Vertical writing mode not supported:
   - `/css/CSS2/floats/floats-placement-vertical-001b.xht`
   - `/css/CSS2/floats/floats-placement-vertical-001c.xht`
 - Absolutes inlines should avoid floats (#33323)
   - `/css/css-position/position-absolute-dynamic-static-position-floats-004.html`
 - No support for grid
   - `/css/css-align/self-alignment/self-align-safe-unsafe-grid-003.html`
   - `/css/css-position/static-position/inline-level-absolute-in-block-level-context-009.html`
   - `/css/css-position/static-position/inline-level-absolute-in-block-level-context-010.html`
 - Cannot reproduce these locally on any platform. Very mysterious:
   - `/css/css-tables/row-group-margin-border-padding.html`
   - `/css/css-tables/row-margin-border-padding.html`
 - Exposes bugs we have related to hanging whitespace in preserved
   whitespace inlines:
   - `/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html`
   - `/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-023.html`

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-09-11 13:40:11 +00:00
Martin Robinson
bc8d8b62c3
Stop using time@0.1 in Servo (#33394)
This removes the last few uses of `time@0.1` in Servo. There are still
dependencies from `style` and `webrender`, but they will be removed soon
as well. The uses of this version of `time` are replaced with
`std::time` types and `time@0.3` when negative `Duration` is necessary.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-11 07:09:56 +00:00
Taym Haddadi
1b27a911af
Make Crashtests with test-wait wait (#33344)
* Make Crashtests with test-wait wait

Signed-off-by: Taym <haddadi.taym@gmail.com>

* use Atom::from instead of the atom macro

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Update test result expectations

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-10 15:19:18 +00:00
Oriol Brufau
9d3d009895
Allow breaking line after space with white-space: break-spaces (#33376)
`white-space: break-spaces` should allow a soft wrap opportunity *after*
every preserved white space. Then, to avoid breaking before the first
white space, `TextRunSegment::shape_text()` has some logic to separate
it from the following spaces and put it with the preceding text instead.

The problem was that, when combined with `word-break: keep-all`, we were
then only checking whether there were more white spaces afterwards,
ignoring the soft wrap opportunity after the first one.

Also removing a duplicated `can_break_anywhere` variable.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-10 11:06:40 +00:00
Oriol Brufau
f1ad364ec2
Fix reordering of table-header-group and table-footer-group (#33383)
We weren't moving a table-header-group to the front if it was the first
row group. However, there might still be preceding rows that don't
belong to any row group.

And similarly, we weren't moving a table-footer-group to the end if it
was the last row group. However, there might still be following rows
that don't belong to any row group.

This patch fixes the logic, and enables existing tests from Microsoft
that were missing a reference.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 23:20:48 +00:00
Simon Wülker
10e5bb72d9
Initial support for <link rel="prefetch"> (#33345)
* Properly store link relations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Send fetch request for prefetch links

We don't actually *do* anything with the response yet
(handle errors etc) but its a first step.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fire load/error events for prefetch loads

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Set prefetch destination/cors setting correctly

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fix ./mach test-tidy errors

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Set correct "Accept" value for prefetch requests

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add spec text to individual steps

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-09 18:52:56 +00:00
Cristian Brinza
2993577ac0
script: Added missing spec step in Location::SetHash (#33380)
* Implement missing spec step in Location::SetHash

Signed-off-by: crbrz <cristianb@gmail.com>

* Fixed wrong URL fragment when hash set to empty string

Signed-off-by: crbrz <cristianb@gmail.com>

* Add WPT tests

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-09-09 16:58:26 +00:00
Simon Wülker
cc3c69b953
implement console.timeLog (#33377)
* Implement console.timeLog

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Adjust WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-09 16:48:49 +00:00
Martin Robinson
d169a82d2e
layout: Implement proper absolute child position for flexbox (#33346)
This implements the requirements outlined in the [flexbox specification]
about how to position absolute children of flex containers. We must
establish a static position rectangle (to use if all insets are auto)
and also align the child into that rectangle.

[flebox specification]: https://drafts.csswg.org/css-flexbox/#abspos-items

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-09 14:44:16 +00:00
webbeef
a3a86d5913
script: Implement TextEncoder::encodeInto() (#33360)
* Implement TextEncoder::encodeInto()

Signed-off-by: webbeef <me@webbeef.org>

* Update components/script/dom/textencoder.rs

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

* Update components/script/dom/textencoder.rs

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: webbeef <me@webbeef.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 14:40:12 +00:00
Martin Robinson
8842fe9df5
script: Use time@0.3 for input elements and do conversion in a &str trait (#33355)
This changes converts all input element parsing and normalization to use
`time` instead of `chrono`. `time` is used by our dependencies, so it
makes sense to work toward removing the Servo dependency on chrono.

In addition, parsing and normalization also moves to a trait on &str to
prepare for the possibility of all script parsers moving to a separate
crate that can have unit tests written against it.

Code duplication is eliminated when possible and more conversion is done
using integer types. These two things together mean we pass more tests
now.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 14:33:16 +00:00
Daniel Adams
938fd8c12f
webxr: Update XRInputSource gamepad index to be -1 (#33369)
* Update XRInputSource gamepad index to be -1

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update test expectations

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-09 11:07:56 +00:00
webbeef
f6ae050077
net: use saturating_sub when substracting durations to prevent underflows (#33341)
* net: use saturating_sub when substracting durations to prevent underflows

Signed-off-by: webbeef <me@webbeef.org>

* Add regression test. (#1)

* Add regression test.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: webbeef <me@webbeef.org>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-09-08 07:36:27 +00:00
Servo WPT Sync
85823edd01
Update web-platform-tests to revision b'ec9b870fec350e59e9db48ae2858e914a07f38d6' (#33359)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-09-08 01:41:09 +00:00
Simon Wülker
1c6fb1a7ba
Set empty object as console prototype (#33358)
* Remove console prototype hack

The console object has an empty object as its prototype,
not the realm object prototype.

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>
2024-09-07 23:10:47 +00:00
Martin Robinson
f3f96c3393
layout: Do not use orthogonal baselines in flex layout (#33347)
When a baseline is orthogonal to the main flexbox axis, it should not
take part in baseline alignment. This change does that for column flex.
While there is no support for vertical writing modes, this change is
made to be as writing mode-agnostic as possible.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-07 22:08:48 +00:00
Samson
567c3185f8
chore: Update wgpu (#33357)
* Update wgpu

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-07 20:28:36 +00:00
Martin Robinson
c24c7d8e4d
layout: Lay out absolutes in atomic containing blocks (#33336)
When inline atomics establish containing blocks for absolute
descendants, layout should happen with those atomics as the containing
block. This ensures that the absolute descendents have the correct
containing block and Fragment parent. This wasn't happening before and
this change fixes that.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-06 13:42:45 +00:00
Martin Robinson
312cf0df08
script: Create a CrossProcessInstant to enable serializable monotonic time (#33282)
Up until now, Servo was using a very old version of time to get a
cross-process monotonic timestamp (using `time::precise_time_ns()`).
This change replaces the usage of old time with a new serializable
monotonic time called `CrossProcessInstant` and uses it where `u64`
timestamps were stored before. The standard library doesn't provide this
functionality because it isn't something you can do reliably on all
platforms. The idea is that we do our best and then fall back
gracefully.

This is a big change, because Servo was using `u64` timestamps all over
the place some as raw values taken from `time::precise_time_ns()` and
some as relative offsets from the "navigation start," which is a concept
similar to DOM's `timeOrigin` (but not exactly the same). It's very
difficult to fix this situation without fixing it everywhere as the
`Instant` concept is supposed to be opaque. The good thing is that this
change clears up all ambiguity when passing times as a `time::Duration`
is unit agnostic and a `CrossProcessInstant` represents an absolute
moment in time.

The `time` version of `Duration` is used because it can both be negative
and is also serializable.

Good things:
 - No need too pass around `time` and `time_precise` any longer.
   `CrossProcessInstant` is also precise and monotonic.
 - The distinction between a time that is unset or at `0` (at some kind
   of timer epoch) is now gone.

There still a lot of work to do to clean up timing, but this is the
first step. In general, I've tried to preserve existing behavior, even
when not spec compliant, as much as possible. I plan to submit followup
PRs fixing some of the issues I've noticed.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-05 18:50:09 +00:00