mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
servo: Merge #14227 - Stylo - gecko glue code for font-size-adjust (from chenpighead:font-size-adjust-gecko); r=Manishearth
<!-- Please describe your changes on the following line: --> Implement the gecko-side glue code for font-size-adjust. This is a followup for #14125, which is originally filed in #13875. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: a4e26d503af5589262e0ad2a73b40325fc7ef8a0
This commit is contained in:
parent
600c23a426
commit
e902ebee42
@ -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…
Reference in New Issue
Block a user