Put more information on the CSS properties in nsCSSPropList.h.

Use the property list in the tables for nsRuleNode::CheckSpecifiedProperties.
To reduce heap usage, redesign the storage of properties and values in nsCSSDeclaration to allocate all property-value pairs in a declaration block in a single allocation, and use temporary structures (like the old permanent structures) during parsing and modification.  Replace per-property switch statements in nsCSSDeclaration with table-based code to reduce code size.
b=125246  r+sr=bzbarsky
This commit is contained in:
dbaron%dbaron.org 2003-06-07 22:14:42 +00:00
Родитель a0cac9ffd2
Коммит f3a00bc53b
51 изменённых файлов: 7767 добавлений и 13508 удалений

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

@ -677,25 +677,12 @@ nsRuleNode::PropagateDependentBit(PRUint32 aBit, nsRuleNode* aHighestNode)
/* the information for a property (or in some cases, a rect group of
properties) */
// for PropertyCheckData::type
// XXX Would bits be more efficient?
#define CHECKDATA_VALUE 0
#define CHECKDATA_RECT 1
#define CHECKDATA_VALUELIST 2
#define CHECKDATA_COUNTERDATA 3
#define CHECKDATA_QUOTES 4
#define CHECKDATA_SHADOW 5
#define CHECKDATA_VALUELIST_ARRAY 6
struct PropertyCheckData {
size_t offset;
PRUint16 type;
nsCSSType type;
PRPackedBool mayHaveExplicitInherit;
};
#define CHECKDATA_PROP(_datastruct, _member, _type, _iscoord) \
{ offsetof(_datastruct, _member), _type, _iscoord }
/* the information for all the properties in a style struct */
typedef nsRuleNode::RuleDetail
@ -813,176 +800,161 @@ CheckFontCallback(const nsRuleDataStruct& aData)
return nsRuleNode::eRuleUnknown;
}
// for nsCSSPropList.h, so we get information on things in the style
// structs but not nsCSS*
#define CSS_PROP_INCLUDE_NOT_CSS
static const PropertyCheckData FontCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataFont, mFamily, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mStyle, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mVariant, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mWeight, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mSize, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mSizeAdjust, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_FONT
};
static const PropertyCheckData DisplayCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataDisplay, mAppearance, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mClip, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mDisplay, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mBinding, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mPosition, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mFloat, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mClear, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mOverflow, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mBreakBefore, CHECKDATA_VALUE, PR_FALSE), // temp fix for bug 2400
CHECKDATA_PROP(nsRuleDataDisplay, mBreakAfter, CHECKDATA_VALUE, PR_FALSE) // temp fix for bug 2400
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_DISPLAY
};
static const PropertyCheckData VisibilityCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataDisplay, mVisibility, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mDirection, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mLang, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mOpacity, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_VISIBILITY
};
static const PropertyCheckData MarginCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mMargin, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_MARGIN
};
static const PropertyCheckData BorderCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mBorderWidth, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderStyle, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderColor, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderRadius, CHECKDATA_RECT, PR_TRUE),
CHECKDATA_PROP(nsRuleDataMargin, mFloatEdge, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderColors, CHECKDATA_VALUELIST_ARRAY, PR_FALSE)
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_BORDER
};
static const PropertyCheckData PaddingCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mPadding, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_PADDING
};
static const PropertyCheckData OutlineCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mOutlineColor, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mOutlineWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataMargin, mOutlineStyle, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mOutlineRadius, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_OUTLINE
};
static const PropertyCheckData ListCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataList, mType, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataList, mImage, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataList, mPosition, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataList, mImageRegion, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_LIST
};
static const PropertyCheckData ColorCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataColor, mColor, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_COLOR
};
static const PropertyCheckData BackgroundCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataColor, mBackAttachment, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackRepeat, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackClip, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackColor, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackImage, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackInlinePolicy, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackOrigin, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackPositionX, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackPositionY, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_BACKGROUND
};
static const PropertyCheckData PositionCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataPosition, mOffset, CHECKDATA_RECT, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMinWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMaxWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMinHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMaxHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mBoxSizing, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataPosition, mZIndex, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_POSITION
};
static const PropertyCheckData TableCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataTable, mLayout, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mFrame, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mRules, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mCols, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mSpan, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TABLE
};
static const PropertyCheckData TableBorderCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataTable, mBorderCollapse, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mBorderSpacingX, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mBorderSpacingY, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mCaptionSide, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mEmptyCells, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TABLEBORDER
};
static const PropertyCheckData ContentCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataContent, mContent, CHECKDATA_VALUELIST, PR_FALSE),
CHECKDATA_PROP(nsRuleDataContent, mMarkerOffset, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataContent, mCounterIncrement, CHECKDATA_COUNTERDATA, PR_FALSE),
CHECKDATA_PROP(nsRuleDataContent, mCounterReset, CHECKDATA_COUNTERDATA, PR_FALSE)
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_CONTENT
};
static const PropertyCheckData QuotesCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataContent, mQuotes, CHECKDATA_QUOTES, PR_FALSE)
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_QUOTES
};
static const PropertyCheckData TextCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataText, mLineHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mTextIndent, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mWordSpacing, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mLetterSpacing, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mTextAlign, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataText, mTextTransform, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataText, mWhiteSpace, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TEXT
};
static const PropertyCheckData TextResetCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataText, mDecoration, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataText, mVerticalAlign, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mUnicodeBidi, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TEXTRESET
};
static const PropertyCheckData UserInterfaceCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataUserInterface, mUserInput, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mUserModify, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mUserFocus, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mCursor, CHECKDATA_VALUELIST, PR_FALSE)
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_USERINTERFACE
};
static const PropertyCheckData UIResetCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataUserInterface, mUserSelect, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mResizer, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mKeyEquivalent, CHECKDATA_VALUELIST, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mForceBrokenImageIcon, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_UIRESET
};
static const PropertyCheckData XULCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataXUL, mBoxAlign, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxDirection, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxFlex, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxOrient, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxPack, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxOrdinal, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_XUL
};
#ifdef MOZ_SVG
static const PropertyCheckData SVGCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataSVG, mFill, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mFillOpacity, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mFillRule, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStroke, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeDasharray, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeDashoffset, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeLinecap, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeLinejoin, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeMiterlimit, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeOpacity, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeWidth, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_SVG
};
#endif
#undef CSS_PROP_INCLUDE_NOT_CSS
static const StructCheckData gCheckProperties[] = {
#define STYLE_STRUCT(name, checkdata_cb, ctor_args) \
@ -1009,7 +981,7 @@ ValueAtOffset(const nsRuleDataStruct& aRuleDataStruct, size_t aOffset)
inline const nsCSSRect*
RectAtOffset(const nsRuleDataStruct& aRuleDataStruct, size_t aOffset)
{
return * NS_REINTERPRET_CAST(const nsCSSRect*const*,
return NS_REINTERPRET_CAST(const nsCSSRect*,
NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}
@ -1065,7 +1037,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
++prop)
switch (prop->type) {
case CHECKDATA_VALUE:
case eCSSType_Value:
{
++total;
const nsCSSValue& value = ValueAtOffset(aRuleDataStruct, prop->offset);
@ -1080,7 +1052,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_RECT:
case eCSSType_Rect:
total += 4;
if (prop->mayHaveExplicitInherit)
ExamineRectCoordProperties(RectAtOffset(aRuleDataStruct, prop->offset),
@ -1091,7 +1063,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
specified, inherited);
break;
case CHECKDATA_VALUELIST:
case eCSSType_ValueList:
{
++total;
const nsCSSValueList* valueList =
@ -1107,7 +1079,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_COUNTERDATA:
case eCSSType_CounterData:
{
++total;
NS_ASSERTION(!prop->mayHaveExplicitInherit,
@ -1123,7 +1095,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_QUOTES:
case eCSSType_Quotes:
{
++total;
NS_ASSERTION(!prop->mayHaveExplicitInherit,
@ -1139,27 +1111,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_VALUELIST_ARRAY:
{
total += 4;
const nsCSSValueList** valueArray =
ValueListArrayAtOffset(aRuleDataStruct, prop->offset);
if (valueArray) {
for (PRInt32 i = 0; i < 4; i++) {
const nsCSSValueList* valList = valueArray[i];
if (valList) {
++specified;
if (eCSSUnit_Inherit == valList->mValue.GetUnit()) {
++inherited;
NS_ASSERTION(!prop->mayHaveExplicitInherit, "Value list arrays can't inherit!");
}
}
}
}
}
break;
case CHECKDATA_SHADOW:
case eCSSType_Shadow:
NS_NOTYETIMPLEMENTED("nsCSSShadow not yet transferred to structs");
break;
@ -1202,11 +1154,7 @@ nsRuleNode::GetDisplayData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Display, mPresContext, aContext);
ruleData.mDisplayData = &displayData;
nsCSSRect clip;
displayData.mClip = &clip;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData, aComputeData);
displayData.mClip = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData, aComputeData);
}
const nsStyleStruct*
@ -1244,7 +1192,7 @@ nsRuleNode::GetUserInterfaceData(nsStyleContext* aContext, PRBool aComputeData)
{
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(eStyleStruct_UserInterface, mPresContext, aContext);
ruleData.mUIData = &uiData;
ruleData.mUserInterfaceData = &uiData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UserInterface, aContext, &ruleData, &uiData, aComputeData);
uiData.mCursor = nsnull;
@ -1256,7 +1204,7 @@ nsRuleNode::GetUIResetData(nsStyleContext* aContext, PRBool aComputeData)
{
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(eStyleStruct_UIReset, mPresContext, aContext);
ruleData.mUIData = &uiData;
ruleData.mUserInterfaceData = &uiData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UIReset, aContext, &ruleData, &uiData, aComputeData);
uiData.mKeyEquivalent = nsnull;
@ -1300,13 +1248,7 @@ nsRuleNode::GetMarginData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Margin, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect margin;
marginData.mMargin = &margin;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData, aComputeData);
marginData.mMargin = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1316,27 +1258,7 @@ nsRuleNode::GetBorderData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Border, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect borderWidth;
nsCSSRect borderColor;
nsCSSRect borderStyle;
nsCSSRect borderRadius;
nsCSSValueList* borderColors[4];
for (PRInt32 i = 0; i < 4; i++)
borderColors[i] = nsnull;
marginData.mBorderWidth = &borderWidth;
marginData.mBorderColor = &borderColor;
marginData.mBorderStyle = &borderStyle;
marginData.mBorderRadius = &borderRadius;
marginData.mBorderColors = borderColors;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData, aComputeData);
marginData.mBorderWidth = marginData.mBorderColor = marginData.mBorderStyle = marginData.mBorderRadius = nsnull;
marginData.mBorderColors = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1346,13 +1268,7 @@ nsRuleNode::GetPaddingData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Padding, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect padding;
marginData.mPadding = &padding;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData, aComputeData);
marginData.mPadding = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1362,13 +1278,7 @@ nsRuleNode::GetOutlineData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Outline, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect outlineRadius;
marginData.mOutlineRadius = &outlineRadius;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData, aComputeData);
marginData.mOutlineRadius = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1378,12 +1288,7 @@ nsRuleNode::GetListData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_List, mPresContext, aContext);
ruleData.mListData = &listData;
nsCSSRect imageRegion;
listData.mImageRegion = &imageRegion;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData, aComputeData);
listData.mImageRegion = nsnull;
return res;
return WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData, aComputeData);
}
const nsStyleStruct*
@ -1393,12 +1298,7 @@ nsRuleNode::GetPositionData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Position, mPresContext, aContext);
ruleData.mPositionData = &posData;
nsCSSRect offset;
posData.mOffset = &offset;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData, aComputeData);
posData.mOffset = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData, aComputeData);
}
const nsStyleStruct*
@ -2796,8 +2696,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
}
// clip property: length, auto, inherit
if (nsnull != displayData.mClip) {
if (eCSSUnit_Inherit == displayData.mClip->mTop.GetUnit()) { // if one is inherit, they all are
if (eCSSUnit_Inherit == displayData.mClip.mTop.GetUnit()) { // if one is inherit, they all are
inherited = PR_TRUE;
display->mClipFlags = parentDisplay->mClipFlags;
display->mClip = parentDisplay->mClip;
@ -2807,37 +2706,37 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mClipFlags = 0; // clear it
if (eCSSUnit_Auto == displayData.mClip->mTop.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mTop.GetUnit()) {
display->mClip.y = 0;
display->mClipFlags |= NS_STYLE_CLIP_TOP_AUTO;
}
else if (displayData.mClip->mTop.IsLengthUnit()) {
display->mClip.y = CalcLength(displayData.mClip->mTop, nsnull, aContext, mPresContext, inherited);
else if (displayData.mClip.mTop.IsLengthUnit()) {
display->mClip.y = CalcLength(displayData.mClip.mTop, nsnull, aContext, mPresContext, inherited);
fullAuto = PR_FALSE;
}
if (eCSSUnit_Auto == displayData.mClip->mBottom.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mBottom.GetUnit()) {
display->mClip.height = 0;
display->mClipFlags |= NS_STYLE_CLIP_BOTTOM_AUTO;
}
else if (displayData.mClip->mBottom.IsLengthUnit()) {
display->mClip.height = CalcLength(displayData.mClip->mBottom, nsnull, aContext, mPresContext, inherited) -
else if (displayData.mClip.mBottom.IsLengthUnit()) {
display->mClip.height = CalcLength(displayData.mClip.mBottom, nsnull, aContext, mPresContext, inherited) -
display->mClip.y;
fullAuto = PR_FALSE;
}
if (eCSSUnit_Auto == displayData.mClip->mLeft.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mLeft.GetUnit()) {
display->mClip.x = 0;
display->mClipFlags |= NS_STYLE_CLIP_LEFT_AUTO;
}
else if (displayData.mClip->mLeft.IsLengthUnit()) {
display->mClip.x = CalcLength(displayData.mClip->mLeft, nsnull, aContext, mPresContext, inherited);
else if (displayData.mClip.mLeft.IsLengthUnit()) {
display->mClip.x = CalcLength(displayData.mClip.mLeft, nsnull, aContext, mPresContext, inherited);
fullAuto = PR_FALSE;
}
if (eCSSUnit_Auto == displayData.mClip->mRight.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mRight.GetUnit()) {
display->mClip.width = 0;
display->mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO;
}
else if (displayData.mClip->mRight.IsLengthUnit()) {
display->mClip.width = CalcLength(displayData.mClip->mRight, nsnull, aContext, mPresContext, inherited) -
else if (displayData.mClip.mRight.IsLengthUnit()) {
display->mClip.width = CalcLength(displayData.mClip.mRight, nsnull, aContext, mPresContext, inherited) -
display->mClip.x;
fullAuto = PR_FALSE;
}
@ -2849,7 +2748,6 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mClipFlags |= NS_STYLE_CLIP_RECT;
}
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3257,21 +3155,6 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
return bg;
}
typedef nsCSSValue nsCSSRect::*CSSRectSide;
#if (NS_SIDE_TOP != 0) || (NS_SIDE_RIGHT != 1) || (NS_SIDE_BOTTOM != 2) || (NS_SIDE_LEFT != 3)
#error "Somebody changed the side constants."
#endif
static const CSSRectSide gCSSSides[] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
const nsStyleStruct*
nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
const nsRuleDataStruct& aData,
@ -3299,17 +3182,16 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// margin: length, percent, auto, inherit
if (marginData.mMargin) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
parentMargin->mMargin.Get(side, parentCoord);
if (SetCoord(marginData.mMargin->*(gCSSSides[side]), coord, parentCoord,
SETCOORD_LPAH, aContext, mPresContext, inherited)) {
if (SetCoord(marginData.mMargin.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
aContext, mPresContext, inherited)) {
margin->mMargin.Set(side, coord);
}
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3355,11 +3237,10 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// border-size: length, enum, inherit
if (marginData.mBorderWidth) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
const nsCSSValue &value = marginData.mBorderWidth->*(gCSSSides[side]);
const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]);
if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext,
mPresContext, inherited))
border->mBorder.Set(side, coord);
@ -3368,13 +3249,11 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
border->mBorder.Set(side, parentBorder->mBorder.Get(side, coord));
}
}
}
// border-style: enum, none, inhert
if (nsnull != marginData.mBorderStyle) {
nsCSSRect* ourStyle = marginData.mBorderStyle;
const nsCSSRect& ourStyle = marginData.mBorderStyle;
FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourStyle->*(gCSSSides[side]);
const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
nsCSSUnit unit = value.GetUnit();
if (eCSSUnit_Enumerated == unit) {
border->SetBorderStyle(side, value.GetIntValue());
@ -3387,42 +3266,37 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
border->SetBorderStyle(side, parentBorder->GetBorderStyle(side));
}
}
}
// border-colors: color, string, enum
if (marginData.mBorderColors) {
nscolor borderColor;
nscolor unused = NS_RGB(0,0,0);
for (PRInt32 i = 0; i < 4; i++) {
if (marginData.mBorderColors[i]) {
FOR_CSS_SIDES(side) {
nsCSSValueList* list =
marginData.mBorderColors.*(nsCSSValueListRect::sides[side]);
if (list) {
// Some composite border color information has been specified for this
// border side.
border->EnsureBorderColors();
border->ClearBorderColors(i);
nsCSSValueList* list = marginData.mBorderColors[i];
border->ClearBorderColors(side);
while (list) {
if (SetColor(list->mValue, unused, mPresContext, borderColor, inherited))
border->AppendBorderColor(i, borderColor, PR_FALSE);
border->AppendBorderColor(side, borderColor, PR_FALSE);
else if (eCSSUnit_Enumerated == list->mValue.GetUnit() &&
NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue())
border->AppendBorderColor(i, nsnull, PR_TRUE);
border->AppendBorderColor(side, nsnull, PR_TRUE);
list = list->mNext;
}
}
}
}
// border-color: color, string, enum, inherit
if (nsnull != marginData.mBorderColor) {
nsCSSRect* ourBorderColor = marginData.mBorderColor;
nscolor borderColor;
nscolor unused = NS_RGB(0,0,0);
const nsCSSRect& ourBorderColor = marginData.mBorderColor;
PRBool transparent;
PRBool foreground;
FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourBorderColor->*(gCSSSides[side]);
const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]);
if (eCSSUnit_Inherit == value.GetUnit()) {
inherited = PR_TRUE;
parentBorder->GetBorderColor(side, borderColor,
@ -3453,20 +3327,15 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
}
}
}
}
// -moz-border-radius: length, percent, inherit
if (marginData.mBorderRadius) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
parentBorder->mBorderRadius.Get(side, parentCoord);
if (SetCoord(marginData.mBorderRadius->*(gCSSSides[side]), coord,
if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord,
parentCoord, SETCOORD_LPH, aContext, mPresContext,
inherited))
border->mBorderRadius.Set(side, coord);
}
}
// float-edge: enum, inherit
if (eCSSUnit_Enumerated == marginData.mFloatEdge.GetUnit())
@ -3520,17 +3389,16 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// padding: length, percent, inherit
if (marginData.mPadding) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
parentPadding->mPadding.Get(side, parentCoord);
if (SetCoord(marginData.mPadding->*(gCSSSides[side]), coord, parentCoord,
SETCOORD_LPH, aContext, mPresContext, inherited)) {
if (SetCoord(marginData.mPadding.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPH,
aContext, mPresContext, inherited)) {
padding->mPadding.Set(side, coord);
}
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3691,35 +3559,33 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
}
// image region property: length, auto, inherit
if (listData.mImageRegion) {
if (eCSSUnit_Inherit == listData.mImageRegion->mTop.GetUnit()) { // if one is inherit, they all are
if (eCSSUnit_Inherit == listData.mImageRegion.mTop.GetUnit()) { // if one is inherit, they all are
inherited = PR_TRUE;
list->mImageRegion = parentList->mImageRegion;
}
else {
if (eCSSUnit_Auto == listData.mImageRegion->mTop.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mTop.GetUnit())
list->mImageRegion.y = 0;
else if (listData.mImageRegion->mTop.IsLengthUnit())
list->mImageRegion.y = CalcLength(listData.mImageRegion->mTop, nsnull, aContext, mPresContext, inherited);
else if (listData.mImageRegion.mTop.IsLengthUnit())
list->mImageRegion.y = CalcLength(listData.mImageRegion.mTop, nsnull, aContext, mPresContext, inherited);
if (eCSSUnit_Auto == listData.mImageRegion->mBottom.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mBottom.GetUnit())
list->mImageRegion.height = 0;
else if (listData.mImageRegion->mBottom.IsLengthUnit())
list->mImageRegion.height = CalcLength(listData.mImageRegion->mBottom, nsnull, aContext,
else if (listData.mImageRegion.mBottom.IsLengthUnit())
list->mImageRegion.height = CalcLength(listData.mImageRegion.mBottom, nsnull, aContext,
mPresContext, inherited) - list->mImageRegion.y;
if (eCSSUnit_Auto == listData.mImageRegion->mLeft.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mLeft.GetUnit())
list->mImageRegion.x = 0;
else if (listData.mImageRegion->mLeft.IsLengthUnit())
list->mImageRegion.x = CalcLength(listData.mImageRegion->mLeft, nsnull, aContext, mPresContext, inherited);
else if (listData.mImageRegion.mLeft.IsLengthUnit())
list->mImageRegion.x = CalcLength(listData.mImageRegion.mLeft, nsnull, aContext, mPresContext, inherited);
if (eCSSUnit_Auto == listData.mImageRegion->mRight.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mRight.GetUnit())
list->mImageRegion.width = 0;
else if (listData.mImageRegion->mRight.IsLengthUnit())
list->mImageRegion.width = CalcLength(listData.mImageRegion->mRight, nsnull, aContext, mPresContext, inherited) -
else if (listData.mImageRegion.mRight.IsLengthUnit())
list->mImageRegion.width = CalcLength(listData.mImageRegion.mRight, nsnull, aContext, mPresContext, inherited) -
list->mImageRegion.x;
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3764,24 +3630,14 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// box offsets: length, percent, auto, inherit
if (posData.mOffset) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
parentPos->mOffset.GetTop(parentCoord);
if (SetCoord(posData.mOffset->mTop, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetTop(coord);
}
parentPos->mOffset.GetRight(parentCoord);
if (SetCoord(posData.mOffset->mRight, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetRight(coord);
}
parentPos->mOffset.GetBottom(parentCoord);
if (SetCoord(posData.mOffset->mBottom, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetBottom(coord);
}
parentPos->mOffset.GetLeft(parentCoord);
if (SetCoord(posData.mOffset->mLeft, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetLeft(coord);
FOR_CSS_SIDES(side) {
parentPos->mOffset.Get(side, parentCoord);
if (SetCoord(posData.mOffset.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
aContext, mPresContext, inherited)) {
pos->mOffset.Set(side, coord);
}
}

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

@ -44,6 +44,7 @@
#include "nsICSSParser.h"
#include "nsICSSLoader.h"
#include "nsICSSStyleRule.h"
#include "nsCSSStruct.h"
#include "nsCSSDeclaration.h"
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
@ -3289,11 +3290,11 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsIHTMLMappedAttributes*
hval.SetPercentValue(value.GetPercentValue());
if (hval.GetUnit() != eCSSUnit_Null) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft = hval;
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight = hval;
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft = hval;
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight = hval;
}
// vspace: value
@ -3305,11 +3306,11 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsIHTMLMappedAttributes*
vval.SetPercentValue(value.GetPercentValue());
if (vval.GetUnit() != eCSSUnit_Null) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mTop.GetUnit() == eCSSUnit_Null)
margin->mTop = vval;
if (margin->mBottom.GetUnit() == eCSSUnit_Null)
margin->mBottom = vval;
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mTop.GetUnit() == eCSSUnit_Null)
margin.mTop = vval;
if (margin.mBottom.GetUnit() == eCSSUnit_Null)
margin.mBottom = vval;
}
}
@ -3360,35 +3361,35 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes*
nscoord val = value.GetPixelValue();
nsCSSRect* borderWidth = aData->mMarginData->mBorderWidth;
if (borderWidth->mLeft.GetUnit() == eCSSUnit_Null)
borderWidth->mLeft.SetFloatValue((float)val, eCSSUnit_Pixel);
if (borderWidth->mTop.GetUnit() == eCSSUnit_Null)
borderWidth->mTop.SetFloatValue((float)val, eCSSUnit_Pixel);
if (borderWidth->mRight.GetUnit() == eCSSUnit_Null)
borderWidth->mRight.SetFloatValue((float)val, eCSSUnit_Pixel);
if (borderWidth->mBottom.GetUnit() == eCSSUnit_Null)
borderWidth->mBottom.SetFloatValue((float)val, eCSSUnit_Pixel);
nsCSSRect& borderWidth = aData->mMarginData->mBorderWidth;
if (borderWidth.mLeft.GetUnit() == eCSSUnit_Null)
borderWidth.mLeft.SetFloatValue((float)val, eCSSUnit_Pixel);
if (borderWidth.mTop.GetUnit() == eCSSUnit_Null)
borderWidth.mTop.SetFloatValue((float)val, eCSSUnit_Pixel);
if (borderWidth.mRight.GetUnit() == eCSSUnit_Null)
borderWidth.mRight.SetFloatValue((float)val, eCSSUnit_Pixel);
if (borderWidth.mBottom.GetUnit() == eCSSUnit_Null)
borderWidth.mBottom.SetFloatValue((float)val, eCSSUnit_Pixel);
nsCSSRect* borderStyle = aData->mMarginData->mBorderStyle;
if (borderStyle->mLeft.GetUnit() == eCSSUnit_Null)
borderStyle->mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
if (borderStyle->mTop.GetUnit() == eCSSUnit_Null)
borderStyle->mTop.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
if (borderStyle->mRight.GetUnit() == eCSSUnit_Null)
borderStyle->mRight.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
if (borderStyle->mBottom.GetUnit() == eCSSUnit_Null)
borderStyle->mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
nsCSSRect& borderStyle = aData->mMarginData->mBorderStyle;
if (borderStyle.mLeft.GetUnit() == eCSSUnit_Null)
borderStyle.mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
if (borderStyle.mTop.GetUnit() == eCSSUnit_Null)
borderStyle.mTop.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
if (borderStyle.mRight.GetUnit() == eCSSUnit_Null)
borderStyle.mRight.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
if (borderStyle.mBottom.GetUnit() == eCSSUnit_Null)
borderStyle.mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_SOLID, eCSSUnit_Enumerated);
nsCSSRect* borderColor = aData->mMarginData->mBorderColor;
if (borderColor->mLeft.GetUnit() == eCSSUnit_Null)
borderColor->mLeft.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
if (borderColor->mTop.GetUnit() == eCSSUnit_Null)
borderColor->mTop.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
if (borderColor->mRight.GetUnit() == eCSSUnit_Null)
borderColor->mRight.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
if (borderColor->mBottom.GetUnit() == eCSSUnit_Null)
borderColor->mBottom.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
nsCSSRect& borderColor = aData->mMarginData->mBorderColor;
if (borderColor.mLeft.GetUnit() == eCSSUnit_Null)
borderColor.mLeft.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
if (borderColor.mTop.GetUnit() == eCSSUnit_Null)
borderColor.mTop.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
if (borderColor.mRight.GetUnit() == eCSSUnit_Null)
borderColor.mRight.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
if (borderColor.mBottom.GetUnit() == eCSSUnit_Null)
borderColor.mBottom.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
}
void

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

@ -177,22 +177,22 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
if (eHTMLUnit_Pixel == value.GetUnit()) {
bodyMarginWidth = value.GetPixelValue();
if (bodyMarginWidth < 0) bodyMarginWidth = 0;
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel);
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel);
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel);
}
mPart->GetHTMLAttribute(nsHTMLAtoms::marginheight, value);
if (eHTMLUnit_Pixel == value.GetUnit()) {
bodyMarginHeight = value.GetPixelValue();
if (bodyMarginHeight < 0) bodyMarginHeight = 0;
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mTop.GetUnit() == eCSSUnit_Null)
margin->mTop.SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel);
if (margin->mBottom.GetUnit() == eCSSUnit_Null)
margin->mBottom.SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mTop.GetUnit() == eCSSUnit_Null)
margin.mTop.SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel);
if (margin.mBottom.GetUnit() == eCSSUnit_Null)
margin.mBottom.SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel);
}
if (eCompatibility_NavQuirks == mode){
@ -201,9 +201,9 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
if (eHTMLUnit_Pixel == value.GetUnit()) {
bodyTopMargin = value.GetPixelValue();
if (bodyTopMargin < 0) bodyTopMargin = 0;
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mTop.GetUnit() == eCSSUnit_Null)
margin->mTop.SetFloatValue((float)bodyTopMargin, eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mTop.GetUnit() == eCSSUnit_Null)
margin.mTop.SetFloatValue((float)bodyTopMargin, eCSSUnit_Pixel);
}
// leftmargin (IE-attribute)
@ -211,9 +211,9 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
if (eHTMLUnit_Pixel == value.GetUnit()) {
bodyLeftMargin = value.GetPixelValue();
if (bodyLeftMargin < 0) bodyLeftMargin = 0;
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetFloatValue((float)bodyLeftMargin, eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetFloatValue((float)bodyLeftMargin, eCSSUnit_Pixel);
}
}
@ -245,19 +245,19 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
}
if ((bodyMarginWidth == -1) && (frameMarginWidth >= 0)) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel);
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel);
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel);
}
if ((bodyMarginHeight == -1) && (frameMarginHeight >= 0)) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mTop.GetUnit() == eCSSUnit_Null)
margin->mTop.SetFloatValue((float)frameMarginHeight, eCSSUnit_Pixel);
if (margin->mBottom.GetUnit() == eCSSUnit_Null)
margin->mBottom.SetFloatValue((float)frameMarginHeight, eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mTop.GetUnit() == eCSSUnit_Null)
margin.mTop.SetFloatValue((float)frameMarginHeight, eCSSUnit_Pixel);
if (margin.mBottom.GetUnit() == eCSSUnit_Null)
margin.mBottom.SetFloatValue((float)frameMarginHeight, eCSSUnit_Pixel);
}
}
}

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

@ -219,7 +219,7 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
return;
if (aData->mSID == eStyleStruct_Margin) {
nsCSSRect* margin = aData->mMarginData->mMargin;
nsCSSRect& margin = aData->mMarginData->mMargin;
nsHTMLValue value;
// align: enum
aAttributes->GetAttribute(nsHTMLAtoms::align, value);
@ -227,22 +227,22 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
// Map align attribute into auto side margins
switch (value.GetIntValue()) {
case NS_STYLE_TEXT_ALIGN_LEFT:
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetAutoValue();
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetAutoValue();
break;
case NS_STYLE_TEXT_ALIGN_RIGHT:
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetAutoValue();
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetAutoValue();
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetFloatValue(0.0f, eCSSUnit_Pixel);
break;
case NS_STYLE_TEXT_ALIGN_CENTER:
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetAutoValue();
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetAutoValue();
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetAutoValue();
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetAutoValue();
break;
}
}

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

@ -463,14 +463,14 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (NS_STYLE_FRAME_0 == frameborder ||
NS_STYLE_FRAME_NO == frameborder ||
NS_STYLE_FRAME_OFF == frameborder) {
if (aData->mMarginData->mBorderWidth->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mLeft.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mRight.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mTop.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mBottom.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mLeft.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mRight.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mTop.SetFloatValue(0.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mBottom.SetFloatValue(0.0f, eCSSUnit_Pixel);
}
}
}

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

@ -1100,14 +1100,14 @@ MapTableFrameInto(const nsIHTMLMappedAttributes* aAttributes,
return;
// set up defaults
if (aData->mMarginData->mBorderStyle->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mRight.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mTop.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mRight.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mTop.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(aBorderStyle, eCSSUnit_Enumerated);
nsHTMLValue frameValue;
// 0 out the sides that we want to hide based on the frame attribute
@ -1118,38 +1118,38 @@ MapTableFrameInto(const nsIHTMLMappedAttributes* aAttributes,
switch (frameValue.GetIntValue())
{
case NS_STYLE_TABLE_FRAME_NONE:
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
case NS_STYLE_TABLE_FRAME_ABOVE:
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
case NS_STYLE_TABLE_FRAME_BELOW:
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
case NS_STYLE_TABLE_FRAME_HSIDES:
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
case NS_STYLE_TABLE_FRAME_LEFT:
aData->mMarginData->mBorderStyle->mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mRight.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
case NS_STYLE_TABLE_FRAME_RIGHT:
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
case NS_STYLE_TABLE_FRAME_VSIDES:
aData->mMarginData->mBorderStyle->mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mTop.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
break;
// BOX and BORDER are ignored, the caller has already set all the border sides
// any illegal value is also ignored
@ -1207,14 +1207,14 @@ MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes,
if (aData->mMarginData) {
// by default, set all border sides to the specified width
if (aData->mMarginData->mBorderWidth->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mLeft.SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mRight.SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mTop .SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mBottom.SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mLeft.SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mRight.SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mTop .SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mBottom.SetFloatValue((float)borderThickness, eCSSUnit_Pixel);
// now account for the frame attribute
MapTableFrameInto(aAttributes, aData, aBorderStyle);
@ -1297,11 +1297,11 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Enumerated) {
if ((NS_STYLE_TEXT_ALIGN_CENTER == value.GetIntValue()) ||
(NS_STYLE_TEXT_ALIGN_MOZ_CENTER == value.GetIntValue())) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetAutoValue();
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetAutoValue();
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetAutoValue();
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetAutoValue();
}
}
@ -1312,21 +1312,21 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
aAttributes->GetAttribute(nsHTMLAtoms::hspace, value);
if (value.GetUnit() == eHTMLUnit_Pixel) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mLeft.GetUnit() == eCSSUnit_Null)
margin->mLeft.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
if (margin->mRight.GetUnit() == eCSSUnit_Null)
margin->mRight.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mLeft.GetUnit() == eCSSUnit_Null)
margin.mLeft.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
if (margin.mRight.GetUnit() == eCSSUnit_Null)
margin.mRight.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
}
aAttributes->GetAttribute(nsHTMLAtoms::vspace, value);
if (value.GetUnit() == eHTMLUnit_Pixel) {
nsCSSRect* margin = aData->mMarginData->mMargin;
if (margin->mTop.GetUnit() == eCSSUnit_Null)
margin->mTop.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
if (margin->mBottom.GetUnit() == eCSSUnit_Null)
margin->mBottom.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
nsCSSRect& margin = aData->mMarginData->mMargin;
if (margin.mTop.GetUnit() == eCSSUnit_Null)
margin.mTop.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
if (margin.mBottom.GetUnit() == eCSSUnit_Null)
margin.mBottom.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
}
}
}
@ -1354,14 +1354,14 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
// padVal.SetPercentValue(pctVal);
//}
}
if (aData->mMarginData->mPadding->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding->mLeft = padVal;
if (aData->mMarginData->mPadding->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding->mRight = padVal;
if (aData->mMarginData->mPadding->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding->mTop = padVal;
if (aData->mMarginData->mPadding->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding->mBottom = padVal;
if (aData->mMarginData->mPadding.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding.mLeft = padVal;
if (aData->mMarginData->mPadding.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding.mRight = padVal;
if (aData->mMarginData->mPadding.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding.mTop = padVal;
if (aData->mMarginData->mPadding.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mPadding.mBottom = padVal;
}
}
}
@ -1408,28 +1408,28 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (((value.GetUnit() == eHTMLUnit_Pixel) &&
(value.GetPixelValue() > 0)) ||
(value.GetUnit() == eHTMLUnit_Empty)) {
if (aData->mMarginData->mBorderWidth->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mLeft.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mRight.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mTop.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth->mBottom.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mLeft.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mRight.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mTop.SetFloatValue(1.0f, eCSSUnit_Pixel);
if (aData->mMarginData->mBorderWidth.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderWidth.mBottom.SetFloatValue(1.0f, eCSSUnit_Pixel);
PRUint8 borderStyle = (eCompatibility_NavQuirks == mode)
? NS_STYLE_BORDER_STYLE_BG_INSET : NS_STYLE_BORDER_STYLE_INSET;
// BG_INSET results in a border color based on background colors
// used for NavQuirks only...
if (aData->mMarginData->mBorderStyle->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mLeft.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mRight.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mTop.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle->mBottom.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mLeft.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mRight.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mTop.SetIntValue(borderStyle, eCSSUnit_Enumerated);
if (aData->mMarginData->mBorderStyle.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderStyle.mBottom.SetIntValue(borderStyle, eCSSUnit_Enumerated);
}
}
}
@ -1450,28 +1450,28 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if ((eHTMLUnit_Color == value.GetUnit()) ||
(eHTMLUnit_ColorName == value.GetUnit())) {
nscolor color = value.GetColorValue();
if (aData->mMarginData->mBorderColor->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mLeft.SetColorValue(color);
if (aData->mMarginData->mBorderColor->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mRight.SetColorValue(color);
if (aData->mMarginData->mBorderColor->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mTop.SetColorValue(color);
if (aData->mMarginData->mBorderColor->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mBottom.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mLeft.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mRight.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mTop.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mBottom.SetColorValue(color);
borderStyle = NS_STYLE_BORDER_STYLE_OUTSET; // use css outset
}
else if (NS_STYLE_BORDER_COLLAPSE == tableStyle->mBorderCollapse) {
// make the color grey
nscolor color = NS_RGB(80, 80, 80);
if (aData->mMarginData->mBorderColor->mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mLeft.SetColorValue(color);
if (aData->mMarginData->mBorderColor->mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mRight.SetColorValue(color);
if (aData->mMarginData->mBorderColor->mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mTop.SetColorValue(color);
if (aData->mMarginData->mBorderColor->mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor->mBottom.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mLeft.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mLeft.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mRight.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mRight.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mTop.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mTop.SetColorValue(color);
if (aData->mMarginData->mBorderColor.mBottom.GetUnit() == eCSSUnit_Null)
aData->mMarginData->mBorderColor.mBottom.SetColorValue(color);
}
// border and frame

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

@ -91,7 +91,8 @@ public:
nsIURI* aBaseURL,
nsCSSDeclaration* aDeclaration,
PRBool aParseOnlyOneDecl,
nsChangeHint* aHint) = 0;
nsChangeHint* aHint,
PRBool aClearOldDecl) = 0;
NS_IMETHOD ParseRule(const nsAString& aRule,
nsIURI* aBaseURL,

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

@ -52,6 +52,7 @@ REQUIRES = xpcom \
$(NULL)
CPPSRCS = \
nsCSSDataBlock.cpp \
nsCSSDeclaration.cpp \
nsCSSLoader.cpp \
nsCSSOMFactory.cpp \

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

@ -0,0 +1,865 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsCSSDataBlock.cpp.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCSSDataBlock.h"
#include "nsCSSProps.h"
#include "nsRuleNode.h"
/*
* nsCSSCompressedDataBlock holds property-value pairs corresponding to
* CSS declaration blocks. The value is stored in one of the six CSS
* data types. These six types are nsCSSValue, nsCSSRect,
* nsCSSValueList, nsCSSCounterData, nsCSSQuotes, and nsCSSShadow, and
* each correspond to a value of the nsCSSType enumeration.
*
* The storage strategy uses the CDB*Storage structs below to help
* ensure that all the types remain properly aligned. nsCSSValue's
* alignment requirements cannot be weaker than any others, since it
* contains a pointer and an enumeration.
*
* The simple types, nsCSSValue and nsCSSRect have the nsCSSValue or
* nsCSSRect objects stored in the block. The list types have only a
* pointer to the first element in the list stored in the block.
*/
struct CDBValueStorage {
nsCSSProperty property;
nsCSSValue value;
};
struct CDBRectStorage {
nsCSSProperty property;
nsCSSRect value;
};
struct CDBPointerStorage {
nsCSSProperty property;
void *value;
};
enum {
CDBValueStorage_advance = sizeof(CDBValueStorage),
CDBRectStorage_advance = sizeof(CDBRectStorage),
// round up using the closest estimate we can get of the alignment
// requirements of nsCSSValue:
CDBPointerStorage_advance = PR_ROUNDUP(sizeof(CDBPointerStorage),
sizeof(CDBValueStorage) - sizeof(nsCSSValue))
};
/*
* Define a bunch of utility functions for getting the property or any
* of the value types when the cursor is at the beginning of the storage
* for the property-value pair. The versions taking a non-const cursor
* argument return a reference so that the caller can assign into the
* result.
*/
inline nsCSSProperty& PropertyAtCursor(char *aCursor) {
return *NS_REINTERPRET_CAST(nsCSSProperty*, aCursor);
}
inline nsCSSProperty PropertyAtCursor(const char *aCursor) {
return *NS_REINTERPRET_CAST(const nsCSSProperty*, aCursor);
}
inline nsCSSValue* ValueAtCursor(char *aCursor) {
return & NS_REINTERPRET_CAST(CDBValueStorage*, aCursor)->value;
}
inline const nsCSSValue* ValueAtCursor(const char *aCursor) {
return & NS_REINTERPRET_CAST(const CDBValueStorage*, aCursor)->value;
}
inline nsCSSRect* RectAtCursor(char *aCursor) {
return & NS_REINTERPRET_CAST(CDBRectStorage*, aCursor)->value;
}
inline const nsCSSRect* RectAtCursor(const char *aCursor) {
return & NS_REINTERPRET_CAST(const CDBRectStorage*, aCursor)->value;
}
inline void*& PointerAtCursor(char *aCursor) {
return NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value;
}
inline void* PointerAtCursor(const char *aCursor) {
return NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value;
}
inline nsCSSValueList*& ValueListAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSValueList**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSValueList* ValueListAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSValueList*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
inline nsCSSCounterData*& CounterDataAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSCounterData**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSCounterData* CounterDataAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSCounterData*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
inline nsCSSQuotes*& QuotesAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSQuotes**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSQuotes* QuotesAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSQuotes*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
inline nsCSSShadow*& ShadowAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSShadow**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSShadow* ShadowAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSShadow*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
nsresult
nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
{
// If we have no data for this struct, then return immediately.
// This optimization should make us return most of the time, so we
// have to worry much less (although still some) about the speed of
// the rest of the function.
if (!(nsCachedStyleData::GetBitForSID(aRuleData->mSID) & mStyleBits))
return NS_OK;
const char* cursor = Block();
const char* cursor_end = BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
if (nsCSSProps::kSIDTable[iProp] == aRuleData->mSID) {
void *prop =
nsCSSExpandedDataBlock::RuleDataPropertyAt(aRuleData, iProp);
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
nsCSSValue* target = NS_STATIC_CAST(nsCSSValue*, prop);
if (target->GetUnit() == eCSSUnit_Null) {
const nsCSSValue *val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
*target = *val;
if (iProp == eCSSProperty_font_family) {
// XXX Are there other things like this?
aRuleData->mFontData->mFamilyFromHTML = PR_FALSE;
}
}
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
nsCSSRect* target = NS_STATIC_CAST(nsCSSRect*, prop);
if (target->mTop.GetUnit() == eCSSUnit_Null)
target->mTop = val->mTop;
if (target->mRight.GetUnit() == eCSSUnit_Null)
target->mRight = val->mRight;
if (target->mBottom.GetUnit() == eCSSUnit_Null)
target->mBottom = val->mBottom;
if (target->mLeft.GetUnit() == eCSSUnit_Null)
target->mLeft = val->mLeft;
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void** target = NS_STATIC_CAST(void**, prop);
if (!*target) {
void* val = PointerAtCursor(cursor);
NS_ASSERTION(val, "oops");
*target = val;
}
cursor += CDBPointerStorage_advance;
} break;
}
} else {
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
cursor += CDBPointerStorage_advance;
} break;
}
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
return NS_OK;
}
const void*
nsCSSCompressedDataBlock::StorageFor(nsCSSProperty aProperty) const
{
// If we have no data for this struct, then return immediately.
// This optimization should make us return most of the time, so we
// have to worry much less (although still some) about the speed of
// the rest of the function.
if (!(nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]) &
mStyleBits))
return nsnull;
const char* cursor = Block();
const char* cursor_end = BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
if (iProp == aProperty) {
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
return ValueAtCursor(cursor);
}
case eCSSType_Rect: {
return RectAtCursor(cursor);
}
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
return &PointerAtCursor(NS_CONST_CAST(char*, cursor));
}
}
}
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
return nsnull;
}
nsCSSCompressedDataBlock*
nsCSSCompressedDataBlock::Clone() const
{
const char *cursor = Block(), *cursor_end = BlockEnd();
char *result_cursor;
nsCSSCompressedDataBlock *result =
new(cursor_end - cursor) nsCSSCompressedDataBlock();
if (!result)
return nsnull;
result_cursor = result->Block();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
PropertyAtCursor(result_cursor) = iProp;
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
const nsCSSValue* val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
*ValueAtCursor(result_cursor) = *val;
cursor += CDBValueStorage_advance;
result_cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
*RectAtCursor(result_cursor) = *val;
cursor += CDBRectStorage_advance;
result_cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void *copy;
NS_ASSERTION(PointerAtCursor(cursor), "oops");
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_ValueList:
copy = new nsCSSValueList(*ValueListAtCursor(cursor));
break;
case eCSSType_CounterData:
copy =
new nsCSSCounterData(*CounterDataAtCursor(cursor));
break;
case eCSSType_Quotes:
copy = new nsCSSQuotes(*QuotesAtCursor(cursor));
break;
case eCSSType_Shadow:
copy = new nsCSSShadow(*ShadowAtCursor(cursor));
break;
default:
NS_NOTREACHED("unreachable");
break;
}
if (!copy) {
result->mBlockEnd = result_cursor;
result->Destroy();
return nsnull;
}
PointerAtCursor(result_cursor) = copy;
cursor += CDBPointerStorage_advance;
result_cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
result->mBlockEnd = result_cursor;
return result;
}
void
nsCSSCompressedDataBlock::Destroy()
{
const char* cursor = Block();
const char* cursor_end = BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
const nsCSSValue* val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
val->~nsCSSValue();
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
val->~nsCSSRect();
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList: {
nsCSSValueList* val = ValueListAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_CounterData: {
nsCSSCounterData* val = CounterDataAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_Quotes: {
nsCSSQuotes* val = QuotesAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_Shadow: {
nsCSSShadow* val = ShadowAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
delete this;
}
/* static */ nsCSSCompressedDataBlock*
nsCSSCompressedDataBlock::CreateEmptyBlock()
{
nsCSSCompressedDataBlock *result = new(0) nsCSSCompressedDataBlock();
if (!result)
return nsnull;
result->mBlockEnd = result->Block();
return result;
}
/*****************************************************************************/
nsCSSExpandedDataBlock::nsCSSExpandedDataBlock()
{
ClearSets();
AssertInitialState();
}
nsCSSExpandedDataBlock::~nsCSSExpandedDataBlock()
{
AssertInitialState();
}
const nsCSSExpandedDataBlock::PropertyOffsetInfo
nsCSSExpandedDataBlock::kOffsetTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_BACKENDONLY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsCSSExpandedDataBlock, m##datastruct_.member_), \
size_t(-1), \
size_t(-1) },
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsCSSExpandedDataBlock, m##datastruct_.member_), \
offsetof(nsRuleData, m##datastruct_##Data), \
offsetof(nsRuleData##datastruct_, member_) },
#include "nsCSSPropList.h"
#undef CSS_PROP
#undef CSS_PROP_BACKENDONLY
};
void
nsCSSExpandedDataBlock::DoExpand(nsCSSCompressedDataBlock *aBlock,
PRBool aImportant)
{
NS_PRECONDITION(aBlock, "unexpected null block");
/*
* Save needless copying and allocation by copying the memory
* corresponding to the stored data in the compressed block, and
* then, to avoid destructors, deleting the compressed block by
* calling |delete| instead of using its |Destroy| method.
*/
const char* cursor = aBlock->Block();
const char* cursor_end = aBlock->BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
NS_ASSERTION(!HasPropertyBit(iProp),
"compressed block has property multiple times");
SetPropertyBit(iProp);
if (aImportant)
SetImportantBit(iProp);
void *prop = PropertyAt(iProp);
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
const nsCSSValue* val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
memcpy(prop, val, sizeof(nsCSSValue));
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
memcpy(prop, val, sizeof(nsCSSRect));
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void* val = PointerAtCursor(cursor);
NS_ASSERTION(val, "oops");
*NS_STATIC_CAST(void**, prop) = val;
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
delete aBlock;
}
void
nsCSSExpandedDataBlock::Expand(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock)
{
NS_PRECONDITION(*aNormalBlock, "unexpected null block");
AssertInitialState();
DoExpand(*aNormalBlock, PR_FALSE);
*aNormalBlock = nsnull;
if (*aImportantBlock) {
DoExpand(*aImportantBlock, PR_TRUE);
*aImportantBlock = nsnull;
}
}
nsCSSExpandedDataBlock::ComputeSizeResult
nsCSSExpandedDataBlock::ComputeSize()
{
ComputeSizeResult result = {0, 0};
for (PRUint32 iHigh = 0; iHigh < NS_ARRAY_LENGTH(mPropertiesSet); ++iHigh) {
if (mPropertiesSet[iHigh] == 0)
continue;
for (PRInt32 iLow = 0; iLow < kPropertiesSetChunkSize; ++iLow) {
if ((mPropertiesSet[iHigh] & (1 << iLow)) == 0)
continue;
nsCSSProperty iProp =
nsCSSProperty(iHigh * kPropertiesSetChunkSize + iLow);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
void *prop = PropertyAt(iProp);
PRUint32 increment = 0;
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
if (val->GetUnit() != eCSSUnit_Null) {
increment = CDBValueStorage_advance;
}
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
if (val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null) {
increment = CDBRectStorage_advance;
}
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void* val = *NS_STATIC_CAST(void**, prop);
if (val) {
increment = CDBPointerStorage_advance;
}
} break;
}
if ((mPropertiesImportant[iHigh] & (1 << iLow)) == 0)
result.normal += increment;
else
result.important += increment;
}
}
return result;
}
void
nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock)
{
nsCSSCompressedDataBlock *result_normal, *result_important;
char *cursor_normal, *cursor_important;
ComputeSizeResult size = ComputeSize();
result_normal = new(size.normal) nsCSSCompressedDataBlock();
if (!result_normal) {
*aNormalBlock = nsnull;
*aImportantBlock = nsnull;
return;
}
cursor_normal = result_normal->Block();
if (size.important != 0) {
result_important = new(size.important) nsCSSCompressedDataBlock();
if (!result_important) {
delete result_normal;
*aNormalBlock = nsnull;
*aImportantBlock = nsnull;
return;
}
cursor_important = result_important->Block();
} else {
result_important = nsnull;
}
/*
* Save needless copying and allocation by copying the memory
* corresponding to the stored data in the expanded block, and then
* clearing the data in the expanded block.
*/
for (PRUint32 iHigh = 0; iHigh < NS_ARRAY_LENGTH(mPropertiesSet); ++iHigh) {
if (mPropertiesSet[iHigh] == 0)
continue;
for (PRInt32 iLow = 0; iLow < kPropertiesSetChunkSize; ++iLow) {
if ((mPropertiesSet[iHigh] & (1 << iLow)) == 0)
continue;
nsCSSProperty iProp =
nsCSSProperty(iHigh * kPropertiesSetChunkSize + iLow);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
void *prop = PropertyAt(iProp);
PRBool present = PR_FALSE;
PRBool important =
(mPropertiesImportant[iHigh] & (1 << iLow)) != 0;
char *&cursor = important ? cursor_important : cursor_normal;
nsCSSCompressedDataBlock *result =
important ? result_important : result_normal;
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
if (val->GetUnit() != eCSSUnit_Null) {
CDBValueStorage *storage =
NS_REINTERPRET_CAST(CDBValueStorage*, cursor);
storage->property = iProp;
memcpy(&storage->value, val, sizeof(nsCSSValue));
new (val) nsCSSValue();
cursor += CDBValueStorage_advance;
present = PR_TRUE;
}
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
if (val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null) {
CDBRectStorage *storage =
NS_REINTERPRET_CAST(CDBRectStorage*, cursor);
storage->property = iProp;
memcpy(&storage->value, val, sizeof(nsCSSRect));
new (val) nsCSSRect();
cursor += CDBRectStorage_advance;
present = PR_TRUE;
}
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void*& val = *NS_STATIC_CAST(void**, prop);
if (val) {
CDBPointerStorage *storage =
NS_REINTERPRET_CAST(CDBPointerStorage*, cursor);
storage->property = iProp;
storage->value = val;
val = nsnull;
cursor += CDBPointerStorage_advance;
present = PR_TRUE;
}
} break;
}
if (present) {
result->mStyleBits |= nsCachedStyleData::GetBitForSID(
nsCSSProps::kSIDTable[iProp]);
}
}
}
result_normal->mBlockEnd = cursor_normal;
NS_ASSERTION(result_normal->DataSize() == ptrdiff_t(size.normal),
"size miscalculation");
if (result_important) {
result_important->mBlockEnd = cursor_important;
NS_ASSERTION(result_important->DataSize() == ptrdiff_t(size.important),
"size miscalculation");
}
ClearSets();
AssertInitialState();
*aNormalBlock = result_normal;
*aImportantBlock = result_important;
}
void
nsCSSExpandedDataBlock::Clear()
{
for (PRUint32 iHigh = 0; iHigh < NS_ARRAY_LENGTH(mPropertiesSet); ++iHigh) {
if (mPropertiesSet[iHigh] == 0)
continue;
for (PRInt32 iLow = 0; iLow < kPropertiesSetChunkSize; ++iLow) {
if ((mPropertiesSet[iHigh] & (1 << iLow)) == 0)
continue;
nsCSSProperty iProp =
nsCSSProperty(iHigh * kPropertiesSetChunkSize + iLow);
ClearProperty(iProp);
}
}
AssertInitialState();
}
void
nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID)
{
NS_ASSERTION(0 <= aPropID && aPropID < eCSSProperty_COUNT_no_shorthands,
"out of range");
ClearPropertyBit(aPropID);
ClearImportantBit(aPropID);
void *prop = PropertyAt(aPropID);
switch (nsCSSProps::kTypeTable[aPropID]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
val->Reset();
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
val->mTop.Reset();
val->mRight.Reset();
val->mBottom.Reset();
val->mLeft.Reset();
} break;
case eCSSType_ValueList: {
nsCSSValueList*& val = *NS_STATIC_CAST(nsCSSValueList**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
case eCSSType_CounterData: {
nsCSSCounterData*& val =
*NS_STATIC_CAST(nsCSSCounterData**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
case eCSSType_Quotes: {
nsCSSQuotes*& val = *NS_STATIC_CAST(nsCSSQuotes**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
case eCSSType_Shadow: {
nsCSSShadow*& val = *NS_STATIC_CAST(nsCSSShadow**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
}
}
#ifdef DEBUG
void
nsCSSExpandedDataBlock::DoAssertInitialState()
{
PRUint32 i;
for (i = 0; i < NS_ARRAY_LENGTH(mPropertiesSet); ++i) {
NS_ASSERTION(mPropertiesSet[i] == 0, "not initial state");
}
for (i = 0; i < NS_ARRAY_LENGTH(mPropertiesImportant); ++i) {
NS_ASSERTION(mPropertiesImportant[i] == 0, "not initial state");
}
for (i = 0; i < eCSSProperty_COUNT_no_shorthands; ++i) {
void *prop = PropertyAt(nsCSSProperty(i));
switch (nsCSSProps::kTypeTable[i]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
NS_ASSERTION(val->GetUnit() == eCSSUnit_Null,
"not initial state");
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
NS_ASSERTION(val->mTop.GetUnit() == eCSSUnit_Null,
"not initial state");
NS_ASSERTION(val->mRight.GetUnit() == eCSSUnit_Null,
"not initial state");
NS_ASSERTION(val->mBottom.GetUnit() == eCSSUnit_Null,
"not initial state");
NS_ASSERTION(val->mLeft.GetUnit() == eCSSUnit_Null,
"not initial state");
} break;
case eCSSType_ValueList: {
nsCSSValueList* val = *NS_STATIC_CAST(nsCSSValueList**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_CounterData: {
nsCSSCounterData* val =
*NS_STATIC_CAST(nsCSSCounterData**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_Quotes: {
nsCSSQuotes* val = *NS_STATIC_CAST(nsCSSQuotes**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_Shadow: {
nsCSSShadow* val = *NS_STATIC_CAST(nsCSSShadow**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
}
}
}
#endif

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

@ -0,0 +1,305 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsCSSDataBlock.h.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCSSDataBlock_h__
#define nsCSSDataBlock_h__
#include "nsCSSStruct.h"
struct nsRuleData;
class nsCSSExpandedDataBlock;
/**
* An |nsCSSCompressedDataBlock| holds an immutable chunk of
* property-value data for a CSS declaration block (which we misname a
* |nsCSSDeclaration|). Mutation is accomplished through
* |nsCSSExpandedDataBlock|.
*/
class nsCSSCompressedDataBlock {
public:
friend class nsCSSExpandedDataBlock;
/**
* Do what |nsIStyleRule::MapRuleInfoInto| needs to do for a style
* rule using this block for storage.
*/
nsresult MapRuleInfoInto(nsRuleData *aRuleData) const;
/**
* Return the location at which the *value* for the property is
* stored, or null if the block does not contain a value for the
* property. This is either an |nsCSSValue*|, |nsCSSRect*|, or an
* |nsCSSValueList**|, etc.
*
* Inefficient (by design).
*/
const void* StorageFor(nsCSSProperty aProperty) const;
/**
* Clone this block, or return null on out-of-memory.
*/
nsCSSCompressedDataBlock* Clone() const;
/**
* Delete all the data stored in this block, and the block itself.
*/
void Destroy();
/**
* Create a new nsCSSCompressedDataBlock holding no declarations.
*/
static nsCSSCompressedDataBlock* CreateEmptyBlock();
private:
PRInt32 mStyleBits; // the structs for which we have data, according to
// |nsCachedStyleData::GetBitForSID|.
enum { block_chars = 4 }; // put 4 chars in the definition of the class
// to ensure size not inflated by alignment
void* operator new(size_t aBaseSize, size_t aDataSize) {
// subtract off the extra size to store |mBlock_|
return ::operator new(aBaseSize + aDataSize -
sizeof(char) * block_chars);
}
nsCSSCompressedDataBlock() : mStyleBits(0) {}
// Only this class (through |Destroy|) or nsCSSExpandedDataBlock (in
// |Expand|) can delete compressed data blocks.
~nsCSSCompressedDataBlock() { }
char* mBlockEnd; // the byte after the last valid byte
char mBlock_[block_chars]; // must be the last member!
char* Block() { return mBlock_; }
char* BlockEnd() { return mBlockEnd; }
const char* Block() const { return mBlock_; }
const char* BlockEnd() const { return mBlockEnd; }
ptrdiff_t DataSize() const { return BlockEnd() - Block(); }
};
class nsCSSExpandedDataBlock {
public:
nsCSSExpandedDataBlock();
~nsCSSExpandedDataBlock();
/*
* When setting properties in an |nsCSSExpandedDataBlock|, callers
* must make the appropriate |AddPropertyBit| call.
*/
nsCSSFont mFont;
nsCSSDisplay mDisplay;
nsCSSMargin mMargin;
nsCSSList mList;
nsCSSPosition mPosition;
nsCSSTable mTable;
nsCSSColor mColor;
nsCSSContent mContent;
nsCSSText mText;
nsCSSUserInterface mUserInterface;
nsCSSAural mAural;
nsCSSPage mPage;
nsCSSBreaks mBreaks;
nsCSSXUL mXUL;
#ifdef MOZ_SVG
nsCSSSVG mSVG;
#endif
/**
* Transfer all of the state from the compressed block to this
* expanded block. The state of this expanded block must be clear
* beforehand.
*
* The compressed block passed in IS DESTROYED by this method and
* set to null, and thus cannot be used again. (This is necessary
* because ownership of sub-objects is transferred to the expanded
* block.)
*/
void Expand(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock);
/**
* Allocate a new compressed block and transfer all of the state
* from this expanded block to the new compressed block, clearing
* the state of this expanded block.
*/
void Compress(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock);
/**
* Clear (and thus destroy) the state of this expanded block.
*/
void Clear();
/**
* Clear the data for the given property (including the set and
* important bits).
*/
void ClearProperty(nsCSSProperty aPropID);
void AssertInitialState() {
#ifdef DEBUG
DoAssertInitialState();
#endif
}
private:
/**
* Compute the size that will be occupied by the result of
* |Compress|.
*/
struct ComputeSizeResult {
PRUint32 normal, important;
};
ComputeSizeResult ComputeSize();
void DoExpand(nsCSSCompressedDataBlock *aBlock, PRBool aImportant);
#ifdef DEBUG
void DoAssertInitialState();
#endif
struct PropertyOffsetInfo {
// XXX These could probably be pointer-to-member, if the casting can
// be done correctly.
size_t block_offset; // offset of value in nsCSSExpandedDataBlock
size_t ruledata_struct_offset; // offset of nsRuleData* in nsRuleData
size_t ruledata_member_offset; // offset of value in nsRuleData*
};
static const PropertyOffsetInfo kOffsetTable[];
typedef PRUint8 property_set_type;
enum { kPropertiesSetChunkSize = 8 }; // number of bits in
// |property_set_type|.
// number of |property_set_type|s in the set
enum { kPropertiesSetChunkCount =
(eCSSProperty_COUNT_no_shorthands + (kPropertiesSetChunkSize-1)) /
kPropertiesSetChunkSize };
/*
* mPropertiesSet stores a bit for every property that may be
* present, to optimize compression of blocks with small numbers of
* properties (the norm). The code does not rely on it to be exact;
* it is allowable, although slower, if a bit is erroneously set
* even though the property is not present.
*/
property_set_type mPropertiesSet[kPropertiesSetChunkCount];
/*
* mPropertiesImportant indicates which properties are '!important'.
*/
property_set_type mPropertiesImportant[kPropertiesSetChunkCount];
public:
/*
* Return the storage location within |this| of the value of the
* property (i.e., either an |nsCSSValue*|, |nsCSSRect*|, or
* |nsCSSValueList**| (etc.).
*/
void* PropertyAt(nsCSSProperty aProperty) {
const PropertyOffsetInfo& offsets =
nsCSSExpandedDataBlock::kOffsetTable[aProperty];
return NS_REINTERPRET_CAST(void*, NS_REINTERPRET_CAST(char*, this) +
offsets.block_offset);
}
/*
* Return the storage location within |aRuleData| of the value of
* the property (i.e., either an |nsCSSValue*|, |nsCSSRect*|, or
* |nsCSSValueList**| (etc.).
*/
static void* RuleDataPropertyAt(nsRuleData *aRuleData,
nsCSSProperty aProperty) {
const PropertyOffsetInfo& offsets =
nsCSSExpandedDataBlock::kOffsetTable[aProperty];
NS_ASSERTION(offsets.ruledata_struct_offset != size_t(-1),
"property should not use CSS_PROP_BACKENDONLY");
char* cssstruct = *NS_REINTERPRET_CAST(char**,
NS_REINTERPRET_CAST(char*, aRuleData) +
offsets.ruledata_struct_offset);
return NS_REINTERPRET_CAST(void*,
cssstruct + offsets.ruledata_member_offset);
}
void AssertInSetRange(nsCSSProperty aProperty) {
NS_ASSERTION(0 <= aProperty &&
aProperty < eCSSProperty_COUNT_no_shorthands,
"out of bounds");
}
void SetPropertyBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesSet[aProperty / kPropertiesSetChunkSize] |=
property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
void ClearPropertyBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesSet[aProperty / kPropertiesSetChunkSize] &=
~property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
PRBool HasPropertyBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
return (mPropertiesSet[aProperty / kPropertiesSetChunkSize] &
(1 << (aProperty % kPropertiesSetChunkSize))) != 0;
}
void SetImportantBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesImportant[aProperty / kPropertiesSetChunkSize] |=
property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
void ClearImportantBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesImportant[aProperty / kPropertiesSetChunkSize] &=
~property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
PRBool HasImportantBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
return (mPropertiesImportant[aProperty / kPropertiesSetChunkSize] &
(1 << (aProperty % kPropertiesSetChunkSize))) != 0;
}
void ClearSets() {
memset(mPropertiesSet, 0, sizeof(mPropertiesSet));
memset(mPropertiesImportant, 0, sizeof(mPropertiesImportant));
}
};
#endif /* !defined(nsCSSDataBlock_h__) */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -48,59 +48,124 @@
#include "nsCSSProps.h"
#include "nsVoidArray.h"
#include "nsValueArray.h"
#include "nsCSSDataBlock.h"
#include "nsCSSStruct.h"
class nsCSSDeclaration {
public:
nsCSSDeclaration(void);
/**
* Construct an |nsCSSDeclaration| that is in an invalid state (null
* |mData|) and cannot be used until its |CompressFrom| method or
* |InitializeEmpty| method is called.
*/
nsCSSDeclaration();
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
public:
NS_DECL_ZEROING_OPERATOR_NEW
/**
* |ValueAppended| must be called to maintain this declaration's
* |mOrder| whenever a property is parsed into an expanded data block
* for this declaration.
*/
nsresult ValueAppended(nsCSSProperty aProperty);
nsCSSStruct* GetData(const nsID& aSID);
nsCSSStruct* EnsureData(const nsID& aSID);
nsresult AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue);
nsresult AppendStructValue(nsCSSProperty aProperty, void* aStruct);
nsresult SetValueImportant(nsCSSProperty aProperty);
nsresult AppendComment(const nsAString& aComment);
nsresult RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue);
nsresult RemoveProperty(nsCSSProperty aProperty);
nsresult GetValue(nsCSSProperty aProperty, nsCSSValue& aValue);
nsresult GetValue(nsCSSProperty aProperty, nsAString& aValue);
nsresult GetValue(const nsAString& aProperty, nsAString& aValue);
nsresult GetValue(nsCSSProperty aProperty, nsAString& aValue) const;
nsresult GetValue(const nsAString& aProperty, nsAString& aValue) const;
nsCSSDeclaration* GetImportantValues();
PRBool GetValueIsImportant(nsCSSProperty aProperty);
PRBool GetValueIsImportant(const nsAString& aProperty);
/**
* May be called only for properties whose type is eCSSType_Value.
*
* XXX It would be good to make this protected, which means not using
* it from inspector via CSSStyleRuleImpl.
*/
nsresult GetValueOrImportantValue(nsCSSProperty aProperty, nsCSSValue& aValue) const;
PRUint32 Count();
nsresult GetNthProperty(PRUint32 aIndex, nsAString& aReturn);
PRBool HasImportantData() const { return mImportantData != nsnull; }
PRBool GetValueIsImportant(nsCSSProperty aProperty) const;
PRBool GetValueIsImportant(const nsAString& aProperty) const;
PRUint32 Count() const;
nsresult GetNthProperty(PRUint32 aIndex, nsAString& aReturn) const;
// XXX This should go away, along with the rest of the property-based hints.
nsChangeHint GetStyleImpact() const;
nsresult ToString(nsAString& aString);
nsresult ToString(nsAString& aString) const;
nsCSSDeclaration* Clone() const;
nsresult MapRuleInfoInto(nsRuleData *aRuleData) const {
return mData->MapRuleInfoInto(aRuleData);
}
nsresult MapImportantRuleInfoInto(nsRuleData *aRuleData) const {
return mImportantData->MapRuleInfoInto(aRuleData);
}
/**
* Initialize this declaration as holding no data. Return false on
* out-of-memory.
*/
PRBool InitializeEmpty();
/**
* Transfer all of the state from |aExpandedData| into this declaration.
* After calling, |aExpandedData| should be in its initial state.
*/
void CompressFrom(nsCSSExpandedDataBlock *aExpandedData) {
NS_ASSERTION(!mData, "oops");
NS_ASSERTION(!mImportantData, "oops");
aExpandedData->Compress(&mData, &mImportantData);
}
/**
* Transfer all of the state from this declaration into
* |aExpandedData| and put this declaration temporarily into an
* invalid state (ended by |CompressFrom| or |InitializeEmpty|) that
* should last only during parsing. During this time only
* |ValueAppended| should be called.
*/
void ExpandTo(nsCSSExpandedDataBlock *aExpandedData) {
aExpandedData->AssertInitialState();
NS_ASSERTION(mData, "oops");
aExpandedData->Expand(&mData, &mImportantData);
NS_ASSERTION(!mData && !mImportantData,
"Expand didn't null things out");
}
/**
* Clear the data, in preparation for its replacement with entirely
* new data by a call to |CompressFrom|.
*/
void ClearData() {
mData->Destroy();
mData = nsnull;
if (mImportantData) {
mImportantData->Destroy();
mImportantData = nsnull;
}
}
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
protected:
nsresult RemoveProperty(nsCSSProperty aProperty);
private:
nsresult GetValueOrImportantValue(nsCSSProperty aProperty, nsCSSValue& aValue);
void AppendImportanceToString(PRBool aIsImportant, nsAString& aString);
PRBool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult);
PRBool AppendValueOrImportantValueToString(nsCSSProperty aProperty, nsAString& aResult);
PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAString& aResult);
// Not implemented, and not supported.
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
PRBool operator==(const nsCSSDeclaration& aCopy) const;
void PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue);
void AppendImportanceToString(PRBool aIsImportant, nsAString& aString) const;
// return whether there was a value in |aValue| (i.e., it had a non-null unit)
PRBool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult) const;
// return whether there was a value in |aValue| (i.e., it had a non-null unit)
PRBool AppendCSSValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAString& aResult) const;
void PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue) const;
PRBool TryBorderShorthand(nsAString & aString, PRUint32 aPropertiesSet,
PRInt32 aBorderTopWidth,
PRInt32 aBorderTopStyle,
@ -113,43 +178,38 @@ private:
PRInt32 aBorderLeftColor,
PRInt32 aBorderRightWidth,
PRInt32 aBorderRightStyle,
PRInt32 aBorderRightColor);
PRInt32 aBorderRightColor) const;
PRBool TryBorderSideShorthand(nsAString & aString,
nsCSSProperty aShorthand,
PRInt32 aBorderWidth,
PRInt32 aBorderStyle,
PRInt32 aBorderColor);
PRInt32 aBorderColor) const;
PRBool TryFourSidesShorthand(nsAString & aString,
nsCSSProperty aShorthand,
PRInt32 & aTop,
PRInt32 & aBottom,
PRInt32 & aLeft,
PRInt32 & aRight,
PRBool aClearIndexes);
void DoClipShorthand(nsAString & aString,
PRInt32 aTop,
PRInt32 aBottom,
PRInt32 aLeft,
PRInt32 aRight);
PRBool aClearIndexes) const;
void TryBackgroundShorthand(nsAString & aString,
PRInt32 & aBgColor, PRInt32 & aBgImage,
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
PRInt32 & aBgPositionX,
PRInt32 & aBgPositionY);
PRInt32 & aBgPositionY) const;
void UseBackgroundPosition(nsAString & aString,
PRInt32 & aBgPositionX,
PRInt32 & aBgPositionY);
PRInt32 & aBgPositionY) const;
PRBool AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond,
PRInt32 aThird, PRInt32 aFourth,
PRInt32 aFifth, PRInt32 aSixth,
PRBool & aImportance);
PRBool & aImportance) const;
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
PRInt32 aThird, PRInt32 aFourth);
PRInt32 aThird, PRInt32 aFourth) const;
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
nsAString& aResult);
nsAString& aResult) const;
protected:
private:
//
// Specialized ref counting.
// We do not want everyone to ref count us, only the rules which hold
@ -161,41 +221,32 @@ protected:
//
friend class CSSStyleRuleImpl;
void AddRef(void) {
mRuleRefs++;
++mRefCnt;
}
void Release(void) {
NS_ASSERTION(0 < mRuleRefs, "bad Release");
if (0 == --mRuleRefs) {
NS_ASSERTION(0 < mRefCnt, "bad Release");
if (0 == --mRefCnt) {
delete this;
}
}
public:
void RuleAbort(void) {
NS_ASSERTION(0 == mRuleRefs, "bad RuleAbort");
NS_ASSERTION(0 == mRefCnt, "bad RuleAbort");
delete this;
}
protected:
//
// Block everyone, except us or a derivitive, from deleting us.
//
private:
// Block everyone, except us or a derivative, from deleting us.
~nsCSSDeclaration(void);
nsCSSProperty OrderValueAt(nsValueArrayIndex aValue) const {
return nsCSSProperty(mOrder.ValueAt(aValue));
}
private:
nsValueArray* mOrder;
nsCSSDeclaration* mImportant;
nsSmallVoidArray mStructs;
//
// Keep these two together, as they should pack.
//
nsCSSDeclRefCount mRuleRefs;
nsCSSDeclContains mContains;
nsValueArray mOrder;
nsAutoRefCnt mRefCnt;
nsCSSCompressedDataBlock *mData; // never null, except while expanded
nsCSSCompressedDataBlock *mImportantData; // may be null
};
nsresult
NS_NewCSSDeclaration(nsCSSDeclaration** aInstancePtrResult);
#endif /* nsCSSDeclaration_h___ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -52,25 +52,6 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
static NS_DEFINE_IID(kCSSFontSID, NS_CSS_FONT_SID);
static NS_DEFINE_IID(kCSSColorSID, NS_CSS_COLOR_SID);
static NS_DEFINE_IID(kCSSDisplaySID, NS_CSS_DISPLAY_SID);
static NS_DEFINE_IID(kCSSTextSID, NS_CSS_TEXT_SID);
static NS_DEFINE_IID(kCSSMarginSID, NS_CSS_MARGIN_SID);
static NS_DEFINE_IID(kCSSPositionSID, NS_CSS_POSITION_SID);
static NS_DEFINE_IID(kCSSListSID, NS_CSS_LIST_SID);
static NS_DEFINE_IID(kCSSTableSID, NS_CSS_TABLE_SID);
static NS_DEFINE_IID(kCSSBreaksSID, NS_CSS_BREAKS_SID);
static NS_DEFINE_IID(kCSSPageSID, NS_CSS_PAGE_SID);
static NS_DEFINE_IID(kCSSContentSID, NS_CSS_CONTENT_SID);
static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID);
static NS_DEFINE_IID(kCSSAuralSID, NS_CSS_AURAL_SID);
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#ifdef MOZ_SVG
static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID);
#endif
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }
// --- nsCSSFont -----------------
@ -97,11 +78,6 @@ nsCSSFont::~nsCSSFont(void)
MOZ_COUNT_DTOR(nsCSSFont);
}
const nsID& nsCSSFont::GetID(void)
{
return kCSSFontSID;
}
#ifdef DEBUG
void nsCSSFont::List(FILE* out, PRInt32 aIndent) const
{
@ -174,11 +150,6 @@ nsCSSColor::~nsCSSColor(void)
MOZ_COUNT_DTOR(nsCSSColor);
}
const nsID& nsCSSColor::GetID(void)
{
return kCSSColorSID;
}
#ifdef DEBUG
void nsCSSColor::List(FILE* out, PRInt32 aIndent) const
{
@ -255,11 +226,6 @@ nsCSSText::~nsCSSText(void)
CSS_IF_DELETE(mTextShadow);
}
const nsID& nsCSSText::GetID(void)
{
return kCSSTextSID;
}
#ifdef DEBUG
void nsCSSText::List(FILE* out, PRInt32 aIndent) const
{
@ -277,11 +243,12 @@ void nsCSSText::List(FILE* out, PRInt32 aIndent) const
if (nsnull != mTextShadow) {
if (mTextShadow->mXOffset.IsLengthUnit()) {
nsCSSShadow* shadow = mTextShadow;
// XXX This prints the property name many times, but nobody cares.
while (nsnull != shadow) {
shadow->mColor.AppendToString(buffer, eCSSProperty_text_shadow_color);
shadow->mXOffset.AppendToString(buffer, eCSSProperty_text_shadow_x);
shadow->mYOffset.AppendToString(buffer, eCSSProperty_text_shadow_y);
shadow->mRadius.AppendToString(buffer, eCSSProperty_text_shadow_radius);
shadow->mColor.AppendToString(buffer, eCSSProperty_text_shadow);
shadow->mXOffset.AppendToString(buffer, eCSSProperty_text_shadow);
shadow->mYOffset.AppendToString(buffer, eCSSProperty_text_shadow);
shadow->mRadius.AppendToString(buffer, eCSSProperty_text_shadow);
shadow = shadow->mNext;
}
}
@ -317,6 +284,24 @@ nsCSSRect::~nsCSSRect()
MOZ_COUNT_DTOR(nsCSSRect);
}
void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue)
{
mTop = aValue;
mRight = aValue;
mBottom = aValue;
mLeft = aValue;
}
#if (NS_SIDE_TOP != 0) || (NS_SIDE_RIGHT != 1) || (NS_SIDE_BOTTOM != 2) || (NS_SIDE_LEFT != 3)
#error "Somebody changed the side constants."
#endif
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft,
};
#ifdef DEBUG
void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const
@ -368,10 +353,98 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co
}
#endif
// --- nsCSSValueListRect -----------------
MOZ_DECL_CTOR_COUNTER(nsCSSValueListRect)
nsCSSValueListRect::nsCSSValueListRect(void)
: mTop(nsnull),
mRight(nsnull),
mBottom(nsnull),
mLeft(nsnull)
{
MOZ_COUNT_CTOR(nsCSSValueListRect);
}
nsCSSValueListRect::nsCSSValueListRect(const nsCSSValueListRect& aCopy)
: mTop(aCopy.mTop),
mRight(aCopy.mRight),
mBottom(aCopy.mBottom),
mLeft(aCopy.mLeft)
{
MOZ_COUNT_CTOR(nsCSSValueListRect);
}
nsCSSValueListRect::~nsCSSValueListRect()
{
MOZ_COUNT_DTOR(nsCSSValueListRect);
}
/* static */ const nsCSSValueListRect::side_type
nsCSSValueListRect::sides[4] = {
&nsCSSValueListRect::mTop,
&nsCSSValueListRect::mRight,
&nsCSSValueListRect::mBottom,
&nsCSSValueListRect::mLeft,
};
#ifdef DEBUG
void nsCSSValueListRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const
{
#if 0
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
if (eCSSProperty_UNKNOWN < aPropID) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID).get());
buffer.Append(NS_LITERAL_STRING(": "));
}
mTop.AppendToString(buffer);
mRight.AppendToString(buffer);
mBottom.AppendToString(buffer);
mLeft.AppendToString(buffer);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
#endif
}
void nsCSSValueListRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const
{
#if 0
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
if (eCSSUnit_Null != mTop.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mTop.AppendToString(buffer);
}
if (eCSSUnit_Null != mRight.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mRight.AppendToString(buffer);
}
if (eCSSUnit_Null != mBottom.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mBottom.AppendToString(buffer);
}
if (eCSSUnit_Null != mLeft.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mLeft.AppendToString(buffer);
}
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
#endif
}
#endif
// --- nsCSSDisplay -----------------
nsCSSDisplay::nsCSSDisplay(void)
: mClip(nsnull)
{
MOZ_COUNT_CTOR(nsCSSDisplay);
}
@ -383,7 +456,7 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mPosition(aCopy.mPosition),
mFloat(aCopy.mFloat),
mClear(aCopy.mClear),
mClip(nsnull),
mClip(aCopy.mClip),
mOverflow(aCopy.mOverflow),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
@ -393,18 +466,11 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
// end temp
{
MOZ_COUNT_CTOR(nsCSSDisplay);
CSS_IF_COPY(mClip, nsCSSRect);
}
nsCSSDisplay::~nsCSSDisplay(void)
{
MOZ_COUNT_DTOR(nsCSSDisplay);
CSS_IF_DELETE(mClip);
}
const nsID& nsCSSDisplay::GetID(void)
{
return kCSSDisplaySID;
}
#ifdef DEBUG
@ -425,9 +491,7 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
mOpacity.AppendToString(buffer, eCSSProperty_opacity);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
if (nsnull != mClip) {
mClip->List(out, eCSSProperty_clip);
}
mClip.List(out, eCSSProperty_clip);
buffer.SetLength(0);
mOverflow.AppendToString(buffer, eCSSProperty_overflow);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
@ -436,115 +500,73 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
// --- nsCSSMargin -----------------
void nsCSSMargin::EnsureBorderColors()
{
if (!mBorderColors) {
PRInt32 i;
mBorderColors = new nsCSSValueList*[4];
for (i = 0; i < 4; i++)
mBorderColors[i] = nsnull;
}
}
nsCSSMargin::nsCSSMargin(void)
: mMargin(nsnull), mPadding(nsnull),
mBorderWidth(nsnull), mBorderColor(nsnull), mBorderColors(nsnull),
mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull)
{
MOZ_COUNT_CTOR(nsCSSMargin);
}
nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy)
: mMargin(nsnull), mPadding(nsnull),
mBorderWidth(nsnull), mBorderColor(nsnull), mBorderColors(nsnull),
mBorderStyle(nsnull), mBorderRadius(nsnull),
: mMargin(aCopy.mMargin),
mPadding(aCopy.mPadding),
mBorderWidth(aCopy.mBorderWidth),
mBorderColor(aCopy.mBorderColor),
mBorderColors(aCopy.mBorderColors),
mBorderStyle(aCopy.mBorderStyle),
mBorderRadius(aCopy.mBorderRadius),
mOutlineWidth(aCopy.mOutlineWidth),
mOutlineColor(aCopy.mOutlineColor),
mOutlineStyle(aCopy.mOutlineStyle),
mOutlineRadius(nsnull),
mOutlineRadius(aCopy.mOutlineRadius),
mFloatEdge(aCopy.mFloatEdge)
{
MOZ_COUNT_CTOR(nsCSSMargin);
CSS_IF_COPY(mMargin, nsCSSRect);
CSS_IF_COPY(mPadding, nsCSSRect);
CSS_IF_COPY(mBorderWidth, nsCSSRect);
CSS_IF_COPY(mBorderColor, nsCSSRect);
CSS_IF_COPY(mBorderStyle, nsCSSRect);
CSS_IF_COPY(mBorderRadius, nsCSSRect);
CSS_IF_COPY(mOutlineRadius, nsCSSRect);
if (aCopy.mBorderColors) {
EnsureBorderColors();
for (PRInt32 i = 0; i < 4; i++)
CSS_IF_COPY(mBorderColors[i], nsCSSValueList);
}
}
nsCSSMargin::~nsCSSMargin(void)
{
MOZ_COUNT_DTOR(nsCSSMargin);
CSS_IF_DELETE(mMargin);
CSS_IF_DELETE(mPadding);
CSS_IF_DELETE(mBorderWidth);
CSS_IF_DELETE(mBorderColor);
CSS_IF_DELETE(mBorderStyle);
CSS_IF_DELETE(mBorderRadius);
CSS_IF_DELETE(mOutlineRadius);
if (mBorderColors) {
for (PRInt32 i = 0; i < 4; i++)
CSS_IF_DELETE(mBorderColors[i]);
delete []mBorderColors;
}
}
const nsID& nsCSSMargin::GetID(void)
{
return kCSSMarginSID;
}
#ifdef DEBUG
void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
{
if (nsnull != mMargin) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty_margin_top,
eCSSProperty_margin_right,
eCSSProperty_margin_bottom,
eCSSProperty_margin_left
};
mMargin->List(out, aIndent, trbl);
mMargin.List(out, aIndent, trbl);
}
if (nsnull != mPadding) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty_padding_top,
eCSSProperty_padding_right,
eCSSProperty_padding_bottom,
eCSSProperty_padding_left
};
mPadding->List(out, aIndent, trbl);
mPadding.List(out, aIndent, trbl);
}
if (nsnull != mBorderWidth) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width
};
mBorderWidth->List(out, aIndent, trbl);
mBorderWidth.List(out, aIndent, trbl);
}
if (nsnull != mBorderColor) {
mBorderColor->List(out, eCSSProperty_border_color, aIndent);
}
if (nsnull != mBorderStyle) {
mBorderStyle->List(out, eCSSProperty_border_style, aIndent);
}
if (nsnull != mBorderRadius) {
mBorderColor.List(out, eCSSProperty_border_color, aIndent);
mBorderStyle.List(out, eCSSProperty_border_style, aIndent);
{
static const nsCSSProperty trbl[] = {
eCSSProperty__moz_border_radius_topLeft,
eCSSProperty__moz_border_radius_topRight,
eCSSProperty__moz_border_radius_bottomRight,
eCSSProperty__moz_border_radius_bottomLeft
};
mBorderRadius->List(out, aIndent, trbl);
mBorderRadius.List(out, aIndent, trbl);
}
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
@ -553,14 +575,14 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
mOutlineWidth.AppendToString(buffer, eCSSProperty__moz_outline_width);
mOutlineColor.AppendToString(buffer, eCSSProperty__moz_outline_color);
mOutlineStyle.AppendToString(buffer, eCSSProperty__moz_outline_style);
if (nsnull != mOutlineRadius) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty__moz_outline_radius_topLeft,
eCSSProperty__moz_outline_radius_topRight,
eCSSProperty__moz_outline_radius_bottomRight,
eCSSProperty__moz_outline_radius_bottomLeft
};
mOutlineRadius->List(out, aIndent, trbl);
mOutlineRadius.List(out, aIndent, trbl);
}
mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
@ -570,7 +592,6 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
// --- nsCSSPosition -----------------
nsCSSPosition::nsCSSPosition(void)
: mOffset(nsnull)
{
MOZ_COUNT_CTOR(nsCSSPosition);
}
@ -583,22 +604,15 @@ nsCSSPosition::nsCSSPosition(const nsCSSPosition& aCopy)
mMinHeight(aCopy.mMinHeight),
mMaxHeight(aCopy.mMaxHeight),
mBoxSizing(aCopy.mBoxSizing),
mOffset(nsnull),
mOffset(aCopy.mOffset),
mZIndex(aCopy.mZIndex)
{
MOZ_COUNT_CTOR(nsCSSPosition);
CSS_IF_COPY(mOffset, nsCSSRect);
}
nsCSSPosition::~nsCSSPosition(void)
{
MOZ_COUNT_DTOR(nsCSSPosition);
CSS_IF_DELETE(mOffset);
}
const nsID& nsCSSPosition::GetID(void)
{
return kCSSPositionSID;
}
#ifdef DEBUG
@ -618,22 +632,19 @@ void nsCSSPosition::List(FILE* out, PRInt32 aIndent) const
mZIndex.AppendToString(buffer, eCSSProperty_z_index);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
if (nsnull != mOffset) {
static const nsCSSProperty trbl[] = {
eCSSProperty_top,
eCSSProperty_right,
eCSSProperty_bottom,
eCSSProperty_left
};
mOffset->List(out, aIndent, trbl);
}
mOffset.List(out, aIndent, trbl);
}
#endif
// --- nsCSSList -----------------
nsCSSList::nsCSSList(void)
:mImageRegion(nsnull)
{
MOZ_COUNT_CTOR(nsCSSList);
}
@ -642,21 +653,14 @@ nsCSSList::nsCSSList(const nsCSSList& aCopy)
: mType(aCopy.mType),
mImage(aCopy.mImage),
mPosition(aCopy.mPosition),
mImageRegion(nsnull)
mImageRegion(aCopy.mImageRegion)
{
MOZ_COUNT_CTOR(nsCSSList);
CSS_IF_COPY(mImageRegion, nsCSSRect);
}
nsCSSList::~nsCSSList(void)
{
MOZ_COUNT_DTOR(nsCSSList);
CSS_IF_DELETE(mImageRegion);
}
const nsID& nsCSSList::GetID(void)
{
return kCSSListSID;
}
#ifdef DEBUG
@ -671,15 +675,13 @@ void nsCSSList::List(FILE* out, PRInt32 aIndent) const
mPosition.AppendToString(buffer, eCSSProperty_list_style_position);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
if (mImageRegion) {
static const nsCSSProperty trbl[] = {
eCSSProperty_top,
eCSSProperty_right,
eCSSProperty_bottom,
eCSSProperty_left
};
mImageRegion->List(out, aIndent, trbl);
}
mImageRegion.List(out, aIndent, trbl);
}
#endif
@ -706,11 +708,6 @@ nsCSSTable::~nsCSSTable(void)
MOZ_COUNT_DTOR(nsCSSTable);
}
const nsID& nsCSSTable::GetID(void)
{
return kCSSTableSID;
}
#ifdef DEBUG
void nsCSSTable::List(FILE* out, PRInt32 aIndent) const
{
@ -740,8 +737,9 @@ nsCSSBreaks::nsCSSBreaks(const nsCSSBreaks& aCopy)
: mOrphans(aCopy.mOrphans),
mWidows(aCopy.mWidows),
mPage(aCopy.mPage),
mPageBreakAfter(aCopy.mPageBreakAfter),
mPageBreakBefore(aCopy.mPageBreakBefore),
// temp fix for bug 24000
//mPageBreakAfter(aCopy.mPageBreakAfter),
//mPageBreakBefore(aCopy.mPageBreakBefore),
mPageBreakInside(aCopy.mPageBreakInside)
{
MOZ_COUNT_CTOR(nsCSSBreaks);
@ -752,11 +750,6 @@ nsCSSBreaks::~nsCSSBreaks(void)
MOZ_COUNT_DTOR(nsCSSBreaks);
}
const nsID& nsCSSBreaks::GetID(void)
{
return kCSSBreaksSID;
}
#ifdef DEBUG
void nsCSSBreaks::List(FILE* out, PRInt32 aIndent) const
{
@ -767,8 +760,9 @@ void nsCSSBreaks::List(FILE* out, PRInt32 aIndent) const
mOrphans.AppendToString(buffer, eCSSProperty_orphans);
mWidows.AppendToString(buffer, eCSSProperty_widows);
mPage.AppendToString(buffer, eCSSProperty_page);
mPageBreakAfter.AppendToString(buffer, eCSSProperty_page_break_after);
mPageBreakBefore.AppendToString(buffer, eCSSProperty_page_break_before);
// temp fix for bug 24000
//mPageBreakAfter.AppendToString(buffer, eCSSProperty_page_break_after);
//mPageBreakBefore.AppendToString(buffer, eCSSProperty_page_break_before);
mPageBreakInside.AppendToString(buffer, eCSSProperty_page_break_inside);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
@ -795,11 +789,6 @@ nsCSSPage::~nsCSSPage(void)
MOZ_COUNT_DTOR(nsCSSPage);
}
const nsID& nsCSSPage::GetID(void)
{
return kCSSPageSID;
}
#ifdef DEBUG
void nsCSSPage::List(FILE* out, PRInt32 aIndent) const
{
@ -893,11 +882,6 @@ nsCSSContent::~nsCSSContent(void)
CSS_IF_DELETE(mQuotes);
}
const nsID& nsCSSContent::GetID(void)
{
return kCSSContentSID;
}
#ifdef DEBUG
void nsCSSContent::List(FILE* out, PRInt32 aIndent) const
{
@ -923,10 +907,11 @@ void nsCSSContent::List(FILE* out, PRInt32 aIndent) const
counter = counter->mNext;
}
mMarkerOffset.AppendToString(buffer, eCSSProperty_marker_offset);
// XXX This prints the property name many times, but nobody cares.
nsCSSQuotes* quotes = mQuotes;
while (nsnull != quotes) {
quotes->mOpen.AppendToString(buffer, eCSSProperty_quotes_open);
quotes->mClose.AppendToString(buffer, eCSSProperty_quotes_close);
quotes->mOpen.AppendToString(buffer, eCSSProperty_quotes);
quotes->mClose.AppendToString(buffer, eCSSProperty_quotes);
quotes = quotes->mNext;
}
@ -964,11 +949,6 @@ nsCSSUserInterface::~nsCSSUserInterface(void)
CSS_IF_DELETE(mCursor);
}
const nsID& nsCSSUserInterface::GetID(void)
{
return kCSSUserInterfaceSID;
}
#ifdef DEBUG
void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const
{
@ -1035,11 +1015,6 @@ nsCSSAural::~nsCSSAural(void)
MOZ_COUNT_DTOR(nsCSSAural);
}
const nsID& nsCSSAural::GetID(void)
{
return kCSSAuralSID;
}
#ifdef DEBUG
void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
{
@ -1091,11 +1066,6 @@ nsCSSXUL::~nsCSSXUL(void)
MOZ_COUNT_DTOR(nsCSSXUL);
}
const nsID& nsCSSXUL::GetID(void)
{
return kCSSXULSID;
}
#ifdef DEBUG
void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
{
@ -1142,11 +1112,6 @@ nsCSSSVG::~nsCSSSVG(void)
MOZ_COUNT_DTOR(nsCSSSVG);
}
const nsID& nsCSSSVG::GetID(void)
{
return kCSSSVGSID;
}
#ifdef DEBUG
void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const
{
@ -1170,4 +1135,3 @@ void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const
#endif
#endif // MOZ_SVG

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

@ -39,92 +39,27 @@
#ifndef nsCSSStruct_h___
#define nsCSSStruct_h___
#include "nsISupports.h"
#include "nsColor.h"
#include <stdio.h>
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSValue.h"
#include <stdio.h>
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.
// We use the nsCSS* structures for storing nsCSSDeclaration's
// *temporary* data during parsing and modification. (They are too big
// for permanent storage.) We also use them for nsRuleData, with some
// additions of things that the style system must cascade, but that
// aren't CSS properties. Thus we 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 \
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_COLOR_SID \
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_TEXT_SID \
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_DISPLAY_SID \
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_MARGIN_SID \
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_POSITION_SID \
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
#define NS_CSS_LIST_SID \
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_TABLE_SID \
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_BREAKS_SID \
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_PAGE_SID \
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_CONTENT_SID \
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
#define NS_CSS_USER_INTERFACE_SID \
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_AURAL_SID \
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
#define NS_CSS_XUL_SID \
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
#ifdef MOZ_SVG
// {9A41A036-027B-45ef-89C9-6E32797839E7}
#define NS_CSS_SVG_SID \
{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } }
#endif
struct nsCSSFont : public nsCSSStruct {
nsCSSFont(void);
nsCSSFont(const nsCSSFont& aCopy);
~nsCSSFont(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -155,7 +90,6 @@ struct nsCSSColor : public nsCSSStruct {
nsCSSColor(void);
nsCSSColor(const nsCSSColor& aCopy);
~nsCSSColor(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -192,7 +126,6 @@ struct nsCSSText : public nsCSSStruct {
nsCSSText(const nsCSSText& aCopy);
~nsCSSText(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -213,6 +146,8 @@ struct nsCSSText : public nsCSSStruct {
struct nsRuleDataText : public nsCSSText {
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
@ -222,10 +157,47 @@ struct nsCSSRect {
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
#endif
PRBool operator==(const nsCSSRect& aOther) const {
return mTop == aOther.mTop &&
mRight == aOther.mRight &&
mBottom == aOther.mBottom &&
mLeft == aOther.mLeft;
}
PRBool operator!=(const nsCSSRect& aOther) const {
return mTop != aOther.mTop ||
mRight != aOther.mRight ||
mBottom != aOther.mBottom ||
mLeft != aOther.mLeft;
}
void SetAllSidesTo(const nsCSSValue& aValue);
nsCSSValue mTop;
nsCSSValue mRight;
nsCSSValue mBottom;
nsCSSValue mLeft;
typedef nsCSSValue nsCSSRect::*side_type;
static const side_type sides[4];
};
struct nsCSSValueListRect {
nsCSSValueListRect(void);
nsCSSValueListRect(const nsCSSValueListRect& aCopy);
~nsCSSValueListRect();
#ifdef DEBUG
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
#endif
nsCSSValueList* mTop;
nsCSSValueList* mRight;
nsCSSValueList* mBottom;
nsCSSValueList* mLeft;
typedef nsCSSValueList* nsCSSValueListRect::*side_type;
static const side_type sides[4];
};
struct nsCSSDisplay : public nsCSSStruct {
@ -233,7 +205,6 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSDisplay(const nsCSSDisplay& aCopy);
~nsCSSDisplay(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -245,7 +216,7 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mPosition;
nsCSSValue mFloat;
nsCSSValue mClear;
nsCSSRect* mClip;
nsCSSRect mClip;
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
@ -265,24 +236,21 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(const nsCSSMargin& aCopy);
~nsCSSMargin(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
void EnsureBorderColors();
nsCSSRect* mMargin;
nsCSSRect* mPadding;
nsCSSRect* mBorderWidth;
nsCSSRect* mBorderColor;
nsCSSValueList** mBorderColors;
nsCSSRect* mBorderStyle;
nsCSSRect* mBorderRadius; // (extension)
nsCSSRect mMargin;
nsCSSRect mPadding;
nsCSSRect mBorderWidth;
nsCSSRect mBorderColor;
nsCSSValueListRect mBorderColors;
nsCSSRect mBorderStyle;
nsCSSRect mBorderRadius; // (extension)
nsCSSValue mOutlineWidth;
nsCSSValue mOutlineColor;
nsCSSValue mOutlineStyle;
nsCSSRect* mOutlineRadius; // (extension)
nsCSSRect mOutlineRadius; // (extension)
nsCSSValue mFloatEdge; // NEW
};
@ -294,7 +262,6 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(const nsCSSPosition& aCopy);
~nsCSSPosition(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -306,7 +273,7 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSValue mMinHeight;
nsCSSValue mMaxHeight;
nsCSSValue mBoxSizing; // NEW
nsCSSRect* mOffset;
nsCSSRect mOffset;
nsCSSValue mZIndex;
};
@ -318,7 +285,6 @@ struct nsCSSList : public nsCSSStruct {
nsCSSList(const nsCSSList& aCopy);
~nsCSSList(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -326,7 +292,7 @@ struct nsCSSList : public nsCSSStruct {
nsCSSValue mType;
nsCSSValue mImage;
nsCSSValue mPosition;
nsCSSRect* mImageRegion;
nsCSSRect mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
@ -337,7 +303,6 @@ struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(const nsCSSTable& aCopy);
~nsCSSTable(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -363,7 +328,6 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(const nsCSSBreaks& aCopy);
~nsCSSBreaks(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -371,8 +335,9 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSValue mOrphans;
nsCSSValue mWidows;
nsCSSValue mPage;
nsCSSValue mPageBreakAfter;
nsCSSValue mPageBreakBefore;
// temp fix for bug 24000
//nsCSSValue mPageBreakAfter;
//nsCSSValue mPageBreakBefore;
nsCSSValue mPageBreakInside;
};
@ -384,7 +349,6 @@ struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(const nsCSSPage& aCopy);
~nsCSSPage(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -422,7 +386,6 @@ struct nsCSSContent : public nsCSSStruct {
nsCSSContent(const nsCSSContent& aCopy);
~nsCSSContent(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -442,7 +405,6 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
~nsCSSUserInterface(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -466,7 +428,6 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(const nsCSSAural& aCopy);
~nsCSSAural(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -500,7 +461,6 @@ struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(const nsCSSXUL& aCopy);
~nsCSSXUL(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -522,7 +482,6 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSSVG(const nsCSSSVG& aCopy);
~nsCSSSVG(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -544,57 +503,4 @@ struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
//
// Some useful types.
//
typedef PRUint16 nsCSSBitField;
typedef PRUint16 nsCSSDeclRefCount;
struct nsCSSDeclContains
{
nsCSSBitField mHasDisplay:1; // 1
nsCSSBitField mHasText:1; // 2
nsCSSBitField mHasColor:1; // 3
nsCSSBitField mHasMargin:1; // 4
nsCSSBitField mHasList:1; // 4
nsCSSBitField mHasFont:1; // 5
nsCSSBitField mHasPosition:1; // 6
nsCSSBitField mHasUserInterface:1; // 8
nsCSSBitField mHasTable:1; // 9
nsCSSBitField mHasContent:1; // 10
nsCSSBitField mHasXUL:1; // 11
nsCSSBitField mHasBreaks:1; // 12
nsCSSBitField mHasPage:1; // 13
nsCSSBitField mHasAural:1; // 14
#if defined(MOZ_SVG)
nsCSSBitField mHasSVG:1; // 15
#endif
};
//
// Macros used to figure out at what index the pointer to the object is.
// These macros have been placed in the order of what is considered most
// created nsCSSStruct first, such that "less math for most likely" will
// lend itself to the speed of the index lookup calculation.
// I have also ordered the bit fields, in case the compiler can come up
// with an optimization if the ordering would matter.
// Presence (mContains.mHasWhatever) is NOT tested for, so do that yourself.
//
#define CSSDECLIDX_Display(decl) ((decl).mContains.mHasDisplay - 1)
#define CSSDECLIDX_Text(decl) ((decl).mContains.mHasText + CSSDECLIDX_Display(decl))
#define CSSDECLIDX_Color(decl) ((decl).mContains.mHasColor + CSSDECLIDX_Text(decl))
#define CSSDECLIDX_Margin(decl) ((decl).mContains.mHasMargin + CSSDECLIDX_Color(decl))
#define CSSDECLIDX_List(decl) ((decl).mContains.mHasList + CSSDECLIDX_Margin(decl))
#define CSSDECLIDX_Font(decl) ((decl).mContains.mHasFont + CSSDECLIDX_List(decl))
#define CSSDECLIDX_Position(decl) ((decl).mContains.mHasPosition + CSSDECLIDX_Font(decl))
#define CSSDECLIDX_UserInterface(decl) ((decl).mContains.mHasUserInterface + CSSDECLIDX_Position(decl))
#define CSSDECLIDX_Table(decl) ((decl).mContains.mHasTable + CSSDECLIDX_UserInterface(decl))
#define CSSDECLIDX_Content(decl) ((decl).mContains.mHasContent + CSSDECLIDX_Table(decl))
#define CSSDECLIDX_XUL(decl) ((decl).mContains.mHasXUL + CSSDECLIDX_Content(decl))
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_XUL(decl))
#define CSSDECLIDX_Page(decl) ((decl).mContains.mHasPage + CSSDECLIDX_Breaks(decl))
#define CSSDECLIDX_Aural(decl) ((decl).mContains.mHasAural + CSSDECLIDX_Page(decl))
#if defined(MOZ_SVG)
#define CSSDECLIDX_SVG(decl) ((decl).mContains.mHasSVG + CSSDECLIDX_Aural(decl))
#endif
#endif /* nsCSSStruct_h___ */

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

@ -74,25 +74,6 @@
#include "nsContentUtils.h"
#include "nsContentErrors.h"
// #define DEBUG_REFS
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCSSFontSID, NS_CSS_FONT_SID);
static NS_DEFINE_IID(kCSSColorSID, NS_CSS_COLOR_SID);
static NS_DEFINE_IID(kCSSTextSID, NS_CSS_TEXT_SID);
static NS_DEFINE_IID(kCSSMarginSID, NS_CSS_MARGIN_SID);
static NS_DEFINE_IID(kCSSPositionSID, NS_CSS_POSITION_SID);
static NS_DEFINE_IID(kCSSListSID, NS_CSS_LIST_SID);
static NS_DEFINE_IID(kCSSDisplaySID, NS_CSS_DISPLAY_SID);
static NS_DEFINE_IID(kCSSTableSID, NS_CSS_TABLE_SID);
static NS_DEFINE_IID(kCSSContentSID, NS_CSS_CONTENT_SID);
static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID);
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#ifdef MOZ_SVG
static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID);
#endif
// -- nsCSSSelector -------------------------------
#define NS_IF_COPY(dest,source,type) \
@ -213,10 +194,6 @@ PRBool nsAtomStringList::Equals(const nsAtomStringList* aOther) const
MOZ_DECL_CTOR_COUNTER(nsAttrSelector)
#ifdef DEBUG_REFS
PRUint32 gAttrSelectorCount=0;
#endif
nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr)
: mNameSpace(aNameSpace),
mAttr(nsnull),
@ -227,11 +204,6 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr)
{
MOZ_COUNT_CTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
#endif
mAttr = NS_NewAtom(aAttr);
}
@ -246,11 +218,6 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint
{
MOZ_COUNT_CTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
#endif
mAttr = NS_NewAtom(aAttr);
}
@ -264,11 +231,6 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy)
{
MOZ_COUNT_CTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount);
#endif
NS_IF_ADDREF(mAttr);
NS_IF_COPY(mNext, aCopy.mNext, nsAttrSelector);
}
@ -277,11 +239,6 @@ nsAttrSelector::~nsAttrSelector(void)
{
MOZ_COUNT_DTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount--;
printf( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount);
#endif
NS_IF_RELEASE(mAttr);
NS_IF_DELETE(mNext);
}
@ -308,10 +265,6 @@ PRBool nsAttrSelector::Equals(const nsAttrSelector* aOther) const
MOZ_DECL_CTOR_COUNTER(nsCSSSelector)
#ifdef DEBUG_REFS
PRUint32 gSelectorCount=0;
#endif
nsCSSSelector::nsCSSSelector(void)
: mNameSpace(kNameSpaceID_Unknown), mTag(nsnull),
mIDList(nsnull),
@ -323,11 +276,6 @@ nsCSSSelector::nsCSSSelector(void)
mNext(nsnull)
{
MOZ_COUNT_CTOR(nsCSSSelector);
#ifdef DEBUG_REFS
gSelectorCount++;
printf( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount);
#endif
}
nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy)
@ -346,22 +294,12 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy)
NS_IF_COPY(mPseudoClassList, aCopy.mPseudoClassList, nsAtomStringList);
NS_IF_COPY(mAttrList, aCopy.mAttrList, nsAttrSelector);
NS_IF_COPY(mNegations, aCopy.mNegations, nsCSSSelector);
#ifdef DEBUG_REFS
gSelectorCount++;
printf( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount);
#endif
}
nsCSSSelector::~nsCSSSelector(void)
{
MOZ_COUNT_DTOR(nsCSSSelector);
Reset();
#ifdef DEBUG_REFS
gSelectorCount--;
printf( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount);
#endif
}
nsCSSSelector& nsCSSSelector::operator=(const nsCSSSelector& aCopy)
@ -761,24 +699,6 @@ nsresult nsCSSSelector::ToString( nsAString& aString, nsICSSStyleSheet* aSheet,
// -- CSSImportantRule -------------------------------
// New map helpers shared by both important and regular rules.
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);
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL);
#ifdef MOZ_SVG
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG);
#endif
class CSSStyleRuleImpl;
class CSSImportantRule : public nsIStyleRule {
@ -829,37 +749,7 @@ CSSImportantRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
NS_IMETHODIMP
CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (!aRuleData)
return NS_OK;
if (aRuleData->mFontData)
return MapFontForDeclaration(mDeclaration, *aRuleData->mFontData);
else if (aRuleData->mDisplayData)
return MapDisplayForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mDisplayData);
else if (aRuleData->mColorData)
return MapColorForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mColorData);
else if (aRuleData->mMarginData)
return MapMarginForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mMarginData);
else if (aRuleData->mListData)
return MapListForDeclaration(mDeclaration, *aRuleData->mListData);
else if (aRuleData->mPositionData)
return MapPositionForDeclaration(mDeclaration, *aRuleData->mPositionData);
else if (aRuleData->mTableData)
return MapTableForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTableData);
else if (aRuleData->mContentData)
return MapContentForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mContentData);
else if (aRuleData->mTextData)
return MapTextForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTextData);
else if (aRuleData->mUIData)
return MapUIForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mUIData);
else if (aRuleData->mXULData)
return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData);
#ifdef MOZ_SVG
else if (aRuleData->mSVGData)
return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData);
#endif
return NS_OK;
return mDeclaration->MapImportantRuleInfoInto(aRuleData);
}
#ifdef DEBUG
@ -953,14 +843,12 @@ DOMCSSDeclarationImpl::RemoveProperty(const nsAString& aPropertyName,
owningDoc->BeginUpdate();
}
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
nsCSSValue val;
rv = decl->RemoveProperty(prop, val);
decl->GetValue(prop, aReturn);
rv = decl->RemoveProperty(prop);
if (NS_SUCCEEDED(rv)) {
// We pass in eCSSProperty_UNKNOWN here so that we don't get the
// property name in the return string.
val.ToString(aReturn, eCSSProperty_UNKNOWN);
if (cssSheet) {
cssSheet->SetModified(PR_TRUE);
}
@ -1112,26 +1000,10 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAString& aDecl,
getter_AddRefs(cssParser));
if (NS_SUCCEEDED(result)) {
if (aClearOldDecl) {
// This should be done with decl->Clear() once such a method exists.
nsAutoString propName;
PRUint32 count, i;
count = decl->Count();
for (i = 0; i < count; i++) {
decl->GetNthProperty(0, propName);
nsCSSProperty prop = nsCSSProps::LookupProperty(propName);
nsCSSValue val;
decl->RemoveProperty(prop, val);
}
}
nsChangeHint hint;
result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,
aParseOnlyOneDecl, &hint);
aParseOnlyOneDecl, &hint,
aClearOldDecl);
if (NS_SUCCEEDED(result)) {
if (cssSheet) {
@ -1235,20 +1107,12 @@ protected:
PRUint32 mLineNumber;
};
#ifdef DEBUG_REFS
PRUint32 gStyleRuleCount=0;
#endif
CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector)
: nsCSSRule(),
mSelector(aSelector), mDeclaration(nsnull),
mWeight(0), mImportantRule(nsnull),
mDOMDeclaration(nsnull)
{
#ifdef DEBUG_REFS
gStyleRuleCount++;
printf( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount);
#endif
}
CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
@ -1259,11 +1123,6 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
mImportantRule(nsnull),
mDOMDeclaration(nsnull)
{
#ifdef DEBUG_REFS
gStyleRuleCount++;
printf( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount);
#endif
nsCSSSelector* copySel = aCopy.mSelector.mNext;
nsCSSSelector* ourSel = &mSelector;
@ -1285,11 +1144,6 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
{
#ifdef DEBUG_REFS
gStyleRuleCount--;
printf( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount);
#endif
nsCSSSelector* next = mSelector.mNext;
while (nsnull != next) {
@ -1425,9 +1279,8 @@ void CSSStyleRuleImpl::SetWeight(PRInt32 aWeight)
already_AddRefed<nsIStyleRule> CSSStyleRuleImpl::GetImportantRule(void)
{
if (!mImportantRule && mDeclaration) {
nsCSSDeclaration* important = mDeclaration->GetImportantValues();
if (important) {
mImportantRule = new CSSImportantRule(mSheet, important);
if (mDeclaration->HasImportantData()) {
mImportantRule = new CSSImportantRule(mSheet, mDeclaration);
NS_ADDREF(mImportantRule);
}
}
@ -1438,7 +1291,7 @@ already_AddRefed<nsIStyleRule> CSSStyleRuleImpl::GetImportantRule(void)
nsresult
CSSStyleRuleImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue)
{
return mDeclaration->GetValue(aProperty, aValue);
return mDeclaration->GetValueOrImportantValue(aProperty, aValue);
}
NS_IMETHODIMP
@ -1484,688 +1337,7 @@ CSSStyleRuleImpl::Clone(nsICSSRule*& aClone) const
NS_IMETHODIMP
CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (!aRuleData)
return NS_OK;
if (aRuleData->mFontData)
return MapFontForDeclaration(mDeclaration, *aRuleData->mFontData);
else if (aRuleData->mDisplayData)
return MapDisplayForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mDisplayData);
else if (aRuleData->mColorData)
return MapColorForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mColorData);
else if (aRuleData->mMarginData)
return MapMarginForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mMarginData);
else if (aRuleData->mListData)
return MapListForDeclaration(mDeclaration, *aRuleData->mListData);
else if (aRuleData->mPositionData)
return MapPositionForDeclaration(mDeclaration, *aRuleData->mPositionData);
else if (aRuleData->mTableData)
return MapTableForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTableData);
else if (aRuleData->mContentData)
return MapContentForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mContentData);
else if (aRuleData->mTextData)
return MapTextForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTextData);
else if (aRuleData->mUIData)
return MapUIForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mUIData);
else if (aRuleData->mXULData)
return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData);
#ifdef MOZ_SVG
else if (aRuleData->mSVGData)
return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData);
#endif
return NS_OK;
}
static nsresult
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataFont& aFont)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSFont* ourFont = (nsCSSFont*)aDecl->GetData(kCSSFontSID);
if (!ourFont)
return NS_OK; // We don't have any rules for fonts.
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;
if (eCSSUnit_Null == aFont.mVariant.GetUnit() && eCSSUnit_Null != ourFont->mVariant.GetUnit())
aFont.mVariant = ourFont->mVariant;
if (eCSSUnit_Null == aFont.mWeight.GetUnit() && eCSSUnit_Null != ourFont->mWeight.GetUnit())
aFont.mWeight = ourFont->mWeight;
if (eCSSUnit_Null == aFont.mSize.GetUnit() && eCSSUnit_Null != ourFont->mSize.GetUnit())
aFont.mSize = ourFont->mSize;
if (eCSSUnit_Null == aFont.mSizeAdjust.GetUnit() && eCSSUnit_Null != ourFont->mSizeAdjust.GetUnit())
aFont.mSizeAdjust = ourFont->mSizeAdjust;
return NS_OK;
}
static nsresult
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSXUL* ourXUL = (nsCSSXUL*)aDecl->GetData(kCSSXULSID);
if (!ourXUL)
return NS_OK; // We don't have any rules for XUL.
// box-align: enum, inherit
if (aXUL.mBoxAlign.GetUnit() == eCSSUnit_Null && ourXUL->mBoxAlign.GetUnit() != eCSSUnit_Null)
aXUL.mBoxAlign = ourXUL->mBoxAlign;
// box-direction: enum, inherit
if (aXUL.mBoxDirection.GetUnit() == eCSSUnit_Null && ourXUL->mBoxDirection.GetUnit() != eCSSUnit_Null)
aXUL.mBoxDirection = ourXUL->mBoxDirection;
// box-flex: enum, inherit
if (aXUL.mBoxFlex.GetUnit() == eCSSUnit_Null && ourXUL->mBoxFlex.GetUnit() != eCSSUnit_Null)
aXUL.mBoxFlex = ourXUL->mBoxFlex;
// box-orient: enum, inherit
if (aXUL.mBoxOrient.GetUnit() == eCSSUnit_Null && ourXUL->mBoxOrient.GetUnit() != eCSSUnit_Null)
aXUL.mBoxOrient = ourXUL->mBoxOrient;
// box-pack: enum, inherit
if (aXUL.mBoxPack.GetUnit() == eCSSUnit_Null && ourXUL->mBoxPack.GetUnit() != eCSSUnit_Null)
aXUL.mBoxPack = ourXUL->mBoxPack;
// box-ordinal-group: number
if (aXUL.mBoxOrdinal.GetUnit() == eCSSUnit_Null && ourXUL->mBoxOrdinal.GetUnit() != eCSSUnit_Null)
aXUL.mBoxOrdinal = ourXUL->mBoxOrdinal;
return NS_OK;
}
#ifdef MOZ_SVG
static nsresult
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSSVG* ourSVG = (nsCSSSVG*)aDecl->GetData(kCSSSVGSID);
if (!ourSVG)
return NS_OK; // We don't have any rules for SVG.
// fill:
if (aSVG.mFill.GetUnit() == eCSSUnit_Null && ourSVG->mFill.GetUnit() != eCSSUnit_Null)
aSVG.mFill = ourSVG->mFill;
// fill-opacity:
if (aSVG.mFillOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mFillOpacity.GetUnit() != eCSSUnit_Null)
aSVG.mFillOpacity = ourSVG->mFillOpacity;
// fill-rule:
if (aSVG.mFillRule.GetUnit() == eCSSUnit_Null && ourSVG->mFillRule.GetUnit() != eCSSUnit_Null)
aSVG.mFillRule = ourSVG->mFillRule;
// stroke:
if (aSVG.mStroke.GetUnit() == eCSSUnit_Null && ourSVG->mStroke.GetUnit() != eCSSUnit_Null)
aSVG.mStroke = ourSVG->mStroke;
// stroke-dasharray:
if (aSVG.mStrokeDasharray.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDasharray.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeDasharray = ourSVG->mStrokeDasharray;
// stroke-dashoffset:
if (aSVG.mStrokeDashoffset.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDashoffset.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeDashoffset = ourSVG->mStrokeDashoffset;
// stroke-linecap: enum, inherit
if (aSVG.mStrokeLinecap.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinecap.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeLinecap = ourSVG->mStrokeLinecap;
// stroke-linejoin
if (aSVG.mStrokeLinejoin.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinejoin.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeLinejoin = ourSVG->mStrokeLinejoin;
// stroke-miterlimit:
if (aSVG.mStrokeMiterlimit.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeMiterlimit.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeMiterlimit = ourSVG->mStrokeMiterlimit;
// stroke-opacity:
if (aSVG.mStrokeOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeOpacity.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeOpacity = ourSVG->mStrokeOpacity;
// stroke-width:
if (aSVG.mStrokeWidth.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeWidth.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeWidth = ourSVG->mStrokeWidth;
return NS_OK;
}
#endif
static nsresult
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataPosition& aPosition)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSPosition* ourPosition = (nsCSSPosition*)aDecl->GetData(kCSSPositionSID);
if (!ourPosition)
return NS_OK; // We don't have any rules for position.
// box offsets: length, percent, auto, inherit
if (ourPosition->mOffset) {
if (aPosition.mOffset->mLeft.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mLeft.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mLeft = ourPosition->mOffset->mLeft;
if (aPosition.mOffset->mRight.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mRight.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mRight = ourPosition->mOffset->mRight;
if (aPosition.mOffset->mTop.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mTop.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mTop = ourPosition->mOffset->mTop;
if (aPosition.mOffset->mBottom.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mBottom.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mBottom = ourPosition->mOffset->mBottom;
}
// width/min-width/max-width
if (aPosition.mWidth.GetUnit() == eCSSUnit_Null && ourPosition->mWidth.GetUnit() != eCSSUnit_Null)
aPosition.mWidth = ourPosition->mWidth;
if (aPosition.mMinWidth.GetUnit() == eCSSUnit_Null && ourPosition->mMinWidth.GetUnit() != eCSSUnit_Null)
aPosition.mMinWidth = ourPosition->mMinWidth;
if (aPosition.mMaxWidth.GetUnit() == eCSSUnit_Null && ourPosition->mMaxWidth.GetUnit() != eCSSUnit_Null)
aPosition.mMaxWidth = ourPosition->mMaxWidth;
// height/min-height/max-height
if (aPosition.mHeight.GetUnit() == eCSSUnit_Null && ourPosition->mHeight.GetUnit() != eCSSUnit_Null)
aPosition.mHeight = ourPosition->mHeight;
if (aPosition.mMinHeight.GetUnit() == eCSSUnit_Null && ourPosition->mMinHeight.GetUnit() != eCSSUnit_Null)
aPosition.mMinHeight = ourPosition->mMinHeight;
if (aPosition.mMaxHeight.GetUnit() == eCSSUnit_Null && ourPosition->mMaxHeight.GetUnit() != eCSSUnit_Null)
aPosition.mMaxHeight = ourPosition->mMaxHeight;
// box-sizing: enum, inherit
if (aPosition.mBoxSizing.GetUnit() == eCSSUnit_Null && ourPosition->mBoxSizing.GetUnit() != eCSSUnit_Null)
aPosition.mBoxSizing = ourPosition->mBoxSizing;
// z-index
if (aPosition.mZIndex.GetUnit() == eCSSUnit_Null && ourPosition->mZIndex.GetUnit() != eCSSUnit_Null)
aPosition.mZIndex = ourPosition->mZIndex;
return NS_OK;
}
static nsresult
MapListForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataList& aList)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSList* ourList = (nsCSSList*)aDecl->GetData(kCSSListSID);
if (!ourList)
return NS_OK; // We don't have any rules for lists.
// list-style-type: enum, none, inherit
if (aList.mType.GetUnit() == eCSSUnit_Null && ourList->mType.GetUnit() != eCSSUnit_Null)
aList.mType = ourList->mType;
// list-style-image: url, none, inherit
if (aList.mImage.GetUnit() == eCSSUnit_Null && ourList->mImage.GetUnit() != eCSSUnit_Null)
aList.mImage = ourList->mImage;
// list-style-position: enum, inherit
if (aList.mPosition.GetUnit() == eCSSUnit_Null && ourList->mPosition.GetUnit() != eCSSUnit_Null)
aList.mPosition = ourList->mPosition;
// image region: length, auto or inherit
if (ourList->mImageRegion) {
if (aList.mImageRegion->mLeft.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mLeft.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mLeft = ourList->mImageRegion->mLeft;
if (aList.mImageRegion->mRight.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mRight.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mRight = ourList->mImageRegion->mRight;
if (aList.mImageRegion->mTop.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mTop.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mTop = ourList->mImageRegion->mTop;
if (aList.mImageRegion->mBottom.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mBottom.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mBottom = ourList->mImageRegion->mBottom;
}
return NS_OK;
}
static nsresult
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsRuleDataMargin& aMargin)
{
nsCSSMargin* ourMargin = (nsCSSMargin*)aDeclaration->GetData(kCSSMarginSID);
if (!ourMargin)
return NS_OK;
// Margins
if (aSID == eStyleStruct_Margin && ourMargin->mMargin) {
if (eCSSUnit_Null == aMargin.mMargin->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mLeft.GetUnit())
aMargin.mMargin->mLeft = ourMargin->mMargin->mLeft;
if (eCSSUnit_Null == aMargin.mMargin->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mTop.GetUnit())
aMargin.mMargin->mTop = ourMargin->mMargin->mTop;
if (eCSSUnit_Null == aMargin.mMargin->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mRight.GetUnit())
aMargin.mMargin->mRight = ourMargin->mMargin->mRight;
if (eCSSUnit_Null == aMargin.mMargin->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mBottom.GetUnit())
aMargin.mMargin->mBottom = ourMargin->mMargin->mBottom;
}
// Padding
if (aSID == eStyleStruct_Padding && ourMargin->mPadding) {
if (eCSSUnit_Null == aMargin.mPadding->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mLeft.GetUnit())
aMargin.mPadding->mLeft = ourMargin->mPadding->mLeft;
if (eCSSUnit_Null == aMargin.mPadding->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mTop.GetUnit())
aMargin.mPadding->mTop = ourMargin->mPadding->mTop;
if (eCSSUnit_Null == aMargin.mPadding->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mRight.GetUnit())
aMargin.mPadding->mRight = ourMargin->mPadding->mRight;
if (eCSSUnit_Null == aMargin.mPadding->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mBottom.GetUnit())
aMargin.mPadding->mBottom = ourMargin->mPadding->mBottom;
}
// Borders
if (aSID == eStyleStruct_Border) {
// border-size
if (ourMargin->mBorderWidth) {
if (eCSSUnit_Null == aMargin.mBorderWidth->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mLeft.GetUnit())
aMargin.mBorderWidth->mLeft = ourMargin->mBorderWidth->mLeft;
if (eCSSUnit_Null == aMargin.mBorderWidth->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mTop.GetUnit())
aMargin.mBorderWidth->mTop = ourMargin->mBorderWidth->mTop;
if (eCSSUnit_Null == aMargin.mBorderWidth->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mRight.GetUnit())
aMargin.mBorderWidth->mRight = ourMargin->mBorderWidth->mRight;
if (eCSSUnit_Null == aMargin.mBorderWidth->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mBottom.GetUnit())
aMargin.mBorderWidth->mBottom = ourMargin->mBorderWidth->mBottom;
}
// border-style
if (ourMargin->mBorderStyle) {
if (eCSSUnit_Null == aMargin.mBorderStyle->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mLeft.GetUnit())
aMargin.mBorderStyle->mLeft = ourMargin->mBorderStyle->mLeft;
if (eCSSUnit_Null == aMargin.mBorderStyle->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mTop.GetUnit())
aMargin.mBorderStyle->mTop = ourMargin->mBorderStyle->mTop;
if (eCSSUnit_Null == aMargin.mBorderStyle->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mRight.GetUnit())
aMargin.mBorderStyle->mRight = ourMargin->mBorderStyle->mRight;
if (eCSSUnit_Null == aMargin.mBorderStyle->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mBottom.GetUnit())
aMargin.mBorderStyle->mBottom = ourMargin->mBorderStyle->mBottom;
}
// border-color
if (ourMargin->mBorderColor) {
if (eCSSUnit_Null == aMargin.mBorderColor->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mLeft.GetUnit())
aMargin.mBorderColor->mLeft = ourMargin->mBorderColor->mLeft;
if (eCSSUnit_Null == aMargin.mBorderColor->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mTop.GetUnit())
aMargin.mBorderColor->mTop = ourMargin->mBorderColor->mTop;
if (eCSSUnit_Null == aMargin.mBorderColor->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mRight.GetUnit())
aMargin.mBorderColor->mRight = ourMargin->mBorderColor->mRight;
if (eCSSUnit_Null == aMargin.mBorderColor->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mBottom.GetUnit())
aMargin.mBorderColor->mBottom = ourMargin->mBorderColor->mBottom;
}
// border-colors
if (ourMargin->mBorderColors) {
for (PRInt32 i = 0; i < 4; i++)
if (!aMargin.mBorderColors[i] && ourMargin->mBorderColors[i])
aMargin.mBorderColors[i] = ourMargin->mBorderColors[i];
}
// -moz-border-radius
if (ourMargin->mBorderRadius) {
if (eCSSUnit_Null == aMargin.mBorderRadius->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mLeft.GetUnit())
aMargin.mBorderRadius->mLeft = ourMargin->mBorderRadius->mLeft;
if (eCSSUnit_Null == aMargin.mBorderRadius->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mTop.GetUnit())
aMargin.mBorderRadius->mTop = ourMargin->mBorderRadius->mTop;
if (eCSSUnit_Null == aMargin.mBorderRadius->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mRight.GetUnit())
aMargin.mBorderRadius->mRight = ourMargin->mBorderRadius->mRight;
if (eCSSUnit_Null == aMargin.mBorderRadius->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mBottom.GetUnit())
aMargin.mBorderRadius->mBottom = ourMargin->mBorderRadius->mBottom;
}
// float-edge
if (eCSSUnit_Null == aMargin.mFloatEdge.GetUnit() && eCSSUnit_Null != ourMargin->mFloatEdge.GetUnit())
aMargin.mFloatEdge = ourMargin->mFloatEdge;
}
// Outline
if (aSID == eStyleStruct_Outline) {
// -moz-outline-radius
if (ourMargin->mOutlineRadius) {
if (eCSSUnit_Null == aMargin.mOutlineRadius->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mLeft.GetUnit())
aMargin.mOutlineRadius->mLeft = ourMargin->mOutlineRadius->mLeft;
if (eCSSUnit_Null == aMargin.mOutlineRadius->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mTop.GetUnit())
aMargin.mOutlineRadius->mTop = ourMargin->mOutlineRadius->mTop;
if (eCSSUnit_Null == aMargin.mOutlineRadius->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mRight.GetUnit())
aMargin.mOutlineRadius->mRight = ourMargin->mOutlineRadius->mRight;
if (eCSSUnit_Null == aMargin.mOutlineRadius->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mBottom.GetUnit())
aMargin.mOutlineRadius->mBottom = ourMargin->mOutlineRadius->mBottom;
}
// outline-width
if (eCSSUnit_Null == aMargin.mOutlineWidth.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineWidth.GetUnit())
aMargin.mOutlineWidth = ourMargin->mOutlineWidth;
// outline-color
if (eCSSUnit_Null == aMargin.mOutlineColor.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineColor.GetUnit())
aMargin.mOutlineColor = ourMargin->mOutlineColor;
// outline-style
if (eCSSUnit_Null == aMargin.mOutlineStyle.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineStyle.GetUnit())
aMargin.mOutlineStyle = ourMargin->mOutlineStyle;
}
return NS_OK;
}
static nsresult
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataColor& aColor)
{
if (!aDecl)
return NS_OK;
nsCSSColor* ourColor = (nsCSSColor*)aDecl->GetData(kCSSColorSID);
if (!ourColor)
return NS_OK; // No rules for color or background.
if (aID == eStyleStruct_Color) {
// color: color, string, inherit
if (aColor.mColor.GetUnit() == eCSSUnit_Null && ourColor->mColor.GetUnit() != eCSSUnit_Null)
aColor.mColor = ourColor->mColor;
}
else if (aID == eStyleStruct_Background) {
// background-color: color, string, enum (flags), inherit
if (aColor.mBackColor.GetUnit() == eCSSUnit_Null && ourColor->mBackColor.GetUnit() != eCSSUnit_Null)
aColor.mBackColor = ourColor->mBackColor;
// background-image: url, none, inherit
if (aColor.mBackImage.GetUnit() == eCSSUnit_Null && ourColor->mBackImage.GetUnit() != eCSSUnit_Null)
aColor.mBackImage = ourColor->mBackImage;
// background-repeat: enum, inherit
if (aColor.mBackRepeat.GetUnit() == eCSSUnit_Null && ourColor->mBackRepeat.GetUnit() != eCSSUnit_Null)
aColor.mBackRepeat = ourColor->mBackRepeat;
// background-attachment: enum, inherit
if (aColor.mBackAttachment.GetUnit() == eCSSUnit_Null && ourColor->mBackAttachment.GetUnit() != eCSSUnit_Null)
aColor.mBackAttachment = ourColor->mBackAttachment;
// background-position: enum, length, percent (flags), inherit
if (aColor.mBackPositionX.GetUnit() == eCSSUnit_Null && ourColor->mBackPositionX.GetUnit() != eCSSUnit_Null)
aColor.mBackPositionX = ourColor->mBackPositionX;
if (aColor.mBackPositionY.GetUnit() == eCSSUnit_Null && ourColor->mBackPositionY.GetUnit() != eCSSUnit_Null)
aColor.mBackPositionY = ourColor->mBackPositionY;
// background-clip: enum, inherit
if (aColor.mBackClip.GetUnit() == eCSSUnit_Null && ourColor->mBackClip.GetUnit() != eCSSUnit_Null)
aColor.mBackClip = ourColor->mBackClip;
// background-inline-policy: enum, inherit
if (aColor.mBackInlinePolicy.GetUnit() == eCSSUnit_Null && ourColor->mBackInlinePolicy.GetUnit() != eCSSUnit_Null)
aColor.mBackInlinePolicy = ourColor->mBackInlinePolicy;
// background-origin: enum, inherit
if (aColor.mBackOrigin.GetUnit() == eCSSUnit_Null && ourColor->mBackOrigin.GetUnit() != eCSSUnit_Null)
aColor.mBackOrigin = ourColor->mBackOrigin;
}
return NS_OK;
}
static nsresult
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataTable& aTable)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSTable* ourTable = (nsCSSTable*)aDecl->GetData(kCSSTableSID);
if (!ourTable)
return NS_OK; // We don't have any rules for tables.
if (aID == eStyleStruct_TableBorder) {
// border-collapse: enum, inherit
if (aTable.mBorderCollapse.GetUnit() == eCSSUnit_Null && ourTable->mBorderCollapse.GetUnit() != eCSSUnit_Null)
aTable.mBorderCollapse = ourTable->mBorderCollapse;
// border-spacing-x: length, inherit
if (aTable.mBorderSpacingX.GetUnit() == eCSSUnit_Null && ourTable->mBorderSpacingX.GetUnit() != eCSSUnit_Null)
aTable.mBorderSpacingX = ourTable->mBorderSpacingX;
// border-spacing-y: length, inherit
if (aTable.mBorderSpacingY.GetUnit() == eCSSUnit_Null && ourTable->mBorderSpacingY.GetUnit() != eCSSUnit_Null)
aTable.mBorderSpacingY = ourTable->mBorderSpacingY;
// caption-side: enum, inherit
if (aTable.mCaptionSide.GetUnit() == eCSSUnit_Null && ourTable->mCaptionSide.GetUnit() != eCSSUnit_Null)
aTable.mCaptionSide = ourTable->mCaptionSide;
// empty-cells: enum, inherit
if (aTable.mEmptyCells.GetUnit() == eCSSUnit_Null && ourTable->mEmptyCells.GetUnit() != eCSSUnit_Null)
aTable.mEmptyCells = ourTable->mEmptyCells;
}
else if (aID == eStyleStruct_Table) {
// table-layout: auto, enum, inherit
if (aTable.mLayout.GetUnit() == eCSSUnit_Null && ourTable->mLayout.GetUnit() != eCSSUnit_Null)
aTable.mLayout = ourTable->mLayout;
}
return NS_OK;
}
static nsresult
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataContent& aContent)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSContent* ourContent = (nsCSSContent*)aDecl->GetData(kCSSContentSID);
if (!ourContent)
return NS_OK; // We don't have any rules for content.
if (aID == eStyleStruct_Content) {
if (!aContent.mContent && ourContent->mContent)
aContent.mContent = ourContent->mContent;
if (!aContent.mCounterIncrement && ourContent->mCounterIncrement)
aContent.mCounterIncrement = ourContent->mCounterIncrement;
if (!aContent.mCounterReset && ourContent->mCounterReset)
aContent.mCounterReset = ourContent->mCounterReset;
if (aContent.mMarkerOffset.GetUnit() == eCSSUnit_Null && ourContent->mMarkerOffset.GetUnit() != eCSSUnit_Null)
aContent.mMarkerOffset = ourContent->mMarkerOffset;
}
else if (aID == eStyleStruct_Quotes) {
if (!aContent.mQuotes && ourContent->mQuotes)
aContent.mQuotes = ourContent->mQuotes;
}
return NS_OK;
}
static nsresult
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataText& aText)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSText* ourText = (nsCSSText*)aDecl->GetData(kCSSTextSID);
if (!ourText)
return NS_OK; // We don't have any rules for text.
if (aID == eStyleStruct_Text) {
if (aText.mLetterSpacing.GetUnit() == eCSSUnit_Null && ourText->mLetterSpacing.GetUnit() != eCSSUnit_Null)
aText.mLetterSpacing = ourText->mLetterSpacing;
if (aText.mLineHeight.GetUnit() == eCSSUnit_Null && ourText->mLineHeight.GetUnit() != eCSSUnit_Null)
aText.mLineHeight = ourText->mLineHeight;
if (aText.mTextIndent.GetUnit() == eCSSUnit_Null && ourText->mTextIndent.GetUnit() != eCSSUnit_Null)
aText.mTextIndent = ourText->mTextIndent;
if (aText.mTextTransform.GetUnit() == eCSSUnit_Null && ourText->mTextTransform.GetUnit() != eCSSUnit_Null)
aText.mTextTransform = ourText->mTextTransform;
if (aText.mTextAlign.GetUnit() == eCSSUnit_Null && ourText->mTextAlign.GetUnit() != eCSSUnit_Null)
aText.mTextAlign = ourText->mTextAlign;
if (aText.mWhiteSpace.GetUnit() == eCSSUnit_Null && ourText->mWhiteSpace.GetUnit() != eCSSUnit_Null)
aText.mWhiteSpace = ourText->mWhiteSpace;
if (aText.mWordSpacing.GetUnit() == eCSSUnit_Null && ourText->mWordSpacing.GetUnit() != eCSSUnit_Null)
aText.mWordSpacing = ourText->mWordSpacing;
}
else if (aID == eStyleStruct_TextReset) {
if (aText.mVerticalAlign.GetUnit() == eCSSUnit_Null && ourText->mVerticalAlign.GetUnit() != eCSSUnit_Null)
aText.mVerticalAlign = ourText->mVerticalAlign;
if (aText.mDecoration.GetUnit() == eCSSUnit_Null && ourText->mDecoration.GetUnit() != eCSSUnit_Null)
aText.mDecoration = ourText->mDecoration;
if (aText.mUnicodeBidi.GetUnit() == eCSSUnit_Null && ourText->mUnicodeBidi.GetUnit() != eCSSUnit_Null)
aText.mUnicodeBidi = ourText->mUnicodeBidi;
}
return NS_OK;
}
static nsresult
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataDisplay& aDisplay)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSDisplay* ourDisplay = (nsCSSDisplay*)aDecl->GetData(kCSSDisplaySID);
if (!ourDisplay)
return NS_OK; // We don't have any rules for display.
if (aID == eStyleStruct_Display) {
// appearance: enum, none, inherit
if (aDisplay.mAppearance.GetUnit() == eCSSUnit_Null &&
ourDisplay->mAppearance.GetUnit() != eCSSUnit_Null)
aDisplay.mAppearance = ourDisplay->mAppearance;
// display: enum, none, inherit
if (aDisplay.mDisplay.GetUnit() == eCSSUnit_Null && ourDisplay->mDisplay.GetUnit() != eCSSUnit_Null)
aDisplay.mDisplay = ourDisplay->mDisplay;
// binding: url, none, inherit
if (aDisplay.mBinding.GetUnit() == eCSSUnit_Null && ourDisplay->mBinding.GetUnit() != eCSSUnit_Null)
aDisplay.mBinding = ourDisplay->mBinding;
// position: enum, inherit
if (aDisplay.mPosition.GetUnit() == eCSSUnit_Null && ourDisplay->mPosition.GetUnit() != eCSSUnit_Null)
aDisplay.mPosition = ourDisplay->mPosition;
// clear: enum, none, inherit
if (aDisplay.mClear.GetUnit() == eCSSUnit_Null && ourDisplay->mClear.GetUnit() != eCSSUnit_Null)
aDisplay.mClear = ourDisplay->mClear;
// temp fix for bug 24000
if (aDisplay.mBreakBefore.GetUnit() == eCSSUnit_Null && ourDisplay->mBreakBefore.GetUnit() != eCSSUnit_Null)
aDisplay.mBreakBefore = ourDisplay->mBreakBefore;
if (aDisplay.mBreakAfter.GetUnit() == eCSSUnit_Null && ourDisplay->mBreakAfter.GetUnit() != eCSSUnit_Null)
aDisplay.mBreakAfter = ourDisplay->mBreakAfter;
// end temp fix
// float: enum, none, inherit
if (aDisplay.mFloat.GetUnit() == eCSSUnit_Null && ourDisplay->mFloat.GetUnit() != eCSSUnit_Null)
aDisplay.mFloat = ourDisplay->mFloat;
// overflow: enum, auto, inherit
if (aDisplay.mOverflow.GetUnit() == eCSSUnit_Null && ourDisplay->mOverflow.GetUnit() != eCSSUnit_Null)
aDisplay.mOverflow = ourDisplay->mOverflow;
// clip property: length, auto, inherit
if (ourDisplay->mClip) {
if (aDisplay.mClip->mLeft.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mLeft.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mLeft = ourDisplay->mClip->mLeft;
if (aDisplay.mClip->mRight.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mRight.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mRight = ourDisplay->mClip->mRight;
if (aDisplay.mClip->mTop.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mTop.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mTop = ourDisplay->mClip->mTop;
if (aDisplay.mClip->mBottom.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mBottom.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mBottom = ourDisplay->mClip->mBottom;
}
}
else if (aID == eStyleStruct_Visibility) {
// opacity: factor, inherit
if (aDisplay.mOpacity.GetUnit() == eCSSUnit_Null && ourDisplay->mOpacity.GetUnit() != eCSSUnit_Null)
aDisplay.mOpacity = ourDisplay->mOpacity;
// direction: enum, inherit
if (aDisplay.mDirection.GetUnit() == eCSSUnit_Null && ourDisplay->mDirection.GetUnit() != eCSSUnit_Null)
aDisplay.mDirection = ourDisplay->mDirection;
// visibility: enum, inherit
if (aDisplay.mVisibility.GetUnit() == eCSSUnit_Null && ourDisplay->mVisibility.GetUnit() != eCSSUnit_Null)
aDisplay.mVisibility = ourDisplay->mVisibility;
}
return NS_OK;
}
static nsresult
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataUserInterface& aUI)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSUserInterface* ourUI = (nsCSSUserInterface*)aDecl->GetData(kCSSUserInterfaceSID);
if (!ourUI)
return NS_OK; // We don't have any rules for UI.
if (aID == eStyleStruct_UserInterface) {
if (aUI.mUserFocus.GetUnit() == eCSSUnit_Null && ourUI->mUserFocus.GetUnit() != eCSSUnit_Null)
aUI.mUserFocus = ourUI->mUserFocus;
if (aUI.mUserInput.GetUnit() == eCSSUnit_Null && ourUI->mUserInput.GetUnit() != eCSSUnit_Null)
aUI.mUserInput = ourUI->mUserInput;
if (aUI.mUserModify.GetUnit() == eCSSUnit_Null && ourUI->mUserModify.GetUnit() != eCSSUnit_Null)
aUI.mUserModify = ourUI->mUserModify;
if (!aUI.mCursor && ourUI->mCursor)
aUI.mCursor = ourUI->mCursor;
}
else if (aID == eStyleStruct_UIReset) {
if (aUI.mUserSelect.GetUnit() == eCSSUnit_Null && ourUI->mUserSelect.GetUnit() != eCSSUnit_Null)
aUI.mUserSelect = ourUI->mUserSelect;
if (!aUI.mKeyEquivalent && ourUI->mKeyEquivalent)
aUI.mKeyEquivalent = ourUI->mKeyEquivalent;
if (aUI.mResizer.GetUnit() == eCSSUnit_Null && ourUI->mResizer.GetUnit() != eCSSUnit_Null)
aUI.mResizer = ourUI->mResizer;
if (aUI.mForceBrokenImageIcon.GetUnit() == eCSSUnit_Null && ourUI->mForceBrokenImageIcon.GetUnit() == eCSSUnit_Integer)
aUI.mForceBrokenImageIcon = ourUI->mForceBrokenImageIcon;
}
return NS_OK;
return mDeclaration->MapRuleInfoInto(aRuleData);
}
#ifdef DEBUG

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

@ -42,7 +42,7 @@
#include "nsString.h"
#include "nsCRT.h"
#include "nsCoord.h"
#include "nsCSSProps.h"
#include "nsCSSProperty.h"
#include "nsUnitConversion.h"

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

@ -1229,8 +1229,8 @@ nsComputedDOMStyle::GetOutlineWidth(nsIFrame *aFrame,
case eStyleUnit_Chars:
{
const nsAFlatCString& width=
nsCSSProps::LookupPropertyValue(eCSSProperty__moz_outline_width,
outline->mOutlineWidth.GetIntValue());
nsCSSProps::SearchKeywordTable(outline->mOutlineWidth.GetIntValue(),
nsCSSProps::kBorderWidthKTable);
val->SetIdent(width);
break;
}

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

@ -72,14 +72,17 @@ NS_IMETHODIMP
nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn)
{
aReturn.Truncate();
nsCSSDeclaration* decl;
nsresult rv = GetCSSDeclaration(&decl, PR_FALSE);
if (NS_SUCCEEDED(rv) && decl) {
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
nsCSSValue val;
rv = decl->RemoveProperty(prop, val);
decl->GetValue(prop, aReturn);
rv = decl->RemoveProperty(prop);
if (NS_SUCCEEDED(rv)) {
rv = SetCSSDeclaration(decl, PR_TRUE, PR_TRUE);
@ -143,12 +146,16 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
}
}
else if (aAllocate) {
result = NS_NewCSSDeclaration(aDecl);
if (NS_SUCCEEDED(result)) {
result = SetCSSDeclaration(*aDecl, PR_FALSE, PR_FALSE);
if (NS_FAILED(result)) {
*aDecl = nsnull;
nsCSSDeclaration *decl = new nsCSSDeclaration();
if (!decl)
return NS_ERROR_OUT_OF_MEMORY;
if (!decl->InitializeEmpty()) {
decl->RuleAbort();
return NS_ERROR_OUT_OF_MEMORY;
}
result = SetCSSDeclaration(*aDecl, PR_FALSE, PR_FALSE);
if (NS_SUCCEEDED(result)) {
*aDecl = decl;
}
}
}
@ -270,27 +277,11 @@ nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAString& aDecl,
return result;
}
if (aClearOldDecl) {
// This should be done with decl->Clear() once such a method exists.
nsAutoString propName;
PRUint32 count, i;
count = decl->Count();
for (i = 0; i < count; i++) {
decl->GetNthProperty(0, propName);
nsCSSProperty prop = nsCSSProps::LookupProperty(propName);
nsCSSValue val;
decl->RemoveProperty(prop, val);
}
}
nsChangeHint uselessHint = NS_STYLE_HINT_NONE;
result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,
aParseOnlyOneDecl,
&uselessHint);
&uselessHint,
aClearOldDecl);
if (NS_SUCCEEDED(result)) {
result = SetCSSDeclaration(decl, PR_TRUE, PR_TRUE);

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

@ -274,7 +274,7 @@ NS_INTERFACE_MAP_END_AGGREGATED(fOuter)
// nsIDOMCSS2Properties
// nsIDOMNSCSS2Properties
#define CSS_PROP(name_, id_, method_, hint_) \
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
NS_IMETHODIMP \
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
{ \
@ -290,9 +290,13 @@ NS_INTERFACE_MAP_END_AGGREGATED(fOuter)
NS_LITERAL_STRING("")); \
}
#define CSS_PROP_INTERNAL(name_, id_, method_, hint_) /* nothing */
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_, hint_) \
CSS_PROP(name_, id_, method_, hint_)
CSS_PROP(name_, id_, method_, hint_, , , ,)
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) \
CSS_PROP(name_, id_, method_, hint_, , , ,)
#include "nsCSSPropList.h"
#undef CSS_PROP_INTERNAL
#undef CSS_PROP_SHORTHAND
#undef CSS_PROP_NOTIMPLEMENTED
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
#undef CSS_PROP

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

@ -76,6 +76,7 @@ public:
virtual void DropReference() = 0;
// XXX DeCOMify this, so that |nsCSSDeclaration*| is the return type.
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
PRBool aAllocate) = 0;
virtual nsresult ParsePropertyValue(const nsAString& aPropName,

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

@ -171,10 +171,10 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
aData->mDisplayData->mAppearance = none;
nsCSSValue autovalue(eCSSUnit_Auto);
aData->mDisplayData->mClip->mTop = autovalue;
aData->mDisplayData->mClip->mRight = autovalue;
aData->mDisplayData->mClip->mBottom = autovalue;
aData->mDisplayData->mClip->mLeft = autovalue;
aData->mDisplayData->mClip.mTop = autovalue;
aData->mDisplayData->mClip.mRight = autovalue;
aData->mDisplayData->mClip.mBottom = autovalue;
aData->mDisplayData->mClip.mLeft = autovalue;
nsCSSValue inlinevalue(NS_STYLE_DISPLAY_INLINE, eCSSUnit_Enumerated);
aData->mDisplayData->mDisplay = inlinevalue;
@ -200,10 +200,10 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
nsCSSValue autovalue(eCSSUnit_Auto);
nsCSSValue none(eCSSUnit_None);
nsCSSValue zero(0.0f, eCSSUnit_Point);
aData->mPositionData->mOffset->mTop = autovalue;
aData->mPositionData->mOffset->mRight = autovalue;
aData->mPositionData->mOffset->mBottom = autovalue;
aData->mPositionData->mOffset->mLeft = autovalue;
aData->mPositionData->mOffset.mTop = autovalue;
aData->mPositionData->mOffset.mRight = autovalue;
aData->mPositionData->mOffset.mBottom = autovalue;
aData->mPositionData->mOffset.mLeft = autovalue;
aData->mPositionData->mWidth = autovalue;
aData->mPositionData->mMinWidth = zero;
aData->mPositionData->mMaxWidth = none;
@ -235,9 +235,9 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
// Disable everything in the UserInterface struct.
if (aData->mSID == eStyleStruct_UserInterface) {
nsCSSValue inherit(eCSSUnit_Inherit);
aData->mUIData->mUserInput = inherit;
aData->mUIData->mUserModify = inherit;
aData->mUIData->mUserFocus = inherit;
aData->mUserInterfaceData->mUserInput = inherit;
aData->mUserInterfaceData->mUserModify = inherit;
aData->mUserInterfaceData->mUserFocus = inherit;
// XXX |mCursor| is a pain, because we have to have our own cursor
// structure allocated.
}
@ -245,7 +245,7 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
if (aData->mSID == eStyleStruct_UIReset) {
nsCSSValue autovalue(eCSSUnit_Auto);
nsCSSValue none(eCSSUnit_None);
aData->mUIData->mResizer = autovalue;
aData->mUserInterfaceData->mResizer = autovalue;
// XXX |mKeyEquivalent| is a pain, because we have to have our own cursor
// structure allocated.
// Don't bother with '-moz-force-broken-image-icon' since it's only
@ -285,26 +285,26 @@ CSSFirstLineRule::MapRuleInfoInto(nsRuleData* aData)
// properties.
if (aData->mSID == eStyleStruct_Border) {
nsCSSValue none(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mTop = none;
aData->mMarginData->mBorderStyle->mRight = none;
aData->mMarginData->mBorderStyle->mBottom = none;
aData->mMarginData->mBorderStyle->mLeft = none;
aData->mMarginData->mBorderStyle.mTop = none;
aData->mMarginData->mBorderStyle.mRight = none;
aData->mMarginData->mBorderStyle.mBottom = none;
aData->mMarginData->mBorderStyle.mLeft = none;
}
if (aData->mSID == eStyleStruct_Margin) {
nsCSSValue zero(0.0f, eCSSUnit_Point);
aData->mMarginData->mMargin->mTop = zero;
aData->mMarginData->mMargin->mRight = zero;
aData->mMarginData->mMargin->mBottom = zero;
aData->mMarginData->mMargin->mLeft = zero;
aData->mMarginData->mMargin.mTop = zero;
aData->mMarginData->mMargin.mRight = zero;
aData->mMarginData->mMargin.mBottom = zero;
aData->mMarginData->mMargin.mLeft = zero;
}
if (aData->mSID == eStyleStruct_Padding) {
nsCSSValue zero(0.0f, eCSSUnit_Point);
aData->mMarginData->mPadding->mTop = zero;
aData->mMarginData->mPadding->mRight = zero;
aData->mMarginData->mPadding->mBottom = zero;
aData->mMarginData->mPadding->mLeft = zero;
aData->mMarginData->mPadding.mTop = zero;
aData->mMarginData->mPadding.mRight = zero;
aData->mMarginData->mPadding.mBottom = zero;
aData->mMarginData->mPadding.mLeft = zero;
}
return NS_OK;

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

@ -41,6 +41,7 @@ nsCSSPseudoElements.h \
nsCSSKeywordList.h \
nsCSSKeywords.h \
nsCSSPropList.h \
nsCSSProperty.h \
nsCSSProps.h \
nsHTMLAtomList.h \
nsHTMLAtoms.h \

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

@ -38,52 +38,214 @@
/******
This file contains the list of all parsed CSS properties
See nsCSSProps.h for access to the enum values for properties
This file contains the list of all parsed CSS properties. It is
designed to be used as inline input through the magic of C
preprocessing. All entries must be enclosed in the appropriate
CSS_PROP_* macro which will have cruel and unusual things done to it.
It is recommended (but not strictly necessary) to keep all entries in
alphabetical order.
It is designed to be used as inline input through the magic of
C preprocessing.
The arguments to CSS_PROP_* are:
All entries must be enclosed in the macro CSS_PROP which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
Requirements:
Entries are in the form: (name, id, method, hint).
'name' entries represent a CSS property name and *must* use only
1. 'name' entries represent a CSS property name and *must* use only
lowercase characters.
'id' must always be the same as 'name' except that all hyphens ('-')
2. 'id' should be the same as 'name' except that all hyphens ('-')
in 'name' are converted to underscores ('_') in 'id'. This lets us
do nice things with the macros without having to copy/convert strings
at runtime.
at runtime. These are the names used for the enum values of the
nsCSSProperty enumeration defined in nsCSSProps.h.
'method' is designed to be as input for CSS2Properties and similar callers.
It must always be the same as 'name' except it must use InterCaps and all
hyphens ('-') must be removed.
3. 'method' is designed to be as input for CSS2Properties and similar
callers. It must always be the same as 'name' except it must use
InterCaps and all hyphens ('-') must be removed.
'hint' says what needs to be recomputed when the property changes.
4. 'hint' says what needs to be recomputed when the property changes.
** Break these invariants and bad things will happen. **
5. 'datastruct' says which nsRuleData* struct this property goes in.
6. 'member' gives the name of the member variable in the nsRuleData
struct.
7. 'type' gives the |nsCSSType| of the data in the nsRuleData struct
and in the nsCSSDeclaration backend.
8. 'iscoord' says whether the property is a coordinate property for
which we use an explicit inherit value in the *style structs* (since
inheritance requires knowledge of layout).
Which CSS_PROP_* macro a property is in depends on which nsStyle* its
computed value lives in (unless it is a shorthand, in which case it
gets CSS_PROP_SHORTHAND).
******/
// Assume the user wants internal properties, but not unimplemented ones
#ifndef CSS_PROP_INTERNAL
#define CSS_PROP_INTERNAL(_name, _id, _method, _hint) \
CSS_PROP(_name, _id, _method, _hint)
#define DEFINED_CSS_PROP_INTERNAL
#endif
/*************************************************************************/
// XXX Should we really be using CSS_PROP_SHORTHAND for 'border-spacing',
// 'background-position', and 'size'?
// All includers must explicitly define CSS_PROP_NOTIMPLEMENTED if they
// want this. (Only the DOM cares.)
#ifndef CSS_PROP_NOTIMPLEMENTED
#define CSS_PROP_NOTIMPLEMENTED(_name, _id, _method, _hint) /* nothing */
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_, hint_) /* nothing */
#define DEFINED_CSS_PROP_NOTIMPLEMENTED
#endif
// All includers must explicitly define CSS_PROP_SHORTHAND if they
// want it.
#ifndef CSS_PROP_SHORTHAND
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) /* nothing */
#define DEFINED_CSS_PROP_SHORTHAND
#endif
// Callers may define CSS_PROP_LIST_EXCLUDE_INTERNAL if they want to
// exclude internal properties that are not represented in the DOM (only
// the DOM style code defines this).
// A caller who wants all the properties can define the |CSS_PROP|
// macro.
#ifdef CSS_PROP
#define USED_CSS_PROP
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#ifdef MOZ_SVG
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#endif
// 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_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(CSS_PROP) */
// An includer who does not define CSS_PROP can define any or all of the
// per-struct macros that are equivalent to it, and the rest will be
// ignored.
#ifndef CSS_PROP_FONT
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_FONT
#endif
#ifndef CSS_PROP_COLOR
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_COLOR
#endif
#ifndef CSS_PROP_BACKGROUND
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BACKGROUND
#endif
#ifndef CSS_PROP_LIST
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_LIST
#endif
#ifndef CSS_PROP_POSITION
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_POSITION
#endif
#ifndef CSS_PROP_TEXT
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TEXT
#endif
#ifndef CSS_PROP_TEXTRESET
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TEXTRESET
#endif
#ifndef CSS_PROP_DISPLAY
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_DISPLAY
#endif
#ifndef CSS_PROP_VISIBILITY
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_VISIBILITY
#endif
#ifndef CSS_PROP_CONTENT
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_CONTENT
#endif
#ifndef CSS_PROP_QUOTES
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_QUOTES
#endif
#ifndef CSS_PROP_USERINTERFACE
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_USERINTERFACE
#endif
#ifndef CSS_PROP_UIRESET
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_UIRESET
#endif
#ifndef CSS_PROP_TABLE
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TABLE
#endif
#ifndef CSS_PROP_TABLEBORDER
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TABLEBORDER
#endif
#ifndef CSS_PROP_MARGIN
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_MARGIN
#endif
#ifndef CSS_PROP_PADDING
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_PADDING
#endif
#ifndef CSS_PROP_BORDER
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BORDER
#endif
#ifndef CSS_PROP_OUTLINE
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_OUTLINE
#endif
#ifndef CSS_PROP_XUL
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_XUL
#endif
#ifdef MOZ_SVG
#ifndef CSS_PROP_SVG
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_SVG
#endif
#endif /* defined(MOZ_SVG) */
#ifndef CSS_PROP_BACKENDONLY
#define CSS_PROP_BACKENDONLY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(CSS_PROP) */
/*************************************************************************/
// For notes XXX bug 3935 below, the names being parsed do not correspond
// to the constants used internally. It would be nice to bring the
// constants into line sometime.
@ -95,215 +257,349 @@
// support them correctly the old constants need to be renamed and
// new ones should be entered.
CSS_PROP(-moz-appearance, appearance, MozAppearance, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-border-radius, _moz_border_radius, MozBorderRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, MozBorderRadiusTopleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, MozBorderRadiusTopright, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, MozBorderRadiusBottomleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, MozBorderRadiusBottomright, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius, _moz_outline_radius, MozOutlineRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, MozOutlineRadiusTopleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, MozOutlineRadiusTopright, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, MozOutlineRadiusBottomleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, MozOutlineRadiusBottomright, NS_STYLE_HINT_VISUAL)
CSS_PROP(azimuth, azimuth, Azimuth, NS_STYLE_HINT_AURAL)
CSS_PROP(background, background, Background, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-attachment, background_attachment, BackgroundAttachment, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(-moz-background-clip, _moz_background_clip, MozBackgroundClip, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-color, background_color, BackgroundColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-image, background_image, BackgroundImage, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-position, background_position, BackgroundPosition, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-repeat, background_repeat, BackgroundRepeat, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(-x-background-x-position, background_x_position, BackgroundXPosition, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-background-y-position, background_y_position, BackgroundYPosition, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP(-moz-binding, binding, MozBinding, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(border, border, Border, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-bottom, border_bottom, BorderBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-bottom-color, border_bottom_color, BorderBottomColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-bottom-colors, border_bottom_colors, MozBorderBottomColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-bottom-style, border_bottom_style, BorderBottomStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-bottom-width, border_bottom_width, BorderBottomWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-collapse, border_collapse, BorderCollapse, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(border-color, border_color, BorderColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-left, border_left, BorderLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-left-color, border_left_color, BorderLeftColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-left-style, border_left_style, BorderLeftStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-left-width, border_left_width, BorderLeftWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-right, border_right, BorderRight, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-right-color, border_right_color, BorderRightColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-right-colors, border_right_colors, MozBorderRightColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-right-style, border_right_style, BorderRightStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-right-width, border_right_width, BorderRightWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-spacing, border_spacing, BorderSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-style, border_style, BorderStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-top, border_top, BorderTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-top-color, border_top_color, BorderTopColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-top-colors, border_top_colors, MozBorderTopColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-top-style, border_top_style, BorderTopStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-top-width, border_top_width, BorderTopWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-width, border_width, BorderWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-border-x-spacing, border_x_spacing, BorderXSpacing, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP_INTERNAL(-x-border-y-spacing, border_y_spacing, BorderYSpacing, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(bottom, bottom, Bottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-box-align, box_align, MozBoxAlign, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-direction, box_direction, MozBoxDirection, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-flex, box_flex, MozBoxFlex, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-flex-group, box_flex_group, MozBoxFlexGroup, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-orient, box_orient, MozBoxOrient, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-pack, box_pack, MozBoxPack, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-sizing, box_sizing, MozBoxSizing, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-ordinal-group, box_ordinal_group, MozBoxOrdinalGroup, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(caption-side, caption_side, CaptionSide, NS_STYLE_HINT_REFLOW)
CSS_PROP(clear, clear, Clear, NS_STYLE_HINT_REFLOW)
CSS_PROP(clip, clip, Clip, nsChangeHint_SyncFrameView)
CSS_PROP_INTERNAL(-x-clip-bottom, clip_bottom, ClipBottom, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP_INTERNAL(-x-clip-left, clip_left, ClipLeft, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP_INTERNAL(-x-clip-right, clip_right, ClipRight, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP_INTERNAL(-x-clip-top, clip_top, ClipTop, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP(color, color, Color, NS_STYLE_HINT_VISUAL)
CSS_PROP(content, content, Content, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP_DISPLAY(-moz-appearance, appearance, MozAppearance, NS_STYLE_HINT_REFLOW, Display, mAppearance, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(-moz-border-radius, _moz_border_radius, MozBorderRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP_BORDER(-moz-border-radius-topleft, _moz_border_radius_topLeft, MozBorderRadiusTopleft, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-topright, _moz_border_radius_topRight, MozBorderRadiusTopright, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, MozBorderRadiusBottomleft, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, MozBorderRadiusBottomright, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(-moz-outline-radius, _moz_outline_radius, MozOutlineRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP_OUTLINE(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, MozOutlineRadiusTopleft, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-topright, _moz_outline_radius_topRight, MozOutlineRadiusTopright, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, MozOutlineRadiusBottomleft, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, MozOutlineRadiusBottomright, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(azimuth, azimuth, Azimuth, NS_STYLE_HINT_AURAL, Aural, mAzimuth, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(background, background, Background, NS_STYLE_HINT_VISUAL)
CSS_PROP_BACKGROUND(background-attachment, background_attachment, BackgroundAttachment, NS_STYLE_HINT_FRAMECHANGE, Color, mBackAttachment, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-clip, _moz_background_clip, MozBackgroundClip, NS_STYLE_HINT_VISUAL, Color, mBackClip, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, NS_STYLE_HINT_VISUAL, Color, mBackColor, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(background-image, background_image, BackgroundImage, NS_STYLE_HINT_VISUAL, Color, mBackImage, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, NS_STYLE_HINT_VISUAL, Color, mBackInlinePolicy, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, NS_STYLE_HINT_VISUAL, Color, mBackOrigin, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(background-position, background_position, BackgroundPosition, NS_STYLE_HINT_VISUAL)
CSS_PROP_BACKGROUND(background-repeat, background_repeat, BackgroundRepeat, NS_STYLE_HINT_VISUAL, Color, mBackRepeat, eCSSType_Value, PR_FALSE)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKGROUND(-x-background-x-position, background_x_position, BackgroundXPosition, NS_STYLE_HINT_VISUAL, Color, mBackPositionX, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKGROUND(-x-background-y-position, background_y_position, BackgroundYPosition, NS_STYLE_HINT_VISUAL, Color, mBackPositionY, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_DISPLAY(-moz-binding, binding, MozBinding, NS_STYLE_HINT_FRAMECHANGE, Display, mBinding, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_SHORTHAND(border, border, Border, NS_STYLE_HINT_REFLOW)
CSS_PROP_SHORTHAND(border-bottom, border_bottom, BorderBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-bottom-color, border_bottom_color, BorderBottomColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mBottom, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-bottom-colors, border_bottom_colors, MozBorderBottomColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mBottom, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-bottom-style, border_bottom_style, BorderBottomStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mBottom, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-bottom-width, border_bottom_width, BorderBottomWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mBottom, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLEBORDER(border-collapse, border_collapse, BorderCollapse, NS_STYLE_HINT_FRAMECHANGE, Table, mBorderCollapse, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-color, border_color, BorderColor, NS_STYLE_HINT_VISUAL)
CSS_PROP_SHORTHAND(border-left, border_left, BorderLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-left-color, border_left_color, BorderLeftColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mLeft, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mLeft, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-left-style, border_left_style, BorderLeftStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mLeft, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-left-width, border_left_width, BorderLeftWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mLeft, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-right, border_right, BorderRight, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-right-color, border_right_color, BorderRightColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mRight, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-right-colors, border_right_colors, MozBorderRightColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mRight, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-right-style, border_right_style, BorderRightStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mRight, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-right-width, border_right_width, BorderRightWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mRight, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-spacing, border_spacing, BorderSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP_SHORTHAND(border-style, border_style, BorderStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP_SHORTHAND(border-top, border_top, BorderTop, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-top-color, border_top_color, BorderTopColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mTop, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-top-colors, border_top_colors, MozBorderTopColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mTop, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-top-style, border_top_style, BorderTopStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mTop, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-top-width, border_top_width, BorderTopWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mTop, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-width, border_width, BorderWidth, NS_STYLE_HINT_REFLOW)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_TABLEBORDER(-x-border-x-spacing, border_x_spacing, BorderXSpacing, NS_STYLE_HINT_REFLOW, Table, mBorderSpacingX, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TABLEBORDER(-x-border-y-spacing, border_y_spacing, BorderYSpacing, NS_STYLE_HINT_REFLOW, Table, mBorderSpacingY, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_POSITION(bottom, bottom, Bottom, NS_STYLE_HINT_REFLOW, Position, mOffset.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(-moz-box-sizing, box_sizing, MozBoxSizing, NS_STYLE_HINT_REFLOW, Position, mBoxSizing, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TABLEBORDER(caption-side, caption_side, CaptionSide, NS_STYLE_HINT_REFLOW, Table, mCaptionSide, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(clear, clear, Clear, NS_STYLE_HINT_REFLOW, Display, mClear, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(clip, clip, Clip, nsChangeHint_SyncFrameView, Display, mClip, eCSSType_Rect, PR_FALSE)
CSS_PROP_COLOR(color, color, Color, NS_STYLE_HINT_VISUAL, Color, mColor, eCSSType_Value, PR_FALSE)
CSS_PROP_CONTENT(content, content, Content, NS_STYLE_HINT_FRAMECHANGE, Content, mContent, eCSSType_ValueList, PR_FALSE)
CSS_PROP_NOTIMPLEMENTED(counter-increment, counter_increment, CounterIncrement, NS_STYLE_HINT_REFLOW)
CSS_PROP_NOTIMPLEMENTED(counter-reset, counter_reset, CounterReset, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-counter-increment, _moz_counter_increment, MozCounterIncrement, NS_STYLE_HINT_REFLOW) // XXX bug 137285
CSS_PROP(-moz-counter-reset, _moz_counter_reset, MozCounterReset, NS_STYLE_HINT_REFLOW) // XXX bug 137285
CSS_PROP(cue, cue, Cue, NS_STYLE_HINT_AURAL)
CSS_PROP(cue-after, cue_after, CueAfter, NS_STYLE_HINT_AURAL)
CSS_PROP(cue-before, cue_before, CueBefore, NS_STYLE_HINT_AURAL)
CSS_PROP(cursor, cursor, Cursor, NS_STYLE_HINT_VISUAL)
CSS_PROP(direction, direction, Direction, NS_STYLE_HINT_REFLOW)
CSS_PROP(display, display, Display, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(elevation, elevation, Elevation, NS_STYLE_HINT_AURAL)
CSS_PROP(empty-cells, empty_cells, EmptyCells, NS_STYLE_HINT_VISUAL)
CSS_PROP(float, float, CssFloat, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(-moz-float-edge, float_edge, MozFloatEdge, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(font, font, Font, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-family, font_family, FontFamily, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-size, font_size, FontSize, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-size-adjust, font_size_adjust, FontSizeAdjust, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-stretch, font_stretch, FontStretch, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-style, font_style, FontStyle, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-variant, font_variant, FontVariant, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-weight, font_weight, FontWeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-force-broken-image-icon, force_broken_image_icon, MozForceBrokenImageIcon, NS_STYLE_HINT_FRAMECHANGE) // bug 58646
CSS_PROP(height, height, Height, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-image-region, image_region, MozImageRegion, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-bottom, image_region_bottom, MozImageRegionBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-left, image_region_left, MozImageRegionLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-right, image_region_right, MozImageRegionRight, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-top, image_region_top, MozImageRegionTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-key-equivalent, key_equivalent, MozKeyEquivalent, NS_STYLE_HINT_CONTENT) // This will need some other notification, but what? // XXX bug 3935
CSS_PROP(left, left, Left, NS_STYLE_HINT_REFLOW)
CSS_PROP(letter-spacing, letter_spacing, LetterSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP(line-height, line_height, LineHeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style, list_style, ListStyle, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style-image, list_style_image, ListStyleImage, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style-position, list_style_position, ListStylePosition, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style-type, list_style_type, ListStyleType, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin, margin, Margin, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-bottom, margin_bottom, MarginBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-left, margin_left, MarginLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-right, margin_right, MarginRight, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-top, margin_top, MarginTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(marker-offset, marker_offset, MarkerOffset, NS_STYLE_HINT_REFLOW)
CSS_PROP(marks, marks, Marks, NS_STYLE_HINT_VISUAL)
CSS_PROP(max-height, max_height, MaxHeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(max-width, max_width, MaxWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(min-height, min_height, MinHeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(min-width, min_width, MinWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-opacity, opacity, MozOpacity, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(orphans, orphans, Orphans, NS_STYLE_HINT_REFLOW)
CSS_PROP_CONTENT(-moz-counter-increment, _moz_counter_increment, MozCounterIncrement, NS_STYLE_HINT_REFLOW, Content, mCounterIncrement, eCSSType_CounterData, PR_FALSE) // XXX bug 137285
CSS_PROP_CONTENT(-moz-counter-reset, _moz_counter_reset, MozCounterReset, NS_STYLE_HINT_REFLOW, Content, mCounterReset, eCSSType_CounterData, PR_FALSE) // XXX bug 137285
CSS_PROP_SHORTHAND(cue, cue, Cue, NS_STYLE_HINT_AURAL)
CSS_PROP_BACKENDONLY(cue-after, cue_after, CueAfter, NS_STYLE_HINT_AURAL, Aural, mCueAfter, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(cue-before, cue_before, CueBefore, NS_STYLE_HINT_AURAL, Aural, mCueBefore, eCSSType_Value, PR_FALSE)
CSS_PROP_USERINTERFACE(cursor, cursor, Cursor, NS_STYLE_HINT_VISUAL, UserInterface, mCursor, eCSSType_ValueList, PR_FALSE)
CSS_PROP_VISIBILITY(direction, direction, Direction, NS_STYLE_HINT_REFLOW, Display, mDirection, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(display, display, Display, NS_STYLE_HINT_FRAMECHANGE, Display, mDisplay, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(elevation, elevation, Elevation, NS_STYLE_HINT_AURAL, Aural, mElevation, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLEBORDER(empty-cells, empty_cells, EmptyCells, NS_STYLE_HINT_VISUAL, Table, mEmptyCells, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(float, float, CssFloat, NS_STYLE_HINT_FRAMECHANGE, Display, mFloat, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-float-edge, float_edge, MozFloatEdge, NS_STYLE_HINT_REFLOW, Margin, mFloatEdge, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_SHORTHAND(font, font, Font, NS_STYLE_HINT_REFLOW)
CSS_PROP_FONT(font-family, font_family, FontFamily, NS_STYLE_HINT_REFLOW, Font, mFamily, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-size, font_size, FontSize, NS_STYLE_HINT_REFLOW, Font, mSize, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-size-adjust, font_size_adjust, FontSizeAdjust, NS_STYLE_HINT_REFLOW, Font, mSizeAdjust, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(font-stretch, font_stretch, FontStretch, NS_STYLE_HINT_REFLOW, Font, mStretch, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-style, font_style, FontStyle, NS_STYLE_HINT_REFLOW, Font, mStyle, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-variant, font_variant, FontVariant, NS_STYLE_HINT_REFLOW, Font, mVariant, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-weight, font_weight, FontWeight, NS_STYLE_HINT_REFLOW, Font, mWeight, eCSSType_Value, PR_FALSE)
CSS_PROP_UIRESET(-moz-force-broken-image-icon, force_broken_image_icon, MozForceBrokenImageIcon, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mForceBrokenImageIcon, eCSSType_Value, PR_FALSE) // bug 58646
CSS_PROP_POSITION(height, height, Height, NS_STYLE_HINT_REFLOW, Position, mHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_LIST(-moz-image-region, image_region, MozImageRegion, NS_STYLE_HINT_REFLOW, List, mImageRegion, eCSSType_Rect, PR_TRUE)
CSS_PROP_UIRESET(-moz-key-equivalent, key_equivalent, MozKeyEquivalent, NS_STYLE_HINT_CONTENT, UserInterface, mKeyEquivalent, eCSSType_ValueList, PR_FALSE) // This will need some other notification, but what? // XXX bug 3935
CSS_PROP_POSITION(left, left, Left, NS_STYLE_HINT_REFLOW, Position, mOffset.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(letter-spacing, letter_spacing, LetterSpacing, NS_STYLE_HINT_REFLOW, Text, mLetterSpacing, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(line-height, line_height, LineHeight, NS_STYLE_HINT_REFLOW, Text, mLineHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(list-style, list_style, ListStyle, NS_STYLE_HINT_REFLOW)
CSS_PROP_LIST(list-style-image, list_style_image, ListStyleImage, NS_STYLE_HINT_REFLOW, List, mImage, eCSSType_Value, PR_FALSE)
CSS_PROP_LIST(list-style-position, list_style_position, ListStylePosition, NS_STYLE_HINT_REFLOW, List, mPosition, eCSSType_Value, PR_FALSE)
CSS_PROP_LIST(list-style-type, list_style_type, ListStyleType, NS_STYLE_HINT_REFLOW, List, mType, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(margin, margin, Margin, NS_STYLE_HINT_REFLOW)
CSS_PROP_MARGIN(margin-bottom, margin_bottom, MarginBottom, NS_STYLE_HINT_REFLOW, Margin, mMargin.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-left, margin_left, MarginLeft, NS_STYLE_HINT_REFLOW, Margin, mMargin.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-right, margin_right, MarginRight, NS_STYLE_HINT_REFLOW, Margin, mMargin.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-top, margin_top, MarginTop, NS_STYLE_HINT_REFLOW, Margin, mMargin.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_CONTENT(marker-offset, marker_offset, MarkerOffset, NS_STYLE_HINT_REFLOW, Content, mMarkerOffset, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(marks, marks, Marks, NS_STYLE_HINT_VISUAL, Page, mMarks, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(max-height, max_height, MaxHeight, NS_STYLE_HINT_REFLOW, Position, mMaxHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(max-width, max_width, MaxWidth, NS_STYLE_HINT_REFLOW, Position, mMaxWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(min-height, min_height, MinHeight, NS_STYLE_HINT_REFLOW, Position, mMinHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(min-width, min_width, MinWidth, NS_STYLE_HINT_REFLOW, Position, mMinWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_VISIBILITY(-moz-opacity, opacity, MozOpacity, NS_STYLE_HINT_FRAMECHANGE, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, NS_STYLE_HINT_REFLOW, Breaks, mOrphans, eCSSType_Value, PR_FALSE)
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline, NS_STYLE_HINT_VISUAL)
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor, NS_STYLE_HINT_VISUAL)
CSS_PROP_NOTIMPLEMENTED(outline-style, outline_style, OutlineStyle, NS_STYLE_HINT_VISUAL)
CSS_PROP_NOTIMPLEMENTED(outline-width, outline_width, OutlineWidth, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline, _moz_outline, MozOutline, NS_STYLE_HINT_VISUAL) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973
CSS_PROP(-moz-outline-color, _moz_outline_color, MozOutlineColor, NS_STYLE_HINT_VISUAL) // XXX bug 48973
CSS_PROP(-moz-outline-style, _moz_outline_style, MozOutlineStyle, NS_STYLE_HINT_VISUAL) // XXX bug 48973
CSS_PROP(-moz-outline-width, _moz_outline_width, MozOutlineWidth, NS_STYLE_HINT_VISUAL) // XXX bug 48973
CSS_PROP(overflow, overflow, Overflow, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(padding, padding, Padding, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-bottom, padding_bottom, PaddingBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-left, padding_left, PaddingLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-right, padding_right, PaddingRight, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-top, padding_top, PaddingTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(page, page, Page, NS_STYLE_HINT_REFLOW)
CSS_PROP(page-break-after, page_break_after, PageBreakAfter, NS_STYLE_HINT_REFLOW)
CSS_PROP(page-break-before, page_break_before, PageBreakBefore, NS_STYLE_HINT_REFLOW)
CSS_PROP(page-break-inside, page_break_inside, PageBreakInside, NS_STYLE_HINT_REFLOW)
CSS_PROP(pause, pause, Pause, NS_STYLE_HINT_AURAL)
CSS_PROP(pause-after, pause_after, PauseAfter, NS_STYLE_HINT_AURAL)
CSS_PROP(pause-before, pause_before, PauseBefore, NS_STYLE_HINT_AURAL)
CSS_PROP(pitch, pitch, Pitch, NS_STYLE_HINT_AURAL)
CSS_PROP(pitch-range, pitch_range, PitchRange, NS_STYLE_HINT_AURAL)
CSS_PROP(play-during, play_during, PlayDuring, NS_STYLE_HINT_AURAL)
CSS_PROP_INTERNAL(-x-play-during-flags, play_during_flags, PlayDuringFlags, NS_STYLE_HINT_AURAL) // XXX why is this here?
CSS_PROP(position, position, Position, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(quotes, quotes, Quotes, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-quotes-close, quotes_close, QuotesClose, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP_INTERNAL(-x-quotes-open, quotes_open, QuotesOpen, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-resizer, resizer, MozResizer, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(richness, richness, Richness, NS_STYLE_HINT_AURAL)
CSS_PROP(right, right, Right, NS_STYLE_HINT_REFLOW)
CSS_PROP(size, size, Size, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-size-height, size_height, SizeHeight, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP_INTERNAL(-x-size-width, size_width, SizeWidth, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(speak, speak, Speak, NS_STYLE_HINT_AURAL)
CSS_PROP(speak-header, speak_header, SpeakHeader, NS_STYLE_HINT_AURAL)
CSS_PROP(speak-numeral, speak_numeral, SpeakNumeral, NS_STYLE_HINT_AURAL)
CSS_PROP(speak-punctuation, speak_punctuation, SpeakPunctuation, NS_STYLE_HINT_AURAL)
CSS_PROP(speech-rate, speech_rate, SpeechRate, NS_STYLE_HINT_AURAL)
CSS_PROP(stress, stress, Stress, NS_STYLE_HINT_AURAL)
CSS_PROP(table-layout, table_layout, TableLayout, NS_STYLE_HINT_REFLOW)
CSS_PROP(text-align, text_align, TextAlign, NS_STYLE_HINT_REFLOW)
CSS_PROP(text-decoration, text_decoration, TextDecoration, NS_STYLE_HINT_VISUAL)
CSS_PROP(text-indent, text_indent, TextIndent, NS_STYLE_HINT_REFLOW)
CSS_PROP(text-shadow, text_shadow, TextShadow, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(-x-text-shadow-color, text_shadow_color, TextShadowColor, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-text-shadow-radius, text_shadow_radius, TextShadowRadius, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-text-shadow-x, text_shadow_x, TextShadowX, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-text-shadow-y, text_shadow_y, TextShadowY, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP(text-transform, text_transform, TextTransform, NS_STYLE_HINT_REFLOW)
CSS_PROP(top, top, Top, NS_STYLE_HINT_REFLOW)
CSS_PROP(unicode-bidi, unicode_bidi, UnicodeBidi, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-user-focus, user_focus, MozUserFocus, NS_STYLE_HINT_CONTENT) // XXX bug 3935
CSS_PROP(-moz-user-input, user_input, MozUserInput, NS_STYLE_HINT_FRAMECHANGE) // XXX ??? // XXX bug 3935
CSS_PROP(-moz-user-modify, user_modify, MozUserModify, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(-moz-user-select, user_select, MozUserSelect, NS_STYLE_HINT_CONTENT) // XXX bug 3935
CSS_PROP(vertical-align, vertical_align, VerticalAlign, NS_STYLE_HINT_REFLOW)
CSS_PROP(visibility, visibility, Visibility, NS_STYLE_HINT_REFLOW) // reflow for collapse
CSS_PROP(voice-family, voice_family, VoiceFamily, NS_STYLE_HINT_AURAL)
CSS_PROP(volume, volume, Volume, NS_STYLE_HINT_AURAL)
CSS_PROP(white-space, white_space, WhiteSpace, NS_STYLE_HINT_REFLOW)
CSS_PROP(widows, widows, Widows, NS_STYLE_HINT_REFLOW)
CSS_PROP(width, width, Width, NS_STYLE_HINT_REFLOW)
CSS_PROP(word-spacing, word_spacing, WordSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP(z-index, z_index, ZIndex, NS_STYLE_HINT_REFLOW)
CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline, NS_STYLE_HINT_VISUAL) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, NS_STYLE_HINT_VISUAL, Margin, mOutlineColor, eCSSType_Value, PR_FALSE) // XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, NS_STYLE_HINT_VISUAL, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE) // XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, NS_STYLE_HINT_VISUAL, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE) // XXX bug 48973
CSS_PROP_DISPLAY(overflow, overflow, Overflow, NS_STYLE_HINT_FRAMECHANGE, Display, mOverflow, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(padding, padding, Padding, NS_STYLE_HINT_REFLOW)
CSS_PROP_PADDING(padding-bottom, padding_bottom, PaddingBottom, NS_STYLE_HINT_REFLOW, Margin, mPadding.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-left, padding_left, PaddingLeft, NS_STYLE_HINT_REFLOW, Margin, mPadding.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-right, padding_right, PaddingRight, NS_STYLE_HINT_REFLOW, Margin, mPadding.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-top, padding_top, PaddingTop, NS_STYLE_HINT_REFLOW, Margin, mPadding.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(page, page, Page, NS_STYLE_HINT_REFLOW, Breaks, mPage, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(page-break-after, page_break_after, PageBreakAfter, NS_STYLE_HINT_REFLOW, Display, mBreakAfter, eCSSType_Value, PR_FALSE) // temp fix for bug 24000
CSS_PROP_DISPLAY(page-break-before, page_break_before, PageBreakBefore, NS_STYLE_HINT_REFLOW, Display, mBreakBefore, eCSSType_Value, PR_FALSE) // temp fix for bug 24000
CSS_PROP_BACKENDONLY(page-break-inside, page_break_inside, PageBreakInside, NS_STYLE_HINT_REFLOW, Breaks, mPageBreakInside, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(pause, pause, Pause, NS_STYLE_HINT_AURAL)
CSS_PROP_BACKENDONLY(pause-after, pause_after, PauseAfter, NS_STYLE_HINT_AURAL, Aural, mPauseAfter, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pause-before, pause_before, PauseBefore, NS_STYLE_HINT_AURAL, Aural, mPauseBefore, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pitch, pitch, Pitch, NS_STYLE_HINT_AURAL, Aural, mPitch, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pitch-range, pitch_range, PitchRange, NS_STYLE_HINT_AURAL, Aural, mPitchRange, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(play-during, play_during, PlayDuring, NS_STYLE_HINT_AURAL, Aural, mPlayDuring, eCSSType_Value, PR_FALSE)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKENDONLY(-x-play-during-flags, play_during_flags, PlayDuringFlags, NS_STYLE_HINT_AURAL, Aural, mPlayDuringFlags, eCSSType_Value, PR_FALSE) // XXX why is this here?
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_DISPLAY(position, position, Position, NS_STYLE_HINT_FRAMECHANGE, Display, mPosition, eCSSType_Value, PR_FALSE)
CSS_PROP_QUOTES(quotes, quotes, Quotes, NS_STYLE_HINT_REFLOW, Content, mQuotes, eCSSType_Quotes, PR_FALSE)
CSS_PROP_UIRESET(-moz-resizer, resizer, MozResizer, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mResizer, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(richness, richness, Richness, NS_STYLE_HINT_AURAL, Aural, mRichness, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(right, right, Right, NS_STYLE_HINT_REFLOW, Position, mOffset.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(size, size, Size, NS_STYLE_HINT_REFLOW)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKENDONLY(-x-size-height, size_height, SizeHeight, NS_STYLE_HINT_REFLOW, Page, mSizeHeight, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(-x-size-width, size_width, SizeWidth, NS_STYLE_HINT_REFLOW, Page, mSizeWidth, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_BACKENDONLY(speak, speak, Speak, NS_STYLE_HINT_AURAL, Aural, mSpeak, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-header, speak_header, SpeakHeader, NS_STYLE_HINT_AURAL, Aural, mSpeakHeader, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-numeral, speak_numeral, SpeakNumeral, NS_STYLE_HINT_AURAL, Aural, mSpeakNumeral, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-punctuation, speak_punctuation, SpeakPunctuation, NS_STYLE_HINT_AURAL, Aural, mSpeakPunctuation, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speech-rate, speech_rate, SpeechRate, NS_STYLE_HINT_AURAL, Aural, mSpeechRate, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(stress, stress, Stress, NS_STYLE_HINT_AURAL, Aural, mStress, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(table-layout, table_layout, TableLayout, NS_STYLE_HINT_REFLOW, Table, mLayout, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(text-align, text_align, TextAlign, NS_STYLE_HINT_REFLOW, Text, mTextAlign, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXTRESET(text-decoration, text_decoration, TextDecoration, NS_STYLE_HINT_VISUAL, Text, mDecoration, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(text-indent, text_indent, TextIndent, NS_STYLE_HINT_REFLOW, Text, mTextIndent, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(text-shadow, text_shadow, TextShadow, NS_STYLE_HINT_VISUAL, Text, mTextShadow, eCSSType_Shadow, PR_FALSE)
CSS_PROP_TEXT(text-transform, text_transform, TextTransform, NS_STYLE_HINT_REFLOW, Text, mTextTransform, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(top, top, Top, NS_STYLE_HINT_REFLOW, Position, mOffset.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXTRESET(unicode-bidi, unicode_bidi, UnicodeBidi, NS_STYLE_HINT_REFLOW, Text, mUnicodeBidi, eCSSType_Value, PR_FALSE)
CSS_PROP_USERINTERFACE(-moz-user-focus, user_focus, MozUserFocus, NS_STYLE_HINT_CONTENT, UserInterface, mUserFocus, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_USERINTERFACE(-moz-user-input, user_input, MozUserInput, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mUserInput, eCSSType_Value, PR_FALSE) // XXX ??? // XXX bug 3935
CSS_PROP_USERINTERFACE(-moz-user-modify, user_modify, MozUserModify, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mUserModify, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_UIRESET(-moz-user-select, user_select, MozUserSelect, NS_STYLE_HINT_CONTENT, UserInterface, mUserSelect, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TEXTRESET(vertical-align, vertical_align, VerticalAlign, NS_STYLE_HINT_REFLOW, Text, mVerticalAlign, eCSSType_Value, PR_TRUE)
CSS_PROP_VISIBILITY(visibility, visibility, Visibility, NS_STYLE_HINT_REFLOW, Display, mVisibility, eCSSType_Value, PR_FALSE) // reflow for collapse
CSS_PROP_BACKENDONLY(voice-family, voice_family, VoiceFamily, NS_STYLE_HINT_AURAL, Aural, mVoiceFamily, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(volume, volume, Volume, NS_STYLE_HINT_AURAL, Aural, mVolume, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(white-space, white_space, WhiteSpace, NS_STYLE_HINT_REFLOW, Text, mWhiteSpace, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(widows, widows, Widows, NS_STYLE_HINT_REFLOW, Breaks, mWidows, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(width, width, Width, NS_STYLE_HINT_REFLOW, Position, mWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(word-spacing, word_spacing, WordSpacing, NS_STYLE_HINT_REFLOW, Text, mWordSpacing, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(z-index, z_index, ZIndex, NS_STYLE_HINT_REFLOW, Position, mZIndex, eCSSType_Value, PR_FALSE)
CSS_PROP_XUL(-moz-box-align, box_align, MozBoxAlign, NS_STYLE_HINT_REFLOW, XUL, mBoxAlign, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-direction, box_direction, MozBoxDirection, NS_STYLE_HINT_REFLOW, XUL, mBoxDirection, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-flex, box_flex, MozBoxFlex, NS_STYLE_HINT_REFLOW, XUL, mBoxFlex, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-orient, box_orient, MozBoxOrient, NS_STYLE_HINT_REFLOW, XUL, mBoxOrient, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-pack, box_pack, MozBoxPack, NS_STYLE_HINT_REFLOW, XUL, mBoxPack, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-ordinal-group, box_ordinal_group, MozBoxOrdinalGroup, NS_STYLE_HINT_FRAMECHANGE, XUL, mBoxOrdinal, eCSSType_Value, PR_FALSE)
#ifdef MOZ_SVG
// XXX treat SVG's CSS Properties as internal for now.
// Do we want to create an nsIDOMSVGCSS2Properties interface?
CSS_PROP_INTERNAL(fill, fill, Fill, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(fill-opacity, fill_opacity, FillOpacity, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(fill-rule, fill_rule, FillRule, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke, stroke, Stroke, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-dasharray, stroke_dasharray, StrokeDasharray, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-dashoffset, stroke_dashoffset, StrokeDashoffset, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-linecap, stroke_linecap, StrokeLinecap, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-linejoin, stroke_linejoin, StrokeLinejoin, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-miterlimit, stroke_miterlimit, StrokeMiterlimit, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-opacity, stroke_opacity, StrokeOpacity, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-width, stroke_width, StrokeWidth, NS_STYLE_HINT_VISUAL)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_SVG(fill, fill, Fill, NS_STYLE_HINT_VISUAL, SVG, mFill, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill-opacity, fill_opacity, FillOpacity, NS_STYLE_HINT_VISUAL, SVG, mFillOpacity, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill-rule, fill_rule, FillRule, NS_STYLE_HINT_VISUAL, SVG, mFillRule, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke, stroke, Stroke, NS_STYLE_HINT_VISUAL, SVG, mStroke, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-dasharray, stroke_dasharray, StrokeDasharray, NS_STYLE_HINT_VISUAL, SVG, mStrokeDasharray, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-dashoffset, stroke_dashoffset, StrokeDashoffset, NS_STYLE_HINT_VISUAL, SVG, mStrokeDashoffset, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-linecap, stroke_linecap, StrokeLinecap, NS_STYLE_HINT_VISUAL, SVG, mStrokeLinecap, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-linejoin, stroke_linejoin, StrokeLinejoin, NS_STYLE_HINT_VISUAL, SVG, mStrokeLinejoin, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-miterlimit, stroke_miterlimit, StrokeMiterlimit, NS_STYLE_HINT_VISUAL, SVG, mStrokeMiterlimit, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-opacity, stroke_opacity, StrokeOpacity, NS_STYLE_HINT_VISUAL, SVG, mStrokeOpacity, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-width, stroke_width, StrokeWidth, NS_STYLE_HINT_VISUAL, SVG, mStrokeWidth, eCSSType_Value, PR_FALSE)
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
#endif
// Clean up after ourselves
#ifdef DEFINED_CSS_PROP_INTERNAL
#undef CSS_PROP_INTERNAL
#undef DEFINED_CSS_PROP_INTERNAL
// Callers that want information on the properties that are in
// the style structs but not in the nsCSS* structs should define
// |CSS_PROP_INCLUDE_NOT_CSS|. (Some of these are also in nsRuleData*,
// and a distinction might be needed at some point.)
#ifdef CSS_PROP_INCLUDE_NOT_CSS
CSS_PROP_VISIBILITY(, , , , Display, mLang, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mFrame, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mRules, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mCols, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mSpan, eCSSType_Value, PR_FALSE)
#endif /* defined(CSS_PROP_INCLUDE_NOT_CSS) */
#ifdef USED_CSS_PROP
#undef USED_CSS_PROP
#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
#ifdef MOZ_SVG
#undef CSS_PROP_SVG
#endif
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(USED_CSS_PROP) */
#ifdef DEFINED_CSS_PROP_FONT
#undef CSS_PROP_FONT
#undef DEFINED_CSS_PROP_FONT
#endif
#ifdef DEFINED_CSS_PROP_COLOR
#undef CSS_PROP_COLOR
#undef DEFINED_CSS_PROP_COLOR
#endif
#ifdef DEFINED_CSS_PROP_BACKGROUND
#undef CSS_PROP_BACKGROUND
#undef DEFINED_CSS_PROP_BACKGROUND
#endif
#ifdef DEFINED_CSS_PROP_LIST
#undef CSS_PROP_LIST
#undef DEFINED_CSS_PROP_LIST
#endif
#ifdef DEFINED_CSS_PROP_POSITION
#undef CSS_PROP_POSITION
#undef DEFINED_CSS_PROP_POSITION
#endif
#ifdef DEFINED_CSS_PROP_TEXT
#undef CSS_PROP_TEXT
#undef DEFINED_CSS_PROP_TETEXTRESETT
#endif
#ifdef DEFINED_CSS_PROP_TEXTRESET
#undef CSS_PROP_TEXTRESET
#undef DEFINED_CSS_PROP_TEDISPLAYTRESET
#endif
#ifdef DEFINED_CSS_PROP_DISPLAY
#undef CSS_PROP_DISPLAY
#undef DEFINED_CSS_PROP_DISPLAY
#endif
#ifdef DEFINED_CSS_PROP_VISIBILITY
#undef CSS_PROP_VISIBILITY
#undef DEFINED_CSS_PROP_VISIBILITY
#endif
#ifdef DEFINED_CSS_PROP_CONTENT
#undef CSS_PROP_CONTENT
#undef DEFINED_CSS_PROP_CONTENT
#endif
#ifdef DEFINED_CSS_PROP_QUOTES
#undef CSS_PROP_QUOTES
#undef DEFINED_CSS_PROP_QUOTES
#endif
#ifdef DEFINED_CSS_PROP_USERINTERFACE
#undef CSS_PROP_USERINTERFACE
#undef DEFINED_CSS_PROP_USERINTERFACE
#endif
#ifdef DEFINED_CSS_PROP_UIRESET
#undef CSS_PROP_UIRESET
#undef DEFINED_CSS_PROP_UIRESET
#endif
#ifdef DEFINED_CSS_PROP_TABLE
#undef CSS_PROP_TABLE
#undef DEFINED_CSS_PROP_TABLE
#endif
#ifdef DEFINED_CSS_PROP_TABLEBORDER
#undef CSS_PROP_TABLEBORDER
#undef DEFINED_CSS_PROP_TABLEBORDER
#endif
#ifdef DEFINED_CSS_PROP_MARGIN
#undef CSS_PROP_MARGIN
#undef DEFINED_CSS_PROP_MARGIN
#endif
#ifdef DEFINED_CSS_PROP_PADDING
#undef CSS_PROP_PADDING
#undef DEFINED_CSS_PROP_PADDING
#endif
#ifdef DEFINED_CSS_PROP_BORDER
#undef CSS_PROP_BORDER
#undef DEFINED_CSS_PROP_BORDER
#endif
#ifdef DEFINED_CSS_PROP_OUTLINE
#undef CSS_PROP_OUTLINE
#undef DEFINED_CSS_PROP_OUTLINE
#endif
#ifdef DEFINED_CSS_PROP_XUL
#undef CSS_PROP_XUL
#undef DEFINED_CSS_PROP_XUL
#endif
#ifdef MOZ_SVG
#ifdef DEFINED_CSS_PROP_SVG
#undef CSS_PROP_SVG
#undef DEFINED_CSS_PROP_SVG
#endif
#endif /* defined(MOZ_SVG) */
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(USED_CSS_PROP) */
#ifdef DEFINED_CSS_PROP_NOTIMPLEMENTED
#undef CSS_PROP_NOTIMPLEMENTED
#undef DEFINED_CSS_PROP_NOTIMPLEMENTED
#endif
#ifdef DEFINED_CSS_PROP_SHORTHAND
#undef CSS_PROP_SHORTHAND
#undef DEFINED_CSS_PROP_SHORTHAND
#endif

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

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCSSProperty_h___
#define nsCSSProperty_h___
/*
Declare the enum list using the magic of preprocessing
enum values are "eCSSProperty_foo" (where foo is the property)
To change the list of properties, see nsCSSPropList.h
*/
enum nsCSSProperty {
eCSSProperty_UNKNOWN = -1,
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eCSSProperty_##id_,
#include "nsCSSPropList.h"
#undef CSS_PROP
eCSSProperty_COUNT_no_shorthands,
// Make the count continue where it left off:
eCSSProperty_COUNT_DUMMY = eCSSProperty_COUNT_no_shorthands - 1,
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) eCSSProperty_##id_,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
eCSSProperty_COUNT
};
// The types of values that can be in the nsCSS*/nsRuleData* structs.
// See nsCSSPropList.h for uses.
enum nsCSSType {
eCSSType_Value,
eCSSType_Rect,
eCSSType_ValueList,
eCSSType_CounterData,
eCSSType_Quotes,
eCSSType_Shadow
};
#endif /* nsCSSProperty_h___ */

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

@ -40,22 +40,8 @@
#include "nsString.h"
#include "nsChangeHint.h"
/*
Declare the enum list using the magic of preprocessing
enum values are "eCSSProperty_foo" (where foo is the property)
To change the list of properties, see nsCSSPropList.h
*/
#define CSS_PROP(_name, _id, _method, _hint) eCSSProperty_##_id,
enum nsCSSProperty {
eCSSProperty_UNKNOWN = -1,
#include "nsCSSPropList.h"
eCSSProperty_COUNT
};
#undef CSS_PROP
#include "nsCSSProperty.h"
#include "nsStyleStruct.h"
class nsCSSProps {
public:
@ -66,6 +52,12 @@ public:
static nsCSSProperty LookupProperty(const nsAString& aProperty);
static nsCSSProperty LookupProperty(const nsACString& aProperty);
static inline PRBool IsShorthand(nsCSSProperty aProperty) {
NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT,
"out of range");
return (aProperty >= eCSSProperty_COUNT_no_shorthands);
}
// Given a property enum, get the string value
static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
@ -81,7 +73,29 @@ public:
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const nsChangeHint kHintTable[];
static const nsChangeHint kHintTable[eCSSProperty_COUNT];
static const nsCSSType kTypeTable[eCSSProperty_COUNT_no_shorthands];
static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands];
// A table for shorthand properties. The appropriate index is the
// property ID minus eCSSProperty_COUNT_no_shorthands.
private:
static const nsCSSProperty *const
kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands];
public:
static inline
const nsCSSProperty *const SubpropertyEntryFor(nsCSSProperty aProperty) {
NS_ASSERTION(eCSSProperty_COUNT_no_shorthands <= aProperty &&
aProperty < eCSSProperty_COUNT,
"out of range");
return nsCSSProps::kSubpropertyTable[aProperty -
eCSSProperty_COUNT_no_shorthands];
}
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(iter_, prop_) \
for (const nsCSSProperty* iter_ = nsCSSProps::SubpropertyEntryFor(prop_); \
*iter_ != eCSSProperty_UNKNOWN; ++iter_)
// Keyword/Enum value tables
static const PRInt32 kAppearanceKTable[];

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

@ -256,7 +256,7 @@ struct nsRuleData
nsRuleDataColor* mColorData;
nsRuleDataContent* mContentData;
nsRuleDataText* mTextData;
nsRuleDataUserInterface* mUIData;
nsRuleDataUserInterface* mUserInterfaceData;
nsRuleDataXUL* mXULData;
#ifdef MOZ_SVG
@ -267,7 +267,7 @@ struct nsRuleData
:mSID(aSID), mPresContext(aContext), mStyleContext(aStyleContext), mPostResolveCallback(nsnull),
mFontData(nsnull), mDisplayData(nsnull), mMarginData(nsnull), mListData(nsnull),
mPositionData(nsnull), mTableData(nsnull), mColorData(nsnull), mContentData(nsnull), mTextData(nsnull),
mUIData(nsnull)
mUserInterfaceData(nsnull)
{
mCanStoreInRuleTree = PR_TRUE;
mXULData = nsnull;

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

@ -51,11 +51,14 @@
extern const char* const kCSSRawProperties[];
// define an array of all CSS properties
#define CSS_PROP(_name, _id, _method, _hint) #_name,
const char* const kCSSRawProperties[] = {
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) #name_,
#include "nsCSSPropList.h"
};
#undef CSS_PROP
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) #name_,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
};
static PRInt32 gTableRefCount;
@ -907,6 +910,9 @@ nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[])
}
}
// XXX TODO These table names should be additional parameters of the
// properties below in nsCSSPropList.h (and the two below should be like
// the rest).
const nsAFlatCString&
nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue)
{
@ -927,6 +933,15 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
switch (aProp) {
case eCSSProperty__moz_border_radius:
case eCSSProperty__moz_border_radius_topLeft:
case eCSSProperty__moz_border_radius_topRight:
case eCSSProperty__moz_border_radius_bottomLeft:
case eCSSProperty__moz_border_radius_bottomRight:
case eCSSProperty__moz_outline_radius:
case eCSSProperty__moz_outline_radius_topLeft:
case eCSSProperty__moz_outline_radius_topRight:
case eCSSProperty__moz_outline_radius_bottomLeft:
case eCSSProperty__moz_outline_radius_bottomRight:
break;
case eCSSProperty_appearance:
@ -985,6 +1000,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
return SearchKeywordTable(aValue, kBoxOrientKTable);
case eCSSProperty_box_pack:
return SearchKeywordTable(aValue, kBoxPackKTable);
case eCSSProperty_box_flex:
case eCSSProperty_box_ordinal_group:
break;
#ifdef MOZ_SVG
case eCSSProperty_fill:
@ -1015,6 +1033,10 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_border_left:
case eCSSProperty_border_right:
case eCSSProperty_border_top:
case eCSSProperty_border_bottom_colors:
case eCSSProperty_border_left_colors:
case eCSSProperty_border_right_colors:
case eCSSProperty_border_top_colors:
break;
case eCSSProperty_border_bottom_color:
@ -1048,10 +1070,6 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
return SearchKeywordTable(aValue, kClearKTable);
case eCSSProperty_clip:
case eCSSProperty_clip_bottom:
case eCSSProperty_clip_left:
case eCSSProperty_clip_right:
case eCSSProperty_clip_top:
case eCSSProperty_color:
break;
@ -1110,12 +1128,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_font_weight:
return SearchKeywordTable(aValue, kFontWeightKTable);
case eCSSProperty_force_broken_image_icon:
case eCSSProperty_height:
case eCSSProperty_image_region:
case eCSSProperty_image_region_top:
case eCSSProperty_image_region_left:
case eCSSProperty_image_region_bottom:
case eCSSProperty_image_region_right:
break;
case eCSSProperty_key_equivalent:
@ -1202,8 +1217,6 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
return SearchKeywordTable(aValue, kPositionKTable);
case eCSSProperty_quotes:
case eCSSProperty_quotes_close:
case eCSSProperty_quotes_open:
break;
case eCSSProperty_resizer:
@ -1249,10 +1262,6 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_text_indent:
case eCSSProperty_text_shadow:
case eCSSProperty_text_shadow_color:
case eCSSProperty_text_shadow_radius:
case eCSSProperty_text_shadow_x:
case eCSSProperty_text_shadow_y:
break;
case eCSSProperty_text_transform:
@ -1326,9 +1335,263 @@ PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr)
}
// define array of all CSS property hints
#define CSS_PROP(_name, _id, _method, _hint) _hint,
const nsChangeHint nsCSSProps::kHintTable[eCSSProperty_COUNT] = {
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) hint_,
#include "nsCSSPropList.h"
};
#undef CSS_PROP
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) hint_,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
};
// define array of all CSS property types
const nsCSSType nsCSSProps::kTypeTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) type_,
#include "nsCSSPropList.h"
#undef CSS_PROP
};
const nsStyleStructID nsCSSProps::kSIDTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Font,
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Color,
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Background,
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_List,
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Position,
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Text,
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_TextReset,
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Display,
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Visibility,
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Content,
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Quotes,
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_UserInterface,
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_UIReset,
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Table,
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_TableBorder,
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Margin,
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Padding,
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Border,
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Outline,
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_XUL,
#ifdef MOZ_SVG
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_SVG,
#endif /* defined(MOZ_SVG) */
// This shouldn't matter, but we need something to go here.
#define CSS_PROP_BACKENDONLY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) nsStyleStructID(-1),
#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
#ifdef MOZ_SVG
#undef CSS_PROP_SVG
#endif /* undefd(MOZ_SVG) */
#undef CSS_PROP_BACKENDONLY
};
static const nsCSSProperty gMozBorderRadiusSubpropTable[] = {
// Code relies on these being in topleft-topright-bottomright-bottomleft
// order.
eCSSProperty__moz_border_radius_topLeft,
eCSSProperty__moz_border_radius_topRight,
eCSSProperty__moz_border_radius_bottomRight,
eCSSProperty__moz_border_radius_bottomLeft,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozOutlineRadiusSubpropTable[] = {
// Code relies on these being in topleft-topright-bottomright-bottomleft
// order.
eCSSProperty__moz_outline_radius_topLeft,
eCSSProperty__moz_outline_radius_topRight,
eCSSProperty__moz_outline_radius_bottomRight,
eCSSProperty__moz_outline_radius_bottomLeft,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBackgroundSubpropTable[] = {
eCSSProperty_background_color,
eCSSProperty_background_image,
eCSSProperty_background_repeat,
eCSSProperty_background_attachment,
eCSSProperty_background_x_position,
eCSSProperty_background_y_position,
eCSSProperty__moz_background_clip, // XXX Added LDB.
eCSSProperty__moz_background_origin, // XXX Added LDB.
eCSSProperty__moz_background_inline_policy, // XXX Added LDB.
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBackgroundPositionSubpropTable[] = {
eCSSProperty_background_x_position,
eCSSProperty_background_y_position,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderSubpropTable[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width,
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style,
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderBottomSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_bottom_width,
eCSSProperty_border_bottom_style,
eCSSProperty_border_bottom_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderLeftSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_left_width,
eCSSProperty_border_left_style,
eCSSProperty_border_left_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderRightSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_right_width,
eCSSProperty_border_right_style,
eCSSProperty_border_right_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderSpacingSubpropTable[] = {
eCSSProperty_border_x_spacing,
eCSSProperty_border_y_spacing,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderStyleSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderTopSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_top_width,
eCSSProperty_border_top_style,
eCSSProperty_border_top_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderWidthSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gCueSubpropTable[] = {
eCSSProperty_cue_after,
eCSSProperty_cue_before,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gFontSubpropTable[] = {
eCSSProperty_font_family,
eCSSProperty_font_style,
eCSSProperty_font_variant,
eCSSProperty_font_weight,
eCSSProperty_font_size,
eCSSProperty_line_height,
eCSSProperty_font_size_adjust, // XXX Added LDB.
eCSSProperty_font_stretch, // XXX Added LDB.
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gListStyleSubpropTable[] = {
eCSSProperty_list_style_type,
eCSSProperty_list_style_image,
eCSSProperty_list_style_position,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMarginSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_margin_top,
eCSSProperty_margin_right,
eCSSProperty_margin_bottom,
eCSSProperty_margin_left,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozOutlineSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty__moz_outline_color,
eCSSProperty__moz_outline_style,
eCSSProperty__moz_outline_width,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gPaddingSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_padding_top,
eCSSProperty_padding_right,
eCSSProperty_padding_bottom,
eCSSProperty_padding_left,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gPauseSubpropTable[] = {
eCSSProperty_pause_after,
eCSSProperty_pause_before,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gSizeSubpropTable[] = {
eCSSProperty_size_width,
eCSSProperty_size_height,
eCSSProperty_UNKNOWN
};
const nsCSSProperty *const
nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) g##method_##SubpropTable,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
};

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

@ -465,9 +465,6 @@ interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
attribute DOMString MozBoxFlex;
// raises(DOMException) on setting
attribute DOMString MozBoxFlexGroup;
// raises(DOMException) on setting
attribute DOMString MozBoxOrient;
// raises(DOMException) on setting

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

@ -31,6 +31,9 @@ REQUIRES = xpcom \
necko \
content \
layout \
gfx \
widget \
locale \
$(NULL)
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))

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

@ -0,0 +1,865 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsCSSDataBlock.cpp.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCSSDataBlock.h"
#include "nsCSSProps.h"
#include "nsRuleNode.h"
/*
* nsCSSCompressedDataBlock holds property-value pairs corresponding to
* CSS declaration blocks. The value is stored in one of the six CSS
* data types. These six types are nsCSSValue, nsCSSRect,
* nsCSSValueList, nsCSSCounterData, nsCSSQuotes, and nsCSSShadow, and
* each correspond to a value of the nsCSSType enumeration.
*
* The storage strategy uses the CDB*Storage structs below to help
* ensure that all the types remain properly aligned. nsCSSValue's
* alignment requirements cannot be weaker than any others, since it
* contains a pointer and an enumeration.
*
* The simple types, nsCSSValue and nsCSSRect have the nsCSSValue or
* nsCSSRect objects stored in the block. The list types have only a
* pointer to the first element in the list stored in the block.
*/
struct CDBValueStorage {
nsCSSProperty property;
nsCSSValue value;
};
struct CDBRectStorage {
nsCSSProperty property;
nsCSSRect value;
};
struct CDBPointerStorage {
nsCSSProperty property;
void *value;
};
enum {
CDBValueStorage_advance = sizeof(CDBValueStorage),
CDBRectStorage_advance = sizeof(CDBRectStorage),
// round up using the closest estimate we can get of the alignment
// requirements of nsCSSValue:
CDBPointerStorage_advance = PR_ROUNDUP(sizeof(CDBPointerStorage),
sizeof(CDBValueStorage) - sizeof(nsCSSValue))
};
/*
* Define a bunch of utility functions for getting the property or any
* of the value types when the cursor is at the beginning of the storage
* for the property-value pair. The versions taking a non-const cursor
* argument return a reference so that the caller can assign into the
* result.
*/
inline nsCSSProperty& PropertyAtCursor(char *aCursor) {
return *NS_REINTERPRET_CAST(nsCSSProperty*, aCursor);
}
inline nsCSSProperty PropertyAtCursor(const char *aCursor) {
return *NS_REINTERPRET_CAST(const nsCSSProperty*, aCursor);
}
inline nsCSSValue* ValueAtCursor(char *aCursor) {
return & NS_REINTERPRET_CAST(CDBValueStorage*, aCursor)->value;
}
inline const nsCSSValue* ValueAtCursor(const char *aCursor) {
return & NS_REINTERPRET_CAST(const CDBValueStorage*, aCursor)->value;
}
inline nsCSSRect* RectAtCursor(char *aCursor) {
return & NS_REINTERPRET_CAST(CDBRectStorage*, aCursor)->value;
}
inline const nsCSSRect* RectAtCursor(const char *aCursor) {
return & NS_REINTERPRET_CAST(const CDBRectStorage*, aCursor)->value;
}
inline void*& PointerAtCursor(char *aCursor) {
return NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value;
}
inline void* PointerAtCursor(const char *aCursor) {
return NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value;
}
inline nsCSSValueList*& ValueListAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSValueList**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSValueList* ValueListAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSValueList*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
inline nsCSSCounterData*& CounterDataAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSCounterData**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSCounterData* CounterDataAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSCounterData*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
inline nsCSSQuotes*& QuotesAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSQuotes**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSQuotes* QuotesAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSQuotes*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
inline nsCSSShadow*& ShadowAtCursor(char *aCursor) {
return * NS_REINTERPRET_CAST(nsCSSShadow**,
& NS_REINTERPRET_CAST(CDBPointerStorage*, aCursor)->value);
}
inline nsCSSShadow* ShadowAtCursor(const char *aCursor) {
return NS_STATIC_CAST(nsCSSShadow*,
NS_REINTERPRET_CAST(const CDBPointerStorage*, aCursor)->value);
}
nsresult
nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
{
// If we have no data for this struct, then return immediately.
// This optimization should make us return most of the time, so we
// have to worry much less (although still some) about the speed of
// the rest of the function.
if (!(nsCachedStyleData::GetBitForSID(aRuleData->mSID) & mStyleBits))
return NS_OK;
const char* cursor = Block();
const char* cursor_end = BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
if (nsCSSProps::kSIDTable[iProp] == aRuleData->mSID) {
void *prop =
nsCSSExpandedDataBlock::RuleDataPropertyAt(aRuleData, iProp);
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
nsCSSValue* target = NS_STATIC_CAST(nsCSSValue*, prop);
if (target->GetUnit() == eCSSUnit_Null) {
const nsCSSValue *val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
*target = *val;
if (iProp == eCSSProperty_font_family) {
// XXX Are there other things like this?
aRuleData->mFontData->mFamilyFromHTML = PR_FALSE;
}
}
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
nsCSSRect* target = NS_STATIC_CAST(nsCSSRect*, prop);
if (target->mTop.GetUnit() == eCSSUnit_Null)
target->mTop = val->mTop;
if (target->mRight.GetUnit() == eCSSUnit_Null)
target->mRight = val->mRight;
if (target->mBottom.GetUnit() == eCSSUnit_Null)
target->mBottom = val->mBottom;
if (target->mLeft.GetUnit() == eCSSUnit_Null)
target->mLeft = val->mLeft;
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void** target = NS_STATIC_CAST(void**, prop);
if (!*target) {
void* val = PointerAtCursor(cursor);
NS_ASSERTION(val, "oops");
*target = val;
}
cursor += CDBPointerStorage_advance;
} break;
}
} else {
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
cursor += CDBPointerStorage_advance;
} break;
}
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
return NS_OK;
}
const void*
nsCSSCompressedDataBlock::StorageFor(nsCSSProperty aProperty) const
{
// If we have no data for this struct, then return immediately.
// This optimization should make us return most of the time, so we
// have to worry much less (although still some) about the speed of
// the rest of the function.
if (!(nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]) &
mStyleBits))
return nsnull;
const char* cursor = Block();
const char* cursor_end = BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
if (iProp == aProperty) {
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
return ValueAtCursor(cursor);
}
case eCSSType_Rect: {
return RectAtCursor(cursor);
}
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
return &PointerAtCursor(NS_CONST_CAST(char*, cursor));
}
}
}
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
return nsnull;
}
nsCSSCompressedDataBlock*
nsCSSCompressedDataBlock::Clone() const
{
const char *cursor = Block(), *cursor_end = BlockEnd();
char *result_cursor;
nsCSSCompressedDataBlock *result =
new(cursor_end - cursor) nsCSSCompressedDataBlock();
if (!result)
return nsnull;
result_cursor = result->Block();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
PropertyAtCursor(result_cursor) = iProp;
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
const nsCSSValue* val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
*ValueAtCursor(result_cursor) = *val;
cursor += CDBValueStorage_advance;
result_cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
*RectAtCursor(result_cursor) = *val;
cursor += CDBRectStorage_advance;
result_cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void *copy;
NS_ASSERTION(PointerAtCursor(cursor), "oops");
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_ValueList:
copy = new nsCSSValueList(*ValueListAtCursor(cursor));
break;
case eCSSType_CounterData:
copy =
new nsCSSCounterData(*CounterDataAtCursor(cursor));
break;
case eCSSType_Quotes:
copy = new nsCSSQuotes(*QuotesAtCursor(cursor));
break;
case eCSSType_Shadow:
copy = new nsCSSShadow(*ShadowAtCursor(cursor));
break;
default:
NS_NOTREACHED("unreachable");
break;
}
if (!copy) {
result->mBlockEnd = result_cursor;
result->Destroy();
return nsnull;
}
PointerAtCursor(result_cursor) = copy;
cursor += CDBPointerStorage_advance;
result_cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
result->mBlockEnd = result_cursor;
return result;
}
void
nsCSSCompressedDataBlock::Destroy()
{
const char* cursor = Block();
const char* cursor_end = BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
const nsCSSValue* val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
val->~nsCSSValue();
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
val->~nsCSSRect();
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList: {
nsCSSValueList* val = ValueListAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_CounterData: {
nsCSSCounterData* val = CounterDataAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_Quotes: {
nsCSSQuotes* val = QuotesAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_Shadow: {
nsCSSShadow* val = ShadowAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
delete this;
}
/* static */ nsCSSCompressedDataBlock*
nsCSSCompressedDataBlock::CreateEmptyBlock()
{
nsCSSCompressedDataBlock *result = new(0) nsCSSCompressedDataBlock();
if (!result)
return nsnull;
result->mBlockEnd = result->Block();
return result;
}
/*****************************************************************************/
nsCSSExpandedDataBlock::nsCSSExpandedDataBlock()
{
ClearSets();
AssertInitialState();
}
nsCSSExpandedDataBlock::~nsCSSExpandedDataBlock()
{
AssertInitialState();
}
const nsCSSExpandedDataBlock::PropertyOffsetInfo
nsCSSExpandedDataBlock::kOffsetTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_BACKENDONLY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsCSSExpandedDataBlock, m##datastruct_.member_), \
size_t(-1), \
size_t(-1) },
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsCSSExpandedDataBlock, m##datastruct_.member_), \
offsetof(nsRuleData, m##datastruct_##Data), \
offsetof(nsRuleData##datastruct_, member_) },
#include "nsCSSPropList.h"
#undef CSS_PROP
#undef CSS_PROP_BACKENDONLY
};
void
nsCSSExpandedDataBlock::DoExpand(nsCSSCompressedDataBlock *aBlock,
PRBool aImportant)
{
NS_PRECONDITION(aBlock, "unexpected null block");
/*
* Save needless copying and allocation by copying the memory
* corresponding to the stored data in the compressed block, and
* then, to avoid destructors, deleting the compressed block by
* calling |delete| instead of using its |Destroy| method.
*/
const char* cursor = aBlock->Block();
const char* cursor_end = aBlock->BlockEnd();
while (cursor < cursor_end) {
nsCSSProperty iProp = PropertyAtCursor(cursor);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
NS_ASSERTION(!HasPropertyBit(iProp),
"compressed block has property multiple times");
SetPropertyBit(iProp);
if (aImportant)
SetImportantBit(iProp);
void *prop = PropertyAt(iProp);
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
const nsCSSValue* val = ValueAtCursor(cursor);
NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
memcpy(prop, val, sizeof(nsCSSValue));
cursor += CDBValueStorage_advance;
} break;
case eCSSType_Rect: {
const nsCSSRect* val = RectAtCursor(cursor);
NS_ASSERTION(val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null, "oops");
memcpy(prop, val, sizeof(nsCSSRect));
cursor += CDBRectStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void* val = PointerAtCursor(cursor);
NS_ASSERTION(val, "oops");
*NS_STATIC_CAST(void**, prop) = val;
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
delete aBlock;
}
void
nsCSSExpandedDataBlock::Expand(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock)
{
NS_PRECONDITION(*aNormalBlock, "unexpected null block");
AssertInitialState();
DoExpand(*aNormalBlock, PR_FALSE);
*aNormalBlock = nsnull;
if (*aImportantBlock) {
DoExpand(*aImportantBlock, PR_TRUE);
*aImportantBlock = nsnull;
}
}
nsCSSExpandedDataBlock::ComputeSizeResult
nsCSSExpandedDataBlock::ComputeSize()
{
ComputeSizeResult result = {0, 0};
for (PRUint32 iHigh = 0; iHigh < NS_ARRAY_LENGTH(mPropertiesSet); ++iHigh) {
if (mPropertiesSet[iHigh] == 0)
continue;
for (PRInt32 iLow = 0; iLow < kPropertiesSetChunkSize; ++iLow) {
if ((mPropertiesSet[iHigh] & (1 << iLow)) == 0)
continue;
nsCSSProperty iProp =
nsCSSProperty(iHigh * kPropertiesSetChunkSize + iLow);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
void *prop = PropertyAt(iProp);
PRUint32 increment = 0;
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
if (val->GetUnit() != eCSSUnit_Null) {
increment = CDBValueStorage_advance;
}
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
if (val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null) {
increment = CDBRectStorage_advance;
}
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void* val = *NS_STATIC_CAST(void**, prop);
if (val) {
increment = CDBPointerStorage_advance;
}
} break;
}
if ((mPropertiesImportant[iHigh] & (1 << iLow)) == 0)
result.normal += increment;
else
result.important += increment;
}
}
return result;
}
void
nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock)
{
nsCSSCompressedDataBlock *result_normal, *result_important;
char *cursor_normal, *cursor_important;
ComputeSizeResult size = ComputeSize();
result_normal = new(size.normal) nsCSSCompressedDataBlock();
if (!result_normal) {
*aNormalBlock = nsnull;
*aImportantBlock = nsnull;
return;
}
cursor_normal = result_normal->Block();
if (size.important != 0) {
result_important = new(size.important) nsCSSCompressedDataBlock();
if (!result_important) {
delete result_normal;
*aNormalBlock = nsnull;
*aImportantBlock = nsnull;
return;
}
cursor_important = result_important->Block();
} else {
result_important = nsnull;
}
/*
* Save needless copying and allocation by copying the memory
* corresponding to the stored data in the expanded block, and then
* clearing the data in the expanded block.
*/
for (PRUint32 iHigh = 0; iHigh < NS_ARRAY_LENGTH(mPropertiesSet); ++iHigh) {
if (mPropertiesSet[iHigh] == 0)
continue;
for (PRInt32 iLow = 0; iLow < kPropertiesSetChunkSize; ++iLow) {
if ((mPropertiesSet[iHigh] & (1 << iLow)) == 0)
continue;
nsCSSProperty iProp =
nsCSSProperty(iHigh * kPropertiesSetChunkSize + iLow);
NS_ASSERTION(0 <= iProp && iProp < eCSSProperty_COUNT_no_shorthands,
"out of range");
void *prop = PropertyAt(iProp);
PRBool present = PR_FALSE;
PRBool important =
(mPropertiesImportant[iHigh] & (1 << iLow)) != 0;
char *&cursor = important ? cursor_important : cursor_normal;
nsCSSCompressedDataBlock *result =
important ? result_important : result_normal;
switch (nsCSSProps::kTypeTable[iProp]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
if (val->GetUnit() != eCSSUnit_Null) {
CDBValueStorage *storage =
NS_REINTERPRET_CAST(CDBValueStorage*, cursor);
storage->property = iProp;
memcpy(&storage->value, val, sizeof(nsCSSValue));
new (val) nsCSSValue();
cursor += CDBValueStorage_advance;
present = PR_TRUE;
}
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
if (val->mTop.GetUnit() != eCSSUnit_Null ||
val->mRight.GetUnit() != eCSSUnit_Null ||
val->mBottom.GetUnit() != eCSSUnit_Null ||
val->mLeft.GetUnit() != eCSSUnit_Null) {
CDBRectStorage *storage =
NS_REINTERPRET_CAST(CDBRectStorage*, cursor);
storage->property = iProp;
memcpy(&storage->value, val, sizeof(nsCSSRect));
new (val) nsCSSRect();
cursor += CDBRectStorage_advance;
present = PR_TRUE;
}
} break;
case eCSSType_ValueList:
case eCSSType_CounterData:
case eCSSType_Quotes:
case eCSSType_Shadow: {
void*& val = *NS_STATIC_CAST(void**, prop);
if (val) {
CDBPointerStorage *storage =
NS_REINTERPRET_CAST(CDBPointerStorage*, cursor);
storage->property = iProp;
storage->value = val;
val = nsnull;
cursor += CDBPointerStorage_advance;
present = PR_TRUE;
}
} break;
}
if (present) {
result->mStyleBits |= nsCachedStyleData::GetBitForSID(
nsCSSProps::kSIDTable[iProp]);
}
}
}
result_normal->mBlockEnd = cursor_normal;
NS_ASSERTION(result_normal->DataSize() == ptrdiff_t(size.normal),
"size miscalculation");
if (result_important) {
result_important->mBlockEnd = cursor_important;
NS_ASSERTION(result_important->DataSize() == ptrdiff_t(size.important),
"size miscalculation");
}
ClearSets();
AssertInitialState();
*aNormalBlock = result_normal;
*aImportantBlock = result_important;
}
void
nsCSSExpandedDataBlock::Clear()
{
for (PRUint32 iHigh = 0; iHigh < NS_ARRAY_LENGTH(mPropertiesSet); ++iHigh) {
if (mPropertiesSet[iHigh] == 0)
continue;
for (PRInt32 iLow = 0; iLow < kPropertiesSetChunkSize; ++iLow) {
if ((mPropertiesSet[iHigh] & (1 << iLow)) == 0)
continue;
nsCSSProperty iProp =
nsCSSProperty(iHigh * kPropertiesSetChunkSize + iLow);
ClearProperty(iProp);
}
}
AssertInitialState();
}
void
nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID)
{
NS_ASSERTION(0 <= aPropID && aPropID < eCSSProperty_COUNT_no_shorthands,
"out of range");
ClearPropertyBit(aPropID);
ClearImportantBit(aPropID);
void *prop = PropertyAt(aPropID);
switch (nsCSSProps::kTypeTable[aPropID]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
val->Reset();
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
val->mTop.Reset();
val->mRight.Reset();
val->mBottom.Reset();
val->mLeft.Reset();
} break;
case eCSSType_ValueList: {
nsCSSValueList*& val = *NS_STATIC_CAST(nsCSSValueList**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
case eCSSType_CounterData: {
nsCSSCounterData*& val =
*NS_STATIC_CAST(nsCSSCounterData**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
case eCSSType_Quotes: {
nsCSSQuotes*& val = *NS_STATIC_CAST(nsCSSQuotes**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
case eCSSType_Shadow: {
nsCSSShadow*& val = *NS_STATIC_CAST(nsCSSShadow**, prop);
if (val) {
delete val;
val = nsnull;
}
} break;
}
}
#ifdef DEBUG
void
nsCSSExpandedDataBlock::DoAssertInitialState()
{
PRUint32 i;
for (i = 0; i < NS_ARRAY_LENGTH(mPropertiesSet); ++i) {
NS_ASSERTION(mPropertiesSet[i] == 0, "not initial state");
}
for (i = 0; i < NS_ARRAY_LENGTH(mPropertiesImportant); ++i) {
NS_ASSERTION(mPropertiesImportant[i] == 0, "not initial state");
}
for (i = 0; i < eCSSProperty_COUNT_no_shorthands; ++i) {
void *prop = PropertyAt(nsCSSProperty(i));
switch (nsCSSProps::kTypeTable[i]) {
case eCSSType_Value: {
nsCSSValue* val = NS_STATIC_CAST(nsCSSValue*, prop);
NS_ASSERTION(val->GetUnit() == eCSSUnit_Null,
"not initial state");
} break;
case eCSSType_Rect: {
nsCSSRect* val = NS_STATIC_CAST(nsCSSRect*, prop);
NS_ASSERTION(val->mTop.GetUnit() == eCSSUnit_Null,
"not initial state");
NS_ASSERTION(val->mRight.GetUnit() == eCSSUnit_Null,
"not initial state");
NS_ASSERTION(val->mBottom.GetUnit() == eCSSUnit_Null,
"not initial state");
NS_ASSERTION(val->mLeft.GetUnit() == eCSSUnit_Null,
"not initial state");
} break;
case eCSSType_ValueList: {
nsCSSValueList* val = *NS_STATIC_CAST(nsCSSValueList**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_CounterData: {
nsCSSCounterData* val =
*NS_STATIC_CAST(nsCSSCounterData**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_Quotes: {
nsCSSQuotes* val = *NS_STATIC_CAST(nsCSSQuotes**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_Shadow: {
nsCSSShadow* val = *NS_STATIC_CAST(nsCSSShadow**, prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
}
}
}
#endif

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

@ -0,0 +1,305 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is nsCSSDataBlock.h.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCSSDataBlock_h__
#define nsCSSDataBlock_h__
#include "nsCSSStruct.h"
struct nsRuleData;
class nsCSSExpandedDataBlock;
/**
* An |nsCSSCompressedDataBlock| holds an immutable chunk of
* property-value data for a CSS declaration block (which we misname a
* |nsCSSDeclaration|). Mutation is accomplished through
* |nsCSSExpandedDataBlock|.
*/
class nsCSSCompressedDataBlock {
public:
friend class nsCSSExpandedDataBlock;
/**
* Do what |nsIStyleRule::MapRuleInfoInto| needs to do for a style
* rule using this block for storage.
*/
nsresult MapRuleInfoInto(nsRuleData *aRuleData) const;
/**
* Return the location at which the *value* for the property is
* stored, or null if the block does not contain a value for the
* property. This is either an |nsCSSValue*|, |nsCSSRect*|, or an
* |nsCSSValueList**|, etc.
*
* Inefficient (by design).
*/
const void* StorageFor(nsCSSProperty aProperty) const;
/**
* Clone this block, or return null on out-of-memory.
*/
nsCSSCompressedDataBlock* Clone() const;
/**
* Delete all the data stored in this block, and the block itself.
*/
void Destroy();
/**
* Create a new nsCSSCompressedDataBlock holding no declarations.
*/
static nsCSSCompressedDataBlock* CreateEmptyBlock();
private:
PRInt32 mStyleBits; // the structs for which we have data, according to
// |nsCachedStyleData::GetBitForSID|.
enum { block_chars = 4 }; // put 4 chars in the definition of the class
// to ensure size not inflated by alignment
void* operator new(size_t aBaseSize, size_t aDataSize) {
// subtract off the extra size to store |mBlock_|
return ::operator new(aBaseSize + aDataSize -
sizeof(char) * block_chars);
}
nsCSSCompressedDataBlock() : mStyleBits(0) {}
// Only this class (through |Destroy|) or nsCSSExpandedDataBlock (in
// |Expand|) can delete compressed data blocks.
~nsCSSCompressedDataBlock() { }
char* mBlockEnd; // the byte after the last valid byte
char mBlock_[block_chars]; // must be the last member!
char* Block() { return mBlock_; }
char* BlockEnd() { return mBlockEnd; }
const char* Block() const { return mBlock_; }
const char* BlockEnd() const { return mBlockEnd; }
ptrdiff_t DataSize() const { return BlockEnd() - Block(); }
};
class nsCSSExpandedDataBlock {
public:
nsCSSExpandedDataBlock();
~nsCSSExpandedDataBlock();
/*
* When setting properties in an |nsCSSExpandedDataBlock|, callers
* must make the appropriate |AddPropertyBit| call.
*/
nsCSSFont mFont;
nsCSSDisplay mDisplay;
nsCSSMargin mMargin;
nsCSSList mList;
nsCSSPosition mPosition;
nsCSSTable mTable;
nsCSSColor mColor;
nsCSSContent mContent;
nsCSSText mText;
nsCSSUserInterface mUserInterface;
nsCSSAural mAural;
nsCSSPage mPage;
nsCSSBreaks mBreaks;
nsCSSXUL mXUL;
#ifdef MOZ_SVG
nsCSSSVG mSVG;
#endif
/**
* Transfer all of the state from the compressed block to this
* expanded block. The state of this expanded block must be clear
* beforehand.
*
* The compressed block passed in IS DESTROYED by this method and
* set to null, and thus cannot be used again. (This is necessary
* because ownership of sub-objects is transferred to the expanded
* block.)
*/
void Expand(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock);
/**
* Allocate a new compressed block and transfer all of the state
* from this expanded block to the new compressed block, clearing
* the state of this expanded block.
*/
void Compress(nsCSSCompressedDataBlock **aNormalBlock,
nsCSSCompressedDataBlock **aImportantBlock);
/**
* Clear (and thus destroy) the state of this expanded block.
*/
void Clear();
/**
* Clear the data for the given property (including the set and
* important bits).
*/
void ClearProperty(nsCSSProperty aPropID);
void AssertInitialState() {
#ifdef DEBUG
DoAssertInitialState();
#endif
}
private:
/**
* Compute the size that will be occupied by the result of
* |Compress|.
*/
struct ComputeSizeResult {
PRUint32 normal, important;
};
ComputeSizeResult ComputeSize();
void DoExpand(nsCSSCompressedDataBlock *aBlock, PRBool aImportant);
#ifdef DEBUG
void DoAssertInitialState();
#endif
struct PropertyOffsetInfo {
// XXX These could probably be pointer-to-member, if the casting can
// be done correctly.
size_t block_offset; // offset of value in nsCSSExpandedDataBlock
size_t ruledata_struct_offset; // offset of nsRuleData* in nsRuleData
size_t ruledata_member_offset; // offset of value in nsRuleData*
};
static const PropertyOffsetInfo kOffsetTable[];
typedef PRUint8 property_set_type;
enum { kPropertiesSetChunkSize = 8 }; // number of bits in
// |property_set_type|.
// number of |property_set_type|s in the set
enum { kPropertiesSetChunkCount =
(eCSSProperty_COUNT_no_shorthands + (kPropertiesSetChunkSize-1)) /
kPropertiesSetChunkSize };
/*
* mPropertiesSet stores a bit for every property that may be
* present, to optimize compression of blocks with small numbers of
* properties (the norm). The code does not rely on it to be exact;
* it is allowable, although slower, if a bit is erroneously set
* even though the property is not present.
*/
property_set_type mPropertiesSet[kPropertiesSetChunkCount];
/*
* mPropertiesImportant indicates which properties are '!important'.
*/
property_set_type mPropertiesImportant[kPropertiesSetChunkCount];
public:
/*
* Return the storage location within |this| of the value of the
* property (i.e., either an |nsCSSValue*|, |nsCSSRect*|, or
* |nsCSSValueList**| (etc.).
*/
void* PropertyAt(nsCSSProperty aProperty) {
const PropertyOffsetInfo& offsets =
nsCSSExpandedDataBlock::kOffsetTable[aProperty];
return NS_REINTERPRET_CAST(void*, NS_REINTERPRET_CAST(char*, this) +
offsets.block_offset);
}
/*
* Return the storage location within |aRuleData| of the value of
* the property (i.e., either an |nsCSSValue*|, |nsCSSRect*|, or
* |nsCSSValueList**| (etc.).
*/
static void* RuleDataPropertyAt(nsRuleData *aRuleData,
nsCSSProperty aProperty) {
const PropertyOffsetInfo& offsets =
nsCSSExpandedDataBlock::kOffsetTable[aProperty];
NS_ASSERTION(offsets.ruledata_struct_offset != size_t(-1),
"property should not use CSS_PROP_BACKENDONLY");
char* cssstruct = *NS_REINTERPRET_CAST(char**,
NS_REINTERPRET_CAST(char*, aRuleData) +
offsets.ruledata_struct_offset);
return NS_REINTERPRET_CAST(void*,
cssstruct + offsets.ruledata_member_offset);
}
void AssertInSetRange(nsCSSProperty aProperty) {
NS_ASSERTION(0 <= aProperty &&
aProperty < eCSSProperty_COUNT_no_shorthands,
"out of bounds");
}
void SetPropertyBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesSet[aProperty / kPropertiesSetChunkSize] |=
property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
void ClearPropertyBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesSet[aProperty / kPropertiesSetChunkSize] &=
~property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
PRBool HasPropertyBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
return (mPropertiesSet[aProperty / kPropertiesSetChunkSize] &
(1 << (aProperty % kPropertiesSetChunkSize))) != 0;
}
void SetImportantBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesImportant[aProperty / kPropertiesSetChunkSize] |=
property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
void ClearImportantBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
mPropertiesImportant[aProperty / kPropertiesSetChunkSize] &=
~property_set_type(1 << (aProperty % kPropertiesSetChunkSize));
}
PRBool HasImportantBit(nsCSSProperty aProperty) {
AssertInSetRange(aProperty);
return (mPropertiesImportant[aProperty / kPropertiesSetChunkSize] &
(1 << (aProperty % kPropertiesSetChunkSize))) != 0;
}
void ClearSets() {
memset(mPropertiesSet, 0, sizeof(mPropertiesSet));
memset(mPropertiesImportant, 0, sizeof(mPropertiesImportant));
}
};
#endif /* !defined(nsCSSDataBlock_h__) */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -48,59 +48,124 @@
#include "nsCSSProps.h"
#include "nsVoidArray.h"
#include "nsValueArray.h"
#include "nsCSSDataBlock.h"
#include "nsCSSStruct.h"
class nsCSSDeclaration {
public:
nsCSSDeclaration(void);
/**
* Construct an |nsCSSDeclaration| that is in an invalid state (null
* |mData|) and cannot be used until its |CompressFrom| method or
* |InitializeEmpty| method is called.
*/
nsCSSDeclaration();
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
public:
NS_DECL_ZEROING_OPERATOR_NEW
/**
* |ValueAppended| must be called to maintain this declaration's
* |mOrder| whenever a property is parsed into an expanded data block
* for this declaration.
*/
nsresult ValueAppended(nsCSSProperty aProperty);
nsCSSStruct* GetData(const nsID& aSID);
nsCSSStruct* EnsureData(const nsID& aSID);
nsresult AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue);
nsresult AppendStructValue(nsCSSProperty aProperty, void* aStruct);
nsresult SetValueImportant(nsCSSProperty aProperty);
nsresult AppendComment(const nsAString& aComment);
nsresult RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue);
nsresult RemoveProperty(nsCSSProperty aProperty);
nsresult GetValue(nsCSSProperty aProperty, nsCSSValue& aValue);
nsresult GetValue(nsCSSProperty aProperty, nsAString& aValue);
nsresult GetValue(const nsAString& aProperty, nsAString& aValue);
nsresult GetValue(nsCSSProperty aProperty, nsAString& aValue) const;
nsresult GetValue(const nsAString& aProperty, nsAString& aValue) const;
nsCSSDeclaration* GetImportantValues();
PRBool GetValueIsImportant(nsCSSProperty aProperty);
PRBool GetValueIsImportant(const nsAString& aProperty);
/**
* May be called only for properties whose type is eCSSType_Value.
*
* XXX It would be good to make this protected, which means not using
* it from inspector via CSSStyleRuleImpl.
*/
nsresult GetValueOrImportantValue(nsCSSProperty aProperty, nsCSSValue& aValue) const;
PRUint32 Count();
nsresult GetNthProperty(PRUint32 aIndex, nsAString& aReturn);
PRBool HasImportantData() const { return mImportantData != nsnull; }
PRBool GetValueIsImportant(nsCSSProperty aProperty) const;
PRBool GetValueIsImportant(const nsAString& aProperty) const;
PRUint32 Count() const;
nsresult GetNthProperty(PRUint32 aIndex, nsAString& aReturn) const;
// XXX This should go away, along with the rest of the property-based hints.
nsChangeHint GetStyleImpact() const;
nsresult ToString(nsAString& aString);
nsresult ToString(nsAString& aString) const;
nsCSSDeclaration* Clone() const;
nsresult MapRuleInfoInto(nsRuleData *aRuleData) const {
return mData->MapRuleInfoInto(aRuleData);
}
nsresult MapImportantRuleInfoInto(nsRuleData *aRuleData) const {
return mImportantData->MapRuleInfoInto(aRuleData);
}
/**
* Initialize this declaration as holding no data. Return false on
* out-of-memory.
*/
PRBool InitializeEmpty();
/**
* Transfer all of the state from |aExpandedData| into this declaration.
* After calling, |aExpandedData| should be in its initial state.
*/
void CompressFrom(nsCSSExpandedDataBlock *aExpandedData) {
NS_ASSERTION(!mData, "oops");
NS_ASSERTION(!mImportantData, "oops");
aExpandedData->Compress(&mData, &mImportantData);
}
/**
* Transfer all of the state from this declaration into
* |aExpandedData| and put this declaration temporarily into an
* invalid state (ended by |CompressFrom| or |InitializeEmpty|) that
* should last only during parsing. During this time only
* |ValueAppended| should be called.
*/
void ExpandTo(nsCSSExpandedDataBlock *aExpandedData) {
aExpandedData->AssertInitialState();
NS_ASSERTION(mData, "oops");
aExpandedData->Expand(&mData, &mImportantData);
NS_ASSERTION(!mData && !mImportantData,
"Expand didn't null things out");
}
/**
* Clear the data, in preparation for its replacement with entirely
* new data by a call to |CompressFrom|.
*/
void ClearData() {
mData->Destroy();
mData = nsnull;
if (mImportantData) {
mImportantData->Destroy();
mImportantData = nsnull;
}
}
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
protected:
nsresult RemoveProperty(nsCSSProperty aProperty);
private:
nsresult GetValueOrImportantValue(nsCSSProperty aProperty, nsCSSValue& aValue);
void AppendImportanceToString(PRBool aIsImportant, nsAString& aString);
PRBool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult);
PRBool AppendValueOrImportantValueToString(nsCSSProperty aProperty, nsAString& aResult);
PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAString& aResult);
// Not implemented, and not supported.
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
PRBool operator==(const nsCSSDeclaration& aCopy) const;
void PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue);
void AppendImportanceToString(PRBool aIsImportant, nsAString& aString) const;
// return whether there was a value in |aValue| (i.e., it had a non-null unit)
PRBool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult) const;
// return whether there was a value in |aValue| (i.e., it had a non-null unit)
PRBool AppendCSSValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAString& aResult) const;
void PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue) const;
PRBool TryBorderShorthand(nsAString & aString, PRUint32 aPropertiesSet,
PRInt32 aBorderTopWidth,
PRInt32 aBorderTopStyle,
@ -113,43 +178,38 @@ private:
PRInt32 aBorderLeftColor,
PRInt32 aBorderRightWidth,
PRInt32 aBorderRightStyle,
PRInt32 aBorderRightColor);
PRInt32 aBorderRightColor) const;
PRBool TryBorderSideShorthand(nsAString & aString,
nsCSSProperty aShorthand,
PRInt32 aBorderWidth,
PRInt32 aBorderStyle,
PRInt32 aBorderColor);
PRInt32 aBorderColor) const;
PRBool TryFourSidesShorthand(nsAString & aString,
nsCSSProperty aShorthand,
PRInt32 & aTop,
PRInt32 & aBottom,
PRInt32 & aLeft,
PRInt32 & aRight,
PRBool aClearIndexes);
void DoClipShorthand(nsAString & aString,
PRInt32 aTop,
PRInt32 aBottom,
PRInt32 aLeft,
PRInt32 aRight);
PRBool aClearIndexes) const;
void TryBackgroundShorthand(nsAString & aString,
PRInt32 & aBgColor, PRInt32 & aBgImage,
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
PRInt32 & aBgPositionX,
PRInt32 & aBgPositionY);
PRInt32 & aBgPositionY) const;
void UseBackgroundPosition(nsAString & aString,
PRInt32 & aBgPositionX,
PRInt32 & aBgPositionY);
PRInt32 & aBgPositionY) const;
PRBool AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond,
PRInt32 aThird, PRInt32 aFourth,
PRInt32 aFifth, PRInt32 aSixth,
PRBool & aImportance);
PRBool & aImportance) const;
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
PRInt32 aThird, PRInt32 aFourth);
PRInt32 aThird, PRInt32 aFourth) const;
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
nsAString& aResult);
nsAString& aResult) const;
protected:
private:
//
// Specialized ref counting.
// We do not want everyone to ref count us, only the rules which hold
@ -161,41 +221,32 @@ protected:
//
friend class CSSStyleRuleImpl;
void AddRef(void) {
mRuleRefs++;
++mRefCnt;
}
void Release(void) {
NS_ASSERTION(0 < mRuleRefs, "bad Release");
if (0 == --mRuleRefs) {
NS_ASSERTION(0 < mRefCnt, "bad Release");
if (0 == --mRefCnt) {
delete this;
}
}
public:
void RuleAbort(void) {
NS_ASSERTION(0 == mRuleRefs, "bad RuleAbort");
NS_ASSERTION(0 == mRefCnt, "bad RuleAbort");
delete this;
}
protected:
//
// Block everyone, except us or a derivitive, from deleting us.
//
private:
// Block everyone, except us or a derivative, from deleting us.
~nsCSSDeclaration(void);
nsCSSProperty OrderValueAt(nsValueArrayIndex aValue) const {
return nsCSSProperty(mOrder.ValueAt(aValue));
}
private:
nsValueArray* mOrder;
nsCSSDeclaration* mImportant;
nsSmallVoidArray mStructs;
//
// Keep these two together, as they should pack.
//
nsCSSDeclRefCount mRuleRefs;
nsCSSDeclContains mContains;
nsValueArray mOrder;
nsAutoRefCnt mRefCnt;
nsCSSCompressedDataBlock *mData; // never null, except while expanded
nsCSSCompressedDataBlock *mImportantData; // may be null
};
nsresult
NS_NewCSSDeclaration(nsCSSDeclaration** aInstancePtrResult);
#endif /* nsCSSDeclaration_h___ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -38,52 +38,214 @@
/******
This file contains the list of all parsed CSS properties
See nsCSSProps.h for access to the enum values for properties
This file contains the list of all parsed CSS properties. It is
designed to be used as inline input through the magic of C
preprocessing. All entries must be enclosed in the appropriate
CSS_PROP_* macro which will have cruel and unusual things done to it.
It is recommended (but not strictly necessary) to keep all entries in
alphabetical order.
It is designed to be used as inline input through the magic of
C preprocessing.
The arguments to CSS_PROP_* are:
All entries must be enclosed in the macro CSS_PROP which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
Requirements:
Entries are in the form: (name, id, method, hint).
'name' entries represent a CSS property name and *must* use only
1. 'name' entries represent a CSS property name and *must* use only
lowercase characters.
'id' must always be the same as 'name' except that all hyphens ('-')
2. 'id' should be the same as 'name' except that all hyphens ('-')
in 'name' are converted to underscores ('_') in 'id'. This lets us
do nice things with the macros without having to copy/convert strings
at runtime.
at runtime. These are the names used for the enum values of the
nsCSSProperty enumeration defined in nsCSSProps.h.
'method' is designed to be as input for CSS2Properties and similar callers.
It must always be the same as 'name' except it must use InterCaps and all
hyphens ('-') must be removed.
3. 'method' is designed to be as input for CSS2Properties and similar
callers. It must always be the same as 'name' except it must use
InterCaps and all hyphens ('-') must be removed.
'hint' says what needs to be recomputed when the property changes.
4. 'hint' says what needs to be recomputed when the property changes.
** Break these invariants and bad things will happen. **
5. 'datastruct' says which nsRuleData* struct this property goes in.
6. 'member' gives the name of the member variable in the nsRuleData
struct.
7. 'type' gives the |nsCSSType| of the data in the nsRuleData struct
and in the nsCSSDeclaration backend.
8. 'iscoord' says whether the property is a coordinate property for
which we use an explicit inherit value in the *style structs* (since
inheritance requires knowledge of layout).
Which CSS_PROP_* macro a property is in depends on which nsStyle* its
computed value lives in (unless it is a shorthand, in which case it
gets CSS_PROP_SHORTHAND).
******/
// Assume the user wants internal properties, but not unimplemented ones
#ifndef CSS_PROP_INTERNAL
#define CSS_PROP_INTERNAL(_name, _id, _method, _hint) \
CSS_PROP(_name, _id, _method, _hint)
#define DEFINED_CSS_PROP_INTERNAL
#endif
/*************************************************************************/
// XXX Should we really be using CSS_PROP_SHORTHAND for 'border-spacing',
// 'background-position', and 'size'?
// All includers must explicitly define CSS_PROP_NOTIMPLEMENTED if they
// want this. (Only the DOM cares.)
#ifndef CSS_PROP_NOTIMPLEMENTED
#define CSS_PROP_NOTIMPLEMENTED(_name, _id, _method, _hint) /* nothing */
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_, hint_) /* nothing */
#define DEFINED_CSS_PROP_NOTIMPLEMENTED
#endif
// All includers must explicitly define CSS_PROP_SHORTHAND if they
// want it.
#ifndef CSS_PROP_SHORTHAND
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) /* nothing */
#define DEFINED_CSS_PROP_SHORTHAND
#endif
// Callers may define CSS_PROP_LIST_EXCLUDE_INTERNAL if they want to
// exclude internal properties that are not represented in the DOM (only
// the DOM style code defines this).
// A caller who wants all the properties can define the |CSS_PROP|
// macro.
#ifdef CSS_PROP
#define USED_CSS_PROP
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#ifdef MOZ_SVG
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#endif
// 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_, hint_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_)
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(CSS_PROP) */
// An includer who does not define CSS_PROP can define any or all of the
// per-struct macros that are equivalent to it, and the rest will be
// ignored.
#ifndef CSS_PROP_FONT
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_FONT
#endif
#ifndef CSS_PROP_COLOR
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_COLOR
#endif
#ifndef CSS_PROP_BACKGROUND
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BACKGROUND
#endif
#ifndef CSS_PROP_LIST
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_LIST
#endif
#ifndef CSS_PROP_POSITION
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_POSITION
#endif
#ifndef CSS_PROP_TEXT
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TEXT
#endif
#ifndef CSS_PROP_TEXTRESET
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TEXTRESET
#endif
#ifndef CSS_PROP_DISPLAY
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_DISPLAY
#endif
#ifndef CSS_PROP_VISIBILITY
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_VISIBILITY
#endif
#ifndef CSS_PROP_CONTENT
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_CONTENT
#endif
#ifndef CSS_PROP_QUOTES
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_QUOTES
#endif
#ifndef CSS_PROP_USERINTERFACE
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_USERINTERFACE
#endif
#ifndef CSS_PROP_UIRESET
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_UIRESET
#endif
#ifndef CSS_PROP_TABLE
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TABLE
#endif
#ifndef CSS_PROP_TABLEBORDER
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TABLEBORDER
#endif
#ifndef CSS_PROP_MARGIN
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_MARGIN
#endif
#ifndef CSS_PROP_PADDING
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_PADDING
#endif
#ifndef CSS_PROP_BORDER
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BORDER
#endif
#ifndef CSS_PROP_OUTLINE
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_OUTLINE
#endif
#ifndef CSS_PROP_XUL
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_XUL
#endif
#ifdef MOZ_SVG
#ifndef CSS_PROP_SVG
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_SVG
#endif
#endif /* defined(MOZ_SVG) */
#ifndef CSS_PROP_BACKENDONLY
#define CSS_PROP_BACKENDONLY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(CSS_PROP) */
/*************************************************************************/
// For notes XXX bug 3935 below, the names being parsed do not correspond
// to the constants used internally. It would be nice to bring the
// constants into line sometime.
@ -95,215 +257,349 @@
// support them correctly the old constants need to be renamed and
// new ones should be entered.
CSS_PROP(-moz-appearance, appearance, MozAppearance, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-border-radius, _moz_border_radius, MozBorderRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, MozBorderRadiusTopleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, MozBorderRadiusTopright, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, MozBorderRadiusBottomleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, MozBorderRadiusBottomright, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius, _moz_outline_radius, MozOutlineRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, MozOutlineRadiusTopleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, MozOutlineRadiusTopright, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, MozOutlineRadiusBottomleft, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, MozOutlineRadiusBottomright, NS_STYLE_HINT_VISUAL)
CSS_PROP(azimuth, azimuth, Azimuth, NS_STYLE_HINT_AURAL)
CSS_PROP(background, background, Background, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-attachment, background_attachment, BackgroundAttachment, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(-moz-background-clip, _moz_background_clip, MozBackgroundClip, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-color, background_color, BackgroundColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-image, background_image, BackgroundImage, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-position, background_position, BackgroundPosition, NS_STYLE_HINT_VISUAL)
CSS_PROP(background-repeat, background_repeat, BackgroundRepeat, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(-x-background-x-position, background_x_position, BackgroundXPosition, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-background-y-position, background_y_position, BackgroundYPosition, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP(-moz-binding, binding, MozBinding, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(border, border, Border, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-bottom, border_bottom, BorderBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-bottom-color, border_bottom_color, BorderBottomColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-bottom-colors, border_bottom_colors, MozBorderBottomColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-bottom-style, border_bottom_style, BorderBottomStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-bottom-width, border_bottom_width, BorderBottomWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-collapse, border_collapse, BorderCollapse, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(border-color, border_color, BorderColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-left, border_left, BorderLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-left-color, border_left_color, BorderLeftColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-left-style, border_left_style, BorderLeftStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-left-width, border_left_width, BorderLeftWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-right, border_right, BorderRight, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-right-color, border_right_color, BorderRightColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-right-colors, border_right_colors, MozBorderRightColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-right-style, border_right_style, BorderRightStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-right-width, border_right_width, BorderRightWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-spacing, border_spacing, BorderSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-style, border_style, BorderStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-top, border_top, BorderTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-top-color, border_top_color, BorderTopColor, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-border-top-colors, border_top_colors, MozBorderTopColors, NS_STYLE_HINT_VISUAL)
CSS_PROP(border-top-style, border_top_style, BorderTopStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP(border-top-width, border_top_width, BorderTopWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(border-width, border_width, BorderWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-border-x-spacing, border_x_spacing, BorderXSpacing, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP_INTERNAL(-x-border-y-spacing, border_y_spacing, BorderYSpacing, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(bottom, bottom, Bottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-box-align, box_align, MozBoxAlign, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-direction, box_direction, MozBoxDirection, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-flex, box_flex, MozBoxFlex, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-flex-group, box_flex_group, MozBoxFlexGroup, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-orient, box_orient, MozBoxOrient, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-pack, box_pack, MozBoxPack, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-sizing, box_sizing, MozBoxSizing, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-ordinal-group, box_ordinal_group, MozBoxOrdinalGroup, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(caption-side, caption_side, CaptionSide, NS_STYLE_HINT_REFLOW)
CSS_PROP(clear, clear, Clear, NS_STYLE_HINT_REFLOW)
CSS_PROP(clip, clip, Clip, nsChangeHint_SyncFrameView)
CSS_PROP_INTERNAL(-x-clip-bottom, clip_bottom, ClipBottom, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP_INTERNAL(-x-clip-left, clip_left, ClipLeft, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP_INTERNAL(-x-clip-right, clip_right, ClipRight, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP_INTERNAL(-x-clip-top, clip_top, ClipTop, nsChangeHint_SyncFrameView) // XXX bug 3935
CSS_PROP(color, color, Color, NS_STYLE_HINT_VISUAL)
CSS_PROP(content, content, Content, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP_DISPLAY(-moz-appearance, appearance, MozAppearance, NS_STYLE_HINT_REFLOW, Display, mAppearance, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(-moz-border-radius, _moz_border_radius, MozBorderRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP_BORDER(-moz-border-radius-topleft, _moz_border_radius_topLeft, MozBorderRadiusTopleft, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-topright, _moz_border_radius_topRight, MozBorderRadiusTopright, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, MozBorderRadiusBottomleft, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, MozBorderRadiusBottomright, NS_STYLE_HINT_VISUAL, Margin, mBorderRadius.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(-moz-outline-radius, _moz_outline_radius, MozOutlineRadius, NS_STYLE_HINT_VISUAL)
CSS_PROP_OUTLINE(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, MozOutlineRadiusTopleft, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-topright, _moz_outline_radius_topRight, MozOutlineRadiusTopright, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, MozOutlineRadiusBottomleft, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, MozOutlineRadiusBottomright, NS_STYLE_HINT_VISUAL, Margin, mOutlineRadius.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(azimuth, azimuth, Azimuth, NS_STYLE_HINT_AURAL, Aural, mAzimuth, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(background, background, Background, NS_STYLE_HINT_VISUAL)
CSS_PROP_BACKGROUND(background-attachment, background_attachment, BackgroundAttachment, NS_STYLE_HINT_FRAMECHANGE, Color, mBackAttachment, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-clip, _moz_background_clip, MozBackgroundClip, NS_STYLE_HINT_VISUAL, Color, mBackClip, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, NS_STYLE_HINT_VISUAL, Color, mBackColor, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(background-image, background_image, BackgroundImage, NS_STYLE_HINT_VISUAL, Color, mBackImage, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, NS_STYLE_HINT_VISUAL, Color, mBackInlinePolicy, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, NS_STYLE_HINT_VISUAL, Color, mBackOrigin, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(background-position, background_position, BackgroundPosition, NS_STYLE_HINT_VISUAL)
CSS_PROP_BACKGROUND(background-repeat, background_repeat, BackgroundRepeat, NS_STYLE_HINT_VISUAL, Color, mBackRepeat, eCSSType_Value, PR_FALSE)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKGROUND(-x-background-x-position, background_x_position, BackgroundXPosition, NS_STYLE_HINT_VISUAL, Color, mBackPositionX, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKGROUND(-x-background-y-position, background_y_position, BackgroundYPosition, NS_STYLE_HINT_VISUAL, Color, mBackPositionY, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_DISPLAY(-moz-binding, binding, MozBinding, NS_STYLE_HINT_FRAMECHANGE, Display, mBinding, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_SHORTHAND(border, border, Border, NS_STYLE_HINT_REFLOW)
CSS_PROP_SHORTHAND(border-bottom, border_bottom, BorderBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-bottom-color, border_bottom_color, BorderBottomColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mBottom, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-bottom-colors, border_bottom_colors, MozBorderBottomColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mBottom, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-bottom-style, border_bottom_style, BorderBottomStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mBottom, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-bottom-width, border_bottom_width, BorderBottomWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mBottom, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLEBORDER(border-collapse, border_collapse, BorderCollapse, NS_STYLE_HINT_FRAMECHANGE, Table, mBorderCollapse, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-color, border_color, BorderColor, NS_STYLE_HINT_VISUAL)
CSS_PROP_SHORTHAND(border-left, border_left, BorderLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-left-color, border_left_color, BorderLeftColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mLeft, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mLeft, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-left-style, border_left_style, BorderLeftStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mLeft, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-left-width, border_left_width, BorderLeftWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mLeft, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-right, border_right, BorderRight, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-right-color, border_right_color, BorderRightColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mRight, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-right-colors, border_right_colors, MozBorderRightColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mRight, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-right-style, border_right_style, BorderRightStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mRight, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-right-width, border_right_width, BorderRightWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mRight, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-spacing, border_spacing, BorderSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP_SHORTHAND(border-style, border_style, BorderStyle, NS_STYLE_HINT_REFLOW) // on/off will need reflow
CSS_PROP_SHORTHAND(border-top, border_top, BorderTop, NS_STYLE_HINT_REFLOW)
CSS_PROP_BORDER(border-top-color, border_top_color, BorderTopColor, NS_STYLE_HINT_VISUAL, Margin, mBorderColor.mTop, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-top-colors, border_top_colors, MozBorderTopColors, NS_STYLE_HINT_VISUAL, Margin, mBorderColors.mTop, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-top-style, border_top_style, BorderTopStyle, NS_STYLE_HINT_REFLOW, Margin, mBorderStyle.mTop, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-top-width, border_top_width, BorderTopWidth, NS_STYLE_HINT_REFLOW, Margin, mBorderWidth.mTop, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-width, border_width, BorderWidth, NS_STYLE_HINT_REFLOW)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_TABLEBORDER(-x-border-x-spacing, border_x_spacing, BorderXSpacing, NS_STYLE_HINT_REFLOW, Table, mBorderSpacingX, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TABLEBORDER(-x-border-y-spacing, border_y_spacing, BorderYSpacing, NS_STYLE_HINT_REFLOW, Table, mBorderSpacingY, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_POSITION(bottom, bottom, Bottom, NS_STYLE_HINT_REFLOW, Position, mOffset.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(-moz-box-sizing, box_sizing, MozBoxSizing, NS_STYLE_HINT_REFLOW, Position, mBoxSizing, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TABLEBORDER(caption-side, caption_side, CaptionSide, NS_STYLE_HINT_REFLOW, Table, mCaptionSide, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(clear, clear, Clear, NS_STYLE_HINT_REFLOW, Display, mClear, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(clip, clip, Clip, nsChangeHint_SyncFrameView, Display, mClip, eCSSType_Rect, PR_FALSE)
CSS_PROP_COLOR(color, color, Color, NS_STYLE_HINT_VISUAL, Color, mColor, eCSSType_Value, PR_FALSE)
CSS_PROP_CONTENT(content, content, Content, NS_STYLE_HINT_FRAMECHANGE, Content, mContent, eCSSType_ValueList, PR_FALSE)
CSS_PROP_NOTIMPLEMENTED(counter-increment, counter_increment, CounterIncrement, NS_STYLE_HINT_REFLOW)
CSS_PROP_NOTIMPLEMENTED(counter-reset, counter_reset, CounterReset, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-counter-increment, _moz_counter_increment, MozCounterIncrement, NS_STYLE_HINT_REFLOW) // XXX bug 137285
CSS_PROP(-moz-counter-reset, _moz_counter_reset, MozCounterReset, NS_STYLE_HINT_REFLOW) // XXX bug 137285
CSS_PROP(cue, cue, Cue, NS_STYLE_HINT_AURAL)
CSS_PROP(cue-after, cue_after, CueAfter, NS_STYLE_HINT_AURAL)
CSS_PROP(cue-before, cue_before, CueBefore, NS_STYLE_HINT_AURAL)
CSS_PROP(cursor, cursor, Cursor, NS_STYLE_HINT_VISUAL)
CSS_PROP(direction, direction, Direction, NS_STYLE_HINT_REFLOW)
CSS_PROP(display, display, Display, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(elevation, elevation, Elevation, NS_STYLE_HINT_AURAL)
CSS_PROP(empty-cells, empty_cells, EmptyCells, NS_STYLE_HINT_VISUAL)
CSS_PROP(float, float, CssFloat, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(-moz-float-edge, float_edge, MozFloatEdge, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(font, font, Font, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-family, font_family, FontFamily, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-size, font_size, FontSize, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-size-adjust, font_size_adjust, FontSizeAdjust, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-stretch, font_stretch, FontStretch, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-style, font_style, FontStyle, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-variant, font_variant, FontVariant, NS_STYLE_HINT_REFLOW)
CSS_PROP(font-weight, font_weight, FontWeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-force-broken-image-icon, force_broken_image_icon, MozForceBrokenImageIcon, NS_STYLE_HINT_FRAMECHANGE) // bug 58646
CSS_PROP(height, height, Height, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-image-region, image_region, MozImageRegion, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-bottom, image_region_bottom, MozImageRegionBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-left, image_region_left, MozImageRegionLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-right, image_region_right, MozImageRegionRight, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-image-region-top, image_region_top, MozImageRegionTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-key-equivalent, key_equivalent, MozKeyEquivalent, NS_STYLE_HINT_CONTENT) // This will need some other notification, but what? // XXX bug 3935
CSS_PROP(left, left, Left, NS_STYLE_HINT_REFLOW)
CSS_PROP(letter-spacing, letter_spacing, LetterSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP(line-height, line_height, LineHeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style, list_style, ListStyle, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style-image, list_style_image, ListStyleImage, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style-position, list_style_position, ListStylePosition, NS_STYLE_HINT_REFLOW)
CSS_PROP(list-style-type, list_style_type, ListStyleType, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin, margin, Margin, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-bottom, margin_bottom, MarginBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-left, margin_left, MarginLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-right, margin_right, MarginRight, NS_STYLE_HINT_REFLOW)
CSS_PROP(margin-top, margin_top, MarginTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(marker-offset, marker_offset, MarkerOffset, NS_STYLE_HINT_REFLOW)
CSS_PROP(marks, marks, Marks, NS_STYLE_HINT_VISUAL)
CSS_PROP(max-height, max_height, MaxHeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(max-width, max_width, MaxWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(min-height, min_height, MinHeight, NS_STYLE_HINT_REFLOW)
CSS_PROP(min-width, min_width, MinWidth, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-opacity, opacity, MozOpacity, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(orphans, orphans, Orphans, NS_STYLE_HINT_REFLOW)
CSS_PROP_CONTENT(-moz-counter-increment, _moz_counter_increment, MozCounterIncrement, NS_STYLE_HINT_REFLOW, Content, mCounterIncrement, eCSSType_CounterData, PR_FALSE) // XXX bug 137285
CSS_PROP_CONTENT(-moz-counter-reset, _moz_counter_reset, MozCounterReset, NS_STYLE_HINT_REFLOW, Content, mCounterReset, eCSSType_CounterData, PR_FALSE) // XXX bug 137285
CSS_PROP_SHORTHAND(cue, cue, Cue, NS_STYLE_HINT_AURAL)
CSS_PROP_BACKENDONLY(cue-after, cue_after, CueAfter, NS_STYLE_HINT_AURAL, Aural, mCueAfter, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(cue-before, cue_before, CueBefore, NS_STYLE_HINT_AURAL, Aural, mCueBefore, eCSSType_Value, PR_FALSE)
CSS_PROP_USERINTERFACE(cursor, cursor, Cursor, NS_STYLE_HINT_VISUAL, UserInterface, mCursor, eCSSType_ValueList, PR_FALSE)
CSS_PROP_VISIBILITY(direction, direction, Direction, NS_STYLE_HINT_REFLOW, Display, mDirection, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(display, display, Display, NS_STYLE_HINT_FRAMECHANGE, Display, mDisplay, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(elevation, elevation, Elevation, NS_STYLE_HINT_AURAL, Aural, mElevation, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLEBORDER(empty-cells, empty_cells, EmptyCells, NS_STYLE_HINT_VISUAL, Table, mEmptyCells, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(float, float, CssFloat, NS_STYLE_HINT_FRAMECHANGE, Display, mFloat, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-float-edge, float_edge, MozFloatEdge, NS_STYLE_HINT_REFLOW, Margin, mFloatEdge, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_SHORTHAND(font, font, Font, NS_STYLE_HINT_REFLOW)
CSS_PROP_FONT(font-family, font_family, FontFamily, NS_STYLE_HINT_REFLOW, Font, mFamily, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-size, font_size, FontSize, NS_STYLE_HINT_REFLOW, Font, mSize, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-size-adjust, font_size_adjust, FontSizeAdjust, NS_STYLE_HINT_REFLOW, Font, mSizeAdjust, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(font-stretch, font_stretch, FontStretch, NS_STYLE_HINT_REFLOW, Font, mStretch, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-style, font_style, FontStyle, NS_STYLE_HINT_REFLOW, Font, mStyle, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-variant, font_variant, FontVariant, NS_STYLE_HINT_REFLOW, Font, mVariant, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-weight, font_weight, FontWeight, NS_STYLE_HINT_REFLOW, Font, mWeight, eCSSType_Value, PR_FALSE)
CSS_PROP_UIRESET(-moz-force-broken-image-icon, force_broken_image_icon, MozForceBrokenImageIcon, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mForceBrokenImageIcon, eCSSType_Value, PR_FALSE) // bug 58646
CSS_PROP_POSITION(height, height, Height, NS_STYLE_HINT_REFLOW, Position, mHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_LIST(-moz-image-region, image_region, MozImageRegion, NS_STYLE_HINT_REFLOW, List, mImageRegion, eCSSType_Rect, PR_TRUE)
CSS_PROP_UIRESET(-moz-key-equivalent, key_equivalent, MozKeyEquivalent, NS_STYLE_HINT_CONTENT, UserInterface, mKeyEquivalent, eCSSType_ValueList, PR_FALSE) // This will need some other notification, but what? // XXX bug 3935
CSS_PROP_POSITION(left, left, Left, NS_STYLE_HINT_REFLOW, Position, mOffset.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(letter-spacing, letter_spacing, LetterSpacing, NS_STYLE_HINT_REFLOW, Text, mLetterSpacing, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(line-height, line_height, LineHeight, NS_STYLE_HINT_REFLOW, Text, mLineHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(list-style, list_style, ListStyle, NS_STYLE_HINT_REFLOW)
CSS_PROP_LIST(list-style-image, list_style_image, ListStyleImage, NS_STYLE_HINT_REFLOW, List, mImage, eCSSType_Value, PR_FALSE)
CSS_PROP_LIST(list-style-position, list_style_position, ListStylePosition, NS_STYLE_HINT_REFLOW, List, mPosition, eCSSType_Value, PR_FALSE)
CSS_PROP_LIST(list-style-type, list_style_type, ListStyleType, NS_STYLE_HINT_REFLOW, List, mType, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(margin, margin, Margin, NS_STYLE_HINT_REFLOW)
CSS_PROP_MARGIN(margin-bottom, margin_bottom, MarginBottom, NS_STYLE_HINT_REFLOW, Margin, mMargin.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-left, margin_left, MarginLeft, NS_STYLE_HINT_REFLOW, Margin, mMargin.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-right, margin_right, MarginRight, NS_STYLE_HINT_REFLOW, Margin, mMargin.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-top, margin_top, MarginTop, NS_STYLE_HINT_REFLOW, Margin, mMargin.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_CONTENT(marker-offset, marker_offset, MarkerOffset, NS_STYLE_HINT_REFLOW, Content, mMarkerOffset, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(marks, marks, Marks, NS_STYLE_HINT_VISUAL, Page, mMarks, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(max-height, max_height, MaxHeight, NS_STYLE_HINT_REFLOW, Position, mMaxHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(max-width, max_width, MaxWidth, NS_STYLE_HINT_REFLOW, Position, mMaxWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(min-height, min_height, MinHeight, NS_STYLE_HINT_REFLOW, Position, mMinHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(min-width, min_width, MinWidth, NS_STYLE_HINT_REFLOW, Position, mMinWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_VISIBILITY(-moz-opacity, opacity, MozOpacity, NS_STYLE_HINT_FRAMECHANGE, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, NS_STYLE_HINT_REFLOW, Breaks, mOrphans, eCSSType_Value, PR_FALSE)
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline, NS_STYLE_HINT_VISUAL)
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor, NS_STYLE_HINT_VISUAL)
CSS_PROP_NOTIMPLEMENTED(outline-style, outline_style, OutlineStyle, NS_STYLE_HINT_VISUAL)
CSS_PROP_NOTIMPLEMENTED(outline-width, outline_width, OutlineWidth, NS_STYLE_HINT_VISUAL)
CSS_PROP(-moz-outline, _moz_outline, MozOutline, NS_STYLE_HINT_VISUAL) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973
CSS_PROP(-moz-outline-color, _moz_outline_color, MozOutlineColor, NS_STYLE_HINT_VISUAL) // XXX bug 48973
CSS_PROP(-moz-outline-style, _moz_outline_style, MozOutlineStyle, NS_STYLE_HINT_VISUAL) // XXX bug 48973
CSS_PROP(-moz-outline-width, _moz_outline_width, MozOutlineWidth, NS_STYLE_HINT_VISUAL) // XXX bug 48973
CSS_PROP(overflow, overflow, Overflow, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(padding, padding, Padding, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-bottom, padding_bottom, PaddingBottom, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-left, padding_left, PaddingLeft, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-right, padding_right, PaddingRight, NS_STYLE_HINT_REFLOW)
CSS_PROP(padding-top, padding_top, PaddingTop, NS_STYLE_HINT_REFLOW)
CSS_PROP(page, page, Page, NS_STYLE_HINT_REFLOW)
CSS_PROP(page-break-after, page_break_after, PageBreakAfter, NS_STYLE_HINT_REFLOW)
CSS_PROP(page-break-before, page_break_before, PageBreakBefore, NS_STYLE_HINT_REFLOW)
CSS_PROP(page-break-inside, page_break_inside, PageBreakInside, NS_STYLE_HINT_REFLOW)
CSS_PROP(pause, pause, Pause, NS_STYLE_HINT_AURAL)
CSS_PROP(pause-after, pause_after, PauseAfter, NS_STYLE_HINT_AURAL)
CSS_PROP(pause-before, pause_before, PauseBefore, NS_STYLE_HINT_AURAL)
CSS_PROP(pitch, pitch, Pitch, NS_STYLE_HINT_AURAL)
CSS_PROP(pitch-range, pitch_range, PitchRange, NS_STYLE_HINT_AURAL)
CSS_PROP(play-during, play_during, PlayDuring, NS_STYLE_HINT_AURAL)
CSS_PROP_INTERNAL(-x-play-during-flags, play_during_flags, PlayDuringFlags, NS_STYLE_HINT_AURAL) // XXX why is this here?
CSS_PROP(position, position, Position, NS_STYLE_HINT_FRAMECHANGE)
CSS_PROP(quotes, quotes, Quotes, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-quotes-close, quotes_close, QuotesClose, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP_INTERNAL(-x-quotes-open, quotes_open, QuotesOpen, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(-moz-resizer, resizer, MozResizer, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(richness, richness, Richness, NS_STYLE_HINT_AURAL)
CSS_PROP(right, right, Right, NS_STYLE_HINT_REFLOW)
CSS_PROP(size, size, Size, NS_STYLE_HINT_REFLOW)
CSS_PROP_INTERNAL(-x-size-height, size_height, SizeHeight, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP_INTERNAL(-x-size-width, size_width, SizeWidth, NS_STYLE_HINT_REFLOW) // XXX bug 3935
CSS_PROP(speak, speak, Speak, NS_STYLE_HINT_AURAL)
CSS_PROP(speak-header, speak_header, SpeakHeader, NS_STYLE_HINT_AURAL)
CSS_PROP(speak-numeral, speak_numeral, SpeakNumeral, NS_STYLE_HINT_AURAL)
CSS_PROP(speak-punctuation, speak_punctuation, SpeakPunctuation, NS_STYLE_HINT_AURAL)
CSS_PROP(speech-rate, speech_rate, SpeechRate, NS_STYLE_HINT_AURAL)
CSS_PROP(stress, stress, Stress, NS_STYLE_HINT_AURAL)
CSS_PROP(table-layout, table_layout, TableLayout, NS_STYLE_HINT_REFLOW)
CSS_PROP(text-align, text_align, TextAlign, NS_STYLE_HINT_REFLOW)
CSS_PROP(text-decoration, text_decoration, TextDecoration, NS_STYLE_HINT_VISUAL)
CSS_PROP(text-indent, text_indent, TextIndent, NS_STYLE_HINT_REFLOW)
CSS_PROP(text-shadow, text_shadow, TextShadow, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(-x-text-shadow-color, text_shadow_color, TextShadowColor, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-text-shadow-radius, text_shadow_radius, TextShadowRadius, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-text-shadow-x, text_shadow_x, TextShadowX, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP_INTERNAL(-x-text-shadow-y, text_shadow_y, TextShadowY, NS_STYLE_HINT_VISUAL) // XXX bug 3935
CSS_PROP(text-transform, text_transform, TextTransform, NS_STYLE_HINT_REFLOW)
CSS_PROP(top, top, Top, NS_STYLE_HINT_REFLOW)
CSS_PROP(unicode-bidi, unicode_bidi, UnicodeBidi, NS_STYLE_HINT_REFLOW)
CSS_PROP(-moz-user-focus, user_focus, MozUserFocus, NS_STYLE_HINT_CONTENT) // XXX bug 3935
CSS_PROP(-moz-user-input, user_input, MozUserInput, NS_STYLE_HINT_FRAMECHANGE) // XXX ??? // XXX bug 3935
CSS_PROP(-moz-user-modify, user_modify, MozUserModify, NS_STYLE_HINT_FRAMECHANGE) // XXX bug 3935
CSS_PROP(-moz-user-select, user_select, MozUserSelect, NS_STYLE_HINT_CONTENT) // XXX bug 3935
CSS_PROP(vertical-align, vertical_align, VerticalAlign, NS_STYLE_HINT_REFLOW)
CSS_PROP(visibility, visibility, Visibility, NS_STYLE_HINT_REFLOW) // reflow for collapse
CSS_PROP(voice-family, voice_family, VoiceFamily, NS_STYLE_HINT_AURAL)
CSS_PROP(volume, volume, Volume, NS_STYLE_HINT_AURAL)
CSS_PROP(white-space, white_space, WhiteSpace, NS_STYLE_HINT_REFLOW)
CSS_PROP(widows, widows, Widows, NS_STYLE_HINT_REFLOW)
CSS_PROP(width, width, Width, NS_STYLE_HINT_REFLOW)
CSS_PROP(word-spacing, word_spacing, WordSpacing, NS_STYLE_HINT_REFLOW)
CSS_PROP(z-index, z_index, ZIndex, NS_STYLE_HINT_REFLOW)
CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline, NS_STYLE_HINT_VISUAL) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, NS_STYLE_HINT_VISUAL, Margin, mOutlineColor, eCSSType_Value, PR_FALSE) // XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, NS_STYLE_HINT_VISUAL, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE) // XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, NS_STYLE_HINT_VISUAL, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE) // XXX bug 48973
CSS_PROP_DISPLAY(overflow, overflow, Overflow, NS_STYLE_HINT_FRAMECHANGE, Display, mOverflow, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(padding, padding, Padding, NS_STYLE_HINT_REFLOW)
CSS_PROP_PADDING(padding-bottom, padding_bottom, PaddingBottom, NS_STYLE_HINT_REFLOW, Margin, mPadding.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-left, padding_left, PaddingLeft, NS_STYLE_HINT_REFLOW, Margin, mPadding.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-right, padding_right, PaddingRight, NS_STYLE_HINT_REFLOW, Margin, mPadding.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-top, padding_top, PaddingTop, NS_STYLE_HINT_REFLOW, Margin, mPadding.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(page, page, Page, NS_STYLE_HINT_REFLOW, Breaks, mPage, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(page-break-after, page_break_after, PageBreakAfter, NS_STYLE_HINT_REFLOW, Display, mBreakAfter, eCSSType_Value, PR_FALSE) // temp fix for bug 24000
CSS_PROP_DISPLAY(page-break-before, page_break_before, PageBreakBefore, NS_STYLE_HINT_REFLOW, Display, mBreakBefore, eCSSType_Value, PR_FALSE) // temp fix for bug 24000
CSS_PROP_BACKENDONLY(page-break-inside, page_break_inside, PageBreakInside, NS_STYLE_HINT_REFLOW, Breaks, mPageBreakInside, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(pause, pause, Pause, NS_STYLE_HINT_AURAL)
CSS_PROP_BACKENDONLY(pause-after, pause_after, PauseAfter, NS_STYLE_HINT_AURAL, Aural, mPauseAfter, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pause-before, pause_before, PauseBefore, NS_STYLE_HINT_AURAL, Aural, mPauseBefore, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pitch, pitch, Pitch, NS_STYLE_HINT_AURAL, Aural, mPitch, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pitch-range, pitch_range, PitchRange, NS_STYLE_HINT_AURAL, Aural, mPitchRange, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(play-during, play_during, PlayDuring, NS_STYLE_HINT_AURAL, Aural, mPlayDuring, eCSSType_Value, PR_FALSE)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKENDONLY(-x-play-during-flags, play_during_flags, PlayDuringFlags, NS_STYLE_HINT_AURAL, Aural, mPlayDuringFlags, eCSSType_Value, PR_FALSE) // XXX why is this here?
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_DISPLAY(position, position, Position, NS_STYLE_HINT_FRAMECHANGE, Display, mPosition, eCSSType_Value, PR_FALSE)
CSS_PROP_QUOTES(quotes, quotes, Quotes, NS_STYLE_HINT_REFLOW, Content, mQuotes, eCSSType_Quotes, PR_FALSE)
CSS_PROP_UIRESET(-moz-resizer, resizer, MozResizer, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mResizer, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(richness, richness, Richness, NS_STYLE_HINT_AURAL, Aural, mRichness, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(right, right, Right, NS_STYLE_HINT_REFLOW, Position, mOffset.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(size, size, Size, NS_STYLE_HINT_REFLOW)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKENDONLY(-x-size-height, size_height, SizeHeight, NS_STYLE_HINT_REFLOW, Page, mSizeHeight, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(-x-size-width, size_width, SizeWidth, NS_STYLE_HINT_REFLOW, Page, mSizeWidth, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_BACKENDONLY(speak, speak, Speak, NS_STYLE_HINT_AURAL, Aural, mSpeak, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-header, speak_header, SpeakHeader, NS_STYLE_HINT_AURAL, Aural, mSpeakHeader, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-numeral, speak_numeral, SpeakNumeral, NS_STYLE_HINT_AURAL, Aural, mSpeakNumeral, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-punctuation, speak_punctuation, SpeakPunctuation, NS_STYLE_HINT_AURAL, Aural, mSpeakPunctuation, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speech-rate, speech_rate, SpeechRate, NS_STYLE_HINT_AURAL, Aural, mSpeechRate, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(stress, stress, Stress, NS_STYLE_HINT_AURAL, Aural, mStress, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(table-layout, table_layout, TableLayout, NS_STYLE_HINT_REFLOW, Table, mLayout, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(text-align, text_align, TextAlign, NS_STYLE_HINT_REFLOW, Text, mTextAlign, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXTRESET(text-decoration, text_decoration, TextDecoration, NS_STYLE_HINT_VISUAL, Text, mDecoration, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(text-indent, text_indent, TextIndent, NS_STYLE_HINT_REFLOW, Text, mTextIndent, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(text-shadow, text_shadow, TextShadow, NS_STYLE_HINT_VISUAL, Text, mTextShadow, eCSSType_Shadow, PR_FALSE)
CSS_PROP_TEXT(text-transform, text_transform, TextTransform, NS_STYLE_HINT_REFLOW, Text, mTextTransform, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(top, top, Top, NS_STYLE_HINT_REFLOW, Position, mOffset.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXTRESET(unicode-bidi, unicode_bidi, UnicodeBidi, NS_STYLE_HINT_REFLOW, Text, mUnicodeBidi, eCSSType_Value, PR_FALSE)
CSS_PROP_USERINTERFACE(-moz-user-focus, user_focus, MozUserFocus, NS_STYLE_HINT_CONTENT, UserInterface, mUserFocus, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_USERINTERFACE(-moz-user-input, user_input, MozUserInput, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mUserInput, eCSSType_Value, PR_FALSE) // XXX ??? // XXX bug 3935
CSS_PROP_USERINTERFACE(-moz-user-modify, user_modify, MozUserModify, NS_STYLE_HINT_FRAMECHANGE, UserInterface, mUserModify, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_UIRESET(-moz-user-select, user_select, MozUserSelect, NS_STYLE_HINT_CONTENT, UserInterface, mUserSelect, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TEXTRESET(vertical-align, vertical_align, VerticalAlign, NS_STYLE_HINT_REFLOW, Text, mVerticalAlign, eCSSType_Value, PR_TRUE)
CSS_PROP_VISIBILITY(visibility, visibility, Visibility, NS_STYLE_HINT_REFLOW, Display, mVisibility, eCSSType_Value, PR_FALSE) // reflow for collapse
CSS_PROP_BACKENDONLY(voice-family, voice_family, VoiceFamily, NS_STYLE_HINT_AURAL, Aural, mVoiceFamily, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(volume, volume, Volume, NS_STYLE_HINT_AURAL, Aural, mVolume, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(white-space, white_space, WhiteSpace, NS_STYLE_HINT_REFLOW, Text, mWhiteSpace, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(widows, widows, Widows, NS_STYLE_HINT_REFLOW, Breaks, mWidows, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(width, width, Width, NS_STYLE_HINT_REFLOW, Position, mWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(word-spacing, word_spacing, WordSpacing, NS_STYLE_HINT_REFLOW, Text, mWordSpacing, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(z-index, z_index, ZIndex, NS_STYLE_HINT_REFLOW, Position, mZIndex, eCSSType_Value, PR_FALSE)
CSS_PROP_XUL(-moz-box-align, box_align, MozBoxAlign, NS_STYLE_HINT_REFLOW, XUL, mBoxAlign, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-direction, box_direction, MozBoxDirection, NS_STYLE_HINT_REFLOW, XUL, mBoxDirection, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-flex, box_flex, MozBoxFlex, NS_STYLE_HINT_REFLOW, XUL, mBoxFlex, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-orient, box_orient, MozBoxOrient, NS_STYLE_HINT_REFLOW, XUL, mBoxOrient, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-pack, box_pack, MozBoxPack, NS_STYLE_HINT_REFLOW, XUL, mBoxPack, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-ordinal-group, box_ordinal_group, MozBoxOrdinalGroup, NS_STYLE_HINT_FRAMECHANGE, XUL, mBoxOrdinal, eCSSType_Value, PR_FALSE)
#ifdef MOZ_SVG
// XXX treat SVG's CSS Properties as internal for now.
// Do we want to create an nsIDOMSVGCSS2Properties interface?
CSS_PROP_INTERNAL(fill, fill, Fill, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(fill-opacity, fill_opacity, FillOpacity, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(fill-rule, fill_rule, FillRule, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke, stroke, Stroke, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-dasharray, stroke_dasharray, StrokeDasharray, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-dashoffset, stroke_dashoffset, StrokeDashoffset, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-linecap, stroke_linecap, StrokeLinecap, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-linejoin, stroke_linejoin, StrokeLinejoin, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-miterlimit, stroke_miterlimit, StrokeMiterlimit, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-opacity, stroke_opacity, StrokeOpacity, NS_STYLE_HINT_VISUAL)
CSS_PROP_INTERNAL(stroke-width, stroke_width, StrokeWidth, NS_STYLE_HINT_VISUAL)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_SVG(fill, fill, Fill, NS_STYLE_HINT_VISUAL, SVG, mFill, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill-opacity, fill_opacity, FillOpacity, NS_STYLE_HINT_VISUAL, SVG, mFillOpacity, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill-rule, fill_rule, FillRule, NS_STYLE_HINT_VISUAL, SVG, mFillRule, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke, stroke, Stroke, NS_STYLE_HINT_VISUAL, SVG, mStroke, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-dasharray, stroke_dasharray, StrokeDasharray, NS_STYLE_HINT_VISUAL, SVG, mStrokeDasharray, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-dashoffset, stroke_dashoffset, StrokeDashoffset, NS_STYLE_HINT_VISUAL, SVG, mStrokeDashoffset, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-linecap, stroke_linecap, StrokeLinecap, NS_STYLE_HINT_VISUAL, SVG, mStrokeLinecap, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-linejoin, stroke_linejoin, StrokeLinejoin, NS_STYLE_HINT_VISUAL, SVG, mStrokeLinejoin, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-miterlimit, stroke_miterlimit, StrokeMiterlimit, NS_STYLE_HINT_VISUAL, SVG, mStrokeMiterlimit, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-opacity, stroke_opacity, StrokeOpacity, NS_STYLE_HINT_VISUAL, SVG, mStrokeOpacity, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-width, stroke_width, StrokeWidth, NS_STYLE_HINT_VISUAL, SVG, mStrokeWidth, eCSSType_Value, PR_FALSE)
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
#endif
// Clean up after ourselves
#ifdef DEFINED_CSS_PROP_INTERNAL
#undef CSS_PROP_INTERNAL
#undef DEFINED_CSS_PROP_INTERNAL
// Callers that want information on the properties that are in
// the style structs but not in the nsCSS* structs should define
// |CSS_PROP_INCLUDE_NOT_CSS|. (Some of these are also in nsRuleData*,
// and a distinction might be needed at some point.)
#ifdef CSS_PROP_INCLUDE_NOT_CSS
CSS_PROP_VISIBILITY(, , , , Display, mLang, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mFrame, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mRules, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mCols, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(, , , , Table, mSpan, eCSSType_Value, PR_FALSE)
#endif /* defined(CSS_PROP_INCLUDE_NOT_CSS) */
#ifdef USED_CSS_PROP
#undef USED_CSS_PROP
#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
#ifdef MOZ_SVG
#undef CSS_PROP_SVG
#endif
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(USED_CSS_PROP) */
#ifdef DEFINED_CSS_PROP_FONT
#undef CSS_PROP_FONT
#undef DEFINED_CSS_PROP_FONT
#endif
#ifdef DEFINED_CSS_PROP_COLOR
#undef CSS_PROP_COLOR
#undef DEFINED_CSS_PROP_COLOR
#endif
#ifdef DEFINED_CSS_PROP_BACKGROUND
#undef CSS_PROP_BACKGROUND
#undef DEFINED_CSS_PROP_BACKGROUND
#endif
#ifdef DEFINED_CSS_PROP_LIST
#undef CSS_PROP_LIST
#undef DEFINED_CSS_PROP_LIST
#endif
#ifdef DEFINED_CSS_PROP_POSITION
#undef CSS_PROP_POSITION
#undef DEFINED_CSS_PROP_POSITION
#endif
#ifdef DEFINED_CSS_PROP_TEXT
#undef CSS_PROP_TEXT
#undef DEFINED_CSS_PROP_TETEXTRESETT
#endif
#ifdef DEFINED_CSS_PROP_TEXTRESET
#undef CSS_PROP_TEXTRESET
#undef DEFINED_CSS_PROP_TEDISPLAYTRESET
#endif
#ifdef DEFINED_CSS_PROP_DISPLAY
#undef CSS_PROP_DISPLAY
#undef DEFINED_CSS_PROP_DISPLAY
#endif
#ifdef DEFINED_CSS_PROP_VISIBILITY
#undef CSS_PROP_VISIBILITY
#undef DEFINED_CSS_PROP_VISIBILITY
#endif
#ifdef DEFINED_CSS_PROP_CONTENT
#undef CSS_PROP_CONTENT
#undef DEFINED_CSS_PROP_CONTENT
#endif
#ifdef DEFINED_CSS_PROP_QUOTES
#undef CSS_PROP_QUOTES
#undef DEFINED_CSS_PROP_QUOTES
#endif
#ifdef DEFINED_CSS_PROP_USERINTERFACE
#undef CSS_PROP_USERINTERFACE
#undef DEFINED_CSS_PROP_USERINTERFACE
#endif
#ifdef DEFINED_CSS_PROP_UIRESET
#undef CSS_PROP_UIRESET
#undef DEFINED_CSS_PROP_UIRESET
#endif
#ifdef DEFINED_CSS_PROP_TABLE
#undef CSS_PROP_TABLE
#undef DEFINED_CSS_PROP_TABLE
#endif
#ifdef DEFINED_CSS_PROP_TABLEBORDER
#undef CSS_PROP_TABLEBORDER
#undef DEFINED_CSS_PROP_TABLEBORDER
#endif
#ifdef DEFINED_CSS_PROP_MARGIN
#undef CSS_PROP_MARGIN
#undef DEFINED_CSS_PROP_MARGIN
#endif
#ifdef DEFINED_CSS_PROP_PADDING
#undef CSS_PROP_PADDING
#undef DEFINED_CSS_PROP_PADDING
#endif
#ifdef DEFINED_CSS_PROP_BORDER
#undef CSS_PROP_BORDER
#undef DEFINED_CSS_PROP_BORDER
#endif
#ifdef DEFINED_CSS_PROP_OUTLINE
#undef CSS_PROP_OUTLINE
#undef DEFINED_CSS_PROP_OUTLINE
#endif
#ifdef DEFINED_CSS_PROP_XUL
#undef CSS_PROP_XUL
#undef DEFINED_CSS_PROP_XUL
#endif
#ifdef MOZ_SVG
#ifdef DEFINED_CSS_PROP_SVG
#undef CSS_PROP_SVG
#undef DEFINED_CSS_PROP_SVG
#endif
#endif /* defined(MOZ_SVG) */
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(USED_CSS_PROP) */
#ifdef DEFINED_CSS_PROP_NOTIMPLEMENTED
#undef CSS_PROP_NOTIMPLEMENTED
#undef DEFINED_CSS_PROP_NOTIMPLEMENTED
#endif
#ifdef DEFINED_CSS_PROP_SHORTHAND
#undef CSS_PROP_SHORTHAND
#undef DEFINED_CSS_PROP_SHORTHAND
#endif

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

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCSSProperty_h___
#define nsCSSProperty_h___
/*
Declare the enum list using the magic of preprocessing
enum values are "eCSSProperty_foo" (where foo is the property)
To change the list of properties, see nsCSSPropList.h
*/
enum nsCSSProperty {
eCSSProperty_UNKNOWN = -1,
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eCSSProperty_##id_,
#include "nsCSSPropList.h"
#undef CSS_PROP
eCSSProperty_COUNT_no_shorthands,
// Make the count continue where it left off:
eCSSProperty_COUNT_DUMMY = eCSSProperty_COUNT_no_shorthands - 1,
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) eCSSProperty_##id_,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
eCSSProperty_COUNT
};
// The types of values that can be in the nsCSS*/nsRuleData* structs.
// See nsCSSPropList.h for uses.
enum nsCSSType {
eCSSType_Value,
eCSSType_Rect,
eCSSType_ValueList,
eCSSType_CounterData,
eCSSType_Quotes,
eCSSType_Shadow
};
#endif /* nsCSSProperty_h___ */

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

@ -51,11 +51,14 @@
extern const char* const kCSSRawProperties[];
// define an array of all CSS properties
#define CSS_PROP(_name, _id, _method, _hint) #_name,
const char* const kCSSRawProperties[] = {
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) #name_,
#include "nsCSSPropList.h"
};
#undef CSS_PROP
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) #name_,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
};
static PRInt32 gTableRefCount;
@ -907,6 +910,9 @@ nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[])
}
}
// XXX TODO These table names should be additional parameters of the
// properties below in nsCSSPropList.h (and the two below should be like
// the rest).
const nsAFlatCString&
nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue)
{
@ -927,6 +933,15 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
switch (aProp) {
case eCSSProperty__moz_border_radius:
case eCSSProperty__moz_border_radius_topLeft:
case eCSSProperty__moz_border_radius_topRight:
case eCSSProperty__moz_border_radius_bottomLeft:
case eCSSProperty__moz_border_radius_bottomRight:
case eCSSProperty__moz_outline_radius:
case eCSSProperty__moz_outline_radius_topLeft:
case eCSSProperty__moz_outline_radius_topRight:
case eCSSProperty__moz_outline_radius_bottomLeft:
case eCSSProperty__moz_outline_radius_bottomRight:
break;
case eCSSProperty_appearance:
@ -985,6 +1000,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
return SearchKeywordTable(aValue, kBoxOrientKTable);
case eCSSProperty_box_pack:
return SearchKeywordTable(aValue, kBoxPackKTable);
case eCSSProperty_box_flex:
case eCSSProperty_box_ordinal_group:
break;
#ifdef MOZ_SVG
case eCSSProperty_fill:
@ -1015,6 +1033,10 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_border_left:
case eCSSProperty_border_right:
case eCSSProperty_border_top:
case eCSSProperty_border_bottom_colors:
case eCSSProperty_border_left_colors:
case eCSSProperty_border_right_colors:
case eCSSProperty_border_top_colors:
break;
case eCSSProperty_border_bottom_color:
@ -1048,10 +1070,6 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
return SearchKeywordTable(aValue, kClearKTable);
case eCSSProperty_clip:
case eCSSProperty_clip_bottom:
case eCSSProperty_clip_left:
case eCSSProperty_clip_right:
case eCSSProperty_clip_top:
case eCSSProperty_color:
break;
@ -1110,12 +1128,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_font_weight:
return SearchKeywordTable(aValue, kFontWeightKTable);
case eCSSProperty_force_broken_image_icon:
case eCSSProperty_height:
case eCSSProperty_image_region:
case eCSSProperty_image_region_top:
case eCSSProperty_image_region_left:
case eCSSProperty_image_region_bottom:
case eCSSProperty_image_region_right:
break;
case eCSSProperty_key_equivalent:
@ -1202,8 +1217,6 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
return SearchKeywordTable(aValue, kPositionKTable);
case eCSSProperty_quotes:
case eCSSProperty_quotes_close:
case eCSSProperty_quotes_open:
break;
case eCSSProperty_resizer:
@ -1249,10 +1262,6 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_text_indent:
case eCSSProperty_text_shadow:
case eCSSProperty_text_shadow_color:
case eCSSProperty_text_shadow_radius:
case eCSSProperty_text_shadow_x:
case eCSSProperty_text_shadow_y:
break;
case eCSSProperty_text_transform:
@ -1326,9 +1335,263 @@ PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr)
}
// define array of all CSS property hints
#define CSS_PROP(_name, _id, _method, _hint) _hint,
const nsChangeHint nsCSSProps::kHintTable[eCSSProperty_COUNT] = {
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) hint_,
#include "nsCSSPropList.h"
};
#undef CSS_PROP
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) hint_,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
};
// define array of all CSS property types
const nsCSSType nsCSSProps::kTypeTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) type_,
#include "nsCSSPropList.h"
#undef CSS_PROP
};
const nsStyleStructID nsCSSProps::kSIDTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Font,
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Color,
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Background,
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_List,
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Position,
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Text,
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_TextReset,
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Display,
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Visibility,
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Content,
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Quotes,
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_UserInterface,
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_UIReset,
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Table,
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_TableBorder,
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Margin,
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Padding,
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Border,
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_Outline,
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_XUL,
#ifdef MOZ_SVG
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) eStyleStruct_SVG,
#endif /* defined(MOZ_SVG) */
// This shouldn't matter, but we need something to go here.
#define CSS_PROP_BACKENDONLY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) nsStyleStructID(-1),
#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
#ifdef MOZ_SVG
#undef CSS_PROP_SVG
#endif /* undefd(MOZ_SVG) */
#undef CSS_PROP_BACKENDONLY
};
static const nsCSSProperty gMozBorderRadiusSubpropTable[] = {
// Code relies on these being in topleft-topright-bottomright-bottomleft
// order.
eCSSProperty__moz_border_radius_topLeft,
eCSSProperty__moz_border_radius_topRight,
eCSSProperty__moz_border_radius_bottomRight,
eCSSProperty__moz_border_radius_bottomLeft,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozOutlineRadiusSubpropTable[] = {
// Code relies on these being in topleft-topright-bottomright-bottomleft
// order.
eCSSProperty__moz_outline_radius_topLeft,
eCSSProperty__moz_outline_radius_topRight,
eCSSProperty__moz_outline_radius_bottomRight,
eCSSProperty__moz_outline_radius_bottomLeft,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBackgroundSubpropTable[] = {
eCSSProperty_background_color,
eCSSProperty_background_image,
eCSSProperty_background_repeat,
eCSSProperty_background_attachment,
eCSSProperty_background_x_position,
eCSSProperty_background_y_position,
eCSSProperty__moz_background_clip, // XXX Added LDB.
eCSSProperty__moz_background_origin, // XXX Added LDB.
eCSSProperty__moz_background_inline_policy, // XXX Added LDB.
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBackgroundPositionSubpropTable[] = {
eCSSProperty_background_x_position,
eCSSProperty_background_y_position,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderSubpropTable[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width,
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style,
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderBottomSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_bottom_width,
eCSSProperty_border_bottom_style,
eCSSProperty_border_bottom_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderLeftSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_left_width,
eCSSProperty_border_left_style,
eCSSProperty_border_left_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderRightSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_right_width,
eCSSProperty_border_right_style,
eCSSProperty_border_right_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderSpacingSubpropTable[] = {
eCSSProperty_border_x_spacing,
eCSSProperty_border_y_spacing,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderStyleSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderTopSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_top_width,
eCSSProperty_border_top_style,
eCSSProperty_border_top_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderWidthSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gCueSubpropTable[] = {
eCSSProperty_cue_after,
eCSSProperty_cue_before,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gFontSubpropTable[] = {
eCSSProperty_font_family,
eCSSProperty_font_style,
eCSSProperty_font_variant,
eCSSProperty_font_weight,
eCSSProperty_font_size,
eCSSProperty_line_height,
eCSSProperty_font_size_adjust, // XXX Added LDB.
eCSSProperty_font_stretch, // XXX Added LDB.
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gListStyleSubpropTable[] = {
eCSSProperty_list_style_type,
eCSSProperty_list_style_image,
eCSSProperty_list_style_position,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMarginSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_margin_top,
eCSSProperty_margin_right,
eCSSProperty_margin_bottom,
eCSSProperty_margin_left,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozOutlineSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty__moz_outline_color,
eCSSProperty__moz_outline_style,
eCSSProperty__moz_outline_width,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gPaddingSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_padding_top,
eCSSProperty_padding_right,
eCSSProperty_padding_bottom,
eCSSProperty_padding_left,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gPauseSubpropTable[] = {
eCSSProperty_pause_after,
eCSSProperty_pause_before,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gSizeSubpropTable[] = {
eCSSProperty_size_width,
eCSSProperty_size_height,
eCSSProperty_UNKNOWN
};
const nsCSSProperty *const
nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) g##method_##SubpropTable,
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
};

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

@ -40,22 +40,8 @@
#include "nsString.h"
#include "nsChangeHint.h"
/*
Declare the enum list using the magic of preprocessing
enum values are "eCSSProperty_foo" (where foo is the property)
To change the list of properties, see nsCSSPropList.h
*/
#define CSS_PROP(_name, _id, _method, _hint) eCSSProperty_##_id,
enum nsCSSProperty {
eCSSProperty_UNKNOWN = -1,
#include "nsCSSPropList.h"
eCSSProperty_COUNT
};
#undef CSS_PROP
#include "nsCSSProperty.h"
#include "nsStyleStruct.h"
class nsCSSProps {
public:
@ -66,6 +52,12 @@ public:
static nsCSSProperty LookupProperty(const nsAString& aProperty);
static nsCSSProperty LookupProperty(const nsACString& aProperty);
static inline PRBool IsShorthand(nsCSSProperty aProperty) {
NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT,
"out of range");
return (aProperty >= eCSSProperty_COUNT_no_shorthands);
}
// Given a property enum, get the string value
static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
@ -81,7 +73,29 @@ public:
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const nsChangeHint kHintTable[];
static const nsChangeHint kHintTable[eCSSProperty_COUNT];
static const nsCSSType kTypeTable[eCSSProperty_COUNT_no_shorthands];
static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands];
// A table for shorthand properties. The appropriate index is the
// property ID minus eCSSProperty_COUNT_no_shorthands.
private:
static const nsCSSProperty *const
kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands];
public:
static inline
const nsCSSProperty *const SubpropertyEntryFor(nsCSSProperty aProperty) {
NS_ASSERTION(eCSSProperty_COUNT_no_shorthands <= aProperty &&
aProperty < eCSSProperty_COUNT,
"out of range");
return nsCSSProps::kSubpropertyTable[aProperty -
eCSSProperty_COUNT_no_shorthands];
}
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(iter_, prop_) \
for (const nsCSSProperty* iter_ = nsCSSProps::SubpropertyEntryFor(prop_); \
*iter_ != eCSSProperty_UNKNOWN; ++iter_)
// Keyword/Enum value tables
static const PRInt32 kAppearanceKTable[];

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

@ -52,25 +52,6 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
static NS_DEFINE_IID(kCSSFontSID, NS_CSS_FONT_SID);
static NS_DEFINE_IID(kCSSColorSID, NS_CSS_COLOR_SID);
static NS_DEFINE_IID(kCSSDisplaySID, NS_CSS_DISPLAY_SID);
static NS_DEFINE_IID(kCSSTextSID, NS_CSS_TEXT_SID);
static NS_DEFINE_IID(kCSSMarginSID, NS_CSS_MARGIN_SID);
static NS_DEFINE_IID(kCSSPositionSID, NS_CSS_POSITION_SID);
static NS_DEFINE_IID(kCSSListSID, NS_CSS_LIST_SID);
static NS_DEFINE_IID(kCSSTableSID, NS_CSS_TABLE_SID);
static NS_DEFINE_IID(kCSSBreaksSID, NS_CSS_BREAKS_SID);
static NS_DEFINE_IID(kCSSPageSID, NS_CSS_PAGE_SID);
static NS_DEFINE_IID(kCSSContentSID, NS_CSS_CONTENT_SID);
static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID);
static NS_DEFINE_IID(kCSSAuralSID, NS_CSS_AURAL_SID);
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#ifdef MOZ_SVG
static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID);
#endif
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }
// --- nsCSSFont -----------------
@ -97,11 +78,6 @@ nsCSSFont::~nsCSSFont(void)
MOZ_COUNT_DTOR(nsCSSFont);
}
const nsID& nsCSSFont::GetID(void)
{
return kCSSFontSID;
}
#ifdef DEBUG
void nsCSSFont::List(FILE* out, PRInt32 aIndent) const
{
@ -174,11 +150,6 @@ nsCSSColor::~nsCSSColor(void)
MOZ_COUNT_DTOR(nsCSSColor);
}
const nsID& nsCSSColor::GetID(void)
{
return kCSSColorSID;
}
#ifdef DEBUG
void nsCSSColor::List(FILE* out, PRInt32 aIndent) const
{
@ -255,11 +226,6 @@ nsCSSText::~nsCSSText(void)
CSS_IF_DELETE(mTextShadow);
}
const nsID& nsCSSText::GetID(void)
{
return kCSSTextSID;
}
#ifdef DEBUG
void nsCSSText::List(FILE* out, PRInt32 aIndent) const
{
@ -277,11 +243,12 @@ void nsCSSText::List(FILE* out, PRInt32 aIndent) const
if (nsnull != mTextShadow) {
if (mTextShadow->mXOffset.IsLengthUnit()) {
nsCSSShadow* shadow = mTextShadow;
// XXX This prints the property name many times, but nobody cares.
while (nsnull != shadow) {
shadow->mColor.AppendToString(buffer, eCSSProperty_text_shadow_color);
shadow->mXOffset.AppendToString(buffer, eCSSProperty_text_shadow_x);
shadow->mYOffset.AppendToString(buffer, eCSSProperty_text_shadow_y);
shadow->mRadius.AppendToString(buffer, eCSSProperty_text_shadow_radius);
shadow->mColor.AppendToString(buffer, eCSSProperty_text_shadow);
shadow->mXOffset.AppendToString(buffer, eCSSProperty_text_shadow);
shadow->mYOffset.AppendToString(buffer, eCSSProperty_text_shadow);
shadow->mRadius.AppendToString(buffer, eCSSProperty_text_shadow);
shadow = shadow->mNext;
}
}
@ -317,6 +284,24 @@ nsCSSRect::~nsCSSRect()
MOZ_COUNT_DTOR(nsCSSRect);
}
void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue)
{
mTop = aValue;
mRight = aValue;
mBottom = aValue;
mLeft = aValue;
}
#if (NS_SIDE_TOP != 0) || (NS_SIDE_RIGHT != 1) || (NS_SIDE_BOTTOM != 2) || (NS_SIDE_LEFT != 3)
#error "Somebody changed the side constants."
#endif
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft,
};
#ifdef DEBUG
void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const
@ -368,10 +353,98 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co
}
#endif
// --- nsCSSValueListRect -----------------
MOZ_DECL_CTOR_COUNTER(nsCSSValueListRect)
nsCSSValueListRect::nsCSSValueListRect(void)
: mTop(nsnull),
mRight(nsnull),
mBottom(nsnull),
mLeft(nsnull)
{
MOZ_COUNT_CTOR(nsCSSValueListRect);
}
nsCSSValueListRect::nsCSSValueListRect(const nsCSSValueListRect& aCopy)
: mTop(aCopy.mTop),
mRight(aCopy.mRight),
mBottom(aCopy.mBottom),
mLeft(aCopy.mLeft)
{
MOZ_COUNT_CTOR(nsCSSValueListRect);
}
nsCSSValueListRect::~nsCSSValueListRect()
{
MOZ_COUNT_DTOR(nsCSSValueListRect);
}
/* static */ const nsCSSValueListRect::side_type
nsCSSValueListRect::sides[4] = {
&nsCSSValueListRect::mTop,
&nsCSSValueListRect::mRight,
&nsCSSValueListRect::mBottom,
&nsCSSValueListRect::mLeft,
};
#ifdef DEBUG
void nsCSSValueListRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const
{
#if 0
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
if (eCSSProperty_UNKNOWN < aPropID) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID).get());
buffer.Append(NS_LITERAL_STRING(": "));
}
mTop.AppendToString(buffer);
mRight.AppendToString(buffer);
mBottom.AppendToString(buffer);
mLeft.AppendToString(buffer);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
#endif
}
void nsCSSValueListRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const
{
#if 0
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
if (eCSSUnit_Null != mTop.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mTop.AppendToString(buffer);
}
if (eCSSUnit_Null != mRight.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mRight.AppendToString(buffer);
}
if (eCSSUnit_Null != mBottom.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mBottom.AppendToString(buffer);
}
if (eCSSUnit_Null != mLeft.GetUnit()) {
buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3]).get());
buffer.Append(NS_LITERAL_STRING(": "));
mLeft.AppendToString(buffer);
}
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
#endif
}
#endif
// --- nsCSSDisplay -----------------
nsCSSDisplay::nsCSSDisplay(void)
: mClip(nsnull)
{
MOZ_COUNT_CTOR(nsCSSDisplay);
}
@ -383,7 +456,7 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mPosition(aCopy.mPosition),
mFloat(aCopy.mFloat),
mClear(aCopy.mClear),
mClip(nsnull),
mClip(aCopy.mClip),
mOverflow(aCopy.mOverflow),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
@ -393,18 +466,11 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
// end temp
{
MOZ_COUNT_CTOR(nsCSSDisplay);
CSS_IF_COPY(mClip, nsCSSRect);
}
nsCSSDisplay::~nsCSSDisplay(void)
{
MOZ_COUNT_DTOR(nsCSSDisplay);
CSS_IF_DELETE(mClip);
}
const nsID& nsCSSDisplay::GetID(void)
{
return kCSSDisplaySID;
}
#ifdef DEBUG
@ -425,9 +491,7 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
mOpacity.AppendToString(buffer, eCSSProperty_opacity);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
if (nsnull != mClip) {
mClip->List(out, eCSSProperty_clip);
}
mClip.List(out, eCSSProperty_clip);
buffer.SetLength(0);
mOverflow.AppendToString(buffer, eCSSProperty_overflow);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
@ -436,115 +500,73 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
// --- nsCSSMargin -----------------
void nsCSSMargin::EnsureBorderColors()
{
if (!mBorderColors) {
PRInt32 i;
mBorderColors = new nsCSSValueList*[4];
for (i = 0; i < 4; i++)
mBorderColors[i] = nsnull;
}
}
nsCSSMargin::nsCSSMargin(void)
: mMargin(nsnull), mPadding(nsnull),
mBorderWidth(nsnull), mBorderColor(nsnull), mBorderColors(nsnull),
mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull)
{
MOZ_COUNT_CTOR(nsCSSMargin);
}
nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy)
: mMargin(nsnull), mPadding(nsnull),
mBorderWidth(nsnull), mBorderColor(nsnull), mBorderColors(nsnull),
mBorderStyle(nsnull), mBorderRadius(nsnull),
: mMargin(aCopy.mMargin),
mPadding(aCopy.mPadding),
mBorderWidth(aCopy.mBorderWidth),
mBorderColor(aCopy.mBorderColor),
mBorderColors(aCopy.mBorderColors),
mBorderStyle(aCopy.mBorderStyle),
mBorderRadius(aCopy.mBorderRadius),
mOutlineWidth(aCopy.mOutlineWidth),
mOutlineColor(aCopy.mOutlineColor),
mOutlineStyle(aCopy.mOutlineStyle),
mOutlineRadius(nsnull),
mOutlineRadius(aCopy.mOutlineRadius),
mFloatEdge(aCopy.mFloatEdge)
{
MOZ_COUNT_CTOR(nsCSSMargin);
CSS_IF_COPY(mMargin, nsCSSRect);
CSS_IF_COPY(mPadding, nsCSSRect);
CSS_IF_COPY(mBorderWidth, nsCSSRect);
CSS_IF_COPY(mBorderColor, nsCSSRect);
CSS_IF_COPY(mBorderStyle, nsCSSRect);
CSS_IF_COPY(mBorderRadius, nsCSSRect);
CSS_IF_COPY(mOutlineRadius, nsCSSRect);
if (aCopy.mBorderColors) {
EnsureBorderColors();
for (PRInt32 i = 0; i < 4; i++)
CSS_IF_COPY(mBorderColors[i], nsCSSValueList);
}
}
nsCSSMargin::~nsCSSMargin(void)
{
MOZ_COUNT_DTOR(nsCSSMargin);
CSS_IF_DELETE(mMargin);
CSS_IF_DELETE(mPadding);
CSS_IF_DELETE(mBorderWidth);
CSS_IF_DELETE(mBorderColor);
CSS_IF_DELETE(mBorderStyle);
CSS_IF_DELETE(mBorderRadius);
CSS_IF_DELETE(mOutlineRadius);
if (mBorderColors) {
for (PRInt32 i = 0; i < 4; i++)
CSS_IF_DELETE(mBorderColors[i]);
delete []mBorderColors;
}
}
const nsID& nsCSSMargin::GetID(void)
{
return kCSSMarginSID;
}
#ifdef DEBUG
void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
{
if (nsnull != mMargin) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty_margin_top,
eCSSProperty_margin_right,
eCSSProperty_margin_bottom,
eCSSProperty_margin_left
};
mMargin->List(out, aIndent, trbl);
mMargin.List(out, aIndent, trbl);
}
if (nsnull != mPadding) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty_padding_top,
eCSSProperty_padding_right,
eCSSProperty_padding_bottom,
eCSSProperty_padding_left
};
mPadding->List(out, aIndent, trbl);
mPadding.List(out, aIndent, trbl);
}
if (nsnull != mBorderWidth) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width
};
mBorderWidth->List(out, aIndent, trbl);
mBorderWidth.List(out, aIndent, trbl);
}
if (nsnull != mBorderColor) {
mBorderColor->List(out, eCSSProperty_border_color, aIndent);
}
if (nsnull != mBorderStyle) {
mBorderStyle->List(out, eCSSProperty_border_style, aIndent);
}
if (nsnull != mBorderRadius) {
mBorderColor.List(out, eCSSProperty_border_color, aIndent);
mBorderStyle.List(out, eCSSProperty_border_style, aIndent);
{
static const nsCSSProperty trbl[] = {
eCSSProperty__moz_border_radius_topLeft,
eCSSProperty__moz_border_radius_topRight,
eCSSProperty__moz_border_radius_bottomRight,
eCSSProperty__moz_border_radius_bottomLeft
};
mBorderRadius->List(out, aIndent, trbl);
mBorderRadius.List(out, aIndent, trbl);
}
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
@ -553,14 +575,14 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
mOutlineWidth.AppendToString(buffer, eCSSProperty__moz_outline_width);
mOutlineColor.AppendToString(buffer, eCSSProperty__moz_outline_color);
mOutlineStyle.AppendToString(buffer, eCSSProperty__moz_outline_style);
if (nsnull != mOutlineRadius) {
{
static const nsCSSProperty trbl[] = {
eCSSProperty__moz_outline_radius_topLeft,
eCSSProperty__moz_outline_radius_topRight,
eCSSProperty__moz_outline_radius_bottomRight,
eCSSProperty__moz_outline_radius_bottomLeft
};
mOutlineRadius->List(out, aIndent, trbl);
mOutlineRadius.List(out, aIndent, trbl);
}
mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
@ -570,7 +592,6 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
// --- nsCSSPosition -----------------
nsCSSPosition::nsCSSPosition(void)
: mOffset(nsnull)
{
MOZ_COUNT_CTOR(nsCSSPosition);
}
@ -583,22 +604,15 @@ nsCSSPosition::nsCSSPosition(const nsCSSPosition& aCopy)
mMinHeight(aCopy.mMinHeight),
mMaxHeight(aCopy.mMaxHeight),
mBoxSizing(aCopy.mBoxSizing),
mOffset(nsnull),
mOffset(aCopy.mOffset),
mZIndex(aCopy.mZIndex)
{
MOZ_COUNT_CTOR(nsCSSPosition);
CSS_IF_COPY(mOffset, nsCSSRect);
}
nsCSSPosition::~nsCSSPosition(void)
{
MOZ_COUNT_DTOR(nsCSSPosition);
CSS_IF_DELETE(mOffset);
}
const nsID& nsCSSPosition::GetID(void)
{
return kCSSPositionSID;
}
#ifdef DEBUG
@ -618,22 +632,19 @@ void nsCSSPosition::List(FILE* out, PRInt32 aIndent) const
mZIndex.AppendToString(buffer, eCSSProperty_z_index);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
if (nsnull != mOffset) {
static const nsCSSProperty trbl[] = {
eCSSProperty_top,
eCSSProperty_right,
eCSSProperty_bottom,
eCSSProperty_left
};
mOffset->List(out, aIndent, trbl);
}
mOffset.List(out, aIndent, trbl);
}
#endif
// --- nsCSSList -----------------
nsCSSList::nsCSSList(void)
:mImageRegion(nsnull)
{
MOZ_COUNT_CTOR(nsCSSList);
}
@ -642,21 +653,14 @@ nsCSSList::nsCSSList(const nsCSSList& aCopy)
: mType(aCopy.mType),
mImage(aCopy.mImage),
mPosition(aCopy.mPosition),
mImageRegion(nsnull)
mImageRegion(aCopy.mImageRegion)
{
MOZ_COUNT_CTOR(nsCSSList);
CSS_IF_COPY(mImageRegion, nsCSSRect);
}
nsCSSList::~nsCSSList(void)
{
MOZ_COUNT_DTOR(nsCSSList);
CSS_IF_DELETE(mImageRegion);
}
const nsID& nsCSSList::GetID(void)
{
return kCSSListSID;
}
#ifdef DEBUG
@ -671,15 +675,13 @@ void nsCSSList::List(FILE* out, PRInt32 aIndent) const
mPosition.AppendToString(buffer, eCSSProperty_list_style_position);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
if (mImageRegion) {
static const nsCSSProperty trbl[] = {
eCSSProperty_top,
eCSSProperty_right,
eCSSProperty_bottom,
eCSSProperty_left
};
mImageRegion->List(out, aIndent, trbl);
}
mImageRegion.List(out, aIndent, trbl);
}
#endif
@ -706,11 +708,6 @@ nsCSSTable::~nsCSSTable(void)
MOZ_COUNT_DTOR(nsCSSTable);
}
const nsID& nsCSSTable::GetID(void)
{
return kCSSTableSID;
}
#ifdef DEBUG
void nsCSSTable::List(FILE* out, PRInt32 aIndent) const
{
@ -740,8 +737,9 @@ nsCSSBreaks::nsCSSBreaks(const nsCSSBreaks& aCopy)
: mOrphans(aCopy.mOrphans),
mWidows(aCopy.mWidows),
mPage(aCopy.mPage),
mPageBreakAfter(aCopy.mPageBreakAfter),
mPageBreakBefore(aCopy.mPageBreakBefore),
// temp fix for bug 24000
//mPageBreakAfter(aCopy.mPageBreakAfter),
//mPageBreakBefore(aCopy.mPageBreakBefore),
mPageBreakInside(aCopy.mPageBreakInside)
{
MOZ_COUNT_CTOR(nsCSSBreaks);
@ -752,11 +750,6 @@ nsCSSBreaks::~nsCSSBreaks(void)
MOZ_COUNT_DTOR(nsCSSBreaks);
}
const nsID& nsCSSBreaks::GetID(void)
{
return kCSSBreaksSID;
}
#ifdef DEBUG
void nsCSSBreaks::List(FILE* out, PRInt32 aIndent) const
{
@ -767,8 +760,9 @@ void nsCSSBreaks::List(FILE* out, PRInt32 aIndent) const
mOrphans.AppendToString(buffer, eCSSProperty_orphans);
mWidows.AppendToString(buffer, eCSSProperty_widows);
mPage.AppendToString(buffer, eCSSProperty_page);
mPageBreakAfter.AppendToString(buffer, eCSSProperty_page_break_after);
mPageBreakBefore.AppendToString(buffer, eCSSProperty_page_break_before);
// temp fix for bug 24000
//mPageBreakAfter.AppendToString(buffer, eCSSProperty_page_break_after);
//mPageBreakBefore.AppendToString(buffer, eCSSProperty_page_break_before);
mPageBreakInside.AppendToString(buffer, eCSSProperty_page_break_inside);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
@ -795,11 +789,6 @@ nsCSSPage::~nsCSSPage(void)
MOZ_COUNT_DTOR(nsCSSPage);
}
const nsID& nsCSSPage::GetID(void)
{
return kCSSPageSID;
}
#ifdef DEBUG
void nsCSSPage::List(FILE* out, PRInt32 aIndent) const
{
@ -893,11 +882,6 @@ nsCSSContent::~nsCSSContent(void)
CSS_IF_DELETE(mQuotes);
}
const nsID& nsCSSContent::GetID(void)
{
return kCSSContentSID;
}
#ifdef DEBUG
void nsCSSContent::List(FILE* out, PRInt32 aIndent) const
{
@ -923,10 +907,11 @@ void nsCSSContent::List(FILE* out, PRInt32 aIndent) const
counter = counter->mNext;
}
mMarkerOffset.AppendToString(buffer, eCSSProperty_marker_offset);
// XXX This prints the property name many times, but nobody cares.
nsCSSQuotes* quotes = mQuotes;
while (nsnull != quotes) {
quotes->mOpen.AppendToString(buffer, eCSSProperty_quotes_open);
quotes->mClose.AppendToString(buffer, eCSSProperty_quotes_close);
quotes->mOpen.AppendToString(buffer, eCSSProperty_quotes);
quotes->mClose.AppendToString(buffer, eCSSProperty_quotes);
quotes = quotes->mNext;
}
@ -964,11 +949,6 @@ nsCSSUserInterface::~nsCSSUserInterface(void)
CSS_IF_DELETE(mCursor);
}
const nsID& nsCSSUserInterface::GetID(void)
{
return kCSSUserInterfaceSID;
}
#ifdef DEBUG
void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const
{
@ -1035,11 +1015,6 @@ nsCSSAural::~nsCSSAural(void)
MOZ_COUNT_DTOR(nsCSSAural);
}
const nsID& nsCSSAural::GetID(void)
{
return kCSSAuralSID;
}
#ifdef DEBUG
void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
{
@ -1091,11 +1066,6 @@ nsCSSXUL::~nsCSSXUL(void)
MOZ_COUNT_DTOR(nsCSSXUL);
}
const nsID& nsCSSXUL::GetID(void)
{
return kCSSXULSID;
}
#ifdef DEBUG
void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
{
@ -1142,11 +1112,6 @@ nsCSSSVG::~nsCSSSVG(void)
MOZ_COUNT_DTOR(nsCSSSVG);
}
const nsID& nsCSSSVG::GetID(void)
{
return kCSSSVGSID;
}
#ifdef DEBUG
void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const
{
@ -1170,4 +1135,3 @@ void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const
#endif
#endif // MOZ_SVG

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

@ -39,92 +39,27 @@
#ifndef nsCSSStruct_h___
#define nsCSSStruct_h___
#include "nsISupports.h"
#include "nsColor.h"
#include <stdio.h>
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSValue.h"
#include <stdio.h>
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.
// We use the nsCSS* structures for storing nsCSSDeclaration's
// *temporary* data during parsing and modification. (They are too big
// for permanent storage.) We also use them for nsRuleData, with some
// additions of things that the style system must cascade, but that
// aren't CSS properties. Thus we 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 \
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_COLOR_SID \
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_TEXT_SID \
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_DISPLAY_SID \
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_MARGIN_SID \
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_POSITION_SID \
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
#define NS_CSS_LIST_SID \
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_TABLE_SID \
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_BREAKS_SID \
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_PAGE_SID \
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_CONTENT_SID \
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
#define NS_CSS_USER_INTERFACE_SID \
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_AURAL_SID \
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
#define NS_CSS_XUL_SID \
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
#ifdef MOZ_SVG
// {9A41A036-027B-45ef-89C9-6E32797839E7}
#define NS_CSS_SVG_SID \
{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } }
#endif
struct nsCSSFont : public nsCSSStruct {
nsCSSFont(void);
nsCSSFont(const nsCSSFont& aCopy);
~nsCSSFont(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -155,7 +90,6 @@ struct nsCSSColor : public nsCSSStruct {
nsCSSColor(void);
nsCSSColor(const nsCSSColor& aCopy);
~nsCSSColor(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -192,7 +126,6 @@ struct nsCSSText : public nsCSSStruct {
nsCSSText(const nsCSSText& aCopy);
~nsCSSText(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -213,6 +146,8 @@ struct nsCSSText : public nsCSSStruct {
struct nsRuleDataText : public nsCSSText {
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
@ -222,10 +157,47 @@ struct nsCSSRect {
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
#endif
PRBool operator==(const nsCSSRect& aOther) const {
return mTop == aOther.mTop &&
mRight == aOther.mRight &&
mBottom == aOther.mBottom &&
mLeft == aOther.mLeft;
}
PRBool operator!=(const nsCSSRect& aOther) const {
return mTop != aOther.mTop ||
mRight != aOther.mRight ||
mBottom != aOther.mBottom ||
mLeft != aOther.mLeft;
}
void SetAllSidesTo(const nsCSSValue& aValue);
nsCSSValue mTop;
nsCSSValue mRight;
nsCSSValue mBottom;
nsCSSValue mLeft;
typedef nsCSSValue nsCSSRect::*side_type;
static const side_type sides[4];
};
struct nsCSSValueListRect {
nsCSSValueListRect(void);
nsCSSValueListRect(const nsCSSValueListRect& aCopy);
~nsCSSValueListRect();
#ifdef DEBUG
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
#endif
nsCSSValueList* mTop;
nsCSSValueList* mRight;
nsCSSValueList* mBottom;
nsCSSValueList* mLeft;
typedef nsCSSValueList* nsCSSValueListRect::*side_type;
static const side_type sides[4];
};
struct nsCSSDisplay : public nsCSSStruct {
@ -233,7 +205,6 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSDisplay(const nsCSSDisplay& aCopy);
~nsCSSDisplay(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -245,7 +216,7 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mPosition;
nsCSSValue mFloat;
nsCSSValue mClear;
nsCSSRect* mClip;
nsCSSRect mClip;
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
@ -265,24 +236,21 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(const nsCSSMargin& aCopy);
~nsCSSMargin(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
void EnsureBorderColors();
nsCSSRect* mMargin;
nsCSSRect* mPadding;
nsCSSRect* mBorderWidth;
nsCSSRect* mBorderColor;
nsCSSValueList** mBorderColors;
nsCSSRect* mBorderStyle;
nsCSSRect* mBorderRadius; // (extension)
nsCSSRect mMargin;
nsCSSRect mPadding;
nsCSSRect mBorderWidth;
nsCSSRect mBorderColor;
nsCSSValueListRect mBorderColors;
nsCSSRect mBorderStyle;
nsCSSRect mBorderRadius; // (extension)
nsCSSValue mOutlineWidth;
nsCSSValue mOutlineColor;
nsCSSValue mOutlineStyle;
nsCSSRect* mOutlineRadius; // (extension)
nsCSSRect mOutlineRadius; // (extension)
nsCSSValue mFloatEdge; // NEW
};
@ -294,7 +262,6 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(const nsCSSPosition& aCopy);
~nsCSSPosition(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -306,7 +273,7 @@ struct nsCSSPosition : public nsCSSStruct {
nsCSSValue mMinHeight;
nsCSSValue mMaxHeight;
nsCSSValue mBoxSizing; // NEW
nsCSSRect* mOffset;
nsCSSRect mOffset;
nsCSSValue mZIndex;
};
@ -318,7 +285,6 @@ struct nsCSSList : public nsCSSStruct {
nsCSSList(const nsCSSList& aCopy);
~nsCSSList(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -326,7 +292,7 @@ struct nsCSSList : public nsCSSStruct {
nsCSSValue mType;
nsCSSValue mImage;
nsCSSValue mPosition;
nsCSSRect* mImageRegion;
nsCSSRect mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
@ -337,7 +303,6 @@ struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(const nsCSSTable& aCopy);
~nsCSSTable(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -363,7 +328,6 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(const nsCSSBreaks& aCopy);
~nsCSSBreaks(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -371,8 +335,9 @@ struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSValue mOrphans;
nsCSSValue mWidows;
nsCSSValue mPage;
nsCSSValue mPageBreakAfter;
nsCSSValue mPageBreakBefore;
// temp fix for bug 24000
//nsCSSValue mPageBreakAfter;
//nsCSSValue mPageBreakBefore;
nsCSSValue mPageBreakInside;
};
@ -384,7 +349,6 @@ struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(const nsCSSPage& aCopy);
~nsCSSPage(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -422,7 +386,6 @@ struct nsCSSContent : public nsCSSStruct {
nsCSSContent(const nsCSSContent& aCopy);
~nsCSSContent(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -442,7 +405,6 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
~nsCSSUserInterface(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -466,7 +428,6 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(const nsCSSAural& aCopy);
~nsCSSAural(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -500,7 +461,6 @@ struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(const nsCSSXUL& aCopy);
~nsCSSXUL(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -522,7 +482,6 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSSVG(const nsCSSSVG& aCopy);
~nsCSSSVG(void);
const nsID& GetID(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
@ -544,57 +503,4 @@ struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
//
// Some useful types.
//
typedef PRUint16 nsCSSBitField;
typedef PRUint16 nsCSSDeclRefCount;
struct nsCSSDeclContains
{
nsCSSBitField mHasDisplay:1; // 1
nsCSSBitField mHasText:1; // 2
nsCSSBitField mHasColor:1; // 3
nsCSSBitField mHasMargin:1; // 4
nsCSSBitField mHasList:1; // 4
nsCSSBitField mHasFont:1; // 5
nsCSSBitField mHasPosition:1; // 6
nsCSSBitField mHasUserInterface:1; // 8
nsCSSBitField mHasTable:1; // 9
nsCSSBitField mHasContent:1; // 10
nsCSSBitField mHasXUL:1; // 11
nsCSSBitField mHasBreaks:1; // 12
nsCSSBitField mHasPage:1; // 13
nsCSSBitField mHasAural:1; // 14
#if defined(MOZ_SVG)
nsCSSBitField mHasSVG:1; // 15
#endif
};
//
// Macros used to figure out at what index the pointer to the object is.
// These macros have been placed in the order of what is considered most
// created nsCSSStruct first, such that "less math for most likely" will
// lend itself to the speed of the index lookup calculation.
// I have also ordered the bit fields, in case the compiler can come up
// with an optimization if the ordering would matter.
// Presence (mContains.mHasWhatever) is NOT tested for, so do that yourself.
//
#define CSSDECLIDX_Display(decl) ((decl).mContains.mHasDisplay - 1)
#define CSSDECLIDX_Text(decl) ((decl).mContains.mHasText + CSSDECLIDX_Display(decl))
#define CSSDECLIDX_Color(decl) ((decl).mContains.mHasColor + CSSDECLIDX_Text(decl))
#define CSSDECLIDX_Margin(decl) ((decl).mContains.mHasMargin + CSSDECLIDX_Color(decl))
#define CSSDECLIDX_List(decl) ((decl).mContains.mHasList + CSSDECLIDX_Margin(decl))
#define CSSDECLIDX_Font(decl) ((decl).mContains.mHasFont + CSSDECLIDX_List(decl))
#define CSSDECLIDX_Position(decl) ((decl).mContains.mHasPosition + CSSDECLIDX_Font(decl))
#define CSSDECLIDX_UserInterface(decl) ((decl).mContains.mHasUserInterface + CSSDECLIDX_Position(decl))
#define CSSDECLIDX_Table(decl) ((decl).mContains.mHasTable + CSSDECLIDX_UserInterface(decl))
#define CSSDECLIDX_Content(decl) ((decl).mContains.mHasContent + CSSDECLIDX_Table(decl))
#define CSSDECLIDX_XUL(decl) ((decl).mContains.mHasXUL + CSSDECLIDX_Content(decl))
#define CSSDECLIDX_Breaks(decl) ((decl).mContains.mHasBreaks + CSSDECLIDX_XUL(decl))
#define CSSDECLIDX_Page(decl) ((decl).mContains.mHasPage + CSSDECLIDX_Breaks(decl))
#define CSSDECLIDX_Aural(decl) ((decl).mContains.mHasAural + CSSDECLIDX_Page(decl))
#if defined(MOZ_SVG)
#define CSSDECLIDX_SVG(decl) ((decl).mContains.mHasSVG + CSSDECLIDX_Aural(decl))
#endif
#endif /* nsCSSStruct_h___ */

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

@ -74,25 +74,6 @@
#include "nsContentUtils.h"
#include "nsContentErrors.h"
// #define DEBUG_REFS
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCSSFontSID, NS_CSS_FONT_SID);
static NS_DEFINE_IID(kCSSColorSID, NS_CSS_COLOR_SID);
static NS_DEFINE_IID(kCSSTextSID, NS_CSS_TEXT_SID);
static NS_DEFINE_IID(kCSSMarginSID, NS_CSS_MARGIN_SID);
static NS_DEFINE_IID(kCSSPositionSID, NS_CSS_POSITION_SID);
static NS_DEFINE_IID(kCSSListSID, NS_CSS_LIST_SID);
static NS_DEFINE_IID(kCSSDisplaySID, NS_CSS_DISPLAY_SID);
static NS_DEFINE_IID(kCSSTableSID, NS_CSS_TABLE_SID);
static NS_DEFINE_IID(kCSSContentSID, NS_CSS_CONTENT_SID);
static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID);
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#ifdef MOZ_SVG
static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID);
#endif
// -- nsCSSSelector -------------------------------
#define NS_IF_COPY(dest,source,type) \
@ -213,10 +194,6 @@ PRBool nsAtomStringList::Equals(const nsAtomStringList* aOther) const
MOZ_DECL_CTOR_COUNTER(nsAttrSelector)
#ifdef DEBUG_REFS
PRUint32 gAttrSelectorCount=0;
#endif
nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr)
: mNameSpace(aNameSpace),
mAttr(nsnull),
@ -227,11 +204,6 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr)
{
MOZ_COUNT_CTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
#endif
mAttr = NS_NewAtom(aAttr);
}
@ -246,11 +218,6 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint
{
MOZ_COUNT_CTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount);
#endif
mAttr = NS_NewAtom(aAttr);
}
@ -264,11 +231,6 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy)
{
MOZ_COUNT_CTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount++;
printf( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount);
#endif
NS_IF_ADDREF(mAttr);
NS_IF_COPY(mNext, aCopy.mNext, nsAttrSelector);
}
@ -277,11 +239,6 @@ nsAttrSelector::~nsAttrSelector(void)
{
MOZ_COUNT_DTOR(nsAttrSelector);
#ifdef DEBUG_REFS
gAttrSelectorCount--;
printf( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount);
#endif
NS_IF_RELEASE(mAttr);
NS_IF_DELETE(mNext);
}
@ -308,10 +265,6 @@ PRBool nsAttrSelector::Equals(const nsAttrSelector* aOther) const
MOZ_DECL_CTOR_COUNTER(nsCSSSelector)
#ifdef DEBUG_REFS
PRUint32 gSelectorCount=0;
#endif
nsCSSSelector::nsCSSSelector(void)
: mNameSpace(kNameSpaceID_Unknown), mTag(nsnull),
mIDList(nsnull),
@ -323,11 +276,6 @@ nsCSSSelector::nsCSSSelector(void)
mNext(nsnull)
{
MOZ_COUNT_CTOR(nsCSSSelector);
#ifdef DEBUG_REFS
gSelectorCount++;
printf( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount);
#endif
}
nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy)
@ -346,22 +294,12 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy)
NS_IF_COPY(mPseudoClassList, aCopy.mPseudoClassList, nsAtomStringList);
NS_IF_COPY(mAttrList, aCopy.mAttrList, nsAttrSelector);
NS_IF_COPY(mNegations, aCopy.mNegations, nsCSSSelector);
#ifdef DEBUG_REFS
gSelectorCount++;
printf( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount);
#endif
}
nsCSSSelector::~nsCSSSelector(void)
{
MOZ_COUNT_DTOR(nsCSSSelector);
Reset();
#ifdef DEBUG_REFS
gSelectorCount--;
printf( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount);
#endif
}
nsCSSSelector& nsCSSSelector::operator=(const nsCSSSelector& aCopy)
@ -761,24 +699,6 @@ nsresult nsCSSSelector::ToString( nsAString& aString, nsICSSStyleSheet* aSheet,
// -- CSSImportantRule -------------------------------
// New map helpers shared by both important and regular rules.
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);
static nsresult MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL);
#ifdef MOZ_SVG
static nsresult MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG);
#endif
class CSSStyleRuleImpl;
class CSSImportantRule : public nsIStyleRule {
@ -829,37 +749,7 @@ CSSImportantRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
NS_IMETHODIMP
CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (!aRuleData)
return NS_OK;
if (aRuleData->mFontData)
return MapFontForDeclaration(mDeclaration, *aRuleData->mFontData);
else if (aRuleData->mDisplayData)
return MapDisplayForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mDisplayData);
else if (aRuleData->mColorData)
return MapColorForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mColorData);
else if (aRuleData->mMarginData)
return MapMarginForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mMarginData);
else if (aRuleData->mListData)
return MapListForDeclaration(mDeclaration, *aRuleData->mListData);
else if (aRuleData->mPositionData)
return MapPositionForDeclaration(mDeclaration, *aRuleData->mPositionData);
else if (aRuleData->mTableData)
return MapTableForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTableData);
else if (aRuleData->mContentData)
return MapContentForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mContentData);
else if (aRuleData->mTextData)
return MapTextForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTextData);
else if (aRuleData->mUIData)
return MapUIForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mUIData);
else if (aRuleData->mXULData)
return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData);
#ifdef MOZ_SVG
else if (aRuleData->mSVGData)
return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData);
#endif
return NS_OK;
return mDeclaration->MapImportantRuleInfoInto(aRuleData);
}
#ifdef DEBUG
@ -953,14 +843,12 @@ DOMCSSDeclarationImpl::RemoveProperty(const nsAString& aPropertyName,
owningDoc->BeginUpdate();
}
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
nsCSSValue val;
rv = decl->RemoveProperty(prop, val);
decl->GetValue(prop, aReturn);
rv = decl->RemoveProperty(prop);
if (NS_SUCCEEDED(rv)) {
// We pass in eCSSProperty_UNKNOWN here so that we don't get the
// property name in the return string.
val.ToString(aReturn, eCSSProperty_UNKNOWN);
if (cssSheet) {
cssSheet->SetModified(PR_TRUE);
}
@ -1112,26 +1000,10 @@ DOMCSSDeclarationImpl::ParseDeclaration(const nsAString& aDecl,
getter_AddRefs(cssParser));
if (NS_SUCCEEDED(result)) {
if (aClearOldDecl) {
// This should be done with decl->Clear() once such a method exists.
nsAutoString propName;
PRUint32 count, i;
count = decl->Count();
for (i = 0; i < count; i++) {
decl->GetNthProperty(0, propName);
nsCSSProperty prop = nsCSSProps::LookupProperty(propName);
nsCSSValue val;
decl->RemoveProperty(prop, val);
}
}
nsChangeHint hint;
result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,
aParseOnlyOneDecl, &hint);
aParseOnlyOneDecl, &hint,
aClearOldDecl);
if (NS_SUCCEEDED(result)) {
if (cssSheet) {
@ -1235,20 +1107,12 @@ protected:
PRUint32 mLineNumber;
};
#ifdef DEBUG_REFS
PRUint32 gStyleRuleCount=0;
#endif
CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector)
: nsCSSRule(),
mSelector(aSelector), mDeclaration(nsnull),
mWeight(0), mImportantRule(nsnull),
mDOMDeclaration(nsnull)
{
#ifdef DEBUG_REFS
gStyleRuleCount++;
printf( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount);
#endif
}
CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
@ -1259,11 +1123,6 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
mImportantRule(nsnull),
mDOMDeclaration(nsnull)
{
#ifdef DEBUG_REFS
gStyleRuleCount++;
printf( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount);
#endif
nsCSSSelector* copySel = aCopy.mSelector.mNext;
nsCSSSelector* ourSel = &mSelector;
@ -1285,11 +1144,6 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
{
#ifdef DEBUG_REFS
gStyleRuleCount--;
printf( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount);
#endif
nsCSSSelector* next = mSelector.mNext;
while (nsnull != next) {
@ -1425,9 +1279,8 @@ void CSSStyleRuleImpl::SetWeight(PRInt32 aWeight)
already_AddRefed<nsIStyleRule> CSSStyleRuleImpl::GetImportantRule(void)
{
if (!mImportantRule && mDeclaration) {
nsCSSDeclaration* important = mDeclaration->GetImportantValues();
if (important) {
mImportantRule = new CSSImportantRule(mSheet, important);
if (mDeclaration->HasImportantData()) {
mImportantRule = new CSSImportantRule(mSheet, mDeclaration);
NS_ADDREF(mImportantRule);
}
}
@ -1438,7 +1291,7 @@ already_AddRefed<nsIStyleRule> CSSStyleRuleImpl::GetImportantRule(void)
nsresult
CSSStyleRuleImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue)
{
return mDeclaration->GetValue(aProperty, aValue);
return mDeclaration->GetValueOrImportantValue(aProperty, aValue);
}
NS_IMETHODIMP
@ -1484,688 +1337,7 @@ CSSStyleRuleImpl::Clone(nsICSSRule*& aClone) const
NS_IMETHODIMP
CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (!aRuleData)
return NS_OK;
if (aRuleData->mFontData)
return MapFontForDeclaration(mDeclaration, *aRuleData->mFontData);
else if (aRuleData->mDisplayData)
return MapDisplayForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mDisplayData);
else if (aRuleData->mColorData)
return MapColorForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mColorData);
else if (aRuleData->mMarginData)
return MapMarginForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mMarginData);
else if (aRuleData->mListData)
return MapListForDeclaration(mDeclaration, *aRuleData->mListData);
else if (aRuleData->mPositionData)
return MapPositionForDeclaration(mDeclaration, *aRuleData->mPositionData);
else if (aRuleData->mTableData)
return MapTableForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTableData);
else if (aRuleData->mContentData)
return MapContentForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mContentData);
else if (aRuleData->mTextData)
return MapTextForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mTextData);
else if (aRuleData->mUIData)
return MapUIForDeclaration(mDeclaration, aRuleData->mSID, *aRuleData->mUIData);
else if (aRuleData->mXULData)
return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData);
#ifdef MOZ_SVG
else if (aRuleData->mSVGData)
return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData);
#endif
return NS_OK;
}
static nsresult
MapFontForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataFont& aFont)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSFont* ourFont = (nsCSSFont*)aDecl->GetData(kCSSFontSID);
if (!ourFont)
return NS_OK; // We don't have any rules for fonts.
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;
if (eCSSUnit_Null == aFont.mVariant.GetUnit() && eCSSUnit_Null != ourFont->mVariant.GetUnit())
aFont.mVariant = ourFont->mVariant;
if (eCSSUnit_Null == aFont.mWeight.GetUnit() && eCSSUnit_Null != ourFont->mWeight.GetUnit())
aFont.mWeight = ourFont->mWeight;
if (eCSSUnit_Null == aFont.mSize.GetUnit() && eCSSUnit_Null != ourFont->mSize.GetUnit())
aFont.mSize = ourFont->mSize;
if (eCSSUnit_Null == aFont.mSizeAdjust.GetUnit() && eCSSUnit_Null != ourFont->mSizeAdjust.GetUnit())
aFont.mSizeAdjust = ourFont->mSizeAdjust;
return NS_OK;
}
static nsresult
MapXULForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataXUL& aXUL)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSXUL* ourXUL = (nsCSSXUL*)aDecl->GetData(kCSSXULSID);
if (!ourXUL)
return NS_OK; // We don't have any rules for XUL.
// box-align: enum, inherit
if (aXUL.mBoxAlign.GetUnit() == eCSSUnit_Null && ourXUL->mBoxAlign.GetUnit() != eCSSUnit_Null)
aXUL.mBoxAlign = ourXUL->mBoxAlign;
// box-direction: enum, inherit
if (aXUL.mBoxDirection.GetUnit() == eCSSUnit_Null && ourXUL->mBoxDirection.GetUnit() != eCSSUnit_Null)
aXUL.mBoxDirection = ourXUL->mBoxDirection;
// box-flex: enum, inherit
if (aXUL.mBoxFlex.GetUnit() == eCSSUnit_Null && ourXUL->mBoxFlex.GetUnit() != eCSSUnit_Null)
aXUL.mBoxFlex = ourXUL->mBoxFlex;
// box-orient: enum, inherit
if (aXUL.mBoxOrient.GetUnit() == eCSSUnit_Null && ourXUL->mBoxOrient.GetUnit() != eCSSUnit_Null)
aXUL.mBoxOrient = ourXUL->mBoxOrient;
// box-pack: enum, inherit
if (aXUL.mBoxPack.GetUnit() == eCSSUnit_Null && ourXUL->mBoxPack.GetUnit() != eCSSUnit_Null)
aXUL.mBoxPack = ourXUL->mBoxPack;
// box-ordinal-group: number
if (aXUL.mBoxOrdinal.GetUnit() == eCSSUnit_Null && ourXUL->mBoxOrdinal.GetUnit() != eCSSUnit_Null)
aXUL.mBoxOrdinal = ourXUL->mBoxOrdinal;
return NS_OK;
}
#ifdef MOZ_SVG
static nsresult
MapSVGForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataSVG& aSVG)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSSVG* ourSVG = (nsCSSSVG*)aDecl->GetData(kCSSSVGSID);
if (!ourSVG)
return NS_OK; // We don't have any rules for SVG.
// fill:
if (aSVG.mFill.GetUnit() == eCSSUnit_Null && ourSVG->mFill.GetUnit() != eCSSUnit_Null)
aSVG.mFill = ourSVG->mFill;
// fill-opacity:
if (aSVG.mFillOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mFillOpacity.GetUnit() != eCSSUnit_Null)
aSVG.mFillOpacity = ourSVG->mFillOpacity;
// fill-rule:
if (aSVG.mFillRule.GetUnit() == eCSSUnit_Null && ourSVG->mFillRule.GetUnit() != eCSSUnit_Null)
aSVG.mFillRule = ourSVG->mFillRule;
// stroke:
if (aSVG.mStroke.GetUnit() == eCSSUnit_Null && ourSVG->mStroke.GetUnit() != eCSSUnit_Null)
aSVG.mStroke = ourSVG->mStroke;
// stroke-dasharray:
if (aSVG.mStrokeDasharray.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDasharray.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeDasharray = ourSVG->mStrokeDasharray;
// stroke-dashoffset:
if (aSVG.mStrokeDashoffset.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDashoffset.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeDashoffset = ourSVG->mStrokeDashoffset;
// stroke-linecap: enum, inherit
if (aSVG.mStrokeLinecap.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinecap.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeLinecap = ourSVG->mStrokeLinecap;
// stroke-linejoin
if (aSVG.mStrokeLinejoin.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinejoin.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeLinejoin = ourSVG->mStrokeLinejoin;
// stroke-miterlimit:
if (aSVG.mStrokeMiterlimit.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeMiterlimit.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeMiterlimit = ourSVG->mStrokeMiterlimit;
// stroke-opacity:
if (aSVG.mStrokeOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeOpacity.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeOpacity = ourSVG->mStrokeOpacity;
// stroke-width:
if (aSVG.mStrokeWidth.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeWidth.GetUnit() != eCSSUnit_Null)
aSVG.mStrokeWidth = ourSVG->mStrokeWidth;
return NS_OK;
}
#endif
static nsresult
MapPositionForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataPosition& aPosition)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSPosition* ourPosition = (nsCSSPosition*)aDecl->GetData(kCSSPositionSID);
if (!ourPosition)
return NS_OK; // We don't have any rules for position.
// box offsets: length, percent, auto, inherit
if (ourPosition->mOffset) {
if (aPosition.mOffset->mLeft.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mLeft.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mLeft = ourPosition->mOffset->mLeft;
if (aPosition.mOffset->mRight.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mRight.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mRight = ourPosition->mOffset->mRight;
if (aPosition.mOffset->mTop.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mTop.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mTop = ourPosition->mOffset->mTop;
if (aPosition.mOffset->mBottom.GetUnit() == eCSSUnit_Null && ourPosition->mOffset->mBottom.GetUnit() != eCSSUnit_Null)
aPosition.mOffset->mBottom = ourPosition->mOffset->mBottom;
}
// width/min-width/max-width
if (aPosition.mWidth.GetUnit() == eCSSUnit_Null && ourPosition->mWidth.GetUnit() != eCSSUnit_Null)
aPosition.mWidth = ourPosition->mWidth;
if (aPosition.mMinWidth.GetUnit() == eCSSUnit_Null && ourPosition->mMinWidth.GetUnit() != eCSSUnit_Null)
aPosition.mMinWidth = ourPosition->mMinWidth;
if (aPosition.mMaxWidth.GetUnit() == eCSSUnit_Null && ourPosition->mMaxWidth.GetUnit() != eCSSUnit_Null)
aPosition.mMaxWidth = ourPosition->mMaxWidth;
// height/min-height/max-height
if (aPosition.mHeight.GetUnit() == eCSSUnit_Null && ourPosition->mHeight.GetUnit() != eCSSUnit_Null)
aPosition.mHeight = ourPosition->mHeight;
if (aPosition.mMinHeight.GetUnit() == eCSSUnit_Null && ourPosition->mMinHeight.GetUnit() != eCSSUnit_Null)
aPosition.mMinHeight = ourPosition->mMinHeight;
if (aPosition.mMaxHeight.GetUnit() == eCSSUnit_Null && ourPosition->mMaxHeight.GetUnit() != eCSSUnit_Null)
aPosition.mMaxHeight = ourPosition->mMaxHeight;
// box-sizing: enum, inherit
if (aPosition.mBoxSizing.GetUnit() == eCSSUnit_Null && ourPosition->mBoxSizing.GetUnit() != eCSSUnit_Null)
aPosition.mBoxSizing = ourPosition->mBoxSizing;
// z-index
if (aPosition.mZIndex.GetUnit() == eCSSUnit_Null && ourPosition->mZIndex.GetUnit() != eCSSUnit_Null)
aPosition.mZIndex = ourPosition->mZIndex;
return NS_OK;
}
static nsresult
MapListForDeclaration(nsCSSDeclaration* aDecl, nsRuleDataList& aList)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSList* ourList = (nsCSSList*)aDecl->GetData(kCSSListSID);
if (!ourList)
return NS_OK; // We don't have any rules for lists.
// list-style-type: enum, none, inherit
if (aList.mType.GetUnit() == eCSSUnit_Null && ourList->mType.GetUnit() != eCSSUnit_Null)
aList.mType = ourList->mType;
// list-style-image: url, none, inherit
if (aList.mImage.GetUnit() == eCSSUnit_Null && ourList->mImage.GetUnit() != eCSSUnit_Null)
aList.mImage = ourList->mImage;
// list-style-position: enum, inherit
if (aList.mPosition.GetUnit() == eCSSUnit_Null && ourList->mPosition.GetUnit() != eCSSUnit_Null)
aList.mPosition = ourList->mPosition;
// image region: length, auto or inherit
if (ourList->mImageRegion) {
if (aList.mImageRegion->mLeft.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mLeft.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mLeft = ourList->mImageRegion->mLeft;
if (aList.mImageRegion->mRight.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mRight.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mRight = ourList->mImageRegion->mRight;
if (aList.mImageRegion->mTop.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mTop.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mTop = ourList->mImageRegion->mTop;
if (aList.mImageRegion->mBottom.GetUnit() == eCSSUnit_Null &&
ourList->mImageRegion->mBottom.GetUnit() != eCSSUnit_Null)
aList.mImageRegion->mBottom = ourList->mImageRegion->mBottom;
}
return NS_OK;
}
static nsresult
MapMarginForDeclaration(nsCSSDeclaration* aDeclaration, const nsStyleStructID& aSID, nsRuleDataMargin& aMargin)
{
nsCSSMargin* ourMargin = (nsCSSMargin*)aDeclaration->GetData(kCSSMarginSID);
if (!ourMargin)
return NS_OK;
// Margins
if (aSID == eStyleStruct_Margin && ourMargin->mMargin) {
if (eCSSUnit_Null == aMargin.mMargin->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mLeft.GetUnit())
aMargin.mMargin->mLeft = ourMargin->mMargin->mLeft;
if (eCSSUnit_Null == aMargin.mMargin->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mTop.GetUnit())
aMargin.mMargin->mTop = ourMargin->mMargin->mTop;
if (eCSSUnit_Null == aMargin.mMargin->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mRight.GetUnit())
aMargin.mMargin->mRight = ourMargin->mMargin->mRight;
if (eCSSUnit_Null == aMargin.mMargin->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mMargin->mBottom.GetUnit())
aMargin.mMargin->mBottom = ourMargin->mMargin->mBottom;
}
// Padding
if (aSID == eStyleStruct_Padding && ourMargin->mPadding) {
if (eCSSUnit_Null == aMargin.mPadding->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mLeft.GetUnit())
aMargin.mPadding->mLeft = ourMargin->mPadding->mLeft;
if (eCSSUnit_Null == aMargin.mPadding->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mTop.GetUnit())
aMargin.mPadding->mTop = ourMargin->mPadding->mTop;
if (eCSSUnit_Null == aMargin.mPadding->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mRight.GetUnit())
aMargin.mPadding->mRight = ourMargin->mPadding->mRight;
if (eCSSUnit_Null == aMargin.mPadding->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mPadding->mBottom.GetUnit())
aMargin.mPadding->mBottom = ourMargin->mPadding->mBottom;
}
// Borders
if (aSID == eStyleStruct_Border) {
// border-size
if (ourMargin->mBorderWidth) {
if (eCSSUnit_Null == aMargin.mBorderWidth->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mLeft.GetUnit())
aMargin.mBorderWidth->mLeft = ourMargin->mBorderWidth->mLeft;
if (eCSSUnit_Null == aMargin.mBorderWidth->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mTop.GetUnit())
aMargin.mBorderWidth->mTop = ourMargin->mBorderWidth->mTop;
if (eCSSUnit_Null == aMargin.mBorderWidth->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mRight.GetUnit())
aMargin.mBorderWidth->mRight = ourMargin->mBorderWidth->mRight;
if (eCSSUnit_Null == aMargin.mBorderWidth->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderWidth->mBottom.GetUnit())
aMargin.mBorderWidth->mBottom = ourMargin->mBorderWidth->mBottom;
}
// border-style
if (ourMargin->mBorderStyle) {
if (eCSSUnit_Null == aMargin.mBorderStyle->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mLeft.GetUnit())
aMargin.mBorderStyle->mLeft = ourMargin->mBorderStyle->mLeft;
if (eCSSUnit_Null == aMargin.mBorderStyle->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mTop.GetUnit())
aMargin.mBorderStyle->mTop = ourMargin->mBorderStyle->mTop;
if (eCSSUnit_Null == aMargin.mBorderStyle->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mRight.GetUnit())
aMargin.mBorderStyle->mRight = ourMargin->mBorderStyle->mRight;
if (eCSSUnit_Null == aMargin.mBorderStyle->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderStyle->mBottom.GetUnit())
aMargin.mBorderStyle->mBottom = ourMargin->mBorderStyle->mBottom;
}
// border-color
if (ourMargin->mBorderColor) {
if (eCSSUnit_Null == aMargin.mBorderColor->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mLeft.GetUnit())
aMargin.mBorderColor->mLeft = ourMargin->mBorderColor->mLeft;
if (eCSSUnit_Null == aMargin.mBorderColor->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mTop.GetUnit())
aMargin.mBorderColor->mTop = ourMargin->mBorderColor->mTop;
if (eCSSUnit_Null == aMargin.mBorderColor->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mRight.GetUnit())
aMargin.mBorderColor->mRight = ourMargin->mBorderColor->mRight;
if (eCSSUnit_Null == aMargin.mBorderColor->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderColor->mBottom.GetUnit())
aMargin.mBorderColor->mBottom = ourMargin->mBorderColor->mBottom;
}
// border-colors
if (ourMargin->mBorderColors) {
for (PRInt32 i = 0; i < 4; i++)
if (!aMargin.mBorderColors[i] && ourMargin->mBorderColors[i])
aMargin.mBorderColors[i] = ourMargin->mBorderColors[i];
}
// -moz-border-radius
if (ourMargin->mBorderRadius) {
if (eCSSUnit_Null == aMargin.mBorderRadius->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mLeft.GetUnit())
aMargin.mBorderRadius->mLeft = ourMargin->mBorderRadius->mLeft;
if (eCSSUnit_Null == aMargin.mBorderRadius->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mTop.GetUnit())
aMargin.mBorderRadius->mTop = ourMargin->mBorderRadius->mTop;
if (eCSSUnit_Null == aMargin.mBorderRadius->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mRight.GetUnit())
aMargin.mBorderRadius->mRight = ourMargin->mBorderRadius->mRight;
if (eCSSUnit_Null == aMargin.mBorderRadius->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mBorderRadius->mBottom.GetUnit())
aMargin.mBorderRadius->mBottom = ourMargin->mBorderRadius->mBottom;
}
// float-edge
if (eCSSUnit_Null == aMargin.mFloatEdge.GetUnit() && eCSSUnit_Null != ourMargin->mFloatEdge.GetUnit())
aMargin.mFloatEdge = ourMargin->mFloatEdge;
}
// Outline
if (aSID == eStyleStruct_Outline) {
// -moz-outline-radius
if (ourMargin->mOutlineRadius) {
if (eCSSUnit_Null == aMargin.mOutlineRadius->mLeft.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mLeft.GetUnit())
aMargin.mOutlineRadius->mLeft = ourMargin->mOutlineRadius->mLeft;
if (eCSSUnit_Null == aMargin.mOutlineRadius->mTop.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mTop.GetUnit())
aMargin.mOutlineRadius->mTop = ourMargin->mOutlineRadius->mTop;
if (eCSSUnit_Null == aMargin.mOutlineRadius->mRight.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mRight.GetUnit())
aMargin.mOutlineRadius->mRight = ourMargin->mOutlineRadius->mRight;
if (eCSSUnit_Null == aMargin.mOutlineRadius->mBottom.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineRadius->mBottom.GetUnit())
aMargin.mOutlineRadius->mBottom = ourMargin->mOutlineRadius->mBottom;
}
// outline-width
if (eCSSUnit_Null == aMargin.mOutlineWidth.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineWidth.GetUnit())
aMargin.mOutlineWidth = ourMargin->mOutlineWidth;
// outline-color
if (eCSSUnit_Null == aMargin.mOutlineColor.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineColor.GetUnit())
aMargin.mOutlineColor = ourMargin->mOutlineColor;
// outline-style
if (eCSSUnit_Null == aMargin.mOutlineStyle.GetUnit() && eCSSUnit_Null != ourMargin->mOutlineStyle.GetUnit())
aMargin.mOutlineStyle = ourMargin->mOutlineStyle;
}
return NS_OK;
}
static nsresult
MapColorForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataColor& aColor)
{
if (!aDecl)
return NS_OK;
nsCSSColor* ourColor = (nsCSSColor*)aDecl->GetData(kCSSColorSID);
if (!ourColor)
return NS_OK; // No rules for color or background.
if (aID == eStyleStruct_Color) {
// color: color, string, inherit
if (aColor.mColor.GetUnit() == eCSSUnit_Null && ourColor->mColor.GetUnit() != eCSSUnit_Null)
aColor.mColor = ourColor->mColor;
}
else if (aID == eStyleStruct_Background) {
// background-color: color, string, enum (flags), inherit
if (aColor.mBackColor.GetUnit() == eCSSUnit_Null && ourColor->mBackColor.GetUnit() != eCSSUnit_Null)
aColor.mBackColor = ourColor->mBackColor;
// background-image: url, none, inherit
if (aColor.mBackImage.GetUnit() == eCSSUnit_Null && ourColor->mBackImage.GetUnit() != eCSSUnit_Null)
aColor.mBackImage = ourColor->mBackImage;
// background-repeat: enum, inherit
if (aColor.mBackRepeat.GetUnit() == eCSSUnit_Null && ourColor->mBackRepeat.GetUnit() != eCSSUnit_Null)
aColor.mBackRepeat = ourColor->mBackRepeat;
// background-attachment: enum, inherit
if (aColor.mBackAttachment.GetUnit() == eCSSUnit_Null && ourColor->mBackAttachment.GetUnit() != eCSSUnit_Null)
aColor.mBackAttachment = ourColor->mBackAttachment;
// background-position: enum, length, percent (flags), inherit
if (aColor.mBackPositionX.GetUnit() == eCSSUnit_Null && ourColor->mBackPositionX.GetUnit() != eCSSUnit_Null)
aColor.mBackPositionX = ourColor->mBackPositionX;
if (aColor.mBackPositionY.GetUnit() == eCSSUnit_Null && ourColor->mBackPositionY.GetUnit() != eCSSUnit_Null)
aColor.mBackPositionY = ourColor->mBackPositionY;
// background-clip: enum, inherit
if (aColor.mBackClip.GetUnit() == eCSSUnit_Null && ourColor->mBackClip.GetUnit() != eCSSUnit_Null)
aColor.mBackClip = ourColor->mBackClip;
// background-inline-policy: enum, inherit
if (aColor.mBackInlinePolicy.GetUnit() == eCSSUnit_Null && ourColor->mBackInlinePolicy.GetUnit() != eCSSUnit_Null)
aColor.mBackInlinePolicy = ourColor->mBackInlinePolicy;
// background-origin: enum, inherit
if (aColor.mBackOrigin.GetUnit() == eCSSUnit_Null && ourColor->mBackOrigin.GetUnit() != eCSSUnit_Null)
aColor.mBackOrigin = ourColor->mBackOrigin;
}
return NS_OK;
}
static nsresult
MapTableForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataTable& aTable)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSTable* ourTable = (nsCSSTable*)aDecl->GetData(kCSSTableSID);
if (!ourTable)
return NS_OK; // We don't have any rules for tables.
if (aID == eStyleStruct_TableBorder) {
// border-collapse: enum, inherit
if (aTable.mBorderCollapse.GetUnit() == eCSSUnit_Null && ourTable->mBorderCollapse.GetUnit() != eCSSUnit_Null)
aTable.mBorderCollapse = ourTable->mBorderCollapse;
// border-spacing-x: length, inherit
if (aTable.mBorderSpacingX.GetUnit() == eCSSUnit_Null && ourTable->mBorderSpacingX.GetUnit() != eCSSUnit_Null)
aTable.mBorderSpacingX = ourTable->mBorderSpacingX;
// border-spacing-y: length, inherit
if (aTable.mBorderSpacingY.GetUnit() == eCSSUnit_Null && ourTable->mBorderSpacingY.GetUnit() != eCSSUnit_Null)
aTable.mBorderSpacingY = ourTable->mBorderSpacingY;
// caption-side: enum, inherit
if (aTable.mCaptionSide.GetUnit() == eCSSUnit_Null && ourTable->mCaptionSide.GetUnit() != eCSSUnit_Null)
aTable.mCaptionSide = ourTable->mCaptionSide;
// empty-cells: enum, inherit
if (aTable.mEmptyCells.GetUnit() == eCSSUnit_Null && ourTable->mEmptyCells.GetUnit() != eCSSUnit_Null)
aTable.mEmptyCells = ourTable->mEmptyCells;
}
else if (aID == eStyleStruct_Table) {
// table-layout: auto, enum, inherit
if (aTable.mLayout.GetUnit() == eCSSUnit_Null && ourTable->mLayout.GetUnit() != eCSSUnit_Null)
aTable.mLayout = ourTable->mLayout;
}
return NS_OK;
}
static nsresult
MapContentForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataContent& aContent)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSContent* ourContent = (nsCSSContent*)aDecl->GetData(kCSSContentSID);
if (!ourContent)
return NS_OK; // We don't have any rules for content.
if (aID == eStyleStruct_Content) {
if (!aContent.mContent && ourContent->mContent)
aContent.mContent = ourContent->mContent;
if (!aContent.mCounterIncrement && ourContent->mCounterIncrement)
aContent.mCounterIncrement = ourContent->mCounterIncrement;
if (!aContent.mCounterReset && ourContent->mCounterReset)
aContent.mCounterReset = ourContent->mCounterReset;
if (aContent.mMarkerOffset.GetUnit() == eCSSUnit_Null && ourContent->mMarkerOffset.GetUnit() != eCSSUnit_Null)
aContent.mMarkerOffset = ourContent->mMarkerOffset;
}
else if (aID == eStyleStruct_Quotes) {
if (!aContent.mQuotes && ourContent->mQuotes)
aContent.mQuotes = ourContent->mQuotes;
}
return NS_OK;
}
static nsresult
MapTextForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataText& aText)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSText* ourText = (nsCSSText*)aDecl->GetData(kCSSTextSID);
if (!ourText)
return NS_OK; // We don't have any rules for text.
if (aID == eStyleStruct_Text) {
if (aText.mLetterSpacing.GetUnit() == eCSSUnit_Null && ourText->mLetterSpacing.GetUnit() != eCSSUnit_Null)
aText.mLetterSpacing = ourText->mLetterSpacing;
if (aText.mLineHeight.GetUnit() == eCSSUnit_Null && ourText->mLineHeight.GetUnit() != eCSSUnit_Null)
aText.mLineHeight = ourText->mLineHeight;
if (aText.mTextIndent.GetUnit() == eCSSUnit_Null && ourText->mTextIndent.GetUnit() != eCSSUnit_Null)
aText.mTextIndent = ourText->mTextIndent;
if (aText.mTextTransform.GetUnit() == eCSSUnit_Null && ourText->mTextTransform.GetUnit() != eCSSUnit_Null)
aText.mTextTransform = ourText->mTextTransform;
if (aText.mTextAlign.GetUnit() == eCSSUnit_Null && ourText->mTextAlign.GetUnit() != eCSSUnit_Null)
aText.mTextAlign = ourText->mTextAlign;
if (aText.mWhiteSpace.GetUnit() == eCSSUnit_Null && ourText->mWhiteSpace.GetUnit() != eCSSUnit_Null)
aText.mWhiteSpace = ourText->mWhiteSpace;
if (aText.mWordSpacing.GetUnit() == eCSSUnit_Null && ourText->mWordSpacing.GetUnit() != eCSSUnit_Null)
aText.mWordSpacing = ourText->mWordSpacing;
}
else if (aID == eStyleStruct_TextReset) {
if (aText.mVerticalAlign.GetUnit() == eCSSUnit_Null && ourText->mVerticalAlign.GetUnit() != eCSSUnit_Null)
aText.mVerticalAlign = ourText->mVerticalAlign;
if (aText.mDecoration.GetUnit() == eCSSUnit_Null && ourText->mDecoration.GetUnit() != eCSSUnit_Null)
aText.mDecoration = ourText->mDecoration;
if (aText.mUnicodeBidi.GetUnit() == eCSSUnit_Null && ourText->mUnicodeBidi.GetUnit() != eCSSUnit_Null)
aText.mUnicodeBidi = ourText->mUnicodeBidi;
}
return NS_OK;
}
static nsresult
MapDisplayForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataDisplay& aDisplay)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSDisplay* ourDisplay = (nsCSSDisplay*)aDecl->GetData(kCSSDisplaySID);
if (!ourDisplay)
return NS_OK; // We don't have any rules for display.
if (aID == eStyleStruct_Display) {
// appearance: enum, none, inherit
if (aDisplay.mAppearance.GetUnit() == eCSSUnit_Null &&
ourDisplay->mAppearance.GetUnit() != eCSSUnit_Null)
aDisplay.mAppearance = ourDisplay->mAppearance;
// display: enum, none, inherit
if (aDisplay.mDisplay.GetUnit() == eCSSUnit_Null && ourDisplay->mDisplay.GetUnit() != eCSSUnit_Null)
aDisplay.mDisplay = ourDisplay->mDisplay;
// binding: url, none, inherit
if (aDisplay.mBinding.GetUnit() == eCSSUnit_Null && ourDisplay->mBinding.GetUnit() != eCSSUnit_Null)
aDisplay.mBinding = ourDisplay->mBinding;
// position: enum, inherit
if (aDisplay.mPosition.GetUnit() == eCSSUnit_Null && ourDisplay->mPosition.GetUnit() != eCSSUnit_Null)
aDisplay.mPosition = ourDisplay->mPosition;
// clear: enum, none, inherit
if (aDisplay.mClear.GetUnit() == eCSSUnit_Null && ourDisplay->mClear.GetUnit() != eCSSUnit_Null)
aDisplay.mClear = ourDisplay->mClear;
// temp fix for bug 24000
if (aDisplay.mBreakBefore.GetUnit() == eCSSUnit_Null && ourDisplay->mBreakBefore.GetUnit() != eCSSUnit_Null)
aDisplay.mBreakBefore = ourDisplay->mBreakBefore;
if (aDisplay.mBreakAfter.GetUnit() == eCSSUnit_Null && ourDisplay->mBreakAfter.GetUnit() != eCSSUnit_Null)
aDisplay.mBreakAfter = ourDisplay->mBreakAfter;
// end temp fix
// float: enum, none, inherit
if (aDisplay.mFloat.GetUnit() == eCSSUnit_Null && ourDisplay->mFloat.GetUnit() != eCSSUnit_Null)
aDisplay.mFloat = ourDisplay->mFloat;
// overflow: enum, auto, inherit
if (aDisplay.mOverflow.GetUnit() == eCSSUnit_Null && ourDisplay->mOverflow.GetUnit() != eCSSUnit_Null)
aDisplay.mOverflow = ourDisplay->mOverflow;
// clip property: length, auto, inherit
if (ourDisplay->mClip) {
if (aDisplay.mClip->mLeft.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mLeft.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mLeft = ourDisplay->mClip->mLeft;
if (aDisplay.mClip->mRight.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mRight.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mRight = ourDisplay->mClip->mRight;
if (aDisplay.mClip->mTop.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mTop.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mTop = ourDisplay->mClip->mTop;
if (aDisplay.mClip->mBottom.GetUnit() == eCSSUnit_Null && ourDisplay->mClip->mBottom.GetUnit() != eCSSUnit_Null)
aDisplay.mClip->mBottom = ourDisplay->mClip->mBottom;
}
}
else if (aID == eStyleStruct_Visibility) {
// opacity: factor, inherit
if (aDisplay.mOpacity.GetUnit() == eCSSUnit_Null && ourDisplay->mOpacity.GetUnit() != eCSSUnit_Null)
aDisplay.mOpacity = ourDisplay->mOpacity;
// direction: enum, inherit
if (aDisplay.mDirection.GetUnit() == eCSSUnit_Null && ourDisplay->mDirection.GetUnit() != eCSSUnit_Null)
aDisplay.mDirection = ourDisplay->mDirection;
// visibility: enum, inherit
if (aDisplay.mVisibility.GetUnit() == eCSSUnit_Null && ourDisplay->mVisibility.GetUnit() != eCSSUnit_Null)
aDisplay.mVisibility = ourDisplay->mVisibility;
}
return NS_OK;
}
static nsresult
MapUIForDeclaration(nsCSSDeclaration* aDecl, const nsStyleStructID& aID, nsRuleDataUserInterface& aUI)
{
if (!aDecl)
return NS_OK; // The rule must have a declaration.
nsCSSUserInterface* ourUI = (nsCSSUserInterface*)aDecl->GetData(kCSSUserInterfaceSID);
if (!ourUI)
return NS_OK; // We don't have any rules for UI.
if (aID == eStyleStruct_UserInterface) {
if (aUI.mUserFocus.GetUnit() == eCSSUnit_Null && ourUI->mUserFocus.GetUnit() != eCSSUnit_Null)
aUI.mUserFocus = ourUI->mUserFocus;
if (aUI.mUserInput.GetUnit() == eCSSUnit_Null && ourUI->mUserInput.GetUnit() != eCSSUnit_Null)
aUI.mUserInput = ourUI->mUserInput;
if (aUI.mUserModify.GetUnit() == eCSSUnit_Null && ourUI->mUserModify.GetUnit() != eCSSUnit_Null)
aUI.mUserModify = ourUI->mUserModify;
if (!aUI.mCursor && ourUI->mCursor)
aUI.mCursor = ourUI->mCursor;
}
else if (aID == eStyleStruct_UIReset) {
if (aUI.mUserSelect.GetUnit() == eCSSUnit_Null && ourUI->mUserSelect.GetUnit() != eCSSUnit_Null)
aUI.mUserSelect = ourUI->mUserSelect;
if (!aUI.mKeyEquivalent && ourUI->mKeyEquivalent)
aUI.mKeyEquivalent = ourUI->mKeyEquivalent;
if (aUI.mResizer.GetUnit() == eCSSUnit_Null && ourUI->mResizer.GetUnit() != eCSSUnit_Null)
aUI.mResizer = ourUI->mResizer;
if (aUI.mForceBrokenImageIcon.GetUnit() == eCSSUnit_Null && ourUI->mForceBrokenImageIcon.GetUnit() == eCSSUnit_Integer)
aUI.mForceBrokenImageIcon = ourUI->mForceBrokenImageIcon;
}
return NS_OK;
return mDeclaration->MapRuleInfoInto(aRuleData);
}
#ifdef DEBUG

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

@ -42,7 +42,7 @@
#include "nsString.h"
#include "nsCRT.h"
#include "nsCoord.h"
#include "nsCSSProps.h"
#include "nsCSSProperty.h"
#include "nsUnitConversion.h"

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

@ -1229,8 +1229,8 @@ nsComputedDOMStyle::GetOutlineWidth(nsIFrame *aFrame,
case eStyleUnit_Chars:
{
const nsAFlatCString& width=
nsCSSProps::LookupPropertyValue(eCSSProperty__moz_outline_width,
outline->mOutlineWidth.GetIntValue());
nsCSSProps::SearchKeywordTable(outline->mOutlineWidth.GetIntValue(),
nsCSSProps::kBorderWidthKTable);
val->SetIdent(width);
break;
}

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

@ -72,14 +72,17 @@ NS_IMETHODIMP
nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn)
{
aReturn.Truncate();
nsCSSDeclaration* decl;
nsresult rv = GetCSSDeclaration(&decl, PR_FALSE);
if (NS_SUCCEEDED(rv) && decl) {
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
nsCSSValue val;
rv = decl->RemoveProperty(prop, val);
decl->GetValue(prop, aReturn);
rv = decl->RemoveProperty(prop);
if (NS_SUCCEEDED(rv)) {
rv = SetCSSDeclaration(decl, PR_TRUE, PR_TRUE);
@ -143,12 +146,16 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,
}
}
else if (aAllocate) {
result = NS_NewCSSDeclaration(aDecl);
if (NS_SUCCEEDED(result)) {
result = SetCSSDeclaration(*aDecl, PR_FALSE, PR_FALSE);
if (NS_FAILED(result)) {
*aDecl = nsnull;
nsCSSDeclaration *decl = new nsCSSDeclaration();
if (!decl)
return NS_ERROR_OUT_OF_MEMORY;
if (!decl->InitializeEmpty()) {
decl->RuleAbort();
return NS_ERROR_OUT_OF_MEMORY;
}
result = SetCSSDeclaration(*aDecl, PR_FALSE, PR_FALSE);
if (NS_SUCCEEDED(result)) {
*aDecl = decl;
}
}
}
@ -270,27 +277,11 @@ nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAString& aDecl,
return result;
}
if (aClearOldDecl) {
// This should be done with decl->Clear() once such a method exists.
nsAutoString propName;
PRUint32 count, i;
count = decl->Count();
for (i = 0; i < count; i++) {
decl->GetNthProperty(0, propName);
nsCSSProperty prop = nsCSSProps::LookupProperty(propName);
nsCSSValue val;
decl->RemoveProperty(prop, val);
}
}
nsChangeHint uselessHint = NS_STYLE_HINT_NONE;
result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,
aParseOnlyOneDecl,
&uselessHint);
&uselessHint,
aClearOldDecl);
if (NS_SUCCEEDED(result)) {
result = SetCSSDeclaration(decl, PR_TRUE, PR_TRUE);

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

@ -274,7 +274,7 @@ NS_INTERFACE_MAP_END_AGGREGATED(fOuter)
// nsIDOMCSS2Properties
// nsIDOMNSCSS2Properties
#define CSS_PROP(name_, id_, method_, hint_) \
#define CSS_PROP(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
NS_IMETHODIMP \
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
{ \
@ -290,9 +290,13 @@ NS_INTERFACE_MAP_END_AGGREGATED(fOuter)
NS_LITERAL_STRING("")); \
}
#define CSS_PROP_INTERNAL(name_, id_, method_, hint_) /* nothing */
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_, hint_) \
CSS_PROP(name_, id_, method_, hint_)
CSS_PROP(name_, id_, method_, hint_, , , ,)
#define CSS_PROP_SHORTHAND(name_, id_, method_, hint_) \
CSS_PROP(name_, id_, method_, hint_, , , ,)
#include "nsCSSPropList.h"
#undef CSS_PROP_INTERNAL
#undef CSS_PROP_SHORTHAND
#undef CSS_PROP_NOTIMPLEMENTED
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
#undef CSS_PROP

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

@ -76,6 +76,7 @@ public:
virtual void DropReference() = 0;
// XXX DeCOMify this, so that |nsCSSDeclaration*| is the return type.
virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
PRBool aAllocate) = 0;
virtual nsresult ParsePropertyValue(const nsAString& aPropName,

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

@ -171,10 +171,10 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
aData->mDisplayData->mAppearance = none;
nsCSSValue autovalue(eCSSUnit_Auto);
aData->mDisplayData->mClip->mTop = autovalue;
aData->mDisplayData->mClip->mRight = autovalue;
aData->mDisplayData->mClip->mBottom = autovalue;
aData->mDisplayData->mClip->mLeft = autovalue;
aData->mDisplayData->mClip.mTop = autovalue;
aData->mDisplayData->mClip.mRight = autovalue;
aData->mDisplayData->mClip.mBottom = autovalue;
aData->mDisplayData->mClip.mLeft = autovalue;
nsCSSValue inlinevalue(NS_STYLE_DISPLAY_INLINE, eCSSUnit_Enumerated);
aData->mDisplayData->mDisplay = inlinevalue;
@ -200,10 +200,10 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
nsCSSValue autovalue(eCSSUnit_Auto);
nsCSSValue none(eCSSUnit_None);
nsCSSValue zero(0.0f, eCSSUnit_Point);
aData->mPositionData->mOffset->mTop = autovalue;
aData->mPositionData->mOffset->mRight = autovalue;
aData->mPositionData->mOffset->mBottom = autovalue;
aData->mPositionData->mOffset->mLeft = autovalue;
aData->mPositionData->mOffset.mTop = autovalue;
aData->mPositionData->mOffset.mRight = autovalue;
aData->mPositionData->mOffset.mBottom = autovalue;
aData->mPositionData->mOffset.mLeft = autovalue;
aData->mPositionData->mWidth = autovalue;
aData->mPositionData->mMinWidth = zero;
aData->mPositionData->mMaxWidth = none;
@ -235,9 +235,9 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
// Disable everything in the UserInterface struct.
if (aData->mSID == eStyleStruct_UserInterface) {
nsCSSValue inherit(eCSSUnit_Inherit);
aData->mUIData->mUserInput = inherit;
aData->mUIData->mUserModify = inherit;
aData->mUIData->mUserFocus = inherit;
aData->mUserInterfaceData->mUserInput = inherit;
aData->mUserInterfaceData->mUserModify = inherit;
aData->mUserInterfaceData->mUserFocus = inherit;
// XXX |mCursor| is a pain, because we have to have our own cursor
// structure allocated.
}
@ -245,7 +245,7 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
if (aData->mSID == eStyleStruct_UIReset) {
nsCSSValue autovalue(eCSSUnit_Auto);
nsCSSValue none(eCSSUnit_None);
aData->mUIData->mResizer = autovalue;
aData->mUserInterfaceData->mResizer = autovalue;
// XXX |mKeyEquivalent| is a pain, because we have to have our own cursor
// structure allocated.
// Don't bother with '-moz-force-broken-image-icon' since it's only
@ -285,26 +285,26 @@ CSSFirstLineRule::MapRuleInfoInto(nsRuleData* aData)
// properties.
if (aData->mSID == eStyleStruct_Border) {
nsCSSValue none(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
aData->mMarginData->mBorderStyle->mTop = none;
aData->mMarginData->mBorderStyle->mRight = none;
aData->mMarginData->mBorderStyle->mBottom = none;
aData->mMarginData->mBorderStyle->mLeft = none;
aData->mMarginData->mBorderStyle.mTop = none;
aData->mMarginData->mBorderStyle.mRight = none;
aData->mMarginData->mBorderStyle.mBottom = none;
aData->mMarginData->mBorderStyle.mLeft = none;
}
if (aData->mSID == eStyleStruct_Margin) {
nsCSSValue zero(0.0f, eCSSUnit_Point);
aData->mMarginData->mMargin->mTop = zero;
aData->mMarginData->mMargin->mRight = zero;
aData->mMarginData->mMargin->mBottom = zero;
aData->mMarginData->mMargin->mLeft = zero;
aData->mMarginData->mMargin.mTop = zero;
aData->mMarginData->mMargin.mRight = zero;
aData->mMarginData->mMargin.mBottom = zero;
aData->mMarginData->mMargin.mLeft = zero;
}
if (aData->mSID == eStyleStruct_Padding) {
nsCSSValue zero(0.0f, eCSSUnit_Point);
aData->mMarginData->mPadding->mTop = zero;
aData->mMarginData->mPadding->mRight = zero;
aData->mMarginData->mPadding->mBottom = zero;
aData->mMarginData->mPadding->mLeft = zero;
aData->mMarginData->mPadding.mTop = zero;
aData->mMarginData->mPadding.mRight = zero;
aData->mMarginData->mPadding.mBottom = zero;
aData->mMarginData->mPadding.mLeft = zero;
}
return NS_OK;

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

@ -91,7 +91,8 @@ public:
nsIURI* aBaseURL,
nsCSSDeclaration* aDeclaration,
PRBool aParseOnlyOneDecl,
nsChangeHint* aHint) = 0;
nsChangeHint* aHint,
PRBool aClearOldDecl) = 0;
NS_IMETHOD ParseRule(const nsAString& aRule,
nsIURI* aBaseURL,

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

@ -677,25 +677,12 @@ nsRuleNode::PropagateDependentBit(PRUint32 aBit, nsRuleNode* aHighestNode)
/* the information for a property (or in some cases, a rect group of
properties) */
// for PropertyCheckData::type
// XXX Would bits be more efficient?
#define CHECKDATA_VALUE 0
#define CHECKDATA_RECT 1
#define CHECKDATA_VALUELIST 2
#define CHECKDATA_COUNTERDATA 3
#define CHECKDATA_QUOTES 4
#define CHECKDATA_SHADOW 5
#define CHECKDATA_VALUELIST_ARRAY 6
struct PropertyCheckData {
size_t offset;
PRUint16 type;
nsCSSType type;
PRPackedBool mayHaveExplicitInherit;
};
#define CHECKDATA_PROP(_datastruct, _member, _type, _iscoord) \
{ offsetof(_datastruct, _member), _type, _iscoord }
/* the information for all the properties in a style struct */
typedef nsRuleNode::RuleDetail
@ -813,176 +800,161 @@ CheckFontCallback(const nsRuleDataStruct& aData)
return nsRuleNode::eRuleUnknown;
}
// for nsCSSPropList.h, so we get information on things in the style
// structs but not nsCSS*
#define CSS_PROP_INCLUDE_NOT_CSS
static const PropertyCheckData FontCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataFont, mFamily, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mStyle, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mVariant, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mWeight, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mSize, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataFont, mSizeAdjust, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_FONT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_FONT
};
static const PropertyCheckData DisplayCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataDisplay, mAppearance, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mClip, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mDisplay, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mBinding, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mPosition, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mFloat, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mClear, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mOverflow, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mBreakBefore, CHECKDATA_VALUE, PR_FALSE), // temp fix for bug 2400
CHECKDATA_PROP(nsRuleDataDisplay, mBreakAfter, CHECKDATA_VALUE, PR_FALSE) // temp fix for bug 2400
#define CSS_PROP_DISPLAY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_DISPLAY
};
static const PropertyCheckData VisibilityCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataDisplay, mVisibility, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mDirection, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mLang, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataDisplay, mOpacity, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_VISIBILITY(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_VISIBILITY
};
static const PropertyCheckData MarginCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mMargin, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_MARGIN(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_MARGIN
};
static const PropertyCheckData BorderCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mBorderWidth, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderStyle, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderColor, CHECKDATA_RECT, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderRadius, CHECKDATA_RECT, PR_TRUE),
CHECKDATA_PROP(nsRuleDataMargin, mFloatEdge, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mBorderColors, CHECKDATA_VALUELIST_ARRAY, PR_FALSE)
#define CSS_PROP_BORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_BORDER
};
static const PropertyCheckData PaddingCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mPadding, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_PADDING(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_PADDING
};
static const PropertyCheckData OutlineCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataMargin, mOutlineColor, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mOutlineWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataMargin, mOutlineStyle, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataMargin, mOutlineRadius, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_OUTLINE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_OUTLINE
};
static const PropertyCheckData ListCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataList, mType, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataList, mImage, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataList, mPosition, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataList, mImageRegion, CHECKDATA_RECT, PR_TRUE)
#define CSS_PROP_LIST(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_LIST
};
static const PropertyCheckData ColorCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataColor, mColor, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_COLOR(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_COLOR
};
static const PropertyCheckData BackgroundCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataColor, mBackAttachment, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackRepeat, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackClip, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackColor, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackImage, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackInlinePolicy, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackOrigin, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackPositionX, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataColor, mBackPositionY, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_BACKGROUND(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_BACKGROUND
};
static const PropertyCheckData PositionCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataPosition, mOffset, CHECKDATA_RECT, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMinWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMaxWidth, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMinHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mMaxHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataPosition, mBoxSizing, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataPosition, mZIndex, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_POSITION(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_POSITION
};
static const PropertyCheckData TableCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataTable, mLayout, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mFrame, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mRules, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mCols, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mSpan, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TABLE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TABLE
};
static const PropertyCheckData TableBorderCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataTable, mBorderCollapse, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mBorderSpacingX, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mBorderSpacingY, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mCaptionSide, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataTable, mEmptyCells, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TABLEBORDER(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TABLEBORDER
};
static const PropertyCheckData ContentCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataContent, mContent, CHECKDATA_VALUELIST, PR_FALSE),
CHECKDATA_PROP(nsRuleDataContent, mMarkerOffset, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataContent, mCounterIncrement, CHECKDATA_COUNTERDATA, PR_FALSE),
CHECKDATA_PROP(nsRuleDataContent, mCounterReset, CHECKDATA_COUNTERDATA, PR_FALSE)
#define CSS_PROP_CONTENT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_CONTENT
};
static const PropertyCheckData QuotesCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataContent, mQuotes, CHECKDATA_QUOTES, PR_FALSE)
#define CSS_PROP_QUOTES(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_QUOTES
};
static const PropertyCheckData TextCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataText, mLineHeight, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mTextIndent, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mWordSpacing, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mLetterSpacing, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mTextAlign, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataText, mTextTransform, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataText, mWhiteSpace, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TEXT(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TEXT
};
static const PropertyCheckData TextResetCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataText, mDecoration, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataText, mVerticalAlign, CHECKDATA_VALUE, PR_TRUE),
CHECKDATA_PROP(nsRuleDataText, mUnicodeBidi, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_TEXTRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_TEXTRESET
};
static const PropertyCheckData UserInterfaceCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataUserInterface, mUserInput, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mUserModify, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mUserFocus, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mCursor, CHECKDATA_VALUELIST, PR_FALSE)
#define CSS_PROP_USERINTERFACE(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_USERINTERFACE
};
static const PropertyCheckData UIResetCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataUserInterface, mUserSelect, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mResizer, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mKeyEquivalent, CHECKDATA_VALUELIST, PR_FALSE),
CHECKDATA_PROP(nsRuleDataUserInterface, mForceBrokenImageIcon, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_UIRESET(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_UIRESET
};
static const PropertyCheckData XULCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataXUL, mBoxAlign, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxDirection, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxFlex, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxOrient, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxPack, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataXUL, mBoxOrdinal, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_XUL(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_XUL
};
#ifdef MOZ_SVG
static const PropertyCheckData SVGCheckProperties[] = {
CHECKDATA_PROP(nsRuleDataSVG, mFill, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mFillOpacity, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mFillRule, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStroke, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeDasharray, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeDashoffset, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeLinecap, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeLinejoin, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeMiterlimit, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeOpacity, CHECKDATA_VALUE, PR_FALSE),
CHECKDATA_PROP(nsRuleDataSVG, mStrokeWidth, CHECKDATA_VALUE, PR_FALSE)
#define CSS_PROP_SVG(name_, id_, method_, hint_, datastruct_, member_, type_, iscoord_) \
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
#include "nsCSSPropList.h"
#undef CSS_PROP_SVG
};
#endif
#undef CSS_PROP_INCLUDE_NOT_CSS
static const StructCheckData gCheckProperties[] = {
#define STYLE_STRUCT(name, checkdata_cb, ctor_args) \
@ -1009,7 +981,7 @@ ValueAtOffset(const nsRuleDataStruct& aRuleDataStruct, size_t aOffset)
inline const nsCSSRect*
RectAtOffset(const nsRuleDataStruct& aRuleDataStruct, size_t aOffset)
{
return * NS_REINTERPRET_CAST(const nsCSSRect*const*,
return NS_REINTERPRET_CAST(const nsCSSRect*,
NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}
@ -1065,7 +1037,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
++prop)
switch (prop->type) {
case CHECKDATA_VALUE:
case eCSSType_Value:
{
++total;
const nsCSSValue& value = ValueAtOffset(aRuleDataStruct, prop->offset);
@ -1080,7 +1052,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_RECT:
case eCSSType_Rect:
total += 4;
if (prop->mayHaveExplicitInherit)
ExamineRectCoordProperties(RectAtOffset(aRuleDataStruct, prop->offset),
@ -1091,7 +1063,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
specified, inherited);
break;
case CHECKDATA_VALUELIST:
case eCSSType_ValueList:
{
++total;
const nsCSSValueList* valueList =
@ -1107,7 +1079,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_COUNTERDATA:
case eCSSType_CounterData:
{
++total;
NS_ASSERTION(!prop->mayHaveExplicitInherit,
@ -1123,7 +1095,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_QUOTES:
case eCSSType_Quotes:
{
++total;
NS_ASSERTION(!prop->mayHaveExplicitInherit,
@ -1139,27 +1111,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
}
break;
case CHECKDATA_VALUELIST_ARRAY:
{
total += 4;
const nsCSSValueList** valueArray =
ValueListArrayAtOffset(aRuleDataStruct, prop->offset);
if (valueArray) {
for (PRInt32 i = 0; i < 4; i++) {
const nsCSSValueList* valList = valueArray[i];
if (valList) {
++specified;
if (eCSSUnit_Inherit == valList->mValue.GetUnit()) {
++inherited;
NS_ASSERTION(!prop->mayHaveExplicitInherit, "Value list arrays can't inherit!");
}
}
}
}
}
break;
case CHECKDATA_SHADOW:
case eCSSType_Shadow:
NS_NOTYETIMPLEMENTED("nsCSSShadow not yet transferred to structs");
break;
@ -1202,11 +1154,7 @@ nsRuleNode::GetDisplayData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Display, mPresContext, aContext);
ruleData.mDisplayData = &displayData;
nsCSSRect clip;
displayData.mClip = &clip;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData, aComputeData);
displayData.mClip = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData, aComputeData);
}
const nsStyleStruct*
@ -1244,7 +1192,7 @@ nsRuleNode::GetUserInterfaceData(nsStyleContext* aContext, PRBool aComputeData)
{
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(eStyleStruct_UserInterface, mPresContext, aContext);
ruleData.mUIData = &uiData;
ruleData.mUserInterfaceData = &uiData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UserInterface, aContext, &ruleData, &uiData, aComputeData);
uiData.mCursor = nsnull;
@ -1256,7 +1204,7 @@ nsRuleNode::GetUIResetData(nsStyleContext* aContext, PRBool aComputeData)
{
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(eStyleStruct_UIReset, mPresContext, aContext);
ruleData.mUIData = &uiData;
ruleData.mUserInterfaceData = &uiData;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UIReset, aContext, &ruleData, &uiData, aComputeData);
uiData.mKeyEquivalent = nsnull;
@ -1300,13 +1248,7 @@ nsRuleNode::GetMarginData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Margin, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect margin;
marginData.mMargin = &margin;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData, aComputeData);
marginData.mMargin = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1316,27 +1258,7 @@ nsRuleNode::GetBorderData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Border, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect borderWidth;
nsCSSRect borderColor;
nsCSSRect borderStyle;
nsCSSRect borderRadius;
nsCSSValueList* borderColors[4];
for (PRInt32 i = 0; i < 4; i++)
borderColors[i] = nsnull;
marginData.mBorderWidth = &borderWidth;
marginData.mBorderColor = &borderColor;
marginData.mBorderStyle = &borderStyle;
marginData.mBorderRadius = &borderRadius;
marginData.mBorderColors = borderColors;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData, aComputeData);
marginData.mBorderWidth = marginData.mBorderColor = marginData.mBorderStyle = marginData.mBorderRadius = nsnull;
marginData.mBorderColors = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1346,13 +1268,7 @@ nsRuleNode::GetPaddingData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Padding, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect padding;
marginData.mPadding = &padding;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData, aComputeData);
marginData.mPadding = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1362,13 +1278,7 @@ nsRuleNode::GetOutlineData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Outline, mPresContext, aContext);
ruleData.mMarginData = &marginData;
nsCSSRect outlineRadius;
marginData.mOutlineRadius = &outlineRadius;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData, aComputeData);
marginData.mOutlineRadius = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData, aComputeData);
}
const nsStyleStruct*
@ -1378,12 +1288,7 @@ nsRuleNode::GetListData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_List, mPresContext, aContext);
ruleData.mListData = &listData;
nsCSSRect imageRegion;
listData.mImageRegion = &imageRegion;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData, aComputeData);
listData.mImageRegion = nsnull;
return res;
return WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData, aComputeData);
}
const nsStyleStruct*
@ -1393,12 +1298,7 @@ nsRuleNode::GetPositionData(nsStyleContext* aContext, PRBool aComputeData)
nsRuleData ruleData(eStyleStruct_Position, mPresContext, aContext);
ruleData.mPositionData = &posData;
nsCSSRect offset;
posData.mOffset = &offset;
const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData, aComputeData);
posData.mOffset = nsnull;
return res;
return WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData, aComputeData);
}
const nsStyleStruct*
@ -2796,8 +2696,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
}
// clip property: length, auto, inherit
if (nsnull != displayData.mClip) {
if (eCSSUnit_Inherit == displayData.mClip->mTop.GetUnit()) { // if one is inherit, they all are
if (eCSSUnit_Inherit == displayData.mClip.mTop.GetUnit()) { // if one is inherit, they all are
inherited = PR_TRUE;
display->mClipFlags = parentDisplay->mClipFlags;
display->mClip = parentDisplay->mClip;
@ -2807,37 +2706,37 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mClipFlags = 0; // clear it
if (eCSSUnit_Auto == displayData.mClip->mTop.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mTop.GetUnit()) {
display->mClip.y = 0;
display->mClipFlags |= NS_STYLE_CLIP_TOP_AUTO;
}
else if (displayData.mClip->mTop.IsLengthUnit()) {
display->mClip.y = CalcLength(displayData.mClip->mTop, nsnull, aContext, mPresContext, inherited);
else if (displayData.mClip.mTop.IsLengthUnit()) {
display->mClip.y = CalcLength(displayData.mClip.mTop, nsnull, aContext, mPresContext, inherited);
fullAuto = PR_FALSE;
}
if (eCSSUnit_Auto == displayData.mClip->mBottom.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mBottom.GetUnit()) {
display->mClip.height = 0;
display->mClipFlags |= NS_STYLE_CLIP_BOTTOM_AUTO;
}
else if (displayData.mClip->mBottom.IsLengthUnit()) {
display->mClip.height = CalcLength(displayData.mClip->mBottom, nsnull, aContext, mPresContext, inherited) -
else if (displayData.mClip.mBottom.IsLengthUnit()) {
display->mClip.height = CalcLength(displayData.mClip.mBottom, nsnull, aContext, mPresContext, inherited) -
display->mClip.y;
fullAuto = PR_FALSE;
}
if (eCSSUnit_Auto == displayData.mClip->mLeft.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mLeft.GetUnit()) {
display->mClip.x = 0;
display->mClipFlags |= NS_STYLE_CLIP_LEFT_AUTO;
}
else if (displayData.mClip->mLeft.IsLengthUnit()) {
display->mClip.x = CalcLength(displayData.mClip->mLeft, nsnull, aContext, mPresContext, inherited);
else if (displayData.mClip.mLeft.IsLengthUnit()) {
display->mClip.x = CalcLength(displayData.mClip.mLeft, nsnull, aContext, mPresContext, inherited);
fullAuto = PR_FALSE;
}
if (eCSSUnit_Auto == displayData.mClip->mRight.GetUnit()) {
if (eCSSUnit_Auto == displayData.mClip.mRight.GetUnit()) {
display->mClip.width = 0;
display->mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO;
}
else if (displayData.mClip->mRight.IsLengthUnit()) {
display->mClip.width = CalcLength(displayData.mClip->mRight, nsnull, aContext, mPresContext, inherited) -
else if (displayData.mClip.mRight.IsLengthUnit()) {
display->mClip.width = CalcLength(displayData.mClip.mRight, nsnull, aContext, mPresContext, inherited) -
display->mClip.x;
fullAuto = PR_FALSE;
}
@ -2849,7 +2748,6 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mClipFlags |= NS_STYLE_CLIP_RECT;
}
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3257,21 +3155,6 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
return bg;
}
typedef nsCSSValue nsCSSRect::*CSSRectSide;
#if (NS_SIDE_TOP != 0) || (NS_SIDE_RIGHT != 1) || (NS_SIDE_BOTTOM != 2) || (NS_SIDE_LEFT != 3)
#error "Somebody changed the side constants."
#endif
static const CSSRectSide gCSSSides[] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
const nsStyleStruct*
nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
const nsRuleDataStruct& aData,
@ -3299,17 +3182,16 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// margin: length, percent, auto, inherit
if (marginData.mMargin) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
parentMargin->mMargin.Get(side, parentCoord);
if (SetCoord(marginData.mMargin->*(gCSSSides[side]), coord, parentCoord,
SETCOORD_LPAH, aContext, mPresContext, inherited)) {
if (SetCoord(marginData.mMargin.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
aContext, mPresContext, inherited)) {
margin->mMargin.Set(side, coord);
}
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3355,11 +3237,10 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// border-size: length, enum, inherit
if (marginData.mBorderWidth) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
const nsCSSValue &value = marginData.mBorderWidth->*(gCSSSides[side]);
const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]);
if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext,
mPresContext, inherited))
border->mBorder.Set(side, coord);
@ -3368,13 +3249,11 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
border->mBorder.Set(side, parentBorder->mBorder.Get(side, coord));
}
}
}
// border-style: enum, none, inhert
if (nsnull != marginData.mBorderStyle) {
nsCSSRect* ourStyle = marginData.mBorderStyle;
const nsCSSRect& ourStyle = marginData.mBorderStyle;
FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourStyle->*(gCSSSides[side]);
const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
nsCSSUnit unit = value.GetUnit();
if (eCSSUnit_Enumerated == unit) {
border->SetBorderStyle(side, value.GetIntValue());
@ -3387,42 +3266,37 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
border->SetBorderStyle(side, parentBorder->GetBorderStyle(side));
}
}
}
// border-colors: color, string, enum
if (marginData.mBorderColors) {
nscolor borderColor;
nscolor unused = NS_RGB(0,0,0);
for (PRInt32 i = 0; i < 4; i++) {
if (marginData.mBorderColors[i]) {
FOR_CSS_SIDES(side) {
nsCSSValueList* list =
marginData.mBorderColors.*(nsCSSValueListRect::sides[side]);
if (list) {
// Some composite border color information has been specified for this
// border side.
border->EnsureBorderColors();
border->ClearBorderColors(i);
nsCSSValueList* list = marginData.mBorderColors[i];
border->ClearBorderColors(side);
while (list) {
if (SetColor(list->mValue, unused, mPresContext, borderColor, inherited))
border->AppendBorderColor(i, borderColor, PR_FALSE);
border->AppendBorderColor(side, borderColor, PR_FALSE);
else if (eCSSUnit_Enumerated == list->mValue.GetUnit() &&
NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue())
border->AppendBorderColor(i, nsnull, PR_TRUE);
border->AppendBorderColor(side, nsnull, PR_TRUE);
list = list->mNext;
}
}
}
}
// border-color: color, string, enum, inherit
if (nsnull != marginData.mBorderColor) {
nsCSSRect* ourBorderColor = marginData.mBorderColor;
nscolor borderColor;
nscolor unused = NS_RGB(0,0,0);
const nsCSSRect& ourBorderColor = marginData.mBorderColor;
PRBool transparent;
PRBool foreground;
FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourBorderColor->*(gCSSSides[side]);
const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]);
if (eCSSUnit_Inherit == value.GetUnit()) {
inherited = PR_TRUE;
parentBorder->GetBorderColor(side, borderColor,
@ -3453,20 +3327,15 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
}
}
}
}
// -moz-border-radius: length, percent, inherit
if (marginData.mBorderRadius) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
parentBorder->mBorderRadius.Get(side, parentCoord);
if (SetCoord(marginData.mBorderRadius->*(gCSSSides[side]), coord,
if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord,
parentCoord, SETCOORD_LPH, aContext, mPresContext,
inherited))
border->mBorderRadius.Set(side, coord);
}
}
// float-edge: enum, inherit
if (eCSSUnit_Enumerated == marginData.mFloatEdge.GetUnit())
@ -3520,17 +3389,16 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// padding: length, percent, inherit
if (marginData.mPadding) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
parentPadding->mPadding.Get(side, parentCoord);
if (SetCoord(marginData.mPadding->*(gCSSSides[side]), coord, parentCoord,
SETCOORD_LPH, aContext, mPresContext, inherited)) {
if (SetCoord(marginData.mPadding.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPH,
aContext, mPresContext, inherited)) {
padding->mPadding.Set(side, coord);
}
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3691,35 +3559,33 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
}
// image region property: length, auto, inherit
if (listData.mImageRegion) {
if (eCSSUnit_Inherit == listData.mImageRegion->mTop.GetUnit()) { // if one is inherit, they all are
if (eCSSUnit_Inherit == listData.mImageRegion.mTop.GetUnit()) { // if one is inherit, they all are
inherited = PR_TRUE;
list->mImageRegion = parentList->mImageRegion;
}
else {
if (eCSSUnit_Auto == listData.mImageRegion->mTop.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mTop.GetUnit())
list->mImageRegion.y = 0;
else if (listData.mImageRegion->mTop.IsLengthUnit())
list->mImageRegion.y = CalcLength(listData.mImageRegion->mTop, nsnull, aContext, mPresContext, inherited);
else if (listData.mImageRegion.mTop.IsLengthUnit())
list->mImageRegion.y = CalcLength(listData.mImageRegion.mTop, nsnull, aContext, mPresContext, inherited);
if (eCSSUnit_Auto == listData.mImageRegion->mBottom.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mBottom.GetUnit())
list->mImageRegion.height = 0;
else if (listData.mImageRegion->mBottom.IsLengthUnit())
list->mImageRegion.height = CalcLength(listData.mImageRegion->mBottom, nsnull, aContext,
else if (listData.mImageRegion.mBottom.IsLengthUnit())
list->mImageRegion.height = CalcLength(listData.mImageRegion.mBottom, nsnull, aContext,
mPresContext, inherited) - list->mImageRegion.y;
if (eCSSUnit_Auto == listData.mImageRegion->mLeft.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mLeft.GetUnit())
list->mImageRegion.x = 0;
else if (listData.mImageRegion->mLeft.IsLengthUnit())
list->mImageRegion.x = CalcLength(listData.mImageRegion->mLeft, nsnull, aContext, mPresContext, inherited);
else if (listData.mImageRegion.mLeft.IsLengthUnit())
list->mImageRegion.x = CalcLength(listData.mImageRegion.mLeft, nsnull, aContext, mPresContext, inherited);
if (eCSSUnit_Auto == listData.mImageRegion->mRight.GetUnit())
if (eCSSUnit_Auto == listData.mImageRegion.mRight.GetUnit())
list->mImageRegion.width = 0;
else if (listData.mImageRegion->mRight.IsLengthUnit())
list->mImageRegion.width = CalcLength(listData.mImageRegion->mRight, nsnull, aContext, mPresContext, inherited) -
else if (listData.mImageRegion.mRight.IsLengthUnit())
list->mImageRegion.width = CalcLength(listData.mImageRegion.mRight, nsnull, aContext, mPresContext, inherited) -
list->mImageRegion.x;
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
@ -3764,24 +3630,14 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
// box offsets: length, percent, auto, inherit
if (posData.mOffset) {
nsStyleCoord coord;
nsStyleCoord parentCoord;
parentPos->mOffset.GetTop(parentCoord);
if (SetCoord(posData.mOffset->mTop, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetTop(coord);
}
parentPos->mOffset.GetRight(parentCoord);
if (SetCoord(posData.mOffset->mRight, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetRight(coord);
}
parentPos->mOffset.GetBottom(parentCoord);
if (SetCoord(posData.mOffset->mBottom, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetBottom(coord);
}
parentPos->mOffset.GetLeft(parentCoord);
if (SetCoord(posData.mOffset->mLeft, coord, parentCoord, SETCOORD_LPAH, aContext, mPresContext, inherited)) {
pos->mOffset.SetLeft(coord);
FOR_CSS_SIDES(side) {
parentPos->mOffset.Get(side, parentCoord);
if (SetCoord(posData.mOffset.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
aContext, mPresContext, inherited)) {
pos->mOffset.Set(side, coord);
}
}

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

@ -256,7 +256,7 @@ struct nsRuleData
nsRuleDataColor* mColorData;
nsRuleDataContent* mContentData;
nsRuleDataText* mTextData;
nsRuleDataUserInterface* mUIData;
nsRuleDataUserInterface* mUserInterfaceData;
nsRuleDataXUL* mXULData;
#ifdef MOZ_SVG
@ -267,7 +267,7 @@ struct nsRuleData
:mSID(aSID), mPresContext(aContext), mStyleContext(aStyleContext), mPostResolveCallback(nsnull),
mFontData(nsnull), mDisplayData(nsnull), mMarginData(nsnull), mListData(nsnull),
mPositionData(nsnull), mTableData(nsnull), mColorData(nsnull), mContentData(nsnull), mTextData(nsnull),
mUIData(nsnull)
mUserInterfaceData(nsnull)
{
mCanStoreInRuleTree = PR_TRUE;
mXULData = nsnull;