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
Domenico Rizzo
0e9746fbbe
Add CanGc argument to reflect_dom_object ( #34606 )
...
* applied mach fmt
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
Refinements
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
Modified reflect_dom_object signature and all its calls
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* fix function calls when parameter is passed up
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
---------
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2024-12-13 15:51:59 +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
Ekta Siwach
d8adeb1b44
clippy: Fix some warnings in components/script
( #31849 )
...
* clippy: fixed some warnings in components/script
* fixed formatting
* fix formatting
2024-03-25 10:22:21 +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
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function
2020-03-20 22:16:56 -04: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
Simon Sapin
793bebfc0e
Upgrade to rustc 1.23.0-nightly (02004ef78 2017-11-08)
2017-11-09 16:56:39 +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
7be32fb237
Rename JS<T> to Dom<T>
2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191
Rename dom::bindings::js to dom::bindings::root
2017-09-26 02:19:05 +02:00
Simon Sapin
6c518c89b9
Upgrade to html5ever 0.16
2017-05-02 19:24:28 +02:00
Anthony Ramine
31e9d81c0f
Make #[dom_struct] a proc_macro attribute
2017-02-24 01:50:51 +01:00
Simon Sapin
53b638c0e2
Update to string-cache 0.3
2016-11-03 16:23:05 +01:00
Anthony Ramine
fcb59d3057
Make reflect_dom_object take a &GlobalScope
2016-10-06 20:59:09 +02:00
Anthony Ramine
7dfb336be8
Use Option<T> to return from getters
...
This removes the cumbersome &mut bool argument and offers overall
a more readable code.
2016-08-30 19:07:19 +02:00
Anthony Ramine
cdc7bca944
Move DOMString back to script
...
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Ravi Shankar
aaf2888d0b
Updated SupportedPropertyNames in NamedNodeMap to match spec
2016-03-05 17:21:01 +05:30
Anthony Ramine
0adfb08089
Implement From<DOMString> for Atom
2016-02-24 17:52:17 +01:00
Mathieu Hordesseaux
322b120f8a
Implement SetNamedItem, SetNamedItemNS, SetAttributeNode and SetAttributeNodeNS
2016-01-28 12:35:44 +01:00
Alan Jeffrey
3dec6edd10
Update string_cache to 0.2.
...
Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
2015-11-25 10:13:21 -06:00
Alan Jeffrey
84bde75b42
Replaced DOMString constructor by conversion functions.
...
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Ms2ger
6b75078503
Make DOMString a newtype around String, rather than a typedef.
...
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.
Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
rohan.prinja
6e774ea6eb
merge from master
2015-11-03 19:01:23 +09:00
nxnfufunezn
d8ef3809a6
Removed JS::root Fixes #8251
2015-10-31 18:15:16 +05:30
Nova Fallen
73c4af626a
Implement DOMStringMap::SupportedPropertyNames and NamedNodeMap::SupportedPropertyNames
2015-10-30 21:13:29 -04:00
rohan.prinja
45224028db
more refactoring
2015-10-30 20:26:29 +09:00
Anthony Ramine
6849510526
Do not root NamedNodeMap::owner
2015-10-19 09:37:02 +02:00
Ravi Shankar
889eec364b
sorted the extern crate, mod & use declarations
2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401
Fix reported test-tidy errors for unmerged import blocks
...
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Anthony Ramine
709d347872
Make the traits for the IDL interfaces take &self
2015-08-27 22:27:43 +02:00
Anthony Ramine
2a028f66a2
Remove AttributeHandlers
...
On components/script/*.rs:
# Remove imports.
/^ *use dom::element::\{.*AttributeHandlers/ {
s/\{AttributeHandlers, /\{/
s/, AttributeHandlers//g
s/\{([a-zA-Z]+)\}/\1/
/\{\}/d
s/::self;$/;/
}
/^ *use dom::element::\{?AttributeHandlers\}?;$/d
# Remove AttributeHandlers.
/^pub trait AttributeHandlers \{$/,/^\}$/D
# Patch AttributeHandlers methods.
/^impl<'a> AttributeHandlers for &'a Element \{/,/^\}$/ {
s/^impl<'a> AttributeHandlers for &'a Element \{/impl Element {/
/^ *fn /s/\(self([,)])/\(\&self\1/
/^ *fn.*\(&self/s/fn/pub fn/
}
The few error cases were then fixed by hand.
2015-08-27 16:59:04 +02:00
Anthony Ramine
c831c2c0a5
Remove helper traits
...
Now that JSRef<T> is gone, there is no need to have helper traits.
On components/script/*.rs:
# Remove imports.
/^ *use dom::[a-z]+::\{.*Helpers/ {
s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
s/\{([a-zA-Z]+)\}/\1/
/\{\}/d
s/::self;$/;/
}
/^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d
On components/script/dom/*.rs:
# Ignore layout things.
/^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }
# Delete helpers traits.
/^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D
# Patch private helpers.
/^impl.*Private.*Helpers/,/^\}$/ {
s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
/^ *(unsafe )?fn .*\(self.*[<&]'a/ {
s/&'a /\&/g
s/<'a, /</g
}
/^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
}
# Patch public helpers.
/^impl.*Helpers/,/^\}$/ {
s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
/^ *(unsafe )?fn .*\(self.*[<&]'a/ {
s/&'a /\&/g
s/<'a, /</g
}
/^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
/^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
}
The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
João Oliveira
fd87c8cb3e
make dom_struct derive HeapSizeOf,
...
closes #7357
2015-08-27 01:17:48 +01:00
Corey Farwell
b11be4d253
Initial implementation of ownPropertyKeys proxy handler
...
Generates `SupportedPropertyNames` on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of `HTMLCollection`. Also added a couple
relevant WPT tests.
Closes #6390
Closes #2215
2015-08-20 11:58:42 -04:00
Bogdan Cuza
45145108da
Measure heap memory usage for more types. Fixes #6951
2015-08-13 21:44:41 +03:00
Bogdan Cuza
233a769c67
Add spec links
2015-07-28 13:28:41 +02:00
Matt Brubeck
13072c7b0c
Remove string_cache dependency from util.
...
Move `namespace::from_domstring` from util to script::dom, because it is used
only in that crate.
2015-07-01 10:04:53 -07:00
Maciej Skrzypkowski
21f495139f
Refactoring, return an Atom from Element::parsed_name. #5774
2015-06-23 08:55:40 +02:00
Michael Wu
675267b782
Upgrade to SM 39
2015-06-19 18:42:48 -04:00
Anthony Ramine
1a30925cad
Remove Temporary::new()
...
Temporary::from_rooted() now takes an Assignable value.
2015-04-28 09:22:46 +02:00
Anthony Ramine
7197052c0d
Uniformise root() methods
...
They now live in traits Rootable, OptionalOptionalRootable, OptionalRootable
and ResultRootable.
2015-04-28 09:22:45 +02:00
Ms2ger
a862479ca8
Remove as_slice() calls from script.
2015-04-26 10:52:55 +02:00
Maciej Skrzypkowski
6a31a75bc6
Refactoring, added conversion to lowercase for get_attribute_by_name method. ( fixes #5561 )
2015-04-21 16:08:15 +02:00
Anthony Ramine
eea80034e6
Implement NamedNodeMap::removeNamedItem*()
2015-04-07 22:34:56 +02:00
Anthony Ramine
70ccd8a02a
Rename name in NamedNodeMap::GetNamedItemNS()
2015-04-07 19:02:50 +02:00