diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2013-05-03 15:41:23 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2013-05-06 15:42:42 -0700 |
commit | b17fffa9d926f4a2a805445c68f120c7912f2c57 (patch) | |
tree | ba2f3fee8cca7d3e14cf0e4fb6b931aa50cc8550 /src | |
parent | a178a7a5d182a0aba04d27315646f514a9a619f2 (diff) | |
download | servo-b17fffa9d926f4a2a805445c68f120c7912f2c57.tar.gz servo-b17fffa9d926f4a2a805445c68f120c7912f2c57.zip |
Fix code style in DOMParser
Diffstat (limited to 'src')
-rw-r--r-- | src/servo/dom/domparser.rs | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/servo/dom/domparser.rs b/src/servo/dom/domparser.rs index 2b08540e40f..6ab6655398f 100644 --- a/src/servo/dom/domparser.rs +++ b/src/servo/dom/domparser.rs @@ -1,6 +1,10 @@ +/* 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 content::content_task::global_content; -use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache, CacheableWrapper}; use dom::bindings::codegen::DOMParserBinding; +use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache, CacheableWrapper}; use dom::document::Document; use dom::element::{Element, HTMLHtmlElement, HTMLHtmlElementTypeId}; use dom::node::Node; @@ -11,12 +15,13 @@ pub struct DOMParser { wrapper: WrapperCache } -pub impl DOMParser { - fn new(owner: @mut Window) -> @mut DOMParser { +impl DOMParser { + pub fn new(owner: @mut Window) -> @mut DOMParser { let parser = @mut DOMParser { owner: owner, wrapper: WrapperCache::new() }; + let cx = global_content().compartment.get().cx.ptr; let cache = owner.get_wrappercache(); let scope = cache.get_wrapper(); @@ -24,13 +29,23 @@ pub impl DOMParser { parser } - fn Constructor(owner: @mut Window, _rv: &mut ErrorResult) -> @mut DOMParser { + pub fn Constructor(owner: @mut Window, _rv: &mut ErrorResult) -> @mut DOMParser { DOMParser::new(owner) } - fn ParseFromString(&self, _s: DOMString, _type_: DOMParserBinding::SupportedType, _rv: &mut ErrorResult) -> @mut Document { - let root = ~HTMLHtmlElement { parent: Element::new(HTMLHtmlElementTypeId, ~"html") }; - let root = unsafe { Node::as_abstract_node(root) }; - Document(root, None) + pub fn ParseFromString(&self, + _s: DOMString, + _type: DOMParserBinding::SupportedType, + _rv: &mut ErrorResult) + -> @mut Document { + unsafe { + let root = ~HTMLHtmlElement { + parent: Element::new(HTMLHtmlElementTypeId, ~"html") + }; + + let root = Node::as_abstract_node(root); + Document(root, None) + } } -}
\ No newline at end of file +} + |