mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Tweak Stylist API for getting animations to avoid exposing the hash table.
This commit is contained in:
parent
6bdb0abebf
commit
68268226ea
3 changed files with 6 additions and 6 deletions
|
@ -533,7 +533,7 @@ pub fn maybe_start_animations(context: &SharedStyleContext,
|
|||
continue
|
||||
}
|
||||
|
||||
if let Some(ref anim) = context.stylist.animations().get(name) {
|
||||
if let Some(ref anim) = context.stylist.get_animation(name) {
|
||||
debug!("maybe_start_animations: animation {} found", name);
|
||||
|
||||
// If this animation doesn't have any keyframe, we can just continue
|
||||
|
@ -637,7 +637,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext,
|
|||
KeyframesRunningState::Paused(progress) => started_at + duration * progress,
|
||||
};
|
||||
|
||||
let animation = match context.stylist.animations().get(name) {
|
||||
let animation = match context.stylist.get_animation(name) {
|
||||
None => {
|
||||
warn!("update_style_for_animation: Animation {:?} not found", name);
|
||||
return;
|
||||
|
|
|
@ -1327,10 +1327,10 @@ impl Stylist {
|
|||
self.is_device_dirty
|
||||
}
|
||||
|
||||
/// Returns the map of registered `@keyframes` animations.
|
||||
/// Returns the registered `@keyframes` animation for the specified name.
|
||||
#[inline]
|
||||
pub fn animations(&self) -> &PrecomputedHashMap<Atom, KeyframesAnimation> {
|
||||
&self.animations
|
||||
pub fn get_animation(&self, name: &Atom) -> Option<&KeyframesAnimation> {
|
||||
self.animations.get(name)
|
||||
}
|
||||
|
||||
/// Computes the match results of a given element against the set of
|
||||
|
|
|
@ -3286,7 +3286,7 @@ pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetB
|
|||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) };
|
||||
|
||||
let animation = match data.stylist.animations().get(&name) {
|
||||
let animation = match data.stylist.get_animation(&name) {
|
||||
Some(animation) => animation,
|
||||
None => return false,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue