Group all intrinsic CharacterData methods together

This commit is contained in:
Anthony Ramine 2015-10-25 02:33:59 +02:00
parent 96060c7aab
commit 7e1e34e7d5

View file

@ -30,6 +30,22 @@ impl CharacterData {
data: DOMRefCell::new(data),
}
}
#[inline]
pub fn data(&self) -> Ref<DOMString> {
self.data.borrow()
}
#[inline]
pub fn append_data(&self, data: &str) {
self.data.borrow_mut().push_str(data);
self.content_changed();
}
fn content_changed(&self) {
let node = self.upcast::<Node>();
node.owner_doc().content_changed(node, NodeDamage::OtherNodeDamage);
}
}
impl CharacterDataMethods for CharacterData {
@ -143,24 +159,6 @@ impl CharacterDataMethods for CharacterData {
}
}
impl CharacterData {
#[inline]
pub fn data(&self) -> Ref<DOMString> {
self.data.borrow()
}
#[inline]
pub fn append_data(&self, data: &str) {
// FIXME(ajeffrey): Efficient append on DOMStrings?
self.data.borrow_mut().push_str(data);
self.content_changed();
}
fn content_changed(&self) {
let node = self.upcast::<Node>();
node.owner_doc().content_changed(node, NodeDamage::OtherNodeDamage);
}
}
#[allow(unsafe_code)]
pub trait LayoutCharacterDataHelpers {
unsafe fn data_for_layout(&self) -> &str;