Bug 1244049 - Part 1: Define scoped enum for CSSPseudoElement type. r=dbaron
This commit is contained in:
@@ -22,8 +22,8 @@ CSSPseudoElement::CSSPseudoElement(Element* aElement,
|
|||||||
, mPseudoType(aType)
|
, mPseudoType(aType)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aElement);
|
MOZ_ASSERT(aElement);
|
||||||
MOZ_ASSERT(aType == nsCSSPseudoElements::ePseudo_after ||
|
MOZ_ASSERT(aType == CSSPseudoElementType::after ||
|
||||||
aType == nsCSSPseudoElements::ePseudo_before,
|
aType == CSSPseudoElementType::before,
|
||||||
"Unexpected Pseudo Type");
|
"Unexpected Pseudo Type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,10 +100,10 @@ CSSPseudoElement::GetCSSPseudoElementPropertyAtom(
|
|||||||
nsCSSPseudoElements::Type aType)
|
nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
switch (aType) {
|
switch (aType) {
|
||||||
case nsCSSPseudoElements::ePseudo_before:
|
case CSSPseudoElementType::before:
|
||||||
return nsGkAtoms::cssPseudoElementBeforeProperty;
|
return nsGkAtoms::cssPseudoElementBeforeProperty;
|
||||||
|
|
||||||
case nsCSSPseudoElements::ePseudo_after:
|
case CSSPseudoElementType::after:
|
||||||
return nsGkAtoms::cssPseudoElementAfterProperty;
|
return nsGkAtoms::cssPseudoElementAfterProperty;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
|||||||
EffectCompositor::GetElementToRestyle(dom::Element* aElement,
|
EffectCompositor::GetElementToRestyle(dom::Element* aElement,
|
||||||
nsCSSPseudoElements::Type aPseudoType)
|
nsCSSPseudoElements::Type aPseudoType)
|
||||||
{
|
{
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (aPseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
return aElement;
|
return aElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,9 +292,9 @@ EffectCompositor::GetElementToRestyle(dom::Element* aElement,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
nsIFrame* pseudoFrame;
|
nsIFrame* pseudoFrame;
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
|
if (aPseudoType == CSSPseudoElementType::before) {
|
||||||
pseudoFrame = nsLayoutUtils::GetBeforeFrame(primaryFrame);
|
pseudoFrame = nsLayoutUtils::GetBeforeFrame(primaryFrame);
|
||||||
} else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
} else if (aPseudoType == CSSPseudoElementType::after) {
|
||||||
pseudoFrame = nsLayoutUtils::GetAfterFrame(primaryFrame);
|
pseudoFrame = nsLayoutUtils::GetAfterFrame(primaryFrame);
|
||||||
} else {
|
} else {
|
||||||
NS_NOTREACHED("Should not try to get the element to restyle for a pseudo "
|
NS_NOTREACHED("Should not try to get the element to restyle for a pseudo "
|
||||||
@@ -497,7 +497,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsCSSPseudoElements::Type pseudoType =
|
nsCSSPseudoElements::Type pseudoType =
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
CSSPseudoElementType::NotPseudo;
|
||||||
|
|
||||||
if (aFrame->IsGeneratedContentFrame()) {
|
if (aFrame->IsGeneratedContentFrame()) {
|
||||||
nsIFrame* parent = aFrame->GetParent();
|
nsIFrame* parent = aFrame->GetParent();
|
||||||
@@ -506,9 +506,9 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
|
|||||||
}
|
}
|
||||||
nsIAtom* name = content->NodeInfo()->NameAtom();
|
nsIAtom* name = content->NodeInfo()->NameAtom();
|
||||||
if (name == nsGkAtoms::mozgeneratedcontentbefore) {
|
if (name == nsGkAtoms::mozgeneratedcontentbefore) {
|
||||||
pseudoType = nsCSSPseudoElements::ePseudo_before;
|
pseudoType = CSSPseudoElementType::before;
|
||||||
} else if (name == nsGkAtoms::mozgeneratedcontentafter) {
|
} else if (name == nsGkAtoms::mozgeneratedcontentafter) {
|
||||||
pseudoType = nsCSSPseudoElements::ePseudo_after;
|
pseudoType = CSSPseudoElementType::after;
|
||||||
} else {
|
} else {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -763,7 +763,7 @@ EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
|||||||
{
|
{
|
||||||
nsIStyleRule *rule =
|
nsIStyleRule *rule =
|
||||||
mCompositor->GetAnimationRule(aData->mElement,
|
mCompositor->GetAnimationRule(aData->mElement,
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
CSSPseudoElementType::NotPseudo,
|
||||||
mCascadeLevel);
|
mCascadeLevel);
|
||||||
if (rule) {
|
if (rule) {
|
||||||
aData->mRuleWalker->Forward(rule);
|
aData->mRuleWalker->Forward(rule);
|
||||||
@@ -775,8 +775,8 @@ void
|
|||||||
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
|
||||||
PseudoElementRuleProcessorData* aData)
|
PseudoElementRuleProcessorData* aData)
|
||||||
{
|
{
|
||||||
if (aData->mPseudoType != nsCSSPseudoElements::ePseudo_before &&
|
if (aData->mPseudoType != CSSPseudoElementType::before &&
|
||||||
aData->mPseudoType != nsCSSPseudoElements::ePseudo_after) {
|
aData->mPseudoType != CSSPseudoElementType::after) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,13 +155,13 @@ EffectSet::GetEffectSetPropertyAtoms()
|
|||||||
EffectSet::GetEffectSetPropertyAtom(nsCSSPseudoElements::Type aPseudoType)
|
EffectSet::GetEffectSetPropertyAtom(nsCSSPseudoElements::Type aPseudoType)
|
||||||
{
|
{
|
||||||
switch (aPseudoType) {
|
switch (aPseudoType) {
|
||||||
case nsCSSPseudoElements::ePseudo_NotPseudoElement:
|
case CSSPseudoElementType::NotPseudo:
|
||||||
return nsGkAtoms::animationEffectsProperty;
|
return nsGkAtoms::animationEffectsProperty;
|
||||||
|
|
||||||
case nsCSSPseudoElements::ePseudo_before:
|
case CSSPseudoElementType::before:
|
||||||
return nsGkAtoms::animationEffectsForBeforeProperty;
|
return nsGkAtoms::animationEffectsForBeforeProperty;
|
||||||
|
|
||||||
case nsCSSPseudoElements::ePseudo_after:
|
case CSSPseudoElementType::after:
|
||||||
return nsGkAtoms::animationEffectsForAfterProperty;
|
return nsGkAtoms::animationEffectsForAfterProperty;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -624,8 +624,7 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect(const GlobalObject& aGlobal,
|
|||||||
"Uninitialized target");
|
"Uninitialized target");
|
||||||
|
|
||||||
RefPtr<Element> targetElement;
|
RefPtr<Element> targetElement;
|
||||||
nsCSSPseudoElements::Type pseudoType =
|
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::NotPseudo;
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
|
||||||
if (target.IsElement()) {
|
if (target.IsElement()) {
|
||||||
targetElement = &target.GetAsElement();
|
targetElement = &target.GetAsElement();
|
||||||
} else {
|
} else {
|
||||||
@@ -1721,13 +1720,13 @@ KeyframeEffectReadOnly::GetTarget(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (mPseudoType) {
|
switch (mPseudoType) {
|
||||||
case nsCSSPseudoElements::ePseudo_before:
|
case CSSPseudoElementType::before:
|
||||||
case nsCSSPseudoElements::ePseudo_after:
|
case CSSPseudoElementType::after:
|
||||||
aRv.SetValue().SetAsCSSPseudoElement() =
|
aRv.SetValue().SetAsCSSPseudoElement() =
|
||||||
CSSPseudoElement::GetCSSPseudoElement(mTarget, mPseudoType);
|
CSSPseudoElement::GetCSSPseudoElement(mTarget, mPseudoType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsCSSPseudoElements::ePseudo_NotPseudoElement:
|
case CSSPseudoElementType::NotPseudo:
|
||||||
aRv.SetValue().SetAsElement() = mTarget;
|
aRv.SetValue().SetAsElement() = mTarget;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1975,12 +1974,12 @@ KeyframeEffectReadOnly::GetAnimationFrame() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPseudoType == nsCSSPseudoElements::ePseudo_before) {
|
if (mPseudoType == CSSPseudoElementType::before) {
|
||||||
frame = nsLayoutUtils::GetBeforeFrame(frame);
|
frame = nsLayoutUtils::GetBeforeFrame(frame);
|
||||||
} else if (mPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
} else if (mPseudoType == CSSPseudoElementType::after) {
|
||||||
frame = nsLayoutUtils::GetAfterFrame(frame);
|
frame = nsLayoutUtils::GetAfterFrame(frame);
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(mPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
MOZ_ASSERT(mPseudoType == CSSPseudoElementType::NotPseudo,
|
||||||
"unknown mPseudoType");
|
"unknown mPseudoType");
|
||||||
}
|
}
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ public:
|
|||||||
if (!aKey)
|
if (!aKey)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return mozilla::HashGeneric(aKey->mElement, aKey->mPseudoType);
|
// Convert the scoped enum into an integer while adding it to hash.
|
||||||
|
return mozilla::HashGeneric(aKey->mElement,
|
||||||
|
static_cast<uint8_t>(aKey->mPseudoType));
|
||||||
}
|
}
|
||||||
enum { ALLOW_MEMMOVE = true };
|
enum { ALLOW_MEMMOVE = true };
|
||||||
|
|
||||||
|
|||||||
@@ -3368,7 +3368,7 @@ void
|
|||||||
Element::GetAnimationsUnsorted(nsTArray<RefPtr<Animation>>& aAnimations)
|
Element::GetAnimationsUnsorted(nsTArray<RefPtr<Animation>>& aAnimations)
|
||||||
{
|
{
|
||||||
EffectSet* effects = EffectSet::GetEffectSet(this,
|
EffectSet* effects = EffectSet::GetEffectSet(this,
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement);
|
CSSPseudoElementType::NotPseudo);
|
||||||
if (!effects) {
|
if (!effects) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2247,13 +2247,12 @@ ComputeAnimationValue(nsCSSProperty aProperty,
|
|||||||
StyleAnimationValue& aOutput)
|
StyleAnimationValue& aOutput)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!StyleAnimationValue::ComputeValue(
|
if (!StyleAnimationValue::ComputeValue(aProperty,
|
||||||
aProperty,
|
aElement,
|
||||||
aElement,
|
CSSPseudoElementType::NotPseudo,
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
aInput,
|
||||||
aInput,
|
false,
|
||||||
false,
|
aOutput)) {
|
||||||
aOutput)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ nsNodeUtils::GetTargetForAnimation(const Animation* aAnimation)
|
|||||||
// If the animation targets a pseudo-element, we don't dispatch
|
// If the animation targets a pseudo-element, we don't dispatch
|
||||||
// notifications for it. (In the future we will have PseudoElement
|
// notifications for it. (In the future we will have PseudoElement
|
||||||
// objects we can use as the target of the notifications.)
|
// objects we can use as the target of the notifications.)
|
||||||
if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (pseudoType != CSSPseudoElementType::NotPseudo) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -360,14 +360,13 @@ ValueFromStringHelper(nsCSSProperty aPropID,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nsDependentSubstring subString(aString, subStringBegin);
|
nsDependentSubstring subString(aString, subStringBegin);
|
||||||
if (!StyleAnimationValue::ComputeValue(
|
if (!StyleAnimationValue::ComputeValue(aPropID,
|
||||||
aPropID,
|
aTargetElement,
|
||||||
aTargetElement,
|
CSSPseudoElementType::NotPseudo,
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
subString,
|
||||||
subString,
|
true,
|
||||||
true,
|
aStyleAnimValue,
|
||||||
aStyleAnimValue,
|
aIsContextSensitive)) {
|
||||||
aIsContextSensitive)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isNegative) {
|
if (isNegative) {
|
||||||
|
|||||||
@@ -1105,11 +1105,11 @@ void
|
|||||||
RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsForElementsWithoutFrames()
|
RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsForElementsWithoutFrames()
|
||||||
{
|
{
|
||||||
StopAnimationsWithoutFrame(mContents,
|
StopAnimationsWithoutFrame(mContents,
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement);
|
CSSPseudoElementType::NotPseudo);
|
||||||
StopAnimationsWithoutFrame(mBeforeContents,
|
StopAnimationsWithoutFrame(mBeforeContents,
|
||||||
nsCSSPseudoElements::ePseudo_before);
|
CSSPseudoElementType::before);
|
||||||
StopAnimationsWithoutFrame(mAfterContents,
|
StopAnimationsWithoutFrame(mAfterContents,
|
||||||
nsCSSPseudoElements::ePseudo_after);
|
CSSPseudoElementType::after);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1160,7 +1160,7 @@ RestyleManager::ContentStateChanged(nsIContent* aContent,
|
|||||||
// call will handle things.
|
// call will handle things.
|
||||||
nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
|
nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
|
||||||
nsCSSPseudoElements::Type pseudoType =
|
nsCSSPseudoElements::Type pseudoType =
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
CSSPseudoElementType::NotPseudo;
|
||||||
if (primaryFrame) {
|
if (primaryFrame) {
|
||||||
// If it's generated content, ignore LOADING/etc state changes on it.
|
// If it's generated content, ignore LOADING/etc state changes on it.
|
||||||
if (!primaryFrame->IsGeneratedContentFrame() &&
|
if (!primaryFrame->IsGeneratedContentFrame() &&
|
||||||
@@ -1192,7 +1192,7 @@ RestyleManager::ContentStateChanged(nsIContent* aContent,
|
|||||||
|
|
||||||
nsRestyleHint rshint;
|
nsRestyleHint rshint;
|
||||||
|
|
||||||
if (pseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
if (pseudoType >= CSSPseudoElementType::Count) {
|
||||||
rshint = styleSet->HasStateDependentStyle(aElement, aStateMask);
|
rshint = styleSet->HasStateDependentStyle(aElement, aStateMask);
|
||||||
} else if (nsCSSPseudoElements::PseudoElementSupportsUserActionState(
|
} else if (nsCSSPseudoElements::PseudoElementSupportsUserActionState(
|
||||||
pseudoType)) {
|
pseudoType)) {
|
||||||
@@ -2132,28 +2132,28 @@ ElementForStyleContext(nsIContent* aParentContent,
|
|||||||
nsCSSPseudoElements::Type aPseudoType)
|
nsCSSPseudoElements::Type aPseudoType)
|
||||||
{
|
{
|
||||||
// We don't expect XUL tree stuff here.
|
// We don't expect XUL tree stuff here.
|
||||||
NS_PRECONDITION(aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
NS_PRECONDITION(aPseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_AnonBox ||
|
aPseudoType == CSSPseudoElementType::AnonBox ||
|
||||||
aPseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
aPseudoType < CSSPseudoElementType::Count,
|
||||||
"Unexpected pseudo");
|
"Unexpected pseudo");
|
||||||
// XXX see the comments about the various element confusion in
|
// XXX see the comments about the various element confusion in
|
||||||
// ElementRestyler::Restyle.
|
// ElementRestyler::Restyle.
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (aPseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
return aFrame->GetContent()->AsElement();
|
return aFrame->GetContent()->AsElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
|
if (aPseudoType == CSSPseudoElementType::AnonBox) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLetter) {
|
if (aPseudoType == CSSPseudoElementType::firstLetter) {
|
||||||
NS_ASSERTION(aFrame->GetType() == nsGkAtoms::letterFrame,
|
NS_ASSERTION(aFrame->GetType() == nsGkAtoms::letterFrame,
|
||||||
"firstLetter pseudoTag without a nsFirstLetterFrame");
|
"firstLetter pseudoTag without a nsFirstLetterFrame");
|
||||||
nsBlockFrame* block = nsBlockFrame::GetNearestAncestorBlock(aFrame);
|
nsBlockFrame* block = nsBlockFrame::GetNearestAncestorBlock(aFrame);
|
||||||
return block->GetContent()->AsElement();
|
return block->GetContent()->AsElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_mozColorSwatch) {
|
if (aPseudoType == CSSPseudoElementType::mozColorSwatch) {
|
||||||
MOZ_ASSERT(aFrame->GetParent() &&
|
MOZ_ASSERT(aFrame->GetParent() &&
|
||||||
aFrame->GetParent()->GetParent(),
|
aFrame->GetParent()->GetParent(),
|
||||||
"Color swatch frame should have a parent & grandparent");
|
"Color swatch frame should have a parent & grandparent");
|
||||||
@@ -2165,11 +2165,11 @@ ElementForStyleContext(nsIContent* aParentContent,
|
|||||||
return grandparentFrame->GetContent()->AsElement();
|
return grandparentFrame->GetContent()->AsElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberText ||
|
if (aPseudoType == CSSPseudoElementType::mozNumberText ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberWrapper ||
|
aPseudoType == CSSPseudoElementType::mozNumberWrapper ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinBox ||
|
aPseudoType == CSSPseudoElementType::mozNumberSpinBox ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp ||
|
aPseudoType == CSSPseudoElementType::mozNumberSpinUp ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown) {
|
aPseudoType == CSSPseudoElementType::mozNumberSpinDown) {
|
||||||
// Get content for nearest nsNumberControlFrame:
|
// Get content for nearest nsNumberControlFrame:
|
||||||
nsIFrame* f = aFrame->GetParent();
|
nsIFrame* f = aFrame->GetParent();
|
||||||
MOZ_ASSERT(f);
|
MOZ_ASSERT(f);
|
||||||
@@ -2203,7 +2203,7 @@ static dom::Element*
|
|||||||
PseudoElementForStyleContext(nsIFrame* aFrame,
|
PseudoElementForStyleContext(nsIFrame* aFrame,
|
||||||
nsCSSPseudoElements::Type aPseudoType)
|
nsCSSPseudoElements::Type aPseudoType)
|
||||||
{
|
{
|
||||||
if (aPseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
if (aPseudoType >= CSSPseudoElementType::Count) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3942,7 +3942,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
|
|||||||
parentContext, oldContext,
|
parentContext, oldContext,
|
||||||
rshint);
|
rshint);
|
||||||
}
|
}
|
||||||
} else if (pseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
|
} else if (pseudoType == CSSPseudoElementType::AnonBox) {
|
||||||
newContext = styleSet->ResolveAnonymousBoxStyle(pseudoTag,
|
newContext = styleSet->ResolveAnonymousBoxStyle(pseudoTag,
|
||||||
parentContext);
|
parentContext);
|
||||||
}
|
}
|
||||||
@@ -3977,7 +3977,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
|
|||||||
// Don't expect XUL tree stuff here, since it needs a comparator and
|
// Don't expect XUL tree stuff here, since it needs a comparator and
|
||||||
// all.
|
// all.
|
||||||
NS_ASSERTION(pseudoType <
|
NS_ASSERTION(pseudoType <
|
||||||
nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
CSSPseudoElementType::Count,
|
||||||
"Unexpected pseudo type");
|
"Unexpected pseudo type");
|
||||||
Element* pseudoElement =
|
Element* pseudoElement =
|
||||||
PseudoElementForStyleContext(aSelf, pseudoType);
|
PseudoElementForStyleContext(aSelf, pseudoType);
|
||||||
@@ -4263,7 +4263,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
|
|||||||
NS_ASSERTION(extraPseudoTag &&
|
NS_ASSERTION(extraPseudoTag &&
|
||||||
extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
|
extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
|
||||||
"extra style context is not pseudo element");
|
"extra style context is not pseudo element");
|
||||||
Element* element = extraPseudoType != nsCSSPseudoElements::ePseudo_AnonBox
|
Element* element = extraPseudoType != CSSPseudoElementType::AnonBox
|
||||||
? mContent->AsElement() : nullptr;
|
? mContent->AsElement() : nullptr;
|
||||||
if (!MustRestyleSelf(aRestyleHint, element)) {
|
if (!MustRestyleSelf(aRestyleHint, element)) {
|
||||||
if (CanReparentStyleContext(aRestyleHint)) {
|
if (CanReparentStyleContext(aRestyleHint)) {
|
||||||
@@ -4285,14 +4285,13 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
|
|||||||
newContext, oldExtraContext,
|
newContext, oldExtraContext,
|
||||||
nsRestyleHint(0));
|
nsRestyleHint(0));
|
||||||
}
|
}
|
||||||
} else if (extraPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
|
} else if (extraPseudoType == CSSPseudoElementType::AnonBox) {
|
||||||
newExtraContext = styleSet->ResolveAnonymousBoxStyle(extraPseudoTag,
|
newExtraContext = styleSet->ResolveAnonymousBoxStyle(extraPseudoTag,
|
||||||
newContext);
|
newContext);
|
||||||
} else {
|
} else {
|
||||||
// Don't expect XUL tree stuff here, since it needs a comparator and
|
// Don't expect XUL tree stuff here, since it needs a comparator and
|
||||||
// all.
|
// all.
|
||||||
NS_ASSERTION(extraPseudoType <
|
NS_ASSERTION(extraPseudoType < CSSPseudoElementType::Count,
|
||||||
nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
|
||||||
"Unexpected type");
|
"Unexpected type");
|
||||||
newExtraContext = styleSet->ResolvePseudoElementStyle(mContent->AsElement(),
|
newExtraContext = styleSet->ResolvePseudoElementStyle(mContent->AsElement(),
|
||||||
extraPseudoType,
|
extraPseudoType,
|
||||||
@@ -4401,11 +4400,11 @@ ElementRestyler::RestyleChildrenOfDisplayContentsElement(
|
|||||||
const bool mightReframePseudos = aRestyleHint & eRestyle_Subtree;
|
const bool mightReframePseudos = aRestyleHint & eRestyle_Subtree;
|
||||||
DoRestyleUndisplayedDescendants(nsRestyleHint(0), mContent, aNewContext);
|
DoRestyleUndisplayedDescendants(nsRestyleHint(0), mContent, aNewContext);
|
||||||
if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
|
if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
|
||||||
MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_before,
|
MaybeReframeForPseudo(CSSPseudoElementType::before,
|
||||||
aParentFrame, nullptr, mContent, aNewContext);
|
aParentFrame, nullptr, mContent, aNewContext);
|
||||||
}
|
}
|
||||||
if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
|
if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
|
||||||
MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_after,
|
MaybeReframeForPseudo(CSSPseudoElementType::after,
|
||||||
aParentFrame, nullptr, mContent, aNewContext);
|
aParentFrame, nullptr, mContent, aNewContext);
|
||||||
}
|
}
|
||||||
if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
|
if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
|
||||||
@@ -4646,7 +4645,7 @@ ElementRestyler::RestyleUndisplayedNodes(nsRestyleHint aChildRestyleHint,
|
|||||||
void
|
void
|
||||||
ElementRestyler::MaybeReframeForBeforePseudo()
|
ElementRestyler::MaybeReframeForBeforePseudo()
|
||||||
{
|
{
|
||||||
MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_before,
|
MaybeReframeForPseudo(CSSPseudoElementType::before,
|
||||||
mFrame, mFrame, mFrame->GetContent(),
|
mFrame, mFrame, mFrame->GetContent(),
|
||||||
mFrame->StyleContext());
|
mFrame->StyleContext());
|
||||||
}
|
}
|
||||||
@@ -4659,7 +4658,7 @@ void
|
|||||||
ElementRestyler::MaybeReframeForAfterPseudo(nsIFrame* aFrame)
|
ElementRestyler::MaybeReframeForAfterPseudo(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aFrame);
|
MOZ_ASSERT(aFrame);
|
||||||
MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_after,
|
MaybeReframeForPseudo(CSSPseudoElementType::after,
|
||||||
aFrame, aFrame, aFrame->GetContent(),
|
aFrame, aFrame, aFrame->GetContent(),
|
||||||
aFrame->StyleContext());
|
aFrame->StyleContext());
|
||||||
}
|
}
|
||||||
@@ -4668,7 +4667,7 @@ ElementRestyler::MaybeReframeForAfterPseudo(nsIFrame* aFrame)
|
|||||||
bool
|
bool
|
||||||
ElementRestyler::MustReframeForBeforePseudo()
|
ElementRestyler::MustReframeForBeforePseudo()
|
||||||
{
|
{
|
||||||
return MustReframeForPseudo(nsCSSPseudoElements::ePseudo_before,
|
return MustReframeForPseudo(CSSPseudoElementType::before,
|
||||||
mFrame, mFrame, mFrame->GetContent(),
|
mFrame, mFrame, mFrame->GetContent(),
|
||||||
mFrame->StyleContext());
|
mFrame->StyleContext());
|
||||||
}
|
}
|
||||||
@@ -4677,7 +4676,7 @@ bool
|
|||||||
ElementRestyler::MustReframeForAfterPseudo(nsIFrame* aFrame)
|
ElementRestyler::MustReframeForAfterPseudo(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aFrame);
|
MOZ_ASSERT(aFrame);
|
||||||
return MustReframeForPseudo(nsCSSPseudoElements::ePseudo_after,
|
return MustReframeForPseudo(CSSPseudoElementType::after,
|
||||||
aFrame, aFrame, aFrame->GetContent(),
|
aFrame, aFrame, aFrame->GetContent(),
|
||||||
aFrame->StyleContext());
|
aFrame->StyleContext());
|
||||||
}
|
}
|
||||||
@@ -4707,8 +4706,8 @@ ElementRestyler::MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
|
|||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
nsStyleContext* aStyleContext)
|
nsStyleContext* aStyleContext)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
MOZ_ASSERT(aPseudoType == CSSPseudoElementType::before ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_after);
|
aPseudoType == CSSPseudoElementType::after);
|
||||||
|
|
||||||
// Make sure not to do this for pseudo-frames...
|
// Make sure not to do this for pseudo-frames...
|
||||||
if (aStyleContext->GetPseudo()) {
|
if (aStyleContext->GetPseudo()) {
|
||||||
@@ -4724,7 +4723,7 @@ ElementRestyler::MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
|
if (aPseudoType == CSSPseudoElementType::before) {
|
||||||
// Check for a ::before pseudo style and the absence of a ::before content,
|
// Check for a ::before pseudo style and the absence of a ::before content,
|
||||||
// but only if aFrame is null or is the first continuation/ib-split.
|
// but only if aFrame is null or is the first continuation/ib-split.
|
||||||
if ((aFrame && !nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aFrame)) ||
|
if ((aFrame && !nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aFrame)) ||
|
||||||
|
|||||||
@@ -192,12 +192,12 @@ public:
|
|||||||
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
|
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
|
||||||
MOZ_ASSERT(aContent);
|
MOZ_ASSERT(aContent);
|
||||||
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
|
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
|
||||||
if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (pseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
mElementContexts.Put(aContent, aStyleContext);
|
mElementContexts.Put(aContent, aStyleContext);
|
||||||
} else if (pseudoType == nsCSSPseudoElements::ePseudo_before) {
|
} else if (pseudoType == CSSPseudoElementType::before) {
|
||||||
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
|
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
|
||||||
mBeforePseudoContexts.Put(aContent->GetParent(), aStyleContext);
|
mBeforePseudoContexts.Put(aContent->GetParent(), aStyleContext);
|
||||||
} else if (pseudoType == nsCSSPseudoElements::ePseudo_after) {
|
} else if (pseudoType == CSSPseudoElementType::after) {
|
||||||
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
|
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
|
||||||
mAfterPseudoContexts.Put(aContent->GetParent(), aStyleContext);
|
mAfterPseudoContexts.Put(aContent->GetParent(), aStyleContext);
|
||||||
}
|
}
|
||||||
@@ -206,14 +206,14 @@ public:
|
|||||||
nsStyleContext* Get(nsIContent* aContent,
|
nsStyleContext* Get(nsIContent* aContent,
|
||||||
nsCSSPseudoElements::Type aPseudoType) {
|
nsCSSPseudoElements::Type aPseudoType) {
|
||||||
MOZ_ASSERT(aContent);
|
MOZ_ASSERT(aContent);
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (aPseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
return mElementContexts.GetWeak(aContent);
|
return mElementContexts.GetWeak(aContent);
|
||||||
}
|
}
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
|
if (aPseudoType == CSSPseudoElementType::before) {
|
||||||
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
|
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
|
||||||
return mBeforePseudoContexts.GetWeak(aContent->GetParent());
|
return mBeforePseudoContexts.GetWeak(aContent->GetParent());
|
||||||
}
|
}
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
if (aPseudoType == CSSPseudoElementType::after) {
|
||||||
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
|
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
|
||||||
return mAfterPseudoContexts.GetWeak(aContent->GetParent());
|
return mAfterPseudoContexts.GetWeak(aContent->GetParent());
|
||||||
}
|
}
|
||||||
@@ -270,12 +270,12 @@ public:
|
|||||||
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
|
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
|
||||||
MOZ_ASSERT(aContent);
|
MOZ_ASSERT(aContent);
|
||||||
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
|
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
|
||||||
if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (pseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
mContents.AppendElement(aContent);
|
mContents.AppendElement(aContent);
|
||||||
} else if (pseudoType == nsCSSPseudoElements::ePseudo_before) {
|
} else if (pseudoType == CSSPseudoElementType::before) {
|
||||||
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
|
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
|
||||||
mBeforeContents.AppendElement(aContent->GetParent());
|
mBeforeContents.AppendElement(aContent->GetParent());
|
||||||
} else if (pseudoType == nsCSSPseudoElements::ePseudo_after) {
|
} else if (pseudoType == CSSPseudoElementType::after) {
|
||||||
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
|
MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
|
||||||
mAfterContents.AppendElement(aContent->GetParent());
|
mAfterContents.AppendElement(aContent->GetParent());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1760,8 +1760,8 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
|||||||
nsCSSPseudoElements::Type aPseudoElement,
|
nsCSSPseudoElements::Type aPseudoElement,
|
||||||
FrameConstructionItemList& aItems)
|
FrameConstructionItemList& aItems)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aPseudoElement == nsCSSPseudoElements::ePseudo_before ||
|
MOZ_ASSERT(aPseudoElement == CSSPseudoElementType::before ||
|
||||||
aPseudoElement == nsCSSPseudoElements::ePseudo_after,
|
aPseudoElement == CSSPseudoElementType::after,
|
||||||
"unexpected aPseudoElement");
|
"unexpected aPseudoElement");
|
||||||
|
|
||||||
// XXXbz is this ever true?
|
// XXXbz is this ever true?
|
||||||
@@ -1782,7 +1782,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
|||||||
if (!pseudoStyleContext)
|
if (!pseudoStyleContext)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isBefore = aPseudoElement == nsCSSPseudoElements::ePseudo_before;
|
bool isBefore = aPseudoElement == CSSPseudoElementType::before;
|
||||||
|
|
||||||
// |ProbePseudoStyleFor| checked the 'display' property and the
|
// |ProbePseudoStyleFor| checked the 'display' property and the
|
||||||
// |ContentCount()| of the 'content' property for us.
|
// |ContentCount()| of the 'content' property for us.
|
||||||
@@ -2961,7 +2961,7 @@ nsCSSFrameConstructor::CreateBackdropFrameFor(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
RefPtr<nsStyleContext> style = aPresShell->StyleSet()->
|
RefPtr<nsStyleContext> style = aPresShell->StyleSet()->
|
||||||
ResolvePseudoElementStyle(aContent->AsElement(),
|
ResolvePseudoElementStyle(aContent->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_backdrop,
|
CSSPseudoElementType::backdrop,
|
||||||
/* aParentStyleContext */ nullptr,
|
/* aParentStyleContext */ nullptr,
|
||||||
/* aPseudoElement */ nullptr);
|
/* aPseudoElement */ nullptr);
|
||||||
nsBackdropFrame* backdropFrame = new (aPresShell) nsBackdropFrame(style);
|
nsBackdropFrame* backdropFrame = new (aPresShell) nsBackdropFrame(style);
|
||||||
@@ -4922,7 +4922,7 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
|||||||
RestyleManager()->GetReframingStyleContexts();
|
RestyleManager()->GetReframingStyleContexts();
|
||||||
if (rsc) {
|
if (rsc) {
|
||||||
nsStyleContext* oldStyleContext =
|
nsStyleContext* oldStyleContext =
|
||||||
rsc->Get(aContent, nsCSSPseudoElements::ePseudo_NotPseudoElement);
|
rsc->Get(aContent, CSSPseudoElementType::NotPseudo);
|
||||||
nsPresContext* presContext = mPresShell->GetPresContext();
|
nsPresContext* presContext = mPresShell->GetPresContext();
|
||||||
if (oldStyleContext) {
|
if (oldStyleContext) {
|
||||||
RestyleManager::TryStartingTransition(presContext, aContent,
|
RestyleManager::TryStartingTransition(presContext, aContent,
|
||||||
@@ -4930,7 +4930,7 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
|||||||
} else if (aContent->IsElement()) {
|
} else if (aContent->IsElement()) {
|
||||||
presContext->TransitionManager()->
|
presContext->TransitionManager()->
|
||||||
PruneCompletedTransitions(aContent->AsElement(),
|
PruneCompletedTransitions(aContent->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement, result);
|
CSSPseudoElementType::NotPseudo, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5763,7 +5763,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||||||
aParentFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT);
|
aParentFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT);
|
||||||
}
|
}
|
||||||
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext,
|
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext,
|
||||||
nsCSSPseudoElements::ePseudo_before, aItems);
|
CSSPseudoElementType::before, aItems);
|
||||||
|
|
||||||
FlattenedChildIterator iter(aContent);
|
FlattenedChildIterator iter(aContent);
|
||||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||||
@@ -5796,7 +5796,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||||||
aItems.SetParentHasNoXBLChildren(!iter.XBLInvolved());
|
aItems.SetParentHasNoXBLChildren(!iter.XBLInvolved());
|
||||||
|
|
||||||
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext,
|
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext,
|
||||||
nsCSSPseudoElements::ePseudo_after, aItems);
|
CSSPseudoElementType::after, aItems);
|
||||||
if (canHavePageBreak && display->mBreakAfter) {
|
if (canHavePageBreak && display->mBreakAfter) {
|
||||||
AddPageBreakItem(aContent, aStyleContext, aItems);
|
AddPageBreakItem(aContent, aStyleContext, aItems);
|
||||||
}
|
}
|
||||||
@@ -6170,7 +6170,7 @@ AdjustAppendParentForAfterContent(nsFrameManager* aFrameManager,
|
|||||||
// document than aChild and return that in aAfterFrame.
|
// document than aChild and return that in aAfterFrame.
|
||||||
if (aParentFrame->GetGenConPseudos() ||
|
if (aParentFrame->GetGenConPseudos() ||
|
||||||
nsLayoutUtils::HasPseudoStyle(aContainer, aParentFrame->StyleContext(),
|
nsLayoutUtils::HasPseudoStyle(aContainer, aParentFrame->StyleContext(),
|
||||||
nsCSSPseudoElements::ePseudo_after,
|
CSSPseudoElementType::after,
|
||||||
aParentFrame->PresContext()) ||
|
aParentFrame->PresContext()) ||
|
||||||
aFrameManager->GetDisplayContentsStyleFor(aContainer)) {
|
aFrameManager->GetDisplayContentsStyleFor(aContainer)) {
|
||||||
nsIFrame* afterFrame = nullptr;
|
nsIFrame* afterFrame = nullptr;
|
||||||
@@ -9556,7 +9556,7 @@ nsCSSFrameConstructor::GetFirstLetterStyle(nsIContent* aContent,
|
|||||||
if (aContent) {
|
if (aContent) {
|
||||||
return mPresShell->StyleSet()->
|
return mPresShell->StyleSet()->
|
||||||
ResolvePseudoElementStyle(aContent->AsElement(),
|
ResolvePseudoElementStyle(aContent->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_firstLetter,
|
CSSPseudoElementType::firstLetter,
|
||||||
aStyleContext,
|
aStyleContext,
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
@@ -9570,7 +9570,7 @@ nsCSSFrameConstructor::GetFirstLineStyle(nsIContent* aContent,
|
|||||||
if (aContent) {
|
if (aContent) {
|
||||||
return mPresShell->StyleSet()->
|
return mPresShell->StyleSet()->
|
||||||
ResolvePseudoElementStyle(aContent->AsElement(),
|
ResolvePseudoElementStyle(aContent->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_firstLine,
|
CSSPseudoElementType::firstLine,
|
||||||
aStyleContext,
|
aStyleContext,
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
@@ -9584,7 +9584,7 @@ nsCSSFrameConstructor::ShouldHaveFirstLetterStyle(nsIContent* aContent,
|
|||||||
nsStyleContext* aStyleContext)
|
nsStyleContext* aStyleContext)
|
||||||
{
|
{
|
||||||
return nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
|
return nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
|
||||||
nsCSSPseudoElements::ePseudo_firstLetter,
|
CSSPseudoElementType::firstLetter,
|
||||||
mPresShell->GetPresContext());
|
mPresShell->GetPresContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9604,7 +9604,7 @@ nsCSSFrameConstructor::ShouldHaveFirstLineStyle(nsIContent* aContent,
|
|||||||
{
|
{
|
||||||
bool hasFirstLine =
|
bool hasFirstLine =
|
||||||
nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
|
nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
|
||||||
nsCSSPseudoElements::ePseudo_firstLine,
|
CSSPseudoElementType::firstLine,
|
||||||
mPresShell->GetPresContext());
|
mPresShell->GetPresContext());
|
||||||
if (hasFirstLine) {
|
if (hasFirstLine) {
|
||||||
// But disable for fieldsets
|
// But disable for fieldsets
|
||||||
@@ -10532,7 +10532,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
|
|||||||
nsFrame::CorrectStyleParentFrame(aFrame, nullptr)->StyleContext();
|
nsFrame::CorrectStyleParentFrame(aFrame, nullptr)->StyleContext();
|
||||||
// Probe for generated content before
|
// Probe for generated content before
|
||||||
CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
|
CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
|
||||||
nsCSSPseudoElements::ePseudo_before,
|
CSSPseudoElementType::before,
|
||||||
itemsToConstruct);
|
itemsToConstruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10580,7 +10580,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
|
|||||||
if (aCanHaveGeneratedContent) {
|
if (aCanHaveGeneratedContent) {
|
||||||
// Probe for generated content after
|
// Probe for generated content after
|
||||||
CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
|
CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
|
||||||
nsCSSPseudoElements::ePseudo_after,
|
CSSPseudoElementType::after,
|
||||||
itemsToConstruct);
|
itemsToConstruct);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -11830,7 +11830,7 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
|
|||||||
if (!aItemIsWithinSVGText) {
|
if (!aItemIsWithinSVGText) {
|
||||||
// Probe for generated content before
|
// Probe for generated content before
|
||||||
CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,
|
CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,
|
||||||
nsCSSPseudoElements::ePseudo_before,
|
CSSPseudoElementType::before,
|
||||||
aParentItem.mChildItems);
|
aParentItem.mChildItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11900,7 +11900,7 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
|
|||||||
if (!aItemIsWithinSVGText) {
|
if (!aItemIsWithinSVGText) {
|
||||||
// Probe for generated content after
|
// Probe for generated content after
|
||||||
CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,
|
CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,
|
||||||
nsCSSPseudoElements::ePseudo_after,
|
CSSPseudoElementType::after,
|
||||||
aParentItem.mChildItems);
|
aParentItem.mChildItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
|
|||||||
nsRect innerRect;
|
nsRect innerRect;
|
||||||
if (
|
if (
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
aStyleContext->GetPseudoType() == nsCSSPseudoElements::ePseudo_XULTree
|
aStyleContext->GetPseudoType() == CSSPseudoElementType::XULTree
|
||||||
#else
|
#else
|
||||||
false
|
false
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -465,13 +465,13 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext)
|
|||||||
// style for the inner such as a dotted line (Windows)
|
// style for the inner such as a dotted line (Windows)
|
||||||
mInnerFocusStyle =
|
mInnerFocusStyle =
|
||||||
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
|
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_mozFocusInner,
|
CSSPseudoElementType::mozFocusInner,
|
||||||
context);
|
context);
|
||||||
|
|
||||||
// style for outer focus like a ridged border (MAC).
|
// style for outer focus like a ridged border (MAC).
|
||||||
mOuterFocusStyle =
|
mOuterFocusStyle =
|
||||||
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
|
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_mozFocusOuter,
|
CSSPseudoElementType::mozFocusOuter,
|
||||||
context);
|
context);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ nsColorControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
nsresult rv = UpdateColor();
|
nsresult rv = UpdateColor();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozColorSwatch;
|
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozColorSwatch;
|
||||||
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
|
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
|
||||||
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
|
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
|
||||||
StyleContext(), mColorContent->AsElement());
|
StyleContext(), mColorContent->AsElement());
|
||||||
@@ -137,7 +137,7 @@ nsColorControlFrame::GetContentInsertionFrame()
|
|||||||
Element*
|
Element*
|
||||||
nsColorControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
nsColorControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozColorSwatch) {
|
if (aType == CSSPseudoElementType::mozColorSwatch) {
|
||||||
return mColorContent;
|
return mColorContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
|
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
|
||||||
|
|
||||||
// Associate ::-moz-meter-bar pseudo-element to the anonymous child.
|
// Associate ::-moz-meter-bar pseudo-element to the anonymous child.
|
||||||
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozMeterBar;
|
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozMeterBar;
|
||||||
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
|
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
|
||||||
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
|
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
|
||||||
StyleContext(), mBarDiv->AsElement());
|
StyleContext(), mBarDiv->AsElement());
|
||||||
@@ -283,7 +283,7 @@ nsMeterFrame::ShouldUseNativeStyle() const
|
|||||||
Element*
|
Element*
|
||||||
nsMeterFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
nsMeterFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozMeterBar) {
|
if (aType == CSSPseudoElementType::mozMeterBar) {
|
||||||
return mBarDiv;
|
return mBarDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ nsNumberControlFrame::MakeAnonymousElement(Element** aResult,
|
|||||||
// non-pseudo-element anonymous children, then we'll need to add a branch
|
// non-pseudo-element anonymous children, then we'll need to add a branch
|
||||||
// that calls ResolveStyleFor((*aResult)->AsElement(), aParentContext)") to
|
// that calls ResolveStyleFor((*aResult)->AsElement(), aParentContext)") to
|
||||||
// set newStyleContext.
|
// set newStyleContext.
|
||||||
NS_ASSERTION(aPseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
NS_ASSERTION(aPseudoType != CSSPseudoElementType::NotPseudo,
|
||||||
"Expecting anonymous children to all be pseudo-elements");
|
"Expecting anonymous children to all be pseudo-elements");
|
||||||
// Associate the pseudo-element with the anonymous child
|
// Associate the pseudo-element with the anonymous child
|
||||||
RefPtr<nsStyleContext> newStyleContext =
|
RefPtr<nsStyleContext> newStyleContext =
|
||||||
@@ -347,8 +347,8 @@ nsNumberControlFrame::MakeAnonymousElement(Element** aResult,
|
|||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown ||
|
if (aPseudoType == CSSPseudoElementType::mozNumberSpinDown ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp) {
|
aPseudoType == CSSPseudoElementType::mozNumberSpinUp) {
|
||||||
resultElement->SetAttr(kNameSpaceID_None, nsGkAtoms::role,
|
resultElement->SetAttr(kNameSpaceID_None, nsGkAtoms::role,
|
||||||
NS_LITERAL_STRING("button"), false);
|
NS_LITERAL_STRING("button"), false);
|
||||||
}
|
}
|
||||||
@@ -380,7 +380,7 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
rv = MakeAnonymousElement(getter_AddRefs(mOuterWrapper),
|
rv = MakeAnonymousElement(getter_AddRefs(mOuterWrapper),
|
||||||
aElements,
|
aElements,
|
||||||
nsGkAtoms::div,
|
nsGkAtoms::div,
|
||||||
nsCSSPseudoElements::ePseudo_mozNumberWrapper,
|
CSSPseudoElementType::mozNumberWrapper,
|
||||||
mStyleContext);
|
mStyleContext);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
rv = MakeAnonymousElement(getter_AddRefs(mTextField),
|
rv = MakeAnonymousElement(getter_AddRefs(mTextField),
|
||||||
outerWrapperCI.mChildren,
|
outerWrapperCI.mChildren,
|
||||||
nsGkAtoms::input,
|
nsGkAtoms::input,
|
||||||
nsCSSPseudoElements::ePseudo_mozNumberText,
|
CSSPseudoElementType::mozNumberText,
|
||||||
outerWrapperCI.mStyleContext);
|
outerWrapperCI.mStyleContext);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
rv = MakeAnonymousElement(getter_AddRefs(mSpinBox),
|
rv = MakeAnonymousElement(getter_AddRefs(mSpinBox),
|
||||||
outerWrapperCI.mChildren,
|
outerWrapperCI.mChildren,
|
||||||
nsGkAtoms::div,
|
nsGkAtoms::div,
|
||||||
nsCSSPseudoElements::ePseudo_mozNumberSpinBox,
|
CSSPseudoElementType::mozNumberSpinBox,
|
||||||
outerWrapperCI.mStyleContext);
|
outerWrapperCI.mStyleContext);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
rv = MakeAnonymousElement(getter_AddRefs(mSpinUp),
|
rv = MakeAnonymousElement(getter_AddRefs(mSpinUp),
|
||||||
spinBoxCI.mChildren,
|
spinBoxCI.mChildren,
|
||||||
nsGkAtoms::div,
|
nsGkAtoms::div,
|
||||||
nsCSSPseudoElements::ePseudo_mozNumberSpinUp,
|
CSSPseudoElementType::mozNumberSpinUp,
|
||||||
spinBoxCI.mStyleContext);
|
spinBoxCI.mStyleContext);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
rv = MakeAnonymousElement(getter_AddRefs(mSpinDown),
|
rv = MakeAnonymousElement(getter_AddRefs(mSpinDown),
|
||||||
spinBoxCI.mChildren,
|
spinBoxCI.mChildren,
|
||||||
nsGkAtoms::div,
|
nsGkAtoms::div,
|
||||||
nsCSSPseudoElements::ePseudo_mozNumberSpinDown,
|
CSSPseudoElementType::mozNumberSpinDown,
|
||||||
spinBoxCI.mStyleContext);
|
spinBoxCI.mStyleContext);
|
||||||
|
|
||||||
SyncDisabledState();
|
SyncDisabledState();
|
||||||
@@ -826,25 +826,25 @@ nsNumberControlFrame::AnonTextControlIsEmpty()
|
|||||||
Element*
|
Element*
|
||||||
nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozNumberWrapper) {
|
if (aType == CSSPseudoElementType::mozNumberWrapper) {
|
||||||
return mOuterWrapper;
|
return mOuterWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozNumberText) {
|
if (aType == CSSPseudoElementType::mozNumberText) {
|
||||||
return mTextField;
|
return mTextField;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinBox) {
|
if (aType == CSSPseudoElementType::mozNumberSpinBox) {
|
||||||
// Might be null.
|
// Might be null.
|
||||||
return mSpinBox;
|
return mSpinBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp) {
|
if (aType == CSSPseudoElementType::mozNumberSpinUp) {
|
||||||
// Might be null.
|
// Might be null.
|
||||||
return mSpinUp;
|
return mSpinUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown) {
|
if (aType == CSSPseudoElementType::mozNumberSpinDown) {
|
||||||
// Might be null.
|
// Might be null.
|
||||||
return mSpinDown;
|
return mSpinDown;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
|
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
|
||||||
|
|
||||||
// Associate ::-moz-progress-bar pseudo-element to the anonymous child.
|
// Associate ::-moz-progress-bar pseudo-element to the anonymous child.
|
||||||
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozProgressBar;
|
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozProgressBar;
|
||||||
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
|
RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
|
||||||
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
|
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
|
||||||
StyleContext(), mBarDiv->AsElement());
|
StyleContext(), mBarDiv->AsElement());
|
||||||
@@ -289,7 +289,7 @@ nsProgressFrame::ShouldUseNativeStyle() const
|
|||||||
Element*
|
Element*
|
||||||
nsProgressFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
nsProgressFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozProgressBar) {
|
if (aType == CSSPseudoElementType::mozProgressBar) {
|
||||||
return mBarDiv;
|
return mBarDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ nsRangeFrame::Init(nsIContent* aContent,
|
|||||||
|
|
||||||
mOuterFocusStyle =
|
mOuterFocusStyle =
|
||||||
styleSet->ProbePseudoElementStyle(aContent->AsElement(),
|
styleSet->ProbePseudoElementStyle(aContent->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_mozFocusOuter,
|
CSSPseudoElementType::mozFocusOuter,
|
||||||
StyleContext());
|
StyleContext());
|
||||||
|
|
||||||
return nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
return nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
||||||
@@ -138,19 +138,19 @@ nsRangeFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
|
|
||||||
// Create the ::-moz-range-track pseuto-element (a div):
|
// Create the ::-moz-range-track pseuto-element (a div):
|
||||||
rv = MakeAnonymousDiv(getter_AddRefs(mTrackDiv),
|
rv = MakeAnonymousDiv(getter_AddRefs(mTrackDiv),
|
||||||
nsCSSPseudoElements::ePseudo_mozRangeTrack,
|
CSSPseudoElementType::mozRangeTrack,
|
||||||
aElements);
|
aElements);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Create the ::-moz-range-progress pseudo-element (a div):
|
// Create the ::-moz-range-progress pseudo-element (a div):
|
||||||
rv = MakeAnonymousDiv(getter_AddRefs(mProgressDiv),
|
rv = MakeAnonymousDiv(getter_AddRefs(mProgressDiv),
|
||||||
nsCSSPseudoElements::ePseudo_mozRangeProgress,
|
CSSPseudoElementType::mozRangeProgress,
|
||||||
aElements);
|
aElements);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Create the ::-moz-range-thumb pseudo-element (a div):
|
// Create the ::-moz-range-thumb pseudo-element (a div):
|
||||||
rv = MakeAnonymousDiv(getter_AddRefs(mThumbDiv),
|
rv = MakeAnonymousDiv(getter_AddRefs(mThumbDiv),
|
||||||
nsCSSPseudoElements::ePseudo_mozRangeThumb,
|
CSSPseudoElementType::mozRangeThumb,
|
||||||
aElements);
|
aElements);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -896,15 +896,15 @@ nsRangeFrame::ShouldUseNativeStyle() const
|
|||||||
Element*
|
Element*
|
||||||
nsRangeFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
nsRangeFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozRangeTrack) {
|
if (aType == CSSPseudoElementType::mozRangeTrack) {
|
||||||
return mTrackDiv;
|
return mTrackDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozRangeThumb) {
|
if (aType == CSSPseudoElementType::mozRangeThumb) {
|
||||||
return mThumbDiv;
|
return mThumbDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozRangeProgress) {
|
if (aType == CSSPseudoElementType::mozRangeProgress) {
|
||||||
return mProgressDiv;
|
return mProgressDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,8 +346,7 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||||||
NS_ENSURE_TRUE(placeholderNode, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(placeholderNode, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
// Associate ::-moz-placeholder pseudo-element with the placeholder node.
|
// Associate ::-moz-placeholder pseudo-element with the placeholder node.
|
||||||
nsCSSPseudoElements::Type pseudoType =
|
nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozPlaceholder;
|
||||||
nsCSSPseudoElements::ePseudo_mozPlaceholder;
|
|
||||||
|
|
||||||
RefPtr<nsStyleContext> placeholderStyleContext =
|
RefPtr<nsStyleContext> placeholderStyleContext =
|
||||||
PresContext()->StyleSet()->ResolvePseudoElementStyle(
|
PresContext()->StyleSet()->ResolvePseudoElementStyle(
|
||||||
@@ -1446,7 +1445,7 @@ nsTextControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
mozilla::dom::Element*
|
mozilla::dom::Element*
|
||||||
nsTextControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
nsTextControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
||||||
{
|
{
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_mozPlaceholder) {
|
if (aType == CSSPseudoElementType::mozPlaceholder) {
|
||||||
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
|
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
|
||||||
return txtCtrl->GetPlaceholderNode();
|
return txtCtrl->GetPlaceholderNode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6897,9 +6897,9 @@ nsBlockFrame::CreateBulletFrameForListItem(bool aCreateBulletList,
|
|||||||
{
|
{
|
||||||
nsIPresShell* shell = PresContext()->PresShell();
|
nsIPresShell* shell = PresContext()->PresShell();
|
||||||
|
|
||||||
nsCSSPseudoElements::Type pseudoType = aCreateBulletList ?
|
CSSPseudoElementType pseudoType = aCreateBulletList ?
|
||||||
nsCSSPseudoElements::ePseudo_mozListBullet :
|
CSSPseudoElementType::mozListBullet :
|
||||||
nsCSSPseudoElements::ePseudo_mozListNumber;
|
CSSPseudoElementType::mozListNumber;
|
||||||
|
|
||||||
nsStyleContext* parentStyle =
|
nsStyleContext* parentStyle =
|
||||||
CorrectStyleParentFrame(this,
|
CorrectStyleParentFrame(this,
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ protected:
|
|||||||
{
|
{
|
||||||
return aPresContext->StyleSet()->
|
return aPresContext->StyleSet()->
|
||||||
ProbePseudoElementStyle(mContent->AsElement(),
|
ProbePseudoElementStyle(mContent->AsElement(),
|
||||||
nsCSSPseudoElements::ePseudo_firstLetter,
|
mozilla::CSSPseudoElementType::firstLetter,
|
||||||
mStyleContext);
|
mStyleContext);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9125,9 +9125,9 @@ nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
|||||||
{
|
{
|
||||||
nsIFrame* frame = nullptr;
|
nsIFrame* frame = nullptr;
|
||||||
|
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_before) {
|
if (aType == CSSPseudoElementType::before) {
|
||||||
frame = nsLayoutUtils::GetBeforeFrame(this);
|
frame = nsLayoutUtils::GetBeforeFrame(this);
|
||||||
} else if (aType == nsCSSPseudoElements::ePseudo_after) {
|
} else if (aType == CSSPseudoElementType::after) {
|
||||||
frame = nsLayoutUtils::GetAfterFrame(this);
|
frame = nsLayoutUtils::GetAfterFrame(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9137,7 +9137,7 @@ nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
|
|||||||
return content->AsElement();
|
return content->AsElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3807,7 +3807,7 @@ nsTextPaintStyle::InitSelectionColorsAndShadow()
|
|||||||
RefPtr<nsStyleContext> sc = nullptr;
|
RefPtr<nsStyleContext> sc = nullptr;
|
||||||
sc = mPresContext->StyleSet()->
|
sc = mPresContext->StyleSet()->
|
||||||
ProbePseudoElementStyle(selectionElement,
|
ProbePseudoElementStyle(selectionElement,
|
||||||
nsCSSPseudoElements::ePseudo_mozSelection,
|
CSSPseudoElementType::mozSelection,
|
||||||
mFrame->StyleContext());
|
mFrame->StyleContext());
|
||||||
// Use -moz-selection pseudo class.
|
// Use -moz-selection pseudo class.
|
||||||
if (sc) {
|
if (sc) {
|
||||||
|
|||||||
@@ -1194,7 +1194,8 @@ inDOMUtils::GetCSSPseudoElementNames(uint32_t* aLength, char16_t*** aNames)
|
|||||||
{
|
{
|
||||||
nsTArray<nsIAtom*> array;
|
nsTArray<nsIAtom*> array;
|
||||||
|
|
||||||
for (int i = 0; i < nsCSSPseudoElements::ePseudo_PseudoElementCount; ++i) {
|
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);
|
nsCSSPseudoElements::Type type = static_cast<nsCSSPseudoElements::Type>(i);
|
||||||
if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
|
if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
|
||||||
nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
|
nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ nsMathMLFrame::ResolveMathMLCharStyle(nsPresContext* aPresContext,
|
|||||||
nsMathMLChar* aMathMLChar)
|
nsMathMLChar* aMathMLChar)
|
||||||
{
|
{
|
||||||
nsCSSPseudoElements::Type pseudoType =
|
nsCSSPseudoElements::Type pseudoType =
|
||||||
nsCSSPseudoElements::ePseudo_mozMathAnonymous; // savings
|
CSSPseudoElementType::mozMathAnonymous; // savings
|
||||||
RefPtr<nsStyleContext> newStyleContext;
|
RefPtr<nsStyleContext> newStyleContext;
|
||||||
newStyleContext = aPresContext->StyleSet()->
|
newStyleContext = aPresContext->StyleSet()->
|
||||||
ResolvePseudoElementStyle(aContent->AsElement(), pseudoType,
|
ResolvePseudoElementStyle(aContent->AsElement(), pseudoType,
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ CommonAnimationManager::GetAnimationCollection(dom::Element *aElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *propName;
|
nsIAtom *propName;
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (aPseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
propName = GetAnimationsAtom();
|
propName = GetAnimationsAtom();
|
||||||
} else if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
|
} else if (aPseudoType == CSSPseudoElementType::before) {
|
||||||
propName = GetAnimationsBeforeAtom();
|
propName = GetAnimationsBeforeAtom();
|
||||||
} else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
} else if (aPseudoType == CSSPseudoElementType::after) {
|
||||||
propName = GetAnimationsAfterAtom();
|
propName = GetAnimationsAfterAtom();
|
||||||
} else {
|
} else {
|
||||||
NS_ASSERTION(!aCreateIfNeeded,
|
NS_ASSERTION(!aCreateIfNeeded,
|
||||||
@@ -155,12 +155,12 @@ CommonAnimationManager::ExtractComputedValueForTransition(
|
|||||||
AnimationCollection::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
|
AnimationCollection::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
|
||||||
{
|
{
|
||||||
switch (aPseudoType) {
|
switch (aPseudoType) {
|
||||||
case nsCSSPseudoElements::ePseudo_before:
|
case CSSPseudoElementType::before:
|
||||||
return NS_LITERAL_STRING("::before");
|
return NS_LITERAL_STRING("::before");
|
||||||
case nsCSSPseudoElements::ePseudo_after:
|
case CSSPseudoElementType::after:
|
||||||
return NS_LITERAL_STRING("::after");
|
return NS_LITERAL_STRING("::after");
|
||||||
default:
|
default:
|
||||||
MOZ_ASSERT(aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
MOZ_ASSERT(aPseudoType == CSSPseudoElementType::NotPseudo,
|
||||||
"Unexpected pseudo type");
|
"Unexpected pseudo type");
|
||||||
return EmptyString();
|
return EmptyString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,14 +177,14 @@ public:
|
|||||||
nsCSSPseudoElements::Type PseudoElementType() const
|
nsCSSPseudoElements::Type PseudoElementType() const
|
||||||
{
|
{
|
||||||
if (IsForElement()) {
|
if (IsForElement()) {
|
||||||
return nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
return CSSPseudoElementType::NotPseudo;
|
||||||
}
|
}
|
||||||
if (IsForBeforePseudo()) {
|
if (IsForBeforePseudo()) {
|
||||||
return nsCSSPseudoElements::ePseudo_before;
|
return CSSPseudoElementType::before;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(IsForAfterPseudo(),
|
MOZ_ASSERT(IsForAfterPseudo(),
|
||||||
"::before & ::after should be the only pseudo-elements here");
|
"::before & ::after should be the only pseudo-elements here");
|
||||||
return nsCSSPseudoElements::ePseudo_after;
|
return CSSPseudoElementType::after;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);
|
static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);
|
||||||
@@ -235,7 +235,7 @@ class OwningElementRef final
|
|||||||
public:
|
public:
|
||||||
OwningElementRef()
|
OwningElementRef()
|
||||||
: mElement(nullptr)
|
: mElement(nullptr)
|
||||||
, mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
|
, mPseudoType(CSSPseudoElementType::NotPseudo)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
OwningElementRef(dom::Element& aElement,
|
OwningElementRef(dom::Element& aElement,
|
||||||
@@ -259,9 +259,9 @@ public:
|
|||||||
return nsContentUtils::PositionIsBefore(mElement, aOther.mElement);
|
return nsContentUtils::PositionIsBefore(mElement, aOther.mElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
return mPseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
(mPseudoType == nsCSSPseudoElements::ePseudo_before &&
|
(mPseudoType == CSSPseudoElementType::before &&
|
||||||
aOther.mPseudoType == nsCSSPseudoElements::ePseudo_after);
|
aOther.mPseudoType == CSSPseudoElementType::after);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSet() const { return !!mElement; }
|
bool IsSet() const { return !!mElement; }
|
||||||
|
|||||||
@@ -2535,7 +2535,7 @@ LookupStyleContext(dom::Element* aElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom* pseudo =
|
nsIAtom* pseudo =
|
||||||
aPseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount ?
|
aPseudoType < CSSPseudoElementType::Count ?
|
||||||
nsCSSPseudoElements::GetPseudoAtom(aPseudoType) : nullptr;
|
nsCSSPseudoElements::GetPseudoAtom(aPseudoType) : nullptr;
|
||||||
return nsComputedDOMStyle::GetStyleContextForElement(aElement, pseudo, shell);
|
return nsComputedDOMStyle::GetStyleContextForElement(aElement, pseudo, shell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,10 +315,10 @@ nsCSSSelector::nsCSSSelector(void)
|
|||||||
mNext(nullptr),
|
mNext(nullptr),
|
||||||
mNameSpace(kNameSpaceID_Unknown),
|
mNameSpace(kNameSpaceID_Unknown),
|
||||||
mOperator(0),
|
mOperator(0),
|
||||||
mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
|
mPseudoType(static_cast<int16_t>(CSSPseudoElementType::NotPseudo))
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsCSSSelector);
|
MOZ_COUNT_CTOR(nsCSSSelector);
|
||||||
static_assert(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
|
static_assert(static_cast<int16_t>(CSSPseudoElementType::MAX) < INT16_MAX,
|
||||||
"nsCSSPseudoElements::Type values overflow mPseudoType");
|
"nsCSSPseudoElements::Type values overflow mPseudoType");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const
|
|||||||
|
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
MOZ_ASSERT(!(IsPseudoElement() &&
|
MOZ_ASSERT(!(IsPseudoElement() &&
|
||||||
PseudoType() != nsCSSPseudoElements::ePseudo_XULTree &&
|
PseudoType() != CSSPseudoElementType::XULTree &&
|
||||||
mClassList),
|
mClassList),
|
||||||
"If non-XUL-tree pseudo-elements can have class selectors "
|
"If non-XUL-tree pseudo-elements can have class selectors "
|
||||||
"after them, specificity calculation must be updated");
|
"after them, specificity calculation must be updated");
|
||||||
@@ -517,7 +517,7 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const
|
|||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
// XUL tree pseudo-elements abuse mClassList to store some private
|
// XUL tree pseudo-elements abuse mClassList to store some private
|
||||||
// data; ignore that.
|
// data; ignore that.
|
||||||
if (PseudoType() == nsCSSPseudoElements::ePseudo_XULTree) {
|
if (PseudoType() == CSSPseudoElementType::XULTree) {
|
||||||
list = nullptr;
|
list = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public:
|
|||||||
bool aAppend = false) const;
|
bool aAppend = false) const;
|
||||||
|
|
||||||
bool IsRestrictedSelector() const {
|
bool IsRestrictedSelector() const {
|
||||||
return PseudoType() == nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
return PseudoType() == mozilla::CSSPseudoElementType::NotPseudo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|||||||
@@ -5875,7 +5875,7 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
|
|||||||
nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
|
nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
|
||||||
|
|
||||||
if (!AgentRulesEnabled() &&
|
if (!AgentRulesEnabled() &&
|
||||||
((pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount &&
|
((pseudoElementType < CSSPseudoElementType::Count &&
|
||||||
nsCSSPseudoElements::PseudoElementIsUASheetOnly(pseudoElementType)) ||
|
nsCSSPseudoElements::PseudoElementIsUASheetOnly(pseudoElementType)) ||
|
||||||
(pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass &&
|
(pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass &&
|
||||||
nsCSSPseudoClasses::PseudoClassIsUASheetOnly(pseudoClassType)))) {
|
nsCSSPseudoClasses::PseudoClassIsUASheetOnly(pseudoClassType)))) {
|
||||||
@@ -5887,17 +5887,17 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
|
|||||||
|
|
||||||
// We currently allow :-moz-placeholder and ::-moz-placeholder. We have to
|
// We currently allow :-moz-placeholder and ::-moz-placeholder. We have to
|
||||||
// be a bit stricter regarding the pseudo-element parsing rules.
|
// be a bit stricter regarding the pseudo-element parsing rules.
|
||||||
if (pseudoElementType == nsCSSPseudoElements::ePseudo_mozPlaceholder &&
|
if (pseudoElementType == CSSPseudoElementType::mozPlaceholder &&
|
||||||
pseudoClassType == nsCSSPseudoClasses::ePseudoClass_mozPlaceholder) {
|
pseudoClassType == nsCSSPseudoClasses::ePseudoClass_mozPlaceholder) {
|
||||||
if (parsingPseudoElement) {
|
if (parsingPseudoElement) {
|
||||||
pseudoClassType = nsCSSPseudoClasses::ePseudoClass_NotPseudoClass;
|
pseudoClassType = nsCSSPseudoClasses::ePseudoClass_NotPseudoClass;
|
||||||
} else {
|
} else {
|
||||||
pseudoElementType = nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
pseudoElementType = CSSPseudoElementType::NotPseudo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
isTreePseudo = (pseudoElementType == nsCSSPseudoElements::ePseudo_XULTree);
|
isTreePseudo = (pseudoElementType == CSSPseudoElementType::XULTree);
|
||||||
// If a tree pseudo-element is using the function syntax, it will
|
// If a tree pseudo-element is using the function syntax, it will
|
||||||
// get isTree set here and will pass the check below that only
|
// get isTree set here and will pass the check below that only
|
||||||
// allows functions if they are in our list of things allowed to be
|
// allows functions if they are in our list of things allowed to be
|
||||||
@@ -5907,18 +5907,17 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
|
|||||||
// desired.
|
// desired.
|
||||||
bool isTree = (eCSSToken_Function == mToken.mType) && isTreePseudo;
|
bool isTree = (eCSSToken_Function == mToken.mType) && isTreePseudo;
|
||||||
#endif
|
#endif
|
||||||
bool isPseudoElement =
|
bool isPseudoElement = (pseudoElementType < CSSPseudoElementType::Count);
|
||||||
(pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount);
|
|
||||||
// anonymous boxes are only allowed if they're the tree boxes or we have
|
// anonymous boxes are only allowed if they're the tree boxes or we have
|
||||||
// enabled agent rules
|
// enabled agent rules
|
||||||
bool isAnonBox = isTreePseudo ||
|
bool isAnonBox = isTreePseudo ||
|
||||||
(pseudoElementType == nsCSSPseudoElements::ePseudo_AnonBox &&
|
(pseudoElementType == CSSPseudoElementType::AnonBox &&
|
||||||
AgentRulesEnabled());
|
AgentRulesEnabled());
|
||||||
bool isPseudoClass =
|
bool isPseudoClass =
|
||||||
(pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
|
(pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
|
||||||
|
|
||||||
NS_ASSERTION(!isPseudoClass ||
|
NS_ASSERTION(!isPseudoClass ||
|
||||||
pseudoElementType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
pseudoElementType == CSSPseudoElementType::NotPseudo,
|
||||||
"Why is this atom both a pseudo-class and a pseudo-element?");
|
"Why is this atom both a pseudo-class and a pseudo-element?");
|
||||||
NS_ASSERTION(isPseudoClass + isPseudoElement + isAnonBox <= 1,
|
NS_ASSERTION(isPseudoClass + isPseudoElement + isAnonBox <= 1,
|
||||||
"Shouldn't be more than one of these");
|
"Shouldn't be more than one of these");
|
||||||
@@ -6413,8 +6412,7 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList,
|
|||||||
nsCSSSelector* selector = aList->AddSelector(aPrevCombinator);
|
nsCSSSelector* selector = aList->AddSelector(aPrevCombinator);
|
||||||
nsCOMPtr<nsIAtom> pseudoElement;
|
nsCOMPtr<nsIAtom> pseudoElement;
|
||||||
nsAutoPtr<nsAtomList> pseudoElementArgs;
|
nsAutoPtr<nsAtomList> pseudoElementArgs;
|
||||||
nsCSSPseudoElements::Type pseudoElementType =
|
nsCSSPseudoElements::Type pseudoElementType = CSSPseudoElementType::NotPseudo;
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
|
||||||
|
|
||||||
int32_t dataMask = 0;
|
int32_t dataMask = 0;
|
||||||
nsSelectorParsingStatus parsingStatus =
|
nsSelectorParsingStatus parsingStatus =
|
||||||
@@ -6433,7 +6431,7 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList,
|
|||||||
getter_Transfers(pseudoElementArgs),
|
getter_Transfers(pseudoElementArgs),
|
||||||
&pseudoElementType);
|
&pseudoElementType);
|
||||||
if (pseudoElement &&
|
if (pseudoElement &&
|
||||||
pseudoElementType != nsCSSPseudoElements::ePseudo_AnonBox) {
|
pseudoElementType != CSSPseudoElementType::AnonBox) {
|
||||||
// Pseudo-elements other than anonymous boxes are represented with
|
// Pseudo-elements other than anonymous boxes are represented with
|
||||||
// a special ':' combinator.
|
// a special ':' combinator.
|
||||||
|
|
||||||
@@ -6481,7 +6479,7 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pseudoElementType == nsCSSPseudoElements::ePseudo_AnonBox) {
|
if (pseudoElementType == CSSPseudoElementType::AnonBox) {
|
||||||
// We got an anonymous box pseudo-element; it must be the only
|
// We got an anonymous box pseudo-element; it must be the only
|
||||||
// thing in this selector group.
|
// thing in this selector group.
|
||||||
if (selector->mNext || !IsUniversalSelector(*selector)) {
|
if (selector->mNext || !IsUniversalSelector(*selector)) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ nsCSSPseudoElements::Type
|
/* static */ CSSPseudoElementType
|
||||||
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
|
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
|
for (uint32_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
|
||||||
@@ -85,22 +85,22 @@ nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
|
|||||||
if (nsCSSAnonBoxes::IsAnonBox(aAtom)) {
|
if (nsCSSAnonBoxes::IsAnonBox(aAtom)) {
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
if (nsCSSAnonBoxes::IsTreePseudoElement(aAtom)) {
|
if (nsCSSAnonBoxes::IsTreePseudoElement(aAtom)) {
|
||||||
return ePseudo_XULTree;
|
return Type::XULTree;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ePseudo_AnonBox;
|
return Type::AnonBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ePseudo_NotPseudoElement;
|
return Type::NotPseudo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ nsIAtom*
|
/* static */ nsIAtom*
|
||||||
nsCSSPseudoElements::GetPseudoAtom(Type aType)
|
nsCSSPseudoElements::GetPseudoAtom(Type aType)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
NS_ASSERTION(aType < Type::Count,
|
||||||
"Unexpected type");
|
"Unexpected type");
|
||||||
return *CSSPseudoElements_info[aType].mAtom;
|
return *CSSPseudoElements_info[static_cast<uint8_t>(aType)].mAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ uint32_t
|
/* static */ uint32_t
|
||||||
|
|||||||
@@ -35,12 +35,36 @@
|
|||||||
// Is content prevented from parsing selectors containing this pseudo-element?
|
// Is content prevented from parsing selectors containing this pseudo-element?
|
||||||
#define CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY (1<<4)
|
#define CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY (1<<4)
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
// The total count of CSSPseudoElement is less than 256,
|
||||||
|
// so use uint8_t as its underlying type.
|
||||||
|
enum class CSSPseudoElementType : uint8_t {
|
||||||
|
// If the actual pseudo-elements stop being first here, change
|
||||||
|
// GetPseudoType.
|
||||||
|
#define CSS_PSEUDO_ELEMENT(_name, _value_, _flags) \
|
||||||
|
_name,
|
||||||
|
#include "nsCSSPseudoElementList.h"
|
||||||
|
#undef CSS_PSEUDO_ELEMENT
|
||||||
|
Count,
|
||||||
|
AnonBox = Count,
|
||||||
|
#ifdef MOZ_XUL
|
||||||
|
XULTree,
|
||||||
|
#endif
|
||||||
|
NotPseudo,
|
||||||
|
MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
// Empty class derived from nsIAtom so that function signatures can
|
// Empty class derived from nsIAtom so that function signatures can
|
||||||
// require an atom from this atom list.
|
// require an atom from this atom list.
|
||||||
class nsICSSPseudoElement : public nsIAtom {};
|
class nsICSSPseudoElement : public nsIAtom {};
|
||||||
|
|
||||||
class nsCSSPseudoElements {
|
class nsCSSPseudoElements {
|
||||||
public:
|
public:
|
||||||
|
// FIXME: Remove this in later patch
|
||||||
|
using Type = mozilla::CSSPseudoElementType;
|
||||||
|
|
||||||
static void AddRefAtoms();
|
static void AddRefAtoms();
|
||||||
|
|
||||||
@@ -53,25 +77,9 @@ public:
|
|||||||
#include "nsCSSPseudoElementList.h"
|
#include "nsCSSPseudoElementList.h"
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
#undef CSS_PSEUDO_ELEMENT
|
||||||
|
|
||||||
enum Type {
|
|
||||||
// If the actual pseudo-elements stop being first here, change
|
|
||||||
// GetPseudoType.
|
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value_, _flags) \
|
|
||||||
ePseudo_##_name,
|
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
ePseudo_PseudoElementCount,
|
|
||||||
ePseudo_AnonBox = ePseudo_PseudoElementCount,
|
|
||||||
#ifdef MOZ_XUL
|
|
||||||
ePseudo_XULTree,
|
|
||||||
#endif
|
|
||||||
ePseudo_NotPseudoElement,
|
|
||||||
ePseudo_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
static Type GetPseudoType(nsIAtom* aAtom);
|
static Type GetPseudoType(nsIAtom* aAtom);
|
||||||
|
|
||||||
// Get the atom for a given Type. aType must be < ePseudo_PseudoElementCount
|
// Get the atom for a given Type. aType must be < Type::Count
|
||||||
static nsIAtom* GetPseudoAtom(Type aType);
|
static nsIAtom* GetPseudoAtom(Type aType);
|
||||||
|
|
||||||
static bool PseudoElementContainsElements(const Type aType) {
|
static bool PseudoElementContainsElements(const Type aType) {
|
||||||
@@ -79,14 +87,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool PseudoElementSupportsStyleAttribute(const Type aType) {
|
static bool PseudoElementSupportsStyleAttribute(const Type aType) {
|
||||||
MOZ_ASSERT(aType < ePseudo_PseudoElementCount);
|
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);
|
static bool PseudoElementSupportsUserActionState(const Type aType);
|
||||||
|
|
||||||
static bool PseudoElementIsUASheetOnly(const Type aType) {
|
static bool PseudoElementIsUASheetOnly(const Type aType) {
|
||||||
MOZ_ASSERT(aType < ePseudo_PseudoElementCount);
|
MOZ_ASSERT(aType < Type::Count);
|
||||||
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY);
|
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -911,7 +911,7 @@ struct RuleCascadeData {
|
|||||||
|
|
||||||
RuleHash mRuleHash;
|
RuleHash mRuleHash;
|
||||||
RuleHash*
|
RuleHash*
|
||||||
mPseudoElementRuleHashes[nsCSSPseudoElements::ePseudo_PseudoElementCount];
|
mPseudoElementRuleHashes[static_cast<uint8_t>(CSSPseudoElementType::Count)];
|
||||||
nsTArray<nsCSSRuleProcessor::StateSelector> mStateSelectors;
|
nsTArray<nsCSSRuleProcessor::StateSelector> mStateSelectors;
|
||||||
EventStates mSelectorDocumentStates;
|
EventStates mSelectorDocumentStates;
|
||||||
PLDHashTable mClassSelectors;
|
PLDHashTable mClassSelectors;
|
||||||
@@ -2644,7 +2644,9 @@ nsCSSRuleProcessor::RulesMatching(PseudoElementRuleProcessorData* aData)
|
|||||||
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
|
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
|
||||||
|
|
||||||
if (cascade) {
|
if (cascade) {
|
||||||
RuleHash* ruleHash = cascade->mPseudoElementRuleHashes[aData->mPseudoType];
|
RuleHash* ruleHash =
|
||||||
|
cascade->mPseudoElementRuleHashes[static_cast<uint8_t>(
|
||||||
|
aData->mPseudoType)];
|
||||||
if (ruleHash) {
|
if (ruleHash) {
|
||||||
NodeMatchContext nodeContext(EventStates(),
|
NodeMatchContext nodeContext(EventStates(),
|
||||||
nsCSSRuleProcessor::IsLink(aData->mElement));
|
nsCSSRuleProcessor::IsLink(aData->mElement));
|
||||||
@@ -2722,7 +2724,7 @@ nsCSSRuleProcessor::HasStateDependentStyle(ElementDependentRuleProcessorData* aD
|
|||||||
"SelectorMatchesTree call");
|
"SelectorMatchesTree call");
|
||||||
|
|
||||||
bool isPseudoElement =
|
bool isPseudoElement =
|
||||||
aPseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
aPseudoType != CSSPseudoElementType::NotPseudo;
|
||||||
|
|
||||||
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
|
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
|
||||||
|
|
||||||
@@ -2806,7 +2808,7 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
|
|||||||
{
|
{
|
||||||
return HasStateDependentStyle(aData,
|
return HasStateDependentStyle(aData,
|
||||||
aData->mElement,
|
aData->mElement,
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
CSSPseudoElementType::NotPseudo,
|
||||||
aData->mStateMask);
|
aData->mStateMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2888,7 +2890,7 @@ RestyleHintForSelectorWithAttributeChange(nsRestyleHint aCurrentHint,
|
|||||||
sel != aSelector;
|
sel != aSelector;
|
||||||
sel = sel->mNext) {
|
sel = sel->mNext) {
|
||||||
MOZ_ASSERT(sel, "aSelector must be reachable from aRightmostSelector");
|
MOZ_ASSERT(sel, "aSelector must be reachable from aRightmostSelector");
|
||||||
if (sel->PseudoType() != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (sel->PseudoType() != CSSPseudoElementType::NotPseudo) {
|
||||||
return eRestyle_Subtree;
|
return eRestyle_Subtree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3410,10 +3412,11 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
|
|||||||
|
|
||||||
// Build the rule hash.
|
// Build the rule hash.
|
||||||
nsCSSPseudoElements::Type pseudoType = aRuleInfo->mSelector->PseudoType();
|
nsCSSPseudoElements::Type pseudoType = aRuleInfo->mSelector->PseudoType();
|
||||||
if (MOZ_LIKELY(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement)) {
|
if (MOZ_LIKELY(pseudoType == CSSPseudoElementType::NotPseudo)) {
|
||||||
cascade->mRuleHash.AppendRule(*aRuleInfo);
|
cascade->mRuleHash.AppendRule(*aRuleInfo);
|
||||||
} else if (pseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
} else if (pseudoType < CSSPseudoElementType::Count) {
|
||||||
RuleHash*& ruleHash = cascade->mPseudoElementRuleHashes[pseudoType];
|
RuleHash*& ruleHash =
|
||||||
|
cascade->mPseudoElementRuleHashes[static_cast<uint8_t>(pseudoType)];
|
||||||
if (!ruleHash) {
|
if (!ruleHash) {
|
||||||
ruleHash = new RuleHash(cascade->mQuirksMode);
|
ruleHash = new RuleHash(cascade->mQuirksMode);
|
||||||
if (!ruleHash) {
|
if (!ruleHash) {
|
||||||
@@ -3426,7 +3429,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
|
|||||||
NS_ASSERTION(aRuleInfo->mSelector->mNext->mOperator == ':',
|
NS_ASSERTION(aRuleInfo->mSelector->mNext->mOperator == ':',
|
||||||
"Unexpected mNext combinator");
|
"Unexpected mNext combinator");
|
||||||
ruleHash->AppendRule(*aRuleInfo);
|
ruleHash->AppendRule(*aRuleInfo);
|
||||||
} else if (pseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
|
} else if (pseudoType == CSSPseudoElementType::AnonBox) {
|
||||||
NS_ASSERTION(!aRuleInfo->mSelector->mCasedTag &&
|
NS_ASSERTION(!aRuleInfo->mSelector->mCasedTag &&
|
||||||
!aRuleInfo->mSelector->mIDList &&
|
!aRuleInfo->mSelector->mIDList &&
|
||||||
!aRuleInfo->mSelector->mClassList &&
|
!aRuleInfo->mSelector->mClassList &&
|
||||||
@@ -3444,7 +3447,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
|
|||||||
RuleValue(*aRuleInfo, 0, aCascade->mQuirksMode));
|
RuleValue(*aRuleInfo, 0, aCascade->mQuirksMode));
|
||||||
} else {
|
} else {
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
NS_ASSERTION(pseudoType == nsCSSPseudoElements::ePseudo_XULTree,
|
NS_ASSERTION(pseudoType == CSSPseudoElementType::XULTree,
|
||||||
"Unexpected pseudo type");
|
"Unexpected pseudo type");
|
||||||
// Index doesn't matter here, since we'll just be walking these
|
// Index doesn't matter here, since we'll just be walking these
|
||||||
// rules in order; just pass 0.
|
// rules in order; just pass 0.
|
||||||
@@ -3460,7 +3463,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
|
|||||||
selector; selector = selector->mNext) {
|
selector; selector = selector->mNext) {
|
||||||
if (selector->IsPseudoElement()) {
|
if (selector->IsPseudoElement()) {
|
||||||
nsCSSPseudoElements::Type pseudo = selector->PseudoType();
|
nsCSSPseudoElements::Type pseudo = selector->PseudoType();
|
||||||
if (pseudo >= nsCSSPseudoElements::ePseudo_PseudoElementCount ||
|
if (pseudo >= CSSPseudoElementType::Count ||
|
||||||
!nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudo)) {
|
!nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudo)) {
|
||||||
NS_ASSERTION(!selector->mNegations, "Shouldn't have negations");
|
NS_ASSERTION(!selector->mNegations, "Shouldn't have negations");
|
||||||
// We do store selectors ending with pseudo-elements that allow :hover
|
// We do store selectors ending with pseudo-elements that allow :hover
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
|
|||||||
RefPtr<nsStyleContext> sc;
|
RefPtr<nsStyleContext> sc;
|
||||||
if (aPseudo) {
|
if (aPseudo) {
|
||||||
nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
|
nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
|
||||||
if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
if (type >= CSSPseudoElementType::Count) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
|
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
|
||||||
|
|||||||
@@ -478,8 +478,7 @@ struct MOZ_STACK_CLASS PseudoElementRuleProcessorData :
|
|||||||
mPseudoType(aPseudoType),
|
mPseudoType(aPseudoType),
|
||||||
mPseudoElement(aPseudoElement)
|
mPseudoElement(aPseudoElement)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aPseudoType <
|
NS_PRECONDITION(aPseudoType < mozilla::CSSPseudoElementType::Count,
|
||||||
nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
|
||||||
"invalid aPseudoType value");
|
"invalid aPseudoType value");
|
||||||
NS_PRECONDITION(aTreeMatchContext.mForStyling, "Styling here!");
|
NS_PRECONDITION(aTreeMatchContext.mForStyling, "Styling here!");
|
||||||
NS_PRECONDITION(aRuleWalker, "Must have rule walker");
|
NS_PRECONDITION(aRuleWalker, "Must have rule walker");
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
|||||||
// This check has to be done "backward", because if it were written the
|
// This check has to be done "backward", because if it were written the
|
||||||
// more natural way it wouldn't fail even when it needed to.
|
// more natural way it wouldn't fail even when it needed to.
|
||||||
static_assert((UINT64_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
|
static_assert((UINT64_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
|
||||||
nsCSSPseudoElements::ePseudo_MAX,
|
static_cast<uint8_t>(CSSPseudoElementType::MAX),
|
||||||
"pseudo element bits no longer fit in a uint64_t");
|
"pseudo element bits no longer fit in a uint64_t");
|
||||||
MOZ_ASSERT(aRuleNode);
|
MOZ_ASSERT(aRuleNode);
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ ShouldSuppressLineBreak(const nsStyleContext* aContext,
|
|||||||
// some other frame with a ruby display value. Non-element pseudos
|
// some other frame with a ruby display value. Non-element pseudos
|
||||||
// which represents text frames, as well as ruby pseudos are excluded
|
// which represents text frames, as well as ruby pseudos are excluded
|
||||||
// because we still want to set the flag for them.
|
// because we still want to set the flag for them.
|
||||||
if (aContext->GetPseudoType() == nsCSSPseudoElements::ePseudo_AnonBox &&
|
if (aContext->GetPseudoType() == CSSPseudoElementType::AnonBox &&
|
||||||
aContext->GetPseudo() != nsCSSAnonBoxes::mozNonElement &&
|
aContext->GetPseudo() != nsCSSAnonBoxes::mozNonElement &&
|
||||||
!RubyUtils::IsRubyPseudo(aContext->GetPseudo())) {
|
!RubyUtils::IsRubyPseudo(aContext->GetPseudo())) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -891,7 +891,7 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION((!aPseudoTag &&
|
NS_PRECONDITION((!aPseudoTag &&
|
||||||
aPseudoType ==
|
aPseudoType ==
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement) ||
|
CSSPseudoElementType::NotPseudo) ||
|
||||||
(aPseudoTag &&
|
(aPseudoTag &&
|
||||||
nsCSSPseudoElements::GetPseudoType(aPseudoTag) ==
|
nsCSSPseudoElements::GetPseudoType(aPseudoTag) ==
|
||||||
aPseudoType),
|
aPseudoType),
|
||||||
@@ -1016,7 +1016,7 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
|
|||||||
|
|
||||||
if (aElementForAnimation &&
|
if (aElementForAnimation &&
|
||||||
aElementForAnimation->IsHTMLElement(nsGkAtoms::body) &&
|
aElementForAnimation->IsHTMLElement(nsGkAtoms::body) &&
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement &&
|
aPseudoType == CSSPseudoElementType::NotPseudo &&
|
||||||
PresContext()->CompatibilityMode() == eCompatibility_NavQuirks) {
|
PresContext()->CompatibilityMode() == eCompatibility_NavQuirks) {
|
||||||
nsIDocument* doc = aElementForAnimation->GetCurrentDoc();
|
nsIDocument* doc = aElementForAnimation->GetCurrentDoc();
|
||||||
if (doc && doc->GetBodyElement() == aElementForAnimation) {
|
if (doc && doc->GetBodyElement() == aElementForAnimation) {
|
||||||
@@ -1395,7 +1395,7 @@ nsStyleSet::ResolveStyleFor(Element* aElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return GetContext(aParentContext, ruleNode, visitedRuleNode,
|
return GetContext(aParentContext, ruleNode, visitedRuleNode,
|
||||||
nullptr, nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
nullptr, CSSPseudoElementType::NotPseudo,
|
||||||
aElement, flags);
|
aElement, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1414,7 +1414,7 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return GetContext(aParentContext, ruleWalker.CurrentNode(), nullptr,
|
return GetContext(aParentContext, ruleWalker.CurrentNode(), nullptr,
|
||||||
nullptr, nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
nullptr, CSSPseudoElementType::NotPseudo,
|
||||||
nullptr, eNoFlags);
|
nullptr, eNoFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1510,7 +1510,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||||||
NS_ASSERTION(mBatching == 0, "rule processors out of date");
|
NS_ASSERTION(mBatching == 0, "rule processors out of date");
|
||||||
|
|
||||||
MOZ_ASSERT(!aPseudoElement ==
|
MOZ_ASSERT(!aPseudoElement ==
|
||||||
(aPseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount ||
|
(aPseudoType >= CSSPseudoElementType::Count ||
|
||||||
!(nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aPseudoType) ||
|
!(nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aPseudoType) ||
|
||||||
nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType))),
|
nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType))),
|
||||||
"should have aPseudoElement only for certain pseudo elements");
|
"should have aPseudoElement only for certain pseudo elements");
|
||||||
@@ -1565,9 +1565,9 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||||||
if (doReplace) {
|
if (doReplace) {
|
||||||
switch (level->mLevel) {
|
switch (level->mLevel) {
|
||||||
case SheetType::Animation: {
|
case SheetType::Animation: {
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
if (aPseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
aPseudoType == CSSPseudoElementType::before ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
aPseudoType == CSSPseudoElementType::after) {
|
||||||
nsIStyleRule* rule = PresContext()->EffectCompositor()->
|
nsIStyleRule* rule = PresContext()->EffectCompositor()->
|
||||||
GetAnimationRule(aElement, aPseudoType,
|
GetAnimationRule(aElement, aPseudoType,
|
||||||
EffectCompositor::CascadeLevel::Animations);
|
EffectCompositor::CascadeLevel::Animations);
|
||||||
@@ -1579,9 +1579,9 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SheetType::Transition: {
|
case SheetType::Transition: {
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
if (aPseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
aPseudoType == CSSPseudoElementType::before ||
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
aPseudoType == CSSPseudoElementType::after) {
|
||||||
nsIStyleRule* rule = PresContext()->EffectCompositor()->
|
nsIStyleRule* rule = PresContext()->EffectCompositor()->
|
||||||
GetAnimationRule(aElement, aPseudoType,
|
GetAnimationRule(aElement, aPseudoType,
|
||||||
EffectCompositor::CascadeLevel::Transitions);
|
EffectCompositor::CascadeLevel::Transitions);
|
||||||
@@ -1597,7 +1597,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||||||
static_cast<SVGAttrAnimationRuleProcessor*>(
|
static_cast<SVGAttrAnimationRuleProcessor*>(
|
||||||
mRuleProcessors[SheetType::SVGAttrAnimation].get());
|
mRuleProcessors[SheetType::SVGAttrAnimation].get());
|
||||||
if (ruleProcessor &&
|
if (ruleProcessor &&
|
||||||
aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
aPseudoType == CSSPseudoElementType::NotPseudo) {
|
||||||
ruleProcessor->ElementRulesMatching(aElement, &ruleWalker);
|
ruleProcessor->ElementRulesMatching(aElement, &ruleWalker);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1611,12 +1611,12 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||||||
if (ruleProcessor) {
|
if (ruleProcessor) {
|
||||||
lastScopedRN = ruleWalker.CurrentNode();
|
lastScopedRN = ruleWalker.CurrentNode();
|
||||||
if (aPseudoType ==
|
if (aPseudoType ==
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
CSSPseudoElementType::NotPseudo) {
|
||||||
ruleProcessor->ElementRulesMatching(PresContext(),
|
ruleProcessor->ElementRulesMatching(PresContext(),
|
||||||
aElement,
|
aElement,
|
||||||
&ruleWalker);
|
&ruleWalker);
|
||||||
} else if (aPseudoType <
|
} else if (aPseudoType <
|
||||||
nsCSSPseudoElements::ePseudo_PseudoElementCount &&
|
CSSPseudoElementType::Count &&
|
||||||
nsCSSPseudoElements::
|
nsCSSPseudoElements::
|
||||||
PseudoElementSupportsStyleAttribute(aPseudoType)) {
|
PseudoElementSupportsStyleAttribute(aPseudoType)) {
|
||||||
ruleProcessor->PseudoElementRulesMatching(aPseudoElement,
|
ruleProcessor->PseudoElementRulesMatching(aPseudoElement,
|
||||||
@@ -1709,9 +1709,9 @@ nsStyleSet::ResolveStyleWithReplacement(Element* aElement,
|
|||||||
nsCSSPseudoElements::Type pseudoType = aOldStyleContext->GetPseudoType();
|
nsCSSPseudoElements::Type pseudoType = aOldStyleContext->GetPseudoType();
|
||||||
Element* elementForAnimation = nullptr;
|
Element* elementForAnimation = nullptr;
|
||||||
if (!(aFlags & eSkipStartingAnimations) &&
|
if (!(aFlags & eSkipStartingAnimations) &&
|
||||||
(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
(pseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
pseudoType == nsCSSPseudoElements::ePseudo_before ||
|
pseudoType == CSSPseudoElementType::before ||
|
||||||
pseudoType == nsCSSPseudoElements::ePseudo_after)) {
|
pseudoType == CSSPseudoElementType::after)) {
|
||||||
// We want to compute a correct elementForAnimation to pass in
|
// We want to compute a correct elementForAnimation to pass in
|
||||||
// because at this point the parameter is more than just the element
|
// because at this point the parameter is more than just the element
|
||||||
// for animation; it's also used for the SetBodyTextColor call when
|
// for animation; it's also used for the SetBodyTextColor call when
|
||||||
@@ -1728,11 +1728,10 @@ nsStyleSet::ResolveStyleWithReplacement(Element* aElement,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(elementForAnimation);
|
nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(elementForAnimation);
|
||||||
NS_ASSERTION(pseudoType ==
|
NS_ASSERTION(pseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
|
||||||
!styleFrame ||
|
!styleFrame ||
|
||||||
styleFrame->StyleContext()->GetPseudoType() ==
|
styleFrame->StyleContext()->GetPseudoType() ==
|
||||||
nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
CSSPseudoElementType::NotPseudo,
|
||||||
"aElement should be the element and not the pseudo-element");
|
"aElement should be the element and not the pseudo-element");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1759,9 +1758,9 @@ nsStyleSet::ResolveStyleWithoutAnimation(dom::Element* aTarget,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
|
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
|
||||||
#endif
|
#endif
|
||||||
MOZ_ASSERT(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
MOZ_ASSERT(pseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
pseudoType == nsCSSPseudoElements::ePseudo_before ||
|
pseudoType == CSSPseudoElementType::before ||
|
||||||
pseudoType == nsCSSPseudoElements::ePseudo_after,
|
pseudoType == CSSPseudoElementType::after,
|
||||||
"unexpected type for animations");
|
"unexpected type for animations");
|
||||||
RestyleManager* restyleManager = PresContext()->RestyleManager();
|
RestyleManager* restyleManager = PresContext()->RestyleManager();
|
||||||
|
|
||||||
@@ -1783,7 +1782,7 @@ nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
|
|||||||
{
|
{
|
||||||
return GetContext(aParentContext, mRuleTree, nullptr,
|
return GetContext(aParentContext, mRuleTree, nullptr,
|
||||||
nsCSSAnonBoxes::mozNonElement,
|
nsCSSAnonBoxes::mozNonElement,
|
||||||
nsCSSPseudoElements::ePseudo_AnonBox, nullptr,
|
CSSPseudoElementType::AnonBox, nullptr,
|
||||||
eNoFlags);
|
eNoFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1793,11 +1792,11 @@ nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
|
|||||||
{
|
{
|
||||||
// This needs to match GetPseudoRestriction in nsRuleNode.cpp.
|
// This needs to match GetPseudoRestriction in nsRuleNode.cpp.
|
||||||
aRuleWalker->SetLevel(SheetType::Agent, false, false);
|
aRuleWalker->SetLevel(SheetType::Agent, false, false);
|
||||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLetter)
|
if (aPseudoType == CSSPseudoElementType::firstLetter)
|
||||||
aRuleWalker->Forward(mFirstLetterRule);
|
aRuleWalker->Forward(mFirstLetterRule);
|
||||||
else if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLine)
|
else if (aPseudoType == CSSPseudoElementType::firstLine)
|
||||||
aRuleWalker->Forward(mFirstLineRule);
|
aRuleWalker->Forward(mFirstLineRule);
|
||||||
else if (aPseudoType == nsCSSPseudoElements::ePseudo_mozPlaceholder)
|
else if (aPseudoType == CSSPseudoElementType::mozPlaceholder)
|
||||||
aRuleWalker->Forward(mPlaceholderRule);
|
aRuleWalker->Forward(mPlaceholderRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1817,7 +1816,7 @@ nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
|
|||||||
{
|
{
|
||||||
NS_ENSURE_FALSE(mInShutdown, nullptr);
|
NS_ENSURE_FALSE(mInShutdown, nullptr);
|
||||||
|
|
||||||
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
NS_ASSERTION(aType < CSSPseudoElementType::Count,
|
||||||
"must have pseudo element type");
|
"must have pseudo element type");
|
||||||
NS_ASSERTION(aParentElement, "Must have parent element");
|
NS_ASSERTION(aParentElement, "Must have parent element");
|
||||||
|
|
||||||
@@ -1847,8 +1846,8 @@ nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
|
|||||||
// For pseudos, |data.IsLink()| being true means that
|
// For pseudos, |data.IsLink()| being true means that
|
||||||
// our parent node is a link.
|
// our parent node is a link.
|
||||||
uint32_t flags = eNoFlags;
|
uint32_t flags = eNoFlags;
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_before ||
|
if (aType == CSSPseudoElementType::before ||
|
||||||
aType == nsCSSPseudoElements::ePseudo_after) {
|
aType == CSSPseudoElementType::after) {
|
||||||
flags |= eDoAnimation;
|
flags |= eDoAnimation;
|
||||||
} else {
|
} else {
|
||||||
// Flex and grid containers don't expect to have any pseudo-element children
|
// Flex and grid containers don't expect to have any pseudo-element children
|
||||||
@@ -1884,7 +1883,7 @@ nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
|
|||||||
{
|
{
|
||||||
NS_ENSURE_FALSE(mInShutdown, nullptr);
|
NS_ENSURE_FALSE(mInShutdown, nullptr);
|
||||||
|
|
||||||
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
|
NS_ASSERTION(aType < CSSPseudoElementType::Count,
|
||||||
"must have pseudo element type");
|
"must have pseudo element type");
|
||||||
NS_ASSERTION(aParentElement, "aParentElement must not be null");
|
NS_ASSERTION(aParentElement, "aParentElement must not be null");
|
||||||
|
|
||||||
@@ -1919,8 +1918,8 @@ nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
|
|||||||
// For pseudos, |data.IsLink()| being true means that
|
// For pseudos, |data.IsLink()| being true means that
|
||||||
// our parent node is a link.
|
// our parent node is a link.
|
||||||
uint32_t flags = eNoFlags;
|
uint32_t flags = eNoFlags;
|
||||||
if (aType == nsCSSPseudoElements::ePseudo_before ||
|
if (aType == CSSPseudoElementType::before ||
|
||||||
aType == nsCSSPseudoElements::ePseudo_after) {
|
aType == CSSPseudoElementType::after) {
|
||||||
flags |= eDoAnimation;
|
flags |= eDoAnimation;
|
||||||
} else {
|
} else {
|
||||||
// Flex and grid containers don't expect to have any pseudo-element children
|
// Flex and grid containers don't expect to have any pseudo-element children
|
||||||
@@ -1995,7 +1994,7 @@ nsStyleSet::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return GetContext(aParentContext, ruleWalker.CurrentNode(), nullptr,
|
return GetContext(aParentContext, ruleWalker.CurrentNode(), nullptr,
|
||||||
aPseudoTag, nsCSSPseudoElements::ePseudo_AnonBox,
|
aPseudoTag, CSSPseudoElementType::AnonBox,
|
||||||
nullptr, aFlags);
|
nullptr, aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2035,7 +2034,7 @@ nsStyleSet::ResolveXULTreePseudoStyle(Element* aParentElement,
|
|||||||
return GetContext(aParentContext, ruleNode, visitedRuleNode,
|
return GetContext(aParentContext, ruleNode, visitedRuleNode,
|
||||||
// For pseudos, |data.IsLink()| being true means that
|
// For pseudos, |data.IsLink()| being true means that
|
||||||
// our parent node is a link.
|
// our parent node is a link.
|
||||||
aPseudoTag, nsCSSPseudoElements::ePseudo_XULTree,
|
aPseudoTag, CSSPseudoElementType::XULTree,
|
||||||
nullptr, eNoFlags);
|
nullptr, eNoFlags);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2294,9 +2293,9 @@ nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
if (pseudoType == CSSPseudoElementType::NotPseudo ||
|
||||||
pseudoType == nsCSSPseudoElements::ePseudo_before ||
|
pseudoType == CSSPseudoElementType::before ||
|
||||||
pseudoType == nsCSSPseudoElements::ePseudo_after) {
|
pseudoType == CSSPseudoElementType::after) {
|
||||||
flags |= eDoAnimation;
|
flags |= eDoAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,15 +262,15 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
|||||||
// common case: no transitions specified or running.
|
// common case: no transitions specified or running.
|
||||||
const nsStyleDisplay *disp = newStyleContext->StyleDisplay();
|
const nsStyleDisplay *disp = newStyleContext->StyleDisplay();
|
||||||
nsCSSPseudoElements::Type pseudoType = newStyleContext->GetPseudoType();
|
nsCSSPseudoElements::Type pseudoType = newStyleContext->GetPseudoType();
|
||||||
if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
if (pseudoType != CSSPseudoElementType::NotPseudo) {
|
||||||
if (pseudoType != nsCSSPseudoElements::ePseudo_before &&
|
if (pseudoType != CSSPseudoElementType::before &&
|
||||||
pseudoType != nsCSSPseudoElements::ePseudo_after) {
|
pseudoType != CSSPseudoElementType::after) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION((pseudoType == nsCSSPseudoElements::ePseudo_before &&
|
NS_ASSERTION((pseudoType == CSSPseudoElementType::before &&
|
||||||
aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore) ||
|
aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore) ||
|
||||||
(pseudoType == nsCSSPseudoElements::ePseudo_after &&
|
(pseudoType == CSSPseudoElementType::after &&
|
||||||
aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter),
|
aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter),
|
||||||
"Unexpected aElement coming through");
|
"Unexpected aElement coming through");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user