Remove some useless clone() call on SpecifiedUrl::image_value.

This commit is contained in:
Xidorn Quan 2018-03-08 21:31:04 +11:00
parent 72d09202f4
commit 14b708311b
3 changed files with 6 additions and 6 deletions

View file

@ -155,12 +155,12 @@ impl nsStyleImage {
}, },
GenericImage::Url(ref url) => { GenericImage::Url(ref url) => {
unsafe { 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) => { GenericImage::Rect(ref image_rect) => {
unsafe { 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); Gecko_InitializeImageCropRect(self);
// Set CropRect // Set CropRect

View file

@ -150,7 +150,7 @@ impl MallocSizeOf for SpecifiedUrl {
// Although this is a RefPtr, this is the primary reference because // Although this is a RefPtr, this is the primary reference because
// SpecifiedUrl is responsible for creating the image_value. So we // SpecifiedUrl is responsible for creating the image_value. So we
// measure unconditionally here. // measure unconditionally here.
n += unsafe { Gecko_ImageValue_SizeOfIncludingThis(image_value.clone().get()) }; n += unsafe { Gecko_ImageValue_SizeOfIncludingThis(image_value.get()) };
} }
n n

View file

@ -4073,7 +4073,7 @@ fn static_assert() {
longhands::list_style_image::computed_value::T(Either::First(ref url)) => { longhands::list_style_image::computed_value::T(Either::First(ref url)) => {
unsafe { unsafe {
Gecko_SetListStyleImageImageValue(&mut self.gecko, 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 // 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 // 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() { for i in 0..v.images.len() {
unsafe { unsafe {
Gecko_SetCursorImageValue(&mut self.gecko.mCursorImages[i], 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 // We don't need to record this struct as uncacheable, like when setting
@ -5551,7 +5551,7 @@ clip-path
ContentItem::Url(ref url) => { ContentItem::Url(ref url) => {
unsafe { unsafe {
bindings::Gecko_SetContentDataImageValue(&mut self.gecko.mContents[i], bindings::Gecko_SetContentDataImageValue(&mut self.gecko.mContents[i],
url.image_value.clone().unwrap().get()) url.image_value.as_ref().unwrap().get())
} }
} }
} }