Bug 1458814: Remove a bit of trivially dead code. r=hiro

MozReview-Commit-ID: GG41v4TejBU

--HG--
extra : rebase_source : 5dc1f255178ae723eed47ec3fdbd6595fa84da62
This commit is contained in:
Emilio Cobos Álvarez 2018-05-03 18:41:17 +02:00
Родитель bac4dc505c
Коммит 0566c42687
3 изменённых файлов: 43 добавлений и 107 удалений

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

@ -40,11 +40,8 @@ struct ValueWrapper {
ValueWrapper(nsCSSPropertyID aPropID, const AnimationValue& aValue)
: mPropID(aPropID)
{
if (aValue.mServo) {
mServoValues.AppendElement(aValue.mServo);
return;
}
MOZ_CRASH("old style system disabled");
MOZ_ASSERT(!aValue.IsNull());
mServoValues.AppendElement(aValue.mServo);
}
ValueWrapper(nsCSSPropertyID aPropID,
const RefPtr<RawServoAnimationValue>& aValue)
@ -58,21 +55,18 @@ struct ValueWrapper {
return false;
}
if (!mServoValues.IsEmpty()) {
size_t len = mServoValues.Length();
if (len != aOther.mServoValues.Length()) {
MOZ_ASSERT(!mServoValues.IsEmpty());
size_t len = mServoValues.Length();
if (len != aOther.mServoValues.Length()) {
return false;
}
for (size_t i = 0; i < len; i++) {
if (!Servo_AnimationValue_DeepEqual(mServoValues[i],
aOther.mServoValues[i])) {
return false;
}
for (size_t i = 0; i < len; i++) {
if (!Servo_AnimationValue_DeepEqual(mServoValues[i],
aOther.mServoValues[i])) {
return false;
}
}
return true;
}
MOZ_CRASH("old style system disabled");
return true;
}
bool operator!=(const ValueWrapper& aOther) const
@ -306,18 +300,11 @@ AddOrAccumulate(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
return false;
}
bool isServo = valueToAddWrapper
? !valueToAddWrapper->mServoValues.IsEmpty()
: !destWrapper->mServoValues.IsEmpty();
if (isServo) {
return AddOrAccumulateForServo(aDest,
valueToAddWrapper,
destWrapper,
aCompositeOp,
aCount);
}
MOZ_CRASH("old style system disabled");
return AddOrAccumulateForServo(aDest,
valueToAddWrapper,
destWrapper,
aCompositeOp,
aCount);
}
nsresult
@ -389,12 +376,7 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
const ValueWrapper* fromWrapper = ExtractValueWrapper(aFrom);
const ValueWrapper* toWrapper = ExtractValueWrapper(aTo);
MOZ_ASSERT(toWrapper, "expecting non-null endpoint");
if (!toWrapper->mServoValues.IsEmpty()) {
return ComputeDistanceForServo(fromWrapper, *toWrapper, aDistance);
}
MOZ_CRASH("old style system disabled");
return ComputeDistanceForServo(fromWrapper, *toWrapper, aDistance);
}
@ -468,15 +450,10 @@ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
const ValueWrapper* startWrapper = ExtractValueWrapper(aStartVal);
const ValueWrapper* endWrapper = ExtractValueWrapper(aEndVal);
MOZ_ASSERT(endWrapper, "expecting non-null endpoint");
if (!endWrapper->mServoValues.IsEmpty()) {
return InterpolateForServo(startWrapper,
*endWrapper,
aUnitDistance,
aResult);
}
MOZ_CRASH("old style system disabled");
return InterpolateForServo(startWrapper,
*endWrapper,
aUnitDistance,
aResult);
}
// Helper function to extract presContext
@ -613,10 +590,6 @@ nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
return;
}
if (wrapper->mServoValues.IsEmpty()) {
MOZ_CRASH("old style system disabled");
}
if (nsCSSProps::IsShorthand(wrapper->mPropID)) {
// In case of shorthand on servo, we iterate over all mServoValues array
// since we have multiple AnimationValues in the array for each longhand
@ -691,23 +664,17 @@ nsSMILCSSValueType::FinalizeValue(nsSMILValue& aValue,
return;
}
bool isServo = !valueToMatchWrapper->mServoValues.IsEmpty();
ServoAnimationValues zeroValues;
zeroValues.SetCapacity(valueToMatchWrapper->mServoValues.Length());
if (isServo) {
ServoAnimationValues zeroValues;
zeroValues.SetCapacity(valueToMatchWrapper->mServoValues.Length());
for (auto& valueToMatch : valueToMatchWrapper->mServoValues) {
RefPtr<RawServoAnimationValue> zeroValue =
Servo_AnimationValues_GetZeroValue(valueToMatch).Consume();
if (!zeroValue) {
return;
}
zeroValues.AppendElement(Move(zeroValue));
for (auto& valueToMatch : valueToMatchWrapper->mServoValues) {
RefPtr<RawServoAnimationValue> zeroValue =
Servo_AnimationValues_GetZeroValue(valueToMatch).Consume();
if (!zeroValue) {
return;
}
aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
Move(zeroValues));
} else {
MOZ_CRASH("old style system disabled");
zeroValues.AppendElement(Move(zeroValue));
}
aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
Move(zeroValues));
}

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

@ -118,10 +118,7 @@ float
AnimationValue::GetOpacity() const
{
MOZ_ASSERT(mServo);
if (mServo) {
return Servo_AnimationValue_GetOpacity(mServo);
}
MOZ_CRASH("old style system disabled");
return Servo_AnimationValue_GetOpacity(mServo);
}
already_AddRefed<const nsCSSValueSharedList>
@ -130,11 +127,7 @@ AnimationValue::GetTransformList() const
MOZ_ASSERT(mServo);
RefPtr<nsCSSValueSharedList> transform;
if (mServo) {
Servo_AnimationValue_GetTransform(mServo, &transform);
} else {
MOZ_CRASH("old style system disabled");
}
Servo_AnimationValue_GetTransform(mServo, &transform);
return transform.forget();
}
@ -142,13 +135,9 @@ Size
AnimationValue::GetScaleValue(const nsIFrame* aFrame) const
{
MOZ_ASSERT(mServo);
if (mServo) {
RefPtr<nsCSSValueSharedList> list;
Servo_AnimationValue_GetTransform(mServo, &list);
return nsStyleTransformMatrix::GetScaleValue(list, aFrame);
}
MOZ_CRASH("old style system disabled");
RefPtr<nsCSSValueSharedList> list;
Servo_AnimationValue_GetTransform(mServo, &list);
return nsStyleTransformMatrix::GetScaleValue(list, aFrame);
}
void
@ -156,13 +145,7 @@ AnimationValue::SerializeSpecifiedValue(nsCSSPropertyID aProperty,
nsAString& aString) const
{
MOZ_ASSERT(mServo);
if (mServo) {
Servo_AnimationValue_Serialize(mServo, aProperty, &aString);
return;
}
MOZ_CRASH("old style system disabled");
Servo_AnimationValue_Serialize(mServo, aProperty, &aString);
}
bool
@ -175,12 +158,7 @@ AnimationValue::IsInterpolableWith(nsCSSPropertyID aProperty,
MOZ_ASSERT(mServo);
MOZ_ASSERT(aToValue.mServo);
if (mServo) {
return Servo_AnimationValues_IsInterpolable(mServo, aToValue.mServo);
}
MOZ_CRASH("old style system disabled");
return Servo_AnimationValues_IsInterpolable(mServo, aToValue.mServo);
}
double
@ -195,15 +173,11 @@ AnimationValue::ComputeDistance(nsCSSPropertyID aProperty,
MOZ_ASSERT(mServo);
MOZ_ASSERT(aOther.mServo);
double distance= 0.0;
if (mServo) {
distance = Servo_AnimationValues_ComputeDistance(mServo, aOther.mServo);
return distance < 0.0
? 0.0
: distance;
}
MOZ_CRASH("old style system disabled");
double distance =
Servo_AnimationValues_ComputeDistance(mServo, aOther.mServo);
return distance < 0.0
? 0.0
: distance;
}
/* static */ AnimationValue

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

@ -4520,7 +4520,6 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(
raw_data: RawServoStyleSetBorrowed,
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut
) {
use std::mem;
use style::properties::LonghandIdSet;
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
@ -4581,10 +4580,6 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(
// This is safe since we immediately write to the uninitialized values.
unsafe { animation_values.set_len((property_index + 1) as u32) };
animation_values[property_index].mProperty = property.to_nscsspropertyid();
// We only make sure we have enough space for this variable,
// but didn't construct a default value for StyleAnimationValue,
// so we should zero it to avoid getting undefined behaviors.
animation_values[property_index].mValue.mGecko = unsafe { mem::zeroed() };
match value {
Some(v) => {
animation_values[property_index].mValue.mServo.set_arc_leaky(Arc::new(v));