Subclass the nsCSS* structs as nsRuleData* so members can be added to the latter without bloating the former, and to allow the former to go away eventually. Propagate whether a font family name comes from HTML through the style system and use it to set a bit on nsFont indicating that quirky behavior of Symbol fonts is acceptable. b=175372 r=bzbarsky sr=kin

This commit is contained in:
dbaron%fas.harvard.edu 2002-11-12 15:17:07 +00:00
parent f623bad311
commit dc83a84103
20 changed files with 813 additions and 542 deletions

File diff suppressed because it is too large Load Diff

View File

@ -234,7 +234,7 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
return;
if (aData->mFontData) {
nsCSSFont& font = *(aData->mFontData);
nsRuleDataFont& font = *(aData->mFontData);
nsHTMLValue value;
// face: string list
@ -243,8 +243,10 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_String) {
nsAutoString familyList;
value.GetStringValue(familyList);
if (!familyList.IsEmpty())
if (!familyList.IsEmpty()) {
font.mFamily.SetStringValue(familyList, eCSSUnit_String);
font.mFamilyFromHTML = PR_TRUE;
}
}
}

View File

@ -203,7 +203,7 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
return;
if (aData->mFontData) {
nsCSSFont& font = *(aData->mFontData);
nsRuleDataFont& font = *(aData->mFontData);
if (nsnull != aAttributes) {
nsHTMLValue value;

View File

@ -390,7 +390,6 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mOverflow(aCopy.mOverflow),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
mLang(aCopy.mLang),
// temp fix for bug 24000
mBreakBefore(aCopy.mBreakBefore),
mBreakAfter(aCopy.mBreakAfter)

View File

@ -56,6 +56,13 @@ struct nsCSSStruct {
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
};
// Eventually we should stop using the nsCSS* structures for storing
// nsCSSDeclaration's data, because they're extremely bloated. However,
// we'll still want to use them for nsRuleData. So, for now, use
// typedefs and inheritance (forwards, when the rule data needs extra
// data) to make the rule data structs from the declaration structs.
typedef nsCSSStruct nsRuleDataStruct;
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_FONT_SID \
@ -139,6 +146,10 @@ struct nsCSSFont : public nsCSSStruct {
nsCSSValue mStretch; // NEW
};
struct nsRuleDataFont : public nsCSSFont {
PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
};
struct nsCSSValueList {
nsCSSValueList(void);
nsCSSValueList(const nsCSSValueList& aCopy);
@ -168,6 +179,9 @@ struct nsCSSColor : public nsCSSStruct {
nsCSSValue mBackOrigin;
};
struct nsRuleDataColor : public nsCSSColor {
};
struct nsCSSShadow {
nsCSSShadow(void);
nsCSSShadow(const nsCSSShadow& aCopy);
@ -203,6 +217,9 @@ struct nsCSSText : public nsCSSStruct {
nsCSSValue mWhiteSpace;
};
struct nsRuleDataText : public nsCSSText {
};
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
@ -239,10 +256,6 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
// mLang member variable is here not because in needs to be stored
// in nsCSSDeclaration objects but because it's needed on the
// stack when the struct is used in WalkRuleTree.
nsCSSValue mLang;
// temp fix for bug 24000
nsCSSValue mBreakBefore;
@ -250,6 +263,10 @@ struct nsCSSDisplay : public nsCSSStruct {
// end temp fix
};
struct nsRuleDataDisplay : public nsCSSDisplay {
nsCSSValue mLang;
};
struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(void);
nsCSSMargin(const nsCSSMargin& aCopy);
@ -276,6 +293,9 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSValue mFloatEdge; // NEW
};
struct nsRuleDataMargin : public nsCSSMargin {
};
struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(void);
nsCSSPosition(const nsCSSPosition& aCopy);
@ -297,6 +317,9 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSValue mZIndex;
};
struct nsRuleDataPosition : public nsCSSPosition {
};
struct nsCSSList : public nsCSSStruct {
nsCSSList(void);
nsCSSList(const nsCSSList& aCopy);
@ -313,6 +336,9 @@ struct nsCSSList : public nsCSSStruct {
nsCSSRect* mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
};
struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(void);
nsCSSTable(const nsCSSTable& aCopy);
@ -336,6 +362,9 @@ struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
};
struct nsRuleDataTable : public nsCSSTable {
};
struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(void);
nsCSSBreaks(const nsCSSBreaks& aCopy);
@ -354,6 +383,9 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSValue mPageBreakInside;
};
struct nsRuleDataBreaks : public nsCSSBreaks {
};
struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(void);
nsCSSPage(const nsCSSPage& aCopy);
@ -369,6 +401,9 @@ struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSValue mSizeHeight;
};
struct nsRuleDataPage : public nsCSSPage {
};
struct nsCSSCounterData {
nsCSSCounterData(void);
nsCSSCounterData(const nsCSSCounterData& aCopy);
@ -406,6 +441,9 @@ struct nsCSSContent : public nsCSSStruct {
nsCSSQuotes* mQuotes;
};
struct nsRuleDataContent : public nsCSSContent {
};
struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(void);
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
@ -427,6 +465,9 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSValue mForceBrokenImageIcon;
};
struct nsRuleDataUserInterface : public nsCSSUserInterface {
};
struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(void);
nsCSSAural(const nsCSSAural& aCopy);
@ -458,6 +499,9 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSValue mVolume;
};
struct nsRuleDataAural : public nsCSSAural {
};
#ifdef INCLUDE_XUL
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
@ -476,6 +520,9 @@ struct nsCSSXUL : public nsCSSStruct {
nsCSSValue mBoxPack;
nsCSSValue mBoxOrdinal;
};
struct nsRuleDataXUL : public nsCSSXUL {
};
#endif
#ifdef MOZ_SVG
@ -501,6 +548,9 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSValue mStrokeOpacity;
nsCSSValue mStrokeWidth;
};
struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
//

