Classes |
| struct | AllocationHeader |
Public Member Functions |
| | nsStyleContext (nsStyleContext *aParent, nsIAtom *aPseudoTag, nsCSSPseudoElements::Type aPseudoType, nsRuleNode *aRuleNode, nsPresContext *aPresContext) |
| | ~nsStyleContext () |
| void * | operator new (size_t sz, nsPresContext *aPresContext) throw () |
| void | Destroy () |
| nsrefcnt | AddRef () |
| nsrefcnt | Release () |
| nsPresContext * | PresContext () const |
| nsStyleContext * | GetParent () const |
| nsIAtom * | GetPseudo () const |
| nsCSSPseudoElements::Type | GetPseudoType () const |
| already_AddRefed< nsStyleContext > | FindChildWithRules (const nsIAtom *aPseudoTag, nsRuleNode *aRules, nsRuleNode *aRulesIfVisited, PRBool aRelevantLinkVisited) |
| PRBool | HasTextDecorations () const |
| PRBool | HasPseudoElementData () const |
| PRBool | RelevantLinkVisited () const |
| PRBool | IsLinkContext () const |
| PRBool | IsStyleIfVisited () const |
| void | SetIsStyleIfVisited () |
| nsStyleContext * | GetStyleIfVisited () const |
| void | SetStyleIfVisited (already_AddRefed< nsStyleContext > aStyleIfVisited) |
| void | SetStyle (nsStyleStructID aSID, void *aStruct) |
| void | SetStyleFont (nsStyleFont *aStruct) |
| void | SetStyleColor (nsStyleColor *aStruct) |
| void | SetStyleList (nsStyleList *aStruct) |
| void | SetStyleText (nsStyleText *aStruct) |
| void | SetStyleVisibility (nsStyleVisibility *aStruct) |
| void | SetStyleQuotes (nsStyleQuotes *aStruct) |
| void | SetStyleUserInterface (nsStyleUserInterface *aStruct) |
| void | SetStyleTableBorder (nsStyleTableBorder *aStruct) |
| void | SetStyleSVG (nsStyleSVG *aStruct) |
| nsRuleNode * | GetRuleNode () |
| void | AddStyleBit (const PRUint32 &aBit) |
| void | Mark () |
| const void * | GetStyleData (nsStyleStructID aSID) |
| const nsStyleFont * | GetStyleFont () |
| const nsStyleColor * | GetStyleColor () |
| const nsStyleBackground * | GetStyleBackground () |
| const nsStyleList * | GetStyleList () |
| const nsStylePosition * | GetStylePosition () |
| const nsStyleText * | GetStyleText () |
| const nsStyleTextReset * | GetStyleTextReset () |
| const nsStyleDisplay * | GetStyleDisplay () |
| const nsStyleVisibility * | GetStyleVisibility () |
| const nsStyleContent * | GetStyleContent () |
| const nsStyleQuotes * | GetStyleQuotes () |
| const nsStyleUserInterface * | GetStyleUserInterface () |
| const nsStyleUIReset * | GetStyleUIReset () |
| const nsStyleTable * | GetStyleTable () |
| const nsStyleTableBorder * | GetStyleTableBorder () |
| const nsStyleMargin * | GetStyleMargin () |
| const nsStylePadding * | GetStylePadding () |
| const nsStyleBorder * | GetStyleBorder () |
| const nsStyleOutline * | GetStyleOutline () |
| const nsStyleXUL * | GetStyleXUL () |
| const nsStyleSVG * | GetStyleSVG () |
| const nsStyleSVGReset * | GetStyleSVGReset () |
| const nsStyleColumn * | GetStyleColumn () |
| const nsStyleFont * | PeekStyleFont () |
| const nsStyleColor * | PeekStyleColor () |
| const nsStyleBackground * | PeekStyleBackground () |
| const nsStyleList * | PeekStyleList () |
| const nsStylePosition * | PeekStylePosition () |
| const nsStyleText * | PeekStyleText () |
| const nsStyleTextReset * | PeekStyleTextReset () |
| const nsStyleDisplay * | PeekStyleDisplay () |
| const nsStyleVisibility * | PeekStyleVisibility () |
| const nsStyleContent * | PeekStyleContent () |
| const nsStyleQuotes * | PeekStyleQuotes () |
| const nsStyleUserInterface * | PeekStyleUserInterface () |
| const nsStyleUIReset * | PeekStyleUIReset () |
| const nsStyleTable * | PeekStyleTable () |
| const nsStyleTableBorder * | PeekStyleTableBorder () |
| const nsStyleMargin * | PeekStyleMargin () |
| const nsStylePadding * | PeekStylePadding () |
| const nsStyleBorder * | PeekStyleBorder () |
| const nsStyleOutline * | PeekStyleOutline () |
| const nsStyleXUL * | PeekStyleXUL () |
| const nsStyleSVG * | PeekStyleSVG () |
| const nsStyleSVGReset * | PeekStyleSVGReset () |
| const nsStyleColumn * | PeekStyleColumn () |
| void * | GetUniqueStyleData (const nsStyleStructID &aSID) |
| nsChangeHint | CalcStyleDifference (nsStyleContext *aOther) |
| nscolor | GetVisitedDependentColor (nsCSSProperty aProperty) |
| | Get a color that depends on link-visitedness using this and this->GetStyleIfVisited().
|
| void * | Alloc (size_t aSize) |
| | Allocate a chunk of memory that is scoped to the lifetime of this style context, i.e., memory that will automatically be freed when this style context is destroyed.
|
Static Public Member Functions |
| static nscolor | CombineVisitedColors (nscolor *aColors, PRBool aLinkIsVisited) |
| | aColors should be a two element array of nscolor in which the first color is the unvisited color and the second is the visited color.
|
Protected Member Functions |
| void | AddChild (nsStyleContext *aChild) |
| void | RemoveChild (nsStyleContext *aChild) |
| void | ApplyStyleFixups (nsPresContext *aPresContext) |
| void | FreeAllocations (nsPresContext *aPresContext) |
| const void * | GetCachedStyleData (nsStyleStructID aSID) |
| const nsStyleFont * | DoGetStyleFont (PRBool aComputeData) |
| const nsStyleColor * | DoGetStyleColor (PRBool aComputeData) |
| const nsStyleBackground * | DoGetStyleBackground (PRBool aComputeData) |
| const nsStyleList * | DoGetStyleList (PRBool aComputeData) |
| const nsStylePosition * | DoGetStylePosition (PRBool aComputeData) |
| const nsStyleText * | DoGetStyleText (PRBool aComputeData) |
| const nsStyleTextReset * | DoGetStyleTextReset (PRBool aComputeData) |
| const nsStyleDisplay * | DoGetStyleDisplay (PRBool aComputeData) |
| const nsStyleVisibility * | DoGetStyleVisibility (PRBool aComputeData) |
| const nsStyleContent * | DoGetStyleContent (PRBool aComputeData) |
| const nsStyleQuotes * | DoGetStyleQuotes (PRBool aComputeData) |
| const nsStyleUserInterface * | DoGetStyleUserInterface (PRBool aComputeData) |
| const nsStyleUIReset * | DoGetStyleUIReset (PRBool aComputeData) |
| const nsStyleTable * | DoGetStyleTable (PRBool aComputeData) |
| const nsStyleTableBorder * | DoGetStyleTableBorder (PRBool aComputeData) |
| const nsStyleMargin * | DoGetStyleMargin (PRBool aComputeData) |
| const nsStylePadding * | DoGetStylePadding (PRBool aComputeData) |
| const nsStyleBorder * | DoGetStyleBorder (PRBool aComputeData) |
| const nsStyleOutline * | DoGetStyleOutline (PRBool aComputeData) |
| const nsStyleXUL * | DoGetStyleXUL (PRBool aComputeData) |
| const nsStyleSVG * | DoGetStyleSVG (PRBool aComputeData) |
| const nsStyleSVGReset * | DoGetStyleSVGReset (PRBool aComputeData) |
| const nsStyleColumn * | DoGetStyleColumn (PRBool aComputeData) |
Protected Attributes |
| nsStyleContext *const | mParent |
| nsStyleContext * | mChild |
| nsStyleContext * | mEmptyChild |
| nsStyleContext * | mPrevSibling |
| nsStyleContext * | mNextSibling |
| nsRefPtr< nsStyleContext > | mStyleIfVisited |
| nsCOMPtr< nsIAtom > | mPseudoTag |
| nsRuleNode *const | mRuleNode |
| AllocationHeader * | mAllocations |
| nsResetStyleData * | mCachedResetData |
| nsInheritedStyleData | mCachedInheritedData |
| PRUint32 | mBits |
| PRUint32 | mRefCnt |
Since the data in |nsIStyleRule|s and |nsRuleNode|s are immutable (with a few exceptions, like system color changes), the data in an nsStyleContext are also immutable (with the additional exception of GetUniqueStyleData). When style data change, nsFrameManager::ReResolveStyleContext creates a new style context.
Style contexts are reference counted. References are generally held by: 1. the |nsIFrame|s that are using the style context and 2. any *child* style contexts (this might be the reverse of expectation, but it makes sense in this case) Style contexts participate in the mark phase of rule node garbage collection.
| void* nsStyleContext::Alloc |
( |
size_t |
aSize |
) |
|
Allocate a chunk of memory that is scoped to the lifetime of this style context, i.e., memory that will automatically be freed when this style context is destroyed.
This is intended for allocations that are stored on this style context or its style structs. (Use on style structs is fine since any style context to which this context's style structs are shared will be a descendant of this style context and thus keep it alive.)
This currently allocates the memory out of the pres shell arena.
It would be relatively straightforward to write a Free method for the underlying implementation, but we don't need it (or the overhead of making a doubly-linked list or other structure to support it).
WARNING: Memory allocated using this method cannot be stored in the rule tree, since rule nodes may outlive the style context.