mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Group all intrinsic CharacterData methods together
This commit is contained in:
parent
96060c7aab
commit
7e1e34e7d5
1 changed files with 16 additions and 18 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue