mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #17682 - birtles:check-pref-for-frames-timing, r=hiro
Check Gecko pref before parsing frames() timing function These are the Servo-side changes for [Gecko bug 1379582](https://bugzilla.mozilla.org/show_bug.cgi?id=1379582). They have been reviewed by @hiikezoe. <!-- 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/17682) <!-- Reviewable:end -->
This commit is contained in:
commit
882fc4731c
2 changed files with 20 additions and 2 deletions
|
@ -803,6 +803,9 @@ extern "C" {
|
|||
ComputedTimingFunction_BeforeFlag)
|
||||
-> f64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_IsFramesTimingEnabled() -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_AnimationGetBaseStyle(aBaseStyles:
|
||||
*mut ::std::os::raw::c_void,
|
||||
|
|
|
@ -131,6 +131,17 @@ impl<S> OriginComponent<S> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
#[inline]
|
||||
fn allow_frames_timing() -> bool {
|
||||
use gecko_bindings::bindings;
|
||||
unsafe { bindings::Gecko_IsFramesTimingEnabled() }
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
#[inline]
|
||||
fn allow_frames_timing() -> bool { true }
|
||||
|
||||
impl Parse for TimingFunction {
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(keyword) = input.try(TimingKeyword::parse) {
|
||||
|
@ -172,8 +183,12 @@ impl Parse for TimingFunction {
|
|||
Ok(GenericTimingFunction::Steps(steps, position))
|
||||
},
|
||||
"frames" => {
|
||||
let frames = Integer::parse_with_minimum(context, i, 2)?;
|
||||
Ok(GenericTimingFunction::Frames(frames))
|
||||
if allow_frames_timing() {
|
||||
let frames = Integer::parse_with_minimum(context, i, 2)?;
|
||||
Ok(GenericTimingFunction::Frames(frames))
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
},
|
||||
_ => Err(()),
|
||||
}).map_err(|()| StyleParseError::UnexpectedFunction(function).into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue