get rid of nsStyleStruct base type. b=408933, r+sr=dbaron, a=beltzner

This commit is contained in:
dwitte@stanford.edu 2008-01-10 12:56:49 -08:00
parent 64d25e1d1e
commit 7e454eebf6
16 changed files with 228 additions and 251 deletions

@ -1117,7 +1117,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// assumeDifferenceHint forces the parent's change to be also // assumeDifferenceHint forces the parent's change to be also
// applied to this frame, no matter what // applied to this frame, no matter what
// nsStyleStruct::CalcStyleDifference says. CalcStyleDifference // nsStyleContext::CalcStyleDifference says. CalcStyleDifference
// can't be trusted because it assumes any changes to the parent // can't be trusted because it assumes any changes to the parent
// style context provider will be automatically propagated to // style context provider will be automatically propagated to
// the frame(s) with child style contexts. // the frame(s) with child style contexts.

@ -85,7 +85,6 @@ class nsIURI;
class nsILookAndFeel; class nsILookAndFeel;
class nsICSSPseudoComparator; class nsICSSPseudoComparator;
class nsIAtom; class nsIAtom;
struct nsStyleStruct;
struct nsStyleBackground; struct nsStyleBackground;
template <class T> class nsRunnableMethod; template <class T> class nsRunnableMethod;
class nsIRunnable; class nsIRunnable;

@ -36,7 +36,7 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* constants used in the nsStyleStruct data provided by nsStyleContext */ /* constants used in the style struct data provided by nsStyleContext */
#ifndef nsStyleConsts_h___ #ifndef nsStyleConsts_h___
#define nsStyleConsts_h___ #define nsStyleConsts_h___

@ -288,7 +288,7 @@ however there is also a class nsStyleUIReset that holds the non-inherited
values, so we will use that one (remember, our property is not inherited). values, so we will use that one (remember, our property is not inherited).
Add a <a href="#StyleContextMember">data member</a> Add a <a href="#StyleContextMember">data member</a>
to hold the value: to hold the value:
<pre>struct nsStyleUIReset: public nsStyleStruct { <pre>struct nsStyleUIReset {
nsStyleUIReset(void); nsStyleUIReset(void);
nsStyleUIReset(const nsStyleUIReset&amp; aOther); nsStyleUIReset(const nsStyleUIReset&amp; aOther);
~nsStyleUIReset(void); ~nsStyleUIReset(void);
@ -471,9 +471,7 @@ style context. Access the new property and get its value. It is that simple.
For this example, it looks like this, in nsImageFrame:<br> For this example, it looks like this, in nsImageFrame:<br>
<pre> PRBool forceIcon = PR_FALSE; <pre> PRBool forceIcon = PR_FALSE;
const nsStyleUIReset* styleData; if (GetStyleUIReset()-&gt;mForceBrokenImageIcon) {
GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&amp;) styleData);
if (styleData-&gt;mForceBrokenImageIcon) {
forceIcon = PR_TRUE; forceIcon = PR_TRUE;
} }

@ -5635,7 +5635,7 @@ nsIFrame::UnsetProperty(nsIAtom* aPropName, nsresult* aStatus) const
aStatus); aStatus);
} }
/* virtual */ const nsStyleStruct* /* virtual */ const void*
nsFrame::GetStyleDataExternal(nsStyleStructID aSID) const nsFrame::GetStyleDataExternal(nsStyleStructID aSID) const
{ {
NS_ASSERTION(mStyleContext, "unexpected null pointer"); NS_ASSERTION(mStyleContext, "unexpected null pointer");

@ -411,7 +411,7 @@ public:
NS_IMETHOD CaptureMouse(nsPresContext* aPresContext, PRBool aGrabMouseEvents); NS_IMETHOD CaptureMouse(nsPresContext* aPresContext, PRBool aGrabMouseEvents);
PRBool IsMouseCaptured(nsPresContext* aPresContext); PRBool IsMouseCaptured(nsPresContext* aPresContext);
virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const; virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const;
#ifdef NS_DEBUG #ifdef NS_DEBUG

@ -641,16 +641,7 @@ public:
* The use of the typesafe functions below is preferred to direct use * The use of the typesafe functions below is preferred to direct use
* of this function. * of this function.
*/ */
virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const = 0; virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
const nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
#ifdef _IMPL_NS_LAYOUT
NS_ASSERTION(mStyleContext, "No style context found!");
return mStyleContext->GetStyleData(aSID);
#else
return GetStyleDataExternal(aSID);
#endif
}
/** /**
* Define typesafe getter functions for each style struct by * Define typesafe getter functions for each style struct by

@ -109,7 +109,7 @@ nsHTMLStyleSheet::GenericTableRule::List(FILE* out, PRInt32 aIndent) const
} }
#endif #endif
static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData) static void PostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{ {
nsStyleText* text = (nsStyleText*)aStyleStruct; nsStyleText* text = (nsStyleText*)aStyleStruct;
if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT) { if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT) {
@ -135,13 +135,13 @@ nsHTMLStyleSheet::TableTHRule::MapRuleInfoInto(nsRuleData* aRuleData)
} }
static void static void
ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct, ProcessTableRulesAttribute(void* aStyleStruct,
nsRuleData* aRuleData, nsRuleData* aRuleData,
PRUint8 aSide, PRUint8 aSide,
PRBool aGroup, PRBool aGroup,
PRUint8 aRulesArg1, PRUint8 aRulesArg1,
PRUint8 aRulesArg2, PRUint8 aRulesArg2,
PRUint8 aRulesArg3) PRUint8 aRulesArg3)
{ {
if (!aStyleStruct || !aRuleData || !aRuleData->mPresContext) return; if (!aStyleStruct || !aRuleData || !aRuleData->mPresContext) return;
@ -202,7 +202,7 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
} }
} }
static void TbodyPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData) static void TbodyPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{ {
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_TRUE, NS_STYLE_TABLE_RULES_ALL, ::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_ROWS); NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_ROWS);
@ -221,7 +221,7 @@ nsHTMLStyleSheet::TableTbodyRule::MapRuleInfoInto(nsRuleData* aRuleData)
} }
// ----------------------------------------------------------- // -----------------------------------------------------------
static void RowPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData) static void RowPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{ {
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_FALSE, NS_STYLE_TABLE_RULES_ALL, ::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_ROWS, NS_STYLE_TABLE_RULES_ROWS); NS_STYLE_TABLE_RULES_ROWS, NS_STYLE_TABLE_RULES_ROWS);
@ -239,7 +239,7 @@ nsHTMLStyleSheet::TableRowRule::MapRuleInfoInto(nsRuleData* aRuleData)
return NS_OK; return NS_OK;
} }
static void ColgroupPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData) static void ColgroupPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{ {
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL, ::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_COLS); NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_COLS);
@ -257,7 +257,7 @@ nsHTMLStyleSheet::TableColgroupRule::MapRuleInfoInto(nsRuleData* aRuleData)
return NS_OK; return NS_OK;
} }
static void ColPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData) static void ColPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{ {
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_FALSE, NS_STYLE_TABLE_RULES_ALL, ::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS); NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS);
@ -265,7 +265,7 @@ static void ColPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRul
NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS); NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS);
} }
static void UngroupedColPostResolveCallback(nsStyleStruct* aStyleStruct, static void UngroupedColPostResolveCallback(void* aStyleStruct,
nsRuleData* aRuleData) nsRuleData* aRuleData)
{ {
// Pass PR_TRUE for aGroup, so that we find the table's style // Pass PR_TRUE for aGroup, so that we find the table's style

@ -50,7 +50,7 @@ class nsPresContext;
class nsStyleContext; class nsStyleContext;
struct nsRuleData; struct nsRuleData;
typedef void (*nsPostResolveFunc)(nsStyleStruct* aStyleStruct, nsRuleData* aData); typedef void (*nsPostResolveFunc)(void* aStyleStruct, nsRuleData* aData);
struct nsRuleData struct nsRuleData
{ {

@ -1116,7 +1116,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
return result; return result;
} }
const nsStyleStruct* const void*
nsRuleNode::GetDisplayData(nsStyleContext* aContext) nsRuleNode::GetDisplayData(nsStyleContext* aContext)
{ {
nsRuleDataDisplay displayData; // Declare a struct with null CSS values. nsRuleDataDisplay displayData; // Declare a struct with null CSS values.
@ -1126,7 +1126,7 @@ nsRuleNode::GetDisplayData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData); return WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetVisibilityData(nsStyleContext* aContext) nsRuleNode::GetVisibilityData(nsStyleContext* aContext)
{ {
nsRuleDataDisplay displayData; // Declare a struct with null CSS values. nsRuleDataDisplay displayData; // Declare a struct with null CSS values.
@ -1136,7 +1136,7 @@ nsRuleNode::GetVisibilityData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Visibility, aContext, &ruleData, &displayData); return WalkRuleTree(eStyleStruct_Visibility, aContext, &ruleData, &displayData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetTextData(nsStyleContext* aContext) nsRuleNode::GetTextData(nsStyleContext* aContext)
{ {
nsRuleDataText textData; // Declare a struct with null CSS values. nsRuleDataText textData; // Declare a struct with null CSS values.
@ -1146,42 +1146,42 @@ nsRuleNode::GetTextData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Text, aContext, &ruleData, &textData); return WalkRuleTree(eStyleStruct_Text, aContext, &ruleData, &textData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetTextResetData(nsStyleContext* aContext) nsRuleNode::GetTextResetData(nsStyleContext* aContext)
{ {
nsRuleDataText textData; // Declare a struct with null CSS values. nsRuleDataText textData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(TextReset), mPresContext, aContext); nsRuleData ruleData(NS_STYLE_INHERIT_BIT(TextReset), mPresContext, aContext);
ruleData.mTextData = &textData; ruleData.mTextData = &textData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_TextReset, aContext, &ruleData, &textData); const void* res = WalkRuleTree(eStyleStruct_TextReset, aContext, &ruleData, &textData);
textData.mTextShadow = nsnull; // We are sharing with some style rule. It really owns the data. textData.mTextShadow = nsnull; // We are sharing with some style rule. It really owns the data.
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::GetUserInterfaceData(nsStyleContext* aContext) nsRuleNode::GetUserInterfaceData(nsStyleContext* aContext)
{ {
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values. nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(UserInterface), mPresContext, aContext); nsRuleData ruleData(NS_STYLE_INHERIT_BIT(UserInterface), mPresContext, aContext);
ruleData.mUserInterfaceData = &uiData; ruleData.mUserInterfaceData = &uiData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UserInterface, aContext, &ruleData, &uiData); const void* res = WalkRuleTree(eStyleStruct_UserInterface, aContext, &ruleData, &uiData);
uiData.mCursor = nsnull; // We are sharing with some style rule. It really owns the data. uiData.mCursor = nsnull; // We are sharing with some style rule. It really owns the data.
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::GetUIResetData(nsStyleContext* aContext) nsRuleNode::GetUIResetData(nsStyleContext* aContext)
{ {
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values. nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(UIReset), mPresContext, aContext); nsRuleData ruleData(NS_STYLE_INHERIT_BIT(UIReset), mPresContext, aContext);
ruleData.mUserInterfaceData = &uiData; ruleData.mUserInterfaceData = &uiData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UIReset, aContext, &ruleData, &uiData); const void* res = WalkRuleTree(eStyleStruct_UIReset, aContext, &ruleData, &uiData);
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::GetFontData(nsStyleContext* aContext) nsRuleNode::GetFontData(nsStyleContext* aContext)
{ {
nsRuleDataFont fontData; // Declare a struct with null CSS values. nsRuleDataFont fontData; // Declare a struct with null CSS values.
@ -1191,7 +1191,7 @@ nsRuleNode::GetFontData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Font, aContext, &ruleData, &fontData); return WalkRuleTree(eStyleStruct_Font, aContext, &ruleData, &fontData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetColorData(nsStyleContext* aContext) nsRuleNode::GetColorData(nsStyleContext* aContext)
{ {
nsRuleDataColor colorData; // Declare a struct with null CSS values. nsRuleDataColor colorData; // Declare a struct with null CSS values.
@ -1201,7 +1201,7 @@ nsRuleNode::GetColorData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Color, aContext, &ruleData, &colorData); return WalkRuleTree(eStyleStruct_Color, aContext, &ruleData, &colorData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetBackgroundData(nsStyleContext* aContext) nsRuleNode::GetBackgroundData(nsStyleContext* aContext)
{ {
nsRuleDataColor colorData; // Declare a struct with null CSS values. nsRuleDataColor colorData; // Declare a struct with null CSS values.
@ -1211,7 +1211,7 @@ nsRuleNode::GetBackgroundData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Background, aContext, &ruleData, &colorData); return WalkRuleTree(eStyleStruct_Background, aContext, &ruleData, &colorData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetMarginData(nsStyleContext* aContext) nsRuleNode::GetMarginData(nsStyleContext* aContext)
{ {
nsRuleDataMargin marginData; // Declare a struct with null CSS values. nsRuleDataMargin marginData; // Declare a struct with null CSS values.
@ -1221,7 +1221,7 @@ nsRuleNode::GetMarginData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData); return WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetBorderData(nsStyleContext* aContext) nsRuleNode::GetBorderData(nsStyleContext* aContext)
{ {
nsRuleDataMargin marginData; // Declare a struct with null CSS values. nsRuleDataMargin marginData; // Declare a struct with null CSS values.
@ -1231,7 +1231,7 @@ nsRuleNode::GetBorderData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData); return WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetPaddingData(nsStyleContext* aContext) nsRuleNode::GetPaddingData(nsStyleContext* aContext)
{ {
nsRuleDataMargin marginData; // Declare a struct with null CSS values. nsRuleDataMargin marginData; // Declare a struct with null CSS values.
@ -1241,7 +1241,7 @@ nsRuleNode::GetPaddingData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData); return WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetOutlineData(nsStyleContext* aContext) nsRuleNode::GetOutlineData(nsStyleContext* aContext)
{ {
nsRuleDataMargin marginData; // Declare a struct with null CSS values. nsRuleDataMargin marginData; // Declare a struct with null CSS values.
@ -1251,7 +1251,7 @@ nsRuleNode::GetOutlineData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData); return WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetListData(nsStyleContext* aContext) nsRuleNode::GetListData(nsStyleContext* aContext)
{ {
nsRuleDataList listData; // Declare a struct with null CSS values. nsRuleDataList listData; // Declare a struct with null CSS values.
@ -1261,7 +1261,7 @@ nsRuleNode::GetListData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData); return WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetPositionData(nsStyleContext* aContext) nsRuleNode::GetPositionData(nsStyleContext* aContext)
{ {
nsRuleDataPosition posData; // Declare a struct with null CSS values. nsRuleDataPosition posData; // Declare a struct with null CSS values.
@ -1271,7 +1271,7 @@ nsRuleNode::GetPositionData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData); return WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetTableData(nsStyleContext* aContext) nsRuleNode::GetTableData(nsStyleContext* aContext)
{ {
nsRuleDataTable tableData; // Declare a struct with null CSS values. nsRuleDataTable tableData; // Declare a struct with null CSS values.
@ -1281,7 +1281,7 @@ nsRuleNode::GetTableData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_Table, aContext, &ruleData, &tableData); return WalkRuleTree(eStyleStruct_Table, aContext, &ruleData, &tableData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetTableBorderData(nsStyleContext* aContext) nsRuleNode::GetTableBorderData(nsStyleContext* aContext)
{ {
nsRuleDataTable tableData; // Declare a struct with null CSS values. nsRuleDataTable tableData; // Declare a struct with null CSS values.
@ -1291,32 +1291,32 @@ nsRuleNode::GetTableBorderData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_TableBorder, aContext, &ruleData, &tableData); return WalkRuleTree(eStyleStruct_TableBorder, aContext, &ruleData, &tableData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetContentData(nsStyleContext* aContext) nsRuleNode::GetContentData(nsStyleContext* aContext)
{ {
nsRuleDataContent contentData; // Declare a struct with null CSS values. nsRuleDataContent contentData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Content), mPresContext, aContext); nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Content), mPresContext, aContext);
ruleData.mContentData = &contentData; ruleData.mContentData = &contentData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Content, aContext, &ruleData, &contentData); const void* res = WalkRuleTree(eStyleStruct_Content, aContext, &ruleData, &contentData);
contentData.mCounterIncrement = contentData.mCounterReset = nsnull; contentData.mCounterIncrement = contentData.mCounterReset = nsnull;
contentData.mContent = nsnull; // We are sharing with some style rule. It really owns the data. contentData.mContent = nsnull; // We are sharing with some style rule. It really owns the data.
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::GetQuotesData(nsStyleContext* aContext) nsRuleNode::GetQuotesData(nsStyleContext* aContext)
{ {
nsRuleDataContent contentData; // Declare a struct with null CSS values. nsRuleDataContent contentData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Quotes), mPresContext, aContext); nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Quotes), mPresContext, aContext);
ruleData.mContentData = &contentData; ruleData.mContentData = &contentData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Quotes, aContext, &ruleData, &contentData); const void* res = WalkRuleTree(eStyleStruct_Quotes, aContext, &ruleData, &contentData);
contentData.mQuotes = nsnull; // We are sharing with some style rule. It really owns the data. contentData.mQuotes = nsnull; // We are sharing with some style rule. It really owns the data.
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::GetXULData(nsStyleContext* aContext) nsRuleNode::GetXULData(nsStyleContext* aContext)
{ {
nsRuleDataXUL xulData; // Declare a struct with null CSS values. nsRuleDataXUL xulData; // Declare a struct with null CSS values.
@ -1326,7 +1326,7 @@ nsRuleNode::GetXULData(nsStyleContext* aContext)
return WalkRuleTree(eStyleStruct_XUL, aContext, &ruleData, &xulData); return WalkRuleTree(eStyleStruct_XUL, aContext, &ruleData, &xulData);
} }
const nsStyleStruct* const void*
nsRuleNode::GetColumnData(nsStyleContext* aContext) nsRuleNode::GetColumnData(nsStyleContext* aContext)
{ {
nsRuleDataColumn columnData; // Declare a struct with null CSS values. nsRuleDataColumn columnData; // Declare a struct with null CSS values.
@ -1337,19 +1337,19 @@ nsRuleNode::GetColumnData(nsStyleContext* aContext)
} }
#ifdef MOZ_SVG #ifdef MOZ_SVG
const nsStyleStruct* const void*
nsRuleNode::GetSVGData(nsStyleContext* aContext) nsRuleNode::GetSVGData(nsStyleContext* aContext)
{ {
nsRuleDataSVG svgData; // Declare a struct with null CSS values. nsRuleDataSVG svgData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(SVG), mPresContext, aContext); nsRuleData ruleData(NS_STYLE_INHERIT_BIT(SVG), mPresContext, aContext);
ruleData.mSVGData = &svgData; ruleData.mSVGData = &svgData;
const nsStyleStruct *res = WalkRuleTree(eStyleStruct_SVG, aContext, &ruleData, &svgData); const void *res = WalkRuleTree(eStyleStruct_SVG, aContext, &ruleData, &svgData);
svgData.mStrokeDasharray = nsnull; // We are sharing with some style rule. It really owns the data. svgData.mStrokeDasharray = nsnull; // We are sharing with some style rule. It really owns the data.
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::GetSVGResetData(nsStyleContext* aContext) nsRuleNode::GetSVGResetData(nsStyleContext* aContext)
{ {
nsRuleDataSVG svgData; // Declare a struct with null CSS values. nsRuleDataSVG svgData; // Declare a struct with null CSS values.
@ -1360,14 +1360,14 @@ nsRuleNode::GetSVGResetData(nsStyleContext* aContext)
} }
#endif #endif
const nsStyleStruct* const void*
nsRuleNode::WalkRuleTree(const nsStyleStructID aSID, nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleData* aRuleData, nsRuleData* aRuleData,
nsRuleDataStruct* aSpecificData) nsRuleDataStruct* aSpecificData)
{ {
// We start at the most specific rule in the tree. // We start at the most specific rule in the tree.
nsStyleStruct* startStruct = nsnull; void* startStruct = nsnull;
nsRuleNode* ruleNode = this; nsRuleNode* ruleNode = this;
nsRuleNode* highestNode = nsnull; // The highest node in the rule tree nsRuleNode* highestNode = nsnull; // The highest node in the rule tree
@ -1485,9 +1485,9 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// Set the inherit bits on our context. These bits tell the style context that // Set the inherit bits on our context. These bits tell the style context that
// it never has to go back to the rule tree for data. Instead the style context tree // it never has to go back to the rule tree for data. Instead the style context tree
// should be walked to find the data. // should be walked to find the data.
const nsStyleStruct* parentStruct = parentContext->GetStyleData(aSID); const void* parentStruct = parentContext->GetStyleData(aSID);
aContext->AddStyleBit(bit); // makes const_cast OK. aContext->AddStyleBit(bit); // makes const_cast OK.
aContext->SetStyle(aSID, const_cast<nsStyleStruct*>(parentStruct)); aContext->SetStyle(aSID, const_cast<void*>(parentStruct));
return parentStruct; return parentStruct;
} }
else else
@ -1497,7 +1497,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
} }
// We need to compute the data from the information that the rules specified. // We need to compute the data from the information that the rules specified.
const nsStyleStruct* res; const void* res;
#define STYLE_STRUCT_TEST aSID #define STYLE_STRUCT_TEST aSID
#define STYLE_STRUCT(name, checkdata_cb, ctor_args) \ #define STYLE_STRUCT(name, checkdata_cb, ctor_args) \
res = Compute##name##Data(startStruct, *aSpecificData, aContext, \ res = Compute##name##Data(startStruct, *aSpecificData, aContext, \
@ -1508,13 +1508,13 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// If we have a post-resolve callback, handle that now. // If we have a post-resolve callback, handle that now.
if (aRuleData->mPostResolveCallback && (NS_LIKELY(res != nsnull))) if (aRuleData->mPostResolveCallback && (NS_LIKELY(res != nsnull)))
(*aRuleData->mPostResolveCallback)((nsStyleStruct*)res, aRuleData); (*aRuleData->mPostResolveCallback)(const_cast<void*>(res), aRuleData);
// Now return the result. // Now return the result.
return res; return res;
} }
const nsStyleStruct* const void*
nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContext) nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContext)
{ {
switch (aSID) { switch (aSID) {
@ -2492,7 +2492,7 @@ nsRuleNode::SetGenericFont(nsPresContext* aPresContext,
// XXX Not sure if we need to do this here // XXX Not sure if we need to do this here
// If we have a post-resolve callback, handle that now. // If we have a post-resolve callback, handle that now.
if (ruleData.mPostResolveCallback) if (ruleData.mPostResolveCallback)
(ruleData.mPostResolveCallback)((nsStyleStruct*)aFont, &ruleData); (ruleData.mPostResolveCallback)(aFont, &ruleData);
parentFont = *aFont; parentFont = *aFont;
} }
@ -2510,8 +2510,8 @@ static PRBool ExtractGeneric(const nsString& aFamily, PRBool aGeneric,
return PR_TRUE; return PR_TRUE;
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeFontData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -2603,8 +2603,8 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(Font, font) COMPUTE_END_INHERITED(Font, font)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeTextData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -2710,8 +2710,8 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(Text, text) COMPUTE_END_INHERITED(Text, text)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeTextResetData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -2769,8 +2769,8 @@ nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(TextReset, text) COMPUTE_END_RESET(TextReset, text)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -2888,8 +2888,8 @@ nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(UserInterface, ui) COMPUTE_END_INHERITED(UserInterface, ui)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeUIResetData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -2941,8 +2941,8 @@ nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(UIReset, ui) COMPUTE_END_RESET(UIReset, ui)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeDisplayData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3303,8 +3303,8 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Display, display) COMPUTE_END_RESET(Display, display)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeVisibilityData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3361,8 +3361,8 @@ nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(Visibility, visibility) COMPUTE_END_INHERITED(Visibility, visibility)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeColorData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3390,8 +3390,8 @@ nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(Color, color) COMPUTE_END_INHERITED(Color, color)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeBackgroundData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3577,8 +3577,8 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Background, bg) COMPUTE_END_RESET(Background, bg)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeMarginData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3613,8 +3613,8 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Margin, margin) COMPUTE_END_RESET(Margin, margin)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeBorderData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3818,8 +3818,8 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Border, border) COMPUTE_END_RESET(Border, border)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct, nsRuleNode::ComputePaddingData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3854,8 +3854,8 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Padding, padding) COMPUTE_END_RESET(Padding, padding)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeOutlineData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -3942,8 +3942,8 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Outline, outline) COMPUTE_END_RESET(Outline, outline)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeListData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4027,8 +4027,8 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(List, list) COMPUTE_END_INHERITED(List, list)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct, nsRuleNode::ComputePositionData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4094,8 +4094,8 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Position, pos) COMPUTE_END_RESET(Position, pos)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeTableData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4135,8 +4135,8 @@ nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Table, table) COMPUTE_END_RESET(Table, table)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeTableBorderData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4197,8 +4197,8 @@ nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(TableBorder, table) COMPUTE_END_INHERITED(TableBorder, table)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeContentData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4384,8 +4384,8 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(Content, content) COMPUTE_END_RESET(Content, content)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeQuotesData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4401,7 +4401,7 @@ nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct,
if (ourQuotes) { if (ourQuotes) {
nsAutoString closeBuffer; nsAutoString closeBuffer;
// FIXME Bug 389406: Implement eCSSUnit_Initial (correctly, unlike // FIXME Bug 389406: Implement eCSSUnit_Initial (correctly, unlike
// nsStyleStruct), and remove the "initial" value from ua.css. // style structs), and remove the "initial" value from ua.css.
if (eCSSUnit_Inherit == ourQuotes->mOpen.GetUnit()) { if (eCSSUnit_Inherit == ourQuotes->mOpen.GetUnit()) {
inherited = PR_TRUE; inherited = PR_TRUE;
count = parentQuotes->QuotesCount(); count = parentQuotes->QuotesCount();
@ -4439,8 +4439,8 @@ nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(Quotes, quotes) COMPUTE_END_INHERITED(Quotes, quotes)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeXULData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4521,8 +4521,8 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct,
COMPUTE_END_RESET(XUL, xul) COMPUTE_END_RESET(XUL, xul)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeColumnData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeColumnData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4609,8 +4609,8 @@ SetSVGOpacity(const nsCSSValue& aValue, float parentOpacity, float& opacity, PRB
} }
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeSVGData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4879,8 +4879,8 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
COMPUTE_END_INHERITED(SVG, svg) COMPUTE_END_INHERITED(SVG, svg)
} }
const nsStyleStruct* const void*
nsRuleNode::ComputeSVGResetData(nsStyleStruct* aStartStruct, nsRuleNode::ComputeSVGResetData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
@ -4970,7 +4970,7 @@ nsRuleNode::ComputeSVGResetData(nsStyleStruct* aStartStruct,
} }
#endif #endif
inline const nsStyleStruct* inline const void*
nsRuleNode::GetParentData(const nsStyleStructID aSID) nsRuleNode::GetParentData(const nsStyleStructID aSID)
{ {
NS_PRECONDITION(mDependentBits & nsCachedStyleData::GetBitForSID(aSID), NS_PRECONDITION(mDependentBits & nsCachedStyleData::GetBitForSID(aSID),
@ -5014,12 +5014,12 @@ nsRuleNode::GetParent##name_() \
#include "nsStyleStructList.h" #include "nsStyleStructList.h"
#undef STYLE_STRUCT #undef STYLE_STRUCT
const nsStyleStruct* const void*
nsRuleNode::GetStyleData(nsStyleStructID aSID, nsRuleNode::GetStyleData(nsStyleStructID aSID,
nsStyleContext* aContext, nsStyleContext* aContext,
PRBool aComputeData) PRBool aComputeData)
{ {
const nsStyleStruct *data; const void *data;
if (mDependentBits & nsCachedStyleData::GetBitForSID(aSID)) { if (mDependentBits & nsCachedStyleData::GetBitForSID(aSID)) {
// We depend on an ancestor for this struct since the cached struct // We depend on an ancestor for this struct since the cached struct
// it has is also appropriate for this rule node. Just go up the // it has is also appropriate for this rule node. Just go up the

@ -193,7 +193,7 @@ struct nsCachedStyleData
return 1 << aSID; return 1 << aSID;
} }
NS_HIDDEN_(nsStyleStruct*) NS_FASTCALL GetStyleData(const nsStyleStructID& aSID) { NS_HIDDEN_(void*) NS_FASTCALL GetStyleData(const nsStyleStructID& aSID) {
// Each struct is stored at this.m##type##Data->m##name##Data where // Each struct is stored at this.m##type##Data->m##name##Data where
// |type| is either Inherit or Reset, and |name| is the name of the // |type| is either Inherit or Reset, and |name| is the name of the
// style struct. The |gInfo| stores the offset of the appropriate // style struct. The |gInfo| stores the offset of the appropriate
@ -214,12 +214,12 @@ struct nsCachedStyleData
// Get either mInheritedData or mResetData. // Get either mInheritedData or mResetData.
char* resetOrInherit = reinterpret_cast<char*>(*reinterpret_cast<void**>(resetOrInheritSlot)); char* resetOrInherit = reinterpret_cast<char*>(*reinterpret_cast<void**>(resetOrInheritSlot));
nsStyleStruct* data = nsnull; void* data = nsnull;
if (resetOrInherit) { if (resetOrInherit) {
// If we have the mInheritedData or mResetData, then we might have // If we have the mInheritedData or mResetData, then we might have
// the struct, so get it. // the struct, so get it.
char* dataSlot = resetOrInherit + info.mInheritResetOffset; char* dataSlot = resetOrInherit + info.mInheritResetOffset;
data = *reinterpret_cast<nsStyleStruct**>(dataSlot); data = *reinterpret_cast<void**>(dataSlot);
} }
return data; return data;
} }
@ -451,149 +451,149 @@ protected:
nsRuleNode* aHighestNode); nsRuleNode* aHighestNode);
NS_HIDDEN_(void) PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode); NS_HIDDEN_(void) PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
NS_HIDDEN_(const nsStyleStruct*) SetDefaultOnRoot(const nsStyleStructID aSID, NS_HIDDEN_(const void*) SetDefaultOnRoot(const nsStyleStructID aSID,
nsStyleContext* aContext); nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext, WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext,
nsRuleData* aRuleData, nsRuleDataStruct* aSpecificData); nsRuleData* aRuleData, nsRuleDataStruct* aSpecificData);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeDisplayData(nsStyleStruct* aStartStruct, ComputeDisplayData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeVisibilityData(nsStyleStruct* aStartStruct, ComputeVisibilityData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeFontData(nsStyleStruct* aStartStruct, ComputeFontData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeColorData(nsStyleStruct* aStartStruct, ComputeColorData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeBackgroundData(nsStyleStruct* aStartStruct, ComputeBackgroundData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeMarginData(nsStyleStruct* aStartStruct, ComputeMarginData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeBorderData(nsStyleStruct* aStartStruct, ComputeBorderData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputePaddingData(nsStyleStruct* aStartStruct, ComputePaddingData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeOutlineData(nsStyleStruct* aStartStruct, ComputeOutlineData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeListData(nsStyleStruct* aStartStruct, ComputeListData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputePositionData(nsStyleStruct* aStartStruct, ComputePositionData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeTableData(nsStyleStruct* aStartStruct, ComputeTableData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeTableBorderData(nsStyleStruct* aStartStruct, ComputeTableBorderData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeContentData(nsStyleStruct* aStartStruct, ComputeContentData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeQuotesData(nsStyleStruct* aStartStruct, ComputeQuotesData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeTextData(nsStyleStruct* aStartStruct, ComputeTextData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeTextResetData(nsStyleStruct* aStartStruct, ComputeTextResetData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeUserInterfaceData(nsStyleStruct* aStartStruct, ComputeUserInterfaceData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsStyleContext* aContext,
nsRuleNode* aHighestNode, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeUIResetData(nsStyleStruct* aStartStruct, ComputeUIResetData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeXULData(nsStyleStruct* aStartStruct, ComputeXULData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeColumnData(nsStyleStruct* aStartStruct, ComputeColumnData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
#ifdef MOZ_SVG #ifdef MOZ_SVG
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeSVGData(nsStyleStruct* aStartStruct, ComputeSVGData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*)
ComputeSVGResetData(nsStyleStruct* aStartStruct, ComputeSVGResetData(void* aStartStruct,
const nsRuleDataStruct& aData, const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode, nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited); RuleDetail aRuleDetail, PRBool aInherited);
@ -637,40 +637,38 @@ protected:
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct); inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
NS_HIDDEN_(const nsStyleStruct*) GetParentData(const nsStyleStructID aSID); NS_HIDDEN_(const void*) GetParentData(const nsStyleStructID aSID);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \ #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_*) GetParent##name_(); NS_HIDDEN_(const nsStyle##name_*) GetParent##name_();
#include "nsStyleStructList.h" #include "nsStyleStructList.h"
#undef STYLE_STRUCT #undef STYLE_STRUCT
NS_HIDDEN_(const nsStyleStruct*) GetDisplayData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetDisplayData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetVisibilityData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetVisibilityData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetFontData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetFontData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetColorData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetColorData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetBackgroundData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetBackgroundData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetMarginData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetMarginData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetBorderData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetBorderData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetPaddingData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetPaddingData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetOutlineData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetOutlineData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetListData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetListData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetPositionData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetPositionData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetTableData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetTableData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*) GetTableBorderData(nsStyleContext* aContext);
GetTableBorderData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetContentData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetContentData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetQuotesData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetQuotesData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetTextData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetTextData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetTextResetData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetTextResetData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) NS_HIDDEN_(const void*) GetUserInterfaceData(nsStyleContext* aContext);
GetUserInterfaceData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetUIResetData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetUIResetData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetXULData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetXULData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetColumnData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetColumnData(nsStyleContext* aContext);
#ifdef MOZ_SVG #ifdef MOZ_SVG
NS_HIDDEN_(const nsStyleStruct*) GetSVGData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetSVGData(nsStyleContext* aContext);
NS_HIDDEN_(const nsStyleStruct*) GetSVGResetData(nsStyleContext* aContext); NS_HIDDEN_(const void*) GetSVGResetData(nsStyleContext* aContext);
#endif #endif
private: private:
@ -703,9 +701,9 @@ public:
// NOTE: Does not |AddRef|. // NOTE: Does not |AddRef|.
nsPresContext* GetPresContext() const { return mPresContext; } nsPresContext* GetPresContext() const { return mPresContext; }
NS_HIDDEN_(const nsStyleStruct*) GetStyleData(nsStyleStructID aSID, NS_HIDDEN_(const void*) GetStyleData(nsStyleStructID aSID,
nsStyleContext* aContext, nsStyleContext* aContext,
PRBool aComputeData); PRBool aComputeData);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \ #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_*) \ NS_HIDDEN_(const nsStyle##name_*) \

@ -214,9 +214,9 @@ PRBool nsStyleContext::Equals(const nsStyleContext* aOther) const
//========================================================================================================= //=========================================================================================================
const nsStyleStruct* nsStyleContext::GetStyleData(nsStyleStructID aSID) const void* nsStyleContext::GetStyleData(nsStyleStructID aSID)
{ {
const nsStyleStruct* cachedData = mCachedStyleData.GetStyleData(aSID); const void* cachedData = mCachedStyleData.GetStyleData(aSID);
if (cachedData) if (cachedData)
return cachedData; // We have computed data stored on this node in the context tree. return cachedData; // We have computed data stored on this node in the context tree.
return mRuleNode->GetStyleData(aSID, this, PR_TRUE); // Our rule node will take care of it for us. return mRuleNode->GetStyleData(aSID, this, PR_TRUE); // Our rule node will take care of it for us.
@ -235,9 +235,9 @@ const nsStyleStruct* nsStyleContext::GetStyleData(nsStyleStructID aSID)
#include "nsStyleStructList.h" #include "nsStyleStructList.h"
#undef STYLE_STRUCT #undef STYLE_STRUCT
inline const nsStyleStruct* nsStyleContext::PeekStyleData(nsStyleStructID aSID) inline const void* nsStyleContext::PeekStyleData(nsStyleStructID aSID)
{ {
const nsStyleStruct* cachedData = mCachedStyleData.GetStyleData(aSID); const void* cachedData = mCachedStyleData.GetStyleData(aSID);
if (cachedData) if (cachedData)
return cachedData; // We have computed data stored on this node in the context tree. return cachedData; // We have computed data stored on this node in the context tree.
return mRuleNode->GetStyleData(aSID, this, PR_FALSE); // Our rule node will take care of it for us. return mRuleNode->GetStyleData(aSID, this, PR_FALSE); // Our rule node will take care of it for us.
@ -246,7 +246,7 @@ inline const nsStyleStruct* nsStyleContext::PeekStyleData(nsStyleStructID aSID)
// This is an evil evil function, since it forces you to alloc your own separate copy of // This is an evil evil function, since it forces you to alloc your own separate copy of
// style data! Do not use this function unless you absolutely have to! You should avoid // style data! Do not use this function unless you absolutely have to! You should avoid
// this at all costs! -dwh // this at all costs! -dwh
nsStyleStruct* void*
nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID) nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
{ {
// If we already own the struct and no kids could depend on it, then // If we already own the struct and no kids could depend on it, then
@ -254,13 +254,13 @@ nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
// function really shouldn't be called for style contexts that could // function really shouldn't be called for style contexts that could
// have kids depending on the data. ClearStyleData would be OK, but // have kids depending on the data. ClearStyleData would be OK, but
// this test for no mChild or mEmptyChild doesn't catch that case.) // this test for no mChild or mEmptyChild doesn't catch that case.)
const nsStyleStruct *current = GetStyleData(aSID); const void *current = GetStyleData(aSID);
if (!mChild && !mEmptyChild && if (!mChild && !mEmptyChild &&
!(mBits & nsCachedStyleData::GetBitForSID(aSID)) && !(mBits & nsCachedStyleData::GetBitForSID(aSID)) &&
mCachedStyleData.GetStyleData(aSID)) mCachedStyleData.GetStyleData(aSID))
return const_cast<nsStyleStruct*>(current); return const_cast<void*>(current);
nsStyleStruct* result; void* result;
nsPresContext *presContext = PresContext(); nsPresContext *presContext = PresContext();
switch (aSID) { switch (aSID) {
@ -283,9 +283,9 @@ nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
} }
if (!result) { if (!result) {
NS_WARNING("Ran out of memory while trying to allocate memory for a unique nsStyleStruct! " NS_WARNING("Ran out of memory while trying to allocate memory for a unique style struct! "
"Returning the non-unique data."); "Returning the non-unique data.");
return const_cast<nsStyleStruct*>(current); return const_cast<void*>(current);
} }
SetStyle(aSID, result); SetStyle(aSID, result);
@ -295,7 +295,7 @@ nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
} }
void void
nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct) nsStyleContext::SetStyle(nsStyleStructID aSID, void* aStruct)
{ {
// This method should only be called from nsRuleNode! It is not a public // This method should only be called from nsRuleNode! It is not a public
// method! // method!
@ -325,7 +325,7 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct)
} }
} }
char* dataSlot = resetOrInherit + info.mInheritResetOffset; char* dataSlot = resetOrInherit + info.mInheritResetOffset;
*reinterpret_cast<nsStyleStruct**>(dataSlot) = aStruct; *reinterpret_cast<void**>(dataSlot) = aStruct;
} }
void void

@ -109,7 +109,7 @@ public:
NS_HIDDEN_(PRBool) Equals(const nsStyleContext* aOther) const; NS_HIDDEN_(PRBool) Equals(const nsStyleContext* aOther) const;
PRBool HasTextDecorations() { return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); } PRBool HasTextDecorations() { return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); }
NS_HIDDEN_(void) SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct); NS_HIDDEN_(void) SetStyle(nsStyleStructID aSID, void* aStruct);
nsRuleNode* GetRuleNode() { return mRuleNode; } nsRuleNode* GetRuleNode() { return mRuleNode; }
void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; } void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; }
@ -134,11 +134,8 @@ public:
* *
* The typesafe functions below are preferred to the use of this * The typesafe functions below are preferred to the use of this
* function. * function.
*
* See also |nsIFrame::GetStyleData| and the other global
* |GetStyleData| in nsIFrame.h.
*/ */
NS_HIDDEN_(const nsStyleStruct*) NS_FASTCALL GetStyleData(nsStyleStructID aSID); NS_HIDDEN_(const void*) NS_FASTCALL GetStyleData(nsStyleStructID aSID);
/** /**
* Define typesafe getter functions for each style struct by * Define typesafe getter functions for each style struct by
@ -154,9 +151,9 @@ public:
#undef STYLE_STRUCT #undef STYLE_STRUCT
NS_HIDDEN_(const nsStyleStruct*) PeekStyleData(nsStyleStructID aSID); NS_HIDDEN_(const void*) PeekStyleData(nsStyleStructID aSID);
NS_HIDDEN_(nsStyleStruct*) GetUniqueStyleData(const nsStyleStructID& aSID); NS_HIDDEN_(void*) GetUniqueStyleData(const nsStyleStructID& aSID);
NS_HIDDEN_(nsChangeHint) CalcStyleDifference(nsStyleContext* aOther); NS_HIDDEN_(nsChangeHint) CalcStyleDifference(nsStyleContext* aOther);

@ -82,13 +82,9 @@ class imgIRequest;
#define NS_RULE_NODE_LEVEL_MASK 0xf0000000 #define NS_RULE_NODE_LEVEL_MASK 0xf0000000
#define NS_RULE_NODE_LEVEL_SHIFT 28 #define NS_RULE_NODE_LEVEL_SHIFT 28
// The actual structs start here
struct nsStyleStruct {
};
// The lifetime of these objects is managed by the presshell's arena. // The lifetime of these objects is managed by the presshell's arena.
struct nsStyleFont : public nsStyleStruct { struct nsStyleFont {
nsStyleFont(const nsFont& aFont, nsPresContext *aPresContext); nsStyleFont(const nsFont& aFont, nsPresContext *aPresContext);
nsStyleFont(const nsStyleFont& aStyleFont); nsStyleFont(const nsStyleFont& aStyleFont);
nsStyleFont(nsPresContext *aPresContext); nsStyleFont(nsPresContext *aPresContext);
@ -123,7 +119,7 @@ struct nsStyleFont : public nsStyleStruct {
#endif #endif
}; };
struct nsStyleColor : public nsStyleStruct { struct nsStyleColor {
nsStyleColor(nsPresContext* aPresContext); nsStyleColor(nsPresContext* aPresContext);
nsStyleColor(const nsStyleColor& aOther); nsStyleColor(const nsStyleColor& aOther);
~nsStyleColor(void) {} ~nsStyleColor(void) {}
@ -146,7 +142,7 @@ struct nsStyleColor : public nsStyleStruct {
nscolor mColor; // [inherited] nscolor mColor; // [inherited]
}; };
struct nsStyleBackground : public nsStyleStruct { struct nsStyleBackground {
nsStyleBackground(nsPresContext* aPresContext); nsStyleBackground(nsPresContext* aPresContext);
nsStyleBackground(const nsStyleBackground& aOther); nsStyleBackground(const nsStyleBackground& aOther);
~nsStyleBackground(); ~nsStyleBackground();
@ -211,7 +207,7 @@ struct nsStyleBackground : public nsStyleStruct {
#define NS_SPACING_BORDER 2 #define NS_SPACING_BORDER 2
struct nsStyleMargin: public nsStyleStruct { struct nsStyleMargin {
nsStyleMargin(void); nsStyleMargin(void);
nsStyleMargin(const nsStyleMargin& aMargin); nsStyleMargin(const nsStyleMargin& aMargin);
~nsStyleMargin(void) {} ~nsStyleMargin(void) {}
@ -242,7 +238,7 @@ protected:
}; };
struct nsStylePadding: public nsStyleStruct { struct nsStylePadding {
nsStylePadding(void); nsStylePadding(void);
nsStylePadding(const nsStylePadding& aPadding); nsStylePadding(const nsStylePadding& aPadding);
~nsStylePadding(void) {} ~nsStylePadding(void) {}
@ -322,7 +318,7 @@ struct nsBorderColors {
((l) > 0) ? PR_MAX( (tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp)) : \ ((l) > 0) ? PR_MAX( (tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp)) : \
PR_MIN(-(tpp), ((l) - ((tpp) / 2)) / (tpp) * (tpp))) PR_MIN(-(tpp), ((l) - ((tpp) / 2)) / (tpp) * (tpp)))
struct nsStyleBorder: public nsStyleStruct { struct nsStyleBorder {
nsStyleBorder(nsPresContext* aContext); nsStyleBorder(nsPresContext* aContext);
nsStyleBorder(const nsStyleBorder& aBorder); nsStyleBorder(const nsStyleBorder& aBorder);
~nsStyleBorder(void) { ~nsStyleBorder(void) {
@ -503,7 +499,7 @@ protected:
}; };
struct nsStyleOutline: public nsStyleStruct { struct nsStyleOutline {
nsStyleOutline(nsPresContext* aPresContext); nsStyleOutline(nsPresContext* aPresContext);
nsStyleOutline(const nsStyleOutline& aOutline); nsStyleOutline(const nsStyleOutline& aOutline);
~nsStyleOutline(void) {} ~nsStyleOutline(void) {}
@ -604,7 +600,7 @@ protected:
}; };
struct nsStyleList : public nsStyleStruct { struct nsStyleList {
nsStyleList(void); nsStyleList(void);
nsStyleList(const nsStyleList& aStyleList); nsStyleList(const nsStyleList& aStyleList);
~nsStyleList(void); ~nsStyleList(void);
@ -628,7 +624,7 @@ struct nsStyleList : public nsStyleStruct {
nsRect mImageRegion; // [inherited] the rect to use within an image nsRect mImageRegion; // [inherited] the rect to use within an image
}; };
struct nsStylePosition : public nsStyleStruct { struct nsStylePosition {
nsStylePosition(void); nsStylePosition(void);
nsStylePosition(const nsStylePosition& aOther); nsStylePosition(const nsStylePosition& aOther);
~nsStylePosition(void); ~nsStylePosition(void);
@ -657,7 +653,7 @@ struct nsStylePosition : public nsStyleStruct {
nsStyleCoord mZIndex; // [reset] nsStyleCoord mZIndex; // [reset]
}; };
struct nsStyleTextReset : public nsStyleStruct { struct nsStyleTextReset {
nsStyleTextReset(void); nsStyleTextReset(void);
nsStyleTextReset(const nsStyleTextReset& aOther); nsStyleTextReset(const nsStyleTextReset& aOther);
~nsStyleTextReset(void); ~nsStyleTextReset(void);
@ -681,7 +677,7 @@ struct nsStyleTextReset : public nsStyleStruct {
nsStyleCoord mVerticalAlign; // [reset] see nsStyleConsts.h for enums nsStyleCoord mVerticalAlign; // [reset] see nsStyleConsts.h for enums
}; };
struct nsStyleText : public nsStyleStruct { struct nsStyleText {
nsStyleText(void); nsStyleText(void);
nsStyleText(const nsStyleText& aOther); nsStyleText(const nsStyleText& aOther);
~nsStyleText(void); ~nsStyleText(void);
@ -719,7 +715,7 @@ struct nsStyleText : public nsStyleStruct {
} }
}; };
struct nsStyleVisibility : public nsStyleStruct { struct nsStyleVisibility {
nsStyleVisibility(nsPresContext* aPresContext); nsStyleVisibility(nsPresContext* aPresContext);
nsStyleVisibility(const nsStyleVisibility& aVisibility); nsStyleVisibility(const nsStyleVisibility& aVisibility);
~nsStyleVisibility() {} ~nsStyleVisibility() {}
@ -751,7 +747,7 @@ struct nsStyleVisibility : public nsStyleStruct {
} }
}; };
struct nsStyleDisplay : public nsStyleStruct { struct nsStyleDisplay {
nsStyleDisplay(); nsStyleDisplay();
nsStyleDisplay(const nsStyleDisplay& aOther); nsStyleDisplay(const nsStyleDisplay& aOther);
~nsStyleDisplay() {} ~nsStyleDisplay() {}
@ -843,7 +839,7 @@ struct nsStyleDisplay : public nsStyleStruct {
} }
}; };
struct nsStyleTable: public nsStyleStruct { struct nsStyleTable {
nsStyleTable(void); nsStyleTable(void);
nsStyleTable(const nsStyleTable& aOther); nsStyleTable(const nsStyleTable& aOther);
~nsStyleTable(void); ~nsStyleTable(void);
@ -868,7 +864,7 @@ struct nsStyleTable: public nsStyleStruct {
PRInt32 mSpan; // [reset] the number of columns spanned by a colgroup or col PRInt32 mSpan; // [reset] the number of columns spanned by a colgroup or col
}; };
struct nsStyleTableBorder: public nsStyleStruct { struct nsStyleTableBorder {
nsStyleTableBorder(nsPresContext* aContext); nsStyleTableBorder(nsPresContext* aContext);
nsStyleTableBorder(const nsStyleTableBorder& aOther); nsStyleTableBorder(const nsStyleTableBorder& aOther);
~nsStyleTableBorder(void); ~nsStyleTableBorder(void);
@ -934,7 +930,7 @@ struct nsStyleCounterData {
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; } #define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; }
struct nsStyleQuotes : public nsStyleStruct { struct nsStyleQuotes {
nsStyleQuotes(); nsStyleQuotes();
nsStyleQuotes(const nsStyleQuotes& aQuotes); nsStyleQuotes(const nsStyleQuotes& aQuotes);
~nsStyleQuotes(); ~nsStyleQuotes();
@ -1004,7 +1000,7 @@ protected:
nsString* mQuotes; nsString* mQuotes;
}; };
struct nsStyleContent: public nsStyleStruct { struct nsStyleContent {
nsStyleContent(void); nsStyleContent(void);
nsStyleContent(const nsStyleContent& aContent); nsStyleContent(const nsStyleContent& aContent);
~nsStyleContent(void); ~nsStyleContent(void);
@ -1109,7 +1105,7 @@ protected:
nsStyleCounterData* mResets; nsStyleCounterData* mResets;
}; };
struct nsStyleUIReset: public nsStyleStruct { struct nsStyleUIReset {
nsStyleUIReset(void); nsStyleUIReset(void);
nsStyleUIReset(const nsStyleUIReset& aOther); nsStyleUIReset(const nsStyleUIReset& aOther);
~nsStyleUIReset(void); ~nsStyleUIReset(void);
@ -1140,7 +1136,7 @@ struct nsCursorImage {
nsCursorImage(); nsCursorImage();
}; };
struct nsStyleUserInterface: public nsStyleStruct { struct nsStyleUserInterface {
nsStyleUserInterface(void); nsStyleUserInterface(void);
nsStyleUserInterface(const nsStyleUserInterface& aOther); nsStyleUserInterface(const nsStyleUserInterface& aOther);
~nsStyleUserInterface(void); ~nsStyleUserInterface(void);
@ -1175,7 +1171,7 @@ struct nsStyleUserInterface: public nsStyleStruct {
void CopyCursorArrayFrom(const nsStyleUserInterface& aSource); void CopyCursorArrayFrom(const nsStyleUserInterface& aSource);
}; };
struct nsStyleXUL : public nsStyleStruct { struct nsStyleXUL {
nsStyleXUL(); nsStyleXUL();
nsStyleXUL(const nsStyleXUL& aSource); nsStyleXUL(const nsStyleXUL& aSource);
~nsStyleXUL(); ~nsStyleXUL();
@ -1201,7 +1197,7 @@ struct nsStyleXUL : public nsStyleStruct {
PRUint8 mBoxPack; // [reset] see nsStyleConsts.h PRUint8 mBoxPack; // [reset] see nsStyleConsts.h
}; };
struct nsStyleColumn : public nsStyleStruct { struct nsStyleColumn {
nsStyleColumn(); nsStyleColumn();
nsStyleColumn(const nsStyleColumn& aSource); nsStyleColumn(const nsStyleColumn& aSource);
~nsStyleColumn(); ~nsStyleColumn();
@ -1251,7 +1247,7 @@ struct nsStyleSVGPaint
} }
}; };
struct nsStyleSVG : public nsStyleStruct { struct nsStyleSVG {
nsStyleSVG(); nsStyleSVG();
nsStyleSVG(const nsStyleSVG& aSource); nsStyleSVG(const nsStyleSVG& aSource);
~nsStyleSVG(); ~nsStyleSVG();
@ -1296,7 +1292,7 @@ struct nsStyleSVG : public nsStyleStruct {
PRUint8 mTextRendering; // [inherited] see nsStyleConsts.h PRUint8 mTextRendering; // [inherited] see nsStyleConsts.h
}; };
struct nsStyleSVGReset : public nsStyleStruct { struct nsStyleSVGReset {
nsStyleSVGReset(); nsStyleSVGReset();
nsStyleSVGReset(const nsStyleSVGReset& aSource); nsStyleSVGReset(const nsStyleSVGReset& aSource);
~nsStyleSVGReset(); ~nsStyleSVGReset();

@ -60,8 +60,6 @@ nsStyleStructID_Length /* one past the end; length of 0-based list */
}; };
struct nsStyleStruct;
// A bit corresponding to each struct ID // A bit corresponding to each struct ID
#define NS_STYLE_INHERIT_BIT(sid_) (1 << PRInt32(eStyleStruct_##sid_)) #define NS_STYLE_INHERIT_BIT(sid_) (1 << PRInt32(eStyleStruct_##sid_))

@ -3,7 +3,7 @@
<!-- <!--
--> -->
<head> <head>
<title>Test for nsStyleStruct copy constructors</title> <title>Test for style struct copy constructors</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script> <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="property_database.js"></script> <script type="text/javascript" src="property_database.js"></script>
@ -21,7 +21,7 @@
<pre id="test"> <pre id="test">
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
/** Test for nsStyleStruct copy constructors **/ /** Test for style struct copy constructors **/
/** /**
* XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for * XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for