Make HTMLFontElementLayoutHelpers methods take self

This commit is contained in:
Anthony Ramine 2020-03-29 17:18:59 +02:00
parent 56ef9b5170
commit fea4a2e629

View file

@ -101,14 +101,14 @@ impl VirtualMethods for HTMLFontElement {
}
pub trait HTMLFontElementLayoutHelpers {
fn get_color(&self) -> Option<RGBA>;
fn get_face(&self) -> Option<Atom>;
fn get_size(&self) -> Option<u32>;
fn get_color(self) -> Option<RGBA>;
fn get_face(self) -> Option<Atom>;
fn get_size(self) -> Option<u32>;
}
impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement> {
#[allow(unsafe_code)]
fn get_color(&self) -> Option<RGBA> {
fn get_color(self) -> Option<RGBA> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(), &local_name!("color"))
@ -118,7 +118,7 @@ impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement> {
}
#[allow(unsafe_code)]
fn get_face(&self) -> Option<Atom> {
fn get_face(self) -> Option<Atom> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(), &local_name!("face"))
@ -128,7 +128,7 @@ impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement> {
}
#[allow(unsafe_code)]
fn get_size(&self) -> Option<u32> {
fn get_size(self) -> Option<u32> {
let size = unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(), &local_name!("size"))