style: Stop using nsStyleSides for -moz-image-rect.

Differential Revision: https://phabricator.services.mozilla.com/D36119
This commit is contained in:
Emilio Cobos Álvarez 2019-06-28 09:46:17 +00:00
parent cc15afa348
commit 8d127014c3
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -69,18 +69,7 @@ impl nsStyleImage {
// Set CropRect
let ref mut rect = *self.mCropRect.mPtr;
image_rect
.top
.to_gecko_style_coord(&mut rect.data_at_mut(0));
image_rect
.right
.to_gecko_style_coord(&mut rect.data_at_mut(1));
image_rect
.bottom
.to_gecko_style_coord(&mut rect.data_at_mut(2));
image_rect
.left
.to_gecko_style_coord(&mut rect.data_at_mut(3));
*rect = Rect(image_rect.top, image_rect.right, image_rect.bottom, image_rect.left);
}
},
GenericImage::Element(ref element) => unsafe {
@ -98,7 +87,7 @@ impl nsStyleImage {
/// Converts into Image.
pub unsafe fn into_image(self: &nsStyleImage) -> Option<Image> {
use crate::gecko_bindings::structs::nsStyleImageType;
use crate::values::computed::{MozImageRect, NumberOrPercentage};
use crate::values::computed::MozImageRect;
match self.mType {
nsStyleImageType::eStyleImageType_Null => None,
@ -107,30 +96,14 @@ impl nsStyleImage {
if self.mCropRect.mPtr.is_null() {
Some(GenericImage::Url(url))
} else {
let ref rect = *self.mCropRect.mPtr;
match (
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(0)),
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(1)),
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(2)),
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(3)),
) {
(Some(top), Some(right), Some(bottom), Some(left)) => {
let rect = &*self.mCropRect.mPtr;
Some(GenericImage::Rect(Box::new(MozImageRect {
url,
top,
right,
bottom,
left,
top: rect.0,
right: rect.1,
bottom: rect.2,
left: rect.3,
})))
},
_ => {
debug_assert!(
false,
"mCropRect could not convert to NumberOrPercentage"
);
None
},
}
}
},
nsStyleImageType::eStyleImageType_Gradient => {