From 14b708311bf62ff6872621e47bddffdb9c810ff0 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 8 Mar 2018 21:31:04 +1100 Subject: [PATCH] Remove some useless clone() call on SpecifiedUrl::image_value. --- components/style/gecko/conversions.rs | 4 ++-- components/style/gecko/url.rs | 2 +- components/style/properties/gecko.mako.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index a36f82018df..e44057bab5d 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -155,12 +155,12 @@ impl nsStyleImage { }, GenericImage::Url(ref url) => { unsafe { - Gecko_SetLayerImageImageValue(self, url.image_value.clone().unwrap().get()); + Gecko_SetLayerImageImageValue(self, url.image_value.as_ref().unwrap().get()); } }, GenericImage::Rect(ref image_rect) => { unsafe { - Gecko_SetLayerImageImageValue(self, image_rect.url.image_value.clone().unwrap().get()); + Gecko_SetLayerImageImageValue(self, image_rect.url.image_value.as_ref().unwrap().get()); Gecko_InitializeImageCropRect(self); // Set CropRect diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index 323c6ebb9b3..ffe0ddea03b 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -150,7 +150,7 @@ impl MallocSizeOf for SpecifiedUrl { // Although this is a RefPtr, this is the primary reference because // SpecifiedUrl is responsible for creating the image_value. So we // measure unconditionally here. - n += unsafe { Gecko_ImageValue_SizeOfIncludingThis(image_value.clone().get()) }; + n += unsafe { Gecko_ImageValue_SizeOfIncludingThis(image_value.get()) }; } n diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 069cd146310..6ff85be6d1c 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -4073,7 +4073,7 @@ fn static_assert() { longhands::list_style_image::computed_value::T(Either::First(ref url)) => { unsafe { Gecko_SetListStyleImageImageValue(&mut self.gecko, - url.image_value.clone().unwrap().get()); + url.image_value.as_ref().unwrap().get()); } // We don't need to record this struct as uncacheable, like when setting // background-image to a url() value, since only properties in reset structs @@ -5291,7 +5291,7 @@ clip-path for i in 0..v.images.len() { unsafe { Gecko_SetCursorImageValue(&mut self.gecko.mCursorImages[i], - v.images[i].url.clone().image_value.unwrap().get()); + v.images[i].url.image_value.as_ref().unwrap().get()); } // We don't need to record this struct as uncacheable, like when setting @@ -5551,7 +5551,7 @@ clip-path ContentItem::Url(ref url) => { unsafe { bindings::Gecko_SetContentDataImageValue(&mut self.gecko.mContents[i], - url.image_value.clone().unwrap().get()) + url.image_value.as_ref().unwrap().get()) } } }