Auto merge of #15442 - BorisChiou:animation/opacity_transform, r=Manishearth

Retrieve the opacity and the transform list from RawServoAnimationValue

These are the servo-side changes for [bug 1335942](https://bugzilla.mozilla.org/show_bug.cgi?id=1335942). @Manishearth had already reviewed them there. Please merge these patches until the gecko-side changes for [bug 1335942](https://bugzilla.mozilla.org/show_bug.cgi?id=1335942) is landed.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [bug 1335942](https://bugzilla.mozilla.org/show_bug.cgi?id=1335942).
- [X] These changes do not require tests because there are existing tests for this in mozilla-central

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15442)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-08 18:39:45 -08:00 committed by GitHub
commit 11c86b82f6
6 changed files with 71 additions and 19 deletions

View file

@ -53,11 +53,13 @@ use style::gecko_bindings::structs::Loader;
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
use style::gecko_bindings::structs::RawServoAnimationValueBorrowedListBorrowed;
use style::gecko_bindings::structs::ServoStyleSheet;
use style::gecko_bindings::structs::nsCSSValueSharedList;
use style::gecko_bindings::structs::nsTimingFunction;
use style::gecko_bindings::structs::nsresult;
use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasBoxFFI};
use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, Strong};
use style::gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI};
use style::gecko_properties::style_structs;
use style::keyframes::KeyframesStepValue;
use style::parallel;
use style::parser::{ParserContext, ParserContextExtraData};
@ -205,6 +207,30 @@ pub extern "C" fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueB
})).into_strong()
}
#[no_mangle]
pub extern "C" fn Servo_AnimationValues_GetOpacity(value: RawServoAnimationValueBorrowed)
-> f32
{
let value = AnimationValue::as_arc(&value);
if let AnimationValue::Opacity(opacity) = **value {
opacity
} else {
panic!("The AnimationValue should be Opacity");
}
}
#[no_mangle]
pub extern "C" fn Servo_AnimationValues_GetTransform(value: RawServoAnimationValueBorrowed,
list: &mut structs::RefPtr<nsCSSValueSharedList>)
{
let value = AnimationValue::as_arc(&value);
if let AnimationValue::Transform(ref servo_list) = **value {
style_structs::Box::convert_transform(servo_list.0.clone().unwrap(), list);
} else {
panic!("The AnimationValue should be transform");
}
}
/// Takes a ServoAnimationValues and populates it with the animation values corresponding
/// to a given property declaration block
#[no_mangle]
@ -253,7 +279,7 @@ pub extern "C" fn Servo_AnimationValues_Populate(anim: RawGeckoAnimationValueLis
// and thus can't directly use `geckoiter`
let local_geckoiter = &mut geckoiter;
for (gecko, servo) in local_geckoiter.zip(&mut iter) {
gecko.mServoValue.set_arc_leaky(Arc::new(servo));
gecko.mValue.mServo.set_arc_leaky(Arc::new(servo));
}
}