Commit graph

69 commits

Author SHA1 Message Date
Ms2ger
2a2ab23dfb Update js. 2015-10-28 18:02:10 +01:00
Anthony Ramine
13ea3ac413 Introduce trait Castable
This trait is used to hold onto the downcast and upcast functions of all
castable IDL interfaces. A castable IDL interface is one which either derives
from or is derived by other interfaces.

The deriving relation is represented by implementations of marker trait
DerivedFrom<T: Castable> generated in InheritTypes.

/^[ ]*use dom::bindings::codegen::InheritTypes::.*(Base|Cast|Derived)/ {
    /::[a-zA-Z]+(Base|Cast|Derived);/d
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    /\{([a-zA-Z]+(Base|Cast|Derived))?\};$/d
    s/\{([a-zA-Z_]+)\};$/\1;/
}

s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.upcast::<\1>()/g
s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.upcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::from_ref\)/\(Castable::upcast::<\1>\)/g

s/([a-zA-Z]+)Cast::from_root/Root::upcast::<\1>/g

s/([a-zA-Z]+)Cast::from_layout_js\(\&([a-zA-Z_.]+)\)/\2.upcast::<\1>()/g

s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.downcast::<\1>()/g
s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.downcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::to_ref\)/\(Castable::downcast::<\1>\)/g

s/([a-zA-Z]+)Cast::to_root/Root::downcast::<\1>/g

s/([a-zA-Z]+)Cast::to_layout_js\(&?([a-zA-Z_.]+(\(\))?)\)/\2.downcast::<\1>()/g

s/\.is_document\(\)/.is::<Document>()/g
s/\.is_htmlanchorelement\(\)/.is::<HTMLAnchorElement>()/g
s/\.is_htmlappletelement\(\)/.is::<HTMLAppletElement>()/g
s/\.is_htmlareaelement\(\)/.is::<HTMLAreaElement>()/g
s/\.is_htmlbodyelement\(\)/.is::<HTMLBodyElement>()/g
s/\.is_htmlembedelement\(\)/.is::<HTMLEmbedElement>()/g
s/\.is_htmlfieldsetelement\(\)/.is::<HTMLFieldSetElement>()/g
s/\.is_htmlformelement\(\)/.is::<HTMLFormElement>()/g
s/\.is_htmlframesetelement\(\)/.is::<HTMLFrameSetElement>()/g
s/\.is_htmlhtmlelement\(\)/.is::<HTMLHtmlElement>()/g
s/\.is_htmlimageelement\(\)/.is::<HTMLImageElement>()/g
s/\.is_htmllegendelement\(\)/.is::<HTMLLegendElement>()/g
s/\.is_htmloptgroupelement\(\)/.is::<HTMLOptGroupElement>()/g
s/\.is_htmloptionelement\(\)/.is::<HTMLOptionElement>()/g
s/\.is_htmlscriptelement\(\)/.is::<HTMLScriptElement>()/g
s/\.is_htmltabledatacellelement\(\)/.is::<HTMLTableDataCellElement>()/g
s/\.is_htmltableheadercellelement\(\)/.is::<HTMLTableHeaderCellElement>()/g
s/\.is_htmltablerowelement\(\)/.is::<HTMLTableRowElement>()/g
s/\.is_htmltablesectionelement\(\)/.is::<HTMLTableSectionElement>()/g
s/\.is_htmltitleelement\(\)/.is::<HTMLTitleElement>()/g
2015-10-21 11:37:16 +02:00
Anthony Ramine
c77d3b965f Introduce IDLInterface::derives()
This method is given a DOMClass value and returns whether it derives from Self.

Interfaces with no descendants directly check whether the given DOMClass is the
same as their own.
2015-10-21 10:59:36 +02:00
Rahul Sharma
1141f00212 added spec link for type mapping 2015-10-15 19:28:56 +05:30
Michael Wu
3129fb2330 Throw on bad ByteStrings 2015-10-14 15:30:57 -04:00
Michael Wu
e733a7c46a Support the updated spidermonkey bindings 2015-10-14 15:30:52 -04:00
Patrick Walton
f2f91886ee script: Stop reallocating so much when converting DOM strings to JS
values.

`size_hint()` in `utf16_units()` seems busted, so we do it ourselves.
2015-09-27 15:40:48 -07: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
Michael Wu
941f7dc04b Move EventTargetTypeId/NodeTypeId to DOMClass 2015-09-12 01:09:46 +02:00
Manish Goregaokar
e94df1ed5c Remove needless returns 2015-09-04 09:13:48 +05:30
Simon Sapin
40b4348824 Upgrade to rustc 1.4.0-dev (cb9323ec0 2015-09-01) 2015-09-02 09:22:17 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
snf
7f152b665d Add Clamp and EnforceRange support for webidl arguments. 2015-07-22 17:04:06 +02:00
Simon Sapin
a5b6cb6b43 Unpaired surrogates: Document the -Z flag in the panic message. 2015-07-13 20:58:21 +02:00
Simon Sapin
e4dc608c0a Use error! instead of warn! to get console output by default. 2015-07-13 20:52:21 +02:00
Simon Sapin
90dbd86ed7 Add a -Z replace-surrogates command-line option.
See #6564.
2015-07-13 20:41:57 +02:00
Ms2ger
243446eff3 Revert "Replace surrogates in JS strings with U+FFFD instead of panicking."
This reverts commit 3f07f8e866.
2015-07-11 09:32:32 +02:00
Simon Sapin
3f07f8e866 Replace surrogates in JS strings with U+FFFD instead of panicking.
Fix #6519.
See #6564.
2015-07-11 03:12:46 +02:00
Ms2ger
a72c6ec8b6 Stop using Vec::from_raw_buf. 2015-06-26 21:20:13 +02:00
Anthony Ramine
a90983553b Merge generic funs to share them across all bindings (fixes #2684) 2015-06-24 11:34:30 +02:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Ms2ger
84b1b52682 Replace ByteString::as_slice() by a Deref implementation. 2015-05-01 21:19:11 +02:00
Ms2ger
a862479ca8 Remove as_slice() calls from script. 2015-04-26 10:52:55 +02:00
Ms2ger
6b79d57920 When converting a non-finite float, throw the TypeError from the FromJSValConvertible implementation.
This removes some unnecessary custom code in the codegen and makes this
implementation follow the convention of having thrown an exception when
returning Err() from FromJSValConvertible.
2015-04-07 14:16:34 +02:00
Ms2ger
e3683c8598 Merge the To/FromJSValConvertible implementations for Finite<T>. 2015-04-07 13:34:06 +02:00
Ms2ger
58a8cfda52 Drop the FromJSValConvertible implementation for interfaces.
It doesn't really fit in the design, and native_from_reflector_jsmanaged has
gained the usability improvements that it used to lack.
2015-04-07 13:11:45 +02:00
Tetsuharu OHZEKI
9cd1b2c158 Use Finite<T> for our dom code (excluding CanvasRenderingContext2D) 2015-03-25 10:45:30 +09:00
Tetsuharu OHZEKI
f7fd34c0aa Introduce Finite<T: Float> for restricted values defined in WebIDL. 2015-03-25 10:45:30 +09:00
Tetsuharu OHZEKI
2bf2c0020b Add bindings support for unrestricted float/double values. 2015-03-25 10:45:30 +09:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Ms2ger
2345f5461b Null-check the result of JS_GetStringCharsAndLength. 2015-03-13 21:27:58 +01:00
Ms2ger
bbbdb98897 Implement USVString. 2015-03-13 21:27:58 +01:00
Chris Double
2af19b2675 Fix #2108 by renaming unwrap functions to native_from_reflector
As noted by @bholley. "unwrap" is confusing because we are
both stripping off wrappers *and* getting a native from a
reflector. Changing the "unwrap" usage to "native_from_reflector"
for clarity.

This renames 'unwrap' to 'native_from_reflector' and
'unwrap_jsmanaged' to 'native_from_reflector_jsmanaged'.
2015-03-12 19:15:12 +13:00
Ms2ger
10ddb86d61 Remove the implementation of ToJSValConvertible for JS<T>.
It is unused and doesn't serve a purpose.
2015-02-21 11:09:06 +01:00
Ms2ger
6d30ec77c8 Replace uint/int by usize/isize in various places. 2015-02-20 14:45:47 +01:00
Ms2ger
a3fedee46e Return usize from IDLInterface::get_prototype_depth.
It is used as an index into an array.
2015-02-20 14:45:47 +01:00
Ms2ger
21a1143dd1 Use u32 for reserved slot indices.
This is what the JSAPI expects.
2015-02-20 14:45:46 +01:00
Ms2ger
c58213b698 Remove the Option<Self> arguments from IDLInterface. 2015-02-19 09:52:48 +01:00
Ms2ger
e921ce859e Fix some warnings in script. 2015-02-12 20:05:14 +01:00
Ms2ger
147dadce89 Implement an Unrooted smart pointer to replace JS when it is not traced. 2015-02-06 12:33:32 +01:00
Ms2ger
e596afe22d Document the DOM.
This is by no means complete, but it is a good place to start.
2015-02-05 14:41:12 +01:00
Manish Goregaokar
5c9b1019a9 Move FromJSValConvertible to associated types (avoids old impl check) 2015-01-31 16:05:16 +05:30
Ms2ger
dac0190b6d Use snake case for the argument to from_jsval for DOMString. 2015-01-29 21:07:46 +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
bors-servo
1a2a08aa50 auto merge of #4717 : Ms2ger/servo/doc-proxy, r=saneyuki 2015-01-28 01:48:52 -07:00
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
238f3e2d91 Require documentation for all code in dom::bindings (excluding dom::bindings::codegen). 2015-01-25 22:01:04 +01: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