Bug 1244049 - Part 2: Replace nsCSSPseudoElements::Type with CSSPseudoElementType. r=dbaron

Also, try to use forward declaraions for CSSPseudoElementType;

--HG--
extra : rebase_source : c00eb9753e8f618a33aa711538ac45c0132b353c
This commit is contained in:
Boris Chiou 2016-02-17 21:37:00 +01:00
parent 185a769719
commit e436478f26
58 changed files with 257 additions and 233 deletions

View File

@ -1107,7 +1107,7 @@ Animation::PostUpdate()
}
Element* targetElement;
nsCSSPseudoElements::Type targetPseudoType;
CSSPseudoElementType targetPseudoType;
mEffect->GetTarget(targetElement, targetPseudoType);
if (!targetElement) {
return;

View File

@ -17,7 +17,7 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CSSPseudoElement, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CSSPseudoElement, Release)
CSSPseudoElement::CSSPseudoElement(Element* aElement,
nsCSSPseudoElements::Type aType)
CSSPseudoElementType aType)
: mParentElement(aElement)
, mPseudoType(aType)
{
@ -69,7 +69,7 @@ CSSPseudoElement::Animate(
/* static */ already_AddRefed<CSSPseudoElement>
CSSPseudoElement::GetCSSPseudoElement(Element* aElement,
nsCSSPseudoElements::Type aType)
CSSPseudoElementType aType)
{
if (!aElement) {
return nullptr;
@ -96,8 +96,7 @@ CSSPseudoElement::GetCSSPseudoElement(Element* aElement,
}
/* static */ nsIAtom*
CSSPseudoElement::GetCSSPseudoElementPropertyAtom(
nsCSSPseudoElements::Type aType)
CSSPseudoElement::GetCSSPseudoElementPropertyAtom(CSSPseudoElementType aType)
{
switch (aType) {
case CSSPseudoElementType::before:

View File

@ -38,7 +38,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
nsCSSPseudoElements::Type GetType() const { return mPseudoType; }
CSSPseudoElementType GetType() const { return mPseudoType; }
void GetType(nsString& aRetVal) const
{
MOZ_ASSERT(nsCSSPseudoElements::GetPseudoAtom(mPseudoType),
@ -64,20 +64,19 @@ public:
// pseudo-type on element, a new CSSPseudoElement will be created and stored
// on the element.
static already_AddRefed<CSSPseudoElement>
GetCSSPseudoElement(Element* aElement, nsCSSPseudoElements::Type aType);
GetCSSPseudoElement(Element* aElement, CSSPseudoElementType aType);
private:
// Only ::before and ::after are supported.
CSSPseudoElement(Element* aElement, nsCSSPseudoElements::Type aType);
CSSPseudoElement(Element* aElement, CSSPseudoElementType aType);
static nsIAtom*
GetCSSPseudoElementPropertyAtom(nsCSSPseudoElements::Type aType);
static nsIAtom* GetCSSPseudoElementPropertyAtom(CSSPseudoElementType aType);
// mParentElement needs to be an owning reference since if script is holding
// on to the pseudo-element, it needs to continue to be able to refer to
// the parent element.
RefPtr<Element> mParentElement;
nsCSSPseudoElements::Type mPseudoType;
CSSPseudoElementType mPseudoType;
};
} // namespace dom

View File

@ -16,6 +16,7 @@
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetPresShellForContent
#include "nsCSSPropertySet.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
@ -80,7 +81,7 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
// Those cases are probably not important but just to be safe, let's make
// sure the cascade is up to date since if it *is* up to date, this is
// basically a no-op.
Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>> pseudoElement =
Maybe<Pair<dom::Element*, CSSPseudoElementType>> pseudoElement =
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
if (pseudoElement) {
EffectCompositor::MaybeUpdateCascadeResults(pseudoElement->first(),
@ -131,7 +132,7 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
void
EffectCompositor::RequestRestyle(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
RestyleType aRestyleType,
CascadeLevel aCascadeLevel)
{
@ -171,7 +172,7 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
void
EffectCompositor::PostRestyleForAnimation(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel)
{
if (!mPresContext) {
@ -212,8 +213,7 @@ EffectCompositor::PostRestyleForThrottledAnimations()
void
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type
aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel)
{
// First update cascade results since that may cause some elements to
@ -235,7 +235,7 @@ EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
nsIStyleRule*
EffectCompositor::GetAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel)
{
// NOTE: We need to be careful about early returns in this method where
@ -281,7 +281,7 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
/* static */ dom::Element*
EffectCompositor::GetElementToRestyle(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
if (aPseudoType == CSSPseudoElementType::NotPseudo) {
return aElement;
@ -417,8 +417,7 @@ EffectCompositor::ClearIsRunningOnCompositor(const nsIFrame *aFrame,
/* static */ void
EffectCompositor::MaybeUpdateCascadeResults(Element* aElement,
nsCSSPseudoElements::Type
aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aStyleContext)
{
EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
@ -433,8 +432,7 @@ EffectCompositor::MaybeUpdateCascadeResults(Element* aElement,
/* static */ void
EffectCompositor::MaybeUpdateCascadeResults(Element* aElement,
nsCSSPseudoElements::Type
aPseudoType)
CSSPseudoElementType aPseudoType)
{
nsStyleContext* styleContext = nullptr;
{
@ -474,7 +472,7 @@ namespace {
/* static */ void
EffectCompositor::UpdateCascadeResults(Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aStyleContext)
{
EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
@ -485,19 +483,18 @@ EffectCompositor::UpdateCascadeResults(Element* aElement,
UpdateCascadeResults(*effects, aElement, aPseudoType, aStyleContext);
}
/* static */ Maybe<Pair<Element*, nsCSSPseudoElements::Type>>
/* static */ Maybe<Pair<Element*, CSSPseudoElementType>>
EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
{
// Always return the same object to benefit from return-value optimization.
Maybe<Pair<Element*, nsCSSPseudoElements::Type>> result;
Maybe<Pair<Element*, CSSPseudoElementType>> result;
nsIContent* content = aFrame->GetContent();
if (!content) {
return result;
}
nsCSSPseudoElements::Type pseudoType =
CSSPseudoElementType::NotPseudo;
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
if (aFrame->IsGeneratedContentFrame()) {
nsIFrame* parent = aFrame->GetParent();
@ -534,7 +531,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
/* static */ void
EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel,
TimeStamp aRefreshTime)
{
@ -615,7 +612,7 @@ EffectCompositor::GetOverriddenProperties(nsStyleContext* aStyleContext,
/* static */ void
EffectCompositor::UpdateCascadeResults(EffectSet& aEffectSet,
Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aStyleContext)
{
MOZ_ASSERT(EffectSet::GetEffectSet(aElement, aPseudoType) == &aEffectSet,

View File

@ -14,7 +14,6 @@
#include "mozilla/PseudoElementHashEntry.h"
#include "mozilla/RefPtr.h"
#include "nsCSSProperty.h"
#include "nsCSSPseudoElements.h"
#include "nsCycleCollectionParticipant.h"
#include "nsDataHashtable.h"
#include "nsIStyleRuleProcessor.h"
@ -30,6 +29,7 @@ namespace mozilla {
class EffectSet;
class RestyleTracker;
enum class CSSPseudoElementType : uint8_t;
namespace dom {
class Animation;
@ -94,7 +94,7 @@ public:
// The specified steps taken to update the animation rule depend on
// |aRestyleType| whose values are described above.
void RequestRestyle(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
RestyleType aRestyleType,
CascadeLevel aCascadeLevel);
@ -103,7 +103,7 @@ public:
// need to perform this step when triggering transitions *without* also
// invalidating the animation style rule (which RequestRestyle would do).
void PostRestyleForAnimation(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel);
// Posts an animation restyle for any elements whose animation style rule
@ -116,11 +116,11 @@ public:
// If the animation rule is not marked as needing an update,
// no work is done.
void MaybeUpdateAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel);
nsIStyleRule* GetAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel);
bool HasPendingStyleUpdates() const;
@ -155,14 +155,14 @@ public:
// animation level of the cascade have changed.
static void
MaybeUpdateCascadeResults(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aStyleContext);
// An overload of MaybeUpdateCascadeResults that uses the style context
// of the primary frame of the specified (pseudo-)element, when available.
static void
MaybeUpdateCascadeResults(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
CSSPseudoElementType aPseudoType);
// Update the mWinsInCascade member for each property in effects targetting
// the specified (pseudo-)element.
@ -172,7 +172,7 @@ public:
// other cases we should call MaybeUpdateCascadeResults.
static void
UpdateCascadeResults(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aStyleContext);
// Helper to fetch the corresponding element and pseudo-type from a frame.
@ -184,7 +184,7 @@ public:
// Returns an empty result when a suitable element cannot be found including
// when the frame represents a pseudo-element on which we do not support
// animations.
static Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>>
static Maybe<Pair<dom::Element*, CSSPseudoElementType>>
GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame);
private:
@ -193,12 +193,12 @@ private:
// Rebuilds the animation rule corresponding to |aCascadeLevel| on the
// EffectSet associated with the specified (pseudo-)element.
static void ComposeAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
CascadeLevel aCascadeLevel,
TimeStamp aRefreshTime);
static dom::Element* GetElementToRestyle(dom::Element* aElement,
nsCSSPseudoElements::Type
CSSPseudoElementType
aPseudoType);
// Get the properties in |aEffectSet| that we are able to animate on the
@ -212,7 +212,7 @@ private:
static void
UpdateCascadeResults(EffectSet& aEffectSet,
dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aStyleContext);
static nsPresContext* GetPresContext(dom::Element* aElement);

View File

@ -7,6 +7,7 @@
#include "EffectSet.h"
#include "mozilla/dom/Element.h" // For Element
#include "RestyleManager.h"
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsCycleCollectionNoteChild.h" // For CycleCollectionNoteChild
#include "nsPresContext.h"
#include "nsLayoutUtils.h"
@ -38,7 +39,7 @@ EffectSet::Traverse(nsCycleCollectionTraversalCallback& aCallback)
/* static */ EffectSet*
EffectSet::GetEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
return static_cast<EffectSet*>(aElement->GetProperty(propName));
@ -87,7 +88,7 @@ EffectSet::GetEffectSet(const nsIFrame* aFrame)
/* static */ EffectSet*
EffectSet::GetOrCreateEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
EffectSet* effectSet = GetEffectSet(aElement, aPseudoType);
if (effectSet) {
@ -114,7 +115,7 @@ EffectSet::GetOrCreateEffectSet(dom::Element* aElement,
/* static */ void
EffectSet::DestroyEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
EffectSet* effectSet =
@ -152,7 +153,7 @@ EffectSet::GetEffectSetPropertyAtoms()
}
/* static */ nsIAtom*
EffectSet::GetEffectSetPropertyAtom(nsCSSPseudoElements::Type aPseudoType)
EffectSet::GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType)
{
switch (aPseudoType) {
case CSSPseudoElementType::NotPseudo:

View File

@ -12,7 +12,6 @@
#include "mozilla/EffectCompositor.h"
#include "mozilla/EnumeratedArray.h"
#include "mozilla/TimeStamp.h"
#include "nsCSSPseudoElements.h" // For nsCSSPseudoElements::Type
#include "nsHashKeys.h" // For nsPtrHashKey
#include "nsTHashtable.h" // For nsTHashtable
@ -25,6 +24,8 @@ class Element;
class KeyframeEffectReadOnly;
} // namespace dom
enum class CSSPseudoElementType : uint8_t;
// A wrapper around a hashset of AnimationEffect objects to handle
// storing the set as a property of an element.
class EffectSet
@ -57,12 +58,12 @@ public:
void Traverse(nsCycleCollectionTraversalCallback& aCallback);
static EffectSet* GetEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
CSSPseudoElementType aPseudoType);
static EffectSet* GetEffectSet(const nsIFrame* aFrame);
static EffectSet* GetOrCreateEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
CSSPseudoElementType aPseudoType);
static void DestroyEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
CSSPseudoElementType aPseudoType);
void AddEffect(dom::KeyframeEffectReadOnly& aEffect);
void RemoveEffect(dom::KeyframeEffectReadOnly& aEffect);
@ -182,8 +183,7 @@ public:
static nsIAtom** GetEffectSetPropertyAtoms();
private:
static nsIAtom* GetEffectSetPropertyAtom(nsCSSPseudoElements::Type
aPseudoType);
static nsIAtom* GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType);
OwningEffectSet mEffects;

View File

@ -17,6 +17,7 @@
#include "nsCSSParser.h"
#include "nsCSSPropertySet.h"
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
#include "nsCSSPseudoElements.h"
#include "nsCSSValue.h"
#include "nsStyleUtil.h"
#include <algorithm> // For std::max
@ -74,7 +75,7 @@ NS_IMPL_RELEASE_INHERITED(KeyframeEffectReadOnly, AnimationEffectReadOnly)
KeyframeEffectReadOnly::KeyframeEffectReadOnly(
nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming)
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
new AnimationEffectTimingReadOnly(aTiming))
@ -84,7 +85,7 @@ KeyframeEffectReadOnly::KeyframeEffectReadOnly(
KeyframeEffectReadOnly::KeyframeEffectReadOnly(
nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
AnimationEffectTimingReadOnly* aTiming)
: AnimationEffectReadOnly(aDocument)
, mTarget(aTarget)
@ -624,7 +625,7 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect(const GlobalObject& aGlobal,
"Uninitialized target");
RefPtr<Element> targetElement;
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::NotPseudo;
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
if (target.IsElement()) {
targetElement = &target.GetAsElement();
} else {
@ -1229,7 +1230,7 @@ ApplyDistributeSpacing(nsTArray<OffsetIndexedKeyframe>& aKeyframes)
*/
static void
GenerateValueEntries(Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsTArray<OffsetIndexedKeyframe>& aKeyframes,
nsTArray<KeyframeValueEntry>& aResult,
ErrorResult& aRv)
@ -1433,7 +1434,7 @@ static void
BuildAnimationPropertyListFromKeyframeSequence(
JSContext* aCx,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
JS::ForOfIterator& aIterator,
nsTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
@ -1491,7 +1492,7 @@ static void
BuildAnimationPropertyListFromPropertyIndexedKeyframes(
JSContext* aCx,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
JS::Handle<JS::Value> aValue,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
@ -1666,7 +1667,7 @@ BuildAnimationPropertyListFromPropertyIndexedKeyframes(
KeyframeEffectReadOnly::BuildAnimationPropertyList(
JSContext* aCx,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
JS::Handle<JSObject*> aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
@ -2125,7 +2126,7 @@ KeyframeEffectReadOnly::ShouldBlockCompositorAnimations(const nsIFrame*
KeyframeEffect::KeyframeEffect(nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming)
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
new AnimationEffectTiming(aTiming))

View File

@ -9,7 +9,6 @@
#include "nsAutoPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsCSSPseudoElements.h"
#include "nsIDocument.h"
#include "nsWrapperCache.h"
#include "mozilla/Attributes.h"
@ -38,6 +37,7 @@ namespace mozilla {
struct AnimationCollection;
class AnimValuesStyleRule;
enum class CSSPseudoElementType : uint8_t;
namespace dom {
class ElementOrCSSPseudoElement;
@ -172,7 +172,7 @@ class KeyframeEffectReadOnly : public AnimationEffectReadOnly
public:
KeyframeEffectReadOnly(nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming);
NS_DECL_ISUPPORTS_INHERITED
@ -209,7 +209,7 @@ public:
// Temporary workaround to return both the target element and pseudo-type
// until we implement PseudoElement (bug 1174575).
void GetTarget(Element*& aTarget,
nsCSSPseudoElements::Type& aPseudoType) const {
CSSPseudoElementType& aPseudoType) const {
aTarget = mTarget;
aPseudoType = mPseudoType;
}
@ -322,7 +322,7 @@ public:
protected:
KeyframeEffectReadOnly(nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
AnimationEffectTimingReadOnly* aTiming);
virtual ~KeyframeEffectReadOnly();
@ -351,7 +351,7 @@ protected:
static void BuildAnimationPropertyList(
JSContext* aCx,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
JS::Handle<JSObject*> aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv);
@ -360,7 +360,7 @@ protected:
RefPtr<Animation> mAnimation;
OwningNonNull<AnimationEffectTimingReadOnly> mTiming;
nsCSSPseudoElements::Type mPseudoType;
CSSPseudoElementType mPseudoType;
InfallibleTArray<AnimationProperty> mProperties;
@ -395,7 +395,7 @@ class KeyframeEffect : public KeyframeEffectReadOnly
public:
KeyframeEffect(nsIDocument* aDocument,
Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming);
JSObject* WrapObject(JSContext* aCx,

View File

@ -9,18 +9,19 @@
#include "mozilla/dom/Element.h"
#include "mozilla/HashFunctions.h"
#include "nsCSSPseudoElements.h"
#include "PLDHashTable.h"
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
struct PseudoElementHashKey
{
dom::Element* mElement;
nsCSSPseudoElements::Type mPseudoType;
CSSPseudoElementType mPseudoType;
};
// A hash entry that uses a RefPtr<dom::Element>, nsCSSPseudoElements::Type pair
// A hash entry that uses a RefPtr<dom::Element>, CSSPseudoElementType pair
class PseudoElementHashEntry : public PLDHashEntryHdr
{
public:
@ -54,7 +55,7 @@ public:
enum { ALLOW_MEMMOVE = true };
RefPtr<dom::Element> mElement;
nsCSSPseudoElements::Type mPseudoType;
CSSPseudoElementType mPseudoType;
};
} // namespace mozilla

View File

@ -389,7 +389,7 @@ nsAnimationReceiver::RecordAnimationMutation(Animation* aAnimation,
}
mozilla::dom::Element* animationTarget;
nsCSSPseudoElements::Type pseudoType;
CSSPseudoElementType pseudoType;
effect->GetTarget(animationTarget, pseudoType);
if (!animationTarget) {
return;

View File

@ -101,6 +101,7 @@
#include "nsIDOMStyleSheet.h"
#include "nsIStyleSheetService.h"
#include "nsContentPermissionHelper.h"
#include "nsCSSPseudoElements.h" // for CSSPseudoElementType
#include "nsNetUtil.h"
#include "nsDocument.h"
#include "HTMLImageElement.h"

View File

@ -6,6 +6,7 @@
#include "nsNodeUtils.h"
#include "nsContentUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsINode.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
@ -235,7 +236,7 @@ nsNodeUtils::GetTargetForAnimation(const Animation* aAnimation)
}
Element* target;
nsCSSPseudoElements::Type pseudoType;
CSSPseudoElementType pseudoType;
effect->GetTarget(target, pseudoType);
// If the animation targets a pseudo-element, we don't dispatch

View File

@ -21,6 +21,7 @@
#include "nsStyleUtil.h"
#include "nsCSSFrameConstructor.h"
#include "nsSVGEffects.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRendering.h"
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
@ -1104,18 +1105,15 @@ RestyleManager::AnimationsWithDestroyedFrame::AnimationsWithDestroyedFrame(
void
RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsForElementsWithoutFrames()
{
StopAnimationsWithoutFrame(mContents,
CSSPseudoElementType::NotPseudo);
StopAnimationsWithoutFrame(mBeforeContents,
CSSPseudoElementType::before);
StopAnimationsWithoutFrame(mAfterContents,
CSSPseudoElementType::after);
StopAnimationsWithoutFrame(mContents, CSSPseudoElementType::NotPseudo);
StopAnimationsWithoutFrame(mBeforeContents, CSSPseudoElementType::before);
StopAnimationsWithoutFrame(mAfterContents, CSSPseudoElementType::after);
}
void
RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsWithoutFrame(
nsTArray<RefPtr<nsIContent>>& aArray,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
nsAnimationManager* animationManager =
mRestyleManager->PresContext()->AnimationManager();
@ -1132,7 +1130,7 @@ RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsWithoutFrame(
static inline dom::Element*
ElementForStyleContext(nsIContent* aParentContent,
nsIFrame* aFrame,
nsCSSPseudoElements::Type aPseudoType);
CSSPseudoElementType aPseudoType);
// Forwarded nsIDocumentObserver method, to handle restyling (and
// passing the notification to the frame).
@ -1159,8 +1157,7 @@ RestyleManager::ContentStateChanged(nsIContent* aContent,
// need to force a reframe -- if it's needed, the HasStateDependentStyle
// call will handle things.
nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
nsCSSPseudoElements::Type pseudoType =
CSSPseudoElementType::NotPseudo;
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
if (primaryFrame) {
// If it's generated content, ignore LOADING/etc state changes on it.
if (!primaryFrame->IsGeneratedContentFrame() &&
@ -2129,7 +2126,7 @@ RestyleManager::TryStartingTransition(nsPresContext* aPresContext,
static dom::Element*
ElementForStyleContext(nsIContent* aParentContent,
nsIFrame* aFrame,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
// We don't expect XUL tree stuff here.
NS_PRECONDITION(aPseudoType == CSSPseudoElementType::NotPseudo ||
@ -2201,7 +2198,7 @@ ElementForStyleContext(nsIContent* aParentContent,
*/
static dom::Element*
PseudoElementForStyleContext(nsIFrame* aFrame,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
if (aPseudoType >= CSSPseudoElementType::Count) {
return nullptr;
@ -3847,7 +3844,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
#endif
nsIAtom* const pseudoTag = oldContext->GetPseudo();
const nsCSSPseudoElements::Type pseudoType = oldContext->GetPseudoType();
const CSSPseudoElementType pseudoType = oldContext->GetPseudoType();
// Get the frame providing the parent style context. If it is a
// child, then resolve the provider first.
@ -3976,8 +3973,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
} else {
// Don't expect XUL tree stuff here, since it needs a comparator and
// all.
NS_ASSERTION(pseudoType <
CSSPseudoElementType::Count,
NS_ASSERTION(pseudoType < CSSPseudoElementType::Count,
"Unexpected pseudo type");
Element* pseudoElement =
PseudoElementForStyleContext(aSelf, pseudoType);
@ -4258,7 +4254,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
LOG_RESTYLE_INDENT();
RefPtr<nsStyleContext> newExtraContext;
nsIAtom* const extraPseudoTag = oldExtraContext->GetPseudo();
const nsCSSPseudoElements::Type extraPseudoType =
const CSSPseudoElementType extraPseudoType =
oldExtraContext->GetPseudoType();
NS_ASSERTION(extraPseudoTag &&
extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
@ -4683,7 +4679,7 @@ ElementRestyler::MustReframeForAfterPseudo(nsIFrame* aFrame)
#endif
void
ElementRestyler::MaybeReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
ElementRestyler::MaybeReframeForPseudo(CSSPseudoElementType aPseudoType,
nsIFrame* aGenConParentFrame,
nsIFrame* aFrame,
nsIContent* aContent,
@ -4700,7 +4696,7 @@ ElementRestyler::MaybeReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
}
bool
ElementRestyler::MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
ElementRestyler::MustReframeForPseudo(CSSPseudoElementType aPseudoType,
nsIFrame* aGenConParentFrame,
nsIFrame* aFrame,
nsIContent* aContent,

View File

@ -18,7 +18,6 @@
#include "nsPresContext.h"
#include "nsRefreshDriver.h"
#include "nsRefPtrHashtable.h"
#include "nsCSSPseudoElements.h"
#include "nsTransitionManager.h"
class nsIFrame;
@ -26,6 +25,7 @@ class nsStyleChangeList;
struct TreeMatchContext;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
class EventStates;
struct UndisplayedNode;
@ -191,7 +191,7 @@ public:
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
MOZ_ASSERT(aContent);
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
if (pseudoType == CSSPseudoElementType::NotPseudo) {
mElementContexts.Put(aContent, aStyleContext);
} else if (pseudoType == CSSPseudoElementType::before) {
@ -204,7 +204,7 @@ public:
}
nsStyleContext* Get(nsIContent* aContent,
nsCSSPseudoElements::Type aPseudoType) {
CSSPseudoElementType aPseudoType) {
MOZ_ASSERT(aContent);
if (aPseudoType == CSSPseudoElementType::NotPseudo) {
return mElementContexts.GetWeak(aContent);
@ -269,7 +269,7 @@ public:
// the real element.
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
MOZ_ASSERT(aContent);
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
if (pseudoType == CSSPseudoElementType::NotPseudo) {
mContents.AppendElement(aContent);
} else if (pseudoType == CSSPseudoElementType::before) {
@ -285,7 +285,7 @@ public:
private:
void StopAnimationsWithoutFrame(nsTArray<RefPtr<nsIContent>>& aArray,
nsCSSPseudoElements::Type aPseudoType);
CSSPseudoElementType aPseudoType);
RestyleManager* mRestyleManager;
AutoRestore<AnimationsWithDestroyedFrame*> mRestorePointer;
@ -792,7 +792,7 @@ private:
const uint8_t aDisplay);
void MaybeReframeForBeforePseudo();
void MaybeReframeForAfterPseudo(nsIFrame* aFrame);
void MaybeReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
void MaybeReframeForPseudo(CSSPseudoElementType aPseudoType,
nsIFrame* aGenConParentFrame,
nsIFrame* aFrame,
nsIContent* aContent,
@ -801,7 +801,7 @@ private:
bool MustReframeForBeforePseudo();
bool MustReframeForAfterPseudo(nsIFrame* aFrame);
#endif
bool MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
bool MustReframeForPseudo(CSSPseudoElementType aPseudoType,
nsIFrame* aGenConParentFrame,
nsIFrame* aFrame,
nsIContent* aContent,

View File

@ -20,6 +20,7 @@
#include "mozilla/Likely.h"
#include "mozilla/LinkedList.h"
#include "nsAbsoluteContainingBlock.h"
#include "nsCSSPseudoElements.h"
#include "nsIAtom.h"
#include "nsIFrameInlines.h"
#include "nsGkAtoms.h"
@ -1757,7 +1758,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
nsContainerFrame* aParentFrame,
nsIContent* aParentContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
CSSPseudoElementType aPseudoElement,
FrameConstructionItemList& aItems)
{
MOZ_ASSERT(aPseudoElement == CSSPseudoElementType::before ||

View File

@ -17,7 +17,6 @@
#include "nsILayoutHistoryState.h"
#include "nsQuoteList.h"
#include "nsCounterManager.h"
#include "nsCSSPseudoElements.h"
#include "nsIAnonymousContentCreator.h"
#include "nsFrameManager.h"
#include "nsIDocument.h"
@ -51,6 +50,7 @@ class FlattenedChildIterator;
class nsCSSFrameConstructor : public nsFrameManager
{
public:
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
typedef mozilla::dom::Element Element;
friend class mozilla::RestyleManager;
@ -452,7 +452,7 @@ private:
nsContainerFrame* aFrame,
nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
CSSPseudoElementType aPseudoElement,
FrameConstructionItemList& aItems);
// This method can change aFrameList: it can chop off the beginning and put

View File

@ -2035,7 +2035,7 @@ nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
bool
nsLayoutUtils::HasPseudoStyle(nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
CSSPseudoElementType aPseudoElement,
nsPresContext* aPresContext)
{
NS_PRECONDITION(aPresContext, "Must have a prescontext");

View File

@ -16,7 +16,6 @@
#include "mozilla/layout/FrameChildList.h"
#include "nsThreadUtils.h"
#include "nsIPrincipal.h"
#include "nsCSSPseudoElements.h"
#include "FrameMetrics.h"
#include "nsIWidget.h"
#include "nsCSSProperty.h"
@ -63,6 +62,7 @@ struct nsStyleImageOrientation;
struct nsOverflowAreas;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
class EventListenerManager;
class SVGImageContext;
struct IntrinsicSize;
@ -661,7 +661,7 @@ public:
*/
static bool HasPseudoStyle(nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
mozilla::CSSPseudoElementType aPseudoElement,
nsPresContext* aPresContext);
/**
@ -2199,7 +2199,8 @@ public:
*/
static bool GetAnimationContent(const nsIFrame* aFrame,
nsIContent* &aContentResult,
nsCSSPseudoElements::Type &aPseudoTypeResult);
mozilla::CSSPseudoElementType
&aPseudoTypeResult);
/**
* Returns true if the frame has current (i.e. running or scheduled-to-run)

View File

@ -8,6 +8,7 @@
#include "nsContentCreatorFunctions.h"
#include "nsContentList.h"
#include "nsContentUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsFormControlFrame.h"
#include "nsGkAtoms.h"
#include "nsIDOMHTMLInputElement.h"
@ -72,7 +73,7 @@ nsColorControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
nsresult rv = UpdateColor();
NS_ENSURE_SUCCESS(rv, rv);
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozColorSwatch;
CSSPseudoElementType pseudoType = CSSPseudoElementType::mozColorSwatch;
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
StyleContext(), mColorContent->AsElement());
@ -135,7 +136,7 @@ nsColorControlFrame::GetContentInsertionFrame()
}
Element*
nsColorControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsColorControlFrame::GetPseudoElement(CSSPseudoElementType aType)
{
if (aType == CSSPseudoElementType::mozColorSwatch) {
return mColorContent;

View File

@ -10,6 +10,10 @@
#include "nsHTMLButtonControlFrame.h"
#include "nsIAnonymousContentCreator.h"
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
} // namespace mozilla
typedef nsHTMLButtonControlFrame nsColorControlFrameSuper;
// Class which implements the input type=color
@ -17,6 +21,7 @@ typedef nsHTMLButtonControlFrame nsColorControlFrameSuper;
class nsColorControlFrame final : public nsColorControlFrameSuper,
public nsIAnonymousContentCreator
{
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
typedef mozilla::dom::Element Element;
public:
@ -47,7 +52,7 @@ public:
virtual bool IsLeaf() const override { return true; }
virtual nsContainerFrame* GetContentInsertionFrame() override;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
// Refresh the color swatch, using associated input's value
nsresult UpdateColor();

View File

@ -19,6 +19,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLMeterElement.h"
#include "nsContentList.h"
#include "nsCSSPseudoElements.h"
#include "nsStyleSet.h"
#include "nsThemeConstants.h"
#include <algorithm>
@ -66,7 +67,7 @@ nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
// Associate ::-moz-meter-bar pseudo-element to the anonymous child.
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozMeterBar;
CSSPseudoElementType pseudoType = CSSPseudoElementType::mozMeterBar;
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
StyleContext(), mBarDiv->AsElement());
@ -281,7 +282,7 @@ nsMeterFrame::ShouldUseNativeStyle() const
}
Element*
nsMeterFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsMeterFrame::GetPseudoElement(CSSPseudoElementType aType)
{
if (aType == CSSPseudoElementType::mozMeterBar) {
return mBarDiv;

View File

@ -73,7 +73,7 @@ public:
*/
bool ShouldUseNativeStyle() const;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
protected:
// Helper function which reflow the anonymous div frame.

View File

@ -20,6 +20,7 @@
#include "nsContentUtils.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentList.h"
#include "nsCSSPseudoElements.h"
#include "nsStyleSet.h"
#include "nsIDOMMutationEvent.h"
#include "nsThreadUtils.h"
@ -323,7 +324,7 @@ nsresult
nsNumberControlFrame::MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
nsIAtom* aTagName,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aParentContext)
{
// Get the NodeInfoManager and tag necessary to create the anonymous divs.
@ -824,7 +825,7 @@ nsNumberControlFrame::AnonTextControlIsEmpty()
}
Element*
nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsNumberControlFrame::GetPseudoElement(CSSPseudoElementType aType)
{
if (aType == CSSPseudoElementType::mozNumberWrapper) {
return mOuterWrapper;

View File

@ -16,6 +16,7 @@
class nsPresContext;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
class WidgetEvent;
class WidgetGUIEvent;
namespace dom {
@ -33,6 +34,7 @@ class nsNumberControlFrame final : public nsContainerFrame
friend nsIFrame*
NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
typedef mozilla::dom::Element Element;
typedef mozilla::dom::HTMLInputElement HTMLInputElement;
typedef mozilla::WidgetEvent WidgetEvent;
@ -186,7 +188,7 @@ public:
*/
nsresult HandleSelectCall();
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
bool ShouldUseNativeStyleForSpinner() const;
@ -196,7 +198,7 @@ private:
nsresult MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
nsIAtom* aTagName,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aParentContext);
class SyncDisabledStateEvent;

View File

@ -19,6 +19,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLProgressElement.h"
#include "nsContentList.h"
#include "nsCSSPseudoElements.h"
#include "nsStyleSet.h"
#include "nsThemeConstants.h"
#include <algorithm>
@ -63,7 +64,7 @@ nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
// Associate ::-moz-progress-bar pseudo-element to the anonymous child.
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozProgressBar;
CSSPseudoElementType pseudoType = CSSPseudoElementType::mozProgressBar;
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
StyleContext(), mBarDiv->AsElement());
@ -287,7 +288,7 @@ nsProgressFrame::ShouldUseNativeStyle() const
}
Element*
nsProgressFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsProgressFrame::GetPseudoElement(CSSPseudoElementType aType)
{
if (aType == CSSPseudoElementType::mozProgressBar) {
return mBarDiv;

View File

@ -11,9 +11,14 @@
#include "nsIAnonymousContentCreator.h"
#include "nsCOMPtr.h"
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
} // namespace mozilla
class nsProgressFrame : public nsContainerFrame,
public nsIAnonymousContentCreator
{
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
typedef mozilla::dom::Element Element;
public:
@ -76,7 +81,7 @@ public:
*/
bool ShouldUseNativeStyle() const;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
protected:
// Helper function which reflow the anonymous div frame.

View File

@ -11,6 +11,7 @@
#include "nsContentCreatorFunctions.h"
#include "nsContentList.h"
#include "nsContentUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRendering.h"
#include "nsFormControlFrame.h"
#include "nsIContent.h"
@ -110,7 +111,7 @@ nsRangeFrame::DestroyFrom(nsIFrame* aDestructRoot)
nsresult
nsRangeFrame::MakeAnonymousDiv(Element** aResult,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsTArray<ContentInfo>& aElements)
{
nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
@ -894,7 +895,7 @@ nsRangeFrame::ShouldUseNativeStyle() const
}
Element*
nsRangeFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsRangeFrame::GetPseudoElement(CSSPseudoElementType aType)
{
if (aType == CSSPseudoElementType::mozRangeTrack) {
return mTrackDiv;

View File

@ -27,6 +27,7 @@ class nsRangeFrame : public nsContainerFrame,
explicit nsRangeFrame(nsStyleContext* aContext);
virtual ~nsRangeFrame();
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
typedef mozilla::dom::Element Element;
public:
@ -147,12 +148,12 @@ public:
*/
void UpdateForValueChange();
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
private:
nsresult MakeAnonymousDiv(Element** aResult,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsTArray<ContentInfo>& aElements);
// Helper function which reflows the anonymous div frames.

View File

@ -10,6 +10,7 @@
#include "nsTextControlFrame.h"
#include "nsIPlaintextEditor.h"
#include "nsCaret.h"
#include "nsCSSPseudoElements.h"
#include "nsGenericHTMLElement.h"
#include "nsIEditor.h"
#include "nsIEditorIMESupport.h"
@ -346,7 +347,7 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
NS_ENSURE_TRUE(placeholderNode, NS_ERROR_OUT_OF_MEMORY);
// Associate ::-moz-placeholder pseudo-element with the placeholder node.
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozPlaceholder;
CSSPseudoElementType pseudoType = CSSPseudoElementType::mozPlaceholder;
RefPtr<nsStyleContext> placeholderStyleContext =
PresContext()->StyleSet()->ResolvePseudoElementStyle(
@ -1443,7 +1444,7 @@ nsTextControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
mozilla::dom::Element*
nsTextControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsTextControlFrame::GetPseudoElement(CSSPseudoElementType aType)
{
if (aType == CSSPseudoElementType::mozPlaceholder) {
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());

View File

@ -19,6 +19,7 @@ class EditorInitializerEntryTracker;
class nsTextEditorState;
class nsIEditor;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
namespace dom {
class Element;
} // namespace dom
@ -98,10 +99,11 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
virtual mozilla::dom::Element*
GetPseudoElement(mozilla::CSSPseudoElementType aType) override;
//==== BEGIN NSIFORMCONTROLFRAME
virtual void SetFocus(bool aOn , bool aRepaint) override;
virtual void SetFocus(bool aOn , bool aRepaint) override;
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;
//==== END NSIFORMCONTROLFRAME

View File

@ -24,6 +24,7 @@
#include "nsPlaceholderFrame.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsIAtom.h"
#include "nsString.h"
#include "nsReadableUtils.h"
@ -9121,7 +9122,7 @@ nsIFrame::IsPseudoStackingContextFromStyle() {
}
Element*
nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
nsIFrame::GetPseudoElement(CSSPseudoElementType aType)
{
nsIFrame* frame = nullptr;

View File

@ -90,6 +90,7 @@ struct CharacterDataChangeInfo;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
class EventStates;
namespace layers {
@ -3094,7 +3095,8 @@ public:
* generated and which corresponds to the specified pseudo-element type,
* or nullptr if there is no such anonymous content.
*/
virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType);
virtual mozilla::dom::Element*
GetPseudoElement(mozilla::CSSPseudoElementType aType);
bool BackfaceIsHidden() {
return StyleDisplay()->BackfaceIsHidden();

View File

@ -1196,7 +1196,7 @@ inDOMUtils::GetCSSPseudoElementNames(uint32_t* aLength, char16_t*** aNames)
const uint8_t pseudoCount = static_cast<uint8_t>(CSSPseudoElementType::Count);
for (uint8_t i = 0; i < pseudoCount; ++i) {
nsCSSPseudoElements::Type type = static_cast<nsCSSPseudoElements::Type>(i);
CSSPseudoElementType type = static_cast<CSSPseudoElementType>(i);
if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
array.AppendElement(atom);

View File

@ -98,7 +98,7 @@ nsMathMLFrame::ResolveMathMLCharStyle(nsPresContext* aPresContext,
nsStyleContext* aParentStyleContext,
nsMathMLChar* aMathMLChar)
{
nsCSSPseudoElements::Type pseudoType =
CSSPseudoElementType pseudoType =
CSSPseudoElementType::mozMathAnonymous; // savings
RefPtr<nsStyleContext> newStyleContext;
newStyleContext = aPresContext->StyleSet()->

View File

@ -68,7 +68,7 @@ CommonAnimationManager::RemoveAllElementCollections()
AnimationCollection*
CommonAnimationManager::GetAnimationCollection(dom::Element *aElement,
nsCSSPseudoElements::Type
CSSPseudoElementType
aPseudoType,
bool aCreateIfNeeded)
{
@ -117,7 +117,7 @@ CommonAnimationManager::GetAnimationCollection(dom::Element *aElement,
AnimationCollection*
CommonAnimationManager::GetAnimationCollection(const nsIFrame* aFrame)
{
Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>> pseudoElement =
Maybe<Pair<dom::Element*, CSSPseudoElementType>> pseudoElement =
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
if (!pseudoElement) {
return nullptr;
@ -152,7 +152,7 @@ CommonAnimationManager::ExtractComputedValueForTransition(
}
/*static*/ nsString
AnimationCollection::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
AnimationCollection::PseudoTypeAsString(CSSPseudoElementType aPseudoType)
{
switch (aPseudoType) {
case CSSPseudoElementType::before:

View File

@ -83,7 +83,7 @@ public:
// by this class for the given |aElement| and |aPseudoType|.
AnimationCollection*
GetAnimationCollection(dom::Element *aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
bool aCreateIfNeeded);
// Given the frame |aFrame| with possibly animated content, finds its
@ -174,7 +174,7 @@ public:
mElementProperty == nsGkAtoms::animationsOfAfterProperty;
}
nsCSSPseudoElements::Type PseudoElementType() const
CSSPseudoElementType PseudoElementType() const
{
if (IsForElement()) {
return CSSPseudoElementType::NotPseudo;
@ -187,7 +187,7 @@ public:
return CSSPseudoElementType::after;
}
static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);
static nsString PseudoTypeAsString(CSSPseudoElementType aPseudoType);
dom::Element* GetElementToRestyle() const;
@ -239,7 +239,7 @@ public:
{ }
OwningElementRef(dom::Element& aElement,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
: mElement(&aElement)
, mPseudoType(aPseudoType)
{ }
@ -267,7 +267,7 @@ public:
bool IsSet() const { return !!mElement; }
void GetElement(dom::Element*& aElement,
nsCSSPseudoElements::Type& aPseudoType) const {
CSSPseudoElementType& aPseudoType) const {
aElement = mElement;
aPseudoType = mPseudoType;
}
@ -276,7 +276,7 @@ public:
private:
dom::Element* MOZ_NON_OWNING_REF mElement;
nsCSSPseudoElements::Type mPseudoType;
CSSPseudoElementType mPseudoType;
};
template <class EventInfo>

View File

@ -19,6 +19,7 @@
#include "nsStyleSet.h"
#include "nsComputedDOMStyle.h"
#include "nsCSSParser.h"
#include "nsCSSPseudoElements.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/dom/Element.h"
#include "mozilla/FloatingPoint.h"
@ -2526,7 +2527,7 @@ BuildStyleRule(nsCSSProperty aProperty,
inline
already_AddRefed<nsStyleContext>
LookupStyleContext(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)
CSSPseudoElementType aPseudoType)
{
nsIDocument* doc = aElement->GetCurrentDoc();
nsIPresShell* shell = doc->GetShell();
@ -2543,7 +2544,7 @@ LookupStyleContext(dom::Element* aElement,
/* static */ bool
StyleAnimationValue::ComputeValue(nsCSSProperty aProperty,
dom::Element* aTargetElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const nsAString& aSpecifiedValue,
bool aUseSVGMode,
StyleAnimationValue& aComputedValue,
@ -2595,7 +2596,7 @@ StyleAnimationValue::ComputeValue(nsCSSProperty aProperty,
StyleAnimationValue::ComputeValues(nsCSSProperty aProperty,
nsCSSProps::EnabledState aEnabledState,
dom::Element* aTargetElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const nsAString& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult)
@ -2625,7 +2626,7 @@ StyleAnimationValue::ComputeValues(
nsCSSProperty aProperty,
nsCSSProps::EnabledState aEnabledState,
dom::Element* aTargetElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
css::StyleRule* aStyleRule,
nsTArray<PropertyStyleAnimationValuePair>& aValues,
bool* aIsContextSensitive)

View File

@ -14,7 +14,6 @@
#include "nsCoord.h"
#include "nsColor.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSValue.h"
class nsIFrame;
@ -31,6 +30,7 @@ namespace dom {
class Element;
} // namespace dom
enum class CSSPseudoElementType : uint8_t;
struct PropertyStyleAnimationValuePair;
/**
@ -156,7 +156,7 @@ public:
*/
static bool ComputeValue(nsCSSProperty aProperty,
mozilla::dom::Element* aTargetElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const nsAString& aSpecifiedValue,
bool aUseSVGMode,
StyleAnimationValue& aComputedValue,
@ -175,7 +175,7 @@ public:
static bool ComputeValues(nsCSSProperty aProperty,
nsCSSProps::EnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const nsAString& aSpecifiedValue,
bool aUseSVGMode,
nsTArray<PropertyStyleAnimationValuePair>& aResult);
@ -403,7 +403,7 @@ private:
static bool ComputeValues(nsCSSProperty aProperty,
nsCSSProps::EnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
mozilla::css::StyleRule* aStyleRule,
nsTArray<PropertyStyleAnimationValuePair>& aValues,
bool* aIsContextSensitive);

View File

@ -23,7 +23,6 @@
#include "nsDOMCSSDeclaration.h"
#include "nsNameSpaceManager.h"
#include "nsXMLNameSpaceMap.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSPseudoClasses.h"
#include "nsCSSAnonBoxes.h"
#include "nsTArray.h"
@ -319,7 +318,7 @@ nsCSSSelector::nsCSSSelector(void)
{
MOZ_COUNT_CTOR(nsCSSSelector);
static_assert(static_cast<int16_t>(CSSPseudoElementType::MAX) < INT16_MAX,
"nsCSSPseudoElements::Type values overflow mPseudoType");
"CSSPseudoElementType values overflow mPseudoType");
}
nsCSSSelector*

View File

@ -17,8 +17,8 @@
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSPseudoClasses.h"
#include "nsCSSPseudoElements.h"
#include "nsIStyleRule.h"
class nsIAtom;
@ -208,13 +208,10 @@ private:
public:
// Get and set the selector's pseudo type
nsCSSPseudoElements::Type PseudoType() const {
return static_cast<nsCSSPseudoElements::Type>(mPseudoType);
mozilla::CSSPseudoElementType PseudoType() const {
return static_cast<mozilla::CSSPseudoElementType>(mPseudoType);
}
void SetPseudoType(nsCSSPseudoElements::Type aType) {
NS_ASSERTION(static_cast<int32_t>(aType) >= INT16_MIN &&
static_cast<int32_t>(aType) <= INT16_MAX,
"Out of bounds - this will overflow mPseudoType");
void SetPseudoType(mozilla::CSSPseudoElementType aType) {
mPseudoType = static_cast<int16_t>(aType);
}

View File

@ -168,7 +168,7 @@ CSSAnimation::QueueEvents()
}
dom::Element* owningElement;
nsCSSPseudoElements::Type owningPseudoType;
CSSPseudoElementType owningPseudoType;
mOwningElement.GetElement(owningElement, owningPseudoType);
MOZ_ASSERT(owningElement, "Owning element should be set");
@ -488,7 +488,7 @@ nsAnimationManager::UpdateAnimations(nsStyleContext* aStyleContext,
void
nsAnimationManager::StopAnimationsForElement(
mozilla::dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)
mozilla::CSSPseudoElementType aPseudoType)
{
MOZ_ASSERT(aElement);
AnimationCollection* collection =

View File

@ -9,7 +9,6 @@
#include "mozilla/ContentEvents.h"
#include "mozilla/EventForwards.h"
#include "AnimationCommon.h"
#include "nsCSSPseudoElements.h"
#include "mozilla/dom/Animation.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h"
@ -26,6 +25,8 @@ class KeyframeEffectReadOnly;
class Promise;
} /* namespace dom */
enum class CSSPseudoElementType : uint8_t;
struct AnimationEventInfo {
RefPtr<dom::Element> mElement;
RefPtr<dom::Animation> mAnimation;
@ -33,7 +34,7 @@ struct AnimationEventInfo {
TimeStamp mTimeStamp;
AnimationEventInfo(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
EventMessage aMessage,
const nsSubstring& aAnimationName,
const StickyTimeDuration& aElapsedTime,
@ -322,7 +323,7 @@ public:
// rather than the element for the generated content for animations on
// ::before and ::after.
void StopAnimationsForElement(mozilla::dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
mozilla::CSSPseudoElementType aPseudoType);
bool IsAnimationManager() override {
return true;

View File

@ -753,7 +753,7 @@ protected:
bool aIsNegated,
nsIAtom** aPseudoElement,
nsAtomList** aPseudoElementArgs,
nsCSSPseudoElements::Type* aPseudoElementType);
CSSPseudoElementType* aPseudoElementType);
nsSelectorParsingStatus ParseAttributeSelector(int32_t& aDataMask,
nsCSSSelector& aSelector);
@ -5827,7 +5827,7 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
bool aIsNegated,
nsIAtom** aPseudoElement,
nsAtomList** aPseudoElementArgs,
nsCSSPseudoElements::Type* aPseudoElementType)
CSSPseudoElementType* aPseudoElementType)
{
NS_ASSERTION(aIsNegated || (aPseudoElement && aPseudoElementArgs),
"expected location to store pseudo element");
@ -5867,7 +5867,7 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
// stash away some info about this pseudo so we only have to get it once.
bool isTreePseudo = false;
nsCSSPseudoElements::Type pseudoElementType =
CSSPseudoElementType pseudoElementType =
nsCSSPseudoElements::GetPseudoType(pseudo);
nsCSSPseudoClasses::Type pseudoClassType =
nsCSSPseudoClasses::GetPseudoType(pseudo);
@ -5971,7 +5971,7 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
}
else if (!parsingPseudoElement && isPseudoClass) {
if (aSelector.IsPseudoElement()) {
nsCSSPseudoElements::Type type = aSelector.PseudoType();
CSSPseudoElementType type = aSelector.PseudoType();
if (!nsCSSPseudoElements::PseudoElementSupportsUserActionState(type)) {
// We only allow user action pseudo-classes on certain pseudo-elements.
REPORT_UNEXPECTED_TOKEN(PEPseudoSelNoUserActionPC);
@ -6412,7 +6412,7 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList,
nsCSSSelector* selector = aList->AddSelector(aPrevCombinator);
nsCOMPtr<nsIAtom> pseudoElement;
nsAutoPtr<nsAtomList> pseudoElementArgs;
nsCSSPseudoElements::Type pseudoElementType = CSSPseudoElementType::NotPseudo;
CSSPseudoElementType pseudoElementType = CSSPseudoElementType::NotPseudo;
int32_t dataMask = 0;
nsSelectorParsingStatus parsingStatus =

View File

@ -67,8 +67,8 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
aAtom == nsCSSPseudoElements::firstLetter ||
aAtom == nsCSSPseudoElements::firstLine;
NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) ||
result ==
PseudoElementHasFlags(GetPseudoType(aAtom), CSS_PSEUDO_ELEMENT_IS_CSS2),
result == PseudoElementHasFlags(GetPseudoType(aAtom),
CSS_PSEUDO_ELEMENT_IS_CSS2),
"result doesn't match flags");
return result;
}
@ -76,9 +76,9 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
/* static */ CSSPseudoElementType
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
{
for (uint32_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
for (uint8_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
if (*CSSPseudoElements_info[i].mAtom == aAtom) {
return Type(i);
return static_cast<Type>(i);
}
}
@ -98,15 +98,14 @@ nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
/* static */ nsIAtom*
nsCSSPseudoElements::GetPseudoAtom(Type aType)
{
NS_ASSERTION(aType < Type::Count,
"Unexpected type");
NS_ASSERTION(aType < Type::Count, "Unexpected type");
return *CSSPseudoElements_info[static_cast<uint8_t>(aType)].mAtom;
}
/* static */ uint32_t
nsCSSPseudoElements::FlagsForPseudoElement(const Type aType)
{
size_t index = static_cast<size_t>(aType);
uint8_t index = static_cast<uint8_t>(aType);
NS_ASSERTION(index < ArrayLength(CSSPseudoElements_flags),
"argument must be a pseudo-element");
return CSSPseudoElements_flags[index];

View File

@ -61,11 +61,11 @@ enum class CSSPseudoElementType : uint8_t {
// require an atom from this atom list.
class nsICSSPseudoElement : public nsIAtom {};
class nsCSSPseudoElements {
public:
// FIXME: Remove this in later patch
using Type = mozilla::CSSPseudoElementType;
class nsCSSPseudoElements
{
typedef mozilla::CSSPseudoElementType Type;
public:
static void AddRefAtoms();
static bool IsPseudoElement(nsIAtom *aAtom);
@ -79,7 +79,7 @@ public:
static Type GetPseudoType(nsIAtom* aAtom);
// Get the atom for a given Type. aType must be < Type::Count
// Get the atom for a given Type. aType must be < CSSPseudoElementType::Count
static nsIAtom* GetPseudoAtom(Type aType);
static bool PseudoElementContainsElements(const Type aType) {
@ -88,7 +88,8 @@ public:
static bool PseudoElementSupportsStyleAttribute(const Type aType) {
MOZ_ASSERT(aType < Type::Count);
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
return PseudoElementHasFlags(aType,
CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
}
static bool PseudoElementSupportsUserActionState(const Type aType);

View File

@ -2716,7 +2716,7 @@ static inline nsRestyleHint RestyleHintForOp(char16_t oper)
nsRestyleHint
nsCSSRuleProcessor::HasStateDependentStyle(ElementDependentRuleProcessorData* aData,
Element* aStatefulElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
EventStates aStateMask)
{
MOZ_ASSERT(!aData->mTreeMatchContext.mForScopedStyle,
@ -3411,7 +3411,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
RuleCascadeData * const cascade = aCascade;
// Build the rule hash.
nsCSSPseudoElements::Type pseudoType = aRuleInfo->mSelector->PseudoType();
CSSPseudoElementType pseudoType = aRuleInfo->mSelector->PseudoType();
if (MOZ_LIKELY(pseudoType == CSSPseudoElementType::NotPseudo)) {
cascade->mRuleHash.AppendRule(*aRuleInfo);
} else if (pseudoType < CSSPseudoElementType::Count) {
@ -3462,7 +3462,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
for (nsCSSSelector* selector = aRuleInfo->mSelector;
selector; selector = selector->mNext) {
if (selector->IsPseudoElement()) {
nsCSSPseudoElements::Type pseudo = selector->PseudoType();
CSSPseudoElementType pseudo = selector->PseudoType();
if (pseudo >= CSSPseudoElementType::Count ||
!nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudo)) {
NS_ASSERTION(!selector->mNegations, "Shouldn't have negations");

View File

@ -19,7 +19,6 @@
#include "mozilla/SheetType.h"
#include "mozilla/UniquePtr.h"
#include "nsAutoPtr.h"
#include "nsCSSPseudoElements.h"
#include "nsExpirationTracker.h"
#include "nsIMediaList.h"
#include "nsIStyleRuleProcessor.h"
@ -40,6 +39,7 @@ class nsCSSCounterStyleRule;
namespace mozilla {
class CSSStyleSheet;
enum class CSSPseudoElementType : uint8_t;
namespace css {
class DocumentRule;
} // namespace css
@ -234,7 +234,7 @@ private:
nsRestyleHint HasStateDependentStyle(ElementDependentRuleProcessorData* aData,
mozilla::dom::Element* aStatefulElement,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
mozilla::EventStates aStateMask);
void ClearSheets();

View File

@ -488,7 +488,7 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
RefPtr<nsStyleContext> sc;
if (aPseudo) {
nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
CSSPseudoElementType type = nsCSSPseudoElements::GetPseudoType(aPseudo);
if (type >= CSSPseudoElementType::Count) {
return nullptr;
}
@ -696,8 +696,7 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
while (topWithPseudoElementData->GetParent()->HasPseudoElementData()) {
topWithPseudoElementData = topWithPseudoElementData->GetParent();
}
nsCSSPseudoElements::Type pseudo =
topWithPseudoElementData->GetPseudoType();
CSSPseudoElementType pseudo = topWithPseudoElementData->GetPseudoType();
nsIAtom* pseudoAtom = nsCSSPseudoElements::GetPseudoAtom(pseudo);
nsAutoString assertMsg(
NS_LITERAL_STRING("we should be in a pseudo-element that is expected to contain elements ("));

View File

@ -18,6 +18,7 @@
#include "mozilla/dom/Element.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#include "nsCSSPseudoElements.h"
#include "RestyleManager.h"
using namespace mozilla;
@ -81,7 +82,7 @@ nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
void
nsHTMLCSSStyleSheet::PseudoElementRulesMatching(Element* aPseudoElement,
nsCSSPseudoElements::Type
CSSPseudoElementType
aPseudoType,
nsRuleWalker* aRuleWalker)
{

View File

@ -13,7 +13,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "nsCSSPseudoElements.h"
#include "nsDataHashtable.h"
#include "nsIStyleRuleProcessor.h"
@ -21,6 +20,7 @@ class nsRuleWalker;
struct MiscContainer;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
namespace dom {
class Element;
} // namespace dom
@ -60,7 +60,7 @@ public:
// aPseudoElement here is the content node for the pseudo-element, not
// its corresponding real element.
void PseudoElementRulesMatching(mozilla::dom::Element* aPseudoElement,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
nsRuleWalker* aRuleWalker);
void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);

View File

@ -470,7 +470,7 @@ struct MOZ_STACK_CLASS PseudoElementRuleProcessorData :
PseudoElementRuleProcessorData(nsPresContext* aPresContext,
mozilla::dom::Element* aParentElement,
nsRuleWalker* aRuleWalker,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
TreeMatchContext& aTreeMatchContext,
mozilla::dom::Element* aPseudoElement)
: ElementDependentRuleProcessorData(aPresContext, aParentElement, aRuleWalker,
@ -484,7 +484,7 @@ struct MOZ_STACK_CLASS PseudoElementRuleProcessorData :
NS_PRECONDITION(aRuleWalker, "Must have rule walker");
}
nsCSSPseudoElements::Type mPseudoType;
mozilla::CSSPseudoElementType mPseudoType;
mozilla::dom::Element* const mPseudoElement; // weak ref
};
@ -549,7 +549,7 @@ struct MOZ_STACK_CLASS PseudoElementStateRuleProcessorData :
PseudoElementStateRuleProcessorData(nsPresContext* aPresContext,
mozilla::dom::Element* aElement,
mozilla::EventStates aStateMask,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
TreeMatchContext& aTreeMatchContext,
mozilla::dom::Element* aPseudoElement)
: StateRuleProcessorData(aPresContext, aElement, aStateMask,
@ -563,7 +563,7 @@ struct MOZ_STACK_CLASS PseudoElementStateRuleProcessorData :
// We kind of want to inherit from both StateRuleProcessorData and
// PseudoElementRuleProcessorData. Instead we've just copied those
// members from PseudoElementRuleProcessorData to this struct.
nsCSSPseudoElements::Type mPseudoType;
mozilla::CSSPseudoElementType mPseudoType;
mozilla::dom::Element* const mPseudoElement; // weak ref
};

View File

@ -2,13 +2,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* the interface (to internal code) for retrieving computed style data */
#include "CSSVariableImageTable.h"
#include "mozilla/DebugOnly.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
#include "nsStyleConsts.h"
#include "nsString.h"
#include "nsPresContext.h"
@ -70,7 +71,7 @@ static bool sExpensiveStyleStructAssertionsEnabled;
nsStyleContext::nsStyleContext(nsStyleContext* aParent,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsRuleNode* aRuleNode,
bool aSkipParentDisplayBasedStyleFixup)
: mParent(aParent)
@ -1216,7 +1217,7 @@ nsStyleContext::Destroy()
already_AddRefed<nsStyleContext>
NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsRuleNode* aRuleNode,
bool aSkipParentDisplayBasedStyleFixup)
{

View File

@ -11,11 +11,14 @@
#include "mozilla/RestyleLogging.h"
#include "mozilla/Assertions.h"
#include "nsRuleNode.h"
#include "nsCSSPseudoElements.h"
class nsIAtom;
class nsPresContext;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
} // namespace mozilla
/**
* An nsStyleContext represents the computed style data for an element.
* The computed style data are stored in a set of structs (see
@ -60,13 +63,13 @@ public:
* matches. See |nsRuleNode| and |nsIStyleRule|.
* @param aSkipParentDisplayBasedStyleFixup
* If set, this flag indicates that we should skip
* the chunk of ApplyStyleFixups() that applies to
* special cases where a child element's style may
* need to be modified based on its parent's display
* the chunk of ApplyStyleFixups() that applies to
* special cases where a child element's style may
* need to be modified based on its parent's display
* value.
*/
nsStyleContext(nsStyleContext* aParent, nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
nsRuleNode* aRuleNode,
bool aSkipParentDisplayBasedStyleFixup);
@ -137,9 +140,9 @@ public:
nsStyleContext* GetParent() const { return mParent; }
nsIAtom* GetPseudo() const { return mPseudoTag; }
nsCSSPseudoElements::Type GetPseudoType() const {
return static_cast<nsCSSPseudoElements::Type>(mBits >>
NS_STYLE_CONTEXT_TYPE_SHIFT);
mozilla::CSSPseudoElementType GetPseudoType() const {
return static_cast<mozilla::CSSPseudoElementType>(
mBits >> NS_STYLE_CONTEXT_TYPE_SHIFT);
}
// Find, if it already exists *and is easily findable* (i.e., near the
@ -629,7 +632,7 @@ private:
already_AddRefed<nsStyleContext>
NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
nsRuleNode* aRuleNode,
bool aSkipParentDisplayBasedStyleFixup);
#endif

View File

@ -885,7 +885,7 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
// should be used.)
nsRuleNode* aVisitedRuleNode,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
Element* aElementForAnimation,
uint32_t aFlags)
{
@ -1504,7 +1504,7 @@ nsRuleNode*
nsStyleSet::RuleNodeWithReplacement(Element* aElement,
Element* aPseudoElement,
nsRuleNode* aOldRuleNode,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsRestyleHint aReplacements)
{
NS_ASSERTION(mBatching == 0, "rule processors out of date");
@ -1706,7 +1706,7 @@ nsStyleSet::ResolveStyleWithReplacement(Element* aElement,
}
}
nsCSSPseudoElements::Type pseudoType = aOldStyleContext->GetPseudoType();
CSSPseudoElementType pseudoType = aOldStyleContext->GetPseudoType();
Element* elementForAnimation = nullptr;
if (!(aFlags & eSkipStartingAnimations) &&
(pseudoType == CSSPseudoElementType::NotPseudo ||
@ -1756,7 +1756,7 @@ nsStyleSet::ResolveStyleWithoutAnimation(dom::Element* aTarget,
nsRestyleHint aWhichToRemove)
{
#ifdef DEBUG
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
#endif
MOZ_ASSERT(pseudoType == CSSPseudoElementType::NotPseudo ||
pseudoType == CSSPseudoElementType::before ||
@ -1787,7 +1787,7 @@ nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
}
void
nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
nsStyleSet::WalkRestrictionRule(CSSPseudoElementType aPseudoType,
nsRuleWalker* aRuleWalker)
{
// This needs to match GetPseudoRestriction in nsRuleNode.cpp.
@ -1810,7 +1810,7 @@ nsStyleSet::WalkDisableTextZoomRule(Element* aElement, nsRuleWalker* aRuleWalker
already_AddRefed<nsStyleContext>
nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
nsCSSPseudoElements::Type aType,
CSSPseudoElementType aType,
nsStyleContext* aParentContext,
Element* aPseudoElement)
{
@ -1864,7 +1864,7 @@ nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
already_AddRefed<nsStyleContext>
nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
nsCSSPseudoElements::Type aType,
CSSPseudoElementType aType,
nsStyleContext* aParentContext)
{
TreeMatchContext treeContext(true, nsRuleWalker::eRelevantLinkUnvisited,
@ -1876,7 +1876,7 @@ nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
already_AddRefed<nsStyleContext>
nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
nsCSSPseudoElements::Type aType,
CSSPseudoElementType aType,
nsStyleContext* aParentContext,
TreeMatchContext& aTreeMatchContext,
Element* aPseudoElement)
@ -2265,7 +2265,7 @@ nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
}
nsIAtom* pseudoTag = aStyleContext->GetPseudo();
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
nsRuleNode* ruleNode = aStyleContext->RuleNode();
NS_ASSERTION(!PresContext()->RestyleManager()->SkipAnimationRules(),
@ -2324,7 +2324,7 @@ struct MOZ_STACK_CLASS StatefulData : public StateRuleProcessorData {
struct MOZ_STACK_CLASS StatefulPseudoElementData : public PseudoElementStateRuleProcessorData {
StatefulPseudoElementData(nsPresContext* aPresContext, Element* aElement,
EventStates aStateMask, nsCSSPseudoElements::Type aPseudoType,
EventStates aStateMask, CSSPseudoElementType aPseudoType,
TreeMatchContext& aTreeMatchContext, Element* aPseudoElement)
: PseudoElementStateRuleProcessorData(aPresContext, aElement, aStateMask,
aPseudoType, aTreeMatchContext,
@ -2395,7 +2395,7 @@ nsStyleSet::HasStateDependentStyle(Element* aElement,
nsRestyleHint
nsStyleSet::HasStateDependentStyle(Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
Element* aPseudoElement,
EventStates aStateMask)
{

View File

@ -25,7 +25,6 @@
#include "nsCOMArray.h"
#include "nsAutoPtr.h"
#include "nsIStyleRule.h"
#include "nsCSSPseudoElements.h"
class gfxFontFeatureValueSet;
class nsCSSKeyframesRule;
@ -41,6 +40,7 @@ struct TreeMatchContext;
namespace mozilla {
class CSSStyleSheet;
class EventStates;
enum class CSSPseudoElementType : uint8_t;
} // namespace mozilla
class nsEmptyStyleRule final : public nsIStyleRule
@ -172,13 +172,13 @@ class nsStyleSet final
ResolveStyleForNonElement(nsStyleContext* aParentContext);
// Get a style context for a pseudo-element. aParentElement must be
// non-null. aPseudoID is the nsCSSPseudoElements::Type for the
// non-null. aPseudoID is the CSSPseudoElementType for the
// pseudo-element. aPseudoElement must be non-null if the pseudo-element
// type is one that allows user action pseudo-classes after it or allows
// style attributes; otherwise, it is ignored.
already_AddRefed<nsStyleContext>
ResolvePseudoElementStyle(mozilla::dom::Element* aParentElement,
nsCSSPseudoElements::Type aType,
mozilla::CSSPseudoElementType aType,
nsStyleContext* aParentContext,
mozilla::dom::Element* aPseudoElement);
@ -187,11 +187,11 @@ class nsStyleSet final
// pseudo element.
already_AddRefed<nsStyleContext>
ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
nsCSSPseudoElements::Type aType,
mozilla::CSSPseudoElementType aType,
nsStyleContext* aParentContext);
already_AddRefed<nsStyleContext>
ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
nsCSSPseudoElements::Type aType,
mozilla::CSSPseudoElementType aType,
nsStyleContext* aParentContext,
TreeMatchContext& aTreeMatchContext,
mozilla::dom::Element* aPseudoElement = nullptr);
@ -283,7 +283,7 @@ class nsStyleSet final
nsRestyleHint HasStateDependentStyle(mozilla::dom::Element* aElement,
mozilla::EventStates aStateMask);
nsRestyleHint HasStateDependentStyle(mozilla::dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
mozilla::dom::Element* aPseudoElement,
mozilla::EventStates aStateMask);
@ -419,7 +419,7 @@ private:
// Move aRuleWalker forward by the appropriate rule if we need to add
// a rule due to property restrictions on pseudo-elements.
void WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
void WalkRestrictionRule(mozilla::CSSPseudoElementType aPseudoType,
nsRuleWalker* aRuleWalker);
void WalkDisableTextZoomRule(mozilla::dom::Element* aElement,
@ -460,7 +460,7 @@ private:
nsRuleNode* RuleNodeWithReplacement(mozilla::dom::Element* aElement,
mozilla::dom::Element* aPseudoElement,
nsRuleNode* aOldRuleNode,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
nsRestyleHint aReplacements);
already_AddRefed<nsStyleContext>
@ -468,7 +468,7 @@ private:
nsRuleNode* aRuleNode,
nsRuleNode* aVisitedRuleNode,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
mozilla::dom::Element* aElementForAnimation,
uint32_t aFlags);

View File

@ -28,6 +28,7 @@
#include "Layers.h"
#include "FrameLayerBuilder.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
#include "nsDisplayList.h"
#include "nsStyleChangeList.h"
#include "nsStyleSet.h"
@ -129,7 +130,7 @@ CSSTransition::QueueEvents()
}
dom::Element* owningElement;
nsCSSPseudoElements::Type owningPseudoType;
CSSPseudoElementType owningPseudoType;
mOwningElement.GetElement(owningElement, owningPseudoType);
MOZ_ASSERT(owningElement, "Owning element should be set");
@ -261,7 +262,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
// Return sooner (before the startedAny check below) for the most
// common case: no transitions specified or running.
const nsStyleDisplay *disp = newStyleContext->StyleDisplay();
nsCSSPseudoElements::Type pseudoType = newStyleContext->GetPseudoType();
CSSPseudoElementType pseudoType = newStyleContext->GetPseudoType();
if (pseudoType != CSSPseudoElementType::NotPseudo) {
if (pseudoType != CSSPseudoElementType::before &&
pseudoType != CSSPseudoElementType::after) {
@ -734,8 +735,7 @@ nsTransitionManager::ConsiderStartingTransition(
void
nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
nsCSSPseudoElements::Type
aPseudoType,
CSSPseudoElementType aPseudoType,
nsStyleContext* aNewStyleContext)
{
AnimationCollection* collection =

View File

@ -16,7 +16,6 @@
#include "mozilla/dom/KeyframeEffect.h"
#include "AnimationCommon.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
class nsIGlobalObject;
class nsStyleContext;
@ -24,6 +23,7 @@ class nsPresContext;
class nsCSSPropertySet;
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
struct StyleTransition;
} // namespace mozilla
@ -37,7 +37,7 @@ struct ElementPropertyTransition : public dom::KeyframeEffectReadOnly
{
ElementPropertyTransition(nsIDocument* aDocument,
dom::Element* aTarget,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
const TimingParams &aTiming,
StyleAnimationValue aStartForReversingTest,
double aReversePortion)
@ -216,7 +216,7 @@ struct TransitionEventInfo {
TimeStamp mTimeStamp;
TransitionEventInfo(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CSSPseudoElementType aPseudoType,
nsCSSProperty aProperty,
StickyTimeDuration aDuration,
const TimeStamp& aTimeStamp,
@ -289,7 +289,7 @@ public:
* new style.
*/
void PruneCompletedTransitions(mozilla::dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
mozilla::CSSPseudoElementType aPseudoType,
nsStyleContext* aNewStyleContext);
void SetInAnimationOnlyStyleUpdate(bool aInAnimationOnlyUpdate) {