mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
parent
1e150140bd
commit
f404853c99
9 changed files with 67 additions and 78 deletions
|
@ -13,7 +13,7 @@ use dom::bindings::error::{Error, Fallible};
|
|||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::{JSRef, OptionalRootable, Rootable, RootedReference};
|
||||
use dom::bindings::js::Temporary;
|
||||
use dom::characterdata::{CharacterData, CharacterDataHelpers};
|
||||
use dom::characterdata::{CharacterData, CharacterDataHelpers, CharacterDataTypeId};
|
||||
use dom::document::Document;
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::node::{Node, NodeHelpers, NodeTypeId};
|
||||
|
@ -27,14 +27,14 @@ pub struct Text {
|
|||
|
||||
impl TextDerived for EventTarget {
|
||||
fn is_text(&self) -> bool {
|
||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Text)
|
||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::Text))
|
||||
}
|
||||
}
|
||||
|
||||
impl Text {
|
||||
fn new_inherited(text: DOMString, document: JSRef<Document>) -> Text {
|
||||
Text {
|
||||
characterdata: CharacterData::new_inherited(NodeTypeId::Text, text, document)
|
||||
characterdata: CharacterData::new_inherited(CharacterDataTypeId::Text, text, document)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue