mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Fix code style in DOMParser
This commit is contained in:
parent
a178a7a5d1
commit
b17fffa9d9
1 changed files with 24 additions and 9 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue