Commit graph

1155 commits

Author SHA1 Message Date
cathiechen
4e4a4c0a28
Implement form-associated custom elements and their ElementInternals (#31980)
* FACEs work, setFormValue test is awful so now has _mozilla backup

* 1. Impl Validatable in ElementInternals instead of HTMLElement. 2. Reuse the code in Validatable trait. 3. The form associated custom element is not a customized built-in element.

* add some comments

* support readonly attribute and complete barred from constraint validation

* Addressed the code review comments

* Updated the legacy-layout results

* Fixed the WPT failures in ElementInternals-validation.html

* Addressed the code review comments

* Review suggestions

* Fixed silly mistakes and update the test result outside elementinternals

* update the test results

---------

Co-authored-by: Patrick Shaughnessy <pshaughn@comcast.net>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-04-11 13:17:11 +00:00
Martin Robinson
fe8b23d14a
layout: Add a FontMetricsProvider for resolving font-relative units (#31966)
The only font relative unit that Servo knows how to resolve currently is
`rem` (relative to the root font size). This is because Stylo cannot do
any font queries. This adds a mechanism to allow this, exposing the
ability to properly render `ex` units in Servo.

This change only allows resolving some font size relative units thoug,
as Servo doesn't collect all the FontMetrics it needs to resolve them
all. This capability will be added in followup changes.

Some new tests fail:
 - ex-unit-001.html: This test fails because Servo does not yet have
   support for setting the weight using @font-face rules on web fonts.
 - ex-unit-004.html: This test fails because Servo does not yet have
   support for setting the Unicode range of a web font using @font-face
   rules.
 - first-available-font-001.html: This test fails because the above
   two feature are missing.
2024-04-04 12:35:15 +00:00
Martin Robinson
18b37e676b
script: Reduce the use of unsafe in LayoutDom (#31979)
Remove the use of unsafe code in the layout wrappers of the DOM. The
main change here is that `unsafe_get()` no longer needs to be an unsafe
method, which allows us to transitively remove or reduce unsafe blocks
from callers. The function itself is not renamed, because it's still
a bit dangerous to start removing the layers of abstraction from actual
DOM nodes.

In addition `init_style_and_opaque_layout_data` can be merged into
`initialize_data`, which removes one more unsafe method.

Finally, a "Safety" section is added to some unsafe methods.
2024-04-03 08:41:19 +00:00
eri
cc082efbfd
clippy: Allow too_many_arguments for existing functions (#31974)
* Allow `too_many_arguments` for existing functions

* fix: Surround ASCII with code block in rustdoc
2024-04-02 12:50:45 +00:00
Azhar Ismagulova
c4739675d8
clippy: Fix needless_borrow warnings in components/script (#31928) 2024-03-29 08:58:22 +00:00
Rosemary Ajayi
18054d0737
clippy: Fix another set of clippy problems in components/script/dom (#31909)
* a reference to a reference

* length comparison to zero

* length comparison to zero

* length comparison to zero
2024-03-28 11:33:29 +00:00
Martin Robinson
8dece05980
fonts: Add support for WOFF2 and properly load web fonts from @imports (#31879)
This change also makes two fixes that are necessary to get WOFF2 fonts
working:

1. It adds support for loading web fonts from stylesheets included via
   @import rules.
2. It ensure that when web fonts are loaded synchronusly they invalidate
   the font cache. This led to incorrect font rendering when running
   tests before.

Fixes #31598.
2024-03-26 20:31:52 +00:00
Aarya Khandelwal
d814d05539
fixed the unneeded return statement warnings. (#31863) 2024-03-26 08:58:34 +00:00
Aarya Khandelwal
f7669b5238
fixes dereferencing on an immutable reference (#31864) 2024-03-26 08:37:44 +00:00
Oluwatobi Sofela
a53632c0e5
clippy: Fix collapsible_if warnings (#31852) 2024-03-25 13:55:45 +00:00
Aarya Khandelwal
bd39e03eeb
changed match to 'matches!' (#31850) 2024-03-25 11:28:12 +00:00
eri
58081579e9
WebIDL: Remove JSObject from Document::NamedGetter (#31841)
* WebIDL: Remove `JSObject` from `Document::NamedGetter`

* fix: update rustdoc comment
2024-03-24 18:04:04 +00:00
Oluwatobi Sofela
3c05b58221
clippy: Fix explicit_auto_deref warnings in components/script (#31837)
* clippy: Fix explicit auto-deref warnings

* clippy: Fix explicit auto-deref warnings

* refactor: Tidy up code

* refactor: Fix method not found errors
2024-03-23 11:29:20 +00:00
Delan Azabani
8882507ad0
Rework “visible” to “throttled” in constellation + script + compositor (#31816) 2024-03-22 06:06:28 +00:00
Oluwatobi Sofela
3e63f8d6ee
clippy: Fix needless borrow warnings (#31813) 2024-03-21 17:48:54 +00:00
Oluwatobi Sofela
694e86ecff
clippy: Fix dereferencing a tuple pattern warnings (#31811) 2024-03-21 17:04:18 +00:00
Oluwatobi Sofela
2789e98876
clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
Martin Robinson
ad37a54f59
dependencies: Upgrade to WebRender 0.64 (#31486)
This brings the version of WebRender used in Servo up-to-date with Gecko
upstream. The big change here is that HiDPI is no longer handled via
WebRender. Instead this happens via a scale applied to the root layer in
the compositor. In addition to this change, various changes are made to
Servo to adapt to the new WebRender API.

Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-03-14 17:40:54 +00:00
eri
03d64d0675
clippy: Fix assorted warnings in components/ (#31628)
* clippy: fix assorted warnings in `components/`

* fix: new and default

* fix: review comments
2024-03-13 08:31:58 +00:00
eri
21939c2ba8
clippy: Fix warnings in components/shared (#31627)
* clippy: fix warnings in `components/shared`

* fix: formatting derive

* fix: rename new to default
2024-03-12 17:22:05 +00:00
Smitty
0beec63c86
script: Implement <meta http-equiv="refresh"> (#31468)
* script: Implement <meta http-equiv="refresh">

* Address review comments
2024-03-01 07:42:18 +00:00
Martin Robinson
9c0561536d
script: Do not run layout in a thread (#31346)
* script: Do not run layout in a thread

Instead of spawning a thread for layout that almost always runs
synchronously with script, simply run layout in the script thread.

This is a resurrection of #28708, taking just the bits that remove the
layout thread. It's a complex change and thus is just a first step
toward cleaning up the interface between script and layout. Messages are
still passed from script to layout via a `process()` method and script
proxies some messages to layout from other threads as well.

Big changes:

1. Layout is created in the script thread on Document load, thus every
   live document is guaranteed to have a layout. This isn't completely
   hidden in the interface, but we can safely `unwrap()` on a Document's
   layout.
2. Layout configuration is abstracted away into a LayoutConfig struct
   and the LayoutFactory is a struct passed around by the Constellation.
   This is to avoid having to monomorphize the entire script thread
   for each layout.
3. Instead of having the Constellation block on the layout thread to
   figure out the current epoch and whether there are pending web fonts
   loading, updates are sent synchronously to the Constellation when
   rendering to a screenshot. This practically only used by the WPT.

A couple tests start to fail, which is probably inevitable since removing
the layout thread has introduced timing changes in "exit after load" and
screenshot behavior.

Co-authored-by: Josh Matthews <josh@joshmatthews.net>

* Update test expectations

* Fix some issues found during review

* Clarify some comments

* Address review comments

---------

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-02-23 08:14:10 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
Martin Robinson
abb017b854
script: Allow moving back to non-quirks mode (#30898)
The code in script is written so that the document itself can move from
quirks to non-quirks mode, but this is never communicated to layout --
meaning quirky layout keeps happening. This is an issue when rewriting
the entire document with `document.write()` which is what some WPT tests
do to test quirks mode behavior.
2023-12-21 08:14:00 +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
Oriol Brufau
d44f772dc3 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Samson
ebd41d4101
Use Foo_Binding instead of FooBinding for namespace modules (#30447)
* Update Codegen.py to emit Foo_Binding instead of FooBinding

* s/FooBinding/Foo_Binding/g
2023-09-30 00:52:04 +00:00
Ennui Langeweile
80d9a2bb4f
Treat the keygen element as obsolete (#30429)
* Eradicate the `keygen` element

* Run `./mach fmt`

* Fix relevant Servo test

* Fix outdated manifest
2023-09-26 21:37:46 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

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

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Samson
450f8193a5
Use mozjs tracing infrastructure (#29918)
* Update mozjs

64711ec2e6 also fixes https://github.com/servo/servo/issues/30043

* Move to mozjs Traceable and introduce CustomTraceable
2023-08-10 21:46:06 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Gregory Terzian
cf9ec700de
make the concept of has_listeners_for follow other implementations (#21044)
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
2023-07-19 15:27:32 +00:00
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
Josh Matthews
0e8ac3fdac Formatting. 2023-05-28 23:54:02 -04:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Josh Matthews
9ea1399c30 Fix formatting. 2023-05-20 11:05:10 -04:00
Josh Matthews
5e5669b945 Remove unused argument from AlreadyInRealm::assert. 2023-05-20 11:05:09 -04:00
Josh Matthews
fca5833e21 Remove global argument from Promise::new_in_current_realm. 2023-05-20 11:05:09 -04:00
Martin Robinson
17e3f34e65 Fix flakiness in animation tests
1. When updating the animation timeline, ensure that nodes that are
   animating are marked dirty, if necessary, so any style queries will
   force an layout flush.
2. Disable the problematic transition test suites, as they are in Gecko.
   These suites often fail when Servo is so overloaded that it cannot
   deliver frames fast enough to get more than two samples during the
   animation lifecycle.

Fixes #28334.
Fixes #26435.
Fixes #21486.
2023-05-02 08:37:15 +02:00
Delan Azabani
fb2acb0b02 clarify todos about exposed objects 2023-03-23 18:07:46 +08:00
Delan Azabani
fd1de05592 apply pylbrecht/servo/named.window.getter (closes #27952) 2023-03-23 18:01:26 +08:00
Adrian Willenbücher
0917dc4e87 Replaced ref_slice::ref_slice with std::slice::from_ref
ref_slice::ref_slice is deprecated in ref_slice-1.2.1,
because it's redundant with std since rust 1.28.

Signed-off-by: Adrian Willenbücher <willenbuecher@xq-tec.com>
2021-06-10 21:17:04 +02:00
Philip Lamb
b8a74e89cf Improve IME messaging to embedder with insertion point index and multiline flag. 2021-03-29 17:55:54 +13:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
teymour-aldridge
217147b2e4 fmt 2021-02-05 14:46:09 +00:00
teymour-aldridge
ff767b13a9 Remove unused arguments from methods. 2021-02-05 14:29:45 +00:00
teymour-aldridge
466e895cdf Fix errors 2021-02-05 14:29:30 +00:00
teymour-aldridge
0854953e35 Mark methods as unsafe. 2021-02-05 14:29:30 +00:00
YUAN LYU
e15bc7516c Fix mouse button handling 2020-12-06 00:21:21 -05:00