Make style contexts know whether they have data from a pseudo-element. (Bug 505515, Bug 435441) r=bzbarsky

This commit is contained in:
L. David Baron 2009-08-10 15:52:29 -07:00
parent 7ca075a6db
commit c46fca41b6
3 changed files with 18 additions and 2 deletions

View File

@ -324,6 +324,10 @@ nsStyleContext::ApplyStyleFixups(nsPresContext* aPresContext)
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
}
if ((mParent && mParent->HasPseudoElementData()) || mPseudoTag) {
mBits |= NS_STYLE_HAS_PSEUDO_ELEMENT_DATA;
}
// Correct tables.
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mDisplay == NS_STYLE_DISPLAY_TABLE) {

View File

@ -112,7 +112,17 @@ public:
NS_HIDDEN_(already_AddRefed<nsStyleContext>)
FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules);
PRBool HasTextDecorations() { return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); }
// Does this style context or any of its ancestors have text
// decorations?
PRBool HasTextDecorations() const
{ return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); }
// Does this style context represent the style for a pseudo-element or
// inherit data from such a style context? Whether this returns true
// is equivalent to whether it or any of its ancestors returns
// non-null for GetPseudoType.
PRBool HasPseudoElementData() const
{ return !!(mBits & NS_STYLE_HAS_PSEUDO_ELEMENT_DATA); }
NS_HIDDEN_(void) SetStyle(nsStyleStructID aSID, void* aStruct);

View File

@ -75,8 +75,10 @@ class imgIRequest;
#define NS_STYLE_INHERIT_MASK 0x00ffffff
// Additional bits for nsStyleContext's mBits:
// A bit to test whether or not we have any text decorations.
// See nsStyleContext::HasTextDecorations
#define NS_STYLE_HAS_TEXT_DECORATIONS 0x01000000
// See nsStyleContext::HasPseudoElementData.
#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA 0x02000000
// Additional bits for nsRuleNode's mDependentBits:
#define NS_RULE_NODE_GC_MARK 0x02000000