style: More ComputedValuesInner cleanup.

MozReview-Commit-ID: 8rkAP3pMEpD
This commit is contained in:
Emilio Cobos Álvarez 2017-07-18 16:47:13 +02:00
parent 07e1c6e75a
commit fe8638a618
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 34 additions and 33 deletions

View file

@ -110,13 +110,13 @@ impl<'a> Iterator for PropertyDeclarationIterator<'a> {
pub struct AnimationValueIterator<'a, 'cx, 'cx_a:'cx> {
iter: Iter<'a, (PropertyDeclaration, Importance)>,
context: &'cx mut Context<'cx_a>,
default_values: &'a ComputedValuesInner,
default_values: &'a ComputedValues,
}
impl<'a, 'cx, 'cx_a:'cx> AnimationValueIterator<'a, 'cx, 'cx_a> {
fn new(declarations: &'a PropertyDeclarationBlock,
context: &'cx mut Context<'cx_a>,
default_values: &'a ComputedValuesInner) -> AnimationValueIterator<'a, 'cx, 'cx_a> {
default_values: &'a ComputedValues) -> AnimationValueIterator<'a, 'cx, 'cx_a> {
AnimationValueIterator {
iter: declarations.declarations().iter(),
context: context,
@ -204,7 +204,7 @@ impl PropertyDeclarationBlock {
/// Return an iterator of (AnimatableLonghand, AnimationValue).
pub fn to_animation_value_iter<'a, 'cx, 'cx_a:'cx>(&'a self,
context: &'cx mut Context<'cx_a>,
default_values: &'a ComputedValuesInner)
default_values: &'a ComputedValues)
-> AnimationValueIterator<'a, 'cx, 'cx_a> {
AnimationValueIterator::new(self, context, default_values)
}

View file

@ -29,7 +29,7 @@ use smallvec::SmallVec;
use std::cmp;
#[cfg(feature = "gecko")] use fnv::FnvHashMap;
use style_traits::ParseError;
use super::ComputedValuesInner;
use super::ComputedValues;
#[cfg(any(feature = "gecko", feature = "testing"))]
use values::Auto;
use values::{CSSFloat, CustomIdent, Either};
@ -394,7 +394,7 @@ impl AnimatedProperty {
/// Update `style` with the proper computed style corresponding to this
/// animation at `progress`.
pub fn update(&self, style: &mut ComputedValuesInner, progress: f64) {
pub fn update(&self, style: &mut ComputedValues, progress: f64) {
match *self {
% for prop in data.longhands:
% if prop.animatable:
@ -427,8 +427,8 @@ impl AnimatedProperty {
/// Get an animatable value from a transition-property, an old style, and a
/// new style.
pub fn from_animatable_longhand(property: &AnimatableLonghand,
old_style: &ComputedValuesInner,
new_style: &ComputedValuesInner)
old_style: &ComputedValues,
new_style: &ComputedValues)
-> AnimatedProperty {
match *property {
% for prop in data.longhands:
@ -521,7 +521,7 @@ impl AnimationValue {
/// Construct an AnimationValue from a property declaration
pub fn from_declaration(decl: &PropertyDeclaration, context: &mut Context,
initial: &ComputedValuesInner) -> Option<Self> {
initial: &ComputedValues) -> Option<Self> {
use properties::LonghandId;
match *decl {
@ -593,7 +593,7 @@ impl AnimationValue {
/// Get an AnimationValue for an AnimatableLonghand from a given computed values.
pub fn from_computed_values(property: &AnimatableLonghand,
computed_values: &ComputedValuesInner)
computed_values: &ComputedValues)
-> Self {
match *property {
% for prop in data.longhands:

View file

@ -124,6 +124,11 @@ impl FontComputationData {
pub fn default_font_size_keyword() -> Option<(longhands::font_size::KeywordSize, f32)> {
Some((Default::default(), 1.))
}
/// Gets a FontComputationData with the default values.
pub fn default_values() -> Self {
Self::new(Self::default_font_size_keyword())
}
}
impl<T> MaybeBoxed<T> for T {
@ -1953,10 +1958,6 @@ impl ComputedValues {
/// Get the initial computed values.
pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES }
/// Servo doesn't track the pseudo-element, so no need to do anything fancy
/// here.
fn pseudo(&self) -> Option<<&PseudoElement> { None }
}
#[cfg(feature = "servo")]