Commit graph

904 commits

Author SHA1 Message Date
bors-servo
bdcd8dd0c2 auto merge of #2111 : jdm/servo/browsercontext, r=Ms2ger 2014-04-22 11:01:18 -04:00
Josh Matthews
94dffca1e1 Remove all traces of WindowProxy. Implement basic browser context concept and outerizing of inner windows. 2014-04-22 10:57:25 -04:00
Tetsuharu OHZEKI
cdbe179acb Make Attr handles all setting value. 2014-04-22 16:15:15 +09:00
Tetsuharu OHZEKI
b2fa6fa221 Make Attr::SetValue to reflect attribute change. 2014-04-22 16:15:15 +09:00
Tetsuharu OHZEKI
a74397432e Make Attr::SetValue uses the internal setter. 2014-04-22 16:15:15 +09:00
bors-servo
3c175c7ac0 auto merge of #2195 : lpy/servo/issue2190, r=Ms2ger
see #2190
2014-04-21 16:49:28 -04:00
bors-servo
73a0658b8a auto merge of #2196 : hazz/servo/initevent, r=Ms2ger
Should fix #2189

This is my first PR for servo (and first time using Rust), so apologies if anything is horribly wrong.
2014-04-21 16:22:25 -04:00
bors-servo
f864d21212 auto merge of #2072 : brunoabinader/servo/domimpl-createdocument, r=Ms2ger
Spec:
http://dom.spec.whatwg.org/#dom-domimplementation-createdocument

Closes #1509.
2014-04-21 15:58:27 -04:00
bors-servo
c760577aee auto merge of #2199 : sankha93/servo/prefix-impl, r=Ms2ger
See #1737.

