diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2014-08-07 19:12:04 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2014-08-07 19:12:04 +0100 |
commit | 8b3c9f64016fe05048f8d774dc7bf0b842bdbd9c (patch) | |
tree | 6b518feee941568ef884b1765c0bfe7ab472f787 /src/components/script/dom/range.rs | |
parent | 1e3dc0341b48f3d6d81cc098c57a1aff6e17dfe5 (diff) | |
parent | bf85cdf0eb734513155af38663393fe7fcc03e83 (diff) | |
download | servo-8b3c9f64016fe05048f8d774dc7bf0b842bdbd9c.tar.gz servo-8b3c9f64016fe05048f8d774dc7bf0b842bdbd9c.zip |
Merge pull request #2987 from saneyuki/idl
Add some blobs for DOM Bindings
Diffstat (limited to 'src/components/script/dom/range.rs')
-rw-r--r-- | src/components/script/dom/range.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/components/script/dom/range.rs b/src/components/script/dom/range.rs new file mode 100644 index 00000000000..16449cabe1a --- /dev/null +++ b/src/components/script/dom/range.rs @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::bindings::codegen::Bindings::RangeBinding; +use dom::bindings::codegen::Bindings::RangeBinding::RangeMethods; +use dom::bindings::error::Fallible; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{JSRef, Temporary}; +use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; + +#[deriving(Encodable)] +pub struct Range { + pub reflector_: Reflector +} + +impl Range { + pub fn new_inherited() -> Range { + Range { + reflector_: Reflector::new() + } + } + + pub fn new(global: &GlobalRef) -> Temporary<Range> { + reflect_dom_object(box Range::new_inherited(), global, RangeBinding::Wrap) + } + + pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Range>> { + Ok(Range::new(global)) + } +} + +impl<'a> RangeMethods for JSRef<'a, Range> { +} + +impl Reflectable for Range { + fn reflector<'a>(&'a self) -> &'a Reflector { + &self.reflector_ + } +} |