зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1676062 - Use a dummy URL data in Servo_ParseEasing and drop Document* and URLExtraData* arguments from relevant functions. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D96791
This commit is contained in:
Родитель
bd1f96ff2d
Коммит
fc509369c5
|
@ -321,7 +321,7 @@ void AnimationEffect::GetComputedTimingAsDict(
|
||||||
void AnimationEffect::UpdateTiming(const OptionalEffectTiming& aTiming,
|
void AnimationEffect::UpdateTiming(const OptionalEffectTiming& aTiming,
|
||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
TimingParams timing =
|
TimingParams timing =
|
||||||
TimingParams::MergeOptionalEffectTiming(mTiming, aTiming, mDocument, aRv);
|
TimingParams::MergeOptionalEffectTiming(mTiming, aTiming, aRv);
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -835,8 +835,7 @@ already_AddRefed<KeyframeEffect> KeyframeEffect::ConstructKeyframeEffect(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimingParams timingParams =
|
TimingParams timingParams = TimingParams::FromOptionsUnion(aOptions, aRv);
|
||||||
TimingParams::FromOptionsUnion(aOptions, doc, aRv);
|
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,8 +444,8 @@ static bool ConvertKeyframeSequence(JSContext* aCx, dom::Document* aDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parseEasingResult.Failed()) {
|
if (!parseEasingResult.Failed()) {
|
||||||
keyframe->mTimingFunction = TimingParams::ParseEasing(
|
keyframe->mTimingFunction =
|
||||||
keyframeDict.mEasing, aDocument, parseEasingResult);
|
TimingParams::ParseEasing(keyframeDict.mEasing, parseEasingResult);
|
||||||
// Even if the above fails, we still need to continue reading off all the
|
// Even if the above fails, we still need to continue reading off all the
|
||||||
// properties since checking the validity of easing should be treated as
|
// properties since checking the validity of easing should be treated as
|
||||||
// a separate step that happens *after* all the other processing in this
|
// a separate step that happens *after* all the other processing in this
|
||||||
|
@ -1099,7 +1099,7 @@ static void GetKeyframeListFromPropertyIndexedKeyframe(
|
||||||
FallibleTArray<Maybe<ComputedTimingFunction>> easings;
|
FallibleTArray<Maybe<ComputedTimingFunction>> easings;
|
||||||
auto parseAndAppendEasing = [&](const nsString& easingString,
|
auto parseAndAppendEasing = [&](const nsString& easingString,
|
||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
auto easing = TimingParams::ParseEasing(easingString, aDocument, aRv);
|
auto easing = TimingParams::ParseEasing(easingString, aRv);
|
||||||
if (!aRv.Failed() && !easings.AppendElement(std::move(easing), fallible)) {
|
if (!aRv.Failed() && !easings.AppendElement(std::move(easing), fallible)) {
|
||||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ const dom::EffectTiming& GetTimingProperties(
|
||||||
template <class OptionsType>
|
template <class OptionsType>
|
||||||
/* static */
|
/* static */
|
||||||
TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
|
TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
|
||||||
dom::Document* aDocument,
|
|
||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
TimingParams result;
|
TimingParams result;
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
|
||||||
result.Update();
|
result.Update();
|
||||||
} else {
|
} else {
|
||||||
const dom::EffectTiming& timing = GetTimingProperties(aOptions);
|
const dom::EffectTiming& timing = GetTimingProperties(aOptions);
|
||||||
result = FromEffectTiming(timing, aDocument, aRv);
|
result = FromEffectTiming(timing, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -64,21 +63,20 @@ TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
|
||||||
/* static */
|
/* static */
|
||||||
TimingParams TimingParams::FromOptionsUnion(
|
TimingParams TimingParams::FromOptionsUnion(
|
||||||
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
|
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
|
||||||
dom::Document* aDocument, ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
return FromOptionsType(aOptions, aDocument, aRv);
|
return FromOptionsType(aOptions, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
TimingParams TimingParams::FromOptionsUnion(
|
TimingParams TimingParams::FromOptionsUnion(
|
||||||
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
||||||
dom::Document* aDocument, ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
return FromOptionsType(aOptions, aDocument, aRv);
|
return FromOptionsType(aOptions, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
TimingParams TimingParams::FromEffectTiming(
|
TimingParams TimingParams::FromEffectTiming(
|
||||||
const dom::EffectTiming& aEffectTiming, dom::Document* aDocument,
|
const dom::EffectTiming& aEffectTiming, ErrorResult& aRv) {
|
||||||
ErrorResult& aRv) {
|
|
||||||
TimingParams result;
|
TimingParams result;
|
||||||
|
|
||||||
Maybe<StickyTimeDuration> duration =
|
Maybe<StickyTimeDuration> duration =
|
||||||
|
@ -95,7 +93,7 @@ TimingParams TimingParams::FromEffectTiming(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Maybe<ComputedTimingFunction> easing =
|
Maybe<ComputedTimingFunction> easing =
|
||||||
TimingParams::ParseEasing(aEffectTiming.mEasing, aDocument, aRv);
|
TimingParams::ParseEasing(aEffectTiming.mEasing, aRv);
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +115,7 @@ TimingParams TimingParams::FromEffectTiming(
|
||||||
/* static */
|
/* static */
|
||||||
TimingParams TimingParams::MergeOptionalEffectTiming(
|
TimingParams TimingParams::MergeOptionalEffectTiming(
|
||||||
const TimingParams& aSource, const dom::OptionalEffectTiming& aEffectTiming,
|
const TimingParams& aSource, const dom::OptionalEffectTiming& aEffectTiming,
|
||||||
dom::Document* aDocument, ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
MOZ_ASSERT(!aRv.Failed(), "Initially return value should be ok");
|
MOZ_ASSERT(!aRv.Failed(), "Initially return value should be ok");
|
||||||
|
|
||||||
TimingParams result = aSource;
|
TimingParams result = aSource;
|
||||||
|
@ -150,8 +148,7 @@ TimingParams TimingParams::MergeOptionalEffectTiming(
|
||||||
|
|
||||||
Maybe<ComputedTimingFunction> easing;
|
Maybe<ComputedTimingFunction> easing;
|
||||||
if (aEffectTiming.mEasing.WasPassed()) {
|
if (aEffectTiming.mEasing.WasPassed()) {
|
||||||
easing = TimingParams::ParseEasing(aEffectTiming.mEasing.Value(), aDocument,
|
easing = TimingParams::ParseEasing(aEffectTiming.mEasing.Value(), aRv);
|
||||||
aRv);
|
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -193,12 +190,9 @@ TimingParams TimingParams::MergeOptionalEffectTiming(
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
Maybe<ComputedTimingFunction> TimingParams::ParseEasing(
|
Maybe<ComputedTimingFunction> TimingParams::ParseEasing(
|
||||||
const nsAString& aEasing, dom::Document* aDocument, ErrorResult& aRv) {
|
const nsAString& aEasing, ErrorResult& aRv) {
|
||||||
MOZ_ASSERT(aDocument);
|
|
||||||
|
|
||||||
nsTimingFunction timingFunction;
|
nsTimingFunction timingFunction;
|
||||||
RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(aDocument);
|
if (!ServoCSSParser::ParseEasing(aEasing, timingFunction)) {
|
||||||
if (!ServoCSSParser::ParseEasing(aEasing, url, timingFunction)) {
|
|
||||||
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(
|
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(
|
||||||
NS_ConvertUTF16toUTF8(aEasing));
|
NS_ConvertUTF16toUTF8(aEasing));
|
||||||
return Nothing();
|
return Nothing();
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class Document;
|
|
||||||
class UnrestrictedDoubleOrKeyframeEffectOptions;
|
class UnrestrictedDoubleOrKeyframeEffectOptions;
|
||||||
class UnrestrictedDoubleOrKeyframeAnimationOptions;
|
class UnrestrictedDoubleOrKeyframeAnimationOptions;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
@ -57,16 +56,14 @@ struct TimingParams {
|
||||||
|
|
||||||
template <class OptionsType>
|
template <class OptionsType>
|
||||||
static TimingParams FromOptionsType(const OptionsType& aOptions,
|
static TimingParams FromOptionsType(const OptionsType& aOptions,
|
||||||
dom::Document* aDocument,
|
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
static TimingParams FromOptionsUnion(
|
static TimingParams FromOptionsUnion(
|
||||||
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
|
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
|
||||||
dom::Document* aDocument, ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
static TimingParams FromOptionsUnion(
|
static TimingParams FromOptionsUnion(
|
||||||
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
||||||
dom::Document* aDocument, ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
static TimingParams FromEffectTiming(const dom::EffectTiming& aEffectTiming,
|
static TimingParams FromEffectTiming(const dom::EffectTiming& aEffectTiming,
|
||||||
dom::Document* aDocument,
|
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
// Returns a copy of |aSource| where each timing property in |aSource| that
|
// Returns a copy of |aSource| where each timing property in |aSource| that
|
||||||
// is also specified in |aEffectTiming| is replaced with the value from
|
// is also specified in |aEffectTiming| is replaced with the value from
|
||||||
|
@ -76,8 +73,7 @@ struct TimingParams {
|
||||||
// true and an unmodified copy of |aSource| will be returned.
|
// true and an unmodified copy of |aSource| will be returned.
|
||||||
static TimingParams MergeOptionalEffectTiming(
|
static TimingParams MergeOptionalEffectTiming(
|
||||||
const TimingParams& aSource,
|
const TimingParams& aSource,
|
||||||
const dom::OptionalEffectTiming& aEffectTiming, dom::Document* aDocument,
|
const dom::OptionalEffectTiming& aEffectTiming, ErrorResult& aRv);
|
||||||
ErrorResult& aRv);
|
|
||||||
|
|
||||||
// Range-checks and validates an UnrestrictedDoubleOrString or
|
// Range-checks and validates an UnrestrictedDoubleOrString or
|
||||||
// OwningUnrestrictedDoubleOrString object and converts to a
|
// OwningUnrestrictedDoubleOrString object and converts to a
|
||||||
|
@ -123,7 +119,6 @@ struct TimingParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Maybe<ComputedTimingFunction> ParseEasing(const nsAString& aEasing,
|
static Maybe<ComputedTimingFunction> ParseEasing(const nsAString& aEasing,
|
||||||
dom::Document* aDocument,
|
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
static StickyTimeDuration CalcActiveDuration(
|
static StickyTimeDuration CalcActiveDuration(
|
||||||
|
|
|
@ -13,9 +13,9 @@ class nsISerialEventTarget;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
class PBackgroundChild;
|
class PBackgroundChild;
|
||||||
class PBackgroundParent;
|
class PBackgroundParent;
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,9 @@ already_AddRefed<RawServoDeclarationBlock> ServoCSSParser::ParseProperty(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool ServoCSSParser::ParseEasing(const nsAString& aValue, URLExtraData* aUrl,
|
bool ServoCSSParser::ParseEasing(const nsAString& aValue,
|
||||||
nsTimingFunction& aResult) {
|
nsTimingFunction& aResult) {
|
||||||
return Servo_ParseEasing(&aValue, aUrl, &aResult);
|
return Servo_ParseEasing(&aValue, &aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
|
@ -89,12 +89,10 @@ class ServoCSSParser {
|
||||||
* Parse a animation timing function.
|
* Parse a animation timing function.
|
||||||
*
|
*
|
||||||
* @param aValue The specified value.
|
* @param aValue The specified value.
|
||||||
* @param aUrl The parser url extra data.
|
|
||||||
* @param aResult The output timing function. (output)
|
* @param aResult The output timing function. (output)
|
||||||
* @return Whether the value was successfully parsed.
|
* @return Whether the value was successfully parsed.
|
||||||
*/
|
*/
|
||||||
static bool ParseEasing(const nsAString& aValue, URLExtraData* aUrl,
|
static bool ParseEasing(const nsAString& aValue, nsTimingFunction& aResult);
|
||||||
nsTimingFunction& aResult);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a specified transform list into a gfx matrix.
|
* Parse a specified transform list into a gfx matrix.
|
||||||
|
|
|
@ -4124,16 +4124,13 @@ pub unsafe extern "C" fn Servo_ParseProperty(
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ParseEasing(
|
pub extern "C" fn Servo_ParseEasing(
|
||||||
easing: &nsAString,
|
easing: &nsAString,
|
||||||
data: *mut URLExtraData,
|
|
||||||
output: &mut nsTimingFunction,
|
output: &mut nsTimingFunction,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
use style::properties::longhands::transition_timing_function;
|
use style::properties::longhands::transition_timing_function;
|
||||||
|
|
||||||
// FIXME Dummy URL data would work fine here.
|
|
||||||
let url_data = unsafe { UrlExtraData::from_ptr_ref(&data) };
|
|
||||||
let context = ParserContext::new(
|
let context = ParserContext::new(
|
||||||
Origin::Author,
|
Origin::Author,
|
||||||
url_data,
|
unsafe { dummy_url_data() },
|
||||||
Some(CssRuleType::Style),
|
Some(CssRuleType::Style),
|
||||||
ParsingMode::DEFAULT,
|
ParsingMode::DEFAULT,
|
||||||
QuirksMode::NoQuirks,
|
QuirksMode::NoQuirks,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче