mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Create a module for generics and make BorderRadiusSize generic
This commit is contained in:
parent
c5c6e8c442
commit
0249270f61
9 changed files with 91 additions and 74 deletions
|
@ -543,15 +543,14 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor {
|
|||
% if need_clone:
|
||||
#[allow(non_snake_case)]
|
||||
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
|
||||
use properties::longhands::${ident}::computed_value::T;
|
||||
use euclid::Size2D;
|
||||
use values::generics::BorderRadiusSize;
|
||||
let width = GeckoStyleCoordConvertible::from_gecko_style_coord(
|
||||
&self.gecko.${gecko_ffi_name}.data_at(${x_index}))
|
||||
.expect("Failed to clone ${ident}");
|
||||
let height = GeckoStyleCoordConvertible::from_gecko_style_coord(
|
||||
&self.gecko.${gecko_ffi_name}.data_at(${y_index}))
|
||||
.expect("Failed to clone ${ident}");
|
||||
T(Size2D::new(width, height))
|
||||
BorderRadiusSize::new(width, height)
|
||||
}
|
||||
% endif
|
||||
</%def>
|
||||
|
|
|
@ -31,7 +31,7 @@ use std::fmt;
|
|||
use style_traits::ToCss;
|
||||
use super::ComputedValues;
|
||||
use values::CSSFloat;
|
||||
use values::{Auto, Either, Normal};
|
||||
use values::{Auto, Either, Normal, generics};
|
||||
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone};
|
||||
use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
|
||||
|
@ -711,7 +711,7 @@ impl<T: Interpolate + Copy> Interpolate for Point2D<T> {
|
|||
impl Interpolate for BorderRadiusSize {
|
||||
#[inline]
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
self.0.interpolate(&other.0, progress).map(BorderRadiusSize)
|
||||
self.0.interpolate(&other.0, progress).map(generics::BorderRadiusSize)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue