Skip to content

Commit

Permalink
Bug 1328787 - Part 5: Implement Servo_StyleSet_FillKeyframesForName. …
Browse files Browse the repository at this point in the history
…r=heycam

PropertyValuePair will be set in subsequent patches.

MozReview-Commit-ID: LhAwlnzMbiT
  • Loading branch information
Hiroyuki Ikezoe committed Jan 29, 2017
1 parent cd0a6b9 commit 092440b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ports/geckolib/glue.rs
Expand Up @@ -35,8 +35,10 @@ use style::gecko_bindings::bindings::{RawServoStyleSheetBorrowed, ServoComputedV
use style::gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong};
use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong};
use style::gecko_bindings::bindings::{nsACString, nsAString};
use style::gecko_bindings::bindings::Gecko_AnimationAppendKeyframe;
use style::gecko_bindings::bindings::RawGeckoAnimationValueListBorrowedMut;
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
use style::gecko_bindings::bindings::RawGeckoKeyframeListBorrowedMut;
use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
Expand All @@ -51,6 +53,7 @@ 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::nsTimingFunction;
use style::gecko_bindings::structs::nsresult;
use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasBoxFFI};
use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, Strong};
Expand Down Expand Up @@ -1139,3 +1142,30 @@ pub extern "C" fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed) {

assert_subtree_is_clean(root);
}

#[no_mangle]
pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSetBorrowed,
name: *const nsACString,
timing_function: *const nsTimingFunction,
_style: ServoComputedValuesBorrowed,
keyframes: RawGeckoKeyframeListBorrowedMut) -> bool {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) };
let style_timing_function = unsafe { timing_function.as_ref().unwrap() };

if let Some(ref animation) = data.stylist.animations().get(&name) {
for step in &animation.steps {
let timing_function = *style_timing_function;

let _keyframe = unsafe {
Gecko_AnimationAppendKeyframe(keyframes,
step.start_percentage.0 as f32,
&timing_function)
};
// Set each PropertyValuePair.
}
return true
}
false
}

0 comments on commit 092440b

Please sign in to comment.