r? @ms2ger
2014-04-21 15:31:36 -04:00
Sankha Narayan Guria
36bf23de20 Implement Element.prefix (Fixes #1737) 2014-04-22 00:27:06 +05:30
Bruno de Oliveira Abinader
41898f0a76 Implement DOMImplementation::createDocument
Spec:
http://dom.spec.whatwg.org/#dom-domimplementation-createdocument

Closes #1509.
2014-04-21 09:30:36 -03:00
Ms2ger
4f9e119334 Remove JSPageInfo::js_compartment.
A js::rust::Compartment is little more than a glorified pointer to the
reflector of a window, so there's no good reason to use it. Instead, this
commit passes a JS<Window> directly when it's necessary.

This also means that we now have to use JS_DefineFunctions rather than
Compartment::define_functions; I believe the former is clearer to the reader
than the extra indirection involved in the latter calling through three
reopsitories.

This commit also simplifies ScriptTask::load to reuse the 'cx' local that is
in scope already, rather than refetching it through js_info.
2014-04-21 13:43:18 +02:00
Harry Maclean
7dbf69c223 set the right flags and attrs for InitEvent 2014-04-20 19:23:55 +01:00
lpy
fd9541357f Implement CharacterData.{deleteData, insertData, replaceData} 2014-04-21 00:53:16 +08:00
Ms2ger
a04d4e63eb Remove not-yet-implemented methods from CharacterData.
This speeds up a web-platform-tests run by about 45 seconds (of 11-12 minutes)
by avoiding three timeouts.
2014-04-19 17:39:13 +02:00
bors-servo
ba9177b7cc auto merge of #2178 : Ms2ger/servo/enum-position, r=jdm
This is a shorter and probably slightly more efficient to write the loop.
2014-04-19 11:01:15 -04:00
bors-servo
5c20ed3023 auto merge of #2179 : Manishearth/servo/refactor-canceled, r=Ms2ger
See #2177
2014-04-19 07:25:15 -04:00
Manish Goregaokar
a748e48f48 Rename Event::default_prevented -> Event::canceled to better match spec (#2177) 2014-04-19 16:02:14 +05:30
bors-servo
4331fad53d auto merge of #2175 : Manishearth/servo/domtests-createevent, r=Ms2ger
#2172

All subtests of `dom/events/Event-defaultPrevented.html` pass now.

CustomEvent has yet to be implemented.(#2173)
2014-04-19 06:22:07 -04:00
Ms2ger
48b8c066f9 Use position in FindEnumStringIndex.
This is a shorter and probably slightly more efficient to write the loop.
2014-04-19 12:20:50 +02:00
Manish Goregaokar
fa7bc7a686 Fix most defaultPrevented test failures (#2172) 2014-04-19 15:46:18 +05:30
Ms2ger
65ed97bab8 Introduce a get_dictionary_property function to reduce duplicated code in the dictionary conversion codegen.
This also explicitly disallows dictionary members without a default value, as
the code for those doesn't currently compile.

This is the second step of my planned rewrite of the dictionary initialization
that will remove the default values we currently use to initialize the
dictionary struct in the 'new' function.
2014-04-18 20:10:55 +02:00
Ms2ger
88c5e733b5 Merge the 'new' and 'Init' functions for dictionaries.
This moves the code in callers more in line with conversions for other types
and ensures the default values given to the dictionary fields (as defined by
the defaultValue function in CGDictionary.impl) do not escape the 'new'
method. The new code is also more in line with the code used by the
FromJSValConvertible trait.

This is the first step of my planned rewrite of the dictionary initialization
that will remove the default values entirely and reduce the code
duplication in the 'Init' (now 'new') function.
2014-04-18 17:12:20 +02:00
Ms2ger
8e596d142e Use 'exceptionCode' when converting to DOMString.
This change allows us to use the code even in cases where we return a
Result type rather than a JSBool. Interface, primitive and union types
already get this right.
2014-04-18 17:12:20 +02:00
bors-servo
58efe0bf75 auto merge of #2156 : Ms2ger/servo/codegen-deadcode, r=jdm 2014-04-18 10:28:11 -04:00
Ms2ger
857eb87bb6 Remove unused references to jsids in the generated code for dictionaries. 2014-04-18 15:52:40 +02:00
Ms2ger
9d7478ab8a Remove some dead code from codegen as found by pyflakes. 2014-04-18 15:52:40 +02:00
bors-servo
099815683d auto merge of #2155 : Ms2ger/servo/dictionary-codegen, r=jdm 2014-04-18 09:40:11 -04:00
Ms2ger
5ac5ba2468 Support nullable strings in dictionaries.
We copy the string in all cases, so there's no need to handle the isMember
case differently.
2014-04-18 11:37:56 +02:00
Ms2ger
b31fdf12ef Add a few tests for dictionary codegen. 2014-04-18 11:30:16 +02:00
Ms2ger
4d20d1716d Implement support for default values for enumeration arguments. 2014-04-18 11:08:21 +02:00
Ms2ger
d53841b016 Handle exceptions from FindEnumStringIndex correctly.
The previous code would return success from the JSNative with a pending
exception, potentially leading to assertion failures inside the JS engine
later.
2014-04-18 10:18:24 +02:00
Ms2ger
baa3845362 Rewrite FindEnumStringIndex to distinguish 'value not found' and 'exception raised'.
This is in preparation for handling those cases differently.
2014-04-18 10:18:17 +02:00
Ms2ger
fa653a5984 Introduce some (commented-out) tests for enumeration codegen. 2014-04-18 10:18:11 +02:00
Josh Matthews
742f73ded5 Add transparent Traceable and Untraceable types to aid proper rooting practices, and replace ad-hoc Untraceable structs with empty Encodable implementations. 2014-04-17 17:41:09 -04:00
bors-servo
7441dae1af auto merge of #2129 : lpy/servo/issue2116, r=jdm
see #2116
I add an `is_interval` field, so that when the `TimerData` is passed by `SetInterval`, we will not delete it from `active_timers`.
Also I think maybe we can extract the code in `ClearTimeout` and `ClearInterval` into another method to avoid duplicate.
2014-04-17 13:34:09 -04:00
lpy
b7dcf62ed0 Implement Window.set/clearInterval.(fixes #2116) 2014-04-18 01:30:39 +08:00
Ms2ger
c9c96d4758 Ensure that optional primitive arguments aren't treated as nullable.
By forgetting the Some(), we caused type inference to convert to Option<T>
for optional non-nullable primitive arguments, and to Option<Option<T>> for
optional nullable primitive arguments (essentially the same thing). This
change brings the primitive codegen in line with the DOMString codegen.

Using distinct types for optionality and nullability would have prevented
this issue.
2014-04-17 16:23:09 +02:00
Ms2ger
f77b775e62 Remove unwrap_object.
There is no good reason to have both unwrap_object and unwrap_jsmanaged.
Removing unwrap_object simplifies the codegen and makes further
simplifications easier.
2014-04-16 11:54:46 +02:00
bors-servo
7149a25e91 auto merge of #2112 : Ms2ger/servo/IDLInterface-JS, r=jdm 2014-04-16 04:22:11 -04:00
Ms2ger
ac46cc6047 Implement FromJSValConvertible for JS<T>. 2014-04-15 21:33:18 +02:00
bors-servo
038730c4bb auto merge of #2054 : sankha93/servo/imageattr, r=jdm 2014-04-15 12:49:14 -04:00
bors-servo
e4f33eb9b9 auto merge of #2114 : Ms2ger/servo/unused-obj-local-arg, r=jdm
This removes the local variable and prefixes the argument with an underscore.
Neither is used right now.
2014-04-15 12:22:44 -04:00
Ms2ger
e4305fe20e Remove unused variable 'obj' from binding functions.
This removes the local variable and prefixes the argument with an underscore.
Neither is used right now.
2014-04-15 17:37:54 +02:00
Ms2ger
dc11464933 Remove the return value from DefineDOMInterface.
This moves the assertion from its only caller into the function itself, to
clarify that we don't intent to deal with any failure here.
2014-04-15 17:32:10 +02:00
Matt Brubeck
28a013cfc5 Move child_inserted into VirtualMethods.
Follow-up from #1984.
2014-04-14 13:39:11 -07:00
Matt Brubeck
8c794c6739 Move inline stylesheet parsing out of HTML parser.
Instead, use shared code to parse stylesheet content when it is inserted,
whether during parsing or dynamically by script.

Based on work by sanools in #1350.
2014-04-14 11:14:07 -07:00
bors-servo
b174a6439b auto merge of #2094 : Manishearth/servo/id-efficiency, r=Ms2ger
This improves the code written for #1822 to use a single linear traversal.

The current code uses a binary search with `CompareDocumentPosition()` for comparing element position, however this method internally calls `traverse_preorder()` (i.e. a linear traversal) so calling this on every pass is quite inefficient.
2014-04-11 17:04:09 -04:00
bors-servo
9d2a6b7824 auto merge of #2087 : Ms2ger/servo/vtable2, r=jdm
Fixes #1527. Does *not* include the code for #1528.

(Originally by @jdm in #1688 and #1866.)
2014-04-11 16:31:14 -04:00
Manish Goregaokar
9f617e9f0c Make register_named_element more efficient 2014-04-11 14:39:23 +05:30