diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index a2d4d11c8ba..47cee710293 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -572,7 +572,7 @@ nsCSSExpandedDataBlock::kOffsetTable[eCSSProperty_COUNT_no_shorthands] = { { offsetof(nsCSSExpandedDataBlock, m##datastruct_.member_), \ size_t(-1), \ size_t(-1) }, - #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) \ + #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) \ { offsetof(nsCSSExpandedDataBlock, m##datastruct_.member_), \ offsetof(nsRuleData, m##datastruct_##Data), \ offsetof(nsRuleData##datastruct_, member_) }, diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 0ed420a1ab5..630d78ec47f 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -80,6 +80,14 @@ keyword table member of class nsCSSProps, for use in nsCSSProps::LookupPropertyValue. + CSS_PROP_SHORTHAND only takes 1-4. + + CSS_PROP, which callers can define to get all the CSS_PROP_* macros + except CSS_PROP_SHORTHAND, also takes a ninth argument: + + 9. 'stylestruct_', the name of the style struct. Can be used to make + nsStyle##stylestruct_ and eStyleStruct_##stylestruct_ + ******/ @@ -103,35 +111,35 @@ #ifdef CSS_PROP #define USED_CSS_PROP -#define CSS_PROP_FONT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_COLOR(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_BACKGROUND(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_LIST(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_POSITION(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_TEXT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_TEXTRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_DISPLAY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_VISIBILITY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_CONTENT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_QUOTES(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_USERINTERFACE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_UIRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_TABLE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_TABLEBORDER(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_MARGIN(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_PADDING(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_BORDER(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_OUTLINE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_XUL(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_COLUMN(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_SVG(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) -#define CSS_PROP_SVGRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) +#define CSS_PROP_FONT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Font) +#define CSS_PROP_COLOR(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Color) +#define CSS_PROP_BACKGROUND(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Background) +#define CSS_PROP_LIST(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, List) +#define CSS_PROP_POSITION(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Position) +#define CSS_PROP_TEXT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Text) +#define CSS_PROP_TEXTRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, TextReset) +#define CSS_PROP_DISPLAY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Display) +#define CSS_PROP_VISIBILITY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Visibility) +#define CSS_PROP_CONTENT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Content) +#define CSS_PROP_QUOTES(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Quotes) +#define CSS_PROP_USERINTERFACE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, UserInterface) +#define CSS_PROP_UIRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, UIReset) +#define CSS_PROP_TABLE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Table) +#define CSS_PROP_TABLEBORDER(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, TableBorder) +#define CSS_PROP_MARGIN(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Margin) +#define CSS_PROP_PADDING(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Padding) +#define CSS_PROP_BORDER(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Border) +#define CSS_PROP_OUTLINE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Outline) +#define CSS_PROP_XUL(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, XUL) +#define CSS_PROP_COLUMN(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, Column) +#define CSS_PROP_SVG(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, SVG) +#define CSS_PROP_SVGRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, SVGReset) // For properties that are stored in the CSS backend but are not // computed. An includer may define this in addition to CSS_PROP, but // otherwise we treat it as the same. #ifndef CSS_PROP_BACKENDONLY -#define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) +#define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, BackendOnly) #define DEFINED_CSS_PROP_BACKENDONLY #endif diff --git a/layout/style/nsCSSProperty.h b/layout/style/nsCSSProperty.h index d9c348801e7..1f14a0b8e38 100644 --- a/layout/style/nsCSSProperty.h +++ b/layout/style/nsCSSProperty.h @@ -51,7 +51,7 @@ enum nsCSSProperty { eCSSProperty_UNKNOWN = -1, - #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eCSSProperty_##id_, + #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) eCSSProperty_##id_, #include "nsCSSPropList.h" #undef CSS_PROP diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 6e01db20a64..21390f3ce4b 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -59,7 +59,7 @@ extern const char* const kCSSRawProperties[]; // define an array of all CSS properties const char* const kCSSRawProperties[] = { -#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) #name_, +#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) #name_, #include "nsCSSPropList.h" #undef CSS_PROP #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_) #name_, @@ -1380,7 +1380,7 @@ nsCSSProps::ValueToKeyword(PRInt32 aValue, const PRInt32 aTable[]) /* static */ const PRInt32* const nsCSSProps::kKeywordTableTable[eCSSProperty_COUNT_no_shorthands] = { - #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) kwtable_, + #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) kwtable_, #include "nsCSSPropList.h" #undef CSS_PROP }; @@ -1420,70 +1420,24 @@ PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) // define array of all CSS property types const nsCSSType nsCSSProps::kTypeTable[eCSSProperty_COUNT_no_shorthands] = { - #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) type_, + #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) type_, #include "nsCSSPropList.h" #undef CSS_PROP }; const nsStyleStructID nsCSSProps::kSIDTable[eCSSProperty_COUNT_no_shorthands] = { - #define CSS_PROP_FONT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Font, - #define CSS_PROP_COLOR(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Color, - #define CSS_PROP_BACKGROUND(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Background, - #define CSS_PROP_LIST(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_List, - #define CSS_PROP_POSITION(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Position, - #define CSS_PROP_TEXT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Text, - #define CSS_PROP_TEXTRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_TextReset, - #define CSS_PROP_DISPLAY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Display, - #define CSS_PROP_VISIBILITY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Visibility, - #define CSS_PROP_CONTENT(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Content, - #define CSS_PROP_QUOTES(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Quotes, - #define CSS_PROP_USERINTERFACE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_UserInterface, - #define CSS_PROP_UIRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_UIReset, - #define CSS_PROP_TABLE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Table, - #define CSS_PROP_TABLEBORDER(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_TableBorder, - #define CSS_PROP_MARGIN(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Margin, - #define CSS_PROP_PADDING(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Padding, - #define CSS_PROP_BORDER(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Border, - #define CSS_PROP_OUTLINE(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Outline, - #define CSS_PROP_XUL(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_XUL, - #define CSS_PROP_SVG(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_SVG, - #define CSS_PROP_SVGRESET(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_SVGReset, - #define CSS_PROP_COLUMN(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_Column, - // Use the special BackendOnly style struct ID (which does need to - // be valid for storing in the nsCSSCompressedDataBlock::mStyleBits - // bitfield). - #define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) eStyleStruct_BackendOnly, + // Note that this uses the special BackendOnly style struct ID + // (which does need to be valid for storing in the + // nsCSSCompressedDataBlock::mStyleBits bitfield). + #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) eStyleStruct_##stylestruct_, #include "nsCSSPropList.h" - #undef CSS_PROP_FONT - #undef CSS_PROP_COLOR - #undef CSS_PROP_BACKGROUND - #undef CSS_PROP_LIST - #undef CSS_PROP_POSITION - #undef CSS_PROP_TEXT - #undef CSS_PROP_TEXTRESET - #undef CSS_PROP_DISPLAY - #undef CSS_PROP_VISIBILITY - #undef CSS_PROP_CONTENT - #undef CSS_PROP_QUOTES - #undef CSS_PROP_USERINTERFACE - #undef CSS_PROP_UIRESET - #undef CSS_PROP_TABLE - #undef CSS_PROP_TABLEBORDER - #undef CSS_PROP_MARGIN - #undef CSS_PROP_PADDING - #undef CSS_PROP_BORDER - #undef CSS_PROP_OUTLINE - #undef CSS_PROP_XUL - #undef CSS_PROP_SVG - #undef CSS_PROP_SVGRESET - #undef CSS_PROP_COLUMN - #undef CSS_PROP_BACKENDONLY + #undef CSS_PROP }; const PRUint32 nsCSSProps::kFlagsTable[eCSSProperty_COUNT] = { - #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) flags_, + #define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) flags_, #include "nsCSSPropList.h" #undef CSS_PROP #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_) flags_, diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index f668a4d7e2a..371d02c68f8 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -380,7 +380,7 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) // nsIDOMCSS2Properties // nsIDOMNSCSS2Properties -#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) \ +#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) \ NS_IMETHODIMP \ CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \ { \ @@ -395,16 +395,16 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) #define CSS_PROP_LIST_EXCLUDE_INTERNAL #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_) \ - CSS_PROP(name_, id_, method_, flags_, X, X, X, X) + CSS_PROP(name_, id_, method_, flags_, X, X, X, X, X) #include "nsCSSPropList.h" // Aliases -CSS_PROP(X, opacity, MozOpacity, 0, X, X, X, X) -CSS_PROP(X, outline, MozOutline, 0, X, X, X, X) -CSS_PROP(X, outline_color, MozOutlineColor, 0, X, X, X, X) -CSS_PROP(X, outline_style, MozOutlineStyle, 0, X, X, X, X) -CSS_PROP(X, outline_width, MozOutlineWidth, 0, X, X, X, X) -CSS_PROP(X, outline_offset, MozOutlineOffset, 0, X, X, X, X) +CSS_PROP(X, opacity, MozOpacity, 0, X, X, X, X, X) +CSS_PROP(X, outline, MozOutline, 0, X, X, X, X, X) +CSS_PROP(X, outline_color, MozOutlineColor, 0, X, X, X, X, X) +CSS_PROP(X, outline_style, MozOutlineStyle, 0, X, X, X, X, X) +CSS_PROP(X, outline_width, MozOutlineWidth, 0, X, X, X, X, X) +CSS_PROP(X, outline_offset, MozOutlineOffset, 0, X, X, X, X, X) #undef CSS_PROP_SHORTHAND #undef CSS_PROP_LIST_EXCLUDE_INTERNAL diff --git a/layout/style/test/ListCSSProperties.cpp b/layout/style/test/ListCSSProperties.cpp index 48a20d845b4..dce3f83452c 100644 --- a/layout/style/test/ListCSSProperties.cpp +++ b/layout/style/test/ListCSSProperties.cpp @@ -48,7 +48,7 @@ struct PropertyInfo { const PropertyInfo gLonghandProperties[] = { -#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) \ +#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) \ { #name_, #method_ }, #include "nsCSSPropList.h" @@ -65,7 +65,7 @@ const PropertyInfo gLonghandProperties[] = { const char* gLonghandPropertiesWithDOMProp[] = { #define CSS_PROP_LIST_EXCLUDE_INTERNAL -#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_) \ +#define CSS_PROP(name_, id_, method_, flags_, datastruct_, member_, type_, kwtable_, stylestruct_) \ #name_, #include "nsCSSPropList.h"