Commit graph

26358 commits

Author SHA1 Message Date
Alex Touchet
e4aed3d06a
Update branch name to main (#30877) 2023-12-16 09:32:20 +00:00
Martin Robinson
ccf0b739df
Add basic support for text-align: justify (#30807)
This also enables parsing of `text-justify` for non-legacy layout,
though only None is supported (disabling justification).
2023-12-15 14:00:13 +00:00
Martin Robinson
569c4a8823
Integrate hyper_serde into Servo source (#30803)
hyper_serde changes very infrequently and typically only in order to
upgrade Servo dependencies. crates.io lists hyper_serde as having no
dependents, and its integration will not prevent releasing new versions.
Integrating it will both reduce the number of repositories we have to
maintain as well as making it easier to upgrade Servo dependencies.
2023-12-14 11:43:10 +00:00
Delan Azabani
17f3c45d4f
Add initial support for offscreen rendering (#30767)
* Offscreen rendering

* shared memory case never actually rendered to backbuffer

* fix compile errors (in theory) when gl crate feature disabled

* update doc comments

* remove dark CentralPanel border covering edges of viewport

* clear to transparent, to avoid pink artifacts

* fix mouse input for browser being consumed by egui

* avoid destroying OpenGL resources unless resizing window

* clean up compositing::gl

* fix flickering around edges after resizing window

* unset invalidate_last_render_target after invalidating

* fix incorrect DRAW_FRAMEBUFFER name when blitting

* bind the widget surface fbo before painting egui

* make composite_specific_target take CompositeTarget, not Option

* compositing: remove cargo feature “gl”

* capitalise FBO in bind log message

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

* capitalise FBO in drop log message

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

* rename RenderTargetInfo fields and use OnceCell for next field

* rename RenderTargetInfo.read to read_back_from_gpu

* document servo_framebuffer_id in Minibrowser::update

* rename needs_fbo to use_offscreen_framebuffer

* capitalise FBO in unbind log message

* clarify the purpose of Minibrowser::on_event

* fix unused_must_use warning

* reduce nesting in Minibrowser::update

* use implicit format argument in panic

* store Minibrowser.widget_surface_fbo as glow type

* explain why servo_framebuffer_id is None in first call site

* rename output_framebuffer_id to offscreen_framebuffer_id

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-12-13 02:49:25 +00:00
Delan Azabani
97e6c72f57
Add multiview feature flag in compositing and constellation (#30840) 2023-12-12 08:50:58 +00:00
Delan Azabani
8a226fdb19
constellation: notify embedder when events are hit-tested to browsers (#30841)
* constellation: notify embedder when events are hit-tested to browsers

* fix compile error in libsimpleservo

* impl From<&CompositorEvent> for CompositorEventVariant

* remove msg temporaries in Constellation::forward_event

* use single wildcard arm in EventDelivered case in handle_servo_events
2023-12-12 06:36:27 +00:00
atbrakhi
a315bec4ed
Use app units in replaced elements (#30825)
* use app_units in replaced elements

* fmt

* remove from_f32_px

* fix typo
2023-12-11 11:30:37 +00:00
Samson
e2743c6141
Bump mozangle to 0.5.0 (#30546)
* Update mozangle to version 0.5

* Update webglshader CompileOptions and BuiltInResources

* Update webglshader.rs

* Update webglshader.rs
2023-12-08 11:15:01 +00:00
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