mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Rename the node field of the DOM node hierarchy
Renamed the Node elements Fixes #924
This commit is contained in:
parent
2dbd065d91
commit
cfd726f7d6
9 changed files with 61 additions and 26 deletions
|
@ -22,7 +22,7 @@ use std::str::eq_slice;
|
|||
use std::ascii::StrAsciiExt;
|
||||
|
||||
pub struct Element {
|
||||
element: Node<ScriptView>,
|
||||
node: Node<ScriptView>,
|
||||
tag_name: ~str, // TODO: This should be an atom, not a ~str.
|
||||
attrs: ~[Attr],
|
||||
style_attribute: Option<Stylesheet>,
|
||||
|
@ -30,7 +30,7 @@ pub struct Element {
|
|||
|
||||
impl CacheableWrapper for Element {
|
||||
fn get_wrappercache(&mut self) -> &mut WrapperCache {
|
||||
self.element.get_wrappercache()
|
||||
self.node.get_wrappercache()
|
||||
}
|
||||
|
||||
fn wrap_object_shared(@mut self, _cx: *JSContext, _scope: *JSObject) -> *JSObject {
|
||||
|
@ -40,7 +40,7 @@ impl CacheableWrapper for Element {
|
|||
|
||||
impl BindingObject for Element {
|
||||
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> {
|
||||
self.element.GetParentObject(cx)
|
||||
self.node.GetParentObject(cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ pub enum ElementTypeId {
|
|||
impl<'self> Element {
|
||||
pub fn new(type_id: ElementTypeId, tag_name: ~str) -> Element {
|
||||
Element {
|
||||
element: Node::new(ElementNodeTypeId(type_id)),
|
||||
node: Node::new(ElementNodeTypeId(type_id)),
|
||||
tag_name: tag_name,
|
||||
attrs: ~[],
|
||||
style_attribute: None,
|
||||
|
@ -180,14 +180,14 @@ impl<'self> Element {
|
|||
_ => ()
|
||||
}
|
||||
|
||||
match self.element.owner_doc {
|
||||
match self.node.owner_doc {
|
||||
Some(owner) => do owner.with_base |owner| { owner.content_changed() },
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_scope_and_cx(&self) -> (*JSObject, *JSContext) {
|
||||
let doc = self.element.owner_doc.unwrap();
|
||||
let doc = self.node.owner_doc.unwrap();
|
||||
let win = doc.with_base(|doc| doc.window.unwrap());
|
||||
let cx = win.page.js_info.get_ref().js_compartment.cx.ptr;
|
||||
let cache = win.get_wrappercache();
|
||||
|
@ -276,7 +276,7 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn GetClientRects(&self, abstract_self: AbstractNode<ScriptView>) -> @mut ClientRectList {
|
||||
let (rects, cx, scope) = match self.element.owner_doc {
|
||||
let (rects, cx, scope) = match self.node.owner_doc {
|
||||
Some(doc) => {
|
||||
match doc.with_base(|doc| doc.window) {
|
||||
Some(win) => {
|
||||
|
@ -318,7 +318,7 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn GetBoundingClientRect(&self, abstract_self: AbstractNode<ScriptView>) -> @mut ClientRect {
|
||||
match self.element.owner_doc {
|
||||
match self.node.owner_doc {
|
||||
Some(doc) => {
|
||||
match doc.with_base(|doc| doc.window) {
|
||||
Some(win) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue