Bug 1349124 - Replace ServoComputedStyleValues with ServoComputedValuesWithParent. r=hiro

MozReview-Commit-ID: 5POa8DRjmc8

--HG--
extra : rebase_source : 5a88f1c30c32dcd6bb728707c066a4b8becfc311
This commit is contained in:
Boris Chiou 2017-03-21 15:41:23 +08:00
Родитель bf7feabf64
Коммит 5fdc3654b4
6 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -196,7 +196,7 @@ KeyframeEffectReadOnly::SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
void
KeyframeEffectReadOnly::SetKeyframes(
nsTArray<Keyframe>&& aKeyframes,
const ServoComputedStyleValues& aServoValues)
const ServoComputedValuesWithParent& aServoValues)
{
DoSetKeyframes(Move(aKeyframes), aServoValues);
}
@ -207,9 +207,9 @@ KeyframeEffectReadOnly::DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes,
StyleType&& aStyle)
{
static_assert(IsSame<StyleType, nsStyleContext*>::value ||
IsSame<StyleType, const ServoComputedStyleValues&>::value,
IsSame<StyleType, const ServoComputedValuesWithParent&>::value,
"StyleType should be nsStyleContext* or "
"const ServoComputedStyleValues&");
"const ServoComputedValuesWithParent&");
if (KeyframesEqualIgnoringComputedOffsets(aKeyframes, mKeyframes)) {
return;
@ -227,8 +227,8 @@ KeyframeEffectReadOnly::DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes,
}
// We need to call UpdateProperties() if the StyleType is
// 'const ServoComputedStyleValues&' (i.e. not a pointer) or nsStyleContext*
// is not nullptr.
// 'const ServoComputedValuesWithParent&' (i.e. not a pointer) or
// nsStyleContext* is not nullptr.
if (!IsPointer<StyleType>::value || aStyle) {
UpdateProperties(aStyle);
MaybeUpdateFrameForCompositor();
@ -311,13 +311,13 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
? aStyleContext->GetParent()->StyleSource().AsServoComputedValues()
: nullptr;
const ServoComputedStyleValues servoValues = { currentStyle, parentStyle };
const ServoComputedValuesWithParent servoValues = { currentStyle, parentStyle };
DoUpdateProperties(servoValues);
}
void
KeyframeEffectReadOnly::UpdateProperties(
const ServoComputedStyleValues& aServoValues)
const ServoComputedValuesWithParent& aServoValues)
{
DoUpdateProperties(aServoValues);
}
@ -922,9 +922,9 @@ nsTArray<AnimationProperty>
KeyframeEffectReadOnly::BuildProperties(StyleType&& aStyle)
{
static_assert(IsSame<StyleType, nsStyleContext*>::value ||
IsSame<StyleType, const ServoComputedStyleValues&>::value,
IsSame<StyleType, const ServoComputedValuesWithParent&>::value,
"StyleType should be nsStyleContext* or "
"const ServoComputedStyleValues&");
"const ServoComputedValuesWithParent&");
MOZ_ASSERT(aStyle);

Просмотреть файл

@ -146,7 +146,7 @@ struct AnimationProperty
}
};
struct ServoComputedStyleValues
struct ServoComputedValuesWithParent
{
const ServoComputedValues* mCurrentStyle;
const ServoComputedValues* mParentStyle;
@ -218,7 +218,7 @@ public:
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
nsStyleContext* aStyleContext);
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
const ServoComputedStyleValues& aServoValues);
const ServoComputedValuesWithParent& aServoValues);
// Returns true if the effect includes |aProperty| regardless of whether the
// property is overridden by !important rule.
@ -247,7 +247,7 @@ public:
// |aStyleContext| to resolve specified values.
void UpdateProperties(nsStyleContext* aStyleContext);
// Servo version of the above function.
void UpdateProperties(const ServoComputedStyleValues& aServoValues);
void UpdateProperties(const ServoComputedValuesWithParent& aServoValues);
// Update various bits of state related to running ComposeStyle().
// We need to update this outside ComposeStyle() because we should avoid
@ -309,7 +309,7 @@ public:
// This is used for deciding the animation is paint-only.
void CalculateCumulativeChangeHint(nsStyleContext* aStyleContext);
void CalculateCumulativeChangeHint(
const ServoComputedStyleValues& aServoValues)
const ServoComputedValuesWithParent& aServoValues)
{
}
@ -411,7 +411,7 @@ protected:
// Ensure the base styles is available for any properties in |aProperties|.
void EnsureBaseStyles(nsStyleContext* aStyleContext,
const nsTArray<AnimationProperty>& aProperties);
void EnsureBaseStyles(const ServoComputedStyleValues& aServoValues,
void EnsureBaseStyles(const ServoComputedValuesWithParent& aServoValues,
const nsTArray<AnimationProperty>& aProperties)
{
// FIXME: Bug 1311257: Support missing keyframes.

Просмотреть файл

@ -595,7 +595,7 @@ KeyframeUtils::ApplyDistributeSpacing(nsTArray<Keyframe>& aKeyframes)
KeyframeUtils::GetComputedKeyframeValues(
const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
const ServoComputedStyleValues& aServoValues)
const ServoComputedValuesWithParent& aServoValues)
{
MOZ_ASSERT(aElement);
MOZ_ASSERT(aElement->IsStyledByServo());

Просмотреть файл

@ -23,7 +23,7 @@ enum class CSSPseudoElementType : uint8_t;
class ErrorResult;
struct Keyframe;
struct PropertyStyleAnimationValuePair;
struct ServoComputedStyleValues;
struct ServoComputedValuesWithParent;
namespace dom {
class Element;
@ -88,7 +88,7 @@ public:
static nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
const ServoComputedStyleValues& aServoValues);
const ServoComputedValuesWithParent& aServoValues);
/**
* Fills in the mComputedOffset member of each keyframe in the given array
@ -117,7 +117,7 @@ public:
SpacingMode aSpacingMode,
nsCSSPropertyID aProperty,
nsTArray<ComputedKeyframeValues>& aComputedValues,
const ServoComputedStyleValues& aServoValues)
const ServoComputedValuesWithParent& aServoValues)
{
NS_WARNING("stylo: ApplySpacing not implemented yet");
}

Просмотреть файл

@ -727,9 +727,10 @@ ServoStyleSet::FillKeyframesForName(const nsString& aName,
}
nsTArray<ComputedKeyframeValues>
ServoStyleSet::GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
ServoStyleSet::GetComputedKeyframeValuesFor(
const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
const ServoComputedStyleValues& aServoValues)
const ServoComputedValuesWithParent& aServoValues)
{
nsTArray<ComputedKeyframeValues> result(aKeyframes.Length());

Просмотреть файл

@ -28,7 +28,7 @@ class CSSStyleSheet;
class ServoRestyleManager;
class ServoStyleSheet;
struct Keyframe;
struct ServoComputedStyleValues;
struct ServoComputedValuesWithParent;
} // namespace mozilla
class nsIDocument;
class nsStyleContext;
@ -245,7 +245,8 @@ public:
nsTArray<ComputedKeyframeValues>
GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
const ServoComputedStyleValues& aServoValues);
const ServoComputedValuesWithParent&
aServoValues);
private:
already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,