View File

@ -390,7 +390,6 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mOverflow(aCopy.mOverflow),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
mLang(aCopy.mLang),
// temp fix for bug 24000
mBreakBefore(aCopy.mBreakBefore),
mBreakAfter(aCopy.mBreakAfter)

View File

@ -56,6 +56,13 @@ struct nsCSSStruct {
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
};
// Eventually we should stop using the nsCSS* structures for storing
// nsCSSDeclaration's data, because they're extremely bloated. However,
// we'll still want to use them for nsRuleData. So, for now, use
// typedefs and inheritance (forwards, when the rule data needs extra
// data) to make the rule data structs from the declaration structs.
typedef nsCSSStruct nsRuleDataStruct;
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_FONT_SID \
@ -139,6 +146,10 @@ struct nsCSSFont : public nsCSSStruct {
nsCSSValue mStretch; // NEW
};
struct nsRuleDataFont : public nsCSSFont {
PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
};
struct nsCSSValueList {
nsCSSValueList(void);
nsCSSValueList(const nsCSSValueList& aCopy);
@ -168,6 +179,9 @@ struct nsCSSColor : public nsCSSStruct {
nsCSSValue mBackOrigin;
};
struct nsRuleDataColor : public nsCSSColor {
};
struct nsCSSShadow {
nsCSSShadow(void);
nsCSSShadow(const nsCSSShadow& aCopy);
@ -203,6 +217,9 @@ struct nsCSSText : public nsCSSStruct {
nsCSSValue mWhiteSpace;
};
struct nsRuleDataText : public nsCSSText {
};
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
@ -239,10 +256,6 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
// mLang member variable is here not because in needs to be stored
// in nsCSSDeclaration objects but because it's needed on the
// stack when the struct is used in WalkRuleTree.
nsCSSValue mLang;
// temp fix for bug 24000
nsCSSValue mBreakBefore;
@ -250,6 +263,10 @@ struct nsCSSDisplay : public nsCSSStruct {
// end temp fix
};
struct nsRuleDataDisplay : public nsCSSDisplay {
nsCSSValue mLang;
};
struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(void);
nsCSSMargin(const nsCSSMargin& aCopy);
@ -276,6 +293,9 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSValue mFloatEdge; // NEW
};
struct nsRuleDataMargin : public nsCSSMargin {
};
struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(void);
nsCSSPosition(const nsCSSPosition& aCopy);
@ -297,6 +317,9 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSValue mZIndex;
};
struct nsRuleDataPosition : public nsCSSPosition {
};
struct nsCSSList : public nsCSSStruct {
nsCSSList(void);
nsCSSList(const nsCSSList& aCopy);
@ -313,6 +336,9 @@ struct nsCSSList : public nsCSSStruct {
nsCSSRect* mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
};
struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(void);
nsCSSTable(const nsCSSTable& aCopy);
@ -336,6 +362,9 @@ struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
};
struct nsRuleDataTable : public nsCSSTable {
};
struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(void);
nsCSSBreaks(const nsCSSBreaks& aCopy);
@ -354,6 +383,9 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSValue mPageBreakInside;
};
struct nsRuleDataBreaks : public nsCSSBreaks {
};
struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(void);
nsCSSPage(const nsCSSPage& aCopy);
@ -369,6 +401,9 @@ struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSValue mSizeHeight;
};
struct nsRuleDataPage : public nsCSSPage {
};
struct nsCSSCounterData {
nsCSSCounterData(void);
nsCSSCounterData(const nsCSSCounterData& aCopy);
@ -406,6 +441,9 @@ struct nsCSSContent : public nsCSSStruct {
nsCSSQuotes* mQuotes;
};
struct nsRuleDataContent : public nsCSSContent {
};
struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(void);
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
@ -427,6 +465,9 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSValue mForceBrokenImageIcon;
};
struct nsRuleDataUserInterface : public nsCSSUserInterface {
};
struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(void);
nsCSSAural(const nsCSSAural& aCopy);
@ -458,6 +499,9 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSValue mVolume;
};
struct nsRuleDataAural : public nsCSSAural {
};
#ifdef INCLUDE_XUL
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
@ -476,6 +520,9 @@ struct nsCSSXUL : public nsCSSStruct {
nsCSSValue mBoxPack;
nsCSSValue mBoxOrdinal;
};
struct nsRuleDataXUL : public nsCSSXUL {
};
#endif
#ifdef MOZ_SVG
@ -501,6 +548,9 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSValue mStrokeOpacity;
nsCSSValue mStrokeWidth;
};
struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
//

View File

@ -918,23 +918,23 @@ nsresult nsCSSSelector::ToString( nsAString& aString, nsICSSStyleSheet* aSheet,
// -- CSSImportantRule -------------------------------
// New map helpers shared by both important and regular rules.
static nsresult MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont);
static nsresult MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay);
static nsresult MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor);
static nsresult MapMarginForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSMargin& aMargin);
static nsresult MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList);
static nsresult MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition);
static nsresult MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable);
static nsresult MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent);
static nsresult MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aContent);
static nsresult MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aContent);
static nsresult MapFontForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataFont& aFont);
static nsresult MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataDisplay& aDisplay);
static nsresult MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataColor& aColor);
static nsresult MapMarginForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataMargin& aMargin);
static nsresult MapListForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataList& aList);
static nsresult MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataPosition& aPosition);
static nsresult MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataTable& aTable);
static nsresult MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataContent& aContent);
static nsresult MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataText& aContent);
static nsresult MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataUserInterface& aContent);
#ifdef INCLUDE_XUL
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL);
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL);
#endif
#ifdef MOZ_SVG
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG);
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG);
#endif
class CSSStyleRuleImpl;
@ -1743,7 +1743,7 @@ CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData)
}
static nsresult
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataFont& aFont)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1752,8 +1752,10 @@ MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
if (!ourFont)
return NS_OK; // We don't have any rules for fonts.
if (eCSSUnit_Null == aFont.mFamily.GetUnit() && eCSSUnit_Null != ourFont->mFamily.GetUnit())
if (eCSSUnit_Null == aFont.mFamily.GetUnit() && eCSSUnit_Null != ourFont->mFamily.GetUnit()) {
aFont.mFamily = ourFont->mFamily;
aFont.mFamilyFromHTML = PR_FALSE;
}
if (eCSSUnit_Null == aFont.mStyle.GetUnit() && eCSSUnit_Null != ourFont->mStyle.GetUnit())
aFont.mStyle = ourFont->mStyle;
@ -1775,7 +1777,7 @@ MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
#ifdef INCLUDE_XUL
static nsresult
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL)
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1814,7 +1816,7 @@ MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL)
#ifdef MOZ_SVG
static nsresult
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG)
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1863,7 +1865,7 @@ MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG)
static nsresult
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition)
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataPosition& aPosition)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1915,7 +1917,7 @@ MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition)
}
static nsresult
MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList)
MapListForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataList& aList)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1959,7 +1961,7 @@ MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList)
}
static nsresult
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsCSSMargin& aMargin)
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsRuleDataMargin& aMargin)
{
nsCSSMargin* ourMargin = (nsCSSMargin*)aDeclaration->GetData(kCSSMarginSID);
if (!ourMargin)
@ -2103,7 +2105,7 @@ MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& a
}
static nsresult
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor)
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataColor& aColor)
{
if (!aDecl)
return NS_OK;
@ -2153,7 +2155,7 @@ MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCS
}
static nsresult
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable)
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataTable& aTable)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2193,7 +2195,7 @@ MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCS
}
static nsresult
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent)
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataContent& aContent)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2224,7 +2226,7 @@ MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, ns
}
static nsresult
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aText)
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataText& aText)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2273,7 +2275,7 @@ MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSS
}
static nsresult
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay)
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataDisplay& aDisplay)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2349,7 +2351,7 @@ MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, ns
}
static nsresult
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aUI)
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataUserInterface& aUI)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.

