Issue #2112 - Part 5: Remove Servo from forwarding code used by magic pointer classes

This commit is contained in:
FranklinDM 2024-03-25 02:02:08 +08:00 committed by roytam1
commit a93a7bed47
52 changed files with 274 additions and 1116 deletions

View file

@ -26,7 +26,6 @@
#include "mozilla/dom/Element.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Likely.h"
#include "mozilla/ServoBindings.h" // RawServoDeclarationBlock
#include "gfxMatrix.h"
#include "gfxQuaternion.h"
#include "nsIDocument.h"
@ -3262,8 +3261,6 @@ ComputeValuesFromStyleRule(nsCSSPropertyID aProperty,
return false;
}
MOZ_ASSERT(aStyleContext->PresContext()->StyleSet()->IsGecko(),
"ServoStyleSet should not use StyleAnimationValue for animations");
nsStyleSet* styleSet = aStyleContext->PresContext()->StyleSet()->AsGecko();
RefPtr<nsStyleContext> tmpStyleContext;
@ -3426,45 +3423,6 @@ StyleAnimationValue::ComputeValues(
aResult);
}
/* static */ bool
StyleAnimationValue::ComputeValues(
nsCSSPropertyID aProperty,
CSSEnabledState aEnabledState,
nsStyleContext* aStyleContext,
const RawServoDeclarationBlock& aDeclarations,
nsTArray<PropertyStyleAnimationValuePair>& aValues)
{
MOZ_ASSERT(aStyleContext->PresContext()->StyleSet()->IsServo(),
"Should be using ServoStyleSet if we have a"
" RawServoDeclarationBlock");
if (!nsCSSProps::IsEnabled(aProperty, aEnabledState)) {
return false;
}
const ServoComputedValues* previousStyle =
aStyleContext->StyleSource().AsServoComputedValues();
// FIXME: Servo bindings don't yet represent const-ness so we just
// cast it away for now.
auto declarations = const_cast<RawServoDeclarationBlock*>(&aDeclarations);
RefPtr<ServoComputedValues> computedValues =
Servo_RestyleWithAddedDeclaration(declarations, previousStyle).Consume();
if (!computedValues) {
return false;
}
RefPtr<nsStyleContext> tmpStyleContext =
NS_NewStyleContext(aStyleContext, aStyleContext->PresContext(),
aStyleContext->GetPseudo(),
aStyleContext->GetPseudoType(),
computedValues.forget(),
false /* skipFixup */);
return ComputeValuesFromStyleContext(aProperty, aEnabledState,
tmpStyleContext, aValues);
}
bool
StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty,
const StyleAnimationValue& aComputedValue,