Privatize Document

This commit is contained in:
Tim Taubert 2014-10-12 23:29:52 +02:00
parent d0addd36bb
commit 8825296869
8 changed files with 38 additions and 22 deletions

View file

@ -62,7 +62,7 @@ use url::Url;
use std::collections::hashmap::HashMap;
use std::ascii::StrAsciiExt;
use std::cell::{Cell, RefCell};
use std::cell::{Cell, Ref, RefCell};
use std::default::Default;
use time;
@ -75,16 +75,17 @@ pub enum IsHTMLDocument {
#[jstraceable]
#[must_root]
#[privatize]
pub struct Document {
pub node: Node,
node: Node,
reflector_: Reflector,
pub window: JS<Window>,
window: JS<Window>,
idmap: RefCell<HashMap<Atom, Vec<JS<Element>>>>,
implementation: MutNullableJS<DOMImplementation>,
content_type: DOMString,
last_modified: RefCell<Option<DOMString>>,
pub encoding_name: RefCell<DOMString>,
pub is_html_document: bool,
encoding_name: RefCell<DOMString>,
is_html_document: bool,
url: Url,
quirks_mode: Cell<QuirksMode>,
images: MutNullableJS<HTMLCollection>,
@ -343,6 +344,21 @@ impl Document {
node.set_owner_doc(*document);
Temporary::from_rooted(*document)
}
#[inline]
pub fn window<'a>(&'a self) -> &'a JS<Window> {
&self.window
}
#[inline]
pub fn encoding_name(&self) -> Ref<DOMString> {
self.encoding_name.borrow()
}
#[inline]
pub fn is_html_document(&self) -> bool {
self.is_html_document
}
}
impl Reflectable for Document {