Bug 1381764: Cleanup the Gecko bits. r=manishearth

MozReview-Commit-ID: dbVDy1u4vp
This commit is contained in:
Emilio Cobos Álvarez 2017-07-18 14:29:12 +02:00 committed by Manish Goregaokar
parent 2eaa179077
commit 9a6ef770c1
6 changed files with 19 additions and 45 deletions

View File

@ -1096,7 +1096,7 @@ GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
MOZ_ASSERT(presContext);
return presContext->StyleSet()->AsServo()
->GetComputedKeyframeValuesFor(aKeyframes, aElement, aStyleContext->ComputedValues());
->GetComputedKeyframeValuesFor(aKeyframes, aElement, aStyleContext);
}
static void

View File

@ -700,14 +700,10 @@ ValueFromStringHelper(nsCSSPropertyID aPropID,
return result;
}
// Get a suitable style context for Servo
const ServoComputedValues* currentStyle =
aStyleContext->ComputedValues();
// Compute value
aPresContext->StyleSet()->AsServo()->GetAnimationValues(servoDeclarationBlock,
aTargetElement,
currentStyle,
aStyleContext->AsServo(),
result);
if (result.IsEmpty()) {
return result;

View File

@ -227,7 +227,7 @@ SERVO_BINDING_FUNC(Servo_ParseEasing, bool,
SERVO_BINDING_FUNC(Servo_GetComputedKeyframeValues, void,
RawGeckoKeyframeListBorrowed keyframes,
RawGeckoElementBorrowed element,
ServoComputedValuesBorrowed style,
ServoStyleContextBorrowed style,
RawServoStyleSetBorrowed set,
RawGeckoComputedKeyframeValuesListBorrowedMut result)
SERVO_BINDING_FUNC(Servo_ComputedValues_ExtractAnimationValue,
@ -256,7 +256,7 @@ SERVO_BINDING_FUNC(Servo_MatrixTransform_Operate, void,
SERVO_BINDING_FUNC(Servo_GetAnimationValues, void,
RawServoDeclarationBlockBorrowed declarations,
RawGeckoElementBorrowed element,
ServoComputedValuesBorrowed style,
ServoStyleContextBorrowed style,
RawServoStyleSetBorrowed style_set,
RawGeckoServoAnimationValueListBorrowedMut animation_values)
@ -307,7 +307,7 @@ SERVO_BINDING_FUNC(Servo_AnimationValue_Compute,
RawServoAnimationValueStrong,
RawGeckoElementBorrowed element,
RawServoDeclarationBlockBorrowed declarations,
ServoComputedValuesBorrowed style,
ServoStyleContextBorrowed style,
RawServoStyleSetBorrowed raw_data)
// Style attribute
@ -464,12 +464,10 @@ SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
ServoStyleContextStrong,
ServoStyleContextBorrowedOrNull parent_style_or_null,
mozilla::CSSPseudoElementType pseudo_type,
nsIAtom* pseudo_tag,
RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoStyleContextStrong,
RawServoStyleSetBorrowed set,
mozilla::CSSPseudoElementType pseudo_type,
nsIAtom* pseudo_tag,
ServoStyleContextBorrowedOrNull parent_style,
mozilla::InheritTarget target)
@ -506,10 +504,8 @@ SERVO_BINDING_FUNC(Servo_ResolveStyle, ServoStyleContextStrong,
SERVO_BINDING_FUNC(Servo_ResolvePseudoStyle, ServoStyleContextStrong,
RawGeckoElementBorrowed element,
mozilla::CSSPseudoElementType pseudo_type,
nsIAtom* pseudo_tag,
bool is_probe,
ServoComputedValuesBorrowedOrNull inherited_style,
ServoStyleContextBorrowedOrNull parent_style_context,
ServoStyleContextBorrowedOrNull inherited_style,
RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_SetExplicitStyle, void,
RawGeckoElementBorrowed element,
@ -530,8 +526,6 @@ SERVO_BINDING_FUNC(Servo_HasAuthorSpecifiedRules, bool,
SERVO_BINDING_FUNC(Servo_ResolveStyleLazily, ServoStyleContextStrong,
RawGeckoElementBorrowed element,
mozilla::CSSPseudoElementType pseudo_type,
nsIAtom* pseudo_tag,
ServoStyleContextBorrowedOrNull parent_style_context,
mozilla::StyleRuleInclusion rule_inclusion,
const mozilla::ServoElementSnapshotTable* snapshots,
RawServoStyleSetBorrowed set)

View File

@ -381,7 +381,6 @@ ServoStyleSet::ResolveStyleForText(nsIContent* aTextNode,
// can avoid worrying about text nodes.
RefPtr<ServoStyleContext> computedValues =
Servo_ComputedValues_Inherit(mRawSet.get(),
CSSPseudoElementType::InheritingAnonBox,
nsCSSAnonBoxes::mozText,
aParentContext,
InheritTarget::Text).Consume();
@ -394,7 +393,6 @@ ServoStyleSet::ResolveStyleForFirstLetterContinuation(ServoStyleContext* aParent
{
RefPtr<ServoStyleContext> computedValues =
Servo_ComputedValues_Inherit(mRawSet.get(),
CSSPseudoElementType::InheritingAnonBox,
nsCSSAnonBoxes::firstLetterContinuation,
aParentContext,
InheritTarget::FirstLetterContinuation)
@ -417,7 +415,6 @@ ServoStyleSet::ResolveStyleForPlaceholder()
RefPtr<ServoStyleContext> computedValues =
Servo_ComputedValues_Inherit(mRawSet.get(),
CSSPseudoElementType::NonInheritingAnonBox,
nsCSSAnonBoxes::oofPlaceholder,
nullptr,
InheritTarget::PlaceholderFrame)
@ -441,7 +438,6 @@ ServoStyleSet::ResolvePseudoElementStyle(Element* aOriginatingElement,
RefPtr<ServoStyleContext> computedValues;
nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
if (aPseudoElement) {
MOZ_ASSERT(aType == aPseudoElement->GetPseudoElementType());
computedValues =
@ -449,14 +445,10 @@ ServoStyleSet::ResolvePseudoElementStyle(Element* aOriginatingElement,
mRawSet.get(),
TraversalRestyleBehavior::Normal).Consume();
} else {
const ServoComputedValues* parentStyle =
aParentContext ? aParentContext->ComputedValues() : nullptr;
computedValues =
Servo_ResolvePseudoStyle(aOriginatingElement,
aType,
pseudoTag,
/* is_probe = */ false,
parentStyle,
aParentContext,
mRawSet.get()).Consume();
}
@ -502,7 +494,7 @@ ServoStyleSet::ResolveInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag,
UpdateStylistIfNeeded();
RefPtr<ServoStyleContext> computedValues =
Servo_ComputedValues_GetForAnonymousBox(aParentContext, CSSPseudoElementType::InheritingAnonBox,
Servo_ComputedValues_GetForAnonymousBox(aParentContext,
aPseudoTag,
mRawSet.get()).Consume();
#ifdef DEBUG
@ -547,7 +539,7 @@ ServoStyleSet::ResolveNonInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag)
MOZ_ASSERT(!nsCSSAnonBoxes::IsNonInheritingAnonBox(nsCSSAnonBoxes::viewport),
"viewport needs fixup to handle blockifying it");
RefPtr<ServoStyleContext> computedValues =
Servo_ComputedValues_GetForAnonymousBox(nullptr, CSSPseudoElementType::NonInheritingAnonBox,
Servo_ComputedValues_GetForAnonymousBox(nullptr,
aPseudoTag,
mRawSet.get()).Consume();
#ifdef DEBUG
@ -775,12 +767,10 @@ ServoStyleSet::ProbePseudoElementStyle(Element* aOriginatingElement,
// aOriginatingElement's styles anyway.
MOZ_ASSERT(aType < CSSPseudoElementType::Count);
nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
RefPtr<ServoStyleContext> computedValues =
Servo_ResolvePseudoStyle(aOriginatingElement, aType, pseudoTag,
Servo_ResolvePseudoStyle(aOriginatingElement, aType,
/* is_probe = */ true,
nullptr,
aParentContext,
mRawSet.get()).Consume();
if (!computedValues) {
return nullptr;
@ -989,7 +979,7 @@ nsTArray<ComputedKeyframeValues>
ServoStyleSet::GetComputedKeyframeValuesFor(
const nsTArray<Keyframe>& aKeyframes,
Element* aElement,
ServoComputedValuesBorrowed aComputedValues)
const ServoStyleContext* aContext)
{
nsTArray<ComputedKeyframeValues> result(aKeyframes.Length());
@ -998,7 +988,7 @@ ServoStyleSet::GetComputedKeyframeValuesFor(
Servo_GetComputedKeyframeValues(&aKeyframes,
aElement,
aComputedValues,
aContext,
mRawSet.get(),
&result);
return result;
@ -1008,12 +998,12 @@ void
ServoStyleSet::GetAnimationValues(
RawServoDeclarationBlock* aDeclarations,
Element* aElement,
ServoComputedValuesBorrowed aComputedValues,
const ServoStyleContext* aStyleContext,
nsTArray<RefPtr<RawServoAnimationValue>>& aAnimationValues)
{
Servo_GetAnimationValues(aDeclarations,
aElement,
aComputedValues,
aStyleContext,
mRawSet.get(),
&aAnimationValues);
}
@ -1038,11 +1028,11 @@ already_AddRefed<RawServoAnimationValue>
ServoStyleSet::ComputeAnimationValue(
Element* aElement,
RawServoDeclarationBlock* aDeclarations,
ServoComputedValuesBorrowed aComputedValues)
const ServoStyleContext* aContext)
{
return Servo_AnimationValue_Compute(aElement,
aDeclarations,
aComputedValues,
aContext,
mRawSet.get()).Consume();
}
@ -1156,8 +1146,6 @@ ServoStyleSet::ResolveStyleLazily(Element* aElement,
RefPtr<ServoStyleContext> computedValues =
Servo_ResolveStyleLazily(elementForStyleResolution,
pseudoTypeForStyleResolution,
aPseudoTag,
aParentContext,
aRuleInclusion,
&Snapshots(),
mRawSet.get()).Consume();
@ -1166,8 +1154,6 @@ ServoStyleSet::ResolveStyleLazily(Element* aElement,
computedValues =
Servo_ResolveStyleLazily(elementForStyleResolution,
pseudoTypeForStyleResolution,
aPseudoTag,
aParentContext,
aRuleInclusion,
&Snapshots(),
mRawSet.get()).Consume();

View File

@ -373,12 +373,12 @@ public:
nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
ServoComputedValuesBorrowed aComputedValues);
const ServoStyleContext* aContext);
void
GetAnimationValues(RawServoDeclarationBlock* aDeclarations,
dom::Element* aElement,
ServoComputedValuesBorrowed aComputedValues,
const ServoStyleContext* aContext,
nsTArray<RefPtr<RawServoAnimationValue>>& aAnimationValues);
bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
@ -405,7 +405,7 @@ public:
already_AddRefed<RawServoAnimationValue>
ComputeAnimationValue(dom::Element* aElement,
RawServoDeclarationBlock* aDeclaration,
ServoComputedValuesBorrowed aComputedValues);
const ServoStyleContext* aContext);
void AppendTask(PostTraversalTask aTask)
{

View File

@ -5432,13 +5432,11 @@ AnimationValue::FromString(nsCSSPropertyID aProperty,
return result;
}
const ServoComputedValues* computedValues =
servoContext->ComputedValues();
result.mServo = presContext->StyleSet()
->AsServo()
->ComputeAnimationValue(aElement,
declarations,
computedValues);
servoContext);
return result;
}