Commit graph

72 commits

Author SHA1 Message Date
Connor Brewster
afc0ccb48d Add event runnables
Make tasks a wrapper over runnables
2016-07-11 22:21:45 -06: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
Alexander Popiak
0a5ac3b207 implement and use From<bool> for enum and back
implement and use  From<bool> for EventBubbles (and back direction)
implement and use From<bool> for EventCancelable (and back direction)
2016-03-17 22:50:22 +01:00
Anthony Ramine
0adfb08089 Implement From<DOMString> for Atom 2016-02-24 17:52:17 +01:00
Corey Farwell
4accaf50b2 Pass around event types as Atoms instead of Strings
`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.
2015-12-10 23:47:25 -05: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
David Zbarsky
722aa86c89 Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
David Zbarsky
0070adb71f Use an Atom for Event.type 2015-11-01 09:42:11 -08:00
Michael Wu
434a5f1d8b Initialize dom struct fields in declaration order 2015-10-30 15:40:43 -04:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
rohan.prinja
4a4f041948 remove get_rooted() and replace all references to it with references to get() 2015-10-29 21:48:39 +09:00
Eli Friedman
57584e74c6 Make get() and set() on MutNullableHeap use the correct types.
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>.
2015-10-15 14:03:56 -07:00
Anthony Ramine
aab2c40389 Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
Pierre Chevalier
8b5fe88bd3 Refactor away duplication of get_rooted functionality
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.
2015-10-08 23:12:20 +01:00
Emilio Cobos Álvarez
7030f09823 webgl: Implement WebGLContextEvent and use it on context creation error
spec: https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
2015-10-08 00:29:31 +02:00
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
Ms2ger
b342dff07d Add more assertions to dispatch_event. 2015-09-16 14:48:36 +02:00
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
Anthony Ramine
709d347872 Make the traits for the IDL interfaces take &self 2015-08-27 22:27:43 +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
wilmoz
d3c60af5c6 Make EventTypeId reflect DOM inheritance hierarchy 2015-08-18 14:04:28 -05:00
Bogdan Cuza
45145108da Measure heap memory usage for more types. Fixes #6951 2015-08-13 21:44:41 +03:00
David Zbarsky
bc1eb97671 Remove some more unnecessary let bindings 2015-07-14 14:48:16 -04:00
David Winslow
4cf46bff2d Refactor #[jstraceable] to #[derive(JSTraceable)]
fixes #6524
2015-07-01 18:27:06 -04:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
William Galliher
5afec62f07 Implement incomplete opening, sending, and closing behaviour for WebSockets using rust-websocket.
Authors:
Shivaji Vidhale <savidhal@ncsu.edu>
William Galliher <wpgallih@ncsu.edu>
Allen Chen <achen4@ncsu.edu>
Rucha Jogaikar <rsjogaik@ncsu.edu>
2015-05-05 12:17:35 -04:00
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02: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
Anthony Ramine
afafde5191 Change MutNullableJS<T> to MutNullableHeap<JS<T>> 2015-04-27 10:45:38 +02:00
Ms2ger
49393a8762 Update some URLs.
The HTML spec's division into pages is not stable, so it is safer to use the
URL without a specific page (which will redirect).
2015-04-14 10:44:51 +02:00
Corey Farwell
82335a1904 Spec links for script::dom::element & script::dom::event 2015-04-09 10:16:10 -07:00
snf
db6aeef2ef implementing StorageEvent interface 2015-03-24 18:03:06 +00:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
James Gilbertson
0b085df1bc Implement 'beforescriptexecute' and 'afterscriptexecute' events.
Spec: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block, sections 2.b.2 & 2.b.9
2015-02-25 15:37:54 -07:00
Ms2ger
a65a1088a4 Change the representation of EventPhase to u16.
This matches the IDL definitions.
2015-02-20 14:45:46 +01:00
Gilles Leblanc
a1804effaf Initialize trusted-ness of DOM events properly
Fixes #3740
2015-02-03 21:40:07 -05:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
01ed338746 Move to to_owned rather than into_string.
into_string has been removed from Rust.
2015-01-20 14:49:07 +01:00
bors-servo
7800d98728 auto merge of #4566 : mattnenterprise/servo/globalref-by-value, r=Ms2ger 2015-01-08 13:12:55 -07:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Matt McCoy
85df7f0d6f Fixes #4164 Make Constructor and new functions take GlobalRef by value 2015-01-07 18:52:41 -05:00
Ms2ger
1dad710063 Replace Root::deref() calls by Root::r() calls where possible.
This changes those calls that were already sound.
2015-01-01 20:36:43 +01:00
bors-servo
56d1b16d1b auto merge of #4173 : Manishearth/servo/a-more-dom-struct, r=kmcallister
Now `#[dom_struct]` also generates Reflectable impls, and there's another lint to ensure that a DOM struct only contains one bare DOM field (as the first field) or a Reflector.

A lot of this was generated by sed -- each autogenerated change has its own commit for easy review; these will be squashed later.
2014-12-27 22:12:45 -07:00
Manish Goregaokar
e9d1740e19 script: to_string() -> into_string() 2014-12-27 14:48:36 +01:00