mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use cached element ID in LayoutElement::get_id
This commit is contained in:
parent
ea655ada10
commit
2e9d8a76d1
2 changed files with 9 additions and 1 deletions
|
@ -494,6 +494,7 @@ pub trait LayoutElementHelpers {
|
|||
unsafe fn html_element_in_html_document_for_layout(&self) -> bool;
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
|
||||
fn id_attribute(&self) -> *const Option<Atom>;
|
||||
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock>;
|
||||
fn local_name(&self) -> &Atom;
|
||||
fn namespace(&self) -> &Namespace;
|
||||
|
@ -517,6 +518,13 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
get_attr_for_layout(&*self.unsafe_get(), namespace, name).is_some()
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn id_attribute(&self) -> *const Option<Atom> {
|
||||
unsafe {
|
||||
(*self.unsafe_get()).id_attribute.borrow_for_layout()
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock> {
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue