mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
When parsing values in `process_a_keyframes_argument` we don't expand properties using `StyleComputer::for_each_property_expanding_shorthands` unlike most other places - this means that if we parse a `border` we end up with the `border`'s sub-properties (`border-width`, `border-style`, `border-color`) still in their unexpanded forms (`CSSKeywordValue`, `LengthStyleValue`, `StyleValueList`, etc) rather than `ShorthandStyleValue`s which causes a crash when serializing the `border` value in `KeyframeEffect::get_keyframes`. The proper fix here is to parse `border`'s sub-properties directly to `ShorthandStyleValue`s instead of relying on `StyleComputer::for_each_property_expanding_shorthand` to do this conversion for us but this may be a while off. This commit also imports the previously crashing tests.
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
// =======================================
|
|
//
|
|
// Utility functions for testing timing
|
|
//
|
|
// =======================================
|
|
|
|
|
|
// ------------------------------
|
|
// Helper functions
|
|
// ------------------------------
|
|
|
|
// Utility function to check that a subset of timing properties have their
|
|
// default values.
|
|
function assert_default_timing_except(effect, propertiesToSkip) {
|
|
const defaults = {
|
|
delay: 0,
|
|
endDelay: 0,
|
|
fill: 'auto',
|
|
iterationStart: 0,
|
|
iterations: 1,
|
|
duration: 'auto',
|
|
direction: 'normal',
|
|
easing: 'linear',
|
|
};
|
|
|
|
for (const prop of Object.keys(defaults)) {
|
|
if (propertiesToSkip.includes(prop)) {
|
|
continue;
|
|
}
|
|
|
|
assert_equals(
|
|
effect.getTiming()[prop],
|
|
defaults[prop],
|
|
`${prop} parameter has default value:`
|
|
);
|
|
}
|
|
}
|
|
|
|
function waitForAnimationTime(animation, time) {
|
|
return new Promise((resolve) => {
|
|
function raf() {
|
|
if (animation.currentTime < time) {
|
|
requestAnimationFrame(raf);
|
|
} else {
|
|
resolve();
|
|
}
|
|
}
|
|
requestAnimationFrame(raf);
|
|
});
|
|
}
|