View File

@ -247,23 +247,23 @@ struct nsRuleData
nsIPresContext* mPresContext;
nsIStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback;
nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsCSSDisplay* mDisplayData;
nsCSSMargin* mMarginData;
nsCSSList* mListData;
nsCSSPosition* mPositionData;
nsCSSTable* mTableData;
nsCSSColor* mColorData;
nsCSSContent* mContentData;
nsCSSText* mTextData;
nsCSSUserInterface* mUIData;
nsRuleDataFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsRuleDataDisplay* mDisplayData;
nsRuleDataMargin* mMarginData;
nsRuleDataList* mListData;
nsRuleDataPosition* mPositionData;
nsRuleDataTable* mTableData;
nsRuleDataColor* mColorData;
nsRuleDataContent* mContentData;
nsRuleDataText* mTextData;
nsRuleDataUserInterface* mUIData;
#ifdef INCLUDE_XUL
nsCSSXUL* mXULData;
nsRuleDataXUL* mXULData;
#endif
#ifdef MOZ_SVG
nsCSSSVG* mSVGData;
nsRuleDataSVG* mSVGData;
#endif
nsRuleData(const nsStyleStructID& aSID, nsIPresContext* aContext, nsIStyleContext* aStyleContext)
@ -413,84 +413,84 @@ protected:
const nsStyleStruct* WalkRuleTree(const nsStyleStructID aSID, nsIStyleContext* aContext,
nsRuleData* aRuleData,
nsCSSStruct* aSpecificData,
nsRuleDataStruct* aSpecificData,
PRBool aComputeData);
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsCSSStruct& aDisplayData,
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsRuleDataStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsCSSStruct& aDisplayData,
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsRuleDataStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsCSSStruct& aFontData,
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsRuleDataStruct& aFontData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsCSSStruct& aColorData,
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsRuleDataStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsCSSStruct& aColorData,
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsRuleDataStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsCSSStruct& aListData,
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsRuleDataStruct& aListData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsCSSStruct& aPositionData,
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsRuleDataStruct& aPositionData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsRuleDataStruct& aTableData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsRuleDataStruct& aTableData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsCSSStruct& aData,
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsCSSStruct& aData,
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUserInterfaceData(nsStyleStruct* aStartData,
const nsCSSStruct& aData,
const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
PRBool aInherited);
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#ifdef INCLUDE_XUL
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsCSSStruct& aXULData,
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsRuleDataStruct& aXULData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#endif
#ifdef MOZ_SVG
const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsCSSStruct& aSVGData,
const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsRuleDataStruct& aSVGData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
@ -498,7 +498,7 @@ protected:
typedef const nsStyleStruct*
(nsRuleNode::*ComputeStyleDataFn)(nsStyleStruct* aStartStruct,
const nsCSSStruct& aStartData,
const nsRuleDataStruct& aStartData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
@ -506,7 +506,7 @@ protected:
static ComputeStyleDataFn gComputeStyleDataFn[];
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsCSSStruct& aCSSStruct);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
const nsStyleStruct* GetParentData(const nsStyleStructID aSID);
const nsStyleStruct* GetDisplayData(nsIStyleContext* aContext, PRBool aComputeData);

View File

@ -263,6 +263,7 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
(aFont1.sizeAdjust == aFont2.sizeAdjust) &&
(aFont1.style == aFont2.style) &&
(aFont1.variant == aFont2.variant) &&
(aFont1.familyNameQuirks == aFont2.familyNameQuirks) &&
(aFont1.weight == aFont2.weight) &&
(aFont1.name == aFont2.name)) {
if ((aFont1.decorations == aFont2.decorations)) {

View File

@ -73,7 +73,11 @@ struct NS_GFX nsFont {
PRUint8 style;
// The variant of the font (normal, small-caps)
PRUint8 variant;
PRUint8 variant : 7;
// True if the character set quirks (for treatment of "Symbol",
// "Wingdings", etc.) should be applied.
PRPackedBool familyNameQuirks : 1;
// The weight of the font (0-999)
PRUint16 weight;

View File

@ -48,6 +48,7 @@ nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
name.AssignWithConversion(aName);
style = aStyle;
variant = aVariant;
familyNameQuirks = PR_FALSE;
weight = aWeight;
decorations = aDecoration;
size = aSize;
@ -61,6 +62,7 @@ nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
{
style = aStyle;
variant = aVariant;
familyNameQuirks = PR_FALSE;
weight = aWeight;
decorations = aDecoration;
size = aSize;
@ -72,6 +74,7 @@ nsFont::nsFont(const nsFont& aOther)
{
style = aOther.style;
variant = aOther.variant;
familyNameQuirks = aOther.familyNameQuirks;
weight = aOther.weight;
decorations = aOther.decorations;
size = aOther.size;
@ -90,6 +93,7 @@ PRBool nsFont::Equals(const nsFont& aOther) const
{
if ((style == aOther.style) &&
(variant == aOther.variant) &&
(familyNameQuirks == aOther.familyNameQuirks) &&
(weight == aOther.weight) &&
(decorations == aOther.decorations) &&
(size == aOther.size) &&
@ -105,6 +109,7 @@ nsFont& nsFont::operator=(const nsFont& aOther)
name = aOther.name;
style = aOther.style;
variant = aOther.variant;
familyNameQuirks = aOther.familyNameQuirks;
weight = aOther.weight;
decorations = aOther.decorations;
size = aOther.size;

View File

@ -390,7 +390,6 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mOverflow(aCopy.mOverflow),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
mLang(aCopy.mLang),
// temp fix for bug 24000
mBreakBefore(aCopy.mBreakBefore),
mBreakAfter(aCopy.mBreakAfter)

View File

@ -56,6 +56,13 @@ struct nsCSSStruct {
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
};
// Eventually we should stop using the nsCSS* structures for storing
// nsCSSDeclaration's data, because they're extremely bloated. However,
// we'll still want to use them for nsRuleData. So, for now, use
// typedefs and inheritance (forwards, when the rule data needs extra
// data) to make the rule data structs from the declaration structs.
typedef nsCSSStruct nsRuleDataStruct;
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_FONT_SID \
@ -139,6 +146,10 @@ struct nsCSSFont : public nsCSSStruct {
nsCSSValue mStretch; // NEW
};
struct nsRuleDataFont : public nsCSSFont {
PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
};
struct nsCSSValueList {
nsCSSValueList(void);
nsCSSValueList(const nsCSSValueList& aCopy);
@ -168,6 +179,9 @@ struct nsCSSColor : public nsCSSStruct {
nsCSSValue mBackOrigin;
};
struct nsRuleDataColor : public nsCSSColor {
};
struct nsCSSShadow {
nsCSSShadow(void);
nsCSSShadow(const nsCSSShadow& aCopy);
@ -203,6 +217,9 @@ struct nsCSSText : public nsCSSStruct {
nsCSSValue mWhiteSpace;
};
struct nsRuleDataText : public nsCSSText {
};
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
@ -239,10 +256,6 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
// mLang member variable is here not because in needs to be stored
// in nsCSSDeclaration objects but because it's needed on the
// stack when the struct is used in WalkRuleTree.
nsCSSValue mLang;
// temp fix for bug 24000
nsCSSValue mBreakBefore;
@ -250,6 +263,10 @@ struct nsCSSDisplay : public nsCSSStruct {
// end temp fix
};
struct nsRuleDataDisplay : public nsCSSDisplay {
nsCSSValue mLang;
};
struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(void);
nsCSSMargin(const nsCSSMargin& aCopy);
@ -276,6 +293,9 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSValue mFloatEdge; // NEW
};
struct nsRuleDataMargin : public nsCSSMargin {
};
struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(void);
nsCSSPosition(const nsCSSPosition& aCopy);
@ -297,6 +317,9 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSValue mZIndex;
};
struct nsRuleDataPosition : public nsCSSPosition {
};
struct nsCSSList : public nsCSSStruct {
nsCSSList(void);
nsCSSList(const nsCSSList& aCopy);
@ -313,6 +336,9 @@ struct nsCSSList : public nsCSSStruct {
nsCSSRect* mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
};
struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(void);
nsCSSTable(const nsCSSTable& aCopy);
@ -336,6 +362,9 @@ struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
};
struct nsRuleDataTable : public nsCSSTable {
};
struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(void);
nsCSSBreaks(const nsCSSBreaks& aCopy);
@ -354,6 +383,9 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSValue mPageBreakInside;
};
struct nsRuleDataBreaks : public nsCSSBreaks {
};
struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(void);
nsCSSPage(const nsCSSPage& aCopy);
@ -369,6 +401,9 @@ struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSValue mSizeHeight;
};
struct nsRuleDataPage : public nsCSSPage {
};
struct nsCSSCounterData {
nsCSSCounterData(void);
nsCSSCounterData(const nsCSSCounterData& aCopy);
@ -406,6 +441,9 @@ struct nsCSSContent : public nsCSSStruct {
nsCSSQuotes* mQuotes;
};
struct nsRuleDataContent : public nsCSSContent {
};
struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(void);
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
@ -427,6 +465,9 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSValue mForceBrokenImageIcon;
};
struct nsRuleDataUserInterface : public nsCSSUserInterface {
};
struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(void);
nsCSSAural(const nsCSSAural& aCopy);
@ -458,6 +499,9 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSValue mVolume;
};
struct nsRuleDataAural : public nsCSSAural {
};
#ifdef INCLUDE_XUL
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
@ -476,6 +520,9 @@ struct nsCSSXUL : public nsCSSStruct {
nsCSSValue mBoxPack;
nsCSSValue mBoxOrdinal;
};
struct nsRuleDataXUL : public nsCSSXUL {
};
#endif
#ifdef MOZ_SVG
@ -501,6 +548,9 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSValue mStrokeOpacity;
nsCSSValue mStrokeWidth;
};
struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
//

View File

@ -390,7 +390,6 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mOverflow(aCopy.mOverflow),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
mLang(aCopy.mLang),
// temp fix for bug 24000
mBreakBefore(aCopy.mBreakBefore),
mBreakAfter(aCopy.mBreakAfter)

View File

@ -56,6 +56,13 @@ struct nsCSSStruct {
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
};
// Eventually we should stop using the nsCSS* structures for storing
// nsCSSDeclaration's data, because they're extremely bloated. However,
// we'll still want to use them for nsRuleData. So, for now, use
// typedefs and inheritance (forwards, when the rule data needs extra
// data) to make the rule data structs from the declaration structs.
typedef nsCSSStruct nsRuleDataStruct;
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_FONT_SID \
@ -139,6 +146,10 @@ struct nsCSSFont : public nsCSSStruct {
nsCSSValue mStretch; // NEW
};
struct nsRuleDataFont : public nsCSSFont {
PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
};
struct nsCSSValueList {
nsCSSValueList(void);
nsCSSValueList(const nsCSSValueList& aCopy);
@ -168,6 +179,9 @@ struct nsCSSColor : public nsCSSStruct {
nsCSSValue mBackOrigin;
};
struct nsRuleDataColor : public nsCSSColor {
};
struct nsCSSShadow {
nsCSSShadow(void);
nsCSSShadow(const nsCSSShadow& aCopy);
@ -203,6 +217,9 @@ struct nsCSSText : public nsCSSStruct {
nsCSSValue mWhiteSpace;
};
struct nsRuleDataText : public nsCSSText {
};
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
@ -239,10 +256,6 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
// mLang member variable is here not because in needs to be stored
// in nsCSSDeclaration objects but because it's needed on the
// stack when the struct is used in WalkRuleTree.
nsCSSValue mLang;
// temp fix for bug 24000
nsCSSValue mBreakBefore;
@ -250,6 +263,10 @@ struct nsCSSDisplay : public nsCSSStruct {
// end temp fix
};
struct nsRuleDataDisplay : public nsCSSDisplay {
nsCSSValue mLang;
};
struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(void);
nsCSSMargin(const nsCSSMargin& aCopy);
@ -276,6 +293,9 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSValue mFloatEdge; // NEW
};
struct nsRuleDataMargin : public nsCSSMargin {
};
struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(void);
nsCSSPosition(const nsCSSPosition& aCopy);
@ -297,6 +317,9 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSValue mZIndex;
};
struct nsRuleDataPosition : public nsCSSPosition {
};
struct nsCSSList : public nsCSSStruct {
nsCSSList(void);
nsCSSList(const nsCSSList& aCopy);
@ -313,6 +336,9 @@ struct nsCSSList : public nsCSSStruct {
nsCSSRect* mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
};
struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(void);
nsCSSTable(const nsCSSTable& aCopy);
@ -336,6 +362,9 @@ struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
};
struct nsRuleDataTable : public nsCSSTable {
};
struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(void);
nsCSSBreaks(const nsCSSBreaks& aCopy);
@ -354,6 +383,9 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSValue mPageBreakInside;
};
struct nsRuleDataBreaks : public nsCSSBreaks {
};
struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(void);
nsCSSPage(const nsCSSPage& aCopy);
@ -369,6 +401,9 @@ struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSValue mSizeHeight;
};
struct nsRuleDataPage : public nsCSSPage {
};
struct nsCSSCounterData {
nsCSSCounterData(void);
nsCSSCounterData(const nsCSSCounterData& aCopy);
@ -406,6 +441,9 @@ struct nsCSSContent : public nsCSSStruct {
nsCSSQuotes* mQuotes;
};
struct nsRuleDataContent : public nsCSSContent {
};
struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(void);
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
@ -427,6 +465,9 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSValue mForceBrokenImageIcon;
};
struct nsRuleDataUserInterface : public nsCSSUserInterface {
};
struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(void);
nsCSSAural(const nsCSSAural& aCopy);
@ -458,6 +499,9 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSValue mVolume;
};
struct nsRuleDataAural : public nsCSSAural {
};
#ifdef INCLUDE_XUL
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
@ -476,6 +520,9 @@ struct nsCSSXUL : public nsCSSStruct {
nsCSSValue mBoxPack;
nsCSSValue mBoxOrdinal;
};
struct nsRuleDataXUL : public nsCSSXUL {
};
#endif
#ifdef MOZ_SVG
@ -501,6 +548,9 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSValue mStrokeOpacity;
nsCSSValue mStrokeWidth;
};
struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
//

View File

@ -918,23 +918,23 @@ nsresult nsCSSSelector::ToString( nsAString& aString, nsICSSStyleSheet* aSheet,
// -- CSSImportantRule -------------------------------
// New map helpers shared by both important and regular rules.
static nsresult MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont);
static nsresult MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay);
static nsresult MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor);
static nsresult MapMarginForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSMargin& aMargin);
static nsresult MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList);
static nsresult MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition);
static nsresult MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable);
static nsresult MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent);
static nsresult MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aContent);
static nsresult MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aContent);
static nsresult MapFontForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataFont& aFont);
static nsresult MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataDisplay& aDisplay);
static nsresult MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataColor& aColor);
static nsresult MapMarginForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataMargin& aMargin);
static nsresult MapListForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataList& aList);
static nsresult MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataPosition& aPosition);
static nsresult MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataTable& aTable);
static nsresult MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataContent& aContent);
static nsresult MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataText& aContent);
static nsresult MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataUserInterface& aContent);
#ifdef INCLUDE_XUL
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL);
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL);
#endif
#ifdef MOZ_SVG
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG);
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG);
#endif
class CSSStyleRuleImpl;
@ -1743,7 +1743,7 @@ CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData)
}
static nsresult
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataFont& aFont)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1752,8 +1752,10 @@ MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
if (!ourFont)
return NS_OK; // We don't have any rules for fonts.
if (eCSSUnit_Null == aFont.mFamily.GetUnit() && eCSSUnit_Null != ourFont->mFamily.GetUnit())
if (eCSSUnit_Null == aFont.mFamily.GetUnit() && eCSSUnit_Null != ourFont->mFamily.GetUnit()) {
aFont.mFamily = ourFont->mFamily;
aFont.mFamilyFromHTML = PR_FALSE;
}
if (eCSSUnit_Null == aFont.mStyle.GetUnit() && eCSSUnit_Null != ourFont->mStyle.GetUnit())
aFont.mStyle = ourFont->mStyle;
@ -1775,7 +1777,7 @@ MapFontForDeclaration(nsCSSDeclaration* aDecl, nsCSSFont& aFont)
#ifdef INCLUDE_XUL
static nsresult
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL)
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1814,7 +1816,7 @@ MapXULForDeclaration(nsCSSDeclaration* aDecl, nsCSSXUL& aXUL)
#ifdef MOZ_SVG
static nsresult
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG)
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1863,7 +1865,7 @@ MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsCSSSVG& aSVG)
static nsresult
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition)
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataPosition& aPosition)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1915,7 +1917,7 @@ MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsCSSPosition& aPosition)
}
static nsresult
MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList)
MapListForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataList& aList)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -1959,7 +1961,7 @@ MapListForDeclaration(nsCSSDeclaration* aDecl, nsCSSList& aList)
}
static nsresult
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsCSSMargin& aMargin)
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsRuleDataMargin& aMargin)
{
nsCSSMargin* ourMargin = (nsCSSMargin*)aDeclaration->GetData(kCSSMarginSID);
if (!ourMargin)
@ -2103,7 +2105,7 @@ MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& a
}
static nsresult
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSColor& aColor)
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataColor& aColor)
{
if (!aDecl)
return NS_OK;
@ -2153,7 +2155,7 @@ MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCS
}
static nsresult
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSTable& aTable)
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataTable& aTable)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2193,7 +2195,7 @@ MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCS
}
static nsresult
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSContent& aContent)
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataContent& aContent)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2224,7 +2226,7 @@ MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, ns
}
static nsresult
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSText& aText)
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataText& aText)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2273,7 +2275,7 @@ MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSS
}
static nsresult
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSDisplay& aDisplay)
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataDisplay& aDisplay)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
@ -2349,7 +2351,7 @@ MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, ns
}
static nsresult
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsCSSUserInterface& aUI)
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataUserInterface& aUI)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.

File diff suppressed because it is too large Load Diff

View File

@ -247,23 +247,23 @@ struct nsRuleData
nsIPresContext* mPresContext;
nsIStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback;
nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsCSSDisplay* mDisplayData;
nsCSSMargin* mMarginData;
nsCSSList* mListData;
nsCSSPosition* mPositionData;
nsCSSTable* mTableData;
nsCSSColor* mColorData;
nsCSSContent* mContentData;
nsCSSText* mTextData;
nsCSSUserInterface* mUIData;
nsRuleDataFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsRuleDataDisplay* mDisplayData;
nsRuleDataMargin* mMarginData;
nsRuleDataList* mListData;
nsRuleDataPosition* mPositionData;
nsRuleDataTable* mTableData;
nsRuleDataColor* mColorData;
nsRuleDataContent* mContentData;
nsRuleDataText* mTextData;
nsRuleDataUserInterface* mUIData;
#ifdef INCLUDE_XUL
nsCSSXUL* mXULData;
nsRuleDataXUL* mXULData;
#endif
#ifdef MOZ_SVG
nsCSSSVG* mSVGData;
nsRuleDataSVG* mSVGData;
#endif
nsRuleData(const nsStyleStructID& aSID, nsIPresContext* aContext, nsIStyleContext* aStyleContext)
@ -413,84 +413,84 @@ protected:
const nsStyleStruct* WalkRuleTree(const nsStyleStructID aSID, nsIStyleContext* aContext,
nsRuleData* aRuleData,
nsCSSStruct* aSpecificData,
nsRuleDataStruct* aSpecificData,
PRBool aComputeData);
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsCSSStruct& aDisplayData,
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsRuleDataStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsCSSStruct& aDisplayData,
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsRuleDataStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsCSSStruct& aFontData,
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsRuleDataStruct& aFontData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsCSSStruct& aColorData,
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsRuleDataStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsCSSStruct& aColorData,
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsRuleDataStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsCSSStruct& aMarginData,
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsRuleDataStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsCSSStruct& aListData,
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsRuleDataStruct& aListData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsCSSStruct& aPositionData,
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsRuleDataStruct& aPositionData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsRuleDataStruct& aTableData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsRuleDataStruct& aTableData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsCSSStruct& aData,
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsCSSStruct& aData,
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUserInterfaceData(nsStyleStruct* aStartData,
const nsCSSStruct& aData,
const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
PRBool aInherited);
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#ifdef INCLUDE_XUL
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsCSSStruct& aXULData,
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsRuleDataStruct& aXULData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#endif
#ifdef MOZ_SVG
const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsCSSStruct& aSVGData,
const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsRuleDataStruct& aSVGData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
@ -498,7 +498,7 @@ protected:
typedef const nsStyleStruct*
(nsRuleNode::*ComputeStyleDataFn)(nsStyleStruct* aStartStruct,
const nsCSSStruct& aStartData,
const nsRuleDataStruct& aStartData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
@ -506,7 +506,7 @@ protected:
static ComputeStyleDataFn gComputeStyleDataFn[];
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsCSSStruct& aCSSStruct);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
const nsStyleStruct* GetParentData(const nsStyleStructID aSID);
const nsStyleStruct* GetDisplayData(nsIStyleContext* aContext, PRBool aComputeData);

View File

@ -263,6 +263,7 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
(aFont1.sizeAdjust == aFont2.sizeAdjust) &&
(aFont1.style == aFont2.style) &&
(aFont1.variant == aFont2.variant) &&
(aFont1.familyNameQuirks == aFont2.familyNameQuirks) &&
(aFont1.weight == aFont2.weight) &&
(aFont1.name == aFont2.name)) {
if ((aFont1.decorations == aFont2.decorations)) {