Add AnimationValueMap and expose it in FFI.

Current Gecko composes all of effects in the composite order at once.
We can put each computed value into this AnimationValueMap every time composing
an effect.
This commit is contained in:
Hiroyuki Ikezoe 2017-03-17 12:29:08 +09:00
parent ba18c14b91
commit 52bee9a4cf
6 changed files with 36 additions and 2 deletions

View file

@ -421,6 +421,7 @@ mod bindings {
"mozilla::Side",
"mozilla::binding_danger::AssertAndSuppressCleanupPolicy",
"RawServoAnimationValueBorrowedListBorrowed",
"RawServoAnimationValueMapBorrowed",
];
let opaque_types = [
"std::pair__PCCP",
@ -541,6 +542,7 @@ mod bindings {
"RawGeckoNode",
"RawGeckoAnimationValueList",
"RawServoAnimationValue",
"RawServoAnimationValueMap",
"RawServoDeclarationBlock",
"RawGeckoPresContext",
"RawGeckoPresContextOwned",

View file

@ -11,12 +11,12 @@
use gecko_bindings::bindings::{RawServoMediaList, RawServoMediaRule, RawServoNamespaceRule};
use gecko_bindings::bindings::{RawServoStyleSheet, RawServoStyleRule, RawServoImportRule};
use gecko_bindings::bindings::{ServoComputedValues, ServoCssRules};
use gecko_bindings::structs::{RawServoAnimationValue, RawServoDeclarationBlock};
use gecko_bindings::structs::{RawServoAnimationValue, RawServoAnimationValueMap, RawServoDeclarationBlock};
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI};
use media_queries::MediaList;
use parking_lot::RwLock;
use properties::{ComputedValues, PropertyDeclarationBlock};
use properties::animated_properties::AnimationValue;
use properties::animated_properties::{AnimationValue, AnimationValueMap};
use stylesheets::{CssRules, Stylesheet, StyleRule, ImportRule, MediaRule, NamespaceRule};
macro_rules! impl_arc_ffi {
@ -59,6 +59,9 @@ impl_arc_ffi!(RwLock<ImportRule> => RawServoImportRule
impl_arc_ffi!(AnimationValue => RawServoAnimationValue
[Servo_AnimationValue_AddRef, Servo_AnimationValue_Release]);
impl_arc_ffi!(RwLock<AnimationValueMap> => RawServoAnimationValueMap
[Servo_AnimationValueMap_AddRef, Servo_AnimationValueMap_Release]);
impl_arc_ffi!(RwLock<MediaList> => RawServoMediaList
[Servo_MediaList_AddRef, Servo_MediaList_Release]);

View file

@ -11,6 +11,7 @@ use gecko_bindings::structs::RawGeckoComputedKeyframeValuesList;
use gecko_bindings::structs::RawGeckoNode;
use gecko_bindings::structs::RawGeckoAnimationValueList;
use gecko_bindings::structs::RawServoAnimationValue;
use gecko_bindings::structs::RawServoAnimationValueMap;
use gecko_bindings::structs::RawServoDeclarationBlock;
use gecko_bindings::structs::RawGeckoPresContext;
use gecko_bindings::structs::RawGeckoPresContextOwned;
@ -207,6 +208,9 @@ pub struct RawServoImportRule(RawServoImportRuleVoid);
pub type RawServoAnimationValueStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoAnimationValue>;
pub type RawServoAnimationValueBorrowed<'a> = &'a RawServoAnimationValue;
pub type RawServoAnimationValueBorrowedOrNull<'a> = Option<&'a RawServoAnimationValue>;
pub type RawServoAnimationValueMapStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoAnimationValueMap>;
pub type RawServoAnimationValueMapBorrowed<'a> = &'a RawServoAnimationValueMap;
pub type RawServoAnimationValueMapBorrowedOrNull<'a> = Option<&'a RawServoAnimationValueMap>;
pub type RawServoMediaListStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoMediaList>;
pub type RawServoMediaListBorrowed<'a> = &'a RawServoMediaList;
pub type RawServoMediaListBorrowedOrNull<'a> = Option<&'a RawServoMediaList>;
@ -325,6 +329,14 @@ extern "C" {
extern "C" {
pub fn Servo_AnimationValue_Release(ptr: RawServoAnimationValueBorrowed);
}
extern "C" {
pub fn Servo_AnimationValueMap_AddRef(ptr:
RawServoAnimationValueMapBorrowed);
}
extern "C" {
pub fn Servo_AnimationValueMap_Release(ptr:
RawServoAnimationValueMapBorrowed);
}
extern "C" {
pub fn Servo_MediaList_AddRef(ptr: RawServoMediaListBorrowed);
}

View file

@ -25843,6 +25843,9 @@ pub mod root {
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RawServoStyleSet([u8; 0]);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RawServoAnimationValueMap([u8; 0]);
pub type RawGeckoNode = root::nsINode;
pub type RawGeckoElement = root::mozilla::dom::Element;
pub type RawGeckoDocument = root::nsIDocument;
@ -25856,6 +25859,8 @@ pub mod root {
root::nsTArray<*const root::RawServoAnimationValue>;
pub type RawGeckoStyleAnimationList =
root::nsStyleAutoArray<root::mozilla::StyleAnimation>;
pub type RawServoAnimationValueMapBorrowed =
*const root::RawServoAnimationValueMap;
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;

View file

@ -25201,6 +25201,9 @@ pub mod root {
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RawServoStyleSet([u8; 0]);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RawServoAnimationValueMap([u8; 0]);
pub type RawGeckoNode = root::nsINode;
pub type RawGeckoElement = root::mozilla::dom::Element;
pub type RawGeckoDocument = root::nsIDocument;
@ -25214,6 +25217,8 @@ pub mod root {
root::nsTArray<*const root::RawServoAnimationValue>;
pub type RawGeckoStyleAnimationList =
root::nsStyleAutoArray<root::mozilla::StyleAnimation>;
pub type RawServoAnimationValueMapBorrowed =
*const root::RawServoAnimationValueMap;
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;

View file

@ -25,6 +25,7 @@ use properties::longhands::visibility::computed_value::T as Visibility;
use properties::longhands::z_index::computed_value::T as ZIndex;
#[cfg(feature = "gecko")] use properties::{PropertyDeclarationId, LonghandId};
use std::cmp;
#[cfg(feature = "gecko")] use std::collections::HashMap;
use std::fmt;
use style_traits::ToCss;
use super::ComputedValues;
@ -252,6 +253,12 @@ impl AnimatedProperty {
}
}
/// A collection of AnimationValue that were composed on an element.
/// This HashMap stores the values that are the last AnimationValue to be
/// composed for each TransitionProperty.
#[cfg(feature = "gecko")]
pub type AnimationValueMap = HashMap<TransitionProperty, AnimationValue>;
/// An enum to represent a single computed value belonging to an animated
/// property in order to be interpolated with another one. When interpolating,
/// both values need to belong to the same property.