Commit graph

212 commits

Author SHA1 Message Date
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
Corey Farwell
5ccb0d43ef Merge adjacent identical impl sections
Prior to #7416 and #7401, many of these `impl` sections were not
identical
2015-08-28 10:30:42 -04:00
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
Manish Goregaokar
b33c5427bc Remove doublepointer in VirtualMethods, and from_borrowed_ref
Most of the heavy lifting done by:

```
$ ls *rs | xargs gawk -i inplace '/let .*: &&.*from_borrowed_ref/{sub("&&", "\\&");sub("_borrowed_","_");} {print $0}'
$ ls *rs | xargs gawk -i inplace "/impl.*VirtualMethods/{in_vm=1; sub(/<'a>/,\"\");sub(/&'a /,\"\")} /^}\$/{in_vm=0;} in_vm{\$0=gensub(/\\*self([^.])/,\"self\\\1\",\"g\"); sub(/from_borrowed_ref/,\"from_ref\")} {print}"
```
2015-08-27 02:14:48 +05:30
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
bors-servo
ff6a70fad3 Auto merge of #7241 - Wafflespeanut:event_handler, r=Ms2ger
Matching over event listeners and handlers; r=Ms2ger

... for #7065

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7241)
<!-- Reviewable:end -->
2015-08-18 06:49:26 -06:00
Ravi Shankar
f3db59972a Matching over event listeners and handlers; r=Ms2ger
fixup! Matching over event listeners and handlers; r=Ms2ger
2015-08-18 18:11:57 +05:30
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
Josh Matthews
8620fe5995 Start reporting memory usage for Window and all nodes in all DOM trees for frame treese in script tasks. 2015-08-03 23:05:00 -04:00
Bogdan Cuza
233a769c67 Add spec links 2015-07-28 13:28:41 +02:00
farodin91
27e760e28d Implement FileReader.{readAsText,readAsDataUrl}. Fixes #6172 2015-07-23 22:33:51 +02: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
Ms2ger
c9f50f41b5 Stop using position_elem.
It is unstable and not really better than the stable alternative.
2015-06-27 23:39:21 +02:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
bors-servo
c3d242544e Auto merge of #6308 - pcwalton:debloat-partialeq, r=nox
This makes the difference between selector matching scaling on the ARM
Cortex-A9 and not, because the auto-derived `PartialEq` implementation
blows out the 32KB I-cache. With this change, there is a 2x improvement
in selector matching over sequential when using all 8 cores. (More work
needs to be done; this is a start.)

r? any DOM expert

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6308)
<!-- Reviewable:end -->
2015-06-12 21:04:05 -06:00
Patrick Walton
8c210e1a27 script: Make PartialEq on element type IDs generate a lot less code.
This makes the difference between selector matching scaling on the ARM
Cortex-A9 and not, because the auto-derived `PartialEq` implementation
blows out the 32KB I-cache. With this change, there is a 2x improvement
in selector matching over sequential when using all 8 cores. (More work
needs to be done; this is a start.)
2015-06-12 15:00:02 -07:00
Corey Farwell
4f47b41fa7 Remove fnv & smallvec crate reexports from util
The util component specified fnv and smallvec as dependencies and publicly
reexported both of them. Several other components utilized these reexports,
presumably because fnv and smallvec used to live in the tree so reexporting
made the transition easier.

These indirect dependencies through the util component are unnecessary.

This commit removes the fnv & smallvec crate reexports in the util component.
It exchange, it adds fnv & smallvec as dependencies to non-util components
wherever needed. Finally, it removes the fnv dependency from util as it is not
utilized anywhere in the util component.
2015-06-10 07:14:55 -07:00
Philipp Hartwig
ab4059ca21 Use byte string instead of handcrafted byte array 2015-05-25 20:57:16 +02:00
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02:00
Ms2ger
a862479ca8 Remove as_slice() calls from script. 2015-04-26 10:52:55 +02:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Ms2ger
1604515fd9 Fix various build warnings. 2015-03-20 17:57:49 +01:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04: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
Ms2ger
f8ac1777ff Don't shadow lifetimes in script. 2015-01-28 13:48:28 +01:00
Josh Matthews
7fec73a432 Fix crash due to address significance for JSAPI things. 2015-01-28 01:13:32 +00: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
Ms2ger
edc1d89251 Deny unsafe blocks in script.
As a first start, this allows them indiscriminately where used.
2015-01-09 10:13:25 +01:00
Matthew Rasmus
020a767849 Fix Equiv related deprecation warnings
...except where we have our own implementations of Equiv.
2015-01-08 08:51:11 -08:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Ms2ger
43eecf6e7a Stop using ptr.is_not_null() in script.
This method is deprecated in rust master; removing its users in advance will
make a future rust upgrade smoother.
2015-01-01 22:19:34 +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
Manish Goregaokar
21a888341d Ensure that Reflectors are the first field 2014-12-27 02:53:36 +05:30
Manish Goregaokar
7d65673561 Remove extra spaces
Command: `find . -maxdepth 1 -type f -print0 | xargs -0 sed -z -i "s/}\\n\\n\\n/}\\n\\n/"`
2014-12-27 02:53:35 +05:30
Manish Goregaokar
552db382d6 Remove manual impls of Reflectors (autogen)
Obtained via:

 `find . -maxdepth 1 -type f -print0 | xargs -0 sed -z -i "s/\\nimpl Reflectable for[^{]*{[^}]*}[^}]*}\\n//"`
 `find . -maxdepth 1 -type f -print0 |xargs -0  grep -lZ dom_struct | xargs -0 grep -LZ  "reflector()\\|Reflector::new" |xargs -0 sed -z -i "s/use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};/use dom::bindings::utils::reflect_dom_object;/"`

followed by semi-automated removal of leftover imports
2014-12-27 02:52:33 +05:30
Ms2ger
bce3b172e7 Make the argument to dispatch_event_with_target non-optional.
The name of the method makes it clear it's supposed to be used with a target
override, so we might as well enforce that.
2014-12-19 11:34:11 +01:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
thiagopnts
79487252ca Add auxiliary method to EventTargetHelpers for events without target
fixup! Add auxiliary method to EventTargetHelpers for events without target
2014-12-16 10:01:38 -02:00
Hinali Marfatia
b1d6041420 Implement a basic WebSocket interface. 2014-11-25 15:43:22 +01:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Patrick Walton
a94e13f888 script: Use an FNV hash to hash event listeners.
The security properties of SipHash are irrelevant for event listeners
and the creation of the random number generator was showing up high in
the profiles.
2014-10-28 11:34:06 -07:00
Tetsuharu OHZEKI
752c821e43 Use DOMRefCell for EventTarget. 2014-10-22 10:01:00 +09:00
Manish Goregaokar
3f2cbb275b Use #[dom_struct] everywhere 2014-10-16 10:20:18 +05:30
Tim Taubert
cd9de05088 Privatize Event 2014-10-13 13:25:44 +02:00