Commit graph

26550 commits

Author SHA1 Message Date
Martin Robinson
7e82c5c957
Compile Servo with the latest version of rust stable (#30831)
This completes the transition to compiling Servo with rust stable. Some
nightly-only features are still used when compiling the `script` and
`crown` crates, as well as for some style unit tests. These will likely
break with newer compiler versions, but `crown` can be disabled for them
conditionally. This is just the first step.

This has some caveats:

1. We need to disable setting up the special linker on Linux. The -Z
   option isn't supported with stable rust so using this is out --
   meanwhile we can't be sure that lld is installed on most systems.
2. `cargo fmt` still uses some unstable options, so we need to rely on
   the unstable toolchain just for running `fmt`. The idea is to fix this
   gradually.
2023-12-06 17:36:07 +00:00
atbrakhi
9028c90332
Generalize LengthPercentageOrAuto impl to Generic Type (#30824)
* Generalize LengthPercentageOrAuto impl to Generic Type

* review fix
2023-12-06 10:20:43 +00:00
Martin Robinson
8ded1072ce
Re-use the TextMetrics data structure in the Layout 2020 fragment tree (#30823)
This data structure has all of the metrics needed to render a font and
is in `Au`. We'll need more of these metrics for implementing
`vertical-align` and its use doesn't increase the size of the Fragment
tree (as the BoxFragment is still larger). In addition, this will be
helpful when switching layout to `Au`.
2023-12-06 09:52:23 +00:00
Martin Robinson
f0b4162328
Add initial support for table box tree construction (#30799)
This is the first part of constructing the box tree for table layout. No
layout is actually done and the construction of tables is now hidden
behind a flag (in order to not regress WPT).  Notably, this does not
handle anonymous table part construction, when the DOM does not reflect
a fully-formed table. That's part two.

Progress toward #27459.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Manish Goregaokar <manishsmail@gmail.com>
2023-12-05 11:10:45 +00:00
Joshua Holmes
c909c64378
Fix typing issues in flex layout (#30784)
* Use `Option` instead of `Result` when passing optional values into vector

Also renames vector and adds comment for clarity, just in case that's helpful

Signed-off-by: Joshua Holmes <joshua.phillip.holmes@gmail.com>

* Replace use of Option with new enum, , when seperating flex content

Signed-off-by: Joshua Holmes <joshua.phillip.holmes@gmail.com>

* Move global  function body into the  method

Signed-off-by: Joshua Holmes <joshua.phillip.holmes@gmail.com>

---------

Signed-off-by: Joshua Holmes <joshua.phillip.holmes@gmail.com>
2023-12-04 10:02:07 +00:00
Samson
604979e367
Replace script_plugins with a clippy like rustc driver (named crown) (#30508)
* Remove script_plugins

* Use crown instead of script_plugins

* crown_is_not_used

* Use crown in command base

* bootstrap crown

* tidy happy

* disable sccache

* Bring crown in tree

* Install crown from tree

* fix windows ci

* fix warning

* fix mac

libscript_plugins.dylib is not available anymore

* Update components/script/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* Update for nightly-2023-03-18

Mostly just based off https://github.com/servo/servo/pull/30630

* Always install crown

it's slow only when there is new version

* Run crown test with `mach test-unit`

* Small fixups; better trace_in_no_trace tests

* Better doc

* crown in config.toml

* Fix tidy for real

* no sccache on rustc_wrapper

* document rustc overrides

* fixup of compiletest

* Make a few minor comment adjustments

* Fix a typo in python/servo/platform/base.py

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>

* Proper test types

* Ignore tidy on crown/tests

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-12-01 15:50:52 +00:00
Martin Robinson
20a73721de
Remove a comment that is no longer valid (#30806)
The update of `max_block_size` here no longer happens.
2023-12-01 12:48:22 +00:00
Martin Robinson
cdbd60fe53
Extend character-based soft wrap prevention to before atomics (#30800)
The changes in #30740, fixed an issue where certain characters should
prevent line break opportunity after atomics. This change extends that
to also apply to before atomics, which is what the specification says
should happen.
2023-12-01 09:26:49 +00:00
Martin Robinson
f1c291853e
Stop sending " " to linebreaker for replaced content (#30740)
We previously sent a " " to the linebreaker in order to ensure that the
next text had a soft wrap opportunity at the start. Calling `next(" ")`
without waiting until the returned index was 1, violated some
invariants of linebreaker ultimately causing a panic.

Instead of using the linebreaker for this, simply keep a flag in the
IFC layout state, which avoids the problem entirely.

Fixes #30703.
2023-11-30 14:46:14 +00:00
Martin Robinson
a05598402e
Add initial support for sticky positioning for non-legacy layout (#30686)
* Add initial support for sticky positioning for non-legacy layout

Many tests still fail for a variety of reasons. One of the primary ones
is that CSSOM currently does not return correct values for elements
positioned by sticky nodes. This requires changes to WebRender to work
properly.

* Fix an assertion failure in the legacy layout sticky code
2023-11-29 09:03:24 +00:00
Oriol Brufau
27056eb93a Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
1ada5e9605 style: Add a query-selector fast path for attribute selectors in the rightmost compound
Differential Revision: https://phabricator.services.mozilla.com/D180553
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
de9fb7983a style: Speed up / specialize attribute selector-matching
Inline the attribute lookup code, and only branch on the attribute selector
type if we have found an attribute.

Differential Revision: https://phabricator.services.mozilla.com/D180531
2023-11-24 08:57:14 +01:00
Oriol Brufau
8c5a028955 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
e59c71d8ef style: Remove unused TElement::has_attr
Differential Revision: https://phabricator.services.mozilla.com/D180530
2023-11-24 08:57:14 +01:00
Oriol Brufau
29f6170564 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
3da2db1c53 style: Remove the never_matches field from attr selectors
It's an extra branch which in practice we almost never take, plus extra
checks during parsing.

Differential Revision: https://phabricator.services.mozilla.com/D180529
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
54a783db17 style: Add a way to optimize the "attribute in no namespace exists" check
Go through the slow path by default. No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D180528
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
c36a22a97f style: Don't recompute quirks mode -> case sensitivity over and over
The only reason we pass the quirks mode around is to compute the case
sensitivity, but we can just pass the later.

Differential Revision: https://phabricator.services.mozilla.com/D180527
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
5b184f448b style: Fix style invalidation on layer rule insertion
Layer insertion may change the order of styles, so we may need to fully
invalidate.

Without this change, bug 1838045 makes
layer-statement-before-import.html fail.

Differential Revision: https://phabricator.services.mozilla.com/D180929
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
50d7f882dd style: Container units should prevent us from sharing style by rule node
At least when the containers are different.

For now check that by doing a somewhat simplified test (checking
sibling-ness).

The new flag can be useful to optimize container query restyles on
resizes too, in the future.

Differential Revision: https://phabricator.services.mozilla.com/D179268
2023-11-24 08:57:14 +01:00
Ting-Yu Lin
07d6ec5d4b style: Remove obsolete comment to add use counter for developing CSS properties
The CSS properties in the list are all shipped. Since we still don't support use
counter for developing CSS properties since this bug opens, I assume this
feature is not critical. Hence the removal of the comment.

Differential Revision: https://phabricator.services.mozilla.com/D180771
2023-11-24 08:57:14 +01:00
Oriol Brufau
c1a622cf01 Further changes required by Servo 2023-11-24 08:57:14 +01:00
David Shin
ae5e0d49d8 style: Move ANCHORS_RELATIVE_SELECTOR out of nsINode flags
Move the flag to ComputedValueFlags, like `CONSIDERED_RELATIVE_SELECTOR`.

Differential Revision: https://phabricator.services.mozilla.com/D180726
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
9321265b38 style: Clean up Context::for_non_inherited_property
We don't ever check the particular property, so it can just be a
boolean.

Differential Revision: https://phabricator.services.mozilla.com/D180680
2023-11-24 08:57:14 +01:00
Oriol Brufau
1ad176f1bc Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
3da0e44d98 style: Fix rebase conflict with bug 1837664 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
77c541b38a style: Do not snap -webkit-text-stroke-width to dev pixels
Introduce LineWidth (which doesn't snap) and let BorderSideWidth
wrap it and actually do the snapping.

Differential Revision: https://phabricator.services.mozilla.com/D180688
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
127e00e48a style: Improve border-image shorthand serialization, and annotate more passes 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
78f8d575b7 style: Don't allow to share style by rule node for links
(Regardless of visitedness)

Differential Revision: https://phabricator.services.mozilla.com/D180353
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
c8ccb52c9e style: Improve border shorthand serialization
Fix some bugs caught by css/cssom/shorthand-values. In particular:

  * Make the shorthand order match the spec.
  * Omit values when we can.

Fix a subtest that wasn't correct. Shorthands can be serialized as long
as !important matches in all components.

Differential Revision: https://phabricator.services.mozilla.com/D180466
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
cf3d31038c style: Minor clean-ups to border shorthand parsing
This doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D180465
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
7c8cf00033 style: Avoid selecting zero-resolution images in image-set
Fairly straight-forward. This fixes the two tests mentioned in comment 0
which aren't still in the repo.

Differential Revision: https://phabricator.services.mozilla.com/D180414
2023-11-24 08:57:14 +01:00
Oriol Brufau
5842cfc127 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Andrew Osmond
42d9ec1106 style: Add method to parse CSS filters without context for workers
This patch adds the ability to parse most CSS filters without a context.
OffscreenCanvas can use this on worker threads to provide support for
filter operations.

Differential Revision: https://phabricator.services.mozilla.com/D179994
2023-11-24 08:57:14 +01:00
CanadaHonk
a10df24ffb style: Serialize NaN and infinity numbers
Added NaN/inf serialization of <number> and changed calc() code to not
remove NaN/infinity in code using it.

This change is unfortunately imperfect as some things using <number>
still refuse to serialize NaN/infinity for some reason (scale()?), but
this bug/patch is just for <number> so leaving that out of scope for
this.

Also added new WPT test file for number NaN/inf serialization based
on existing serialization tests (all pass already!).

5 other WPT subtests now newly pass.

Differential Revision: https://phabricator.services.mozilla.com/D178587
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
dcb61c095f style: Forbid negative CSS resolutions at parse time
Apply some clang-tidy suggestions while I was going through the
ServoStyleConstsInlines while at it.

Remove one 0x test because it's tested on the same test and causes a
harness error.

Differential Revision: https://phabricator.services.mozilla.com/D180331
2023-11-24 08:57:14 +01:00
Ting-Yu Lin
019c14cf0b style: Make flex-flow serialization interoperable
Differential Revision: https://phabricator.services.mozilla.com/D180270
2023-11-24 08:57:14 +01:00
Oriol Brufau
abc0c86fef Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
d02c4e2fe9 style: Remove viewport rule code
Turns out Servo doesn't need this either, see
https://github.com/servo/servo/pull/29850.

Differential Revision: https://phabricator.services.mozilla.com/D180264
2023-11-24 08:57:14 +01:00
Oriol Brufau
0b75c1d9d1 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
23d60c2195 style: Unify parallel and sequential traversal scheduling
Use in_place_scope_fifo to spawn work into the thread pool while doing
work in the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D179492
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
7771cf25a8 style: Remove :nth-child(... of) pref
We ship this, and the front-end uses it by default, so remove the pref.

Differential Revision: https://phabricator.services.mozilla.com/D180222
2023-11-24 08:57:14 +01:00
Boris Chiou
bcae33a43f style: Send offset-position to the compositor
We send offset-position to the compositor, just like other similar
properties, e.g. offset-rotate, offset-anchor. This includes extracting
this animation value, doing serialization and sending it via IPC.

So now we can run the animation of ray() on the compositor properly.

Differential Revision: https://phabricator.services.mozilla.com/D179862
2023-11-24 08:57:14 +01:00
Boris Chiou
2fef5d1a17 style: Add at <position> into ray() in style system
We reuse PositionOrAuto here, and let "auto" represent the situation when the
author omits "at <position>" because it has a special meaning.

https://drafts.fxtf.org/motion-1/#valdef-ray-at-position

Note: No need to update css/motion/parsing/offset-path-parsing-valid.html
because Blink added some to the upstream repo already.

Differential Revision: https://phabricator.services.mozilla.com/D179860
2023-11-24 08:57:14 +01:00
Boris Chiou
8b60424e29 style: Return Err() in to_animated_zero() for offset-path
It's unnecessary to implement ToAnimatedZero for this property and so we
return Err(()), just like other properties which also use basic shapes,
e.g. clip-path, shape-outside.

Differential Revision: https://phabricator.services.mozilla.com/D179859
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
52e2cc5ff0 style: Change some references to raw pointers in some FFI functions
Even tho https://github.com/rust-lang/rust/issues/112337 is IMO a rust
bug, it's easy to work around in our code and it doesn't really affect
expressiveness.

Differential Revision: https://phabricator.services.mozilla.com/D180065
2023-11-24 08:57:14 +01:00
Oriol Brufau
e792eba7c7 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Jihye Hong
9e223342e7 style: Make content-visibility: auto forces contain-intrinsic-size to gain an auto value
When the content having `content-visibility: auto` and the specific value for `contain-intrinsic-size` is slightly out of the viewport,
its computed value keeps changing.
This patch makes `content-visibilty: auto` forces `contain-intrinsic-size` to gain an auto value to solve this issue.

Differential Revision: https://phabricator.services.mozilla.com/D174583
2023-11-24 08:57:14 +01:00
Oriol Brufau
dcbeb2f1ab Further changes required by Servo 2023-11-24 08:57:14 +01:00