Eli Friedman
5bdf6bb1d3
Fix remaining MutHeap methods not to expose JS<T>.
2015-10-15 14:03:57 -07: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
Corey Farwell
4dc8fd76ec
Consolidate magic number representing max unsigned long
2015-10-10 13:46:11 -04:00
bors-servo
1029feb55d
Auto merge of #7841 - frewsxcv:htmlbodyelement-text, r=nox
...
Implement <body>'s "text" attribute
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7841 )
<!-- Reviewable:end -->
2015-10-09 06:11:46 -06: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
Corey Farwell
64f4835a4f
Implement <body>'s "text" attribute
2015-10-08 10:55:12 -04:00
Corey Farwell
770e3bab35
Add doc-comments about methods that can panic
...
https://github.com/servo/servo/pull/7683/files#r40072222
2015-09-30 22:51:30 -04:00
Corey Farwell
74e4c4fdc7
Implement size
attribute for <font> element
2015-09-30 22:51:30 -04: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
Manish Goregaokar
54c036cd66
Elide most 'a lifetimes
2015-09-04 08:55:51 +05:30
Prabhjyot Singh Sodhi
105ea0d690
renaming tokens(), atom() and uint() and rewriting to return or panic
2015-09-02 22:20:33 +05:30
Anthony Ramine
58e1bd0e57
Introduce VirtualMethods::attribute_mutated()
...
This replaces before_remove_attr(), after_remove_attr() and after_set_attr().
The virtual method takes the mutated attribute and an AttributeMutation value
to disambiguate between "attribute is changed", "attribute is added" and
"attribute is removed".
In the case of "attribute is changed", the mutation value contains a reference
to the old value of the mutated attribute, which is used to unregister outdated
named elements when the "id" attribute is changed on an element.
This greatly simplifies the handling of attributes, which in many cases don't
have any specific behaviour whether they are removed or changed or added. It
also fixes a few bugs where things were put in before_remove_attr() instead of
after_remove_attr() (e.g. when removing an href attribute from a base element).
A few helper functions in Element were also renamed and made private.
2015-09-02 15:45:38 +02: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
Johann Tuffe
ec07178b6f
sort all uses
2015-08-20 20:47:12 +08:00
Bogdan Cuza
45145108da
Measure heap memory usage for more types. Fixes #6951
2015-08-13 21:44:41 +03:00
Corey Farwell
7159fe749f
Create and utilize utility for joining strs
2015-07-08 05:18:07 +09:00
Corey Farwell
9b2ba3d713
Join Atoms without requiring intermediate Vec
...
Related to: https://github.com/servo/string-cache/pull/89
2015-07-08 04:42:49 +09:00
Corey Farwell
a985ee4f19
Utilize iterators for AttrValue::from_serialized_tokenlist
2015-07-04 21:54:45 -07:00
David Winslow
4cf46bff2d
Refactor #[jstraceable] to #[derive(JSTraceable)]
...
fixes #6524
2015-07-01 18:27:06 -04:00
Ms2ger
c019897a50
Implement AttrHelpersForLayout for LayoutJS<Attr> rather than Attr itself.
2015-06-20 18:51:25 +02:00
Michael Wu
675267b782
Upgrade to SM 39
2015-06-19 18:42:48 -04:00
Patrick Walton
1a3395e077
script: Implement the width
and height
attributes for iframes per
...
HTML5 § 4.8.6.
Improves Amazon and Ars Technica.
2015-05-20 11:15:25 -07:00
Ms2ger
1b99fd7ecb
Implement get_attr_for_layout that returns an AttrValue.
2015-05-12 13:02:50 +02:00
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