mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1447358: Unifdef the old style system code. r=jwatt
Summary: This has been automatically generated using: http://dotat.at/prog/unifdef/ And: find $OBJDIR -type f -name '*.h' | while read FILE; do echo "$FILE" unifdef -m -DMOZ_STYLO -UMOZ_OLD_STYLE "$FILE"; done find $OBJDIR -type f -name '*.cpp' | while read FILE; do echo "$FILE" unifdef -m -DMOZ_STYLO -UMOZ_OLD_STYLE "$FILE"; done MozReview-Commit-ID: I4NdKqbMXzJ Reviewers: jwatt Bug #: 1447358 Differential Revision: https://phabricator.services.mozilla.com/D779
This commit is contained in:
parent
fc0283f66c
commit
f7522ae728
@ -1657,13 +1657,6 @@ 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
|
||||
|
@ -18,9 +18,6 @@
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoStyleContext.h"
|
||||
#endif
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/RestyleManagerInlines.h"
|
||||
@ -36,10 +33,6 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresShellInlines.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
|
||||
#include "nsRuleProcessorData.h" // For ElementRuleProcessorData etc.
|
||||
#endif
|
||||
#include "nsStyleContextInlines.h"
|
||||
#include "nsTArray.h"
|
||||
#include "PendingAnimationTracker.h"
|
||||
@ -415,81 +408,6 @@ EffectCompositor::UpdateEffectProperties(StyleType* aStyleType,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
// First update cascade results since that may cause some elements to
|
||||
// be marked as needing a restyle.
|
||||
MaybeUpdateCascadeResults(StyleBackendType::Gecko,
|
||||
aElement, aPseudoType,
|
||||
aStyleContext);
|
||||
|
||||
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
|
||||
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
|
||||
|
||||
if (!elementsToRestyle.Contains(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ComposeAnimationRule(aElement, aPseudoType, aCascadeLevel);
|
||||
|
||||
elementsToRestyle.Remove(key);
|
||||
}
|
||||
|
||||
nsIStyleRule*
|
||||
EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
// NOTE: We need to be careful about early returns in this method where
|
||||
// we *don't* update mElementsToRestyle. When we get a call to
|
||||
// RequestRestyle that results in a call to PostRestyleForAnimation, we
|
||||
// will set a bool flag in mElementsToRestyle indicating that we've
|
||||
// called PostRestyleForAnimation so we don't need to call it again
|
||||
// until that restyle happens. During that restyle, if we arrive here
|
||||
// and *don't* update mElementsToRestyle we'll continue to skip calling
|
||||
// PostRestyleForAnimation from RequestRestyle.
|
||||
|
||||
if (!mPresContext || !mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
|
||||
"stylo: Servo-backed style system should not be using "
|
||||
"EffectCompositor");
|
||||
if (mPresContext->RestyleManager()->AsGecko()->SkipAnimationRules()) {
|
||||
// We don't need to worry about updating mElementsToRestyle in this case
|
||||
// since this is not the animation restyle we requested when we called
|
||||
// PostRestyleForAnimation (see comment at start of this method).
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeUpdateAnimationRule(aElement, aPseudoType, aCascadeLevel, aStyleContext);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
|
||||
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
|
||||
MOZ_ASSERT(!elementsToRestyle.Contains(key),
|
||||
"Element should no longer require a restyle after its "
|
||||
"animation rule has been updated");
|
||||
}
|
||||
#endif
|
||||
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effectSet) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return effectSet->AnimationRule(aCascadeLevel);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
class EffectCompositeOrderComparator {
|
||||
@ -590,73 +508,6 @@ EffectCompositor::HasPendingStyleUpdates() const
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool
|
||||
EffectCompositor::HasThrottledStyleUpdates() const
|
||||
{
|
||||
for (auto& elementSet : mElementsToRestyle) {
|
||||
for (auto iter = elementSet.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
if (!iter.Data()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
|
||||
{
|
||||
if (!mPresContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < kCascadeLevelCount; i++) {
|
||||
CascadeLevel cascadeLevel = CascadeLevel(i);
|
||||
auto& elementSet = mElementsToRestyle[cascadeLevel];
|
||||
|
||||
// Copy the list of elements to restyle to a separate array that we can
|
||||
// iterate over. This is because we need to call MaybeUpdateCascadeResults
|
||||
// on each element, but doing that can mutate elementSet. In this case
|
||||
// it will only mutate the bool value associated with each element in the
|
||||
// set but even doing that will cause assertions in PLDHashTable to fail
|
||||
// if we are iterating over the hashtable at the same time.
|
||||
nsTArray<PseudoElementHashEntry::KeyType> elementsToRestyle(
|
||||
elementSet.Count());
|
||||
for (auto iter = elementSet.Iter(); !iter.Done(); iter.Next()) {
|
||||
// Skip animations on elements that have been orphaned since they
|
||||
// requested a restyle.
|
||||
if (iter.Key().mElement->IsInComposedDoc()) {
|
||||
elementsToRestyle.AppendElement(iter.Key());
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& pseudoElem : elementsToRestyle) {
|
||||
MaybeUpdateCascadeResults(StyleBackendType::Gecko,
|
||||
pseudoElem.mElement,
|
||||
pseudoElem.mPseudoType,
|
||||
nullptr);
|
||||
|
||||
ComposeAnimationRule(pseudoElem.mElement,
|
||||
pseudoElem.mPseudoType,
|
||||
cascadeLevel);
|
||||
|
||||
dom::Element* elementToRestyle =
|
||||
GetElementToRestyle(pseudoElem.mElement, pseudoElem.mPseudoType);
|
||||
if (elementToRestyle) {
|
||||
nsRestyleHint rshint = cascadeLevel == CascadeLevel::Transitions ?
|
||||
eRestyle_CSSTransitions :
|
||||
eRestyle_CSSAnimations;
|
||||
aTracker.AddPendingRestyle(elementToRestyle, rshint, nsChangeHint(0));
|
||||
}
|
||||
}
|
||||
|
||||
elementSet.Clear();
|
||||
// Note: mElement pointers in elementsToRestyle might now dangle
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ bool
|
||||
EffectCompositor::HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
@ -749,47 +600,6 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* static */ void
|
||||
EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel)
|
||||
{
|
||||
EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effects) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The caller is responsible for calling MaybeUpdateCascadeResults first.
|
||||
MOZ_ASSERT(!effects->CascadeNeedsUpdate(),
|
||||
"Animation cascade out of date when composing animation rule");
|
||||
|
||||
// Get a list of effects sorted by composite order.
|
||||
nsTArray<KeyframeEffectReadOnly*> sortedEffectList(effects->Count());
|
||||
for (KeyframeEffectReadOnly* effect : *effects) {
|
||||
sortedEffectList.AppendElement(effect);
|
||||
}
|
||||
sortedEffectList.Sort(EffectCompositeOrderComparator());
|
||||
|
||||
RefPtr<AnimValuesStyleRule>& animRule = effects->AnimationRule(aCascadeLevel);
|
||||
animRule = nullptr;
|
||||
|
||||
// If multiple animations affect the same property, animations with higher
|
||||
// composite order (priority) override or add or animations with lower
|
||||
// priority except properties in propertiesToSkip.
|
||||
const nsCSSPropertyIDSet& propertiesToSkip =
|
||||
aCascadeLevel == CascadeLevel::Animations
|
||||
? effects->PropertiesForAnimationsLevel().Inverse()
|
||||
: effects->PropertiesForAnimationsLevel();
|
||||
for (KeyframeEffectReadOnly* effect : sortedEffectList) {
|
||||
effect->GetAnimation()->WillComposeStyle();
|
||||
effect->GetAnimation()->ComposeStyle(animRule, propertiesToSkip);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(effects == EffectSet::GetEffectSet(aElement, aPseudoType),
|
||||
"EffectSet should not change while composing style");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */ nsCSSPropertyIDSet
|
||||
EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
||||
@ -806,20 +616,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) {
|
||||
aStyleContext = frame->StyleContext();
|
||||
}
|
||||
}
|
||||
|
||||
if (!aStyleContext) {
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else if (aBackendType == StyleBackendType::Servo && !elementToRestyle) {
|
||||
return result;
|
||||
}
|
||||
@ -855,13 +652,7 @@ 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:
|
||||
@ -1237,122 +1028,6 @@ EffectCompositor::PreTraverse(dom::Element* aElement,
|
||||
return found;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// ---------------------------------------------------------
|
||||
//
|
||||
// Nested class: AnimationStyleRuleProcessor
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS(EffectCompositor::AnimationStyleRuleProcessor,
|
||||
nsIStyleRuleProcessor)
|
||||
|
||||
nsRestyleHint
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasStateDependentStyle(
|
||||
StateRuleProcessorData* aData)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasStateDependentStyle(
|
||||
PseudoElementStateRuleProcessorData* aData)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
bool
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasDocumentStateDependentStyle(
|
||||
StateRuleProcessorData* aData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
EffectCompositor::AnimationStyleRuleProcessor::HasAttributeDependentStyle(
|
||||
AttributeRuleProcessorData* aData,
|
||||
RestyleHintData& aRestyleHintDataResult)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
bool
|
||||
EffectCompositor::AnimationStyleRuleProcessor::MediumFeaturesChanged(
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
ElementRuleProcessorData* aData)
|
||||
{
|
||||
nsIStyleRule *rule =
|
||||
mCompositor->GetAnimationRule(aData->mElement,
|
||||
CSSPseudoElementType::NotPseudo,
|
||||
mCascadeLevel,
|
||||
nullptr);
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
PseudoElementRuleProcessorData* aData)
|
||||
{
|
||||
if (aData->mPseudoType != CSSPseudoElementType::before &&
|
||||
aData->mPseudoType != CSSPseudoElementType::after) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIStyleRule *rule =
|
||||
mCompositor->GetAnimationRule(aData->mElement,
|
||||
aData->mPseudoType,
|
||||
mCascadeLevel,
|
||||
nullptr);
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
AnonBoxRuleProcessorData* aData)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
void
|
||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||
XULTreeRuleProcessorData* aData)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t
|
||||
EffectCompositor::AnimationStyleRuleProcessor::SizeOfExcludingThis(
|
||||
MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
EffectCompositor::AnimationStyleRuleProcessor::SizeOfIncludingThis(
|
||||
MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
template
|
||||
void
|
||||
EffectCompositor::UpdateEffectProperties(
|
||||
GeckoStyleContext* aStyleContext,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
#endif
|
||||
|
||||
template
|
||||
void
|
||||
|
@ -16,9 +16,6 @@
|
||||
#include "nsCSSPropertyID.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsCSSPropertyIDSet;
|
||||
@ -50,13 +47,6 @@ 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)
|
||||
@ -134,36 +124,6 @@ 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,
|
||||
// no work is done.
|
||||
// |aStyleContext| is used for UpdateCascadingResults.
|
||||
// |aStyleContext| can be nullptr if style context, which is associated with
|
||||
// the primary frame of the specified (pseudo-)element, is the current style
|
||||
// context.
|
||||
// If we are resolving a new style context, we shoud pass the newly created
|
||||
// style context, otherwise we may use an old style context, it will result
|
||||
// unexpected cascading results.
|
||||
void MaybeUpdateAnimationRule(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
CascadeLevel aCascadeLevel,
|
||||
nsStyleContext *aStyleContext);
|
||||
|
||||
// We need to pass the newly resolved style context as |aStyleContext| when
|
||||
// we call this function during resolving style context because this function
|
||||
// calls UpdateCascadingResults with a style context if necessary, at the
|
||||
// time, we end up using the previous style context if we don't pass the new
|
||||
// style context.
|
||||
// When we are not resolving style context, |aStyleContext| can be nullptr, we
|
||||
// will use a style context associated with the primary frame of the specified
|
||||
// (pseudo-)element.
|
||||
nsIStyleRule* GetAnimationRule(dom::Element* aElement,
|
||||
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.
|
||||
@ -178,19 +138,6 @@ public:
|
||||
|
||||
bool HasPendingStyleUpdates() const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool HasThrottledStyleUpdates() const;
|
||||
|
||||
// Tell the restyle tracker about all the animated styles that have
|
||||
// pending updates so that it can update the animation rule for these
|
||||
// elements.
|
||||
void AddStyleUpdatesTo(RestyleTracker& aTracker);
|
||||
|
||||
nsIStyleRuleProcessor* RuleProcessor(CascadeLevel aCascadeLevel) const
|
||||
{
|
||||
return mRuleProcessors[aCascadeLevel];
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
nsCSSPropertyID aProperty);
|
||||
@ -290,13 +237,6 @@ 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
|
||||
@ -332,52 +272,6 @@ private:
|
||||
|
||||
bool mIsInPreTraverse = false;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
class AnimationStyleRuleProcessor final : public nsIStyleRuleProcessor
|
||||
{
|
||||
public:
|
||||
AnimationStyleRuleProcessor(EffectCompositor* aCompositor,
|
||||
CascadeLevel aCascadeLevel)
|
||||
: mCompositor(aCompositor)
|
||||
, mCascadeLevel(aCascadeLevel)
|
||||
{
|
||||
MOZ_ASSERT(aCompositor);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRuleProcessor (parts)
|
||||
nsRestyleHint HasStateDependentStyle(
|
||||
StateRuleProcessorData* aData) override;
|
||||
nsRestyleHint HasStateDependentStyle(
|
||||
PseudoElementStateRuleProcessorData* aData) override;
|
||||
bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) override;
|
||||
nsRestyleHint HasAttributeDependentStyle(
|
||||
AttributeRuleProcessorData* aData,
|
||||
RestyleHintData& aRestyleHintDataResult) override;
|
||||
bool MediumFeaturesChanged(nsPresContext* aPresContext) override;
|
||||
void RulesMatching(ElementRuleProcessorData* aData) override;
|
||||
void RulesMatching(PseudoElementRuleProcessorData* aData) override;
|
||||
void RulesMatching(AnonBoxRuleProcessorData* aData) override;
|
||||
#ifdef MOZ_XUL
|
||||
void RulesMatching(XULTreeRuleProcessorData* aData) override;
|
||||
#endif
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const MOZ_MUST_OVERRIDE override;
|
||||
|
||||
private:
|
||||
~AnimationStyleRuleProcessor() = default;
|
||||
|
||||
EffectCompositor* mCompositor;
|
||||
CascadeLevel mCascadeLevel;
|
||||
};
|
||||
|
||||
EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
|
||||
OwningNonNull<AnimationStyleRuleProcessor>>
|
||||
mRuleProcessors;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -7,9 +7,6 @@
|
||||
#ifndef mozilla_EffectSet_h
|
||||
#define mozilla_EffectSet_h
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/AnimValuesStyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
@ -172,13 +169,6 @@ 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
|
||||
{
|
||||
@ -216,17 +206,6 @@ 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
|
||||
// detect any new changes; if necessary we restyle immediately
|
||||
// afterwards with animation.
|
||||
EnumeratedArray<EffectCompositor::CascadeLevel,
|
||||
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
|
||||
|
@ -12,16 +12,10 @@
|
||||
// For UnrestrictedDoubleOrKeyframeAnimationOptions;
|
||||
#include "mozilla/dom/CSSPseudoElement.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/AnimValuesStyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/FloatingPoint.h" // For IsFinite
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoStyleContext.h"
|
||||
#endif
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
@ -199,12 +193,7 @@ KeyframeEffectReadOnly::SetKeyframes(JSContext* aContext,
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
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());
|
||||
}
|
||||
@ -215,14 +204,6 @@ KeyframeEffectReadOnly::SetKeyframes(JSContext* aContext,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
GeckoStyleContext* aStyleContext)
|
||||
{
|
||||
DoSetKeyframes(Move(aKeyframes), Move(aStyleContext));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(
|
||||
@ -237,12 +218,6 @@ 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;
|
||||
@ -327,13 +302,7 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
||||
MOZ_ASSERT(aStyleContext);
|
||||
|
||||
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());
|
||||
@ -395,140 +364,6 @@ KeyframeEffectReadOnly::DoUpdateProperties(StyleType* aStyle)
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* static */ StyleAnimationValue
|
||||
KeyframeEffectReadOnly::CompositeValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const StyleAnimationValue& aValueToComposite,
|
||||
const StyleAnimationValue& aUnderlyingValue,
|
||||
CompositeOperation aCompositeOperation)
|
||||
{
|
||||
// Just return the underlying value if |aValueToComposite| is null
|
||||
// (i.e. missing keyframe).
|
||||
if (aValueToComposite.IsNull()) {
|
||||
return aUnderlyingValue;
|
||||
}
|
||||
|
||||
switch (aCompositeOperation) {
|
||||
case dom::CompositeOperation::Replace:
|
||||
return aValueToComposite;
|
||||
case dom::CompositeOperation::Add: {
|
||||
StyleAnimationValue result(aValueToComposite);
|
||||
return StyleAnimationValue::Add(aProperty,
|
||||
aUnderlyingValue,
|
||||
Move(result));
|
||||
}
|
||||
case dom::CompositeOperation::Accumulate: {
|
||||
StyleAnimationValue result(aValueToComposite);
|
||||
return StyleAnimationValue::Accumulate(aProperty,
|
||||
aUnderlyingValue,
|
||||
Move(result));
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown compisite operation type");
|
||||
break;
|
||||
}
|
||||
return StyleAnimationValue();
|
||||
}
|
||||
|
||||
StyleAnimationValue
|
||||
KeyframeEffectReadOnly::GetUnderlyingStyle(
|
||||
nsCSSPropertyID aProperty,
|
||||
const RefPtr<AnimValuesStyleRule>& aAnimationRule)
|
||||
{
|
||||
StyleAnimationValue result;
|
||||
|
||||
if (aAnimationRule && aAnimationRule->HasValue(aProperty)) {
|
||||
// If we have already composed style for the property, we use the style
|
||||
// as the underlying style.
|
||||
DebugOnly<bool> success = aAnimationRule->GetValue(aProperty, result);
|
||||
MOZ_ASSERT(success, "AnimValuesStyleRule::GetValue should not fail");
|
||||
} else {
|
||||
// If we are composing with composite operation that is not 'replace'
|
||||
// and we have not composed style for the property yet, we have to get
|
||||
// the base style for the property.
|
||||
result = BaseStyle(aProperty).mGecko;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
StyleAnimationValue
|
||||
KeyframeEffectReadOnly::CompositeValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const RefPtr<AnimValuesStyleRule>& aAnimationRule,
|
||||
const StyleAnimationValue& aValueToComposite,
|
||||
CompositeOperation aCompositeOperation)
|
||||
{
|
||||
MOZ_ASSERT(mTarget, "CompositeValue should be called with target element");
|
||||
MOZ_ASSERT(!mDocument->IsStyledByServo());
|
||||
|
||||
StyleAnimationValue underlyingValue =
|
||||
GetUnderlyingStyle(aProperty, aAnimationRule);
|
||||
|
||||
return CompositeValue(aProperty,
|
||||
aValueToComposite,
|
||||
underlyingValue,
|
||||
aCompositeOperation);
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::EnsureBaseStyles(
|
||||
GeckoStyleContext* aStyleContext,
|
||||
const nsTArray<AnimationProperty>& aProperties)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
mBaseStyleValues.Clear();
|
||||
|
||||
RefPtr<GeckoStyleContext> cachedBaseStyleContext;
|
||||
|
||||
for (const AnimationProperty& property : aProperties) {
|
||||
for (const AnimationPropertySegment& segment : property.mSegments) {
|
||||
if (segment.HasReplaceableValues()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
EnsureBaseStyle(property.mProperty,
|
||||
aStyleContext,
|
||||
cachedBaseStyleContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::EnsureBaseStyle(
|
||||
nsCSSPropertyID aProperty,
|
||||
GeckoStyleContext* aStyleContext,
|
||||
RefPtr<GeckoStyleContext>& aCachedBaseStyleContext)
|
||||
{
|
||||
if (mBaseStyleValues.Contains(aProperty)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aCachedBaseStyleContext) {
|
||||
aCachedBaseStyleContext =
|
||||
aStyleContext->PresContext()->StyleSet()->AsGecko()->
|
||||
ResolveStyleByRemovingAnimation(mTarget->mElement,
|
||||
aStyleContext,
|
||||
eRestyle_AllHintsWithAnimations);
|
||||
}
|
||||
|
||||
StyleAnimationValue result;
|
||||
DebugOnly<bool> success =
|
||||
StyleAnimationValue::ExtractComputedValue(aProperty,
|
||||
aCachedBaseStyleContext,
|
||||
result);
|
||||
|
||||
MOZ_ASSERT(success, "Should be able to extract computed animation value");
|
||||
MOZ_ASSERT(!result.IsNull(), "Should have a valid StyleAnimationValue");
|
||||
|
||||
mBaseStyleValues.Put(aProperty, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::EnsureBaseStyles(
|
||||
@ -610,87 +445,6 @@ KeyframeEffectReadOnly::WillComposeStyle()
|
||||
mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyleRule(
|
||||
RefPtr<AnimValuesStyleRule>& aStyleRule,
|
||||
const AnimationProperty& aProperty,
|
||||
const AnimationPropertySegment& aSegment,
|
||||
const ComputedTiming& aComputedTiming)
|
||||
{
|
||||
StyleAnimationValue fromValue =
|
||||
CompositeValue(aProperty.mProperty, aStyleRule,
|
||||
aSegment.mFromValue.mGecko,
|
||||
aSegment.mFromComposite);
|
||||
StyleAnimationValue toValue =
|
||||
CompositeValue(aProperty.mProperty, aStyleRule,
|
||||
aSegment.mToValue.mGecko,
|
||||
aSegment.mToComposite);
|
||||
if (fromValue.IsNull() || toValue.IsNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aStyleRule) {
|
||||
// Allocate the style rule now that we know we have animation data.
|
||||
aStyleRule = new AnimValuesStyleRule();
|
||||
}
|
||||
|
||||
// Iteration composition for accumulate
|
||||
if (mEffectOptions.mIterationComposite ==
|
||||
IterationCompositeOperation::Accumulate &&
|
||||
aComputedTiming.mCurrentIteration > 0) {
|
||||
const AnimationPropertySegment& lastSegment =
|
||||
aProperty.mSegments.LastElement();
|
||||
// FIXME: Bug 1293492: Add a utility function to calculate both of
|
||||
// below StyleAnimationValues.
|
||||
StyleAnimationValue lastValue = lastSegment.mToValue.mGecko.IsNull()
|
||||
? GetUnderlyingStyle(aProperty.mProperty, aStyleRule)
|
||||
: lastSegment.mToValue.mGecko;
|
||||
fromValue =
|
||||
StyleAnimationValue::Accumulate(aProperty.mProperty,
|
||||
lastValue,
|
||||
Move(fromValue),
|
||||
aComputedTiming.mCurrentIteration);
|
||||
toValue =
|
||||
StyleAnimationValue::Accumulate(aProperty.mProperty,
|
||||
lastValue,
|
||||
Move(toValue),
|
||||
aComputedTiming.mCurrentIteration);
|
||||
}
|
||||
|
||||
// Special handling for zero-length segments
|
||||
if (aSegment.mToKey == aSegment.mFromKey) {
|
||||
if (aComputedTiming.mProgress.Value() < 0) {
|
||||
aStyleRule->AddValue(aProperty.mProperty, Move(fromValue));
|
||||
} else {
|
||||
aStyleRule->AddValue(aProperty.mProperty, Move(toValue));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
double positionInSegment =
|
||||
(aComputedTiming.mProgress.Value() - aSegment.mFromKey) /
|
||||
(aSegment.mToKey - aSegment.mFromKey);
|
||||
double valuePosition =
|
||||
ComputedTimingFunction::GetPortion(aSegment.mTimingFunction,
|
||||
positionInSegment,
|
||||
aComputedTiming.mBeforeFlag);
|
||||
|
||||
MOZ_ASSERT(IsFinite(valuePosition), "Position value should be finite");
|
||||
|
||||
StyleAnimationValue val;
|
||||
if (StyleAnimationValue::Interpolate(aProperty.mProperty,
|
||||
fromValue,
|
||||
toValue,
|
||||
valuePosition, val)) {
|
||||
aStyleRule->AddValue(aProperty.mProperty, Move(val));
|
||||
} else if (valuePosition < 0.5) {
|
||||
aStyleRule->AddValue(aProperty.mProperty, Move(fromValue));
|
||||
} else {
|
||||
aStyleRule->AddValue(aProperty.mProperty, Move(toValue));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::ComposeStyleRule(
|
||||
@ -978,12 +732,6 @@ 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);
|
||||
|
||||
@ -1373,38 +1121,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (nsCSSProps::IsShorthand(propertyValue.mProperty)) {
|
||||
// nsCSSValue::AppendToString does not accept shorthands properties but
|
||||
// works with token stream values if we pass eCSSProperty_UNKNOWN as
|
||||
// the property.
|
||||
propertyValue.mValue.AppendToString(
|
||||
eCSSProperty_UNKNOWN, stringValue);
|
||||
} else {
|
||||
nsCSSValue cssValue = propertyValue.mValue;
|
||||
if (cssValue.GetUnit() == eCSSUnit_Null) {
|
||||
// We use an uninitialized nsCSSValue to represent the
|
||||
// "neutral value". We currently only do this for keyframes generated
|
||||
// from CSS animations with missing 0%/100% keyframes. Furthermore,
|
||||
// currently (at least until bug 1339334) keyframes generated from
|
||||
// CSS animations only contain longhand properties so we only need to
|
||||
// handle null nsCSSValues for longhand properties.
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::UncomputeValue(
|
||||
propertyValue.mProperty,
|
||||
Move(BaseStyle(propertyValue.mProperty).mGecko),
|
||||
cssValue);
|
||||
|
||||
MOZ_ASSERT(uncomputeResult,
|
||||
"Unable to get specified value from computed value");
|
||||
MOZ_ASSERT(cssValue.GetUnit() != eCSSUnit_Null,
|
||||
"Got null computed value");
|
||||
}
|
||||
cssValue.AppendToString(propertyValue.mProperty, stringValue);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* name = nsCSSProps::PropertyIDLName(propertyValue.mProperty);
|
||||
@ -1785,36 +1502,6 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationValue& aValue,
|
||||
GeckoStyleContext* aBaseStyleContext)
|
||||
{
|
||||
MOZ_ASSERT(aBaseStyleContext,
|
||||
"CreateStyleContextForAnimationValue needs to be called "
|
||||
"with a valid GeckoStyleContext");
|
||||
|
||||
RefPtr<AnimValuesStyleRule> styleRule = new AnimValuesStyleRule();
|
||||
styleRule->AddValue(aProperty, aValue.mGecko);
|
||||
|
||||
nsCOMArray<nsIStyleRule> rules;
|
||||
rules.AppendObject(styleRule);
|
||||
|
||||
nsStyleSet* styleSet =
|
||||
aBaseStyleContext->PresContext()->StyleSet()->AsGecko();
|
||||
|
||||
RefPtr<GeckoStyleContext> styleContext =
|
||||
styleSet->ResolveStyleByAddingRules(aBaseStyleContext, rules);
|
||||
|
||||
// We need to call StyleData to generate cached data for the style context.
|
||||
// Otherwise CalcStyleDifference returns no meaningful result.
|
||||
styleContext->StyleData(nsCSSProps::kSIDTable[aProperty]);
|
||||
|
||||
return styleContext.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
@ -2055,13 +1742,6 @@ 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,10 +165,6 @@ 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);
|
||||
|
||||
@ -214,16 +210,6 @@ public:
|
||||
void ComposeStyle(ComposeAnimationResult&& aRestultContainer,
|
||||
const nsCSSPropertyIDSet& aPropertiesToSkip);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Composite |aValueToComposite| on |aUnderlyingValue| with
|
||||
// |aCompositeOperation|.
|
||||
// Returns |aValueToComposite| if |aCompositeOperation| is Replace.
|
||||
static StyleAnimationValue CompositeValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const StyleAnimationValue& aValueToComposite,
|
||||
const StyleAnimationValue& aUnderlyingValue,
|
||||
CompositeOperation aCompositeOperation);
|
||||
#endif
|
||||
|
||||
// Returns true if at least one property is being animated on compositor.
|
||||
bool IsRunningOnCompositor() const;
|
||||
@ -283,11 +269,7 @@ public:
|
||||
// then assign the raw pointer to a RefPtr.
|
||||
result.mServo = mBaseStyleValuesForServo.GetWeak(aProperty, &hasProperty);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
hasProperty = mBaseStyleValues.Get(aProperty, &result.mGecko);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
MOZ_ASSERT(hasProperty || result.IsNull());
|
||||
return result;
|
||||
@ -355,39 +337,9 @@ 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
|
||||
// target element's EffectSet.
|
||||
StyleAnimationValue CompositeValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const RefPtr<AnimValuesStyleRule>& aAnimationRule,
|
||||
const StyleAnimationValue& aValueToComposite,
|
||||
CompositeOperation aCompositeOperation);
|
||||
|
||||
// Returns underlying style animation value for |aProperty|.
|
||||
StyleAnimationValue GetUnderlyingStyle(
|
||||
nsCSSPropertyID aProperty,
|
||||
const RefPtr<AnimValuesStyleRule>& aAnimationRule);
|
||||
|
||||
// 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
|
||||
// base style context will be resolved and stored in
|
||||
// |aCachedBaseStyleContext|.
|
||||
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,
|
||||
@ -422,9 +374,6 @@ protected:
|
||||
// The non-animated values for properties in this effect that contain at
|
||||
// least one animation value that is composited with the underlying value
|
||||
// (i.e. it uses the additive or accumulate composite mode).
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mBaseStyleValues;
|
||||
#endif
|
||||
nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>
|
||||
mBaseStyleValuesForServo;
|
||||
|
||||
@ -442,24 +391,12 @@ 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,18 +364,8 @@ 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,
|
||||
@ -901,49 +891,7 @@ MakePropertyValuePair(nsCSSPropertyID aProperty, const nsAString& aStringValue,
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
if (!nsCSSProps::IsShorthand(aProperty)) {
|
||||
aParser.ParseLonghandProperty(aProperty,
|
||||
aStringValue,
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->NodePrincipal(),
|
||||
value);
|
||||
if (value.GetUnit() == eCSSUnit_Null) {
|
||||
// Invalid property value, so return Nothing.
|
||||
ReportInvalidPropertyValueToConsole(aProperty, aStringValue, aDocument);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (value.GetUnit() == eCSSUnit_Null) {
|
||||
// If we have a shorthand, store the string value as a token stream.
|
||||
nsCSSValueTokenStream* tokenStream = new nsCSSValueTokenStream;
|
||||
tokenStream->mTokenStream = aStringValue;
|
||||
|
||||
// We are about to convert a null value to a token stream value but
|
||||
// by leaving the mPropertyID as unknown, we will be able to
|
||||
// distinguish between shorthand values and valid token stream values
|
||||
// (e.g. values with variable references).
|
||||
MOZ_ASSERT(tokenStream->mPropertyID == eCSSProperty_UNKNOWN,
|
||||
"The property of a token stream should be initialized"
|
||||
" to unknown");
|
||||
|
||||
// By leaving mShorthandPropertyID as unknown, we ensure that when
|
||||
// we call nsCSSValue::AppendToString we get back the string stored
|
||||
// in mTokenStream.
|
||||
MOZ_ASSERT(tokenStream->mShorthandPropertyID == eCSSProperty_UNKNOWN,
|
||||
"The shorthand property of a token stream should be initialized"
|
||||
" to unknown");
|
||||
value.SetTokenStreamValue(tokenStream);
|
||||
}
|
||||
|
||||
result.emplace(aProperty, Move(value));
|
||||
return result;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -988,113 +936,8 @@ 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
|
||||
* simulate failure when calling StyleAnimationValue::ComputeValues using its
|
||||
* value).
|
||||
*
|
||||
* @param aPair The property-value pair to test.
|
||||
* @return True if |aPair| represents a failure value.
|
||||
*/
|
||||
static bool
|
||||
IsComputeValuesFailureKey(const PropertyValuePair& aPair)
|
||||
{
|
||||
return nsCSSProps::IsShorthand(aPair.mProperty) &&
|
||||
aPair.mSimulateComputeValuesFailure;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/**
|
||||
* Calculate the StyleAnimationValues of properties of each keyframe.
|
||||
* This involves expanding shorthand properties into longhand properties,
|
||||
* removing the duplicated properties for each keyframe, and creating an
|
||||
* array of |property:computed value| pairs for each keyframe.
|
||||
*
|
||||
* These computed values are used when computing the final set of
|
||||
* per-property animation values (see GetAnimationPropertiesFromKeyframes).
|
||||
*
|
||||
* @param aKeyframes The input keyframes.
|
||||
* @param aElement The context element.
|
||||
* @param aStyleContext The style context to use when computing values.
|
||||
* @return The set of ComputedKeyframeValues. The length will be the same as
|
||||
* aFrames.
|
||||
*/
|
||||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
GeckoStyleContext* aStyleContext)
|
||||
{
|
||||
MOZ_ASSERT(aStyleContext);
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
const size_t len = aKeyframes.Length();
|
||||
nsTArray<ComputedKeyframeValues> result(len);
|
||||
|
||||
for (const Keyframe& frame : aKeyframes) {
|
||||
nsCSSPropertyIDSet propertiesOnThisKeyframe;
|
||||
ComputedKeyframeValues* computedValues = result.AppendElement();
|
||||
for (const PropertyValuePair& pair :
|
||||
PropertyPriorityIterator(frame.mPropertyValues)) {
|
||||
MOZ_ASSERT(!pair.mServoDeclarationBlock,
|
||||
"Animation values were parsed using Servo backend but target"
|
||||
" element is not using Servo backend?");
|
||||
|
||||
// Expand each value into the set of longhands and produce
|
||||
// a KeyframeValueEntry for each value.
|
||||
nsTArray<PropertyStyleAnimationValuePair> values;
|
||||
|
||||
// For shorthands, we store the string as a token stream so we need to
|
||||
// extract that first.
|
||||
if (nsCSSProps::IsShorthand(pair.mProperty)) {
|
||||
nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue();
|
||||
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
|
||||
CSSEnabledState::eForAllContent, aElement, aStyleContext,
|
||||
tokenStream->mTokenStream, /* aUseSVGMode */ false, values)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (IsComputeValuesFailureKey(pair)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
} else if (pair.mValue.GetUnit() == eCSSUnit_Null) {
|
||||
// An uninitialized nsCSSValue represents the underlying value which
|
||||
// we represent as an uninitialized AnimationValue so we just leave
|
||||
// neutralPair->mValue as-is.
|
||||
PropertyStyleAnimationValuePair* neutralPair = values.AppendElement();
|
||||
neutralPair->mProperty = pair.mProperty;
|
||||
} else {
|
||||
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
|
||||
CSSEnabledState::eForAllContent, aElement, aStyleContext,
|
||||
pair.mValue, /* aUseSVGMode */ false, values)) {
|
||||
continue;
|
||||
}
|
||||
MOZ_ASSERT(values.Length() == 1,
|
||||
"Longhand properties should produce a single"
|
||||
" StyleAnimationValue");
|
||||
}
|
||||
|
||||
for (auto& value : values) {
|
||||
// If we already got a value for this property on the keyframe,
|
||||
// skip this one.
|
||||
if (propertiesOnThisKeyframe.HasProperty(value.mProperty)) {
|
||||
continue;
|
||||
}
|
||||
propertiesOnThisKeyframe.AddProperty(value.mProperty);
|
||||
computedValues->AppendElement(Move(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result.Length() == aKeyframes.Length(), "Array length mismatch");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The variation of the above function. This is for Servo backend.
|
||||
@ -1644,17 +1487,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());
|
||||
if (!parser.IsValueValidForProperty(pair.mProperty,
|
||||
tokenStream->mTokenStream)) {
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
MOZ_ASSERT(styleBackend != StyleBackendType::Servo ||
|
||||
@ -1694,15 +1527,6 @@ DistributeRange(const Range<Keyframe>& aRange)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template
|
||||
nsTArray<AnimationProperty>
|
||||
KeyframeUtils::GetAnimationPropertiesFromKeyframes(
|
||||
const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
GeckoStyleContext* aStyle,
|
||||
dom::CompositeOperation aEffectComposite);
|
||||
#endif
|
||||
|
||||
template
|
||||
nsTArray<AnimationProperty>
|
||||
|
@ -13,9 +13,6 @@
|
||||
#include "mozilla/ServoCSSParser.h"
|
||||
#include "nsCSSParser.h" // For nsCSSParser
|
||||
#include "nsIDocument.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -134,60 +131,7 @@ TimingParams::ParseEasing(const nsAString& aEasing,
|
||||
return Some(ComputedTimingFunction(timingFunction));
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
|
||||
aEasing,
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->GetDocumentURI(),
|
||||
aDocument->NodePrincipal(),
|
||||
value);
|
||||
|
||||
switch (value.GetUnit()) {
|
||||
case eCSSUnit_List: {
|
||||
const nsCSSValueList* list = value.GetListValue();
|
||||
if (list->mNext) {
|
||||
// don't support a list of timing functions
|
||||
break;
|
||||
}
|
||||
switch (list->mValue.GetUnit()) {
|
||||
case eCSSUnit_Enumerated:
|
||||
// Return Nothing() if "linear" is passed in.
|
||||
if (list->mValue.GetIntValue() ==
|
||||
NS_STYLE_TRANSITION_TIMING_FUNCTION_LINEAR) {
|
||||
return Nothing();
|
||||
}
|
||||
MOZ_FALLTHROUGH;
|
||||
case eCSSUnit_Cubic_Bezier:
|
||||
case eCSSUnit_Function:
|
||||
case eCSSUnit_Steps: {
|
||||
nsTimingFunction timingFunction;
|
||||
nsRuleNode::ComputeTimingFunction(list->mValue, timingFunction);
|
||||
return Some(ComputedTimingFunction(timingFunction));
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function list "
|
||||
"item unit");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eCSSUnit_Inherit:
|
||||
case eCSSUnit_Initial:
|
||||
case eCSSUnit_Unset:
|
||||
case eCSSUnit_TokenStream:
|
||||
case eCSSUnit_Null:
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function unit");
|
||||
break;
|
||||
}
|
||||
|
||||
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
|
||||
return Nothing();
|
||||
}
|
||||
|
@ -121,28 +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);
|
||||
nsCSSValue value;
|
||||
if (!parser.ParseMarginString(aString, nullptr, 0, value, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mRootMargin = value.GetRectValue();
|
||||
|
||||
for (auto side : nsCSSRect::sides) {
|
||||
nsCSSValue& value = mRootMargin.*side;
|
||||
if (!(value.IsPixelLengthUnit() || value.IsPercentLengthUnit())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -685,40 +685,7 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValue value;
|
||||
nsCSSParser parser;
|
||||
bool parseSuccess = parser.ParseTransformProperty(aTransformList,
|
||||
true,
|
||||
value);
|
||||
if (!parseSuccess) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// A value of "none" results in a 2D identity matrix.
|
||||
if (value.GetUnit() == eCSSUnit_None) {
|
||||
mMatrix3D = nullptr;
|
||||
mMatrix2D = new gfx::Matrix();
|
||||
return this;
|
||||
}
|
||||
|
||||
// A value other than a transform-list is a syntax error.
|
||||
if (value.GetUnit() != eCSSUnit_SharedList) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RuleNodeCacheConditions dummy;
|
||||
nsStyleTransformMatrix::TransformReferenceBox dummyBox;
|
||||
transform = nsStyleTransformMatrix::ReadTransforms(
|
||||
value.GetSharedListValue()->mHead,
|
||||
nullptr, nullptr, dummy, dummyBox,
|
||||
nsPresContext::AppUnitsPerCSSPixel(),
|
||||
&contains3dTransform);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!contains3dTransform) {
|
||||
|
@ -112,11 +112,6 @@
|
||||
#include "nsView.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsTextNode.h"
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -3498,30 +3493,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.
|
||||
return nullptr;
|
||||
}
|
||||
TreeMatchContext matchingContext(false,
|
||||
nsRuleWalker::eRelevantLinkUnvisited,
|
||||
OwnerDoc(),
|
||||
TreeMatchContext::eNeverMatchVisited);
|
||||
matchingContext.SetHasSpecifiedScope();
|
||||
matchingContext.AddScopeElement(this);
|
||||
for (nsINode* node = this; node; node = node->GetParentNode()) {
|
||||
if (node->IsElement() &&
|
||||
nsCSSRuleProcessor::SelectorListMatches(node->AsElement(),
|
||||
matchingContext,
|
||||
aList)) {
|
||||
return node->AsElement();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -3539,23 +3511,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.
|
||||
return false;
|
||||
}
|
||||
TreeMatchContext matchingContext(false,
|
||||
nsRuleWalker::eRelevantLinkUnvisited,
|
||||
OwnerDoc(),
|
||||
TreeMatchContext::eNeverMatchVisited);
|
||||
matchingContext.SetHasSpecifiedScope();
|
||||
matchingContext.AddScopeElement(this);
|
||||
return nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
|
||||
aList);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -4356,7 +4312,6 @@ void
|
||||
Element::ClearServoData(nsIDocument* aDoc) {
|
||||
MOZ_ASSERT(IsStyledByServo());
|
||||
MOZ_ASSERT(aDoc);
|
||||
#ifdef MOZ_STYLO
|
||||
if (HasServoData()) {
|
||||
Servo_Element_ClearData(this);
|
||||
} else {
|
||||
@ -4370,9 +4325,6 @@ Element::ClearServoData(nsIDocument* aDoc) {
|
||||
if (aDoc->GetServoRestyleRoot() == this) {
|
||||
aDoc->ClearServoRestyleRoot();
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("Accessing servo node data in non-stylo build");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -454,12 +454,6 @@ 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)) {
|
||||
|
@ -97,10 +97,6 @@
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "ChildIterator.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsTextNode.h"
|
||||
#include "mozilla/dom/NodeListBinding.h"
|
||||
|
||||
|
@ -13,11 +13,6 @@
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsCSSProps.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsMediaList.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -251,17 +246,7 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
||||
return !!mServoSourceSizeList;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser cssParser;
|
||||
|
||||
mSizeQueries.Clear();
|
||||
mSizeValues.Clear();
|
||||
|
||||
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
|
||||
mSizeQueries, mSizeValues);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -464,30 +449,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");
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < numSizes; i++) {
|
||||
if (mSizeQueries[i]->Matches(pctx, nullptr)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == numSizes) {
|
||||
// No match defaults to 100% viewport
|
||||
nsCSSValue defaultWidth(100.0f, eCSSUnit_ViewportWidth);
|
||||
effectiveWidth = nsRuleNode::CalcLengthWithInitialFont(pctx,
|
||||
defaultWidth);
|
||||
} else {
|
||||
effectiveWidth = nsRuleNode::CalcLengthWithInitialFont(pctx,
|
||||
mSizeValues[i]);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
*aWidth = nsPresContext::AppUnitsToDoubleCSSPixels(std::max(effectiveWidth, 0));
|
||||
|
@ -125,11 +125,6 @@ private:
|
||||
// Servo bits.
|
||||
UniquePtr<RawServoSourceSizeList> mServoSourceSizeList;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Gecko bits.
|
||||
nsTArray< nsAutoPtr<nsMediaQuery> > mSizeQueries;
|
||||
nsTArray<nsCSSValue> mSizeValues;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ResponsiveImageCandidate {
|
||||
|
@ -6,9 +6,6 @@
|
||||
|
||||
#include "mozilla/dom/StyleSheetList.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#endif
|
||||
#include "mozilla/dom/StyleSheetListBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -18,9 +18,6 @@
|
||||
#include "nsMappedAttributeElement.h"
|
||||
#include "nsString.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsContentUtils.h" // nsAutoScriptBlocker
|
||||
@ -631,15 +628,6 @@ nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
|
||||
return MakeMappedUnique(mapped);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
if (mImpl && mImpl->mMappedAttrs) {
|
||||
aRuleWalker->Forward(mImpl->mMappedAttrs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsAttrAndChildArray::Compact()
|
||||
|
@ -125,9 +125,6 @@ public:
|
||||
}
|
||||
return DoSetMappedAttrStyleSheet(aSheet);
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker);
|
||||
#endif
|
||||
|
||||
void Compact();
|
||||
|
||||
|
@ -1747,14 +1747,7 @@ 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;
|
||||
|
@ -2842,43 +2842,7 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue computedValue;
|
||||
if (!StyleAnimationValue::ExtractComputedValue(propertyID,
|
||||
styleContext->AsGecko(),
|
||||
computedValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Note: ExtractComputedValue can return 'unset', 'initial', or 'inherit' in
|
||||
// its "computedValue" outparam, even though these technically aren't valid
|
||||
// computed values. (It has this behavior for discretely-animatable
|
||||
// properties, e.g. 'align-content', when these keywords are explicitly
|
||||
// specified or when there is no specified value.) But we need to return a
|
||||
// valid computed value -- these keywords won't do. So we fall back to
|
||||
// nsComputedDOMStyle in this case.
|
||||
if (computedValue.GetUnit() == StyleAnimationValue::eUnit_DiscreteCSSValue &&
|
||||
(computedValue.GetCSSValueValue()->GetUnit() == eCSSUnit_Unset ||
|
||||
computedValue.GetCSSValueValue()->GetUnit() == eCSSUnit_Initial ||
|
||||
computedValue.GetCSSValueValue()->GetUnit() == eCSSUnit_Inherit)) {
|
||||
RefPtr<nsComputedDOMStyle> computedStyle =
|
||||
NS_NewComputedDOMStyle(
|
||||
element, aPseudoElement, shell,
|
||||
nsComputedDOMStyle::StyleType::eAll,
|
||||
nsComputedDOMStyle::AnimationFlag::eWithoutAnimation);
|
||||
computedStyle->GetPropertyValue(propertyID, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::UncomputeValue(propertyID,
|
||||
Move(computedValue), aResult);
|
||||
MOZ_ASSERT(uncomputeResult,
|
||||
"Unable to get specified value from computed value");
|
||||
return NS_OK;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -230,9 +230,6 @@
|
||||
#include "nsITextControlElement.h"
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
#include "nsIEditor.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsISecurityConsoleMessage.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
@ -1324,27 +1321,11 @@ 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)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SelectorCacheKey* key = new SelectorCacheKey(aSelector);
|
||||
mTable.Put(key->mKey, SelectorList(Move(aSelectorList)));
|
||||
AddObject(key);
|
||||
}
|
||||
#endif
|
||||
|
||||
void nsIDocument::SelectorCache::CacheList(
|
||||
const nsAString& aSelector,
|
||||
@ -1955,9 +1936,6 @@ 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(mLayoutHistoryState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnloadBlocker)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFirstBaseNodeWithHref)
|
||||
@ -3711,7 +3689,6 @@ nsIDocument::SetBaseURI(nsIURI* aURI)
|
||||
URLExtraData*
|
||||
nsIDocument::DefaultStyleAttrURLData()
|
||||
{
|
||||
#ifdef MOZ_STYLO
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsIURI* baseURI = GetDocBaseURI();
|
||||
nsIURI* docURI = GetDocumentURI();
|
||||
@ -3723,10 +3700,6 @@ nsIDocument::DefaultStyleAttrURLData()
|
||||
mCachedURLData = new URLExtraData(baseURI, docURI, principal);
|
||||
}
|
||||
return mCachedURLData;
|
||||
#else
|
||||
MOZ_CRASH("Should not be called for non-stylo build");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -12644,12 +12617,10 @@ nsIDocument::UpdateStyleBackendType()
|
||||
// Assume Gecko by default.
|
||||
mStyleBackendType = StyleBackendType::Gecko;
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
if (nsLayoutUtils::StyloEnabled() &&
|
||||
nsLayoutUtils::ShouldUseStylo(NodePrincipal())) {
|
||||
mStyleBackendType = StyleBackendType::Servo;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1522,12 +1522,7 @@ 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;
|
||||
}
|
||||
@ -1539,12 +1534,6 @@ public:
|
||||
, mServo(aList.release())
|
||||
{}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
explicit SelectorList(mozilla::UniquePtr<nsCSSSelectorList>&& aList)
|
||||
: mIsServo(false)
|
||||
, mGecko(aList.release())
|
||||
{}
|
||||
#endif
|
||||
|
||||
~SelectorList() {
|
||||
Reset();
|
||||
@ -3875,10 +3864,8 @@ protected:
|
||||
nsCOMPtr<nsIURI> mDocumentBaseURI;
|
||||
nsCOMPtr<nsIURI> mChromeXHRDocBaseURI;
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
// A lazily-constructed URL data for style system to resolve URL value.
|
||||
RefPtr<mozilla::URLExtraData> mCachedURLData;
|
||||
#endif
|
||||
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
|
||||
|
@ -25,9 +25,6 @@
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
@ -87,9 +84,6 @@
|
||||
#include "nsPIBoxObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPresContext.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsString.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsSVGUtils.h"
|
||||
@ -99,9 +93,6 @@
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "xpcpublic.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsCSSParser.h"
|
||||
#include "HTMLLegendElement.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
@ -2526,96 +2517,9 @@ nsINode::ParseServoSelectorList(
|
||||
return selectorList;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSSelectorList*
|
||||
nsINode::ParseSelectorList(const nsAString& aSelectorString,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
nsIDocument::SelectorCache& cache =
|
||||
doc->GetSelectorCache(mozilla::StyleBackendType::Gecko);
|
||||
nsIDocument::SelectorCache::SelectorList* list =
|
||||
cache.GetList(aSelectorString);
|
||||
if (list) {
|
||||
if (!*list) {
|
||||
// Invalid selector.
|
||||
aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR,
|
||||
NS_LITERAL_CSTRING("'") + NS_ConvertUTF16toUTF8(aSelectorString) +
|
||||
NS_LITERAL_CSTRING("' is not a valid selector")
|
||||
);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return list->AsGecko();
|
||||
}
|
||||
|
||||
nsCSSParser parser(doc->CSSLoader());
|
||||
|
||||
nsCSSSelectorList* selectorList = nullptr;
|
||||
aRv = parser.ParseSelectorString(aSelectorString,
|
||||
doc->GetDocumentURI(),
|
||||
0, // XXXbz get the line number!
|
||||
&selectorList);
|
||||
if (aRv.Failed()) {
|
||||
// We hit this for syntax errors, which are quite common, so don't
|
||||
// use NS_ENSURE_SUCCESS. (For example, jQuery has an extended set
|
||||
// of selectors, but it sees if we can parse them first.)
|
||||
MOZ_ASSERT(aRv.ErrorCodeIs(NS_ERROR_DOM_SYNTAX_ERR),
|
||||
"Unexpected error, so cached version won't return it");
|
||||
|
||||
// Change the error message to match above.
|
||||
aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR,
|
||||
NS_LITERAL_CSTRING("'") + NS_ConvertUTF16toUTF8(aSelectorString) +
|
||||
NS_LITERAL_CSTRING("' is not a valid selector")
|
||||
);
|
||||
|
||||
cache.CacheList(aSelectorString, UniquePtr<nsCSSSelectorList>());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Filter out pseudo-element selectors from selectorList
|
||||
nsCSSSelectorList** slot = &selectorList;
|
||||
do {
|
||||
nsCSSSelectorList* cur = *slot;
|
||||
if (cur->mSelectors->IsPseudoElement()) {
|
||||
*slot = cur->mNext;
|
||||
cur->mNext = nullptr;
|
||||
delete cur;
|
||||
} else {
|
||||
slot = &cur->mNext;
|
||||
}
|
||||
} while (*slot);
|
||||
|
||||
if (selectorList) {
|
||||
NS_ASSERTION(selectorList->mSelectors,
|
||||
"How can we not have any selectors?");
|
||||
cache.CacheList(aSelectorString, UniquePtr<nsCSSSelectorList>(selectorList));
|
||||
} else {
|
||||
// This is the "only pseudo-element selectors" case, which is
|
||||
// not common, so just don't worry about caching it. That way a
|
||||
// null cached value can always indicate an invalid selector.
|
||||
}
|
||||
|
||||
return selectorList;
|
||||
}
|
||||
|
||||
static void
|
||||
AddScopeElements(TreeMatchContext& aMatchContext,
|
||||
nsINode* aMatchContextNode)
|
||||
{
|
||||
if (aMatchContextNode->IsElement()) {
|
||||
aMatchContext.SetHasSpecifiedScope();
|
||||
aMatchContext.AddScopeElement(aMatchContextNode->AsElement());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
struct SelectorMatchInfo {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSSelectorList* const mSelectorList;
|
||||
TreeMatchContext& mMatchContext;
|
||||
#endif
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@ -2652,11 +2556,6 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* 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
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|| nsCSSRuleProcessor::SelectorListMatches(element,
|
||||
aMatchInfo->mMatchContext,
|
||||
aMatchInfo->mSelectorList)
|
||||
#endif
|
||||
) {
|
||||
aList.AppendElement(element);
|
||||
if (onlyFirstMatch) {
|
||||
@ -2667,67 +2566,6 @@ 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.
|
||||
template<bool onlyFirstMatch, class Collector, class T>
|
||||
MOZ_ALWAYS_INLINE static void
|
||||
FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDocument* doc = aRoot->OwnerDoc();
|
||||
|
||||
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
doc, TreeMatchContext::eNeverMatchVisited);
|
||||
AddScopeElements(matchingContext, aRoot);
|
||||
|
||||
// Fast-path selectors involving IDs. We can only do this if aRoot
|
||||
// is in the document and the document is not in quirks mode, since
|
||||
// ID selectors are case-insensitive in quirks mode. Also, only do
|
||||
// this if aSelectorList only has one selector, because otherwise
|
||||
// ordering the elements correctly is a pain.
|
||||
NS_ASSERTION(aRoot->IsElement() || aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
|
||||
!aRoot->IsInUncomposedDoc(),
|
||||
"The optimization below to check ContentIsDescendantOf only for "
|
||||
"elements depends on aRoot being either an element or a "
|
||||
"document if it's in the document.");
|
||||
if (aRoot->IsInUncomposedDoc() &&
|
||||
doc->GetCompatibilityMode() != eCompatibility_NavQuirks &&
|
||||
!aSelectorList->mNext &&
|
||||
aSelectorList->mSelectors->mIDList) {
|
||||
nsAtom* id = aSelectorList->mSelectors->mIDList->mAtom;
|
||||
SelectorMatchInfo info = { aSelectorList, matchingContext };
|
||||
FindMatchingElementsWithId<onlyFirstMatch, T>(nsDependentAtomString(id),
|
||||
aRoot, &info, aList);
|
||||
return;
|
||||
}
|
||||
|
||||
Collector results;
|
||||
for (nsIContent* cur = aRoot->GetFirstChild();
|
||||
cur;
|
||||
cur = cur->GetNextNode(aRoot)) {
|
||||
if (cur->IsElement() &&
|
||||
nsCSSRuleProcessor::SelectorListMatches(cur->AsElement(),
|
||||
matchingContext,
|
||||
aSelectorList)) {
|
||||
if (onlyFirstMatch) {
|
||||
aList.AppendElement(cur->AsElement());
|
||||
return;
|
||||
}
|
||||
results.AppendElement(cur->AsElement());
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t len = results.Length();
|
||||
if (len) {
|
||||
aList.SetCapacity(len);
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
aList.AppendElement(results.ElementAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ElementHolder {
|
||||
ElementHolder() : mElement(nullptr) {}
|
||||
@ -2757,18 +2595,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.
|
||||
return nullptr;
|
||||
}
|
||||
ElementHolder holder;
|
||||
FindMatchingElements<true, ElementHolder>(this, aList, holder, aResult);
|
||||
return holder.mElement;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -2790,15 +2617,7 @@ 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
|
||||
}
|
||||
);
|
||||
|
||||
@ -2935,13 +2754,11 @@ nsINode::IsNodeApzAwareInternal() const
|
||||
return EventTarget::IsApzAware();
|
||||
}
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
bool
|
||||
nsINode::IsStyledByServo() const
|
||||
{
|
||||
return OwnerDoc()->IsStyledByServo();
|
||||
}
|
||||
#endif
|
||||
|
||||
DocGroup*
|
||||
nsINode::GetDocGroup() const
|
||||
|
@ -1043,11 +1043,7 @@ public:
|
||||
* Returns true if this is a node belonging to a document that uses the Servo
|
||||
* style system.
|
||||
*/
|
||||
#ifdef MOZ_STYLO
|
||||
bool IsStyledByServo() const;
|
||||
#else
|
||||
bool IsStyledByServo() const { return false; }
|
||||
#endif
|
||||
|
||||
inline void UnsetRestyleFlagsIfGecko();
|
||||
|
||||
@ -2083,11 +2079,7 @@ 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,14 +7,6 @@
|
||||
#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,9 +39,6 @@ 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,
|
||||
|
@ -11,10 +11,6 @@
|
||||
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "mozilla/GenericSpecifiedValues.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
@ -151,13 +147,6 @@ 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,
|
||||
@ -258,56 +247,6 @@ nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
|
||||
mSheet = aSheet; // not ref counted
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (mRuleMapper) {
|
||||
(*mRuleMapper)(this, aRuleData);
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsMappedAttributes::MightMapInheritedStyleData()
|
||||
{
|
||||
// Just assume that we do, rather than adding checks to all of the different
|
||||
// kinds of attribute mapping functions we have.
|
||||
return true;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsMappedAttributes::GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
|
||||
nsCSSValue* aValue)
|
||||
{
|
||||
MOZ_ASSERT(false, "GetDiscretelyAnimatedCSSValue is not implemented yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
nsAutoCString str;
|
||||
nsAutoString tmp;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < mAttrCount; ++i) {
|
||||
int32_t indent;
|
||||
for (indent = aIndent; indent > 0; --indent) {
|
||||
str.AppendLiteral(" ");
|
||||
}
|
||||
|
||||
Attrs()[i].mName.GetQualifiedName(tmp);
|
||||
LossyAppendUTF16toASCII(tmp, str);
|
||||
|
||||
Attrs()[i].mValue.ToString(tmp);
|
||||
LossyAppendUTF16toASCII(tmp, str);
|
||||
str.Append('\n');
|
||||
fprintf_stderr(out, "%s", str.get());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
nsMappedAttributes::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
|
||||
|
@ -14,9 +14,6 @@
|
||||
|
||||
#include "nsAttrAndChildArray.h"
|
||||
#include "nsMappedAttributeElement.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
@ -25,9 +22,6 @@ class nsAtom;
|
||||
class nsHTMLStyleSheet;
|
||||
|
||||
class nsMappedAttributes final
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
: public nsIStyleRule
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
nsMappedAttributes(nsHTMLStyleSheet* aSheet,
|
||||
@ -37,11 +31,7 @@ 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);
|
||||
@ -99,16 +89,6 @@ public:
|
||||
mServoStyle = nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// nsIStyleRule
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
|
||||
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;
|
||||
|
||||
|
@ -12,10 +12,6 @@
|
||||
#include "mozilla/DeclarationBlockInlines.h"
|
||||
#include "mozilla/ServoDeclarationBlock.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/css/Rule.h"
|
||||
#include "mozilla/dom/CSSRuleList.h"
|
||||
#include "mozilla/dom/SRIMetadata.h"
|
||||
@ -1100,12 +1096,7 @@ 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());
|
||||
@ -1115,15 +1106,7 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
||||
aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
|
||||
/* aLoadData = */ nullptr, 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(),
|
||||
/* aLoadData = */ nullptr, 0);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
// Mark the sheet as complete.
|
||||
@ -1206,16 +1189,7 @@ 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)) {
|
||||
|
@ -5,9 +5,6 @@
|
||||
#ifndef nsTreeSanitizer_h_
|
||||
#define nsTreeSanitizer_h_
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
|
@ -27,14 +27,7 @@
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
@ -759,27 +752,13 @@ CanvasGradient::AddColorStop(float aOffset, const nsAString& aColorstr, ErrorRes
|
||||
: nullptr;
|
||||
|
||||
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;
|
||||
|
||||
nsPresContext* presContext = shell ? shell->GetPresContext() : nullptr;
|
||||
|
||||
ok = parser.ParseColorString(aColorstr, nullptr, 0, value) &&
|
||||
nsRuleNode::ComputeColor(value, presContext, nullptr, color);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
@ -1180,11 +1159,7 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
||||
css::Loader* loader = document ? document->CSSLoader() : nullptr;
|
||||
|
||||
bool useServoParser =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
document && document->IsStyledByServo();
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
|
||||
if (useServoParser) {
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
@ -1210,36 +1185,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);
|
||||
nsCSSValue value;
|
||||
if (!parser.ParseColorString(aString, nullptr, 0, value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value.IsNumericColorUnit()) {
|
||||
// if we already have a color we can just use it directly
|
||||
*aColor = value.GetColorValue();
|
||||
} else {
|
||||
// otherwise resolve it
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
RefPtr<nsStyleContext> parentContext;
|
||||
if (mCanvasElement && mCanvasElement->IsInComposedDoc()) {
|
||||
// Inherit from the canvas element.
|
||||
parentContext =
|
||||
nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr);
|
||||
}
|
||||
|
||||
Unused << nsRuleNode::ComputeColor(
|
||||
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
|
||||
*aColor);
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -2691,161 +2637,6 @@ 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,
|
||||
const nsCSSPropertyID aProp2, const nsAString& aValue2, bool* aChanged2)
|
||||
{
|
||||
nsIPrincipal* principal = aNode->NodePrincipal();
|
||||
nsIDocument* document = aNode->OwnerDoc();
|
||||
|
||||
nsIURI* docURL = document->GetDocumentURI();
|
||||
nsIURI* baseURL = document->GetDocBaseURI();
|
||||
|
||||
// Pass the CSS Loader object to the parser, to allow parser error reports
|
||||
// to include the outer window ID.
|
||||
nsCSSParser parser(document->CSSLoader());
|
||||
|
||||
RefPtr<Declaration> declaration =
|
||||
parser.ParseStyleAttribute(EmptyString(), docURL, baseURL, principal);
|
||||
|
||||
if (aProp1 != eCSSProperty_UNKNOWN) {
|
||||
parser.ParseProperty(aProp1, aValue1, docURL, baseURL, principal,
|
||||
declaration, aChanged1, false);
|
||||
}
|
||||
|
||||
if (aProp2 != eCSSProperty_UNKNOWN) {
|
||||
parser.ParseProperty(aProp2, aValue2, docURL, baseURL, principal,
|
||||
declaration, aChanged2, false);
|
||||
}
|
||||
|
||||
declaration->SetImmutable();
|
||||
return declaration.forget();
|
||||
}
|
||||
|
||||
static already_AddRefed<Declaration>
|
||||
CreateFontDeclaration(const nsAString& aFont,
|
||||
nsINode* aNode,
|
||||
bool* aOutFontChanged)
|
||||
{
|
||||
bool lineHeightChanged;
|
||||
return CreateDeclaration(aNode,
|
||||
eCSSProperty_font, aFont, aOutFontChanged,
|
||||
eCSSProperty_line_height, NS_LITERAL_STRING("normal"), &lineHeightChanged);
|
||||
}
|
||||
|
||||
static already_AddRefed<GeckoStyleContext>
|
||||
GetFontParentStyleContext(Element* aElement,
|
||||
nsIPresShell* aPresShell,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
if (aElement && aElement->IsInComposedDoc()) {
|
||||
// Inherit from the canvas element.
|
||||
RefPtr<nsStyleContext> result =
|
||||
nsComputedDOMStyle::GetStyleContext(aElement, nullptr);
|
||||
if (!result) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
return GeckoStyleContext::TakeRef(result.forget());
|
||||
}
|
||||
|
||||
// otherwise inherit from default (10px sans-serif)
|
||||
|
||||
bool changed;
|
||||
RefPtr<css::Declaration> parentRule =
|
||||
CreateFontDeclaration(NS_LITERAL_STRING("10px sans-serif"),
|
||||
aPresShell->GetDocument(), &changed);
|
||||
|
||||
nsTArray<nsCOMPtr<nsIStyleRule>> parentRules;
|
||||
parentRules.AppendElement(parentRule);
|
||||
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
|
||||
MOZ_RELEASE_ASSERT(styleSet);
|
||||
|
||||
RefPtr<GeckoStyleContext> result =
|
||||
styleSet->ResolveStyleForRules(nullptr, parentRules);
|
||||
|
||||
if (!result) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static bool
|
||||
PropertyIsInheritOrInitial(Declaration* aDeclaration, const nsCSSPropertyID aProperty)
|
||||
{
|
||||
// We know the declaration is not !important, so we can use
|
||||
// GetNormalBlock().
|
||||
const nsCSSValue* filterVal =
|
||||
aDeclaration->GetNormalBlock()->ValueFor(aProperty);
|
||||
return (!filterVal || (filterVal->GetUnit() == eCSSUnit_Unset ||
|
||||
filterVal->GetUnit() == eCSSUnit_Inherit ||
|
||||
filterVal->GetUnit() == eCSSUnit_Initial));
|
||||
}
|
||||
|
||||
static already_AddRefed<GeckoStyleContext>
|
||||
GetFontStyleContext(Element* aElement, const nsAString& aFont,
|
||||
nsIPresShell* aPresShell,
|
||||
nsAString& aOutUsedFont,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
bool fontParsedSuccessfully = false;
|
||||
RefPtr<css::Declaration> decl =
|
||||
CreateFontDeclaration(aFont, aPresShell->GetDocument(),
|
||||
&fontParsedSuccessfully);
|
||||
|
||||
if (!fontParsedSuccessfully) {
|
||||
// We got a syntax error. The spec says this value must be ignored.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// In addition to unparseable values, the spec says we need to reject
|
||||
// 'inherit' and 'initial'. The easiest way to check for this is to look
|
||||
// at font-size-adjust, which the font shorthand resets to either 'none' or
|
||||
// '-moz-system-font'.
|
||||
if (PropertyIsInheritOrInitial(decl, eCSSProperty_font_size_adjust)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// have to get a parent style context for inherit-like relative
|
||||
// values (2em, bolder, etc.)
|
||||
RefPtr<GeckoStyleContext> parentContext =
|
||||
GetFontParentStyleContext(aElement, aPresShell, aError);
|
||||
|
||||
if (aError.Failed()) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(parentContext,
|
||||
"GFX: GetFontParentStyleContext should have returned an error if it couldn't get a parent context.");
|
||||
|
||||
MOZ_ASSERT(!aPresShell->IsDestroying(),
|
||||
"GetFontParentStyleContext should have returned an error if the presshell is being destroyed.");
|
||||
|
||||
nsTArray<nsCOMPtr<nsIStyleRule>> rules;
|
||||
rules.AppendElement(decl);
|
||||
// add a rule to prevent text zoom from affecting the style
|
||||
rules.AppendElement(new nsDisableTextZoomStyleRule);
|
||||
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
|
||||
MOZ_RELEASE_ASSERT(styleSet);
|
||||
|
||||
RefPtr<GeckoStyleContext> sc =
|
||||
styleSet->ResolveStyleForRules(parentContext, rules);
|
||||
|
||||
// The font getter is required to be reserialized based on what we
|
||||
// parsed (including having line-height removed). (Older drafts of
|
||||
// the spec required font sizes be converted to pixels, but that no
|
||||
// longer seems to be required.)
|
||||
decl->GetPropertyValueByID(eCSSProperty_font, aOutUsedFont);
|
||||
|
||||
return sc.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateDeclarationForServo(nsCSSPropertyID aProperty,
|
||||
@ -2955,52 +2746,6 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
||||
return sc.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static already_AddRefed<Declaration>
|
||||
CreateFilterDeclaration(const nsAString& aFilter,
|
||||
nsINode* aNode,
|
||||
bool* aOutFilterChanged)
|
||||
{
|
||||
bool dummy;
|
||||
return CreateDeclaration(aNode,
|
||||
eCSSProperty_filter, aFilter, aOutFilterChanged,
|
||||
eCSSProperty_UNKNOWN, EmptyString(), &dummy);
|
||||
}
|
||||
|
||||
static already_AddRefed<GeckoStyleContext>
|
||||
ResolveFilterStyle(const nsAString& aFilterString,
|
||||
nsIPresShell* aPresShell,
|
||||
GeckoStyleContext* aParentContext,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsIDocument* document = aPresShell->GetDocument();
|
||||
bool filterChanged = false;
|
||||
RefPtr<css::Declaration> decl =
|
||||
CreateFilterDeclaration(aFilterString, document, &filterChanged);
|
||||
|
||||
if (!filterChanged) {
|
||||
// Refuse to accept the filter, but do not throw an error.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// In addition to unparseable values, the spec says we need to reject
|
||||
// 'inherit' and 'initial'.
|
||||
if (PropertyIsInheritOrInitial(decl, eCSSProperty_filter)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsTArray<nsCOMPtr<nsIStyleRule>> rules;
|
||||
rules.AppendElement(decl);
|
||||
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
|
||||
MOZ_RELEASE_ASSERT(styleSet);
|
||||
|
||||
RefPtr<GeckoStyleContext> sc =
|
||||
styleSet->ResolveStyleForRules(aParentContext, rules);
|
||||
|
||||
return sc.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateFilterDeclarationForServo(const nsAString& aFilter,
|
||||
@ -3057,26 +2802,8 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
||||
|
||||
nsString usedFont;
|
||||
if (presShell->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RefPtr<GeckoStyleContext> parentContext =
|
||||
GetFontStyleContext(mCanvasElement, GetFont(),
|
||||
presShell, usedFont, aError);
|
||||
if (!parentContext) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return false;
|
||||
}
|
||||
RefPtr<GeckoStyleContext> sc =
|
||||
ResolveFilterStyle(aString, presShell, parentContext, aError);
|
||||
|
||||
if (!sc) {
|
||||
return false;
|
||||
}
|
||||
aFilterChain = sc->StyleEffects()->mFilters;
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// For stylo
|
||||
@ -4014,12 +3741,7 @@ 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;
|
||||
|
@ -19,9 +19,6 @@
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsIDocShell.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "nsGlobalWindow.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Body)
|
||||
|
@ -8,9 +8,6 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRule.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -11,9 +11,6 @@
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -26,9 +26,6 @@
|
||||
#include "nsIListControlFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
@ -12,9 +12,6 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsAtom.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "celldata.h"
|
||||
#include "mozilla/dom/HTMLTableCellElementBinding.h"
|
||||
|
||||
@ -93,21 +90,6 @@ HTMLTableCellElement::CellIndex() const
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (nsMappedAttributes* tableInheritedAttributes = GetMappedAttributesInheritedFromTable()) {
|
||||
if (tableInheritedAttributes) {
|
||||
aRuleWalker->Forward(tableInheritedAttributes);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsMappedAttributes*
|
||||
HTMLTableCellElement::GetMappedAttributesInheritedFromTable() const
|
||||
|
@ -143,9 +143,6 @@ 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;
|
||||
|
@ -35,9 +35,6 @@
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsNetUtil.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsVideoFrame.h"
|
||||
|
@ -23,9 +23,6 @@
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
@ -2966,39 +2963,7 @@ IsOrHasAncestorWithDisplayNone(Element* aElement, nsIPresShell* aPresShell)
|
||||
return !aElement->HasServoData() || Servo_Element_IsDisplayNone(aElement);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
AutoTArray<Element*, 10> elementsToCheck;
|
||||
// Style and layout work on the flattened tree, so this is what we need to
|
||||
// check in order to figure out whether we're in a display: none subtree.
|
||||
for (Element* e = aElement; e; e = e->GetFlattenedTreeParentElement()) {
|
||||
if (e->GetPrimaryFrame()) {
|
||||
// e definitely isn't display:none and doesn't have a display:none
|
||||
// ancestor.
|
||||
break;
|
||||
}
|
||||
elementsToCheck.AppendElement(e);
|
||||
}
|
||||
|
||||
if (elementsToCheck.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->AsGecko();
|
||||
RefPtr<GeckoStyleContext> sc;
|
||||
for (auto* element : Reversed(elementsToCheck)) {
|
||||
if (sc) {
|
||||
sc = styleSet->ResolveStyleFor(element, sc, LazyComputeBehavior::Assert);
|
||||
} else {
|
||||
sc = nsComputedDOMStyle::GetStyleContextNoFlush(element, nullptr)
|
||||
.downcast<GeckoStyleContext>();
|
||||
}
|
||||
if (sc->StyleDisplay()->mDisplay == StyleDisplay::None) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("Old style system disabled");
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -2301,11 +2301,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority)
|
||||
// Content processes have no permission to access profile directory, so we
|
||||
// send the file URL instead.
|
||||
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());
|
||||
|
@ -12,9 +12,6 @@
|
||||
#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
|
||||
#include "nsCRT.h"
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
@ -75,15 +75,7 @@ nsSMILCSSProperty::GetBaseValue() const
|
||||
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 =
|
||||
|
@ -41,16 +41,8 @@ struct ValueWrapper {
|
||||
mServoValues.AppendElement(aValue.mServo);
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mGeckoValue = aValue.mGecko;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
ValueWrapper(nsCSSPropertyID aPropID, const StyleAnimationValue& aValue)
|
||||
: mPropID(aPropID), mGeckoValue(aValue) {}
|
||||
#endif
|
||||
ValueWrapper(nsCSSPropertyID aPropID,
|
||||
const RefPtr<RawServoAnimationValue>& aValue)
|
||||
: mPropID(aPropID), mServoValues{(aValue)} {}
|
||||
@ -77,11 +69,7 @@ struct ValueWrapper {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return mGeckoValue == aOther.mGeckoValue;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool operator!=(const ValueWrapper& aOther) const
|
||||
@ -91,42 +79,10 @@ struct ValueWrapper {
|
||||
|
||||
nsCSSPropertyID mPropID;
|
||||
ServoAnimationValues mServoValues;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue mGeckoValue;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Helper Methods
|
||||
// --------------
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static const StyleAnimationValue*
|
||||
GetZeroValueForUnit(StyleAnimationValue::Unit aUnit)
|
||||
{
|
||||
static const StyleAnimationValue
|
||||
sZeroCoord(0, StyleAnimationValue::CoordConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroPercent(0.0f, StyleAnimationValue::PercentConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroFloat(0.0f, StyleAnimationValue::FloatConstructor);
|
||||
static const StyleAnimationValue
|
||||
sZeroColor(NS_RGB(0,0,0), StyleAnimationValue::ColorConstructor);
|
||||
|
||||
MOZ_ASSERT(aUnit != StyleAnimationValue::eUnit_Null,
|
||||
"Need non-null unit for a zero value");
|
||||
switch (aUnit) {
|
||||
case StyleAnimationValue::eUnit_Coord:
|
||||
return &sZeroCoord;
|
||||
case StyleAnimationValue::eUnit_Percent:
|
||||
return &sZeroPercent;
|
||||
case StyleAnimationValue::eUnit_Float:
|
||||
return &sZeroFloat;
|
||||
case StyleAnimationValue::eUnit_Color:
|
||||
return &sZeroColor;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If one argument is null, this method updates it to point to "zero"
|
||||
// for the other argument's Unit (if applicable; otherwise, we return false).
|
||||
@ -161,61 +117,6 @@ FinalizeServoAnimationValues(const RefPtr<RawServoAnimationValue>*& aValue1,
|
||||
return *aValue1 && *aValue2;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1,
|
||||
const StyleAnimationValue*& aValue2)
|
||||
{
|
||||
if (!aValue1 && !aValue2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aValue1) {
|
||||
aValue1 = GetZeroValueForUnit(aValue2->GetUnit());
|
||||
return !!aValue1; // Fail if we have no zero value for this unit.
|
||||
}
|
||||
if (!aValue2) {
|
||||
aValue2 = GetZeroValueForUnit(aValue1->GetUnit());
|
||||
return !!aValue2; // Fail if we have no zero value for this unit.
|
||||
}
|
||||
|
||||
// Ok, both values were specified.
|
||||
// Need to handle a special-case, though: unitless nonzero length (parsed as
|
||||
// eUnit_Float) mixed with unitless 0 length (parsed as eUnit_Coord). These
|
||||
// won't interoperate in StyleAnimationValue, since their Units don't match.
|
||||
// In this case, we replace the eUnit_Coord 0 value with eUnit_Float 0 value.
|
||||
const StyleAnimationValue& zeroCoord =
|
||||
*GetZeroValueForUnit(StyleAnimationValue::eUnit_Coord);
|
||||
if (*aValue1 == zeroCoord &&
|
||||
aValue2->GetUnit() == StyleAnimationValue::eUnit_Float) {
|
||||
aValue1 = GetZeroValueForUnit(StyleAnimationValue::eUnit_Float);
|
||||
} else if (*aValue2 == zeroCoord &&
|
||||
aValue1->GetUnit() == StyleAnimationValue::eUnit_Float) {
|
||||
aValue2 = GetZeroValueForUnit(StyleAnimationValue::eUnit_Float);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
InvertSign(StyleAnimationValue& aValue)
|
||||
{
|
||||
switch (aValue.GetUnit()) {
|
||||
case StyleAnimationValue::eUnit_Coord:
|
||||
aValue.SetCoordValue(-aValue.GetCoordValue());
|
||||
break;
|
||||
case StyleAnimationValue::eUnit_Percent:
|
||||
aValue.SetPercentValue(-aValue.GetPercentValue());
|
||||
break;
|
||||
case StyleAnimationValue::eUnit_Float:
|
||||
aValue.SetFloatValue(-aValue.GetFloatValue());
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("Calling InvertSign with an unsupported unit");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static ValueWrapper*
|
||||
ExtractValueWrapper(nsSMILValue& aValue)
|
||||
@ -413,36 +314,7 @@ AddOrAccumulate(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
||||
aCount);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const StyleAnimationValue* valueToAdd = valueToAddWrapper ?
|
||||
&valueToAddWrapper->mGeckoValue : nullptr;
|
||||
const StyleAnimationValue* destValue = destWrapper ?
|
||||
&destWrapper->mGeckoValue : nullptr;
|
||||
if (!FinalizeStyleAnimationValues(valueToAdd, destValue)) {
|
||||
return false;
|
||||
}
|
||||
// Did FinalizeStyleAnimationValues change destValue?
|
||||
// If so, update outparam to use the new value.
|
||||
if (destWrapper && &destWrapper->mGeckoValue != destValue) {
|
||||
destWrapper->mGeckoValue = *destValue;
|
||||
}
|
||||
|
||||
// Handle barely-initialized "zero" destination.
|
||||
if (!destWrapper) {
|
||||
aDest.mU.mPtr = destWrapper = new ValueWrapper(property, *destValue);
|
||||
}
|
||||
|
||||
// For Gecko, we currently call Add for either composite mode.
|
||||
//
|
||||
// This is not ideal, but it doesn't make any difference for the set of
|
||||
// properties we currently allow adding in SMIL and this code path will
|
||||
// hopefully become obsolete before we expand that set.
|
||||
return StyleAnimationValue::Add(property,
|
||||
destWrapper->mGeckoValue,
|
||||
*valueToAdd, aCount);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -519,52 +391,9 @@ 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;
|
||||
if (!FinalizeStyleAnimationValues(fromCSSValue, toCSSValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return StyleAnimationValue::ComputeDistance(toWrapper->mPropID,
|
||||
fromWrapper->mGeckoValue,
|
||||
toWrapper->mGeckoValue,
|
||||
nullptr,
|
||||
aDistance)
|
||||
? NS_OK
|
||||
: NS_ERROR_FAILURE;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static nsresult
|
||||
InterpolateForGecko(const ValueWrapper* aStartWrapper,
|
||||
const ValueWrapper& aEndWrapper,
|
||||
double aUnitDistance,
|
||||
nsSMILValue& aResult)
|
||||
{
|
||||
const StyleAnimationValue* startCSSValue = aStartWrapper
|
||||
? &aStartWrapper->mGeckoValue
|
||||
: nullptr;
|
||||
const StyleAnimationValue* endCSSValue = &aEndWrapper.mGeckoValue;
|
||||
if (!FinalizeStyleAnimationValues(startCSSValue, endCSSValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
StyleAnimationValue resultValue;
|
||||
if (StyleAnimationValue::Interpolate(aEndWrapper.mPropID,
|
||||
*startCSSValue,
|
||||
*endCSSValue,
|
||||
aUnitDistance, resultValue)) {
|
||||
aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, resultValue);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static nsresult
|
||||
InterpolateForServo(const ValueWrapper* aStartWrapper,
|
||||
@ -644,14 +473,7 @@ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
|
||||
aResult);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return InterpolateForGecko(startWrapper,
|
||||
*endWrapper,
|
||||
aUnitDistance,
|
||||
aResult);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper function to extract presContext
|
||||
@ -668,65 +490,6 @@ GetPresContextForElement(Element* aElem)
|
||||
return doc->GetPresContext();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static const nsDependentSubstring
|
||||
GetNonNegativePropValue(const nsAString& aString, nsCSSPropertyID aPropID,
|
||||
bool& aIsNegative)
|
||||
{
|
||||
// If value is negative, we'll strip off the "-" so the CSS parser won't
|
||||
// barf, and then manually make the parsed value negative.
|
||||
// (This is a partial solution to let us accept some otherwise out-of-bounds
|
||||
// CSS values. Bug 501188 will provide a more complete fix.)
|
||||
aIsNegative = false;
|
||||
uint32_t subStringBegin = 0;
|
||||
|
||||
// NOTE: We need to opt-out 'stroke-dasharray' from the negative-number
|
||||
// check. Its values might look negative (e.g. by starting with "-1"), but
|
||||
// they're more complicated than our simple negation logic here can handle.
|
||||
if (aPropID != eCSSProperty_stroke_dasharray) {
|
||||
int32_t absValuePos = nsSMILParserUtils::CheckForNegativeNumber(aString);
|
||||
if (absValuePos > 0) {
|
||||
aIsNegative = true;
|
||||
subStringBegin = (uint32_t)absValuePos; // Start parsing after '-' sign
|
||||
}
|
||||
}
|
||||
|
||||
return Substring(aString, subStringBegin);
|
||||
}
|
||||
|
||||
// Helper function to parse a string into a StyleAnimationValue
|
||||
static bool
|
||||
ValueFromStringHelper(nsCSSPropertyID aPropID,
|
||||
Element* aTargetElement,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::GeckoStyleContext* aStyleContext,
|
||||
const nsAString& aString,
|
||||
StyleAnimationValue& aStyleAnimValue,
|
||||
bool* aIsContextSensitive)
|
||||
{
|
||||
bool isNegative = false;
|
||||
const nsDependentSubstring subString =
|
||||
GetNonNegativePropValue(aString, aPropID, isNegative);
|
||||
|
||||
if (!StyleAnimationValue::ComputeValue(aPropID, aTargetElement, aStyleContext,
|
||||
subString, true, aStyleAnimValue,
|
||||
aIsContextSensitive)) {
|
||||
return false;
|
||||
}
|
||||
if (isNegative) {
|
||||
InvertSign(aStyleAnimValue);
|
||||
}
|
||||
|
||||
if (aPropID == eCSSProperty_font_size) {
|
||||
// Divide out text-zoom, since SVG is supposed to ignore it
|
||||
MOZ_ASSERT(aStyleAnimValue.GetUnit() == StyleAnimationValue::eUnit_Coord,
|
||||
"'font-size' value with unexpected style unit");
|
||||
aStyleAnimValue.SetCoordValue(aStyleAnimValue.GetCoordValue() /
|
||||
aPresContext->EffectiveTextZoom());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ServoAnimationValues
|
||||
ValueFromStringHelper(nsCSSPropertyID aPropID,
|
||||
@ -809,17 +572,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleAnimationValue parsedValue;
|
||||
if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
|
||||
styleContext->AsGecko(), aString, parsedValue,
|
||||
aIsContextSensitive)) {
|
||||
sSingleton.Init(aValue);
|
||||
aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue);
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
@ -864,15 +617,7 @@ nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
|
||||
}
|
||||
|
||||
if (wrapper->mServoValues.IsEmpty()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::UncomputeValue(wrapper->mPropID,
|
||||
wrapper->mGeckoValue,
|
||||
aString);
|
||||
return;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (nsCSSProps::IsShorthand(wrapper->mPropID)) {
|
||||
@ -944,16 +689,6 @@ nsSMILCSSValueType::FinalizeValue(nsSMILValue& aValue,
|
||||
aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
|
||||
Move(zeroValues));
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
const StyleAnimationValue* zeroValue =
|
||||
GetZeroValueForUnit(valueToMatchWrapper->mGeckoValue.GetUnit());
|
||||
if (!zeroValue) {
|
||||
return;
|
||||
}
|
||||
aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
|
||||
*zeroValue);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,6 @@
|
||||
#include "nsError.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
@ -925,26 +921,6 @@ nsSVGElement::NodeInfoChanged(nsIDocument* aOldDoc)
|
||||
OwnerDoc()->ScheduleSVGForPresAttrEvaluation(this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// printf("nsSVGElement(%p)::WalkContentStyleRules()\n", this);
|
||||
#endif
|
||||
if (!mContentDeclarationBlock) {
|
||||
UpdateContentDeclarationBlock(StyleBackendType::Gecko);
|
||||
}
|
||||
|
||||
if (mContentDeclarationBlock) {
|
||||
css::Declaration* declaration = mContentDeclarationBlock->AsGecko();
|
||||
declaration->SetImmutable();
|
||||
aRuleWalker->Forward(declaration);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSVGElement::IsAttributeMapped(const nsAtom* name) const
|
||||
@ -1186,9 +1162,6 @@ private:
|
||||
// MEMBER DATA
|
||||
// -----------
|
||||
css::Loader* mLoader;
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser mParser;
|
||||
#endif
|
||||
|
||||
// Arguments for nsCSSParser::ParseProperty
|
||||
nsIURI* mDocURI;
|
||||
@ -1209,9 +1182,6 @@ MappedAttrParser::MappedAttrParser(css::Loader* aLoader,
|
||||
nsSVGElement* aElement,
|
||||
StyleBackendType aBackend)
|
||||
: mLoader(aLoader)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
, mParser(aLoader)
|
||||
#endif
|
||||
, mDocURI(aDocURI)
|
||||
, mBaseURI(aBaseURI)
|
||||
, mElement(aElement)
|
||||
@ -1232,12 +1202,7 @@ 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();
|
||||
}
|
||||
@ -1250,12 +1215,7 @@ 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
|
||||
@ -1292,16 +1252,7 @@ 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);
|
||||
|
@ -112,10 +112,6 @@ 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;
|
||||
|
||||
|
@ -36,10 +36,6 @@
|
||||
#include "nsXULPrototypeCache.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsRuleProcessorData.h"
|
||||
#endif
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
@ -678,48 +674,6 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsresult
|
||||
nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData,
|
||||
bool* aCutOffInheritance)
|
||||
{
|
||||
*aCutOffInheritance = false;
|
||||
|
||||
NS_ASSERTION(aData->mElement, "How did that happen?");
|
||||
|
||||
// Walk the binding scope chain, starting with the binding attached to our
|
||||
// content, up till we run out of scopes or we get cut off.
|
||||
nsIContent *content = aData->mElement;
|
||||
|
||||
do {
|
||||
nsXBLBinding *binding = content->GetXBLBinding();
|
||||
if (binding) {
|
||||
binding->WalkRules(aFunc, aData);
|
||||
// If we're not looking at our original content, allow the binding to cut
|
||||
// off style inheritance
|
||||
if (content != aData->mElement) {
|
||||
if (!binding->InheritsStyle()) {
|
||||
// Go no further; we're not inheriting style from anything above here
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (content->IsRootOfNativeAnonymousSubtree()) {
|
||||
break; // Deliberately cut off style inheritance here.
|
||||
}
|
||||
|
||||
content = content->GetBindingParent();
|
||||
} while (content);
|
||||
|
||||
// If "content" is non-null that means we cut off inheritance at some point
|
||||
// in the loop.
|
||||
*aCutOffInheritance = (content != nullptr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsBindingManager::EnumerateBoundContentBindings(
|
||||
@ -750,44 +704,14 @@ nsBindingManager::EnumerateBoundContentBindings(
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData)
|
||||
{
|
||||
EnumerateBoundContentBindings([=](nsXBLBinding* aBinding) {
|
||||
nsIStyleRuleProcessor* ruleProcessor =
|
||||
aBinding->PrototypeBinding()->GetRuleProcessor();
|
||||
if (ruleProcessor) {
|
||||
(*(aFunc))(ruleProcessor, aData);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext,
|
||||
mozilla::MediaFeatureChangeReason aReason)
|
||||
{
|
||||
MOZ_ASSERT(!mDocument->IsStyledByServo());
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
bool rulesChanged = false;
|
||||
RefPtr<nsPresContext> presContext = aPresContext;
|
||||
EnumerateBoundContentBindings([=, &rulesChanged](nsXBLBinding* aBinding) {
|
||||
nsIStyleRuleProcessor* ruleProcessor =
|
||||
aBinding->PrototypeBinding()->GetRuleProcessor();
|
||||
if (ruleProcessor) {
|
||||
bool thisChanged = ruleProcessor->MediumFeaturesChanged(presContext);
|
||||
rulesChanged = rulesChanged || thisChanged;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return rulesChanged;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -126,15 +126,6 @@ public:
|
||||
|
||||
nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Style rule methods
|
||||
nsresult WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
ElementDependentRuleProcessorData* aData,
|
||||
bool* aCutOffInheritance);
|
||||
|
||||
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,18 +825,6 @@ nsXBLBinding::InheritsStyle() const
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
|
||||
{
|
||||
if (mNextBinding)
|
||||
mNextBinding->WalkRules(aFunc, aData);
|
||||
|
||||
nsIStyleRuleProcessor *rules = mPrototypeBinding->GetRuleProcessor();
|
||||
if (rules)
|
||||
(*aFunc)(rules, aData);
|
||||
}
|
||||
#endif
|
||||
|
||||
const RawServoAuthorStyles*
|
||||
nsXBLBinding::GetServoStyles() const
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "nsXBLService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINodeList.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -131,9 +128,6 @@ public:
|
||||
|
||||
void ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument);
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData);
|
||||
#endif
|
||||
|
||||
const RawServoAuthorStyles* GetServoStyles() const;
|
||||
|
||||
|
@ -39,9 +39,6 @@
|
||||
#include "nsIInterfaceInfo.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsXBLResourceLoader.h"
|
||||
#include "mozilla/dom/CDATASection.h"
|
||||
#include "mozilla/dom/Comment.h"
|
||||
@ -592,17 +589,6 @@ nsXBLPrototypeBinding::SetInitialAttributes(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor*
|
||||
nsXBLPrototypeBinding::GetRuleProcessor()
|
||||
{
|
||||
if (mResources) {
|
||||
return mResources->GetRuleProcessor();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::EnsureAttributeTable()
|
||||
|
@ -133,9 +133,6 @@ public:
|
||||
bool HasStyleSheets() const;
|
||||
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsIStyleRuleProcessor* GetRuleProcessor();
|
||||
#endif
|
||||
|
||||
const RawServoAuthorStyles* GetServoStyles() const
|
||||
{
|
||||
|
@ -4,9 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -17,10 +14,6 @@
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "mozilla/dom/URL.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
@ -122,11 +115,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
|
||||
ComputeServoStyles(*shell->StyleSet()->AsServo());
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
GatherRuleProcessor();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -146,9 +135,6 @@ 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");
|
||||
}
|
||||
|
||||
@ -156,9 +142,6 @@ void
|
||||
nsXBLPrototypeResources::Unlink()
|
||||
{
|
||||
mStyleSheetList.Clear();
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mRuleProcessor = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -167,24 +150,6 @@ nsXBLPrototypeResources::ClearLoader()
|
||||
mLoader = nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsXBLPrototypeResources::GatherRuleProcessor()
|
||||
{
|
||||
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
|
||||
for (StyleSheet* sheet : mStyleSheetList) {
|
||||
MOZ_ASSERT(sheet->IsGecko(),
|
||||
"GatherRuleProcessor must only be called for "
|
||||
"nsXBLPrototypeResources objects with Gecko-flavored style "
|
||||
"backends");
|
||||
sheets.AppendElement(sheet->AsGecko());
|
||||
}
|
||||
mRuleProcessor = new nsCSSRuleProcessor(Move(sheets),
|
||||
SheetType::Doc,
|
||||
nullptr,
|
||||
mRuleProcessor);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsXBLPrototypeResources::SyncServoStyles()
|
||||
@ -254,9 +219,6 @@ nsXBLPrototypeResources::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
for (const auto& sheet : mStyleSheetList) {
|
||||
n += sheet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
n += mRuleProcessor ? mRuleProcessor->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
#endif
|
||||
n += mServoStyles ? Servo_AuthorStyles_SizeOfIncludingThis(
|
||||
ServoAuthorStylesMallocSizeOf,
|
||||
ServoAuthorStylesMallocEnclosingSizeOf,
|
||||
|
@ -67,16 +67,6 @@ public:
|
||||
|
||||
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
|
||||
* nsStyleSet::GatherRuleProcessors.)
|
||||
*/
|
||||
void GatherRuleProcessor();
|
||||
|
||||
nsCSSRuleProcessor* GetRuleProcessor() const { return mRuleProcessor; }
|
||||
#endif
|
||||
|
||||
const RawServoAuthorStyles* GetServoStyles() const
|
||||
{
|
||||
@ -104,10 +94,6 @@ private:
|
||||
// mServoStyles.
|
||||
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.
|
||||
|
@ -7,9 +7,6 @@
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
@ -28,13 +25,7 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#endif
|
||||
#include "nsContentUtils.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -192,11 +183,7 @@ 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->ComputeServoStyles(
|
||||
*mBoundDocument->GetShell()->StyleSet()->AsServo());
|
||||
|
@ -36,9 +36,6 @@
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "nsIURL.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIWidget.h"
|
||||
@ -52,9 +49,6 @@
|
||||
#include "nsPIBoxObject.h"
|
||||
#include "XULDocument.h"
|
||||
#include "nsXULPopupListener.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "nsCSSParser.h"
|
||||
#include "ListBoxObject.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -1443,13 +1437,6 @@ 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,
|
||||
@ -2390,13 +2377,7 @@ 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,9 +389,6 @@ 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;
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/DeclarationBlockInlines.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "nsAString.h"
|
||||
|
@ -3007,11 +3007,7 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -132,65 +132,6 @@ CompositorAnimationStorage::SetAnimations(uint64_t aId, const AnimationArray& aV
|
||||
mAnimations.Put(aId, value);
|
||||
}
|
||||
|
||||
#ifndef MOZ_STYLO
|
||||
static StyleAnimationValue
|
||||
SampleValue(double aPortion, const layers::Animation& aAnimation,
|
||||
const AnimationPropertySegment&& aSegment,
|
||||
const StyleAnimationValue& aLastValue,
|
||||
uint64_t aCurrentIteration,
|
||||
const StyleAnimationValue& aUnderlyingValue)
|
||||
{
|
||||
NS_ASSERTION(aSegment.mFromValue.mGecko.IsNull() ||
|
||||
aSegment.mToValue.mGecko.IsNull() ||
|
||||
aSegment.mFromValue.mGecko.GetUnit() ==
|
||||
aSegment.mToValue.mGecko.GetUnit(),
|
||||
"Must have same unit");
|
||||
|
||||
StyleAnimationValue startValue =
|
||||
dom::KeyframeEffectReadOnly::CompositeValue(aAnimation.property(),
|
||||
aSegment.mFromValue.mGecko,
|
||||
aUnderlyingValue,
|
||||
aSegment.mFromComposite);
|
||||
StyleAnimationValue endValue =
|
||||
dom::KeyframeEffectReadOnly::CompositeValue(aAnimation.property(),
|
||||
aSegment.mToValue.mGecko,
|
||||
aUnderlyingValue,
|
||||
aSegment.mToComposite);
|
||||
|
||||
// Iteration composition for accumulate
|
||||
if (static_cast<dom::IterationCompositeOperation>
|
||||
(aAnimation.iterationComposite()) ==
|
||||
dom::IterationCompositeOperation::Accumulate &&
|
||||
aCurrentIteration > 0) {
|
||||
// FIXME: Bug 1293492: Add a utility function to calculate both of
|
||||
// below StyleAnimationValues.
|
||||
startValue =
|
||||
StyleAnimationValue::Accumulate(aAnimation.property(),
|
||||
aLastValue.IsNull()
|
||||
? aUnderlyingValue
|
||||
: aLastValue,
|
||||
Move(startValue),
|
||||
aCurrentIteration);
|
||||
endValue =
|
||||
StyleAnimationValue::Accumulate(aAnimation.property(),
|
||||
aLastValue.IsNull()
|
||||
? aUnderlyingValue
|
||||
: aLastValue,
|
||||
Move(endValue),
|
||||
aCurrentIteration);
|
||||
}
|
||||
|
||||
StyleAnimationValue interpolatedValue;
|
||||
// This should never fail because we only pass transform and opacity values
|
||||
// to the compositor and they should never fail to interpolate.
|
||||
DebugOnly<bool> uncomputeResult =
|
||||
StyleAnimationValue::Interpolate(aAnimation.property(),
|
||||
startValue, endValue,
|
||||
aPortion, interpolatedValue);
|
||||
MOZ_ASSERT(uncomputeResult, "could not uncompute value");
|
||||
return interpolatedValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
AnimationHelper::SampleAnimationForEachNode(
|
||||
@ -278,7 +219,6 @@ AnimationHelper::SampleAnimationForEachNode(
|
||||
static_cast<dom::CompositeOperation>(segment->endComposite());
|
||||
|
||||
// interpolate the property
|
||||
#ifdef MOZ_STYLO
|
||||
dom::IterationCompositeOperation iterCompositeOperation =
|
||||
static_cast<dom::IterationCompositeOperation>(
|
||||
animation.iterationComposite());
|
||||
@ -291,17 +231,6 @@ AnimationHelper::SampleAnimationForEachNode(
|
||||
iterCompositeOperation,
|
||||
portion,
|
||||
computedTiming.mCurrentIteration).Consume();
|
||||
#elif MOZ_OLD_STYLE
|
||||
aAnimationValue.mGecko =
|
||||
SampleValue(portion,
|
||||
animation,
|
||||
Move(animSegment),
|
||||
animData.mEndValues.LastElement().mGecko,
|
||||
computedTiming.mCurrentIteration,
|
||||
aAnimationValue.mGecko);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
aHasInEffectAnimations = true;
|
||||
}
|
||||
|
||||
@ -480,11 +409,7 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||
static AnimationValue
|
||||
ToAnimationValue(const Animatable& aAnimatable)
|
||||
{
|
||||
#ifdef MOZ_STYLO
|
||||
StyleBackendType backend = StyleBackendType::Servo;
|
||||
#else
|
||||
StyleBackendType backend = StyleBackendType::Gecko;
|
||||
#endif
|
||||
AnimationValue result;
|
||||
|
||||
switch (aAnimatable.type()) {
|
||||
|
@ -14,9 +14,6 @@
|
||||
#include "base/task.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDocument.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
|
||||
#define AEM_LOG(...)
|
||||
// #define AEM_LOG(...) printf_stderr("AEM: " __VA_ARGS__)
|
||||
|
@ -183,9 +183,6 @@
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
#include "mozilla/layers/InputAPZContext.h"
|
||||
#include "mozilla/layers/FocusTarget.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
@ -612,12 +609,7 @@ 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)
|
||||
@ -4398,21 +4390,7 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
|
||||
if (mStyleSet->IsServo()) {
|
||||
mStyleSet->AsServo()->InvalidateStyleForDocumentStateChanges(aStateMask);
|
||||
} 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
|
||||
}
|
||||
}
|
||||
|
||||
@ -9621,15 +9599,6 @@ CopySheetsIntoClone(StyleSetHandle aSet, StyleSetHandle aClone)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet*
|
||||
PresShell::CloneStyleSet(nsStyleSet* aSet)
|
||||
{
|
||||
nsStyleSet* clone = new nsStyleSet();
|
||||
CopySheetsIntoClone(aSet, clone);
|
||||
return clone;
|
||||
}
|
||||
#endif
|
||||
|
||||
ServoStyleSet*
|
||||
PresShell::CloneStyleSet(ServoStyleSet* aSet)
|
||||
@ -9689,27 +9658,16 @@ 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
|
||||
@ -10439,11 +10397,7 @@ PresShell::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
||||
mFramesToDirty.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
if (StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
StyleSet()->AsGecko()->AddSizeOfIncludingThis(aSizes);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
StyleSet()->AsServo()->AddSizeOfIncludingThis(aSizes);
|
||||
}
|
||||
@ -10644,14 +10598,7 @@ nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
|
||||
{
|
||||
*aRetVal = false;
|
||||
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;
|
||||
}
|
||||
|
@ -508,9 +508,6 @@ private:
|
||||
bool mCaretEnabled;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsStyleSet* CloneStyleSet(nsStyleSet* aSet);
|
||||
#endif
|
||||
ServoStyleSet* CloneStyleSet(ServoStyleSet* aSet);
|
||||
bool VerifyIncrementalReflow();
|
||||
bool mInVerifyReflow;
|
||||
|
@ -14,9 +14,6 @@
|
||||
#include "mozilla/AutoRestore.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#define RESTYLE_LOGGING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RESTYLE_LOGGING
|
||||
|
@ -625,154 +625,6 @@ static bool gInApplyRenderingChangeToTree = false;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static void
|
||||
DumpContext(nsIFrame* aFrame, nsStyleContext* aContext)
|
||||
{
|
||||
if (aFrame) {
|
||||
fputs("frame: ", stdout);
|
||||
nsAutoString name;
|
||||
aFrame->GetFrameName(name);
|
||||
fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
|
||||
fprintf(stdout, " (%p)", static_cast<void*>(aFrame));
|
||||
}
|
||||
if (aContext) {
|
||||
fprintf(stdout, " style: %p ", static_cast<void*>(aContext));
|
||||
|
||||
nsAtom* pseudoTag = aContext->GetPseudo();
|
||||
if (pseudoTag) {
|
||||
nsAutoString buffer;
|
||||
pseudoTag->ToString(buffer);
|
||||
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), stdout);
|
||||
fputs(" ", stdout);
|
||||
}
|
||||
fputs("{}\n", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
VerifySameTree(GeckoStyleContext* aContext1, GeckoStyleContext* aContext2)
|
||||
{
|
||||
GeckoStyleContext* top1 = aContext1;
|
||||
GeckoStyleContext* top2 = aContext2;
|
||||
GeckoStyleContext* parent;
|
||||
for (;;) {
|
||||
parent = top1->GetParent();
|
||||
if (!parent)
|
||||
break;
|
||||
top1 = parent;
|
||||
}
|
||||
for (;;) {
|
||||
parent = top2->GetParent();
|
||||
if (!parent)
|
||||
break;
|
||||
top2 = parent;
|
||||
}
|
||||
NS_ASSERTION(top1 == top2,
|
||||
"Style contexts are not in the same style context tree");
|
||||
}
|
||||
|
||||
static void
|
||||
VerifyContextParent(nsIFrame* aFrame, GeckoStyleContext* aContext,
|
||||
GeckoStyleContext* aParentContext)
|
||||
{
|
||||
// get the contexts not provided
|
||||
if (!aContext) {
|
||||
aContext = aFrame->StyleContext()->AsGecko();
|
||||
}
|
||||
|
||||
if (!aParentContext) {
|
||||
nsIFrame* providerFrame;
|
||||
nsStyleContext* parent = aFrame->GetParentStyleContext(&providerFrame);
|
||||
aParentContext = parent ? parent->AsGecko() : nullptr;
|
||||
// aParentContext could still be null
|
||||
}
|
||||
|
||||
NS_ASSERTION(aContext, "Failure to get required contexts");
|
||||
GeckoStyleContext* actualParentContext = aContext->GetParent();
|
||||
|
||||
if (aParentContext) {
|
||||
if (aParentContext != actualParentContext) {
|
||||
DumpContext(aFrame, aContext);
|
||||
if (aContext == aParentContext) {
|
||||
NS_ERROR("Using parent's style context");
|
||||
} else {
|
||||
NS_ERROR("Wrong parent style context");
|
||||
fputs("Wrong parent style context: ", stdout);
|
||||
DumpContext(nullptr, actualParentContext);
|
||||
fputs("should be using: ", stdout);
|
||||
DumpContext(nullptr, aParentContext);
|
||||
VerifySameTree(actualParentContext, aParentContext);
|
||||
fputs("\n", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (actualParentContext) {
|
||||
NS_ERROR("Have parent context and shouldn't");
|
||||
DumpContext(aFrame, aContext);
|
||||
fputs("Has parent context: ", stdout);
|
||||
DumpContext(nullptr, actualParentContext);
|
||||
fputs("Should be null\n\n", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
GeckoStyleContext* childStyleIfVisited = aContext->GetStyleIfVisited();
|
||||
// Either childStyleIfVisited has aContext->GetParent()->GetStyleIfVisited()
|
||||
// as the parent or it has a different rulenode from aContext _and_ has
|
||||
// aContext->GetParent() as the parent.
|
||||
if (childStyleIfVisited &&
|
||||
!((childStyleIfVisited->RuleNode() != aContext->RuleNode() &&
|
||||
childStyleIfVisited->GetParent() == aContext->GetParent()) ||
|
||||
childStyleIfVisited->GetParent() ==
|
||||
aContext->GetParent()->GetStyleIfVisited())) {
|
||||
NS_ERROR("Visited style has wrong parent");
|
||||
DumpContext(aFrame, aContext);
|
||||
fputs("\n", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
VerifyStyleTree(nsIFrame* aFrame)
|
||||
{
|
||||
GeckoStyleContext* context = aFrame->StyleContext()->AsGecko();
|
||||
VerifyContextParent(aFrame, context, nullptr);
|
||||
|
||||
nsIFrame::ChildListIterator lists(aFrame);
|
||||
for (; !lists.IsDone(); lists.Next()) {
|
||||
for (nsIFrame* child : lists.CurrentList()) {
|
||||
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
|
||||
// only do frames that are in flow
|
||||
if (child->IsPlaceholderFrame()) {
|
||||
// placeholder: first recurse and verify the out of flow frame,
|
||||
// then verify the placeholder's context
|
||||
nsIFrame* outOfFlowFrame =
|
||||
nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
|
||||
|
||||
// recurse to out of flow frame, letting the parent context get resolved
|
||||
do {
|
||||
VerifyStyleTree(outOfFlowFrame);
|
||||
} while ((outOfFlowFrame = outOfFlowFrame->GetNextContinuation()));
|
||||
|
||||
// verify placeholder using the parent frame's context as
|
||||
// parent context
|
||||
VerifyContextParent(child, nullptr, nullptr);
|
||||
} else { // regular frame
|
||||
VerifyStyleTree(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// do additional contexts
|
||||
int32_t contextIndex = 0;
|
||||
for (nsStyleContext* extraContext;
|
||||
(extraContext = aFrame->GetAdditionalStyleContext(contextIndex));
|
||||
++contextIndex) {
|
||||
VerifyContextParent(aFrame, extraContext->AsGecko(), context);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
|
||||
@ -783,13 +635,7 @@ 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
|
||||
@ -1905,13 +1751,7 @@ RestyleManager::IncrementAnimationGeneration()
|
||||
// ProcessPendingRestyles so we should ignore any subsequent (redundant)
|
||||
// calls that occur while we are still processing restyles.
|
||||
if (IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (AsGecko()->IsProcessingRestyles()) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
if (mInStyleRefresh) {
|
||||
return;
|
||||
|
@ -7,9 +7,6 @@
|
||||
#ifndef mozilla_RestyleManagerInlines_h
|
||||
#define mozilla_RestyleManagerInlines_h
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoRestyleManager.h"
|
||||
#endif
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/ServoUtils.h"
|
||||
|
||||
|
@ -335,35 +335,6 @@ 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
|
||||
{
|
||||
public:
|
||||
explicit TreeMatchContextHolder(nsIDocument* aDocument)
|
||||
{
|
||||
if (!aDocument->IsStyledByServo()) {
|
||||
mMaybeTreeMatchContext.emplace(aDocument,
|
||||
TreeMatchContext::ForFrameConstruction);
|
||||
}
|
||||
}
|
||||
|
||||
bool Exists() const { return mMaybeTreeMatchContext.isSome(); }
|
||||
operator TreeMatchContext*() { return mMaybeTreeMatchContext.ptrOr(nullptr); }
|
||||
|
||||
TreeMatchContext* operator ->()
|
||||
{
|
||||
MOZ_ASSERT(mMaybeTreeMatchContext.isSome());
|
||||
return mMaybeTreeMatchContext.ptr();
|
||||
}
|
||||
|
||||
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.
|
||||
@ -376,7 +347,6 @@ public:
|
||||
TreeMatchContext* operator->() { MOZ_CRASH("old style system disabled"); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Returns true if aFrame is an anonymous flex/grid item.
|
||||
static inline bool
|
||||
@ -896,11 +866,7 @@ 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
|
||||
@ -1048,7 +1014,6 @@ protected:
|
||||
PendingBinding* mCurrentPendingBindingInsertionPoint;
|
||||
};
|
||||
|
||||
#ifndef MOZ_OLD_STYLE
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -1063,7 +1028,6 @@ public:
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
||||
nsFrameConstructorState::nsFrameConstructorState(
|
||||
nsIPresShell* aPresShell,
|
||||
@ -1982,29 +1946,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
||||
styleSet->AsServo()->ResolveServoStyle(container);
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
|
||||
GeckoRestyleManager::ReframingStyleContexts* rsc =
|
||||
geckoRM->GetReframingStyleContexts();
|
||||
|
||||
if (rsc) {
|
||||
RefPtr<GeckoStyleContext> newContext =
|
||||
GeckoStyleContext::TakeRef(pseudoStyleContext.forget());
|
||||
if (auto* oldStyleContext = rsc->Get(container, aPseudoElement)) {
|
||||
GeckoRestyleManager::TryInitiatingTransition(aState.mPresContext,
|
||||
container,
|
||||
oldStyleContext,
|
||||
&newContext);
|
||||
} else {
|
||||
aState.mPresContext->TransitionManager()->
|
||||
PruneCompletedTransitions(aParentContent->AsElement(),
|
||||
aPseudoElement, newContext);
|
||||
}
|
||||
pseudoStyleContext = newContext.forget();
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t contentCount = pseudoStyleContext->StyleContent()->ContentCount();
|
||||
@ -5289,29 +5231,7 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
||||
// it probably won't need to track reframed style contexts to start
|
||||
// transitions correctly.
|
||||
if (RestyleManager()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
|
||||
GeckoRestyleManager::ReframingStyleContexts* rsc =
|
||||
geckoRM->GetReframingStyleContexts();
|
||||
if (rsc) {
|
||||
GeckoStyleContext* oldStyleContext =
|
||||
rsc->Get(aContent, CSSPseudoElementType::NotPseudo);
|
||||
nsPresContext* presContext = mPresShell->GetPresContext();
|
||||
if (oldStyleContext) {
|
||||
RefPtr<GeckoStyleContext> newContext =
|
||||
GeckoStyleContext::TakeRef(result.forget());
|
||||
GeckoRestyleManager::TryInitiatingTransition(presContext, aContent,
|
||||
oldStyleContext, &newContext);
|
||||
result = newContext.forget();
|
||||
} else if (aContent->IsElement()) {
|
||||
presContext->TransitionManager()->
|
||||
PruneCompletedTransitions(aContent->AsElement(),
|
||||
CSSPseudoElementType::NotPseudo, result->AsGecko());
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
return result.forget();
|
||||
@ -5994,13 +5914,7 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
@ -7287,16 +7201,7 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
||||
CheckBitsForLazyFrameConstruction(parent);
|
||||
|
||||
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();
|
||||
}
|
||||
@ -7304,103 +7209,6 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
nsCSSFrameConstructor::CreateNeededFrames(
|
||||
nsIContent* aContent,
|
||||
TreeMatchContext& aTreeMatchContext)
|
||||
{
|
||||
MOZ_ASSERT(!aContent->IsStyledByServo());
|
||||
NS_ASSERTION(!aContent->HasFlag(NODE_NEEDS_FRAME),
|
||||
"shouldn't get here with a content node that has needs frame bit set");
|
||||
NS_ASSERTION(aContent->HasFlag(NODE_DESCENDANTS_NEED_FRAMES),
|
||||
"should only get here with a content node that has descendants needing frames");
|
||||
MOZ_ASSERT(aTreeMatchContext.mAncestorFilter.HasFilter(),
|
||||
"The whole point of having the tree match context is optimizing "
|
||||
"the ancestor filter usage!");
|
||||
|
||||
aContent->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES);
|
||||
|
||||
// We could either descend first (on nodes that don't have NODE_NEEDS_FRAME
|
||||
// set) or issue content notifications for our kids first. In absence of
|
||||
// anything definitive either way we'll go with the latter.
|
||||
|
||||
// It might be better to use GetChildArray and scan it completely first and
|
||||
// then issue all notifications. (We have to scan it completely first because
|
||||
// constructing frames can set attributes, which can change the storage of
|
||||
// child lists).
|
||||
|
||||
// Scan the children of aContent to see what operations (if any) we need to
|
||||
// perform.
|
||||
bool inRun = false;
|
||||
nsIContent* firstChildInRun = nullptr;
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child; child = child->GetNextSibling()) {
|
||||
if (child->HasFlag(NODE_NEEDS_FRAME)) {
|
||||
NS_ASSERTION(!child->GetPrimaryFrame() ||
|
||||
child->GetPrimaryFrame()->GetContent() != child,
|
||||
//XXX the child->GetPrimaryFrame()->GetContent() != child
|
||||
// check is needed due to bug 135040. Remove it once that's
|
||||
// fixed.
|
||||
"NEEDS_FRAME set on a node that already has a frame?");
|
||||
if (!inRun) {
|
||||
inRun = true;
|
||||
firstChildInRun = child;
|
||||
}
|
||||
} else {
|
||||
if (inRun) {
|
||||
inRun = false;
|
||||
// generate a ContentRangeInserted for [startOfRun,i)
|
||||
ContentRangeInserted(aContent, firstChildInRun, child, nullptr,
|
||||
InsertionKind::Sync,
|
||||
&aTreeMatchContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inRun) {
|
||||
ContentAppended(aContent, firstChildInRun,
|
||||
InsertionKind::Sync,
|
||||
&aTreeMatchContext);
|
||||
}
|
||||
|
||||
// Now descend.
|
||||
FlattenedChildIterator iter(aContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->HasFlag(NODE_DESCENDANTS_NEED_FRAMES)) {
|
||||
TreeMatchContext::AutoAncestorPusher insertionPointPusher(
|
||||
&aTreeMatchContext);
|
||||
|
||||
// Handle stuff like xbl:children.
|
||||
if (child->GetParent() != aContent && child->GetParent()->IsElement()) {
|
||||
insertionPointPusher.PushAncestor(child->GetParent()->AsElement());
|
||||
}
|
||||
|
||||
TreeMatchContext::AutoAncestorPusher pusher(&aTreeMatchContext);
|
||||
pusher.PushAncestor(child);
|
||||
|
||||
CreateNeededFrames(child, aTreeMatchContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::CreateNeededFrames()
|
||||
{
|
||||
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
||||
"Someone forgot a script blocker");
|
||||
|
||||
Element* rootElement = mDocument->GetRootElement();
|
||||
NS_ASSERTION(!rootElement || !rootElement->HasFlag(NODE_NEEDS_FRAME),
|
||||
"root element should not have frame created lazily");
|
||||
if (rootElement && rootElement->HasFlag(NODE_DESCENDANTS_NEED_FRAMES)) {
|
||||
TreeMatchContext treeMatchContext(
|
||||
mDocument, TreeMatchContext::ForFrameConstruction);
|
||||
treeMatchContext.InitAncestors(rootElement);
|
||||
CreateNeededFrames(rootElement, treeMatchContext);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer,
|
||||
@ -9392,59 +9200,6 @@ nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool
|
||||
DefinitelyEqualURIsAndPrincipal(mozilla::css::URLValue* aURI1,
|
||||
mozilla::css::URLValue* aURI2)
|
||||
{
|
||||
return aURI1 == aURI2 ||
|
||||
(aURI1 && aURI2 && aURI1->DefinitelyEqualURIsAndPrincipal(*aURI2));
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement)
|
||||
{
|
||||
RefPtr<nsStyleContext> oldContext = GetDisplayNoneStyleFor(aElement);
|
||||
StyleDisplay oldDisplay = StyleDisplay::None;
|
||||
if (!oldContext) {
|
||||
oldContext = GetDisplayContentsStyleFor(aElement);
|
||||
if (!oldContext) {
|
||||
return nullptr;
|
||||
}
|
||||
oldDisplay = StyleDisplay::Contents;
|
||||
}
|
||||
|
||||
// The parent has a frame, so try resolving a new context.
|
||||
RefPtr<nsStyleContext> newContext = mPresShell->StyleSet()->
|
||||
ResolveStyleFor(aElement, oldContext->AsGecko()->GetParent(),
|
||||
LazyComputeBehavior::Assert);
|
||||
|
||||
if (oldDisplay == StyleDisplay::None) {
|
||||
ChangeRegisteredDisplayNoneStyleFor(aElement, newContext);
|
||||
} else {
|
||||
ChangeRegisteredDisplayContentsStyleFor(aElement, newContext);
|
||||
}
|
||||
|
||||
const nsStyleDisplay* disp = newContext->StyleDisplay();
|
||||
if (oldDisplay == disp->mDisplay) {
|
||||
// We can skip trying to recreate frames here, but only if our style
|
||||
// context does not have a binding URI that differs from our old one.
|
||||
// Otherwise, we should try to recreate, because we may want to apply the
|
||||
// new binding
|
||||
if (!disp->mBinding) {
|
||||
return newContext;
|
||||
}
|
||||
const nsStyleDisplay* oldDisp = oldContext->PeekStyleDisplay();
|
||||
if (oldDisp &&
|
||||
DefinitelyEqualURIsAndPrincipal(disp->mBinding, oldDisp->mBinding)) {
|
||||
return newContext;
|
||||
}
|
||||
}
|
||||
|
||||
RecreateFramesForContent(aElement, InsertionKind::Sync);
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
IsWhitespaceFrame(nsIFrame* aFrame)
|
||||
|
@ -100,20 +100,9 @@ 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,
|
||||
@ -1865,16 +1854,6 @@ 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
|
||||
* (display:none/contents) which will have their style context updated in the
|
||||
* frame manager undisplayed maps.
|
||||
* @return null if frames were recreated, the new style context otherwise
|
||||
*/
|
||||
nsStyleContext* MaybeRecreateFramesForElement(Element* aElement);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Recreate frames for aContent.
|
||||
|
@ -2321,11 +2321,7 @@ 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();
|
||||
}
|
||||
|
@ -196,9 +196,7 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
|
||||
/* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
|
||||
/* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
|
||||
/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
|
||||
#ifdef MOZ_STYLO
|
||||
/* static */ bool nsLayoutUtils::sStyloEnabled;
|
||||
#endif
|
||||
/* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
|
||||
/* static */ uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
|
||||
|
||||
@ -8282,20 +8280,7 @@ nsLayoutUtils::Initialize()
|
||||
"svg.transform-box.enabled");
|
||||
Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled,
|
||||
"layout.css.text-combine-upright-digits.enabled");
|
||||
#ifdef MOZ_STYLO
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (PR_GetEnv("STYLO_FORCE_ENABLED")) {
|
||||
sStyloEnabled = true;
|
||||
} else if (PR_GetEnv("STYLO_FORCE_DISABLED")) {
|
||||
sStyloEnabled = false;
|
||||
} else {
|
||||
Preferences::AddBoolVarCache(&sStyloEnabled,
|
||||
"layout.css.servo.enabled");
|
||||
}
|
||||
#else
|
||||
sStyloEnabled = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
|
||||
"layout.idle_period.time_limit",
|
||||
@ -8328,21 +8313,10 @@ nsLayoutUtils::Shutdown()
|
||||
nsStyleList::Shutdown();
|
||||
}
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
/* static */
|
||||
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
|
||||
// they don't matter, and we shouldn't respect them at the same time.
|
||||
if (!StyloChromeEnabled() &&
|
||||
nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -8350,21 +8324,8 @@ nsLayoutUtils::ShouldUseStylo(nsIPrincipal* aPrincipal)
|
||||
bool
|
||||
nsLayoutUtils::StyloChromeEnabled()
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
static bool sInitialized = false;
|
||||
static bool sEnabled = false;
|
||||
if (!sInitialized) {
|
||||
// We intentionally don't allow dynamic toggling of this pref
|
||||
// because it is rather risky to mix style backend in XUL.
|
||||
sEnabled = Preferences::GetBool("layout.css.servo.chrome.enabled");
|
||||
sInitialized = true;
|
||||
}
|
||||
return sEnabled;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */
|
||||
void
|
||||
|
@ -24,9 +24,6 @@
|
||||
#include "nsStyleCoord.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
#include "imgIContainer.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "Units.h"
|
||||
@ -2528,18 +2525,11 @@ 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() {
|
||||
#if defined(MOZ_STYLO) && defined(MOZ_OLD_STYLE)
|
||||
return sStyloEnabled && StyloSupportedInCurrentProcess();
|
||||
#elif defined(MOZ_STYLO)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Whether Stylo should be allowed to be enabled in this process.
|
||||
static bool StyloSupportedInCurrentProcess() {
|
||||
#ifdef MOZ_STYLO
|
||||
if (XRE_IsContentProcess()) {
|
||||
return true;
|
||||
}
|
||||
@ -2552,17 +2542,14 @@ public:
|
||||
// Otherwise we only use stylo on non-e10s parent.
|
||||
return !XRE_IsE10sParentProcess();
|
||||
}
|
||||
#endif
|
||||
// Stylo is not enabled for any other process.
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "We should not be creating any document "
|
||||
"in processes other than content and parent");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
// Whether Stylo should be used on chrome documents.
|
||||
static bool StyloChromeEnabled();
|
||||
#endif
|
||||
|
||||
static uint32_t IdlePeriodDeadlineLimit() {
|
||||
return sIdlePeriodDeadlineLimit;
|
||||
@ -2592,16 +2579,10 @@ public:
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
/**
|
||||
* Return whether stylo should be used for a given document principal.
|
||||
*/
|
||||
static bool ShouldUseStylo(nsIPrincipal* aPrincipal);
|
||||
#else
|
||||
static bool ShouldUseStylo(nsIPrincipal* aPrincipal) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Register an imgIRequest object with a refresh driver.
|
||||
@ -3120,9 +3101,7 @@ private:
|
||||
static bool sInterruptibleReflowEnabled;
|
||||
static bool sSVGTransformBoxEnabled;
|
||||
static bool sTextCombineUprightDigitsEnabled;
|
||||
#ifdef MOZ_STYLO
|
||||
static bool sStyloEnabled;
|
||||
#endif
|
||||
static uint32_t sIdlePeriodDeadlineLimit;
|
||||
static uint32_t sQuiescentFramesBeforeIdlePeriod;
|
||||
|
||||
|
@ -12,9 +12,6 @@
|
||||
#include "mozilla/Poison.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "GeckoStyleContext.h"
|
||||
#endif
|
||||
#include "FrameLayerBuilder.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsStyleContext.h"
|
||||
|
@ -38,20 +38,11 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsViewManager.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoRestyleManager.h"
|
||||
#endif
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/RestyleManagerInlines.h"
|
||||
#include "SurfaceCacheUtils.h"
|
||||
#include "nsMediaFeatures.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
#include "gfxPlatform.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRules.h"
|
||||
#endif
|
||||
#include "nsFontFaceLoader.h"
|
||||
#include "mozilla/AnimationEventDispatcher.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
@ -126,35 +117,6 @@ public:
|
||||
nsPresContext* mPresContext;
|
||||
};
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|
||||
namespace {
|
||||
|
||||
class CharSetChangingRunnable : public Runnable
|
||||
{
|
||||
public:
|
||||
CharSetChangingRunnable(nsPresContext* aPresContext,
|
||||
NotNull<const Encoding*> aCharSet)
|
||||
: Runnable("CharSetChangingRunnable"),
|
||||
mPresContext(aPresContext),
|
||||
mCharSet(aCharSet)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
mPresContext->DoChangeCharSet(mCharSet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<nsPresContext> mPresContext;
|
||||
NotNull<const Encoding*> mCharSet;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
||||
nscolor
|
||||
nsPresContext::MakeColorPref(const nsString& aColor)
|
||||
@ -167,24 +129,13 @@ nsPresContext::MakeColorPref(const nsString& aColor)
|
||||
: nullptr;
|
||||
|
||||
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) {
|
||||
@ -1030,11 +981,7 @@ 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
|
||||
@ -1169,14 +1116,6 @@ nsPresContext::UpdateCharSet(NotNull<const Encoding*> aCharSet)
|
||||
void
|
||||
nsPresContext::DispatchCharSetChange(NotNull<const Encoding*> aEncoding)
|
||||
{
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
if (!Document()->IsStyledByServo()) {
|
||||
RefPtr<CharSetChangingRunnable> runnable =
|
||||
new CharSetChangingRunnable(this, aEncoding);
|
||||
Document()->Dispatch(TaskCategory::Other, runnable.forget());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// In Servo RebuildAllStyleData is async, so no need to do the runnable dance.
|
||||
DoChangeCharSet(aEncoding);
|
||||
}
|
||||
@ -2076,11 +2015,7 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
|
||||
mUsesRootEMUnits = false;
|
||||
mUsesExChUnits = false;
|
||||
if (mShell->StyleSet()->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
mShell->StyleSet()->AsGecko()->SetUsesViewportUnits(false);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO(emilio): It's unclear to me why would these three calls below be
|
||||
@ -2276,15 +2211,7 @@ nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
|
||||
uint32_t aRuleTypeMask) const
|
||||
{
|
||||
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();
|
||||
|
||||
|
@ -50,9 +50,6 @@
|
||||
#include "mozilla/dom/Performance.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoRestyleManager.h"
|
||||
#endif
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/RestyleManagerInlines.h"
|
||||
#include "Layers.h"
|
||||
|
@ -7,9 +7,6 @@
|
||||
/* implementation of interface for managing user and user-agent style sheets */
|
||||
|
||||
#include "nsStyleSheetService.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#endif
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/PreloadedStyleSheet.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
@ -177,9 +174,7 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI *aSheetURI,
|
||||
// that a Servo sheet was also loaded. In both cases, the new sheets are
|
||||
// the last sheets in m{Gecko,Servo}Sheets[aSheetType]
|
||||
bool servoSheetWasAdded = false;
|
||||
#ifdef MOZ_STYLO
|
||||
servoSheetWasAdded = nsLayoutUtils::StyloSupportedInCurrentProcess();
|
||||
#endif
|
||||
|
||||
// Hold on to a copy of the registered PresShells.
|
||||
nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
|
||||
@ -250,17 +245,7 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
|
||||
}
|
||||
|
||||
|
||||
#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;
|
||||
nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet);
|
||||
@ -268,7 +253,6 @@ nsStyleSheetService::LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
|
||||
MOZ_ASSERT(servoSheet);
|
||||
mServoSheets[aSheetType].AppendElement(servoSheet);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -285,11 +269,7 @@ nsStyleSheetService::SheetRegistered(nsIURI *sheetURI,
|
||||
|
||||
// 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;
|
||||
@ -385,15 +365,6 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||
// We have to search for Gecko and Servo sheets separately.
|
||||
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;
|
||||
@ -409,11 +380,7 @@ nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||
for (nsIPresShell* presShell : toNotify) {
|
||||
if (presShell->StyleSet()) {
|
||||
StyleSheet* sheet =
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
presShell->StyleSet()->IsGecko() ? geckoSheet : servoSheet;
|
||||
#else
|
||||
servoSheet;
|
||||
#endif
|
||||
if (sheet) {
|
||||
presShell->NotifyStyleSheetServiceSheetRemoved(sheet, aSheetType);
|
||||
}
|
||||
@ -473,9 +440,6 @@ nsStyleSheetService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) co
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
for (auto* sheetArrays : {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
&mGeckoSheets,
|
||||
#endif
|
||||
&mServoSheets,
|
||||
}) {
|
||||
for (auto& sheetArray : *sheetArrays) {
|
||||
|
@ -85,19 +85,10 @@ private:
|
||||
|
||||
mozilla::Array<SheetArray, 3>& Sheets(mozilla::StyleBackendType aType)
|
||||
{
|
||||
#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
|
||||
|
@ -40,9 +40,6 @@
|
||||
#include "nsPlainTextSerializer.h"
|
||||
#include "nsXMLContentSerializer.h"
|
||||
#include "nsXHTMLContentSerializer.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
#include "nsContentAreaDragDrop.h"
|
||||
#include "nsBox.h"
|
||||
#include "nsIFrameTraversal.h"
|
||||
|
@ -33,18 +33,12 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsImageFrame.h"
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/RuleProcessorCache.h"
|
||||
#endif
|
||||
#include "nsRange.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsRepeatService.h"
|
||||
#include "nsFloatManager.h"
|
||||
#include "nsSprocketLayout.h"
|
||||
#include "nsStackLayout.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "nsTextControlFrame.h"
|
||||
#include "nsXBLService.h"
|
||||
#include "txMozillaXSLTProcessor.h"
|
||||
@ -284,9 +278,6 @@ nsLayoutStatics::Initialize()
|
||||
ServiceWorkerRegistrar::Initialize();
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
GeckoStyleContext::Initialize();
|
||||
#endif
|
||||
mozilla::LayerAnimationInfo::Initialize();
|
||||
#endif
|
||||
|
||||
@ -296,11 +287,9 @@ nsLayoutStatics::Initialize()
|
||||
|
||||
mozilla::dom::WebCryptoThreadPool::Initialize();
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
if (XRE_IsParentProcess() || XRE_IsContentProcess()) {
|
||||
InitializeServo();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
// On Android, we instantiate it when constructing AndroidBridge.
|
||||
@ -329,12 +318,10 @@ nsLayoutStatics::Shutdown()
|
||||
// Don't need to shutdown nsWindowMemoryReporter, that will be done by the
|
||||
// memory reporter manager.
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
if (XRE_IsParentProcess() || XRE_IsContentProcess()) {
|
||||
ShutdownServo();
|
||||
URLExtraData::ReleaseDummy();
|
||||
}
|
||||
#endif
|
||||
|
||||
nsMessageManagerScriptExecutor::Shutdown();
|
||||
nsFocusManager::Shutdown();
|
||||
@ -346,9 +333,6 @@ nsLayoutStatics::Shutdown()
|
||||
Attr::Shutdown();
|
||||
EventListenerManager::Shutdown();
|
||||
IMEStateManager::Shutdown();
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSParser::Shutdown();
|
||||
#endif
|
||||
nsMediaFeatures::Shutdown();
|
||||
nsHTMLDNSPrefetch::Shutdown();
|
||||
nsCSSRendering::Shutdown();
|
||||
@ -386,9 +370,6 @@ nsLayoutStatics::Shutdown()
|
||||
nsAttrValue::Shutdown();
|
||||
nsContentUtils::Shutdown();
|
||||
nsLayoutStylesheetCache::Shutdown();
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
RuleProcessorCache::Shutdown();
|
||||
#endif
|
||||
|
||||
ShutdownJSEnvironment();
|
||||
nsGlobalWindowInner::ShutDown();
|
||||
|
@ -20,9 +20,6 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLMeterElement.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsThemeConstants.h"
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -20,9 +20,6 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLProgressElement.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsThemeConstants.h"
|
||||
|
@ -80,10 +80,6 @@ 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
|
||||
}
|
||||
|
||||
|
@ -45,10 +45,6 @@
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "LayoutLogging.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoStyleContext.h"
|
||||
#include "mozilla/GeckoRestyleManager.h"
|
||||
#endif
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/RestyleManagerInlines.h"
|
||||
#include "nsInlineFrame.h"
|
||||
@ -785,18 +781,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.
|
||||
GeckoRestyleManager::ReframingStyleContexts* rsc =
|
||||
presContext->RestyleManager()->AsGecko()->GetReframingStyleContexts();
|
||||
if (rsc) {
|
||||
rsc->Put(mContent, mStyleContext->AsGecko());
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -7808,20 +7793,6 @@ 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())) {
|
||||
aTo += nsPrintfCString("^%p", geckoContext->GetParent());
|
||||
if (geckoContext->GetParent()) {
|
||||
aTo += nsPrintfCString("^%p", geckoContext->GetParent()->GetParent());
|
||||
if (geckoContext->GetParent()->GetParent()) {
|
||||
aTo += nsPrintfCString("^%p", geckoContext->GetParent()->GetParent()->GetParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
aTo += "]";
|
||||
}
|
||||
|
@ -29,9 +29,6 @@
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsTableWrapperFrame.h"
|
||||
|
||||
|
@ -6,9 +6,6 @@
|
||||
|
||||
#include "InspectorFontFace.h"
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRules.h"
|
||||
#endif
|
||||
#include "gfxTextRun.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "nsFontFaceLoader.h"
|
||||
|
@ -19,11 +19,6 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#endif
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsXBLBinding.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
@ -37,13 +32,7 @@
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/dom/CharacterData.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleWalker.h"
|
||||
#endif
|
||||
#include "nsCSSPseudoClasses.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#endif
|
||||
#include "mozilla/dom/CSSLexer.h"
|
||||
#include "mozilla/dom/InspectorUtilsBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
@ -189,31 +178,7 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
|
||||
|
||||
|
||||
if (styleContext->IsGecko()) {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
auto gecko = styleContext->AsGecko();
|
||||
nsRuleNode* ruleNode = gecko->RuleNode();
|
||||
if (!ruleNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoTArray<nsRuleNode*, 16> ruleNodes;
|
||||
while (!ruleNode->IsRoot()) {
|
||||
ruleNodes.AppendElement(ruleNode);
|
||||
ruleNode = ruleNode->GetParent();
|
||||
}
|
||||
|
||||
for (nsRuleNode* ruleNode : Reversed(ruleNodes)) {
|
||||
RefPtr<Declaration> decl = do_QueryObject(ruleNode->GetRule());
|
||||
if (decl) {
|
||||
css::Rule* owningRule = decl->GetOwningRule();
|
||||
if (owningRule) {
|
||||
aResult.AppendElement(owningRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
} else {
|
||||
nsIDocument* doc = aElement.OwnerDoc();
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
@ -899,23 +864,11 @@ InspectorUtils::ColorToRGBA(GlobalObject& aGlobalObject,
|
||||
{
|
||||
nscolor color = NS_RGB(0, 0, 0);
|
||||
|
||||
#ifdef MOZ_STYLO
|
||||
if (!ServoCSSParser::ComputeColor(nullptr, NS_RGB(0, 0, 0), aColorString,
|
||||
&color)) {
|
||||
aResult.SetNull();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
nsCSSParser cssParser;
|
||||
nsCSSValue cssValue;
|
||||
|
||||
if (!cssParser.ParseColorString(aColorString, nullptr, 0, cssValue, true)) {
|
||||
aResult.SetNull();
|
||||
return;
|
||||
}
|
||||
|
||||
nsRuleNode::ComputeColor(cssValue, nullptr, nullptr, color);
|
||||
#endif
|
||||
|
||||
InspectorRGBATuple& tuple = aResult.SetValue();
|
||||
tuple.mR = NS_GET_R(color);
|
||||
@ -928,13 +881,7 @@ InspectorUtils::ColorToRGBA(GlobalObject& aGlobalObject,
|
||||
InspectorUtils::IsValidCSSColor(GlobalObject& aGlobalObject,
|
||||
const nsAString& aColorString)
|
||||
{
|
||||
#ifdef MOZ_STYLO
|
||||
return ServoCSSParser::IsValidCSSColor(aColorString);
|
||||
#else
|
||||
nsCSSParser cssParser;
|
||||
nsCSSValue cssValue;
|
||||
return cssParser.ParseColorString(aColorString, nullptr, 0, cssValue, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -1154,16 +1101,6 @@ 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);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<ServoStyleSheet> servoSheet = do_QueryObject(&aSheet);
|
||||
if (servoSheet) {
|
||||
|
@ -8,9 +8,6 @@
|
||||
#include "nsPresContext.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTextFrame.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoRestyleManager.h"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -78,9 +78,6 @@
|
||||
#include "LayersLogging.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/GeckoRestyleManager.h"
|
||||
#endif
|
||||
#include "nsCaret.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsDOMTokenList.h"
|
||||
@ -179,11 +176,7 @@ static void AddTransformFunctions(const nsCSSValueList* aList,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -487,13 +480,7 @@ SetAnimatable(nsCSSPropertyID aProperty,
|
||||
Servo_AnimationValue_GetTransform(aAnimationValue.mServo, &list);
|
||||
AddTransformFunctions(list, aFrame, aRefBox, aAnimatable);
|
||||
} else {
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
nsCSSValueSharedList* list =
|
||||
aAnimationValue.mGecko.GetCSSValueSharedListValue();
|
||||
AddTransformFunctions(list, aFrame, aRefBox, aAnimatable);
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -116,15 +116,6 @@ AnimationCollection<AnimationType>::GetOrCreateAnimationCollection(
|
||||
return collection;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
template <class AnimationType>
|
||||
void
|
||||
AnimationCollection<AnimationType>::UpdateCheckGeneration(
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
mCheckGeneration = aPresContext->RestyleManager()->GetAnimationGeneration();
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class AnimationType>
|
||||
/*static*/ nsAtom*
|
||||
|
@ -38,9 +38,6 @@ class AnimationCollection
|
||||
AnimationCollection(dom::Element* aElement, nsAtom* aElementProperty)
|
||||
: mElement(aElement)
|
||||
, mElementProperty(aElementProperty)
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
, mCheckGeneration(0)
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
, mCalledPropertyDtor(false)
|
||||
#endif
|
||||
@ -98,17 +95,6 @@ public:
|
||||
|
||||
InfallibleTArray<RefPtr<AnimationType>> mAnimations;
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// For CSS transitions only, we record the most recent generation
|
||||
// for which we've done the transition update, so that we avoid doing
|
||||
// it more than once per style change.
|
||||
// (Note that we also store an animation generation on each EffectSet in
|
||||
// order to track when we need to update animations on layers.)
|
||||
uint64_t mCheckGeneration;
|
||||
|
||||
// Update mCheckGeneration to RestyleManager's count
|
||||
void UpdateCheckGeneration(nsPresContext* aPresContext);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static nsAtom* GetPropertyAtomForPseudoType(
|
||||
|
@ -69,13 +69,7 @@ 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
|
||||
@ -96,15 +90,8 @@ 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,15 +11,6 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
/* virtual */ bool
|
||||
CSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("should not be called");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* virtual */ JSObject*
|
||||
CSSKeyframesRule::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
@ -31,10 +31,6 @@ 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;
|
||||
#endif
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
|
||||
|
||||
|
@ -35,9 +35,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleNode.h"
|
||||
#endif
|
||||
#include "nsMediaFeatures.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
@ -14,9 +14,6 @@
|
||||
#include "mozilla/WritingModes.h"
|
||||
#include "nsCSSCounterStyleRule.h"
|
||||
#include "nsString.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
|
@ -7,9 +7,6 @@
|
||||
#ifndef mozilla_DeclarationBlockInlines_h
|
||||
#define mozilla_DeclarationBlockInlines_h
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "mozilla/ServoDeclarationBlock.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -33,11 +30,7 @@ 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());
|
||||
}
|
||||
@ -48,11 +41,6 @@ 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
|
||||
|
@ -542,21 +542,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
|
||||
base,
|
||||
principal,
|
||||
aResult)) {
|
||||
aResult.Reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "gfxFontConstants.h"
|
||||
#include "gfxFontSrcPrincipal.h"
|
||||
#include "gfxFontSrcURI.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#endif
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "mozilla/dom/FontFaceSetBinding.h"
|
||||
#include "mozilla/dom/FontFaceSetIterator.h"
|
||||
@ -50,9 +47,6 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsStyleSet.h"
|
||||
#endif
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "StylePrefs.h"
|
||||
@ -227,62 +221,7 @@ FontFaceSet::ParseFontShorthandForMatching(
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
// Parse aFont as a 'font' property value.
|
||||
RefPtr<Declaration> declaration = new Declaration;
|
||||
declaration->InitializeEmpty();
|
||||
|
||||
bool changed = false;
|
||||
nsCSSParser parser;
|
||||
parser.ParseProperty(eCSSProperty_font,
|
||||
aFont,
|
||||
mDocument->GetDocumentURI(),
|
||||
mDocument->GetDocumentURI(),
|
||||
mDocument->NodePrincipal(),
|
||||
declaration,
|
||||
&changed,
|
||||
/* aIsImportant */ false);
|
||||
|
||||
// All of the properties we are interested in should have been set at once.
|
||||
MOZ_ASSERT(changed == (declaration->HasProperty(eCSSProperty_font_family) &&
|
||||
declaration->HasProperty(eCSSProperty_font_style) &&
|
||||
declaration->HasProperty(eCSSProperty_font_weight) &&
|
||||
declaration->HasProperty(eCSSProperty_font_stretch)));
|
||||
|
||||
if (!changed) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCSSCompressedDataBlock* data = declaration->GetNormalBlock();
|
||||
MOZ_ASSERT(!declaration->GetImportantBlock());
|
||||
|
||||
const nsCSSValue* family = data->ValueFor(eCSSProperty_font_family);
|
||||
if (family->GetUnit() != eCSSUnit_FontFamilyList) {
|
||||
// We got inherit, initial, unset, a system font, or a token stream.
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
aFamilyList = family->GetFontFamilyListValue();
|
||||
|
||||
int32_t weight = data->ValueFor(eCSSProperty_font_weight)->GetIntValue();
|
||||
|
||||
// Resolve relative font weights against the initial of font-weight
|
||||
// (normal, which is equivalent to 400).
|
||||
if (weight == NS_STYLE_FONT_WEIGHT_BOLDER) {
|
||||
weight = NS_FONT_WEIGHT_BOLD;
|
||||
} else if (weight == NS_STYLE_FONT_WEIGHT_LIGHTER) {
|
||||
weight = NS_FONT_WEIGHT_THIN;
|
||||
}
|
||||
|
||||
aWeight = weight;
|
||||
|
||||
aStretch = data->ValueFor(eCSSProperty_font_stretch)->GetIntValue();
|
||||
aStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -14,9 +14,6 @@
|
||||
#ifndef mozilla_GenericSpecifiedValuesInlines_h
|
||||
#define mozilla_GenericSpecifiedValuesInlines_h
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
#include "nsRuleData.h"
|
||||
#endif
|
||||
#include "mozilla/GenericSpecifiedValues.h"
|
||||
#include "mozilla/ServoSpecifiedValues.h"
|
||||
|
||||
@ -36,11 +33,7 @@ GenericSpecifiedValues::ShouldIgnoreColors() const
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
return !AsGecko()->mPresContext->UseDocumentColors();
|
||||
#else
|
||||
MOZ_CRASH("old style system disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
@ -83,29 +76,11 @@ 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
|
||||
// instead
|
||||
static_assert(
|
||||
!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::SetIntValue),
|
||||
decltype(&MOZ_STYLO_GECKO_TYPE::SetKeywordValue)>::value,
|
||||
"Gecko subclass should define its own SetKeywordValue");
|
||||
static_assert(
|
||||
!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,190 +18,11 @@ 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
|
||||
//
|
||||
|
||||
class GroupRuleRuleList final : public dom::CSSRuleList
|
||||
{
|
||||
public:
|
||||
explicit GroupRuleRuleList(GroupRule *aGroupRule);
|
||||
|
||||
virtual CSSStyleSheet* GetParentObject() override;
|
||||
|
||||
virtual Rule*
|
||||
IndexedGetter(uint32_t aIndex, bool& aFound) override;
|
||||
virtual uint32_t
|
||||
Length() override;
|
||||
|
||||
void DropReference() { mGroupRule = nullptr; }
|
||||
|
||||
private:
|
||||
~GroupRuleRuleList();
|
||||
|
||||
private:
|
||||
GroupRule* mGroupRule;
|
||||
};
|
||||
|
||||
GroupRuleRuleList::GroupRuleRuleList(GroupRule *aGroupRule)
|
||||
{
|
||||
// Not reference counted to avoid circular references.
|
||||
// The rule will tell us when its going away.
|
||||
mGroupRule = aGroupRule;
|
||||
}
|
||||
|
||||
GroupRuleRuleList::~GroupRuleRuleList()
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleSheet*
|
||||
GroupRuleRuleList::GetParentObject()
|
||||
{
|
||||
if (!mGroupRule) {
|
||||
return nullptr;
|
||||
}
|
||||
StyleSheet* sheet = mGroupRule->GetStyleSheet();
|
||||
return sheet ? sheet->AsGecko() : nullptr;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GroupRuleRuleList::Length()
|
||||
{
|
||||
if (!mGroupRule) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return AssertedCast<uint32_t>(mGroupRule->StyleRuleCount());
|
||||
}
|
||||
|
||||
Rule*
|
||||
GroupRuleRuleList::IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = false;
|
||||
|
||||
if (mGroupRule) {
|
||||
RefPtr<Rule> rule = mGroupRule->GetStyleRuleAt(aIndex);
|
||||
if (rule) {
|
||||
aFound = true;
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// -------------------------------
|
||||
// GeckoGroupRuleRules
|
||||
//
|
||||
|
||||
GeckoGroupRuleRules::GeckoGroupRuleRules()
|
||||
{
|
||||
}
|
||||
|
||||
GeckoGroupRuleRules::GeckoGroupRuleRules(GeckoGroupRuleRules&& aOther)
|
||||
: mRules(Move(aOther.mRules))
|
||||
, mRuleCollection(Move(aOther.mRuleCollection))
|
||||
{
|
||||
}
|
||||
|
||||
GeckoGroupRuleRules::GeckoGroupRuleRules(const GeckoGroupRuleRules& aCopy)
|
||||
{
|
||||
for (const Rule* rule : aCopy.mRules) {
|
||||
RefPtr<Rule> clone = rule->Clone();
|
||||
mRules.AppendObject(clone);
|
||||
}
|
||||
}
|
||||
|
||||
GeckoGroupRuleRules::~GeckoGroupRuleRules()
|
||||
{
|
||||
for (Rule* rule : mRules) {
|
||||
rule->SetParentRule(nullptr);
|
||||
}
|
||||
if (mRuleCollection) {
|
||||
mRuleCollection->DropReference();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GeckoGroupRuleRules::Clear()
|
||||
{
|
||||
mRules.Clear();
|
||||
if (mRuleCollection) {
|
||||
mRuleCollection->DropReference();
|
||||
mRuleCollection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GeckoGroupRuleRules::Traverse(nsCycleCollectionTraversalCallback& cb)
|
||||
{
|
||||
IncrementalClearCOMRuleArray& rules = mRules;
|
||||
for (int32_t i = 0, count = rules.Count(); i < count; ++i) {
|
||||
if (!rules[i]->IsCCLeaf()) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mRules[i]");
|
||||
cb.NoteXPCOMChild(rules[i]);
|
||||
}
|
||||
}
|
||||
ImplCycleCollectionTraverse(cb, mRuleCollection, "mRuleCollection");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
GeckoGroupRuleRules::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
for (const Rule* rule : mRules) {
|
||||
rule->List(out, aIndent + 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
GeckoGroupRuleRules::DeleteStyleRuleAt(uint32_t aIndex)
|
||||
{
|
||||
Rule* rule = mRules.SafeObjectAt(aIndex);
|
||||
if (rule) {
|
||||
rule->SetStyleSheet(nullptr);
|
||||
rule->SetParentRule(nullptr);
|
||||
}
|
||||
return mRules.RemoveObjectAt(aIndex) ? NS_OK : NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
CSSRuleList*
|
||||
GeckoGroupRuleRules::CssRules(GroupRule* aParentRule)
|
||||
{
|
||||
if (!mRuleCollection) {
|
||||
mRuleCollection = new GroupRuleRuleList(aParentRule);
|
||||
}
|
||||
return mRuleCollection;
|
||||
}
|
||||
|
||||
size_t
|
||||
GeckoGroupRuleRules::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = mRules.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (const Rule* rule : mRules) {
|
||||
n += rule->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mRuleCollection
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
// -------------------------------
|
||||
// ServoGroupRuleRules
|
||||
@ -235,11 +56,7 @@ 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
|
||||
{
|
||||
}
|
||||
|
||||
@ -309,55 +126,6 @@ GroupRule::SetStyleSheet(StyleSheet* aSheet)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
void
|
||||
GroupRule::AppendStyleRule(Rule* aRule)
|
||||
{
|
||||
GeckoRules().AppendObject(aRule);
|
||||
StyleSheet* sheet = GetStyleSheet();
|
||||
aRule->SetStyleSheet(sheet);
|
||||
aRule->SetParentRule(this);
|
||||
if (sheet) {
|
||||
sheet->RuleChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GroupRule::EnumerateRulesForwards(RuleEnumFunc aFunc, void * aData) const
|
||||
{
|
||||
for (const Rule* rule : GeckoRules()) {
|
||||
if (!aFunc(const_cast<Rule*>(rule), aData)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GroupRule::InsertStyleRuleAt(uint32_t aIndex, Rule* aRule)
|
||||
{
|
||||
aRule->SetStyleSheet(GetStyleSheet());
|
||||
aRule->SetParentRule(this);
|
||||
if (!GeckoRules().InsertObjectAt(aRule, aIndex)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
GroupRule::AppendRulesToCssText(nsAString& aCssText) const
|
||||
{
|
||||
aCssText.AppendLiteral(" {\n");
|
||||
for (const Rule* rule : GeckoRules()) {
|
||||
nsAutoString cssText;
|
||||
rule->GetCssText(cssText);
|
||||
aCssText.AppendLiteral(" ");
|
||||
aCssText.Append(cssText);
|
||||
aCssText.Append('\n');
|
||||
}
|
||||
aCssText.Append('}');
|
||||
}
|
||||
#endif
|
||||
|
||||
CSSRuleList*
|
||||
GroupRule::CssRules()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user