mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Remove unused and somewhat dubious GeckoElement::set_data.
This commit is contained in:
parent
601a351632
commit
23d9462d23
1 changed files with 0 additions and 24 deletions
|
@ -84,7 +84,6 @@ use std::cell::RefCell;
|
|||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::mem;
|
||||
use std::ops::DerefMut;
|
||||
use std::ptr;
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
use stylist::CascadeData;
|
||||
|
@ -615,29 +614,6 @@ impl<'le> GeckoElement<'le> {
|
|||
self.namespace_id() == (structs::root::kNameSpaceID_XUL as i32)
|
||||
}
|
||||
|
||||
/// Sets the specified element data, return any existing data.
|
||||
///
|
||||
/// Like `ensure_data`, only safe to call with exclusive access to the
|
||||
/// element.
|
||||
pub unsafe fn set_data(&self, replace_data: Option<ElementData>) -> Option<ElementData> {
|
||||
match (self.get_data(), replace_data) {
|
||||
(Some(old), Some(replace_data)) => {
|
||||
Some(mem::replace(old.borrow_mut().deref_mut(), replace_data))
|
||||
}
|
||||
(Some(old), None) => {
|
||||
let old_data = mem::replace(old.borrow_mut().deref_mut(), ElementData::default());
|
||||
self.0.mServoData.set(ptr::null_mut());
|
||||
Some(old_data)
|
||||
}
|
||||
(None, Some(replace_data)) => {
|
||||
let ptr = Box::into_raw(Box::new(AtomicRefCell::new(replace_data)));
|
||||
self.0.mServoData.set(ptr);
|
||||
None
|
||||
}
|
||||
(None, None) => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_id(&self) -> bool {
|
||||
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementHasID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue