Anthony Ramine
409b5e3695
Return a reference in Document::window()
2015-10-19 09:36:52 +02:00
Anthony Ramine
e889b0914b
Do not root Document::window
2015-10-19 09:36:51 +02:00
Bobby Holley
75ec093334
Move Event States to |Element|.
...
Conceptually they belong there, rather than on |Node|.
Fixes #7934 .
2015-10-16 17:56:31 -07:00
Anthony Ramine
264e943597
Return a reference in BrowserContext::frame_element()
2015-10-17 02:17:25 +02:00
Anthony Ramine
1f31d5b856
Return a reference in BrowserContext::active_document()
2015-10-17 02:07:52 +02:00
Eli Friedman
9de42c8935
Simplify extracting a reference from an Option<Root<T>>, per review comments.
2015-10-15 14:03:58 -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
Anthony Ramine
7d6ea83479
Explicitly customise flags of new nodes where needed
...
Given codegen now generates the various TypeId enums, it seems pointless to
still have to write their respective values in every DOM struct inheriting from
Node just to set the initial IS_IN_DOC flag in Document and IN_ENABLED_STATE in
form controls.
2015-10-15 17:30:41 +02:00
Anthony Ramine
617fc08783
Generate all Derived implementations in codegen
2015-10-14 22:04:20 +02:00
Anthony Ramine
aab2c40389
Generate the TypeId enums in codegen
2015-10-14 18:45:35 +02:00
Eli Friedman
fa606bf1c8
Link to the HTML multipage spec, not the single-page one.
2015-10-13 11:48:51 -07: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
Anthony Urena
ba86131cd5
Refactor Error enum usage to consistently be qualified
2015-10-06 05:43:52 -04:00
Corey Farwell
f14f09e886
Use util::str::str_join in more places
...
Instead of intermediate allocations of `Vec`s, we should utilize
`str_join` which operates on iterators
2015-09-28 19:57:06 -04:00
Patrick Walton
5dce5f0c97
script: Stop copying the document URL.
2015-09-24 18:54:53 -07:00
Ravi Shankar
889eec364b
sorted the extern crate, mod & use declarations
2015-09-24 02:12:45 +05:30
Corey Farwell
83333e972c
Add/update spec links for SupportedPropertyNames methods
2015-09-20 11:48:14 -04: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
João Oliveira
832cfac747
rewrite uses of map as if let
...
closes #7580
2015-09-15 02:51:59 +01:00
bors-servo
5a0be12e43
Auto merge of #7531 - nox:template, r=Ms2ger
...
Implement <template>
All tests using iframes can't currently pass, same for innerHTML-related tests with <template> elements. The latter contradicts the spec, see the links below.
Apart from this, they work, AFAICT.
https://github.com/servo/html5ever/issues/164
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27314
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7531 )
<!-- Reviewable:end -->
2015-09-08 02:29:00 -06:00
Anthony Ramine
a7476a758e
Bump html5ever to 0.2.4, <template> support!
...
The failing <img> test comes from the now-correct parsing of <font face> elements
in SVG.
2015-09-08 10:28:21 +02:00
Tetsuharu OHZEKI
63627405d9
script: change requestAnimationFrame returns the unsigned long type.
2015-09-04 15:40:30 +09:00
Prabhjyot Singh Sodhi
105ea0d690
renaming tokens(), atom() and uint() and rewriting to return or panic
2015-09-02 22:20:33 +05:30
bors-servo
eaf90c0b1c
Auto merge of #7452 - nox:cleanup-attributes, r=nox
...
Introduce VirtualMethods::attribute_mutated()
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7452 )
<!-- Reviewable:end -->
2015-09-02 08:14:33 -06:00
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
Corey Farwell
3a1d140ab5
Enforce linking to spec for method implementations via macros
2015-08-31 21:02:23 -04:00
Anthony Ramine
105d990845
Replace many uses of to_ascii_lowercase() by make_ascii_lowercase()
2015-08-30 15:30:00 +02:00
bors-servo
72125f070d
Auto merge of #7391 - jdm:prefs, r=Ms2ger
...
Replace catch-all experimental flag with fine-grained boolean prefere…
…nces initialized from a JSON document.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7391 )
<!-- Reviewable:end -->
2015-08-28 10:08:32 -06:00
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
Josh Matthews
a3ee9b5dd9
Replace catch-all experimental flag with fine-grained boolean preferences initialized from a JSON document.
2015-08-28 10:30:04 -04:00
Anthony Ramine
709d347872
Make the traits for the IDL interfaces take &self
2015-08-27 22:27:43 +02:00
bors-servo
8c301c291a
Auto merge of #7389 - frewsxcv:implement-nihilistic-methods, r=nox
...
Implement 'do nothing' methods on Window and Document
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7389 )
<!-- Reviewable:end -->
2015-08-27 12:30:28 -06:00
Corey Farwell
bf50145fbd
Implement 'do nothing' methods on Window and Document
2015-08-27 13:13:10 -04: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
Corey Farwell
b11be4d253
Initial implementation of ownPropertyKeys proxy handler
...
Generates `SupportedPropertyNames` on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of `HTMLCollection`. Also added a couple
relevant WPT tests.
Closes #6390
Closes #2215
2015-08-20 11:58:42 -04:00
Johann Tuffe
ec07178b6f
sort all uses
2015-08-20 20:47:12 +08:00
bors-servo
70b9922eb0
Auto merge of #7260 - notriddle:issue_7169, r=Ms2ger
...
Navigate to a new page even when there's a fragment.
Closes #7169
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7260 )
<!-- Reviewable:end -->
2015-08-19 01:40:28 -06:00
Michael Howell
af31e8ed0f
Navigate to a new page even when there's a fragment.
...
Closes #7169
2015-08-18 17:35:09 -07:00
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
vectorijk
14ac1ef75a
remove ScriptListener
...
ref #7175
2015-08-16 01:34:55 -07:00
João Oliveira
0038580abf
Replace uses of for foo in bar.iter()
and for foo in bar.iter_mut()
...
closes #7197
2015-08-15 02:27:39 +01:00
João Oliveira
9c11781880
replace .len() == 0 with is_empty()
...
closes #7198
2015-08-14 04:00:33 +01:00
bors-servo
a03616f379
Auto merge of #7097 - boghison:memtypes, r=jdm
...
Measure heap memory usage for more types. Fixes #6951
Also adds HeapSizeOf implementations/derive for some types. I've used "Cannot calculate Heap size" as a reason everywhere, because my imagination is rather limited. If you'd like me to change this message for specific types, please write something like this: "Trusted - Cannot calculate Heap size for Trusted" so that it would be easier for me to replace them through a script :)
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7097 )
<!-- Reviewable:end -->
2015-08-13 13:16:14 -06:00
Bogdan Cuza
45145108da
Measure heap memory usage for more types. Fixes #6951
2015-08-13 21:44:41 +03:00
bors-servo
f3b7c5cb4b
Auto merge of #7132 - jdm:docenum, r=ms2ger
...
Document the use and meaning of the devtools control messages. Fixes …
…#6922.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7132 )
<!-- Reviewable:end -->
2015-08-13 12:41:48 -06:00
Josh Matthews
e59de75608
Simplify devtools frame marker notification. Record each frame tick based on a single message sent from the script task that ticked.
2015-08-12 00:59:58 -04:00
bors-servo
0c5158587d
Auto merge of #6757 - mskrzypkows:document_hasFocus, r=jdm
...
Implementing document.hasFocus method, needs tests. #6475
I'm not sure if I have to implement some test for a new document method. As I remember there were tests for document methods, is it changed now? Where should I add tests?
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png " height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6757 )
<!-- Reviewable:end -->
2015-08-11 15:35:21 -06:00
Maciej Skrzypkowski
07c0cd8a18
Implementing document.hasFocus method. #6475
2015-08-10 21:23:09 +02:00