aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorAnthony Ramine <nox@nox.paris>2020-03-29 19:31:54 +0200
committerAnthony Ramine <nox@nox.paris>2020-03-29 19:31:54 +0200
commit467913acdb63e9bc086dc31035a247d22886d0e6 (patch)
tree074939bec4ef74424d83de7afd7cf597665740e9 /components/script/dom
parent9b2debe678fe3efd62978b664c583bd74df60edc (diff)
downloadservo-467913acdb63e9bc086dc31035a247d22886d0e6.tar.gz
servo-467913acdb63e9bc086dc31035a247d22886d0e6.zip
Make LayoutElementHelpers methods take self
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/element.rs52
1 files changed, 26 insertions, 26 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 70000fd95f7..1521207faee 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -622,12 +622,12 @@ impl RawLayoutElementHelpers for Element {
pub trait LayoutElementHelpers<'dom> {
#[allow(unsafe_code)]
- unsafe fn has_class_for_layout(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool;
+ unsafe fn has_class_for_layout(self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool;
#[allow(unsafe_code)]
- unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]>;
+ unsafe fn get_classes_for_layout(self) -> Option<&'static [Atom]>;
#[allow(unsafe_code)]
- unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, _: &mut V)
+ unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(self, _: &mut V)
where
V: Push<ApplicableDeclarationBlock>;
#[allow(unsafe_code)]
@@ -635,24 +635,24 @@ pub trait LayoutElementHelpers<'dom> {
#[allow(unsafe_code)]
unsafe fn get_rowspan(self) -> u32;
#[allow(unsafe_code)]
- unsafe fn is_html_element(&self) -> bool;
- fn id_attribute(&self) -> *const Option<Atom>;
- fn style_attribute(&self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>>;
- fn local_name(&self) -> &LocalName;
- fn namespace(&self) -> &Namespace;
- fn get_lang_for_layout(&self) -> String;
- fn get_state_for_layout(&self) -> ElementState;
- fn insert_selector_flags(&self, flags: ElementSelectorFlags);
- fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool;
+ unsafe fn is_html_element(self) -> bool;
+ fn id_attribute(self) -> *const Option<Atom>;
+ fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>>;
+ fn local_name(self) -> &'dom LocalName;
+ fn namespace(self) -> &'dom Namespace;
+ fn get_lang_for_layout(self) -> String;
+ fn get_state_for_layout(self) -> ElementState;
+ fn insert_selector_flags(self, flags: ElementSelectorFlags);
+ fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool;
/// The shadow root this element is a host of.
#[allow(unsafe_code)]
- unsafe fn get_shadow_root_for_layout(&self) -> Option<LayoutDom<'dom, ShadowRoot>>;
+ unsafe fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>>;
}
impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
#[allow(unsafe_code)]
#[inline]
- unsafe fn has_class_for_layout(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
+ unsafe fn has_class_for_layout(self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
get_attr_for_layout(&*self.unsafe_get(), &ns!(), &local_name!("class")).map_or(
false,
|attr| {
@@ -666,13 +666,13 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
#[allow(unsafe_code)]
#[inline]
- unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> {
+ unsafe fn get_classes_for_layout(self) -> Option<&'static [Atom]> {
get_attr_for_layout(&*self.unsafe_get(), &ns!(), &local_name!("class"))
.map(|attr| attr.value_tokens_forever().unwrap())
}
#[allow(unsafe_code)]
- unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
+ unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(self, hints: &mut V)
where
V: Push<ApplicableDeclarationBlock>,
{
@@ -1019,32 +1019,32 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
#[inline]
#[allow(unsafe_code)]
- unsafe fn is_html_element(&self) -> bool {
+ unsafe fn is_html_element(self) -> bool {
(*self.unsafe_get()).namespace == ns!(html)
}
#[allow(unsafe_code)]
- fn id_attribute(&self) -> *const Option<Atom> {
+ 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<Arc<Locked<PropertyDeclarationBlock>>> {
+ fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>> {
unsafe { (*self.unsafe_get()).style_attribute.borrow_for_layout() }
}
#[allow(unsafe_code)]
- fn local_name(&self) -> &LocalName {
+ fn local_name(self) -> &'dom LocalName {
unsafe { &(*self.unsafe_get()).local_name }
}
#[allow(unsafe_code)]
- fn namespace(&self) -> &Namespace {
+ fn namespace(self) -> &'dom Namespace {
unsafe { &(*self.unsafe_get()).namespace }
}
#[allow(unsafe_code)]
- fn get_lang_for_layout(&self) -> String {
+ fn get_lang_for_layout(self) -> String {
unsafe {
let mut current_node = Some(self.upcast::<Node>());
while let Some(node) = current_node {
@@ -1073,13 +1073,13 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
#[inline]
#[allow(unsafe_code)]
- fn get_state_for_layout(&self) -> ElementState {
+ fn get_state_for_layout(self) -> ElementState {
unsafe { (*self.unsafe_get()).state.get() }
}
#[inline]
#[allow(unsafe_code)]
- fn insert_selector_flags(&self, flags: ElementSelectorFlags) {
+ fn insert_selector_flags(self, flags: ElementSelectorFlags) {
debug_assert!(thread_state::get().is_layout());
unsafe {
let f = &(*self.unsafe_get()).selector_flags;
@@ -1089,13 +1089,13 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
#[inline]
#[allow(unsafe_code)]
- fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool {
+ fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool {
unsafe { (*self.unsafe_get()).selector_flags.get().contains(flags) }
}
#[inline]
#[allow(unsafe_code)]
- unsafe fn get_shadow_root_for_layout(&self) -> Option<LayoutDom<'dom, ShadowRoot>> {
+ unsafe fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>> {
(*self.unsafe_get())
.rare_data_for_layout()
.as_ref()?