Commit graph

59 commits

Author SHA1 Message Date
Anthony Ramine
fedad2af1f Improve support of limited unsigned long attributes 2015-05-06 20:18:08 +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
Ms2ger
e8b02acb1d Pass Atom to Attr:new for the prefix argument. 2015-04-27 12:20:23 -07:00
Ms2ger
89a0c004d5 Store an Atom for Attr::prefix. 2015-04-27 11:51:13 -07:00
Anthony Ramine
afafde5191 Change MutNullableJS<T> to MutNullableHeap<JS<T>> 2015-04-27 10:45:38 +02:00
Ms2ger
a862479ca8 Remove as_slice() calls from script. 2015-04-26 10:52:55 +02:00
Ms2ger
41cc0a939e Replace the Str implementation for AttrValue by a Deref implementation. 2015-04-25 15:24:27 +02:00
Ms2ger
4108af0c11 Introduce AttrValue::atom(). 2015-04-25 15:13:03 +02:00
Ms2ger
dd9351d722 Parse attributes according to the specification in AttrValue::from_u32.
This exposes another bug: "-0" failed to parse with str.parse(), and is now
successfully parsed into 0. However, input.size and textarea.{rows, cols} are
supposed to be "limited to only non-negative numbers greater than zero", so 0
is not actually supposed to be accepted.
2015-04-20 10:51:44 +02:00
Anthony Ramine
254207730e Make Element::get_attribute() take its namespace by reference 2015-04-06 14:31:27 +02:00
Anthony Ramine
d3d12e6324 Make attributes lose their owner when removed 2015-04-04 17:39:39 +02:00
Corey Farwell
d838fcce30 Remove some unnecessary uses of as_slice
For the majority of these cases, `as_slice` can be removed due to
`Deref`. In particular, `Deref` for:

* `String` -> `str`
* `Atom` -> `str`

The latter of those two requires, a bump of the locked `string-cache`
library
2015-03-29 14:42:19 -04:00
Corey Farwell
3a5c94cf70 Cleanup and modernize script::dom::attr
* Wrap lines longer than 100 characters
* Add whatwg specification links for official methods
* Other misc cleanup/modernization
2015-03-28 15:11:54 -04:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01: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
Ms2ger
a094c0a7f3 Remove unsound Root::deref() call in Attr::set_value.
This changes those calls whose unsoundness was not picked up by the type system
because of a lifetime constraint that cannot be expressed at this time.
2015-01-01 20:36:44 +01: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
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
Bruno de Oliveira Abinader
8859286a99 Added AttrValue::from_atomic_tokens & Element::set_atomic_tokenlist_attribute 2014-12-26 14:55:26 -04:00
Bruno de Oliveira Abinader
c5f7e553e4 Avoid duplicated tokens in AttrValue::from_serialized_tokenlist 2014-12-26 13:08:20 -04:00
Bruno de Oliveira Abinader
eb3678fa28 AttrValue's s/from_tokenlist/from_serialized_tokenlist/ 2014-12-26 13:08:20 -04:00
Tetsuharu OHZEKI
a7bb436177 script: Remove glob imports added in #4405 2014-12-19 04:52:48 +09:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Michael Booth
2cbf5a3671 Updated reflect_dom_object to be passed by value 2014-11-30 19:47:52 +00:00
Rohan Prinja
4b754bd457 implement Document#createAttribute 2014-11-23 14:51:04 +05:30
Matthew Rasmus
73721cd189 Implement Attr#nodeValue
Fixes #4047
2014-11-20 13:18:10 -08:00
Ms2ger
86d609abaf Use RefCell in DOMRefCell to reduce duplicated code. 2014-11-14 21:18:43 +01:00
Tom Schuster
96e42feaa1 Implement the whole Attr interface 2014-11-07 14:36:57 +01:00
Bruno de Oliveira Abinader
bbab8831e0 Usage of JSRef<Attr> in before_remove_attr & after_set_attr
JSRef<Attr> does not require allocating a DOMString for value, which are
unused in most cases. It also provides more access to Attr data.
2014-10-22 11:13:58 -04:00
Manish Goregaokar
3f2cbb275b Use #[dom_struct] everywhere 2014-10-16 10:20:18 +05:30
Tetsuharu OHZEKI
2d5d1e36ad Use DOMRefCell<T> in Attr. 2014-10-15 13:41:03 +09:00
Patrick Walton
ee2ccc4f87 script: Use atom comparison in more places, especially for attributes.
75% improvement in style recalc for Guardians of the Galaxy.
2014-10-14 10:32:40 -07:00
Tim Taubert
78fef7eec5 Privatize Attr 2014-10-13 13:18:57 +02:00
Tim Taubert
35f8270c64 Remove unnecessary deref()s (fixes #3586) 2014-10-09 15:01:54 +02:00
Manish Goregaokar
b908d5accb Remove Traceable from attr.rs 2014-10-05 21:12:26 +05:30
Keegan McAllister
d50114c41d Use string-cache's Namespace type 2014-09-29 21:40:54 -07:00
Keegan McAllister
6429750b33 Eliminate servo_util::atom
We only needed this for Encodable, and now we use JSTraceable instead.
2014-09-29 18:39:36 -07:00
Simon Sapin
b3245fa407 Upgrade to rustc d2b30f7d3 2014-09-23 2014-09-29 17:41:45 +01:00
Cameron Zwarich
2789750f66 Make the AttrHelpers trait use extended_deref 2014-09-26 18:38:36 -07:00
Manish Goregaokar
cc44a3b064 Use JSTraceable everywhere 2014-09-24 05:44:49 +05:30
Cameron Zwarich
d768ee77ad Convert various helper traits from &JSRef to JSRef
I converted them all with a few exceptions:

- Methods that were used by trait objects, since trait objects don't
  work with `self` methods.
- Methods that take an &'b JSRef<'a, T> and return an &'b. In reality,
  many (all?) could return an &'a instead, but this isn't allowed by the
  Deref trait.
- Methods that internally rely on the same issue with Deref.
- I left out the traits involved in layout entirely, even though not all
  of their methods suffer from one of the above problems.

There will probably be solutions to all of these problems in the future.
2014-09-20 11:54:11 -07:00
Cameron Zwarich
2c8d51a37c More progress in the &JSRef -> JSRef conversion
Change all of the <Class>Methods traits to take `self` instead of
`&self`.
2014-09-20 11:54:10 -07:00
Cameron Zwarich
4fa8725111 First steps of &JSRef -> JSRef conversion
Replace &JSRef with JSRef in the bulk of the generated code. This will
remove a level of indirection throughout all DOM code.

This patch doesn't change methods implemented on JSRef<T> to take `self`
rather than `&self`, and it leaves a few other uses of &JSRef, but those
changes can be made incrementally.
2014-09-19 13:39:17 -07:00
Josh Matthews
fae7ce3c1d Retrieve some basic layout properties for nodes to make the box model somewhat useful. 2014-09-18 15:07:11 -04:00