mirror of
https://github.com/servo/servo.git
synced 2025-07-26 00:30:22 +01:00
Implement style_attribute() on LayoutJS<Element>.
This commit is contained in:
parent
8a6681ba70
commit
23c679d55a
2 changed files with 11 additions and 5 deletions
|
@ -383,11 +383,9 @@ pub struct LayoutElement<'le> {
|
||||||
|
|
||||||
impl<'le> LayoutElement<'le> {
|
impl<'le> LayoutElement<'le> {
|
||||||
pub fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
pub fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
||||||
use script::dom::element::ElementHelpers;
|
unsafe {
|
||||||
let style: &Option<PropertyDeclarationBlock> = unsafe {
|
&*self.element.style_attribute()
|
||||||
&*(*self.element.unsafe_get()).style_attribute().borrow_for_layout()
|
}
|
||||||
};
|
|
||||||
style
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -511,6 +511,7 @@ pub trait LayoutElementHelpers {
|
||||||
unsafe fn html_element_in_html_document_for_layout(&self) -> bool;
|
unsafe fn html_element_in_html_document_for_layout(&self) -> bool;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
|
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
|
||||||
|
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LayoutElementHelpers for LayoutJS<Element> {
|
impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
|
@ -528,6 +529,13 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool {
|
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool {
|
||||||
get_attr_for_layout(&*self.unsafe_get(), namespace, name).is_some()
|
get_attr_for_layout(&*self.unsafe_get(), namespace, name).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock> {
|
||||||
|
unsafe {
|
||||||
|
(*self.unsafe_get()).style_attribute.borrow_for_layout()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue