mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Make Element::id not clone the attribute.
This commit is contained in:
parent
98c9292ecb
commit
f2efd04a5d
10 changed files with 46 additions and 37 deletions
|
@ -341,7 +341,7 @@ pub struct ServoLayoutElement<'le> {
|
|||
impl<'le> fmt::Debug for ServoLayoutElement<'le> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "<{}", self.element.local_name())?;
|
||||
if let &Some(ref id) = unsafe { &*self.element.id_attribute() } {
|
||||
if let Some(id) = self.id() {
|
||||
write!(f, " id={}", id)?;
|
||||
}
|
||||
write!(f, "> ({:#x})", self.as_node().opaque().0)
|
||||
|
@ -382,9 +382,9 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn id(&self) -> Option<Atom> {
|
||||
fn id(&self) -> Option<&Atom> {
|
||||
unsafe {
|
||||
(*self.element.id_attribute()).clone()
|
||||
(*self.element.id_attribute()).as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue