mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Stylo - gecko glue code for font-size-adjust.
This commit is contained in:
parent
969c7ec06f
commit
32bf5ab8b0
2 changed files with 37 additions and 4 deletions
|
@ -887,7 +887,7 @@ fn static_assert() {
|
|||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="Font"
|
||||
skip_longhands="font-family font-size font-weight font-synthesis"
|
||||
skip_longhands="font-family font-size font-size-adjust font-weight font-synthesis"
|
||||
skip_additionals="*">
|
||||
|
||||
pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) {
|
||||
|
@ -974,6 +974,28 @@ fn static_assert() {
|
|||
self.gecko.mFont.synthesis = other.gecko.mFont.synthesis;
|
||||
}
|
||||
|
||||
pub fn set_font_size_adjust(&mut self, v: longhands::font_size_adjust::computed_value::T) {
|
||||
use properties::longhands::font_size_adjust::computed_value::T;
|
||||
match v {
|
||||
T::None => self.gecko.mFont.sizeAdjust = -1.0 as f32,
|
||||
T::Number(n) => self.gecko.mFont.sizeAdjust = n.0 as f32,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_font_size_adjust_from(&mut self, other: &Self) {
|
||||
self.gecko.mFont.sizeAdjust = other.gecko.mFont.sizeAdjust;
|
||||
}
|
||||
|
||||
pub fn clone_font_size_adjust(&self) -> longhands::font_size_adjust::computed_value::T {
|
||||
use properties::longhands::font_size_adjust::computed_value::T;
|
||||
use values::specified::Number;
|
||||
|
||||
match self.gecko.mFont.sizeAdjust {
|
||||
-1.0 => T::None,
|
||||
_ => T::Number(Number(self.gecko.mFont.sizeAdjust)),
|
||||
}
|
||||
}
|
||||
|
||||
</%self:impl_trait>
|
||||
|
||||
<% skip_box_longhands= """display overflow-y vertical-align
|
||||
|
|
|
@ -353,8 +353,7 @@ ${helpers.single_keyword("font-variant",
|
|||
</%helpers:longhand>
|
||||
|
||||
// https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop
|
||||
// FIXME: This prop should be animatable
|
||||
<%helpers:longhand products="none" name="font-size-adjust" animatable="False">
|
||||
<%helpers:longhand products="gecko" name="font-size-adjust" animatable="True">
|
||||
use values::NoViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use values::specified::Number;
|
||||
|
@ -362,7 +361,7 @@ ${helpers.single_keyword("font-variant",
|
|||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
impl NoViewportPercentage for SpecifiedValue {}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum SpecifiedValue {
|
||||
None,
|
||||
|
@ -372,6 +371,8 @@ ${helpers.single_keyword("font-variant",
|
|||
pub mod computed_value {
|
||||
use style_traits::ToCss;
|
||||
use std::fmt;
|
||||
use properties::animated_properties::Interpolate;
|
||||
use values::specified::Number;
|
||||
|
||||
pub use super::SpecifiedValue as T;
|
||||
|
||||
|
@ -383,6 +384,16 @@ ${helpers.single_keyword("font-variant",
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Interpolate for T {
|
||||
fn interpolate(&self, other: &Self, time: f64) -> Result<Self, ()> {
|
||||
match (*self, *other) {
|
||||
(T::Number(ref number), T::Number(ref other)) =>
|
||||
Ok(T::Number(Number(try!(number.0.interpolate(&other.0, time))))),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline] pub fn get_initial_value() -> computed_value::T {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue