Commit graph

58 commits

Author SHA1 Message Date
Josh Matthews
c94ac5bccb
Move various reflector types and traits to script_bindings (#35279)
* script: Move Reflector to script_bindings.

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

* script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-04 06:58:08 +00:00
Josh Matthews
875e387004
script: Feature-gate all crown support. (#35055)
* script: Feature-gate all crown support.

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

* script: Use cfg(crown) instead of a cargo feature.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-18 21:36:15 +00:00
Josh Matthews
c94d909a86
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types.

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

* script: Mass pub->pub(crate) conversion.

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

* script: Hide existing dead code warnings.

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

* Formatting.

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

* Fix clippy warnings.

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

* Formatting.

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

* Fix unit tests.

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

* Fix clippy.

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

* More formatting.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-10 08:19:19 +00:00
Josh Matthews
e956f3124c
Generate a trait abstracting over all known DOM interfaces (#34357)
* script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it.

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

* script: Update trait implementations with new generic type.

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

* Formatting.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-11-24 07:35:14 +00:00
chickenleaf
a2f81d69c1
CanGc fixes (#33852)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-10-16 02:50:28 +00:00
chickenleaf
b088a8b8f1
Fix Clippy warning: remove unneeded late initialization of string (#33840)
* Fix Clippy warning: remove unneeded late initialization of string

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* Fixed the comments placement

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-10-15 06:09:26 +00:00
chickenleaf
92f12ff7cd
Propagate CanGc through dommatrix, dommatrixreadonly, and testbindings (#33822)
* CanGc fixes starting from dommatrix.rs
fixed conflicts
Signed-off-by: L Ashwin B <lashwinib@gmail.com>

~

* cleaning up

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* fixed cannot find value can_gc in this scope error

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-10-13 16:11:46 +00:00
tanishka
27b25e869b
content: Replace uses of downcast+is_some/is_none with is (#33804)
* content: Replace uses of downcast+is_some/is_none with is

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* Remove ! to return correct logic

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

---------

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-11 15:40:39 +00:00
Simon Wülker
c00c6e728d
Implement DOMMatrix stringifier (#33792)
* Implement DOMMatrix stringifier

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-10-11 03:06:44 +00:00
Simon Wülker
f15da16da4
Update DOMMatrix::is2D when modifying elements (#33796)
* Invalidate DOMMatrix::is2D when modifying matrix values

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-10-11 01:55:27 +00:00
Josh Matthews
7d931e673a
script: Include constructors and static methods in generated DOM traits (#33665)
* Add all constructors, special operations, and static methods to generated DOM interface traits.

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

* Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls.

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

* Add missing doc links.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-10-08 01:51:58 +00:00
Josh Matthews
60ef6bc461
Start marking functions that can transitively trigger a GC (#33144)
* Mark JS reflector wrappers as CanGc.

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

* Propagate CanGc from reflect_dom_object_with_proto.

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

* Mark DOM constructors as GC operations.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-22 11:42:36 +00:00
Oluwatobi Sofela
3e63f8d6ee
clippy: Fix needless borrow warnings (#31813) 2024-03-21 17:48:54 +00:00
Taym Haddadi
a9a7e8a5cf
Rename buffer_source_type to buffer_source (#31426)
* Rename buffer_source_type to buffer_source

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

* Code format

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

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-02-26 14:21:46 +00:00
Taym Haddadi
d0b663800f
WedIDL: bring dom/bindings/typedarray further in line with spec (#31375)
* WedIDL: bring dom/bindings/typedarray further in line with spec

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

* Rename HeapBufferSourceTypes to HeapBufferSource

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

* fmt code

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

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-02-25 12:13:17 +00:00
Martin Robinson
9a6973d629
style: Remove dependency on servo_url (#31358)
In order for stylo to be a separate crate, it needs to depend on less
things from Servo. This change makes it so that stylo no longer depends
on servo_url.
2024-02-16 11:56:35 +00:00
Taym Haddadi
967925c119
webidlg: Handle Float64Array as a TypedArray rather than a raw JSObject (#31189)
* WebIDL use FLoat64Array

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

* Use to_vec to convert array to vec

* avoid allocating a new vec

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-01-30 08:45:29 +00:00
Taym Haddadi
890588945d
Use Uint8Array for TextEncoder (#31145)
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-01-23 12:15:42 +00:00
Gregory Terzian
e145c51234
WebIDL: use FLoat32Array (#30990)
* inital

* audiobuffer: return float 32 array as channel data

* add on heap float 32 array type

* fix warnings

* add list of webidl interfaces to ignore for float 32

* codegen: remove duplication of builtin return type handling

* bindings: derive default for float 32 array wrapper

* bindings: allow unsafe code in typedarrays module

* bindings: rename float 32 array wrapper

* bindings: rename HeapFloat32Array is_set method to is_initialized

* bindings: assert float 32 array is initialized before data can be acquired

* bindings: use let syntax for error handling in float 32 array wrapper

* bindings: use copy_from_slice where possible in float 32 array wrapper

* bindings: rename args in typedarray copy methods

* codegen: use idl type in builtin names for float 32 array

* bindings: add a util to create float 32 arrays, use in dom matrix readonly

* codegen: tidy

* bindings: box the heap inside heaped float 32 arrays
2024-01-11 09:43:36 +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
f1ae42678a Further changes required by Servo 2023-11-24 08:57:14 +01:00
Ennui Langeweile
26a3dffd95
Clean up and merge some canvas-related WebIDLs (#30606)
* Clean up and merge some canvas-related WebIDLs

* Apply `./mach fmt`

* WebIDL has `test-tidy` support???
2023-10-26 12:45:53 +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
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
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
Martin Robinson
423cc34cb0 Bump euclid to 0.22
- Also updates raqote to latest with an upgrade of font-kit to 0.11
  applied on as a patch
- Update lyon_geom to the latest version

Major change:

- All matrices are now stored in row major order. This means that
  parameters to rotation functions no longer should be negated.
- `post_...()` functions are now named `then()`. `pre_transform()` is removed,
  so `then()` is used and the order of operations changed.
2023-01-26 08:59:21 +01:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
Kunal Mohan
02c1612cb0
Add accountable-refcell as optional build time feature 2020-01-08 09:44:41 +05:30
marmeladema
2c5d0a6ebc Convert CGTraitInterface to use safe JSContext instead of raw JSContext 2019-07-24 08:24:50 +01:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Kagami Sascha Rosylight
168d980f9e Fix DOMMatrix rotate test failure 2019-07-03 20:23:52 +09:00
Kagami Sascha Rosylight
9218c535d1 add link to the spec 2019-07-02 18:28:17 +09:00
Kagami Sascha Rosylight
ebdb1067ca Add DOMMatrix.prototype.scaleNonUniform 2019-07-02 18:23:39 +09:00
Kagami Sascha Rosylight
7a1db0e8ea Support DOMMatrix string constructor 2019-06-30 18:45:56 +09:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Emilio Cobos Álvarez
c2f8b0468a
Update mozjs. 2018-03-25 00:04:43 +01:00
Christian Poveda
6d08027890 Add constructors for typed arrays in DOMMatrix and DOMMatrixReadOnly 2018-03-23 15:37:32 -05:00
Simon Sapin
e17697fb0e Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender 2017-12-08 14:32:28 +01:00
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
coalman
fc34b9a14d Fix indentation errors in servo rust code that tidy now finds. 2017-04-18 14:56:13 -04:00