aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/event.rs
Commit message (Collapse)AuthorAgeFilesLines
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
* Remove use of unstable box syntax.Simon Sapin2017-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* Rename Root<T> to DomRoot<T>Anthony Ramine2017-09-261-9/+9
| | | | | | | 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.
* Rename DOMRefCell<T> to DomRefCell<T>Anthony Ramine2017-09-261-3/+3
| | | | | | | | 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.
* Rename MutNullableJS<T> to MutNullableDom<T>Anthony Ramine2017-09-261-3/+3
|
* Rename JS<T> to Dom<T>Anthony Ramine2017-09-261-3/+3
|
* Rename dom::bindings::js to dom::bindings::rootAnthony Ramine2017-09-261-1/+1
|
* Derive the Default trait for dictionaries containing GC values.Josh Matthews2017-09-251-0/+9
|
* Introduce TaskOnceAnthony Ramine2017-09-201-5/+5
| | | | | Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing from CancellableTask<T>.
* Rename Task to TaskBoxAnthony Ramine2017-09-201-5/+5
|
* Move Task to its own moduleAnthony Ramine2017-09-181-1/+1
|
* Rename Runnable to TaskAnthony Ramine2017-09-161-7/+7
| | | | | | | | | | | | The changes are: * `*Runnable` -> `*Task`; * `RunnableMsg` -> `Task`; * `RunnableWrapper` -> `TaskCanceller`; * `MainThreadRunnable` -> `MainThreadTask`; * `wrap_runnable` -> `wrap_task`; * `get_runnable_wrapper` -> `task_canceller`; * `handler` -> `run`; * `main_thread_handler` -> `run_with_script_thread`.
* move name implementation as default implementation to the trait and remove ↵toidiu2017-09-031-4/+0
| | | | overrides.
* order derivable traits listsClément DAVID2017-08-231-4/+4
| | | | | | Ignoring : - **generated**.rs - python/tidy/servo_tidy_tests/rust_tidy.rs
* Make #[dom_struct] a proc_macro attributeAnthony Ramine2017-02-241-0/+1
|
* Remove some convenience methods on EventAnthony Ramine2017-01-221-64/+22
| | | | They don't need to exist anymore now that dom::eventdispatcher has been removed.
* Inline dom::eventdispatcher into dom::eventAnthony Ramine2017-01-221-91/+276
|
* Change event cancellation from bool to an enumRavi Shankar2016-12-271-5/+37
|
* Remove HeapGCValueAnthony Ramine2016-12-121-3/+3
| | | | | | It could be used to have mutable JSVal fields without GC barriers. With the removal of that trait, MutHeap and MutNullableHeap can respectively be replaced by MutJS and MutNullableJS.
* remove extra clones from dom event scriptJake Goldsborough2016-11-051-2/+2
|
* Migrate `EventTarget` event firing functions to use `Atom`s.Corey Farwell2016-11-031-2/+4
| | | | This allows us to utilize more `atom` macros.
* Remove "fire a simple event" concept, refactor event firing API.Corey Farwell2016-11-031-2/+2
| | | | | "fire a simple event" concept was removed in https://github.com/whatwg/html/pull/1933.
* Update to string-cache 0.3Simon Sapin2016-11-031-1/+1
|
* Pass a &GlobalScope to WebIDL static methods and constructorsAnthony Ramine2016-10-061-3/+2
|
* Make reflect_dom_object take a &GlobalScopeAnthony Ramine2016-10-061-3/+4
|
* Return an enum instead of a boolean from dispatch_eventAdolfo Ochagavía2016-09-261-1/+9
| | | | Fixes #13196
* Fix step 10 of eventdispatcher::dispatch_event (fixes #11609)Anthony Ramine2016-08-241-7/+16
| | | | | We consolidate steps 10-12 in a single function to expose less general-purpose mutating methods on Event.
* Add event runnablesConnor Brewster2016-07-111-2/+36
| | | | Make tasks a wrapper over runnables
* Move DOMString back to scriptAnthony Ramine2016-05-241-1/+1
| | | | This entirely removes the 'non-geckolib' feature of the util crate.
* implement and use From<bool> for enum and backAlexander Popiak2016-03-171-3/+39
| | | | | implement and use From<bool> for EventBubbles (and back direction) implement and use From<bool> for EventCancelable (and back direction)
* Implement From<DOMString> for AtomAnthony Ramine2016-02-241-2/+2
|
* Pass around event types as Atoms instead of StringsCorey Farwell2015-12-101-16/+20
| | | | | | `Event` internally stores the `type` as an `Atom`, and we're `String`s everywhere, which can cause unnecessary allocations to occur since they'll end up as `Atom`s anyways.
* Update string_cache to 0.2.Alan Jeffrey2015-11-251-1/+1
| | | | | | | | | | | 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.
* Replaced DOMString constructor by conversion functions.Alan Jeffrey2015-11-121-2/+1
| | | | | | Replaced DOMString(...) by DOMString::from(...). Replaced ....0 by String::from(...). Removed any uses of .to_owner() in DOMString::from("...").
* Make DOMString a newtype around String, rather than a typedef.Ms2ger2015-11-041-1/+1
| | | | | | | | | | 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.
* Get rid of a bunch of explicit derefsDavid Zbarsky2015-11-031-1/+1
|
* merge from masterrohan.prinja2015-11-031-6/+12
|\
| * Use an Atom for Event.typeDavid Zbarsky2015-11-011-4/+10
| |
| * Initialize dom struct fields in declaration orderMichael Wu2015-10-301-3/+3
| |
* | more refactoringrohan.prinja2015-10-301-1/+1
|/
* remove get_rooted() and replace all references to it with references to get()rohan.prinja2015-10-291-2/+2
|
* Make get() and set() on MutNullableHeap use the correct types.Eli Friedman2015-10-151-2/+2
| | | | | | get() must always return a rooted value, because we have no way of ensuring the value won't be invalidated. set() takes an &T because it's convenient; there isn't any need to expose JS<T>.
* Generate the TypeId enums in codegenAnthony Ramine2015-10-141-23/+2
|
* Refactor away duplication of get_rooted functionalityPierre Chevalier2015-10-081-2/+2
| | | | | | | | | | | | | | Refactor .get().map(Root::from_rooted) and .get().map(|foo| foo.root()) to .get_rooted() on MutNullableHeap objects. First part done mechanically with the following comand: sed -i s/"get().map(Root::from_rooted)"/"get_rooted()"/g *.rs Second part done manually after finding them with git grep ".get().map(" Fixes 7929.
* webgl: Implement WebGLContextEvent and use it on context creation errorEmilio Cobos Álvarez2015-10-081-1/+2
| | | | spec: https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
* Fix reported test-tidy errors for unmerged import blocksBrandon Fairchild2015-09-191-3/+1
| | | | This merges import blocks that were reported by tidy as unmerged.
* Add more assertions to dispatch_event.Ms2ger2015-09-161-1/+6
|
* Elide most 'a lifetimesManish Goregaokar2015-09-041-1/+1
|
* Make the traits for the IDL interfaces take &selfAnthony Ramine2015-08-271-14/+14
|
* Remove helper traitsAnthony Ramine2015-08-271-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.