mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #16202 - BorisChiou:stylo/animation/initial_computed_keyframes, r=emilio
stylo: Bug 1352067 - Initialize StyleAnimationValue with zeros. AnimationValue::mGecko and AnimationValue::mServo are mutually exclusive, so we have to make sure mGecko.IsNull() returns reasonable value, or we will got assertions. Hence, we should initialize it during constructing StyleAnimationValue from Servo side. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix Bug 1352067. - [X] These changes do not require tests because there are enough tests in Gecko <!-- 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/16202) <!-- Reviewable:end -->
This commit is contained in:
commit
a70e4ac5b2
1 changed files with 5 additions and 0 deletions
|
@ -1551,6 +1551,7 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
|
||||||
raw_data: RawServoStyleSetBorrowed,
|
raw_data: RawServoStyleSetBorrowed,
|
||||||
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut)
|
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut)
|
||||||
{
|
{
|
||||||
|
use std::mem;
|
||||||
use style::properties::LonghandIdSet;
|
use style::properties::LonghandIdSet;
|
||||||
use style::properties::declaration_block::Importance;
|
use style::properties::declaration_block::Importance;
|
||||||
use style::values::computed::Context;
|
use style::values::computed::Context;
|
||||||
|
@ -1614,6 +1615,10 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
|
||||||
unsafe { animation_values.set_len((i + 1) as u32) };
|
unsafe { animation_values.set_len((i + 1) as u32) };
|
||||||
seen.set_transition_property_bit(&anim.0);
|
seen.set_transition_property_bit(&anim.0);
|
||||||
animation_values[i].mProperty = anim.0.into();
|
animation_values[i].mProperty = anim.0.into();
|
||||||
|
// We only make sure we have enough space for this variable,
|
||||||
|
// but didn't construct a default value for StyleAnimationValue,
|
||||||
|
// so we should zero it to avoid getting undefined behaviors.
|
||||||
|
animation_values[i].mValue.mGecko = unsafe { mem::zeroed() };
|
||||||
animation_values[i].mValue.mServo.set_arc_leaky(Arc::new(anim.1));
|
animation_values[i].mValue.mServo.set_arc_leaky(Arc::new(anim.1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue