mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Stop using nsStyleSides for -moz-image-rect.
Differential Revision: https://phabricator.services.mozilla.com/D36119
This commit is contained in:
parent
cc15afa348
commit
8d127014c3
1 changed files with 10 additions and 37 deletions
|
@ -69,18 +69,7 @@ impl nsStyleImage {
|
||||||
|
|
||||||
// Set CropRect
|
// Set CropRect
|
||||||
let ref mut rect = *self.mCropRect.mPtr;
|
let ref mut rect = *self.mCropRect.mPtr;
|
||||||
image_rect
|
*rect = Rect(image_rect.top, image_rect.right, image_rect.bottom, image_rect.left);
|
||||||
.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));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GenericImage::Element(ref element) => unsafe {
|
GenericImage::Element(ref element) => unsafe {
|
||||||
|
@ -98,7 +87,7 @@ impl nsStyleImage {
|
||||||
/// Converts into Image.
|
/// Converts into Image.
|
||||||
pub unsafe fn into_image(self: &nsStyleImage) -> Option<Image> {
|
pub unsafe fn into_image(self: &nsStyleImage) -> Option<Image> {
|
||||||
use crate::gecko_bindings::structs::nsStyleImageType;
|
use crate::gecko_bindings::structs::nsStyleImageType;
|
||||||
use crate::values::computed::{MozImageRect, NumberOrPercentage};
|
use crate::values::computed::MozImageRect;
|
||||||
|
|
||||||
match self.mType {
|
match self.mType {
|
||||||
nsStyleImageType::eStyleImageType_Null => None,
|
nsStyleImageType::eStyleImageType_Null => None,
|
||||||
|
@ -107,30 +96,14 @@ impl nsStyleImage {
|
||||||
if self.mCropRect.mPtr.is_null() {
|
if self.mCropRect.mPtr.is_null() {
|
||||||
Some(GenericImage::Url(url))
|
Some(GenericImage::Url(url))
|
||||||
} else {
|
} else {
|
||||||
let ref rect = *self.mCropRect.mPtr;
|
let rect = &*self.mCropRect.mPtr;
|
||||||
match (
|
Some(GenericImage::Rect(Box::new(MozImageRect {
|
||||||
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(0)),
|
url,
|
||||||
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(1)),
|
top: rect.0,
|
||||||
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(2)),
|
right: rect.1,
|
||||||
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(3)),
|
bottom: rect.2,
|
||||||
) {
|
left: rect.3,
|
||||||
(Some(top), Some(right), Some(bottom), Some(left)) => {
|
})))
|
||||||
Some(GenericImage::Rect(Box::new(MozImageRect {
|
|
||||||
url,
|
|
||||||
top,
|
|
||||||
right,
|
|
||||||
bottom,
|
|
||||||
left,
|
|
||||||
})))
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
debug_assert!(
|
|
||||||
false,
|
|
||||||
"mCropRect could not convert to NumberOrPercentage"
|
|
||||||
);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nsStyleImageType::eStyleImageType_Gradient => {
|
nsStyleImageType::eStyleImageType_Gradient => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue