mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
auto merge of #4189 : chmanchester/servo/rootlint, r=jdm
I think this matches the intent of the issue, I'm a rust/servo novice; any suggestions for improvements are welcome. Thanks!
This commit is contained in:
commit
2615be9bab
2 changed files with 51 additions and 12 deletions
|
@ -206,7 +206,6 @@ pub trait RawLayoutElementHelpers {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name: &Atom) -> Option<&'a JS<Attr>> {
|
||||
// cast to point to T in RefCell<T> directly
|
||||
let attrs: *const Vec<JS<Attr>> = mem::transmute(&elem.attrs);
|
||||
|
@ -219,7 +218,6 @@ unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name
|
|||
|
||||
impl RawLayoutElementHelpers for Element {
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_attr_val_for_layout<'a>(&'a self, namespace: &Namespace, name: &Atom)
|
||||
-> Option<&'a str> {
|
||||
get_attr_for_layout(self, namespace, name).map(|attr| {
|
||||
|
@ -229,7 +227,6 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_attr_vals_for_layout<'a>(&'a self, name: &Atom) -> Vec<&'a str> {
|
||||
let attrs = self.attrs.borrow_for_layout();
|
||||
(*attrs).iter().filter_map(|attr: &JS<Attr>| {
|
||||
|
@ -243,7 +240,6 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_attr_atom_for_layout(&self, namespace: &Namespace, name: &Atom)
|
||||
-> Option<Atom> {
|
||||
let attrs = self.attrs.borrow_for_layout();
|
||||
|
@ -258,7 +254,6 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn has_class_for_layout(&self, name: &Atom) -> bool {
|
||||
let attrs = self.attrs.borrow_for_layout();
|
||||
(*attrs).iter().find(|attr: & &JS<Attr>| {
|
||||
|
@ -273,7 +268,6 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> {
|
||||
let attrs = self.attrs.borrow_for_layout();
|
||||
(*attrs).iter().find(|attr: & &JS<Attr>| {
|
||||
|
@ -286,7 +280,6 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_length_attribute_for_layout(&self, length_attribute: LengthAttribute)
|
||||
-> LengthOrPercentageOrAuto {
|
||||
match length_attribute {
|
||||
|
@ -301,7 +294,6 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_integer_attribute_for_layout(&self, integer_attribute: IntegerAttribute)
|
||||
-> Option<i32> {
|
||||
match integer_attribute {
|
||||
|
@ -347,7 +339,6 @@ pub trait LayoutElementHelpers {
|
|||
}
|
||||
|
||||
impl LayoutElementHelpers for JS<Element> {
|
||||
#[allow(unrooted_must_root)]
|
||||
#[inline]
|
||||
unsafe fn html_element_in_html_document_for_layout(&self) -> bool {
|
||||
if (*self.unsafe_get()).namespace != ns!(HTML) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue