Make NodeTypeId include CharacterData variant

NodeTypeId is supposed to reflect the WebIDL inheritance hierarchy.
All of Text/ProcessingInstruction/Comment inherit from CharacterData,
which inherits from Node. There should be a CharacterDataTypeId value
that differentiates between those, instead.
This commit is contained in:
Jinwoo Song 2015-04-28 14:09:31 +09:00
parent 1e150140bd
commit f404853c99
9 changed files with 67 additions and 78 deletions

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::InheritTypes::CommentDerived;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JSRef, Rootable, Temporary};
use dom::characterdata::CharacterData;
use dom::characterdata::{CharacterData, CharacterDataTypeId};
use dom::document::Document;
use dom::eventtarget::{EventTarget, EventTargetTypeId};
use dom::node::{Node, NodeTypeId};
@ -22,14 +22,14 @@ pub struct Comment {
impl CommentDerived for EventTarget {
fn is_comment(&self) -> bool {
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Comment)
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::Comment))
}
}
impl Comment {
fn new_inherited(text: DOMString, document: JSRef<Document>) -> Comment {
Comment {
characterdata: CharacterData::new_inherited(NodeTypeId::Comment, text, document)
characterdata: CharacterData::new_inherited(CharacterDataTypeId::Comment, text, document)
}
}