зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1430014 - Part 4: #ifdef out unnecessary code when the old style system is not built. r=xidorn
MozReview-Commit-ID: 1FZ9VzjcPzN --HG-- extra : source : de22d220635f8c059834b76f769d5215ab1a8b5b
This commit is contained in:
Родитель
98b3e38412
Коммит
cc7db5c40c
|
@ -1513,11 +1513,13 @@ Animation::IsRunningOnCompositor() const
|
|||
mEffect->AsKeyframeEffect()->IsRunningOnCompositor();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template
|
||||
void
|
||||
Animation::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
|
||||
RefPtr<AnimValuesStyleRule>& aAnimationRule,
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
|
|
@ -383,6 +383,7 @@ EffectCompositor::UpdateEffectProperties(StyleType* aStyleType,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
|
@ -456,6 +457,7 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
|||
|
||||
return effectSet->AnimationRule(aCascadeLevel);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
class EffectCompositeOrderComparator {
|
||||
|
@ -570,6 +572,7 @@ EffectCompositor::HasThrottledStyleUpdates() const
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
|
||||
{
|
||||
|
@ -621,6 +624,7 @@ EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
|
|||
// Note: mElement pointers in elementsToRestyle might now dangle
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ bool
|
||||
EffectCompositor::HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
|
@ -713,6 +717,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* static */ void
|
||||
EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
|
@ -752,6 +757,7 @@ EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
|
|||
MOZ_ASSERT(effects == EffectSet::GetEffectSet(aElement, aPseudoType),
|
||||
"EffectSet should not change while composing style");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ nsCSSPropertyIDSet
|
||||
EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
||||
|
@ -768,6 +774,7 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
|
||||
Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
|
||||
if (aBackendType == StyleBackendType::Gecko && !aStyleContext) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (elementToRestyle) {
|
||||
nsIFrame* frame = elementToRestyle->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
|
@ -778,6 +785,9 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
if (!aStyleContext) {
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else if (aBackendType == StyleBackendType::Servo && !elementToRestyle) {
|
||||
return result;
|
||||
}
|
||||
|
@ -813,9 +823,13 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
&result);
|
||||
break;
|
||||
case StyleBackendType::Gecko:
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsRuleNode::ComputePropertiesOverridingAnimation(propertiesToTrack,
|
||||
aStyleContext->AsGecko(),
|
||||
result);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1191,6 +1205,7 @@ EffectCompositor::PreTraverse(dom::Element* aElement,
|
|||
return found;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// ---------------------------------------------------------
|
||||
//
|
||||
// Nested class: AnimationStyleRuleProcessor
|
||||
|
@ -1305,6 +1320,7 @@ EffectCompositor::UpdateEffectProperties(
|
|||
GeckoStyleContext* aStyleContext,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
|
|
@ -48,11 +48,13 @@ public:
|
|||
explicit EffectCompositor(nsPresContext* aPresContext)
|
||||
: mPresContext(aPresContext)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
for (size_t i = 0; i < kCascadeLevelCount; i++) {
|
||||
CascadeLevel cascadeLevel = CascadeLevel(i);
|
||||
mRuleProcessors[cascadeLevel] =
|
||||
new AnimationStyleRuleProcessor(this, cascadeLevel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EffectCompositor)
|
||||
|
@ -126,6 +128,7 @@ public:
|
|||
dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Updates the animation rule stored on the EffectSet for the
|
||||
// specified (pseudo-)element for cascade level |aLevel|.
|
||||
// If the animation rule is not marked as needing an update,
|
||||
|
@ -154,6 +157,7 @@ public:
|
|||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel,
|
||||
nsStyleContext* aStyleContext);
|
||||
#endif
|
||||
|
||||
// Get animation rule for stylo. This is an equivalent of GetAnimationRule
|
||||
// and will be called from servo side.
|
||||
|
@ -169,6 +173,7 @@ public:
|
|||
bool HasPendingStyleUpdates() const;
|
||||
bool HasThrottledStyleUpdates() const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Tell the restyle tracker about all the animated styles that have
|
||||
// pending updates so that it can update the animation rule for these
|
||||
// elements.
|
||||
|
@ -178,6 +183,7 @@ public:
|
|||
{
|
||||
return mRuleProcessors[aCascadeLevel];
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
nsCSSPropertyID aProperty);
|
||||
|
@ -254,11 +260,13 @@ public:
|
|||
private:
|
||||
~EffectCompositor() = default;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Rebuilds the animation rule corresponding to |aCascadeLevel| on the
|
||||
// EffectSet associated with the specified (pseudo-)element.
|
||||
static void ComposeAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel);
|
||||
#endif
|
||||
|
||||
// Get the properties in |aEffectSet| that we are able to animate on the
|
||||
// compositor but which are also specified at a higher level in the cascade
|
||||
|
@ -312,6 +320,7 @@ private:
|
|||
|
||||
bool mIsInPreTraverse = false;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
class AnimationStyleRuleProcessor final : public nsIStyleRuleProcessor
|
||||
{
|
||||
public:
|
||||
|
@ -356,6 +365,7 @@ private:
|
|||
EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
|
||||
OwningNonNull<AnimationStyleRuleProcessor>>
|
||||
mRuleProcessors;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -170,11 +170,13 @@ public:
|
|||
|
||||
size_t Count() const { return mEffects.Count(); }
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<AnimValuesStyleRule>&
|
||||
AnimationRule(EffectCompositor::CascadeLevel aCascadeLevel)
|
||||
{
|
||||
return mAnimationRule[aCascadeLevel];
|
||||
}
|
||||
#endif
|
||||
|
||||
const TimeStamp& LastTransformSyncTime() const
|
||||
{
|
||||
|
@ -212,6 +214,7 @@ private:
|
|||
|
||||
OwningEffectSet mEffects;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// These style rules contain the style data for currently animating
|
||||
// values. They only match when styling with animation. When we
|
||||
// style without animation, we need to not use them so that we can
|
||||
|
@ -221,6 +224,7 @@ private:
|
|||
EffectCompositor::CascadeLevel(
|
||||
EffectCompositor::kCascadeLevelCount),
|
||||
RefPtr<AnimValuesStyleRule>> mAnimationRule;
|
||||
#endif
|
||||
|
||||
// Refresh driver timestamp from the moment when transform animations in this
|
||||
// effect set were last updated and sent to the compositor. This is used for
|
||||
|
|
|
@ -194,24 +194,31 @@ KeyframeEffectReadOnly::SetKeyframes(JSContext* aContext,
|
|||
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
if (auto gecko = styleContext->GetAsGecko()) {
|
||||
if (styleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto gecko = styleContext->AsGecko();
|
||||
SetKeyframes(Move(keyframes), gecko);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
SetKeyframes(Move(keyframes), styleContext->AsServo());
|
||||
}
|
||||
} else {
|
||||
// SetKeyframes has the same behavior for null StyleType* for
|
||||
// both backends, just pick one and use it.
|
||||
SetKeyframes(Move(keyframes), (GeckoStyleContext*) nullptr);
|
||||
SetKeyframes(Move(keyframes), (ServoStyleContext*) nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
GeckoStyleContext* aStyleContext)
|
||||
{
|
||||
DoSetKeyframes(Move(aKeyframes), Move(aStyleContext));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(
|
||||
|
@ -226,10 +233,12 @@ void
|
|||
KeyframeEffectReadOnly::DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
StyleType* aStyle)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static_assert(IsSame<StyleType, GeckoStyleContext>::value ||
|
||||
IsSame<StyleType, const ServoStyleContext>::value,
|
||||
"StyleType should be GeckoStyleContext* or "
|
||||
"const ServoStyleContext*");
|
||||
#endif
|
||||
|
||||
if (KeyframesEqualIgnoringComputedOffsets(aKeyframes, mKeyframes)) {
|
||||
return;
|
||||
|
@ -313,9 +322,14 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
|||
{
|
||||
MOZ_ASSERT(aStyleContext);
|
||||
|
||||
if (auto gecko = aStyleContext->GetAsGecko()) {
|
||||
if (aStyleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto gecko = aStyleContext->AsGecko();
|
||||
DoUpdateProperties(Move(gecko));
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
UpdateProperties(aStyleContext->AsServo());
|
||||
|
@ -412,6 +426,7 @@ KeyframeEffectReadOnly::CompositeValue(
|
|||
return StyleAnimationValue();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue
|
||||
KeyframeEffectReadOnly::GetUnderlyingStyle(
|
||||
nsCSSPropertyID aProperty,
|
||||
|
@ -509,6 +524,7 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
|
|||
|
||||
mBaseStyleValues.Put(aProperty, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::EnsureBaseStyles(
|
||||
|
@ -590,6 +606,7 @@ KeyframeEffectReadOnly::WillComposeStyle()
|
|||
mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyleRule(
|
||||
RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||
|
@ -669,6 +686,7 @@ KeyframeEffectReadOnly::ComposeStyleRule(
|
|||
aStyleRule->AddValue(aProperty.mProperty, Move(toValue));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyleRule(
|
||||
|
@ -947,10 +965,12 @@ template<typename StyleType>
|
|||
nsTArray<AnimationProperty>
|
||||
KeyframeEffectReadOnly::BuildProperties(StyleType* aStyle)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static_assert(IsSame<StyleType, GeckoStyleContext>::value ||
|
||||
IsSame<StyleType, const ServoStyleContext>::value,
|
||||
"StyleType should be GeckoStyleContext* or "
|
||||
"const ServoStyleContext*");
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(aStyle);
|
||||
|
||||
|
@ -1719,6 +1739,7 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
|
@ -1747,6 +1768,7 @@ KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
|||
|
||||
return styleContext.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
|
@ -1987,11 +2009,13 @@ KeyframeEffectReadOnly::UpdateEffectSet(EffectSet* aEffectSet) const
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
|
||||
RefPtr<AnimValuesStyleRule>& aAnimationRule,
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
|
|
@ -165,8 +165,10 @@ public:
|
|||
void SetAnimation(Animation* aAnimation) override;
|
||||
void SetKeyframes(JSContext* aContext, JS::Handle<JSObject*> aKeyframes,
|
||||
ErrorResult& aRv);
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
GeckoStyleContext* aStyleContext);
|
||||
#endif
|
||||
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
const ServoStyleContext* aComputedValues);
|
||||
|
||||
|
@ -347,6 +349,7 @@ protected:
|
|||
// target and its effectSet.
|
||||
void MarkCascadeNeedsUpdate();
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Composites |aValueToComposite| using |aCompositeOperation| onto the value
|
||||
// for |aProperty| in |aAnimationRule|, or, if there is no suitable value in
|
||||
// |aAnimationRule|, uses the base value for the property recorded on the
|
||||
|
@ -365,9 +368,11 @@ protected:
|
|||
// Ensure the base styles is available for any properties in |aProperties|.
|
||||
void EnsureBaseStyles(GeckoStyleContext* aStyleContext,
|
||||
const nsTArray<AnimationProperty>& aProperties);
|
||||
#endif
|
||||
void EnsureBaseStyles(const ServoStyleContext* aComputedValues,
|
||||
const nsTArray<AnimationProperty>& aProperties);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// If no base style is already stored for |aProperty|, resolves the base style
|
||||
// for |aProperty| using |aStyleContext| and stores it in mBaseStyleValues.
|
||||
// If |aCachedBaseStyleContext| is non-null, it will be used, otherwise the
|
||||
|
@ -376,6 +381,7 @@ protected:
|
|||
void EnsureBaseStyle(nsCSSPropertyID aProperty,
|
||||
GeckoStyleContext* aStyleContext,
|
||||
RefPtr<GeckoStyleContext>& aCachedBaseStyleContext);
|
||||
#endif
|
||||
// Stylo version of the above function that also first checks for an additive
|
||||
// value in |aProperty|'s list of segments.
|
||||
void EnsureBaseStyle(const AnimationProperty& aProperty,
|
||||
|
@ -428,20 +434,24 @@ private:
|
|||
template<typename StyleType>
|
||||
void DoUpdateProperties(StyleType* aStyle);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void ComposeStyleRule(RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||
const AnimationProperty& aProperty,
|
||||
const AnimationPropertySegment& aSegment,
|
||||
const ComputedTiming& aComputedTiming);
|
||||
#endif
|
||||
|
||||
void ComposeStyleRule(RawServoAnimationValueMap& aAnimationValues,
|
||||
const AnimationProperty& aProperty,
|
||||
const AnimationPropertySegment& aSegment,
|
||||
const ComputedTiming& aComputedTiming);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationValue& aValue,
|
||||
GeckoStyleContext* aBaseStyleContext);
|
||||
#endif
|
||||
|
||||
already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
|
|
|
@ -364,14 +364,18 @@ HasValidOffsets(const nsTArray<Keyframe>& aKeyframes);
|
|||
static void
|
||||
MarkAsComputeValuesFailureKey(PropertyValuePair& aPair);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
IsComputeValuesFailureKey(const PropertyValuePair& aPair);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
GeckoStyleContext* aStyleContext);
|
||||
#endif
|
||||
|
||||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
|
@ -897,6 +901,7 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
if (!nsCSSProps::IsShorthand(aProperty)) {
|
||||
aParser.ParseLonghandProperty(aProperty,
|
||||
|
@ -936,6 +941,9 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
|||
|
||||
result.emplace(aProperty, Move(value));
|
||||
return result;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -980,6 +988,7 @@ MarkAsComputeValuesFailureKey(PropertyValuePair& aPair)
|
|||
aPair.mSimulateComputeValuesFailure = true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Returns true if |aPair| is a property-value pair on which we have
|
||||
* previously called MarkAsComputeValuesFailureKey (and hence we should
|
||||
|
@ -996,7 +1005,9 @@ IsComputeValuesFailureKey(const PropertyValuePair& aPair)
|
|||
aPair.mSimulateComputeValuesFailure;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Calculate the StyleAnimationValues of properties of each keyframe.
|
||||
* This involves expanding shorthand properties into longhand properties,
|
||||
|
@ -1083,6 +1094,7 @@ GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
|||
MOZ_ASSERT(result.Length() == aKeyframes.Length(), "Array length mismatch");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The variation of the above function. This is for Servo backend.
|
||||
|
@ -1632,6 +1644,7 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
|
|||
for (const PropertyValuePair& pair : frame.mPropertyValues) {
|
||||
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
||||
if (styleBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValueTokenStream* tokenStream =
|
||||
pair.mValue.GetTokenStreamValue();
|
||||
nsCSSParser parser(aDocument->CSSLoader());
|
||||
|
@ -1639,6 +1652,9 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
|
|||
tokenStream->mTokenStream)) {
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
MOZ_ASSERT(styleBackend != StyleBackendType::Servo ||
|
||||
|
|
|
@ -132,6 +132,7 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
|||
return Some(ComputedTimingFunction(timingFunction));
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
|
||||
|
@ -182,6 +183,10 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
|||
}
|
||||
|
||||
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
|
|||
&mRootMargin);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// By not passing a CSS Loader object we make sure we don't parse in quirks
|
||||
// mode so that pixel/percent and unit-less values will be differentiated.
|
||||
nsCSSParser parser(nullptr);
|
||||
|
@ -139,6 +140,9 @@ DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
|
|||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -683,6 +683,7 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
bool parseSuccess = parser.ParseTransformProperty(aTransformList,
|
||||
|
@ -713,6 +714,9 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
|||
nullptr, nullptr, dummy, dummyBox,
|
||||
nsPresContext::AppUnitsPerCSSPixel(),
|
||||
&contains3dTransform);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!contains3dTransform) {
|
||||
|
|
|
@ -3538,6 +3538,7 @@ Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
|
|||
return const_cast<Element*>(Servo_SelectorList_Closest(this, aList));
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) -> Element* {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
// Either we failed (and aError already has the exception), or this
|
||||
// is a pseudo-element-only selector that matches nothing.
|
||||
|
@ -3558,6 +3559,9 @@ Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
|
|||
}
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -3575,6 +3579,7 @@ Element::Matches(const nsAString& aSelector, ErrorResult& aError)
|
|||
return Servo_SelectorList_Matches(this, aList);
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
// Either we failed (and aError already has the exception), or this
|
||||
// is a pseudo-element-only selector that matches nothing.
|
||||
|
@ -3588,6 +3593,9 @@ Element::Matches(const nsAString& aSelector, ErrorResult& aError)
|
|||
matchingContext.AddScopeElement(this);
|
||||
return nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
|
||||
aList);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -454,10 +454,12 @@ public:
|
|||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Directionality GetDirectionality() const {
|
||||
if (HasFlag(NODE_HAS_DIRECTION_RTL)) {
|
||||
|
|
|
@ -249,6 +249,7 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
|||
return !!mServoSourceSizeList;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser cssParser;
|
||||
|
||||
mSizeQueries.Clear();
|
||||
|
@ -256,6 +257,9 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
|||
|
||||
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
|
||||
mSizeQueries, mSizeValues);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -459,6 +463,7 @@ ResponsiveImageSelector::ComputeFinalWidthForCurrentViewport(double *aWidth)
|
|||
effectiveWidth = presShell->StyleSet()->AsServo()->EvaluateSourceSizeList(
|
||||
mServoSourceSizeList.get());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
unsigned int numSizes = mSizeQueries.Length();
|
||||
MOZ_ASSERT(numSizes == mSizeValues.Length(),
|
||||
"mSizeValues length differs from mSizeQueries");
|
||||
|
@ -479,6 +484,9 @@ ResponsiveImageSelector::ComputeFinalWidthForCurrentViewport(double *aWidth)
|
|||
effectiveWidth = nsRuleNode::CalcLengthWithInitialFont(pctx,
|
||||
mSizeValues[i]);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
*aWidth = nsPresContext::AppUnitsToDoubleCSSPixels(std::max(effectiveWidth, 0));
|
||||
|
|
|
@ -125,9 +125,11 @@ private:
|
|||
// Servo bits.
|
||||
UniquePtr<RawServoSourceSizeList> mServoSourceSizeList;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Gecko bits.
|
||||
nsTArray< nsAutoPtr<nsMediaQuery> > mSizeQueries;
|
||||
nsTArray<nsCSSValue> mSizeValues;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ResponsiveImageCandidate {
|
||||
|
|
|
@ -629,6 +629,7 @@ nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
return MakeMappedUnique(mapped);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -636,6 +637,7 @@ nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
|
|||
aRuleWalker->Forward(mImpl->mMappedAttrs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsAttrAndChildArray::Compact()
|
||||
|
|
|
@ -125,7 +125,9 @@ public:
|
|||
}
|
||||
return DoSetMappedAttrStyleSheet(aSheet);
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker);
|
||||
#endif
|
||||
|
||||
void Compact();
|
||||
|
||||
|
|
|
@ -1744,10 +1744,14 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
|
|||
ownerDoc->GetCompatibilityMode(),
|
||||
ownerDoc->CSSLoader());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
css::Loader* cssLoader = ownerDoc->CSSLoader();
|
||||
nsCSSParser cssParser(cssLoader);
|
||||
decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
|
||||
principal);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (!decl) {
|
||||
return false;
|
||||
|
|
|
@ -2882,6 +2882,7 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue computedValue;
|
||||
if (!StyleAnimationValue::ExtractComputedValue(propertyID,
|
||||
styleContext->AsGecko(),
|
||||
|
@ -2915,6 +2916,9 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
|||
MOZ_ASSERT(uncomputeResult,
|
||||
"Unable to get specified value from computed value");
|
||||
return NS_OK;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -1333,12 +1333,17 @@ nsIDocument::SelectorCache::SelectorList::Reset()
|
|||
}
|
||||
} else {
|
||||
if (mGecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
delete mGecko;
|
||||
mGecko = nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// CacheList takes ownership of aSelectorList.
|
||||
void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
|
||||
mozilla::UniquePtr<nsCSSSelectorList>&& aSelectorList)
|
||||
|
@ -1348,6 +1353,7 @@ void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
|
|||
mTable.Put(key->mKey, SelectorList(Move(aSelectorList)));
|
||||
AddObject(key);
|
||||
}
|
||||
#endif
|
||||
|
||||
void nsIDocument::SelectorCache::CacheList(
|
||||
const nsAString& aSelector,
|
||||
|
@ -1963,7 +1969,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
|||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChannel)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleAttrStyleSheet)
|
||||
#endif
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mXPathEvaluator)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLayoutHistoryState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnloadBlocker)
|
||||
|
|
|
@ -1176,8 +1176,12 @@ public:
|
|||
mServo = aOther.mServo;
|
||||
aOther.mServo = nullptr;
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mGecko = aOther.mGecko;
|
||||
aOther.mGecko = nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -1189,10 +1193,12 @@ public:
|
|||
, mServo(aList.release())
|
||||
{}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
explicit SelectorList(mozilla::UniquePtr<nsCSSSelectorList>&& aList)
|
||||
: mIsServo(false)
|
||||
, mGecko(aList.release())
|
||||
{}
|
||||
#endif
|
||||
|
||||
~SelectorList() {
|
||||
Reset();
|
||||
|
|
|
@ -2634,6 +2634,7 @@ nsINode::ParseServoSelectorList(
|
|||
return selectorList;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSSelectorList*
|
||||
nsINode::ParseSelectorList(const nsAString& aSelectorString,
|
||||
ErrorResult& aRv)
|
||||
|
@ -2715,11 +2716,14 @@ AddScopeElements(TreeMatchContext& aMatchContext,
|
|||
aMatchContext.AddScopeElement(aMatchContextNode->AsElement());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
struct SelectorMatchInfo {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSSelectorList* const mSelectorList;
|
||||
TreeMatchContext& mMatchContext;
|
||||
#endif
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -2755,10 +2759,13 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
|
|||
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
|
||||
// We have an element with the right id and it's a strict descendant
|
||||
// of aRoot. Make sure it really matches the selector.
|
||||
if (!aMatchInfo ||
|
||||
nsCSSRuleProcessor::SelectorListMatches(element,
|
||||
aMatchInfo->mMatchContext,
|
||||
aMatchInfo->mSelectorList)) {
|
||||
if (!aMatchInfo
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|| nsCSSRuleProcessor::SelectorListMatches(element,
|
||||
aMatchInfo->mMatchContext,
|
||||
aMatchInfo->mSelectorList)
|
||||
#endif
|
||||
) {
|
||||
aList.AppendElement(element);
|
||||
if (onlyFirstMatch) {
|
||||
return;
|
||||
|
@ -2768,6 +2775,7 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Actually find elements matching aSelectorList (which must not be
|
||||
// null) and which are descendants of aRoot and put them in aList. If
|
||||
// onlyFirstMatch, then stop once the first one is found.
|
||||
|
@ -2827,6 +2835,7 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ElementHolder {
|
||||
ElementHolder() : mElement(nullptr) {}
|
||||
|
@ -2856,6 +2865,7 @@ nsINode::QuerySelector(const nsAString& aSelector, ErrorResult& aResult)
|
|||
Servo_SelectorList_QueryFirst(this, aList, useInvalidation));
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) -> Element* {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
// Either we failed (and aResult already has the exception), or this
|
||||
// is a pseudo-element-only selector that matches nothing.
|
||||
|
@ -2864,6 +2874,9 @@ nsINode::QuerySelector(const nsAString& aSelector, ErrorResult& aResult)
|
|||
ElementHolder holder;
|
||||
FindMatchingElements<true, ElementHolder>(this, aList, holder, aResult);
|
||||
return holder.mElement;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -2885,11 +2898,15 @@ nsINode::QuerySelectorAll(const nsAString& aSelector, ErrorResult& aResult)
|
|||
this, aList, contentList.get(), useInvalidation);
|
||||
},
|
||||
[&](nsCSSSelectorList* aList) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!aList) {
|
||||
return;
|
||||
}
|
||||
FindMatchingElements<false, AutoTArray<Element*, 128>>(
|
||||
this, aList, *contentList, aResult);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -2182,7 +2182,11 @@ protected:
|
|||
if (IsStyledByServo()) {
|
||||
return aServoFunctor(ParseServoSelectorList(aSelectorString, aRv));
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return aGeckoFunctor(ParseSelectorList(aSelectorString, aRv));
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
#include "nsMappedAttributeElement.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsresult
|
||||
nsMappedAttributeElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
mAttrsAndChildren.WalkMappedAttributeStyleRules(aRuleWalker);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsMappedAttributeElement::SetAndSwapMappedAttribute(nsAtom* aName,
|
||||
|
|
|
@ -39,7 +39,9 @@ public:
|
|||
static void MapNoAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
#endif
|
||||
virtual bool SetAndSwapMappedAttribute(nsAtom* aName,
|
||||
nsAttrValue& aValue,
|
||||
bool* aValueWasSet,
|
||||
|
|
|
@ -149,11 +149,13 @@ nsMappedAttributes::LastRelease()
|
|||
delete this;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMPL_ADDREF(nsMappedAttributes)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(nsMappedAttributes, LastRelease())
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(nsMappedAttributes,
|
||||
nsIStyleRule)
|
||||
#endif
|
||||
|
||||
void
|
||||
nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
|
||||
|
@ -254,6 +256,7 @@ nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
mSheet = aSheet; // not ref counted
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
|
@ -302,6 +305,7 @@ nsMappedAttributes::List(FILE* out, int32_t aIndent) const
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
nsMappedAttributes::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
class nsAtom;
|
||||
class nsHTMLStyleSheet;
|
||||
|
||||
class nsMappedAttributes final : public nsIStyleRule
|
||||
class nsMappedAttributes final
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
: public nsIStyleRule
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
nsMappedAttributes(nsHTMLStyleSheet* aSheet,
|
||||
|
@ -32,7 +35,11 @@ public:
|
|||
void* operator new(size_t size, uint32_t aAttrCount = 1) CPP_THROW_NEW;
|
||||
nsMappedAttributes* Clone(bool aWillAddAttr);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_DECL_ISUPPORTS
|
||||
#else
|
||||
NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(nsMappedAttributes, LastRelease())
|
||||
#endif
|
||||
|
||||
void SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
|
||||
bool* aValueWasSet);
|
||||
|
@ -90,6 +97,7 @@ public:
|
|||
mServoStyle = nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// nsIStyleRule
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
|
@ -97,6 +105,7 @@ public:
|
|||
nsCSSValue* aValue) override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
|
|
@ -427,7 +427,11 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
|||
if (mStyleSheet->IsServo()) {
|
||||
// XXXheycam ServoStyleSheets don't support <style scoped>.
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,6 +603,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
CSSStyleSheet* sheet = mStyleSheet->AsGecko();
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(this);
|
||||
|
@ -637,4 +642,7 @@ nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
|
|||
if (newScopeElement) {
|
||||
newScopeElement->SetIsElementInStyleScopeFlagOnSubtree(true);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1094,8 +1094,12 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
|||
CORS_NONE, aDocument->GetReferrerPolicy(),
|
||||
SRIMetadata());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
sheet = new CSSStyleSheet(mozilla::css::eAuthorSheetFeatures,
|
||||
CORS_NONE, aDocument->GetReferrerPolicy());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
|
||||
sheet->SetPrincipal(aDocument->NodePrincipal());
|
||||
|
@ -1105,10 +1109,14 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
|||
aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
|
||||
0, aDocument->GetCompatibilityMode());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Create the CSS parser, and parse the CSS text.
|
||||
nsCSSParser parser(nullptr, sheet->AsGecko());
|
||||
rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
|
||||
aDocument->NodePrincipal(), 0);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
// Mark the sheet as complete.
|
||||
|
@ -1188,12 +1196,16 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
|
|||
document->GetCompatibilityMode(),
|
||||
document->CSSLoader());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Pass the CSS Loader object to the parser, to allow parser error
|
||||
// reports to include the outer window ID.
|
||||
nsCSSParser parser(document->CSSLoader());
|
||||
decl = parser.ParseStyleAttribute(value, document->GetDocumentURI(),
|
||||
aElement->GetBaseURIForStyleAttr(),
|
||||
document->NodePrincipal());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (decl) {
|
||||
if (SanitizeStyleDeclaration(decl)) {
|
||||
|
|
|
@ -756,10 +756,18 @@ CanvasGradient::AddColorStop(float aOffset, const nsAString& aColorstr, ErrorRes
|
|||
? shell->StyleSet()->GetAsServo()
|
||||
: nullptr;
|
||||
|
||||
if (servoStyleSet) {
|
||||
bool useServoParser =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
servoStyleSet;
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
|
||||
if (useServoParser) {
|
||||
ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColorstr,
|
||||
&color);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
|
||||
|
@ -767,6 +775,9 @@ CanvasGradient::AddColorStop(float aOffset, const nsAString& aColorstr, ErrorRes
|
|||
|
||||
ok = parser.ParseColorString(aColorstr, nullptr, 0, value) &&
|
||||
nsRuleNode::ComputeColor(value, presContext, nullptr, color);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
|
@ -1166,7 +1177,14 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
nsIDocument* document = mCanvasElement ? mCanvasElement->OwnerDoc() : nullptr;
|
||||
css::Loader* loader = document ? document->CSSLoader() : nullptr;
|
||||
|
||||
if (document && document->IsStyledByServo()) {
|
||||
bool useServoParser =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
document && document->IsStyledByServo()
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
if (useServoParser) {
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
ServoStyleSet* set = presShell ? presShell->StyleSet()->AsServo() : nullptr;
|
||||
|
||||
|
@ -1190,6 +1208,7 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Pass the CSS Loader object to the parser, to allow parser error
|
||||
// reports to include the outer window ID.
|
||||
nsCSSParser parser(loader);
|
||||
|
@ -1217,6 +1236,9 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
*aColor);
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2669,6 +2691,7 @@ CanvasRenderingContext2D::SetShadowColor(const nsAString& aShadowColor)
|
|||
// filters
|
||||
//
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static already_AddRefed<Declaration>
|
||||
CreateDeclaration(nsINode* aNode,
|
||||
const nsCSSPropertyID aProp1, const nsAString& aValue1, bool* aChanged1,
|
||||
|
@ -2821,6 +2844,7 @@ GetFontStyleContext(Element* aElement, const nsAString& aFont,
|
|||
|
||||
return sc.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateDeclarationForServo(nsCSSPropertyID aProperty,
|
||||
|
@ -2930,6 +2954,7 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
|||
return sc.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static already_AddRefed<Declaration>
|
||||
CreateFilterDeclaration(const nsAString& aFilter,
|
||||
nsINode* aNode,
|
||||
|
@ -2974,6 +2999,7 @@ ResolveFilterStyle(const nsAString& aFilterString,
|
|||
|
||||
return sc.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateFilterDeclarationForServo(const nsAString& aFilter,
|
||||
|
@ -3030,6 +3056,7 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
|
||||
nsString usedFont;
|
||||
if (presShell->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<GeckoStyleContext> parentContext =
|
||||
GetFontStyleContext(mCanvasElement, GetFont(),
|
||||
presShell, usedFont, aError);
|
||||
|
@ -3045,6 +3072,10 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
}
|
||||
aFilterChain = sc->StyleEffects()->mFilters;
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// For stylo
|
||||
|
@ -3982,8 +4013,12 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
|||
sc =
|
||||
GetFontStyleForServo(mCanvasElement, aFont, presShell, usedFont, aError);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
sc =
|
||||
GetFontStyleContext(mCanvasElement, aFont, presShell, usedFont, aError);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (!sc) {
|
||||
return false;
|
||||
|
|
|
@ -72,12 +72,16 @@ DocumentRendererChild::RenderDocument(nsPIDOMWindowOuter* window,
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
nsCSSValue bgColorValue;
|
||||
if (!parser.ParseColorString(aBGColor, nullptr, 0, bgColorValue) ||
|
||||
!nsRuleNode::ComputeColor(bgColorValue, presContext, nullptr, bgColor)) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw directly into the output array.
|
||||
|
|
|
@ -93,6 +93,7 @@ HTMLTableCellElement::CellIndex() const
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -106,6 +107,7 @@ HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsMappedAttributes*
|
||||
HTMLTableCellElement::GetMappedAttributesInheritedFromTable() const
|
||||
|
|
|
@ -142,7 +142,9 @@ public:
|
|||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
#endif
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
// Get mapped attributes of ancestor table, if any
|
||||
nsMappedAttributes* GetMappedAttributesInheritedFromTable() const;
|
||||
|
|
|
@ -2238,7 +2238,13 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
|||
|
||||
// Content processes have no permission to access profile directory, so we
|
||||
// send the file URL instead.
|
||||
StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
|
||||
StyleBackendType backendType =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleBackendType::Gecko;
|
||||
#else
|
||||
StyleBackendType::Servo;
|
||||
#endif
|
||||
StyleSheet* ucs = nsLayoutStylesheetCache::For(backendType)->UserContentSheet();
|
||||
if (ucs) {
|
||||
SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL());
|
||||
} else {
|
||||
|
@ -2358,25 +2364,21 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
|||
// send two loads.
|
||||
//
|
||||
// The URIs of the Gecko and Servo sheets should be the same, so it
|
||||
// shouldn't matter which we look at. (The Servo sheets don't exist
|
||||
// in non-MOZ-STYLO builds, though, so look at the Gecko ones.)
|
||||
// shouldn't matter which we look at.
|
||||
|
||||
for (StyleSheet* sheet :
|
||||
*sheetService->AgentStyleSheets(StyleBackendType::Gecko)) {
|
||||
for (StyleSheet* sheet : *sheetService->AgentStyleSheets(backendType)) {
|
||||
URIParams uri;
|
||||
SerializeURI(sheet->GetSheetURI(), uri);
|
||||
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
for (StyleSheet* sheet :
|
||||
*sheetService->UserStyleSheets(StyleBackendType::Gecko)) {
|
||||
for (StyleSheet* sheet : *sheetService->UserStyleSheets(backendType)) {
|
||||
URIParams uri;
|
||||
SerializeURI(sheet->GetSheetURI(), uri);
|
||||
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
|
||||
}
|
||||
|
||||
for (StyleSheet* sheet :
|
||||
*sheetService->AuthorStyleSheets(StyleBackendType::Gecko)) {
|
||||
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets(backendType)) {
|
||||
URIParams uri;
|
||||
SerializeURI(sheet->GetSheetURI(), uri);
|
||||
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
|
||||
|
|
|
@ -74,10 +74,16 @@ nsSMILCSSProperty::GetBaseValue() const
|
|||
if (!computedValue.mServo) {
|
||||
return baseValue;
|
||||
}
|
||||
} else if (!StyleAnimationValue::ExtractComputedValue(mPropID,
|
||||
mBaseStyleContext->AsGecko(),
|
||||
computedValue.mGecko)) {
|
||||
return baseValue;
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!StyleAnimationValue::ExtractComputedValue(mPropID,
|
||||
mBaseStyleContext->AsGecko(),
|
||||
computedValue.mGecko)) {
|
||||
return baseValue;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
baseValue =
|
||||
|
|
|
@ -183,6 +183,7 @@ FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1,
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static void
|
||||
InvertSign(StyleAnimationValue& aValue)
|
||||
{
|
||||
|
@ -201,6 +202,7 @@ InvertSign(StyleAnimationValue& aValue)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static ValueWrapper*
|
||||
ExtractValueWrapper(nsSMILValue& aValue)
|
||||
|
@ -500,6 +502,7 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
|
|||
return ComputeDistanceForServo(fromWrapper, *toWrapper, aDistance);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const StyleAnimationValue* fromCSSValue = fromWrapper ?
|
||||
&fromWrapper->mGeckoValue : nullptr;
|
||||
const StyleAnimationValue* toCSSValue = &toWrapper->mGeckoValue;
|
||||
|
@ -514,6 +517,9 @@ nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom,
|
|||
aDistance)
|
||||
? NS_OK
|
||||
: NS_ERROR_FAILURE;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -640,6 +646,7 @@ GetPresContextForElement(Element* aElem)
|
|||
return shell ? shell->GetPresContext() : nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static const nsDependentSubstring
|
||||
GetNonNegativePropValue(const nsAString& aString, nsCSSPropertyID aPropID,
|
||||
bool& aIsNegative)
|
||||
|
@ -697,6 +704,7 @@ ValueFromStringHelper(nsCSSPropertyID aPropID,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ServoAnimationValues
|
||||
ValueFromStringHelper(nsCSSPropertyID aPropID,
|
||||
|
@ -780,6 +788,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue parsedValue;
|
||||
if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
|
||||
styleContext->AsGecko(), aString, parsedValue,
|
||||
|
@ -787,6 +796,9 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
|||
sSingleton.Init(aValue);
|
||||
aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -930,6 +930,7 @@ nsSVGElement::NodeInfoChanged(nsIDocument* aOldDoc)
|
|||
OwnerDoc()->ScheduleSVGForPresAttrEvaluation(this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -948,6 +949,7 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSVGElement::IsAttributeMapped(const nsAtom* name) const
|
||||
|
@ -1204,8 +1206,10 @@ public:
|
|||
private:
|
||||
// MEMBER DATA
|
||||
// -----------
|
||||
nsCSSParser mParser;
|
||||
css::Loader* mLoader;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser mParser;
|
||||
#endif
|
||||
|
||||
// Arguments for nsCSSParser::ParseProperty
|
||||
nsIURI* mDocURI;
|
||||
|
@ -1225,8 +1229,14 @@ MappedAttrParser::MappedAttrParser(css::Loader* aLoader,
|
|||
already_AddRefed<nsIURI> aBaseURI,
|
||||
nsSVGElement* aElement,
|
||||
StyleBackendType aBackend)
|
||||
: mParser(aLoader), mLoader(aLoader), mDocURI(aDocURI), mBaseURI(aBaseURI),
|
||||
mElement(aElement), mBackend(aBackend)
|
||||
: mLoader(aLoader)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
, mParser(aLoader)
|
||||
#endif
|
||||
, mDocURI(aDocURI)
|
||||
, mBaseURI(aBaseURI)
|
||||
, mElement(aElement)
|
||||
, mBackend(aBackend)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1243,8 +1253,12 @@ MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
|
|||
{
|
||||
if (!mDecl) {
|
||||
if (mBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mDecl = new css::Declaration();
|
||||
mDecl->AsGecko()->InitializeEmpty();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
mDecl = new ServoDeclarationBlock();
|
||||
}
|
||||
|
@ -1257,8 +1271,12 @@ MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
|
|||
if (propertyID != eCSSProperty_UNKNOWN) {
|
||||
bool changed = false; // outparam for ParseProperty.
|
||||
if (mBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
|
||||
mElement->NodePrincipal(), mDecl->AsGecko(), &changed, false, true);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
|
||||
// FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
|
||||
|
@ -1295,12 +1313,16 @@ MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
|
|||
if (aMappedAttrName == nsGkAtoms::lang) {
|
||||
propertyID = eCSSProperty__x_lang;
|
||||
if (mBackend == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSExpandedDataBlock block;
|
||||
mDecl->AsGecko()->ExpandTo(&block);
|
||||
nsCSSValue cssValue(PromiseFlatString(aMappedAttrValue), eCSSUnit_Ident);
|
||||
block.AddLonghandProperty(propertyID, cssValue);
|
||||
mDecl->AsGecko()->ValueAppended(propertyID);
|
||||
mDecl->AsGecko()->CompressFrom(&block);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
RefPtr<nsAtom> atom = NS_Atomize(aMappedAttrValue);
|
||||
Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
|
||||
|
|
|
@ -116,8 +116,10 @@ public:
|
|||
*/
|
||||
virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
void WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
|
|
|
@ -673,6 +673,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsresult
|
||||
nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData,
|
||||
|
@ -713,6 +714,7 @@ nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsBindingManager::EnumerateBoundContentBindings(
|
||||
|
@ -743,6 +745,7 @@ nsBindingManager::EnumerateBoundContentBindings(
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData)
|
||||
|
@ -756,6 +759,7 @@ nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
|||
return true;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
||||
|
@ -786,12 +790,16 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
|||
rulesChanged = rulesChanged || styleSetChanged;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor* ruleProcessor =
|
||||
aBinding->PrototypeBinding()->GetRuleProcessor();
|
||||
if (ruleProcessor) {
|
||||
bool thisChanged = ruleProcessor->MediumFeaturesChanged(presContext);
|
||||
rulesChanged = rulesChanged || thisChanged;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -124,6 +124,7 @@ public:
|
|||
|
||||
nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Style rule methods
|
||||
nsresult WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData,
|
||||
|
@ -131,6 +132,7 @@ public:
|
|||
|
||||
void WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData);
|
||||
#endif
|
||||
|
||||
// Do any processing that needs to happen as a result of a change in the
|
||||
// characteristics of the medium, and return whether this rule processor's
|
||||
|
|
|
@ -825,6 +825,7 @@ nsXBLBinding::InheritsStyle() const
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
|
||||
{
|
||||
|
@ -835,6 +836,7 @@ nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
|
|||
if (rules)
|
||||
(*aFunc)(rules, aData);
|
||||
}
|
||||
#endif
|
||||
|
||||
ServoStyleSet*
|
||||
nsXBLBinding::GetServoStyleSet() const
|
||||
|
|
|
@ -129,7 +129,9 @@ public:
|
|||
|
||||
void ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData);
|
||||
#endif
|
||||
|
||||
mozilla::ServoStyleSet* GetServoStyleSet() const;
|
||||
|
||||
|
|
|
@ -564,6 +564,7 @@ nsXBLPrototypeBinding::SetInitialAttributes(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor*
|
||||
nsXBLPrototypeBinding::GetRuleProcessor()
|
||||
{
|
||||
|
@ -573,6 +574,7 @@ nsXBLPrototypeBinding::GetRuleProcessor()
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::ComputeServoStyleSet(nsPresContext* aPresContext)
|
||||
|
|
|
@ -132,7 +132,9 @@ public:
|
|||
bool HasStyleSheets() const;
|
||||
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor* GetRuleProcessor();
|
||||
#endif
|
||||
void ComputeServoStyleSet(nsPresContext* aPresContext);
|
||||
mozilla::ServoStyleSet* GetServoStyleSet() const;
|
||||
|
||||
|
|
|
@ -121,7 +121,11 @@ nsXBLPrototypeResources::FlushSkinSheets()
|
|||
ComputeServoStyleSet(shell->GetPresContext());
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
GatherRuleProcessor();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -141,7 +145,9 @@ nsXBLPrototypeResources::Traverse(nsCycleCollectionTraversalCallback &cb)
|
|||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mResources mLoader");
|
||||
cb.NoteXPCOMChild(mLoader);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
CycleCollectionNoteChild(cb, mRuleProcessor.get(), "mRuleProcessor");
|
||||
#endif
|
||||
ImplCycleCollectionTraverse(cb, mStyleSheetList, "mStyleSheetList");
|
||||
}
|
||||
|
||||
|
@ -149,7 +155,9 @@ void
|
|||
nsXBLPrototypeResources::Unlink()
|
||||
{
|
||||
mStyleSheetList.Clear();
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mRuleProcessor = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -158,6 +166,7 @@ nsXBLPrototypeResources::ClearLoader()
|
|||
mLoader = nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsXBLPrototypeResources::GatherRuleProcessor()
|
||||
{
|
||||
|
@ -174,6 +183,7 @@ nsXBLPrototypeResources::GatherRuleProcessor()
|
|||
nullptr,
|
||||
mRuleProcessor);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsXBLPrototypeResources::ComputeServoStyleSet(nsPresContext* aPresContext)
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
bool HasStyleSheets() const;
|
||||
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Recreates mRuleProcessor to represent the current list of style sheets
|
||||
* stored in mStyleSheetList. (Named GatherRuleProcessor to parallel
|
||||
|
@ -58,6 +59,7 @@ public:
|
|||
void GatherRuleProcessor();
|
||||
|
||||
nsCSSRuleProcessor* GetRuleProcessor() const { return mRuleProcessor; }
|
||||
#endif
|
||||
|
||||
// Updates the ServoStyleSet object that holds the result of cascading the
|
||||
// sheets in mStyleSheetList. Equivalent to GatherRuleProcessor(), but for
|
||||
|
@ -73,8 +75,10 @@ private:
|
|||
// A list of loaded stylesheets for this binding.
|
||||
nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheetList;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// The list of stylesheets converted to a rule processor.
|
||||
RefPtr<nsCSSRuleProcessor> mRuleProcessor;
|
||||
#endif
|
||||
|
||||
// The result of cascading the XBL style sheets like mRuleProcessor, but
|
||||
// for the Servo style backend.
|
||||
|
|
|
@ -186,7 +186,11 @@ nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
|
|||
if (mPendingSheets == 0) {
|
||||
// All stylesheets are loaded.
|
||||
if (aSheet->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mResources->GatherRuleProcessor();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
mResources->ComputeServoStyleSet(
|
||||
mBoundDocument->GetShell()->GetPresContext());
|
||||
|
|
|
@ -1387,11 +1387,13 @@ nsXULElement::PreHandleEvent(EventChainVisitor& aVisitor)
|
|||
//----------------------------------------------------------------------
|
||||
// Implementation methods
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsChangeHint
|
||||
nsXULElement::GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
|
@ -2335,9 +2337,13 @@ nsXULPrototypeElement::SetAttrAt(uint32_t aPos, const nsAString& aValue,
|
|||
declaration = ServoDeclarationBlock::FromCssText(
|
||||
aValue, data, eCompatibility_FullStandards, nullptr);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
declaration = parser.ParseStyleAttribute(aValue, aDocumentURI,
|
||||
aDocumentURI, principal);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (declaration) {
|
||||
mAttributes[aPos].mValue.SetTo(declaration.forget(), &aValue);
|
||||
|
|
|
@ -389,7 +389,9 @@ public:
|
|||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
#endif
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
|
|
@ -2908,7 +2908,11 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
|
|||
NS_ERROR("stylo: ServoStyleSheets can't be disabled yet");
|
||||
return true;
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
sheet->AsGecko()->SetDisabled(false);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -602,8 +602,12 @@ VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
|
|||
NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
|
||||
aPresContext->RestyleManager()->AsGecko()->DebugVerifyStyleTree(rootFrame);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#define VERIFY_STYLE_TREE ::VerifyStyleTree(mPresContext, mFrameConstructor)
|
||||
|
@ -4348,16 +4352,22 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
|
|||
if (mDidInitialize) {
|
||||
if (mStyleSet->IsServo()) {
|
||||
mStyleSet->AsServo()->InvalidateStyleForDocumentStateChanges(aStateMask);
|
||||
} else if (Element* rootElement = aDocument->GetRootElement()) {
|
||||
const bool needRestyle =
|
||||
mStyleSet->AsGecko()->HasDocumentStateDependentStyle(
|
||||
rootElement, aStateMask);
|
||||
if (needRestyle) {
|
||||
mPresContext->RestyleManager()->PostRestyleEvent(rootElement,
|
||||
eRestyle_Subtree,
|
||||
nsChangeHint(0));
|
||||
VERIFY_STYLE_TREE;
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (Element* rootElement = aDocument->GetRootElement()) {
|
||||
const bool needRestyle =
|
||||
mStyleSet->AsGecko()->HasDocumentStateDependentStyle(
|
||||
rootElement, aStateMask);
|
||||
if (needRestyle) {
|
||||
mPresContext->RestyleManager()->PostRestyleEvent(rootElement,
|
||||
eRestyle_Subtree,
|
||||
nsChangeHint(0));
|
||||
VERIFY_STYLE_TREE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9727,6 +9737,7 @@ CopySheetsIntoClone(StyleSetHandle aSet, StyleSetHandle aClone)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet*
|
||||
PresShell::CloneStyleSet(nsStyleSet* aSet)
|
||||
{
|
||||
|
@ -9734,6 +9745,7 @@ PresShell::CloneStyleSet(nsStyleSet* aSet)
|
|||
CopySheetsIntoClone(aSet, clone);
|
||||
return clone;
|
||||
}
|
||||
#endif
|
||||
|
||||
ServoStyleSet*
|
||||
PresShell::CloneStyleSet(ServoStyleSet* aSet)
|
||||
|
@ -9796,19 +9808,27 @@ PresShell::VerifyIncrementalReflow()
|
|||
|
||||
// Create a new presentation shell to view the document. Use the
|
||||
// exact same style information that this document has.
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsAutoPtr<nsStyleSet> newGeckoSet;
|
||||
#endif
|
||||
nsAutoPtr<ServoStyleSet> newServoSet;
|
||||
StyleSetHandle newSet;
|
||||
if (mStyleSet->IsServo()) {
|
||||
newServoSet = CloneStyleSet(mStyleSet->AsServo());
|
||||
newSet = newServoSet;
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
newGeckoSet = CloneStyleSet(mStyleSet->AsGecko());
|
||||
newSet = newGeckoSet;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet);
|
||||
NS_ENSURE_TRUE(sh, false);
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
newGeckoSet.forget();
|
||||
#endif
|
||||
newServoSet.forget();
|
||||
// Note that after we create the shell, we must make sure to destroy it
|
||||
sh->SetVerifyReflowEnable(false); // turn off verify reflow while we're reflowing the test frame tree
|
||||
|
@ -10639,12 +10659,14 @@ PresShell::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
|||
mApproximatelyVisibleFrames.ShallowSizeOfExcludingThis(mallocSizeOf) +
|
||||
mFramesToDirty.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
if (nsStyleSet* styleSet = StyleSet()->GetAsGecko()) {
|
||||
styleSet->AddSizeOfIncludingThis(aSizes);
|
||||
} else if (ServoStyleSet* styleSet = StyleSet()->GetAsServo()) {
|
||||
styleSet->AddSizeOfIncludingThis(aSizes);
|
||||
if (StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleSet()->AsGecko()->AddSizeOfIncludingThis(aSizes);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
MOZ_CRASH();
|
||||
StyleSet()->AsServo()->AddSizeOfIncludingThis(aSizes);
|
||||
}
|
||||
|
||||
aSizes.mLayoutTextRunsSize += SizeOfTextRuns(mallocSizeOf);
|
||||
|
@ -10845,10 +10867,15 @@ nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
|
|||
bool* aRetVal)
|
||||
{
|
||||
*aRetVal = false;
|
||||
if (nsStyleSet* styleSet = mStyleSet->GetAsGecko()) {
|
||||
if (mStyleSet->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet* styleSet = mStyleSet->AsGecko();
|
||||
// ServoStyleSets do not have rule processors.
|
||||
SheetType type = ToSheetType(aSheetType);
|
||||
*aRetVal = styleSet->HasRuleProcessorUsedByMultipleStyleSets(type);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -518,7 +518,9 @@ protected:
|
|||
bool mCaretEnabled;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet* CloneStyleSet(nsStyleSet* aSet);
|
||||
#endif
|
||||
ServoStyleSet* CloneStyleSet(ServoStyleSet* aSet);
|
||||
bool VerifyIncrementalReflow();
|
||||
bool mInVerifyReflow;
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
#include "mozilla/AutoRestore.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define RESTYLE_LOGGING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RESTYLE_LOGGING
|
||||
#define LOG_RESTYLE_VAR2(prefix_, suffix_) prefix_##suffix_
|
||||
|
|
|
@ -482,6 +482,7 @@ static bool gInApplyRenderingChangeToTree = false;
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static void
|
||||
DumpContext(nsIFrame* aFrame, nsStyleContext* aContext)
|
||||
{
|
||||
|
@ -628,6 +629,7 @@ VerifyStyleTree(nsIFrame* aFrame)
|
|||
VerifyContextParent(aFrame, extraContext->AsGecko(), context);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
|
||||
|
@ -638,9 +640,13 @@ RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
|
|||
// we work out what we want to assert (bug 1322570).
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (aFrame) {
|
||||
VerifyStyleTree(aFrame);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // DEBUG
|
||||
|
@ -1752,10 +1758,20 @@ RestyleManager::IncrementAnimationGeneration()
|
|||
// We update the animation generation at start of each call to
|
||||
// ProcessPendingRestyles so we should ignore any subsequent (redundant)
|
||||
// calls that occur while we are still processing restyles.
|
||||
if ((IsGecko() && !AsGecko()->IsProcessingRestyles()) ||
|
||||
(IsServo() && !mInStyleRefresh)) {
|
||||
++mAnimationGeneration;
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (AsGecko()->IsProcessingRestyles()) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
if (mInStyleRefresh) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
++mAnimationGeneration;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
|
|
@ -335,6 +335,8 @@ static int32_t FFWC_recursions=0;
|
|||
static int32_t FFWC_nextInFlows=0;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|
||||
// Wrapper class to handle stack-construction a TreeMatchContext only if we're
|
||||
// using the Gecko style system.
|
||||
class MOZ_STACK_CLASS TreeMatchContextHolder
|
||||
|
@ -361,6 +363,21 @@ private:
|
|||
Maybe<TreeMatchContext> mMaybeTreeMatchContext;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// Define this dummy class so there are fewer call sites to change when the old
|
||||
// style system code is compiled out.
|
||||
class TreeMatchContextHolder
|
||||
{
|
||||
public:
|
||||
explicit TreeMatchContextHolder(nsIDocument* aDocument) {}
|
||||
bool Exists() const { return false; }
|
||||
operator TreeMatchContext*() { return nullptr; }
|
||||
TreeMatchContext* operator->() { MOZ_CRASH("old style system disabled"); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Returns true if aFrame is an anonymous flex/grid item.
|
||||
static inline bool
|
||||
IsAnonymousFlexOrGridItem(const nsIFrame* aFrame)
|
||||
|
@ -879,7 +896,11 @@ public:
|
|||
|
||||
bool HasAncestorFilter()
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return mTreeMatchContext && mTreeMatchContext->mAncestorFilter.HasFilter();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Function to push the existing absolute containing block state and
|
||||
|
@ -1027,6 +1048,23 @@ protected:
|
|||
PendingBinding* mCurrentPendingBindingInsertionPoint;
|
||||
};
|
||||
|
||||
#ifndef MOZ_OLD_STYLE
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class AutoDisplayContentsAncestorPusher
|
||||
{
|
||||
public:
|
||||
AutoDisplayContentsAncestorPusher(TreeMatchContext& aTreeMatchContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIContent* aParent) {}
|
||||
bool IsEmpty() const { return false; }
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
nsFrameConstructorState::nsFrameConstructorState(
|
||||
nsIPresShell* aPresShell,
|
||||
TreeMatchContext* aTreeMatchContext,
|
||||
|
@ -1955,6 +1993,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
|||
styleSet->AsServo()->ResolveServoStyle(container);
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
|
||||
GeckoRestyleManager::ReframingStyleContexts* rsc =
|
||||
geckoRM->GetReframingStyleContexts();
|
||||
|
@ -1974,6 +2013,9 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
|||
}
|
||||
pseudoStyleContext = newContext.forget();
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t contentCount = pseudoStyleContext->StyleContent()->ContentCount();
|
||||
|
@ -3987,7 +4029,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
insertionPointPusher(aState.mTreeMatchContext);
|
||||
if (adcp.isSome() && adcp->IsEmpty() && parent &&
|
||||
parent->IsActiveChildrenElement()) {
|
||||
if (aState.mTreeMatchContext->mAncestorFilter.HasFilter()) {
|
||||
if (aState.HasAncestorFilter()) {
|
||||
insertionPointPusher.PushAncestorAndStyleScope(parent);
|
||||
} else {
|
||||
insertionPointPusher.PushStyleScope(parent);
|
||||
|
@ -5276,7 +5318,9 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
|||
// ServoRestyleManager does not handle transitions yet, and when it does
|
||||
// it probably won't need to track reframed style contexts to start
|
||||
// transitions correctly.
|
||||
if (mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
|
||||
if (RestyleManager()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
|
||||
GeckoRestyleManager::ReframingStyleContexts* rsc =
|
||||
geckoRM->GetReframingStyleContexts();
|
||||
if (rsc) {
|
||||
|
@ -5295,6 +5339,9 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
|||
CSSPseudoElementType::NotPseudo, result->AsGecko());
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
return result.forget();
|
||||
|
@ -5979,9 +6026,13 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
styleContext =
|
||||
mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aContent->AsElement());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
styleContext =
|
||||
ResolveStyleContext(styleContext->AsGecko()->GetParent(),
|
||||
aContent, &aState);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7267,12 +7318,17 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
|||
// We need different handling for servo given the scoped restyle roots.
|
||||
CheckBitsForLazyFrameConstruction(parent);
|
||||
|
||||
if (mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
|
||||
if (RestyleManager()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
|
||||
while (parent && !parent->HasFlag(NODE_DESCENDANTS_NEED_FRAMES)) {
|
||||
parent->SetFlags(NODE_DESCENDANTS_NEED_FRAMES);
|
||||
parent = parent->GetFlattenedTreeParent();
|
||||
}
|
||||
geckoRM->PostRestyleEventForLazyConstruction();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
parent->AsElement()->NoteDescendantsNeedFramesForServo();
|
||||
}
|
||||
|
@ -7280,6 +7336,7 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsCSSFrameConstructor::CreateNeededFrames(
|
||||
nsIContent* aContent,
|
||||
|
@ -7376,6 +7433,7 @@ nsCSSFrameConstructor::CreateNeededFrames()
|
|||
CreateNeededFrames(rootElement, treeMatchContext);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer,
|
||||
|
@ -9385,6 +9443,7 @@ nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
DefinitelyEqualURIsAndPrincipal(mozilla::css::URLValue* aURI1,
|
||||
mozilla::css::URLValue* aURI2)
|
||||
|
@ -9436,6 +9495,7 @@ nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement)
|
|||
RecreateFramesForContent(aElement, InsertionKind::Sync);
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
IsWhitespaceFrame(nsIFrame* aFrame)
|
||||
|
|
|
@ -100,16 +100,20 @@ public:
|
|||
|
||||
void ReconstructDocElementHierarchy(InsertionKind);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Create frames for content nodes that are marked as needing frames. This
|
||||
// should be called before ProcessPendingRestyles.
|
||||
// Note: It's the caller's responsibility to make sure to wrap a
|
||||
// CreateNeededFrames call in a view update batch and a script blocker.
|
||||
void CreateNeededFrames();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void CreateNeededFrames(nsIContent* aContent,
|
||||
TreeMatchContext& aTreeMatchContext);
|
||||
#endif
|
||||
|
||||
enum Operation {
|
||||
CONTENTAPPEND,
|
||||
|
@ -1859,6 +1863,7 @@ private:
|
|||
PendingBinding* aPendingBinding,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* ReResolve style for aElement then recreate frames if required.
|
||||
* Do nothing for other types of style changes, except for undisplayed nodes
|
||||
|
@ -1867,6 +1872,7 @@ private:
|
|||
* @return null if frames were recreated, the new style context otherwise
|
||||
*/
|
||||
nsStyleContext* MaybeRecreateFramesForElement(Element* aElement);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Recreate frames for aContent.
|
||||
|
|
|
@ -2327,7 +2327,11 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
|
||||
StyleSetHandle styleSet;
|
||||
if (backendType == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
styleSet = new nsStyleSet();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
styleSet = new ServoStyleSet(ServoStyleSet::Kind::Master);
|
||||
}
|
||||
|
|
|
@ -8270,6 +8270,7 @@ nsLayoutUtils::Shutdown()
|
|||
bool
|
||||
nsLayoutUtils::ShouldUseStylo(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Disable stylo for system principal because XUL hasn't been fully
|
||||
// supported. Other principal aren't able to use XUL by default, and
|
||||
// the back door to enable XUL is mostly just for testing, which means
|
||||
|
@ -8278,7 +8279,7 @@ nsLayoutUtils::ShouldUseStylo(nsIPrincipal* aPrincipal)
|
|||
nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2518,8 +2518,10 @@ public:
|
|||
// or disabled at compile-time. However, we provide the additional capability
|
||||
// to disable it dynamically in stylo-enabled builds via a pref.
|
||||
static bool StyloEnabled() {
|
||||
#ifdef MOZ_STYLO
|
||||
#if defined(MOZ_STYLO) && defined(MOZ_OLD_STYLE)
|
||||
return sStyloEnabled && StyloSupportedInCurrentProcess();
|
||||
#elif defined(MOZ_STYLO)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -156,14 +156,25 @@ nsPresContext::MakeColorPref(const nsString& aColor)
|
|||
? mShell->StyleSet()->GetAsServo()
|
||||
: nullptr;
|
||||
|
||||
if (servoStyleSet) {
|
||||
bool useServoParser =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
servoStyleSet;
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
|
||||
if (useServoParser) {
|
||||
ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColor,
|
||||
&result);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
nsCSSValue value;
|
||||
ok = parser.ParseColorString(aColor, nullptr, 0, value) &&
|
||||
nsRuleNode::ComputeColor(value, this, nullptr, result);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
|
@ -1011,7 +1022,11 @@ nsPresContext::AttachShell(nsIPresShell* aShell, StyleBackendType aBackendType)
|
|||
if (aBackendType == StyleBackendType::Servo) {
|
||||
mRestyleManager = new ServoRestyleManager(this);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mRestyleManager = new GeckoRestyleManager(this);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Since CounterStyleManager is also the name of a method of
|
||||
|
@ -2050,8 +2065,12 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
|
|||
|
||||
mUsesRootEMUnits = false;
|
||||
mUsesExChUnits = false;
|
||||
if (nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko()) {
|
||||
styleSet->SetUsesViewportUnits(false);
|
||||
if (mShell->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mShell->StyleSet()->AsGecko()->SetUsesViewportUnits(false);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
mDocument->RebuildUserFontSet();
|
||||
RebuildCounterStyles();
|
||||
|
@ -2273,11 +2292,16 @@ bool
|
|||
nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
|
||||
uint32_t aRuleTypeMask) const
|
||||
{
|
||||
if (auto* geckoStyleContext = aFrame->StyleContext()->GetAsGecko()) {
|
||||
if (aFrame->StyleContext()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto* geckoStyleContext = aFrame->StyleContext()->AsGecko();
|
||||
return
|
||||
nsRuleNode::HasAuthorSpecifiedRules(geckoStyleContext,
|
||||
aRuleTypeMask,
|
||||
UseDocumentColors());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
Element* elem = aFrame->GetContent()->AsElement();
|
||||
|
||||
|
@ -2793,15 +2817,18 @@ nsPresContext::HasCachedStyleData()
|
|||
return false;
|
||||
}
|
||||
|
||||
nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// XXXheycam ServoStyleSets do not use the rule tree, so just assume for now
|
||||
// that we need to restyle when e.g. dppx changes assuming we're sufficiently
|
||||
// bootstrapped.
|
||||
return mShell->DidInitialize();
|
||||
if (mShell->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return mShell->StyleSet()->AsGecko()->HasCachedStyleData();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
return styleSet->HasCachedStyleData();
|
||||
// XXXheycam ServoStyleSets do not use the rule tree, so just assume for now
|
||||
// that we need to restyle when e.g. dppx changes assuming we're sufficiently
|
||||
// bootstrapped.
|
||||
return mShell->DidInitialize();
|
||||
}
|
||||
|
||||
already_AddRefed<nsITimer>
|
||||
|
|
|
@ -100,9 +100,7 @@ nsStyleSheetService::FindSheetByURI(mozilla::StyleBackendType aBackendType,
|
|||
uint32_t aSheetType,
|
||||
nsIURI* aSheetURI)
|
||||
{
|
||||
SheetArray& sheets = aBackendType == mozilla::StyleBackendType::Gecko ?
|
||||
mGeckoSheets[aSheetType] :
|
||||
mServoSheets[aSheetType];
|
||||
SheetArray& sheets = Sheets(aBackendType)[aSheetType];
|
||||
for (int32_t i = sheets.Length() - 1; i >= 0; i-- ) {
|
||||
if (SheetHasURI(sheets[i], aSheetURI)) {
|
||||
return i;
|
||||
|
@ -184,11 +182,9 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI,
|
|||
nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
|
||||
for (nsIPresShell* presShell : toNotify) {
|
||||
if (presShell->StyleSet()) {
|
||||
bool isGecko = presShell->StyleSet()->IsGecko();
|
||||
// We always have a Gecko sheet; we sometimes have a Servo sheet.
|
||||
if (isGecko || servoSheetWasAdded) {
|
||||
StyleSheet* sheet = isGecko ? mGeckoSheets[aSheetType].LastElement() :
|
||||
mServoSheets[aSheetType].LastElement();
|
||||
StyleBackendType backendType = presShell->StyleSet()->BackendType();
|
||||
if (backendType == StyleBackendType::Gecko || servoSheetWasAdded) {
|
||||
StyleSheet* sheet = Sheets(backendType)[aSheetType].LastElement();
|
||||
presShell->NotifyStyleSheetServiceSheetAdded(sheet, aSheetType);
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("Servo pres shell, but stylo unsupported?");
|
||||
|
@ -250,20 +246,21 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
RefPtr<StyleSheet> geckoSheet;
|
||||
|
||||
rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Gecko, &geckoSheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(geckoSheet);
|
||||
mGeckoSheets[aSheetType].AppendElement(geckoSheet);
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
{
|
||||
RefPtr<StyleSheet> geckoSheet;
|
||||
nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Gecko, &geckoSheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(geckoSheet);
|
||||
mGeckoSheets[aSheetType].AppendElement(geckoSheet);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
if (nsLayoutUtils::StyloSupportedInCurrentProcess()) {
|
||||
RefPtr<StyleSheet> servoSheet;
|
||||
|
||||
rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet);
|
||||
nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(servoSheet);
|
||||
mServoSheets[aSheetType].AppendElement(servoSheet);
|
||||
|
@ -283,9 +280,14 @@ nsStyleSheetService::SheetRegistered(nsIURI *sheetURI,
|
|||
NS_ENSURE_ARG_POINTER(sheetURI);
|
||||
NS_PRECONDITION(_retval, "Null out param");
|
||||
|
||||
// Check to see if we have the Gecko sheet.
|
||||
*_retval = (FindSheetByURI(mozilla::StyleBackendType::Gecko,
|
||||
aSheetType, sheetURI) >= 0);
|
||||
// Check to see if we have the sheet.
|
||||
StyleBackendType backendType =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleBackendType::Gecko;
|
||||
#else
|
||||
StyleBackendType::Servo;
|
||||
#endif
|
||||
*_retval = (FindSheetByURI(backendType, aSheetType, sheetURI) >= 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -378,13 +380,17 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
|||
NS_ENSURE_ARG_POINTER(aSheetURI);
|
||||
|
||||
// We have to search for Gecko and Servo sheets separately.
|
||||
// Gecko first, which should always be present.
|
||||
int32_t foundIndex = FindSheetByURI(StyleBackendType::Gecko,
|
||||
aSheetType, aSheetURI);
|
||||
int32_t foundIndex;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Gecko first, which should always be present, if the old style system
|
||||
// is enabled.
|
||||
foundIndex = FindSheetByURI(StyleBackendType::Gecko, aSheetType, aSheetURI);
|
||||
NS_ENSURE_TRUE(foundIndex >= 0, NS_ERROR_INVALID_ARG);
|
||||
|
||||
RefPtr<StyleSheet> geckoSheet = mGeckoSheets[aSheetType][foundIndex];
|
||||
mGeckoSheets[aSheetType].RemoveElementAt(foundIndex);
|
||||
#endif
|
||||
|
||||
// Now search for Servo, which may or may not be present.
|
||||
RefPtr<StyleSheet> servoSheet;
|
||||
|
@ -399,8 +405,12 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
|||
nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
|
||||
for (nsIPresShell* presShell : toNotify) {
|
||||
if (presShell->StyleSet()) {
|
||||
StyleSheet* sheet = presShell->StyleSet()->IsGecko() ? geckoSheet
|
||||
: servoSheet;
|
||||
StyleSheet* sheet =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
presShell->StyleSet()->IsGecko() ? geckoSheet : servoSheet;
|
||||
#else
|
||||
servoSheet;
|
||||
#endif
|
||||
if (sheet) {
|
||||
presShell->NotifyStyleSheetServiceSheetRemoved(sheet, aSheetType);
|
||||
}
|
||||
|
@ -459,7 +469,12 @@ size_t
|
|||
nsStyleSheetService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
for (auto* sheetArrays : { &mGeckoSheets, &mServoSheets }) {
|
||||
for (auto* sheetArrays : {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
&mGeckoSheets,
|
||||
#endif
|
||||
&mServoSheets,
|
||||
}) {
|
||||
for (auto& sheetArray : *sheetArrays) {
|
||||
n += sheetArray.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (StyleSheet* sheet : sheetArray) {
|
||||
|
|
|
@ -85,11 +85,19 @@ private:
|
|||
|
||||
mozilla::Array<SheetArray, 3>& Sheets(mozilla::StyleBackendType aType)
|
||||
{
|
||||
return aType == mozilla::StyleBackendType::Gecko ? mGeckoSheets
|
||||
: mServoSheets;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (aType == mozilla::StyleBackendType::Gecko) {
|
||||
return mGeckoSheets;
|
||||
}
|
||||
#else
|
||||
MOZ_ASSERT(aType == mozilla::StyleBackendType::Servo);
|
||||
#endif
|
||||
return mServoSheets;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mozilla::Array<SheetArray, 3> mGeckoSheets;
|
||||
#endif
|
||||
mozilla::Array<SheetArray, 3> mServoSheets;
|
||||
|
||||
// Registered PresShells that will be notified when sheets are added and
|
||||
|
|
|
@ -289,7 +289,9 @@ nsLayoutStatics::Initialize()
|
|||
ServiceWorkerRegistrar::Initialize();
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
GeckoStyleContext::Initialize();
|
||||
#endif
|
||||
mozilla::LayerAnimationInfo::Initialize();
|
||||
#endif
|
||||
|
||||
|
@ -349,7 +351,9 @@ nsLayoutStatics::Shutdown()
|
|||
Attr::Shutdown();
|
||||
EventListenerManager::Shutdown();
|
||||
IMEStateManager::Shutdown();
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser::Shutdown();
|
||||
#endif
|
||||
nsMediaFeatures::Shutdown();
|
||||
nsHTMLDNSPrefetch::Shutdown();
|
||||
nsCSSRendering::Shutdown();
|
||||
|
@ -387,7 +391,9 @@ nsLayoutStatics::Shutdown()
|
|||
nsAttrValue::Shutdown();
|
||||
nsContentUtils::Shutdown();
|
||||
nsLayoutStylesheetCache::Shutdown();
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RuleProcessorCache::Shutdown();
|
||||
#endif
|
||||
|
||||
ShutdownJSEnvironment();
|
||||
nsGlobalWindowInner::ShutDown();
|
||||
|
|
|
@ -80,8 +80,10 @@ nsFirstLetterFrame::SetInitialChildList(ChildListID aListID,
|
|||
for (nsIFrame* f : aChildList) {
|
||||
MOZ_ASSERT(f->GetParent() == this, "Unexpected parent");
|
||||
MOZ_ASSERT(f->IsTextFrame(), "We should not have kids that are containers!");
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
MOZ_ASSERT_IF(f->StyleContext()->IsGecko(),
|
||||
f->StyleContext()->AsGecko()->GetParent() == StyleContext());
|
||||
#endif
|
||||
nsLayoutUtils::MarkDescendantsDirty(f); // Drops cached textruns
|
||||
}
|
||||
|
||||
|
|
|
@ -779,6 +779,7 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData)
|
|||
// because what matters is whether the new style (not the old)
|
||||
// specifies CSS transitions.
|
||||
if (presContext->RestyleManager()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// stylo: ServoRestyleManager does not handle transitions yet, and when
|
||||
// it does it probably won't need to track reframed style contexts to
|
||||
// initiate transitions correctly.
|
||||
|
@ -787,6 +788,9 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData)
|
|||
if (rsc) {
|
||||
rsc->Put(mContent, mStyleContext->AsGecko());
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7765,6 +7769,7 @@ nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix, uint32_t aFlags) con
|
|||
pseudoTag->ToString(atomString);
|
||||
aTo += nsPrintfCString("%s", NS_LossyConvertUTF16toASCII(atomString).get());
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (auto* geckoContext = mStyleContext->GetAsGecko()) {
|
||||
if (!geckoContext->GetParent() ||
|
||||
(GetParent() && GetParent()->StyleContext() != geckoContext->GetParent())) {
|
||||
|
@ -7777,6 +7782,7 @@ nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix, uint32_t aFlags) con
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
aTo += "]";
|
||||
}
|
||||
|
|
|
@ -183,7 +183,9 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
|
|||
}
|
||||
|
||||
|
||||
if (auto gecko = styleContext->GetAsGecko()) {
|
||||
if (styleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto gecko = styleContext->AsGecko();
|
||||
nsRuleNode* ruleNode = gecko->RuleNode();
|
||||
if (!ruleNode) {
|
||||
return;
|
||||
|
@ -204,6 +206,9 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
nsIDocument* doc = aElement.OwnerDoc();
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
|
@ -1128,6 +1133,7 @@ InspectorUtils::ParseStyleSheet(GlobalObject& aGlobalObject,
|
|||
const nsAString& aInput,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<CSSStyleSheet> geckoSheet = do_QueryObject(&aSheet);
|
||||
if (geckoSheet) {
|
||||
nsresult rv = geckoSheet->ReparseSheet(aInput);
|
||||
|
@ -1136,6 +1142,7 @@ InspectorUtils::ParseStyleSheet(GlobalObject& aGlobalObject,
|
|||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<ServoStyleSheet> servoSheet = do_QueryObject(&aSheet);
|
||||
if (servoSheet) {
|
||||
|
|
|
@ -174,9 +174,12 @@ static void AddTransformFunctions(const nsCSSValueList* aList,
|
|||
return;
|
||||
}
|
||||
|
||||
GeckoStyleContext* contextIfGecko = aContext
|
||||
? aContext->GetAsGecko()
|
||||
: nullptr;
|
||||
GeckoStyleContext* contextIfGecko =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
aContext ? aContext->GetAsGecko() : nullptr;
|
||||
#else
|
||||
nullptr;
|
||||
#endif
|
||||
|
||||
for (const nsCSSValueList* curr = aList; curr; curr = curr->mNext) {
|
||||
const nsCSSValue& currElem = curr->mValue;
|
||||
|
|
|
@ -69,9 +69,13 @@ CSS::Supports(const GlobalObject& aGlobal,
|
|||
return Servo_CSSSupports2(&property, &value);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
return parser.EvaluateSupportsDeclaration(aProperty, aValue, info.mDocURI,
|
||||
info.mBaseURI, info.mPrincipal);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
|
@ -92,10 +96,15 @@ CSS::Supports(const GlobalObject& aGlobal,
|
|||
return Servo_CSSSupports(&cond);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
return parser.EvaluateSupportsCondition(aCondition, info.mDocURI,
|
||||
info.mBaseURI, info.mPrincipal,
|
||||
css::SupportsParsingSettings::ImpliedParentheses);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ bool
|
||||
CSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey)
|
||||
|
@ -18,6 +19,7 @@ CSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT_UNREACHABLE("should not be called");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* virtual */ JSObject*
|
||||
CSSKeyframesRule::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
|
|
@ -31,8 +31,10 @@ public:
|
|||
virtual void DeleteRule(const nsAString& aKey) = 0;
|
||||
virtual CSSKeyframeRule* FindRule(const nsAString& aKey) = 0;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey) final override;
|
||||
#endif
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
|
||||
|
||||
|
|
|
@ -31,7 +31,11 @@ DeclarationBlock::Clone() const
|
|||
{
|
||||
RefPtr<DeclarationBlock> result;
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
result = new css::Declaration(*AsGecko());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
result = new ServoDeclarationBlock(*AsServo());
|
||||
}
|
||||
|
@ -42,9 +46,11 @@ already_AddRefed<DeclarationBlock>
|
|||
DeclarationBlock::EnsureMutable()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (IsGecko()) {
|
||||
AsGecko()->AssertNotExpanded();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (IsServo() && !IsDirty()) {
|
||||
// In stylo, the old DeclarationBlock is stored in element's rule node tree
|
||||
|
|
|
@ -19,7 +19,8 @@ class nsCSSScanner;
|
|||
class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
class CSSStyleSheet;
|
||||
class ServoStyleSheet;
|
||||
class StyleSheet;
|
||||
|
||||
namespace css {
|
||||
|
||||
|
@ -93,7 +94,7 @@ private:
|
|||
|
||||
#ifndef CSS_REPORT_PARSE_ERRORS
|
||||
inline ErrorReporter::ErrorReporter(const nsCSSScanner&,
|
||||
const CSSStyleSheet*,
|
||||
const StyleSheet*,
|
||||
const Loader*,
|
||||
nsIURI*) {}
|
||||
inline ErrorReporter::~ErrorReporter() {}
|
||||
|
|
|
@ -526,6 +526,7 @@ FontFace::ParseDescriptor(nsCSSFontDesc aDescID,
|
|||
return ServoCSSParser::ParseFontDescriptor(aDescID, aString, url, aResult);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
if (!parser.ParseFontFaceDescriptor(aDescID, aString,
|
||||
docURI, // aSheetURL
|
||||
|
@ -537,6 +538,9 @@ FontFace::ParseDescriptor(nsCSSFontDesc aDescID,
|
|||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -223,6 +223,7 @@ FontFaceSet::ParseFontShorthandForMatching(
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Parse aFont as a 'font' property value.
|
||||
RefPtr<Declaration> declaration = new Declaration;
|
||||
declaration->InitializeEmpty();
|
||||
|
@ -275,6 +276,9 @@ FontFaceSet::ParseFontShorthandForMatching(
|
|||
|
||||
aStretch = data->ValueFor(eCSSProperty_font_stretch)->GetIntValue();
|
||||
aStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -34,7 +34,11 @@ GenericSpecifiedValues::ShouldIgnoreColors() const
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return !AsGecko()->mPresContext->UseDocumentColors();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -77,6 +81,7 @@ GenericSpecifiedValues::SetIdentAtomValueIfUnset(nsCSSPropertyID aId,
|
|||
void
|
||||
GenericSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// there are some static asserts in MOZ_STYLO_FORWARD which
|
||||
// won't work with the overloaded SetKeywordValue function,
|
||||
// so we copy its expansion and use SetIntValue for decltype
|
||||
|
@ -89,11 +94,16 @@ GenericSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
|
|||
!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::SetIntValue),
|
||||
decltype(&MOZ_STYLO_SERVO_TYPE::SetKeywordValue)>::value,
|
||||
"Servo subclass should define its own SetKeywordValue");
|
||||
#endif
|
||||
|
||||
if (IsServo()) {
|
||||
return AsServo()->SetKeywordValue(aId, aValue);
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return AsGecko()->SetKeywordValue(aId, aValue);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,11 +18,19 @@ using namespace mozilla::dom;
|
|||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define CALL_INNER(inner_, call_) \
|
||||
((inner_).is<GeckoGroupRuleRules>() \
|
||||
? (inner_).as<GeckoGroupRuleRules>().call_ \
|
||||
: (inner_).as<ServoGroupRuleRules>().call_)
|
||||
#else
|
||||
#define CALL_INNER(inner_, call_) \
|
||||
((inner_).is<DummyGroupRuleRules>() \
|
||||
? (inner_).as<DummyGroupRuleRules>().call_ \
|
||||
: (inner_).as<ServoGroupRuleRules>().call_)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// -------------------------------
|
||||
// Style Rule List for group rules
|
||||
//
|
||||
|
@ -193,6 +201,7 @@ GeckoGroupRuleRules::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
|||
// - mRuleCollection
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
// -------------------------------
|
||||
// ServoGroupRuleRules
|
||||
|
@ -226,7 +235,11 @@ ServoGroupRuleRules::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
|||
|
||||
GroupRule::GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber)
|
||||
: Rule(aLineNumber, aColumnNumber)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
, mInner(GeckoGroupRuleRules())
|
||||
#else
|
||||
, mInner(DummyGroupRuleRules())
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -296,6 +309,7 @@ GroupRule::SetStyleSheet(StyleSheet* aSheet)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
GroupRule::AppendStyleRule(Rule* aRule)
|
||||
{
|
||||
|
@ -343,6 +357,7 @@ GroupRule::AppendRulesToCssText(nsAString& aCssText) const
|
|||
}
|
||||
aCssText.Append('}');
|
||||
}
|
||||
#endif
|
||||
|
||||
CSSRuleList*
|
||||
GroupRule::CssRules()
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace css {
|
|||
class GroupRule;
|
||||
class GroupRuleRuleList;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
struct GeckoGroupRuleRules
|
||||
{
|
||||
GeckoGroupRuleRules();
|
||||
|
@ -76,6 +77,7 @@ struct GeckoGroupRuleRules
|
|||
IncrementalClearCOMRuleArray mRules;
|
||||
RefPtr<GroupRuleRuleList> mRuleCollection; // lazily constructed
|
||||
};
|
||||
#endif
|
||||
|
||||
struct ServoGroupRuleRules
|
||||
{
|
||||
|
@ -132,12 +134,37 @@ struct ServoGroupRuleRules
|
|||
RefPtr<ServoCSSRuleList> mRuleList;
|
||||
};
|
||||
|
||||
struct DummyGroupRuleRules
|
||||
{
|
||||
void SetParentRule(GroupRule* aParentRule) {}
|
||||
void SetStyleSheet(StyleSheet* aSheet) {}
|
||||
void Clear() {}
|
||||
void Traverse(nsCycleCollectionTraversalCallback& cb) {}
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out, int32_t aIndex) const {}
|
||||
#endif
|
||||
int32_t StyleRuleCount() const { return 0; }
|
||||
Rule* GetStyleRuleAt(int32_t aIndex) const { return nullptr; }
|
||||
nsresult DeleteStyleRuleAt(uint32_t aIndex) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
dom::CSSRuleList* CssRules(GroupRule* aParentRule) { return nullptr; }
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return 0; }
|
||||
};
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define REDIRECT_TO_INNER(call_) \
|
||||
if (mInner.is<GeckoGroupRuleRules>()) { \
|
||||
return mInner.as<GeckoGroupRuleRules>().call_; \
|
||||
} else { \
|
||||
return mInner.as<ServoGroupRuleRules>().call_; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define REDIRECT_TO_INNER(call_) \
|
||||
if (mInner.is<DummyGroupRuleRules>()) { \
|
||||
return mInner.as<DummyGroupRuleRules>().call_; \
|
||||
} else { \
|
||||
return mInner.as<ServoGroupRuleRules>().call_; \
|
||||
}
|
||||
#endif
|
||||
|
||||
// inherits from Rule so it can be shared between
|
||||
// MediaRule and DocumentRule
|
||||
|
@ -163,7 +190,9 @@ public:
|
|||
virtual void SetStyleSheet(StyleSheet* aSheet) override;
|
||||
|
||||
public:
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void AppendStyleRule(Rule* aRule);
|
||||
#endif
|
||||
|
||||
int32_t StyleRuleCount() const {
|
||||
REDIRECT_TO_INNER(StyleRuleCount())
|
||||
|
@ -172,8 +201,10 @@ public:
|
|||
REDIRECT_TO_INNER(GetStyleRuleAt(aIndex))
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
typedef bool (*RuleEnumFunc)(Rule* aElement, void* aData);
|
||||
bool EnumerateRulesForwards(RuleEnumFunc aFunc, void * aData) const;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The next two methods should never be called unless you have first
|
||||
|
@ -183,10 +214,12 @@ public:
|
|||
nsresult DeleteStyleRuleAt(uint32_t aIndex) {
|
||||
REDIRECT_TO_INNER(DeleteStyleRuleAt(aIndex));
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsresult InsertStyleRuleAt(uint32_t aIndex, Rule* aRule);
|
||||
|
||||
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey) = 0;
|
||||
#endif
|
||||
|
||||
// non-virtual -- it is only called by subclasses
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
|
@ -201,6 +234,7 @@ public:
|
|||
void DeleteRule(uint32_t aIndex, ErrorResult& aRv);
|
||||
|
||||
protected:
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void AppendRulesToCssText(nsAString& aCssText) const;
|
||||
|
||||
// Must only be called if this is a Gecko GroupRule.
|
||||
|
@ -210,9 +244,18 @@ protected:
|
|||
const IncrementalClearCOMRuleArray& GeckoRules() const {
|
||||
return mInner.as<GeckoGroupRuleRules>().mRules;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
Variant<GeckoGroupRuleRules, ServoGroupRuleRules> mInner;
|
||||
#else
|
||||
// This only reason for the DummyGroupRuleRules is that ServoKeyframesRule
|
||||
// inherits from CSSKeyframesRules (and thus GroupRule). Once
|
||||
// ServoKeyframesRule can be made to inherit from Rule, the
|
||||
// DummyGroupRuleRules can be removed.
|
||||
Variant<DummyGroupRuleRules, ServoGroupRuleRules> mInner;
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef REDIRECT_TO_INNER
|
||||
|
|
|
@ -1113,7 +1113,11 @@ Loader::CreateSheet(nsIURI* aURI,
|
|||
}
|
||||
|
||||
if (GetStyleBackendType() == StyleBackendType::Gecko) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
*aSheet = new CSSStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
*aSheet = new ServoStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
|
||||
}
|
||||
|
@ -1156,7 +1160,11 @@ Loader::PrepareSheet(StyleSheet* aSheet,
|
|||
aSheet->SetEnabled(!aIsAlternate);
|
||||
|
||||
if (aSheet->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
aSheet->AsGecko()->SetScopeElement(aScopeElement);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
if (aScopeElement) {
|
||||
NS_WARNING("stylo: scoped style sheets not supported");
|
||||
|
@ -1270,7 +1278,11 @@ Loader::InsertChildSheet(StyleSheet* aSheet,
|
|||
// cloned off of top-level sheets which were disabled
|
||||
aSheet->SetEnabled(true);
|
||||
if (aGeckoParentRule) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
aGeckoParentRule->SetSheet(aSheet->AsGecko()); // This sets the ownerRule on the sheet
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
aParentSheet->PrependStyleSheet(aSheet);
|
||||
|
||||
|
@ -1684,12 +1696,16 @@ Loader::ParseSheet(const nsAString& aUTF16,
|
|||
nsresult rv;
|
||||
|
||||
if (aLoadData->mSheet->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
|
||||
rv = parser.ParseSheet(aUTF16,
|
||||
sheetURI,
|
||||
baseURI,
|
||||
aLoadData->mSheet->Principal(),
|
||||
aLoadData->mLineNumber);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
rv = aLoadData->mSheet->AsServo()->ParseSheet(
|
||||
this,
|
||||
|
@ -2198,7 +2214,11 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
|
|||
StyleSheetState state;
|
||||
if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, sheet)) {
|
||||
if (aParentSheet->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
aGeckoParentRule->SetSheet(sheet->AsGecko());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
state = eSheetComplete;
|
||||
} else {
|
||||
|
|
|
@ -81,10 +81,14 @@ MediaList::Create(
|
|||
return mediaList.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
RefPtr<nsMediaList> mediaList = new nsMediaList();
|
||||
parser.ParseMediaList(aMedia, nullptr, 0, mediaList, aCallerType);
|
||||
return mediaList.forget();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#ifndef RuleNodeCacheConditions_h_
|
||||
#define RuleNodeCacheConditions_h_
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -154,4 +156,18 @@ private:
|
|||
|
||||
} // namespace mozilla
|
||||
|
||||
#else
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Define this dummy class so there are fewer call sites to change when the old
|
||||
// style system code is compiled out.
|
||||
class RuleNodeCacheConditions
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(RuleNodeCacheConditions_h_)
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace mozilla {
|
|||
enum Side;
|
||||
struct StyleTransition;
|
||||
namespace css {
|
||||
class ErrorReporter;
|
||||
struct URLValue;
|
||||
struct ImageValue;
|
||||
class LoaderReusableStyleSheets;
|
||||
|
|
|
@ -42,6 +42,7 @@ ServoDocumentRule::Clone() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ bool
|
||||
ServoDocumentRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey)
|
||||
|
@ -51,6 +52,7 @@ ServoDocumentRule::UseForPresentation(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
|
|
|
@ -23,8 +23,10 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
already_AddRefed<css::Rule> Clone() const override;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey) final override;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, int32_t aIndent = 0) const final override;
|
||||
#endif
|
||||
|
|
|
@ -59,6 +59,7 @@ ServoMediaRule::Clone() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ bool
|
||||
ServoMediaRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey)
|
||||
|
@ -68,6 +69,7 @@ ServoMediaRule::UseForPresentation(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* virtual */ void
|
||||
ServoMediaRule::SetStyleSheet(StyleSheet* aSheet)
|
||||
|
|
|
@ -26,8 +26,10 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoMediaRule, dom::CSSMediaRule)
|
||||
|
||||
already_AddRefed<css::Rule> Clone() const override;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey) final override;
|
||||
#endif
|
||||
void SetStyleSheet(StyleSheet* aSheet) override;
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, int32_t aIndent = 0) const final override;
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "nsPrintfCString.h"
|
||||
#include "nsSMILAnimationController.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ ServoSupportsRule::Clone() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ bool
|
||||
ServoSupportsRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey)
|
||||
|
@ -52,6 +53,7 @@ ServoSupportsRule::UseForPresentation(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
|
|
|
@ -23,8 +23,10 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
already_AddRefed<css::Rule> Clone() const override;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey) final override;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void List(FILE* out = stdout, int32_t aIndent = 0) const final override;
|
||||
#endif
|
||||
|
|
|
@ -35,26 +35,41 @@ inline bool IsInServoTraversal()
|
|||
}
|
||||
} // namespace mozilla
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
#if defined(MOZ_STYLO) && defined(MOZ_OLD_STYLE)
|
||||
# define MOZ_DECL_STYLO_CHECK_METHODS \
|
||||
bool IsGecko() const { return !IsServo(); } \
|
||||
bool IsServo() const { return mType == StyleBackendType::Servo; }
|
||||
#elif defined(MOZ_STYLO)
|
||||
# define MOZ_DECL_STYLO_CHECK_METHODS \
|
||||
bool IsGecko() const { return false; } \
|
||||
bool IsServo() const { return true; }
|
||||
#else
|
||||
# define MOZ_DECL_STYLO_CHECK_METHODS \
|
||||
bool IsGecko() const { return true; } \
|
||||
bool IsServo() const { return false; }
|
||||
#endif
|
||||
|
||||
#define MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_) \
|
||||
inline geckotype_* AsGecko(); \
|
||||
#define MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_) \
|
||||
inline servotype_* AsServo(); \
|
||||
inline const geckotype_* AsGecko() const; \
|
||||
inline const servotype_* AsServo() const; \
|
||||
inline geckotype_* GetAsGecko(); \
|
||||
inline servotype_* GetAsServo(); \
|
||||
inline const geckotype_* GetAsGecko() const; \
|
||||
inline const servotype_* GetAsServo() const;
|
||||
|
||||
#define MOZ_DECL_STYLO_CONVERT_METHODS_GECKO(geckotype_) \
|
||||
inline geckotype_* AsGecko(); \
|
||||
inline const geckotype_* AsGecko() const; \
|
||||
inline geckotype_* GetAsGecko(); \
|
||||
inline const geckotype_* GetAsGecko() const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_) \
|
||||
MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_) \
|
||||
MOZ_DECL_STYLO_CONVERT_METHODS_GECKO(geckotype_)
|
||||
#else
|
||||
#define MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_) \
|
||||
MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Macro used in a base class of |geckotype_| and |servotype_|.
|
||||
* The class should define |StyleBackendType mType;| itself.
|
||||
|
@ -63,41 +78,53 @@ inline bool IsInServoTraversal()
|
|||
MOZ_DECL_STYLO_CHECK_METHODS \
|
||||
MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_)
|
||||
|
||||
/**
|
||||
* Macro used in inline header of class |type_| with its Gecko and Servo
|
||||
* subclasses named |geckotype_| and |servotype_| correspondingly for
|
||||
* implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
|
||||
*/
|
||||
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
|
||||
#define MOZ_DEFINE_STYLO_METHODS_GECKO(type_, geckotype_) \
|
||||
geckotype_* type_::AsGecko() { \
|
||||
MOZ_ASSERT(IsGecko()); \
|
||||
return static_cast<geckotype_*>(this); \
|
||||
} \
|
||||
servotype_* type_::AsServo() { \
|
||||
MOZ_ASSERT(IsServo()); \
|
||||
return static_cast<servotype_*>(this); \
|
||||
} \
|
||||
const geckotype_* type_::AsGecko() const { \
|
||||
MOZ_ASSERT(IsGecko()); \
|
||||
return static_cast<const geckotype_*>(this); \
|
||||
} \
|
||||
geckotype_* type_::GetAsGecko() { \
|
||||
return IsGecko() ? AsGecko() : nullptr; \
|
||||
} \
|
||||
const geckotype_* type_::GetAsGecko() const { \
|
||||
return IsGecko() ? AsGecko() : nullptr; \
|
||||
}
|
||||
|
||||
#define MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_) \
|
||||
servotype_* type_::AsServo() { \
|
||||
MOZ_ASSERT(IsServo()); \
|
||||
return static_cast<servotype_*>(this); \
|
||||
} \
|
||||
const servotype_* type_::AsServo() const { \
|
||||
MOZ_ASSERT(IsServo()); \
|
||||
return static_cast<const servotype_*>(this); \
|
||||
} \
|
||||
geckotype_* type_::GetAsGecko() { \
|
||||
return IsGecko() ? AsGecko() : nullptr; \
|
||||
} \
|
||||
servotype_* type_::GetAsServo() { \
|
||||
return IsServo() ? AsServo() : nullptr; \
|
||||
} \
|
||||
const geckotype_* type_::GetAsGecko() const { \
|
||||
return IsGecko() ? AsGecko() : nullptr; \
|
||||
} \
|
||||
const servotype_* type_::GetAsServo() const { \
|
||||
return IsServo() ? AsServo() : nullptr; \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro used in inline header of class |type_| with its Gecko and Servo
|
||||
* subclasses named |geckotype_| and |servotype_| correspondingly for
|
||||
* implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
|
||||
*/
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
|
||||
MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_) \
|
||||
MOZ_DEFINE_STYLO_METHODS_GECKO(type_, geckotype_)
|
||||
#else
|
||||
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
|
||||
MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_)
|
||||
#endif
|
||||
|
||||
#define MOZ_STYLO_THIS_TYPE mozilla::RemovePointer<decltype(this)>::Type
|
||||
#define MOZ_STYLO_GECKO_TYPE mozilla::RemovePointer<decltype(AsGecko())>::Type
|
||||
#define MOZ_STYLO_SERVO_TYPE mozilla::RemovePointer<decltype(AsServo())>::Type
|
||||
|
@ -107,6 +134,7 @@ inline bool IsInServoTraversal()
|
|||
* the Servo or Gecko implementation. The class of the method using it
|
||||
* should use MOZ_DECL_STYLO_METHODS to define basic stylo methods.
|
||||
*/
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define MOZ_STYLO_FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
||||
static_assert(!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::method_), \
|
||||
decltype(&MOZ_STYLO_GECKO_TYPE::method_)> \
|
||||
|
@ -118,6 +146,10 @@ inline bool IsInServoTraversal()
|
|||
return AsServo()->method_ servoargs_; \
|
||||
} \
|
||||
return AsGecko()->method_ geckoargs_;
|
||||
#else
|
||||
#define MOZ_STYLO_FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
||||
return AsServo()->method_ servoargs_;
|
||||
#endif
|
||||
|
||||
#define MOZ_STYLO_FORWARD(method_, args_) \
|
||||
MOZ_STYLO_FORWARD_CONCRETE(method_, args_, args_)
|
||||
|
|
|
@ -324,6 +324,7 @@ ToPrimitive(nsCSSValue::Array* aArray)
|
|||
return arr.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static void
|
||||
AppendCSSShadowValue(const nsCSSShadowItem *aShadow,
|
||||
nsCSSValueList **&aResultTail,
|
||||
|
@ -351,6 +352,7 @@ AppendCSSShadowValue(const nsCSSShadowItem *aShadow,
|
|||
*aResultTail = resultItem;
|
||||
aResultTail = &resultItem->mNext;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Like nsStyleCoord::CalcValue, but with length in float pixels instead
|
||||
// of nscoord.
|
||||
|
@ -433,11 +435,13 @@ ExtractCalcValue(const nsCSSValue& aValue)
|
|||
return ExtractCalcValueInternal(aValue);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static void
|
||||
CalcValueToCSSValue(const nsStyleCoord::CalcValue* aCalc, nsCSSValue& aValue)
|
||||
{
|
||||
aValue.SetCalcValue(aCalc);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
CalcValueToCSSValue(const PixelCalcValue& aCalc, nsCSSValue& aValue)
|
||||
|
@ -884,6 +888,7 @@ AddWeightedFilterFunction(double aCoeff1, const nsCSSValueList* aList1,
|
|||
static inline float
|
||||
GetNumberOrPercent(const nsCSSValue &aValue);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
ComputeSingleShadowSquareDistance(const nsCSSValueList* aShadow1,
|
||||
const nsCSSValueList* aShadow2,
|
||||
|
@ -1072,6 +1077,7 @@ ComputeFilterListDistance(const nsCSSValueList* aList1,
|
|||
aDistance = sqrt(squareDistance);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
enum class Restrictions {
|
||||
Enable,
|
||||
|
@ -1084,6 +1090,7 @@ AddShapeFunction(nsCSSPropertyID aProperty,
|
|||
double aCoeff2, const nsCSSValue::Array* aArray2,
|
||||
Restrictions aRestriction = Restrictions::Enable);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
ComputeShapeDistance(nsCSSPropertyID aProperty,
|
||||
const nsCSSValue::Array* aArray1,
|
||||
|
@ -1160,12 +1167,14 @@ ComputeShapeDistance(nsCSSPropertyID aProperty,
|
|||
aDistance = sqrt(squareDistance);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static nsCSSValueList*
|
||||
AddTransformLists(double aCoeff1, const nsCSSValueList* aList1,
|
||||
double aCoeff2, const nsCSSValueList* aList2,
|
||||
nsCSSKeyword aOperatorType = eCSSKeyword_interpolatematrix);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static double
|
||||
ComputeTransform2DMatrixDistance(const Matrix& aMatrix1,
|
||||
const Matrix& aMatrix2)
|
||||
|
@ -1952,6 +1961,7 @@ StyleAnimationValue::ComputeDistance(nsCSSPropertyID aProperty,
|
|||
MOZ_ASSERT(false, "Can't compute distance using the given common unit");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
AddCSSValueNumber(double aCoeff1, const nsCSSValue &aValue1,
|
||||
|
@ -3410,6 +3420,7 @@ StyleAnimationValue::Accumulate(nsCSSPropertyID aProperty,
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
already_AddRefed<css::StyleRule>
|
||||
BuildStyleRule(nsCSSPropertyID aProperty,
|
||||
dom::Element* aTargetElement,
|
||||
|
@ -3681,6 +3692,7 @@ StyleAnimationValue::ComputeValues(
|
|||
aSpecifiedValue, aUseSVGMode,
|
||||
aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty,
|
||||
|
@ -3867,6 +3879,7 @@ StyleDataAtOffset(const void* aStyleStruct, ptrdiff_t aOffset)
|
|||
reinterpret_cast<const uint8_t*>(aStyleStruct) + aOffset);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
StyleCoordToValue(const nsStyleCoord& aCoord, StyleAnimationValue& aValue)
|
||||
{
|
||||
|
@ -4894,6 +4907,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
Size
|
||||
StyleAnimationValue::GetScaleValue(const nsIFrame* aForFrame) const
|
||||
|
@ -5438,6 +5452,7 @@ AnimationValue::ComputeDistance(nsCSSPropertyID aProperty,
|
|||
: distance;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return StyleAnimationValue::ComputeDistance(aProperty,
|
||||
mGecko,
|
||||
aOther.mGecko,
|
||||
|
@ -5445,6 +5460,9 @@ AnimationValue::ComputeDistance(nsCSSPropertyID aProperty,
|
|||
distance)
|
||||
? distance
|
||||
: 0.0;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* static */ AnimationValue
|
||||
|
@ -5493,6 +5511,7 @@ AnimationValue::FromString(nsCSSPropertyID aProperty,
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!StyleAnimationValue::ComputeValue(aProperty, aElement,
|
||||
styleContext->AsGecko(),
|
||||
aValue, false /* |aUseSVGMode| */,
|
||||
|
@ -5500,6 +5519,9 @@ AnimationValue::FromString(nsCSSPropertyID aProperty,
|
|||
MOZ_ASSERT(result.IsNull());
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* static */ AnimationValue
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
static double ComputeColorDistance(const css::RGBAColorData& aStartColor,
|
||||
const css::RGBAColorData& aEndColor);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Calculates a measure of 'distance' between two values.
|
||||
*
|
||||
|
@ -114,6 +115,7 @@ public:
|
|||
const StyleAnimationValue& aEndValue,
|
||||
GeckoStyleContext* aStyleContext,
|
||||
double& aDistance);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Calculates an interpolated value that is the specified |aPortion| between
|
||||
|
@ -175,6 +177,7 @@ public:
|
|||
|
||||
// Type-conversion methods
|
||||
// -----------------------
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Creates a computed value for the given specified value
|
||||
* (property ID + string). A style context is needed in case the
|
||||
|
@ -245,6 +248,7 @@ public:
|
|||
const nsCSSValue& aSpecifiedValue,
|
||||
bool aUseSVGMode,
|
||||
nsTArray<PropertyStyleAnimationValuePair>& aResult);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates a specified value for the given computed value.
|
||||
|
@ -276,6 +280,7 @@ public:
|
|||
const StyleAnimationValue& aComputedValue,
|
||||
nsAString& aSpecifiedValue);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Gets the computed value for the given property from the given style
|
||||
* context.
|
||||
|
@ -294,6 +299,7 @@ public:
|
|||
nsCSSPropertyID aProperty,
|
||||
mozilla::GeckoStyleContext* aStyleContext,
|
||||
StyleAnimationValue& aComputedValue);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The types and values for the values that we extract and animate.
|
||||
|
|
|
@ -359,11 +359,13 @@ public:
|
|||
|
||||
int32_t GetType() const override;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
CSSStyleSheet* GetStyleSheet() const
|
||||
{
|
||||
StyleSheet* sheet = Rule::GetStyleSheet();
|
||||
return sheet ? sheet->AsGecko() : nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<Rule> Clone() const override;
|
||||
|
||||
|
|
|
@ -61,7 +61,15 @@ public:
|
|||
public:
|
||||
friend class ::mozilla::StyleSetHandle;
|
||||
|
||||
bool IsGecko() const { return !IsServo(); }
|
||||
bool IsGecko() const
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return !IsServo();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsServo() const
|
||||
{
|
||||
MOZ_ASSERT(mValue, "StyleSetHandle null pointer dereference");
|
||||
|
@ -78,11 +86,13 @@ public:
|
|||
StyleBackendType::Servo;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet* AsGecko()
|
||||
{
|
||||
MOZ_ASSERT(IsGecko());
|
||||
return reinterpret_cast<nsStyleSet*>(mValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
ServoStyleSet* AsServo()
|
||||
{
|
||||
|
@ -90,13 +100,17 @@ public:
|
|||
return reinterpret_cast<ServoStyleSet*>(mValue & ~SERVO_BIT);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet* GetAsGecko() { return IsGecko() ? AsGecko() : nullptr; }
|
||||
#endif
|
||||
ServoStyleSet* GetAsServo() { return IsServo() ? AsServo() : nullptr; }
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const nsStyleSet* AsGecko() const
|
||||
{
|
||||
return const_cast<Ptr*>(this)->AsGecko();
|
||||
}
|
||||
#endif
|
||||
|
||||
const ServoStyleSet* AsServo() const
|
||||
{
|
||||
|
@ -104,7 +118,9 @@ public:
|
|||
return const_cast<Ptr*>(this)->AsServo();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const nsStyleSet* GetAsGecko() const { return IsGecko() ? AsGecko() : nullptr; }
|
||||
#endif
|
||||
const ServoStyleSet* GetAsServo() const { return IsServo() ? AsServo() : nullptr; }
|
||||
|
||||
// These inline methods are defined in StyleSetHandleInlines.h.
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|
||||
#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
||||
if (IsGecko()) { \
|
||||
return AsGecko()->method_ geckoargs_; \
|
||||
|
@ -27,6 +29,17 @@
|
|||
return AsServo()->method_ args_; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
|
||||
return AsServo()->method_ servoargs_;
|
||||
|
||||
#define FORWARD_WITH_PARENT(method_, parent_, args_) \
|
||||
auto* parent = parent_ ? parent_->AsServo() : nullptr; \
|
||||
return AsServo()->method_ args_;
|
||||
|
||||
#endif
|
||||
|
||||
#define FORWARD(method_, args_) FORWARD_CONCRETE(method_, args_, args_)
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -36,10 +49,14 @@ StyleSetHandle::Ptr::Delete()
|
|||
{
|
||||
if (mValue) {
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
delete AsGecko();
|
||||
} else {
|
||||
delete AsServo();
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
delete AsServo();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,13 +118,17 @@ StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
|
|||
TreeMatchContext* aTreeMatchContext)
|
||||
{
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
MOZ_ASSERT(aTreeMatchContext);
|
||||
auto* parent = aParentContext ? aParentContext->AsGecko() : nullptr;
|
||||
return AsGecko()->ResolveStyleFor(aElement, parent, aMayCompute, *aTreeMatchContext);
|
||||
} else {
|
||||
auto* parent = aParentContext ? aParentContext->AsServo() : nullptr;
|
||||
return AsServo()->ResolveStyleFor(aElement, parent, aMayCompute);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
auto* parent = aParentContext ? aParentContext->AsServo() : nullptr;
|
||||
return AsServo()->ResolveStyleFor(aElement, parent, aMayCompute);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
|
@ -190,18 +211,22 @@ StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
|
|||
const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
|
||||
{
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aNewSheets.Length());
|
||||
for (auto& sheet : aNewSheets) {
|
||||
newSheets.AppendElement(sheet->AsGecko());
|
||||
}
|
||||
return AsGecko()->ReplaceSheets(aType, newSheets);
|
||||
} else {
|
||||
nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
|
||||
for (auto& sheet : aNewSheets) {
|
||||
newSheets.AppendElement(sheet->AsServo());
|
||||
}
|
||||
return AsServo()->ReplaceSheets(aType, newSheets);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
|
||||
for (auto& sheet : aNewSheets) {
|
||||
newSheets.AppendElement(sheet->AsServo());
|
||||
}
|
||||
return AsServo()->ReplaceSheets(aType, newSheets);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -315,11 +340,16 @@ StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
|
|||
TreeMatchContext* aTreeMatchContext)
|
||||
{
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
MOZ_ASSERT(aTreeMatchContext);
|
||||
auto* parent = aParentContext ? aParentContext->AsGecko() : nullptr;
|
||||
return AsGecko()->ProbePseudoElementStyle(aParentElement, aType, parent,
|
||||
*aTreeMatchContext);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
auto* parent = aParentContext ? aParentContext->AsServo() : nullptr;
|
||||
return AsServo()->ProbePseudoElementStyle(aParentElement, aType, parent);
|
||||
}
|
||||
|
@ -328,20 +358,30 @@ void
|
|||
StyleSetHandle::Ptr::RootStyleContextAdded()
|
||||
{
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
AsGecko()->RootStyleContextAdded();
|
||||
} else {
|
||||
// Not needed.
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
void
|
||||
StyleSetHandle::Ptr::RootStyleContextRemoved()
|
||||
{
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
AsGecko()->RootStyleContextRemoved();
|
||||
} else {
|
||||
// Not needed.
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -76,7 +76,11 @@ StyleSheet::LastRelease()
|
|||
|
||||
UnparentChildren();
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
AsGecko()->LastRelease();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
AsServo()->LastRelease();
|
||||
}
|
||||
|
@ -408,14 +412,18 @@ StyleSheet::EnsureUniqueInner()
|
|||
mInner->RemoveSheet(this);
|
||||
mInner = clone;
|
||||
|
||||
if (CSSStyleSheet* geckoSheet = GetAsGecko()) {
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Ensure we're using the new rules.
|
||||
//
|
||||
// NOTE: In Servo, all kind of changes that change the set of selectors or
|
||||
// rules we match are covered by the PresShell notifications. In Gecko
|
||||
// that's true too, but this is probably needed because selectors are not
|
||||
// refcounted and can become stale.
|
||||
geckoSheet->ClearRuleCascades();
|
||||
AsGecko()->ClearRuleCascades();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
// Fixup the child lists and parent links in the Servo sheet. This is done
|
||||
// here instead of in StyleSheetInner::CloneFor, because it's just more
|
||||
|
@ -441,11 +449,19 @@ StyleSheet::AppendAllChildSheets(nsTArray<StyleSheet*>& aArray)
|
|||
|
||||
// WebIDL CSSStyleSheet API
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define FORWARD_INTERNAL(method_, args_) \
|
||||
if (IsServo()) { \
|
||||
return AsServo()->method_ args_; \
|
||||
} \
|
||||
return AsGecko()->method_ args_;
|
||||
#else
|
||||
#define FORWARD_INTERNAL(method_, args_) \
|
||||
if (IsServo()) { \
|
||||
return AsServo()->method_ args_; \
|
||||
} \
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
|
||||
dom::CSSRuleList*
|
||||
StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
|
||||
|
@ -608,7 +624,11 @@ StyleSheet::InsertRuleIntoGroup(const nsAString& aRule,
|
|||
|
||||
nsresult result;
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
result = AsGecko()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
result = AsServo()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
|
||||
}
|
||||
|
|
|
@ -345,6 +345,7 @@ PopExistingAnimation(const nsAtom* aName,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
class ResolvedStyleCache {
|
||||
public:
|
||||
ResolvedStyleCache() : mCache() {}
|
||||
|
@ -389,6 +390,7 @@ ResolvedStyleCache::Get(nsPresContext* aPresContext,
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
class MOZ_STACK_CLASS ServoCSSAnimationBuilder final {
|
||||
public:
|
||||
|
@ -441,7 +443,7 @@ public:
|
|||
// post the required restyles.
|
||||
void NotifyNewOrRemovedAnimation(const Animation& aAnimation)
|
||||
{
|
||||
AnimationEffectReadOnly* effect = aAnimation.GetEffect();
|
||||
dom::AnimationEffectReadOnly* effect = aAnimation.GetEffect();
|
||||
if (!effect) {
|
||||
return;
|
||||
}
|
||||
|
@ -458,6 +460,7 @@ private:
|
|||
const ServoStyleContext* mStyleContext;
|
||||
};
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
class MOZ_STACK_CLASS GeckoCSSAnimationBuilder final {
|
||||
public:
|
||||
GeckoCSSAnimationBuilder(GeckoStyleContext* aStyleContext,
|
||||
|
@ -508,6 +511,7 @@ private:
|
|||
|
||||
static Maybe<ComputedTimingFunction>
|
||||
ConvertTimingFunction(const nsTimingFunction& aTimingFunction);
|
||||
#endif
|
||||
|
||||
template<class BuilderType>
|
||||
static void
|
||||
|
@ -645,6 +649,7 @@ BuildAnimation(nsPresContext* aPresContext,
|
|||
return animation.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool
|
||||
GeckoCSSAnimationBuilder::BuildKeyframes(nsPresContext* aPresContext,
|
||||
nsAtom* aName,
|
||||
|
@ -990,6 +995,7 @@ GeckoCSSAnimationBuilder::FillInMissingKeyframeValues(
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class BuilderType>
|
||||
static nsAnimationManager::OwningCSSAnimationPtrArray
|
||||
|
@ -1027,6 +1033,7 @@ BuildAnimations(nsPresContext* aPresContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsAnimationManager::UpdateAnimations(GeckoStyleContext* aStyleContext,
|
||||
mozilla::dom::Element* aElement)
|
||||
|
@ -1048,6 +1055,7 @@ nsAnimationManager::UpdateAnimations(GeckoStyleContext* aStyleContext,
|
|||
const nsStyleDisplay* disp = aStyleContext->StyleDisplay();
|
||||
DoUpdateAnimations(target, *disp, builder);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsAnimationManager::UpdateAnimations(
|
||||
|
|
|
@ -290,6 +290,7 @@ public:
|
|||
typedef nsTArray<RefPtr<mozilla::dom::CSSAnimation>>
|
||||
OwningCSSAnimationPtrArray;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Update the set of animations on |aElement| based on |aStyleContext|.
|
||||
* If necessary, this will notify the corresponding EffectCompositor so
|
||||
|
@ -300,6 +301,7 @@ public:
|
|||
*/
|
||||
void UpdateAnimations(mozilla::GeckoStyleContext* aStyleContext,
|
||||
mozilla::dom::Element* aElement);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function does the same thing as the above UpdateAnimations()
|
||||
|
|
|
@ -130,8 +130,12 @@ nsCSSCounterStyleRule::SetName(const nsAString& aName)
|
|||
if (!doc || doc->IsStyledByServo()) {
|
||||
name = ServoCSSParser::ParseCounterStyleName(aName);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
name = parser.ParseCounterStyleName(aName, nullptr);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (name) {
|
||||
|
@ -412,11 +416,15 @@ nsCSSCounterStyleRule::SetDescriptor(nsCSSCounterDesc aDescID,
|
|||
ok = ServoCSSParser::ParseCounterStyleDescriptor(aDescID, aValue, data,
|
||||
value);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser parser;
|
||||
nsIURI* baseURL = sheet ? sheet->GetBaseURI() : nullptr;
|
||||
nsIPrincipal* principal = sheet ? sheet->Principal() : nullptr;
|
||||
ok = parser.ParseCounterDescriptor(aDescID, aValue, nullptr,
|
||||
baseURL, principal, value);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ok && CheckDescValue(GetSystem(), aDescID, value)) {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef nsCSSParser_h___
|
||||
#define nsCSSParser_h___
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
|
||||
|
@ -349,4 +351,22 @@ protected:
|
|||
void* mImpl;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
class Loader;
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
// Define this dummy class so there are fewer call sites to change when the old
|
||||
// style system code is compiled out.
|
||||
class nsCSSParser
|
||||
{
|
||||
public:
|
||||
explicit nsCSSParser(mozilla::css::Loader* aLoader = nullptr) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* nsCSSParser_h___ */
|
||||
|
|
|
@ -104,6 +104,7 @@ GetBackgroundList(T nsStyleImageLayers::Layer::* aMember,
|
|||
return valueList.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Whether there is any pending restyle for the element or any of its ancestors.
|
||||
static bool
|
||||
ContentNeedsRestyle(nsIContent* aContent)
|
||||
|
@ -131,6 +132,7 @@ ContentNeedsRestyle(nsIContent* aContent)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Whether aDocument needs to restyle for aElement
|
||||
static bool
|
||||
|
@ -185,6 +187,7 @@ DocumentNeedsRestyle(
|
|||
return restyleManager->HasPendingRestyleAncestor(aElement);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// For Gecko, first check if there is any pending restyle, then we check if
|
||||
// any ancestor has dirty bits for restyle.
|
||||
GeckoRestyleManager* restyleManager =
|
||||
|
@ -195,6 +198,9 @@ DocumentNeedsRestyle(
|
|||
}
|
||||
|
||||
return ContentNeedsRestyle(aElement);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -448,9 +454,15 @@ nsComputedDOMStyle::Length()
|
|||
// properties.
|
||||
UpdateCurrentStyleSources(false);
|
||||
if (mStyleContext) {
|
||||
length += mStyleContext->IsServo()
|
||||
? Servo_GetCustomPropertiesCount(mStyleContext->AsServo())
|
||||
: StyleVariables()->mVariables.Count();
|
||||
if (mStyleContext->IsServo()) {
|
||||
length += Servo_GetCustomPropertiesCount(mStyleContext->AsServo());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
length += StyleVariables()->mVariables.Count();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
ClearCurrentStyleSources();
|
||||
|
@ -511,6 +523,7 @@ nsComputedDOMStyle::GetStyleContext(Element* aElement,
|
|||
return GetStyleContextNoFlush(aElement, aPseudo, presShell, aStyleType);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
namespace {
|
||||
class MOZ_STACK_CLASS StyleResolver final
|
||||
{
|
||||
|
@ -629,6 +642,7 @@ private:
|
|||
nsComputedDOMStyle::AnimationFlag mAnimationFlag;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The following function checks whether we need to explicitly resolve the style
|
||||
|
@ -651,8 +665,12 @@ MustReresolveStyle(const nsStyleContext* aContext)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return aContext->AsGecko()->GetParent() &&
|
||||
aContext->AsGecko()->GetParent()->HasPseudoElementData();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -735,10 +753,14 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
|
|||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
MOZ_ASSERT(presContext, "Should have a prescontext if we have a frame");
|
||||
if (presContext && presContext->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet* styleSet = presContext->StyleSet()->AsGecko();
|
||||
return styleSet->ResolveStyleByRemovingAnimation(
|
||||
aElement, result->AsGecko(),
|
||||
eRestyle_AllHintsWithAnimations);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
Element* elementOrPseudoElement =
|
||||
EffectCompositor::GetElementToRestyle(aElement, pseudoType);
|
||||
|
@ -790,6 +812,7 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
|
|||
result);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<GeckoStyleContext> parentContext;
|
||||
nsIContent* parent = aPseudo ? aElement : aElement->GetParent();
|
||||
// Don't resolve parent context for document fragments.
|
||||
|
@ -815,6 +838,9 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
|
|||
aElement, pseudoType,
|
||||
parentContext,
|
||||
inDocWithShell);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsMargin
|
||||
|
@ -1028,6 +1054,7 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
|
|||
if (!mStyleContext || MustReresolveStyle(mStyleContext)) {
|
||||
#ifdef DEBUG
|
||||
if (mStyleContext && mStyleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// We want to check that going through this path because of
|
||||
// HasPseudoElementData is rare, because it slows us down a good
|
||||
// bit. So check that we're really inside something associated
|
||||
|
@ -1047,6 +1074,9 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
|
|||
NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(pseudo) ||
|
||||
mContent->IsNativeAnonymous(),
|
||||
NS_LossyConvertUTF16toASCII(assertMsg).get());
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
// Need to resolve a style context
|
||||
|
@ -1076,6 +1106,7 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
|
|||
}
|
||||
|
||||
if (mAnimationFlag == eWithoutAnimation) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// We will support Servo in bug 1311257.
|
||||
MOZ_ASSERT(mPresShell->StyleSet()->IsGecko(),
|
||||
"eWithoutAnimationRules support Gecko only");
|
||||
|
@ -1085,6 +1116,9 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
|
|||
mContent->AsElement(), mStyleContext->AsGecko(),
|
||||
eRestyle_AllHintsWithAnimations);
|
||||
SetResolvedStyleContext(Move(unanimatedStyleContext), currentGeneration);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// mExposeVisitedStyle is set to true only by testing APIs that
|
||||
|
@ -1226,13 +1260,22 @@ nsComputedDOMStyle::IndexedGetter(uint32_t aIndex,
|
|||
|
||||
bool isServo = mStyleContext->IsServo();
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const nsStyleVariables* variables = isServo
|
||||
? nullptr
|
||||
: StyleVariables();
|
||||
#endif
|
||||
|
||||
const uint32_t count = isServo
|
||||
? Servo_GetCustomPropertiesCount(mStyleContext->AsServo())
|
||||
: variables->mVariables.Count();
|
||||
uint32_t count;
|
||||
if (isServo) {
|
||||
count = Servo_GetCustomPropertiesCount(mStyleContext->AsServo());
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
count = variables->mVariables.Count();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
const uint32_t index = aIndex - length;
|
||||
if (index < count) {
|
||||
|
@ -1241,7 +1284,11 @@ nsComputedDOMStyle::IndexedGetter(uint32_t aIndex,
|
|||
if (isServo) {
|
||||
Servo_GetCustomPropertyNameAt(mStyleContext->AsServo(), index, &varName);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
variables->mVariables.GetVariableAt(index, varName);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
aPropName.AssignLiteral("--");
|
||||
aPropName.Append(varName);
|
||||
|
@ -7287,9 +7334,17 @@ nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
|
|||
nsString variableValue;
|
||||
const nsAString& name = Substring(aPropertyName,
|
||||
CSS_CUSTOM_NAME_PREFIX_LENGTH);
|
||||
bool present = mStyleContext->IsServo()
|
||||
? Servo_GetCustomPropertyValue(mStyleContext->AsServo(), &name, &variableValue)
|
||||
: StyleVariables()->mVariables.Get(name, variableValue);
|
||||
bool present;
|
||||
if (mStyleContext->IsServo()) {
|
||||
present = Servo_GetCustomPropertyValue(mStyleContext->AsServo(), &name,
|
||||
&variableValue);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
present = StyleVariables()->mVariables.Get(name, variableValue);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
if (!present) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -144,8 +144,12 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
|
|||
if (mElement->IsStyledByServo()) {
|
||||
decl = new ServoDeclarationBlock();
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
decl = new css::Declaration();
|
||||
decl->AsGecko()->InitializeEmpty();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// this *can* fail (inside SetAttrAndNotify, at least).
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче