Fix HP bustage by moving GetStyleData function templates from nsStyleStruct.h to nsIFrame.h and nsIStyleContext.h b=111883

This commit is contained in:
dbaron%fas.harvard.edu 2001-11-28 06:50:13 +00:00
Родитель 7c43a9f17a
Коммит 00f9823b7d
5 изменённых файлов: 37 добавлений и 38 удалений

Просмотреть файл

@ -1100,24 +1100,9 @@ inline nsBorderEdges::nsBorderEdges()
mOutsideEdge = PR_TRUE; mOutsideEdge = PR_TRUE;
}; };
// typesafe mechanisms for accessing style data // typesafe mechanisms for accessing style data, global function
class nsIFrame; // templates |GetStyleData(nsIFrame*, const T**)| and
class nsIStyleContext; // |GetStyleData(nsIStyleContext*, const T**)|, where T is derived from
// nsStyleStruct, are located in nsIStyleContext.h and nsIFrame.h
template <class T>
inline void
GetStyleData(nsIFrame* aFrame, const T** aStyleStruct)
{
aFrame->GetStyleData(NS_GET_STYLESTRUCTID(T),
*NS_REINTERPRET_CAST(const nsStyleStruct**, aStyleStruct));
}
template <class T>
inline void
GetStyleData(nsIStyleContext* aStyleContext, const T** aStyleStruct)
{
*aStyleStruct = NS_STATIC_CAST(const T*,
aStyleContext->GetStyleData(NS_GET_STYLESTRUCTID(T)));
}
#endif /* nsStyleStruct_h___ */ #endif /* nsStyleStruct_h___ */

Просмотреть файл

@ -1159,4 +1159,14 @@ private:
NS_IMETHOD_(nsrefcnt) Release(void) = 0; NS_IMETHOD_(nsrefcnt) Release(void) = 0;
}; };
// typesafe way to access style data. See comment in nsStyleStruct.h
// and also overloaded function in nsIStyleContext.h
template <class T>
inline void
GetStyleData(nsIFrame* aFrame, const T** aStyleStruct)
{
aFrame->GetStyleData(NS_GET_STYLESTRUCTID(T),
*NS_REINTERPRET_CAST(const nsStyleStruct**, aStyleStruct));
}
#endif /* nsIFrame_h___ */ #endif /* nsIFrame_h___ */

Просмотреть файл

@ -139,5 +139,14 @@ extern NS_EXPORT nsresult
nsRuleNode* aRuleNode, nsRuleNode* aRuleNode,
nsIPresContext* aPresContext); nsIPresContext* aPresContext);
// typesafe way to access style data. See nsStyleStruct.h and also
// overloaded function in nsIFrame.h.
template <class T>
inline void
GetStyleData(nsIStyleContext* aStyleContext, const T** aStyleStruct)
{
*aStyleStruct = NS_STATIC_CAST(const T*,
aStyleContext->GetStyleData(NS_GET_STYLESTRUCTID(T)));
}
#endif /* nsIStyleContext_h___ */ #endif /* nsIStyleContext_h___ */

Просмотреть файл

@ -1159,4 +1159,14 @@ private:
NS_IMETHOD_(nsrefcnt) Release(void) = 0; NS_IMETHOD_(nsrefcnt) Release(void) = 0;
}; };
// typesafe way to access style data. See comment in nsStyleStruct.h
// and also overloaded function in nsIStyleContext.h
template <class T>
inline void
GetStyleData(nsIFrame* aFrame, const T** aStyleStruct)
{
aFrame->GetStyleData(NS_GET_STYLESTRUCTID(T),
*NS_REINTERPRET_CAST(const nsStyleStruct**, aStyleStruct));
}
#endif /* nsIFrame_h___ */ #endif /* nsIFrame_h___ */

Просмотреть файл

@ -1100,24 +1100,9 @@ inline nsBorderEdges::nsBorderEdges()
mOutsideEdge = PR_TRUE; mOutsideEdge = PR_TRUE;
}; };
// typesafe mechanisms for accessing style data // typesafe mechanisms for accessing style data, global function
class nsIFrame; // templates |GetStyleData(nsIFrame*, const T**)| and
class nsIStyleContext; // |GetStyleData(nsIStyleContext*, const T**)|, where T is derived from
// nsStyleStruct, are located in nsIStyleContext.h and nsIFrame.h
template <class T>
inline void
GetStyleData(nsIFrame* aFrame, const T** aStyleStruct)
{
aFrame->GetStyleData(NS_GET_STYLESTRUCTID(T),
*NS_REINTERPRET_CAST(const nsStyleStruct**, aStyleStruct));
}
template <class T>
inline void
GetStyleData(nsIStyleContext* aStyleContext, const T** aStyleStruct)
{
*aStyleStruct = NS_STATIC_CAST(const T*,
aStyleContext->GetStyleData(NS_GET_STYLESTRUCTID(T)));
}
#endif /* nsStyleStruct_h___ */ #endif /* nsStyleStruct_h___ */