mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
style: Use Rust types for perspective and z-index.
Differential Revision: https://phabricator.services.mozilla.com/D20381
This commit is contained in:
parent
6428ed726d
commit
74d7d5bc42
8 changed files with 17 additions and 87 deletions
|
@ -14,7 +14,6 @@ use crate::values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
|
|||
use crate::values::computed::{Angle, Length, LengthPercentage};
|
||||
use crate::values::computed::{Number, NumberOrPercentage, Percentage};
|
||||
use crate::values::generics::basic_shape::ShapeRadius;
|
||||
use crate::values::generics::box_::Perspective;
|
||||
use crate::values::generics::gecko::ScrollSnapPoint;
|
||||
use crate::values::generics::grid::{TrackBreadth, TrackKeyword};
|
||||
use crate::values::generics::length::LengthPercentageOrAuto;
|
||||
|
@ -330,27 +329,6 @@ impl GeckoStyleCoordConvertible for ScrollSnapPoint<LengthPercentage> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<L> GeckoStyleCoordConvertible for Perspective<L>
|
||||
where
|
||||
L: GeckoStyleCoordConvertible,
|
||||
{
|
||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||
match *self {
|
||||
Perspective::None => coord.set_value(CoordDataValue::None),
|
||||
Perspective::Length(ref l) => l.to_gecko_style_coord(coord),
|
||||
};
|
||||
}
|
||||
|
||||
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||
use crate::gecko_bindings::structs::root::nsStyleUnit;
|
||||
|
||||
if coord.unit() == nsStyleUnit::eStyleUnit_None {
|
||||
return Some(Perspective::None);
|
||||
}
|
||||
Some(Perspective::Length(L::from_gecko_style_coord(coord)?))
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert a given RGBA value to `nscolor`.
|
||||
pub fn convert_rgba_to_nscolor(rgba: &RGBA) -> u32 {
|
||||
((rgba.alpha as u32) << 24) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue