Fix for 70809. r=attinasi, sr=brendan

This commit is contained in:
hyatt%netscape.com 2001-03-06 02:30:30 +00:00
parent 4d01b576e2
commit 6946f71e1b
18 changed files with 856 additions and 8 deletions

View File

@ -1734,6 +1734,63 @@ PRUint32 StylePrintImpl::ComputeCRC32(PRUint32 aCrc) const
#pragma mark -
#endif
#ifdef INCLUDE_XUL
// --------------------
// nsStyleXUL
//
nsStyleXUL::nsStyleXUL() { }
nsStyleXUL::~nsStyleXUL() { }
struct StyleXULImpl: public nsStyleXUL {
StyleXULImpl() { }
void ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext);
void SetFrom(const nsStyleXUL& aSource);
void CopyTo(nsStyleXUL& aDest) const;
PRInt32 CalcDifference(const StyleXULImpl& aOther) const;
PRUint32 ComputeCRC32(PRUint32 aCrc) const;
private: // These are not allowed
StyleXULImpl(const StyleXULImpl& aOther);
StyleXULImpl& operator=(const StyleXULImpl& aOther);
};
void StyleXULImpl::ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext)
{
mBoxOrient = NS_STYLE_BOX_ORIENT_HORIZONTAL;
}
void StyleXULImpl::SetFrom(const nsStyleXUL& aSource)
{
nsCRT::memcpy((nsStyleXUL*)this, &aSource, sizeof(nsStyleXUL));
}
void StyleXULImpl::CopyTo(nsStyleXUL& aDest) const
{
nsCRT::memcpy(&aDest, (const nsStyleXUL*)this, sizeof(nsStyleXUL));
}
PRInt32 StyleXULImpl::CalcDifference(const StyleXULImpl& aOther) const
{
if (mBoxOrient == aOther.mBoxOrient)
return NS_STYLE_HINT_NONE;
return NS_STYLE_HINT_REFLOW;
}
PRUint32 StyleXULImpl::ComputeCRC32(PRUint32 aCrc) const
{
PRUint32 crc = aCrc;
#ifdef COMPUTE_STYLEDATA_CRC
crc = AccumulateCRC(crc,(const char *)&mBoxOrient,sizeof(mBoxOrient));
#endif
return crc;
}
#ifdef XP_MAC
#pragma mark -
#endif
#endif // INCLUDE_XUL
//----------------------------------------------------------------------
#ifdef SHARE_STYLECONTEXTS
@ -1945,6 +2002,22 @@ void StyleOutlineImplLog::ResetFrom(const nsStyleOutline* aParent, nsIPresContex
mSetFromParent = (aParent != nsnull);
}
#ifdef INCLUDE_XUL
// StyleXULImpl mXUL;
struct StyleXULImplLog: public StyleXULImpl {
void ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext);
StyleXULImpl mInternalXUL;
bool mSetFromParent;
};
void StyleXULImplLog::ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext)
{
StyleXULImpl::ResetFrom(aParent, aPresContext);
CopyTo(mInternalXUL);
mSetFromParent = (aParent != nsnull);
}
#endif // INCLUDE_XUL
#ifdef XP_MAC
#pragma mark -
#endif
@ -1996,6 +2069,9 @@ private: // all data and methods private: only friends have access
StylePaddingImplLog mPadding;
StyleBorderImplLog mBorder;
StyleOutlineImplLog mOutline;
#ifdef INCLUDE_XUL
StyleXULImplLog mXUL;
#endif
#else
StyleFontImpl mFont;
StyleColorImpl mColor;
@ -2011,6 +2087,9 @@ private: // all data and methods private: only friends have access
StylePaddingImpl mPadding;
StyleBorderImpl mBorder;
StyleOutlineImpl mOutline;
#ifdef INCLUDE_XUL
StyleXULImpl mXUL;
#endif
#endif
PRUint32 mRefCnt;
@ -2145,6 +2224,9 @@ static void LogStyleStructs(nsStyleContextData* aStyleContextData)
case eStyleStruct_Padding: printf("eStyleStruct_Padding "); sizeOfStruct = sizeof(StylePaddingImpl); break;
case eStyleStruct_Border: printf("eStyleStruct_Border "); sizeOfStruct = sizeof(StyleBorderImpl); break;
case eStyleStruct_Outline: printf("eStyleStruct_Outline "); sizeOfStruct = sizeof(StyleOutlineImpl); break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL: printf("eStyleStruct_XUL "); sizeOfStruct = sizeof(StyleXULImpl); break;
#endif
}
short percentDefault = (totalCount == 0 ? 0 : ((100 * defaultStruct[i]) / totalCount));
short percentFromParent = (defaultStruct[i] == 0 ? 0 : ((100 * setFromParent[i]) / defaultStruct[i]));
@ -2284,6 +2366,15 @@ static void LogStyleStructs(nsStyleContextData* aStyleContextData)
setFromParent[i]++;
}
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
if (aStyleContextData->mXUL.CalcDifference(aStyleContextData->mXUL.mInternalXUL) == NS_STYLE_HINT_NONE) {
defaultStruct[i]++;
if (aStyleContextData->mXUL.mSetFromParent)
setFromParent[i]++;
}
break;
#endif
}
}
@ -2330,6 +2421,9 @@ PRUint32 nsStyleContextData::ComputeCRC32(PRUint32 aCrc) const
crc = mPadding.ComputeCRC32(crc);
crc = mBorder.ComputeCRC32(crc);
crc = mOutline.ComputeCRC32(crc);
#ifdef INCLUDE_XUL
crc = mXUL.ComputeCRC32(crc);
#endif
#else
crc = 0;
#endif
@ -2467,6 +2561,9 @@ protected:
StylePaddingImpl mPadding;
StyleBorderImpl mBorder;
StyleOutlineImpl mOutline;
#ifdef INCLUDE_XUL
StyleXULImpl mXUL;
#endif
#endif // #ifdef SHARE_STYLECONTEXTS
@ -2512,6 +2609,9 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent,
mTable(),
mContent(),
mUserInterface(),
#ifdef INCLUDE_XUL
mXUL(),
#endif
mPrint()
#endif
{
@ -2900,6 +3000,9 @@ static void LogGetStyleDataCall(nsStyleStructID aSID, LogCallType aLogCallType,
case eStyleStruct_Border: printf("eStyleStruct_Border "); break;
case eStyleStruct_Outline: printf("eStyleStruct_Outline "); break;
case eStyleStruct_BorderPaddingShortcut: printf("BorderPaddingShortcut "); break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL: printf("eStyleStruct_XUL "); break;
#endif
}
short percent = 100*calls[i]/totalCalls;
short avdepth = calls[i] == 0 ? 0 : round(float(depth[i])/float(calls[i]));
@ -3028,6 +3131,11 @@ const nsStyleStruct* StyleContextImpl::GetStyleData(nsStyleStructID aSID)
case eStyleStruct_Outline:
result = & GETSCDATA(Outline);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
result = & GETSCDATA(XUL);
break;
#endif
default:
NS_ERROR("Invalid style struct id");
break;
@ -3090,6 +3198,11 @@ nsStyleStruct* StyleContextImpl::GetMutableStyleData(nsStyleStructID aSID)
case eStyleStruct_Outline:
result = & GETSCDATA(Outline);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
result = & GETSCDATA(XUL);
break;
#endif
default:
NS_ERROR("Invalid style struct id");
break;
@ -3170,6 +3283,11 @@ StyleContextImpl::GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const
case eStyleStruct_Outline:
GETSCDATA(Outline).CopyTo((nsStyleOutline&)aStruct);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
GETSCDATA(XUL).CopyTo((nsStyleXUL&)aStruct);
break;
#endif
case eStyleStruct_BorderPaddingShortcut: {
nsMargin border, padding;
if (GETSCDATA(Border).GetBorder(border)) {
@ -3239,6 +3357,11 @@ StyleContextImpl::SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct)
case eStyleStruct_Outline:
GETSCDATA(Outline).SetFrom((const nsStyleOutline&)aStruct);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
GETSCDATA(XUL).SetFrom((const nsStyleXUL&)aStruct);
break;
#endif
default:
NS_ERROR("Invalid style struct id");
result = NS_ERROR_INVALID_ARG;
@ -3299,6 +3422,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
GETSCDATA(Padding).ResetFrom(&(mParent->GETSCDATA(Padding)), aPresContext);
GETSCDATA(Border).ResetFrom(&(mParent->GETSCDATA(Border)), aPresContext);
GETSCDATA(Outline).ResetFrom(&(mParent->GETSCDATA(Outline)), aPresContext);
#ifdef INCLUDE_XUL
GETSCDATA(XUL).ResetFrom(&(mParent->GETSCDATA(XUL)), aPresContext);
#endif
}
else {
GETSCDATA(Font).ResetFrom(nsnull, aPresContext);
@ -3315,6 +3441,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
GETSCDATA(Padding).ResetFrom(nsnull, aPresContext);
GETSCDATA(Border).ResetFrom(nsnull, aPresContext);
GETSCDATA(Outline).ResetFrom(nsnull, aPresContext);
#ifdef INCLUDE_XUL
GETSCDATA(XUL).ResetFrom(nsnull, aPresContext);
#endif
}
PRUint32 cnt = 0;
@ -3396,6 +3525,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
GETSCDATA(Padding).ResetFrom(nsnull, aPresContext);
GETSCDATA(Border).ResetFrom(nsnull, aPresContext);
GETSCDATA(Outline).ResetFrom(nsnull, aPresContext);
#ifdef INCLUDE_XUL
GETSCDATA(XUL).ResetFrom(nsnull, aPresContext);
#endif
GETSCDATA(Display).mVisible = visible;
GETSCDATA(Display).mDirection = direction;
GETSCDATA(Display).mLanguage = language;
@ -3589,6 +3721,15 @@ StyleContextImpl::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint,PR
aHint = hint;
}
}
#ifdef INCLUDE_XUL
if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;
if (aHint < NS_STYLE_HINT_MAX) {
hint = GETSCDATA(XUL).CalcDifference(other->GETSCDATA(XUL));
if (aHint < hint) {
aHint = hint;
}
}
#endif
}
return NS_OK;
}
@ -3897,6 +4038,10 @@ void StyleContextImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
totalSize += (long)sizeof(GETSCDATA(Border));
printf( " - StyleOutlineImpl: %ld\n", (long)sizeof(GETSCDATA(Outline)));
totalSize += (long)sizeof(GETSCDATA(Outline));
#ifdef INCLUDE_XUL
printf( " - StyleXULImpl: %ld\n", (long)sizeof(GETSCDATA(XUL)));
totalSize += (long)sizeof(GETSCDATA(XUL));
#endif
printf( " - Total: %ld\n", (long)totalSize);
printf( "*************************************\n");
}

View File

@ -48,7 +48,9 @@ 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);
#ifdef INCLUDE_XUL
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#endif
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }
@ -973,6 +975,41 @@ void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
fputs(buffer, out);
}
#ifdef INCLUDE_XUL
// --- nsCSSXUL -----------------
nsCSSXUL::nsCSSXUL(void)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::nsCSSXUL(const nsCSSXUL& aCopy)
: mBoxOrient(aCopy.mBoxOrient)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::~nsCSSXUL(void)
{
MOZ_COUNT_DTOR(nsCSSXUL);
}
const nsID& nsCSSXUL::GetID(void)
{
return kCSSXULSID;
}
void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
{
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
mBoxOrient.AppendToString(buffer, eCSSProperty_box_orient);
fputs(buffer, out);
}
#endif // INCLUDE_XUL
// --- nsCSSDeclaration -----------------
@ -1042,6 +1079,9 @@ protected:
nsCSSContent* mContent;
nsCSSUserInterface* mUserInterface;
nsCSSAural* mAural;
#ifdef INCLUDE_XUL
nsCSSXUL* mXUL;
#endif
CSSDeclarationImpl* mImportant;
@ -1084,6 +1124,9 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy)
DECL_IF_COPY(Content);
DECL_IF_COPY(UserInterface);
DECL_IF_COPY(Aural);
#ifdef INCLUDE_XUL
DECL_IF_COPY(XUL);
#endif
#ifdef DEBUG_REFS
++gInstanceCount;
@ -1126,6 +1169,9 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void)
CSS_IF_DELETE(mContent);
CSS_IF_DELETE(mUserInterface);
CSS_IF_DELETE(mAural);
#ifdef INCLUDE_XUL
CSS_IF_DELETE(mXUL);
#endif
NS_IF_RELEASE(mImportant);
CSS_IF_DELETE(mOrder);
@ -1161,7 +1207,11 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr)
CSS_IF_GET_ELSE(aSID, Page, aDataPtr)
CSS_IF_GET_ELSE(aSID, Content, aDataPtr)
CSS_IF_GET_ELSE(aSID, UserInterface, aDataPtr)
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) {
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr)
#ifdef INCLUDE_XUL
CSS_IF_GET_ELSE(aSID, XUL, aDataPtr)
#endif
{
return NS_NOINTERFACE;
}
return NS_OK;
@ -1692,6 +1742,18 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_ENSURE(XUL) {
switch (aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient = aValue; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -2427,6 +2489,20 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
CSS_ENSURE_IMPORTANT(XUL) {
switch (aProperty) {
CSS_CASE_IMPORTANT(eCSSProperty_box_orient, mXUL->mBoxOrient);
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3101,6 +3177,18 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_CHECK(XUL) {
switch(aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient.Reset(); break;
CSS_BOGUS_DEFAULT; // Make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3828,6 +3916,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
switch (aProperty) {
case eCSSProperty_box_orient: aValue = mXUL->mBoxOrient; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
else {
aValue.Reset();
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -4615,6 +4718,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
if(mUserInterface && uniqueItems->AddItem(mUserInterface)){
aSize += sizeof(*mUserInterface);
}
#ifdef INCLUDE_XUL
if(mXUL && uniqueItems->AddItem(mXUL)){
aSize += sizeof(*mXUL);
}
#endif
if(mAural && uniqueItems->AddItem(mAural)){
aSize += sizeof(*mAural);
}

View File

@ -97,6 +97,7 @@ CSS_KEY(bengali, bengali)
CSS_KEY(bidi-override, bidi_override)
CSS_KEY(blink, blink)
CSS_KEY(block, block)
CSS_KEY(block-axis, block_axis)
CSS_KEY(bold, bold)
CSS_KEY(bolder, bolder)
CSS_KEY(border-box, border_box)

View File

@ -1318,6 +1318,7 @@ PRBool CSSParserImpl::ParseSelectorList(PRInt32& aErrorCode,
REPORT_UNEXPECTED_EOF();
break;
}
if (eCSSToken_Symbol == tk->mType) {
if (',' == tk->mSymbol) {
SelectorList* newList = nsnull;
@ -3187,6 +3188,11 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode,
case eCSSProperty_left:
case eCSSProperty_right:
return ParseVariant(aErrorCode, aValue, VARIANT_AHLP, nsnull);
#ifdef INCLUDE_XUL
case eCSSProperty_box_orient:
return ParseVariant(aErrorCode, aValue, VARIANT_HK,
nsCSSProps::kBoxOrientKTable);
#endif
case eCSSProperty_box_sizing:
return ParseVariant(aErrorCode, aValue, VARIANT_HK,
nsCSSProps::kBoxSizingKTable);

View File

@ -677,6 +677,17 @@ const PRInt32 nsCSSProps::kWhitespaceKTable[] = {
-1,-1
};
#ifdef INCLUDE_XUL
// Specific keyword tables for XUL.properties
const PRInt32 nsCSSProps::kBoxOrientKTable[] = {
eCSSKeyword_horizontal, NS_STYLE_BOX_ORIENT_HORIZONTAL,
eCSSKeyword_vertical, NS_STYLE_BOX_ORIENT_VERTICAL,
eCSSKeyword_inline_axis, NS_STYLE_BOX_ORIENT_HORIZONTAL,
eCSSKeyword_block_axis, NS_STYLE_BOX_ORIENT_VERTICAL,
-1,-1
};
#endif
PRInt32
nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[])
{
@ -763,6 +774,11 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
case eCSSProperty_border_collapse:
return SearchKeywordTable(aValue, kBorderCollapseKTable);
#ifdef INCLUDE_XUL
case eCSSProperty_box_orient:
return SearchKeywordTable(aValue, kBoxOrientKTable);
#endif
case eCSSProperty_box_sizing:
return SearchKeywordTable(aValue, kBoxSizingKTable);

View File

@ -76,6 +76,9 @@ public:
static const PRInt32 kBorderColorKTable[];
static const PRInt32 kBorderStyleKTable[];
static const PRInt32 kBorderWidthKTable[];
#ifdef INCLUDE_XUL
static const PRInt32 kBoxOrientKTable[];
#endif
static const PRInt32 kBoxSizingKTable[];
static const PRInt32 kCaptionSideKTable[];
static const PRInt32 kClearKTable[];

View File

@ -48,7 +48,9 @@ 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);
#ifdef INCLUDE_XUL
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#endif
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }
@ -973,6 +975,41 @@ void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
fputs(buffer, out);
}
#ifdef INCLUDE_XUL
// --- nsCSSXUL -----------------
nsCSSXUL::nsCSSXUL(void)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::nsCSSXUL(const nsCSSXUL& aCopy)
: mBoxOrient(aCopy.mBoxOrient)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::~nsCSSXUL(void)
{
MOZ_COUNT_DTOR(nsCSSXUL);
}
const nsID& nsCSSXUL::GetID(void)
{
return kCSSXULSID;
}
void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
{
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
mBoxOrient.AppendToString(buffer, eCSSProperty_box_orient);
fputs(buffer, out);
}
#endif // INCLUDE_XUL
// --- nsCSSDeclaration -----------------
@ -1042,6 +1079,9 @@ protected:
nsCSSContent* mContent;
nsCSSUserInterface* mUserInterface;
nsCSSAural* mAural;
#ifdef INCLUDE_XUL
nsCSSXUL* mXUL;
#endif
CSSDeclarationImpl* mImportant;
@ -1084,6 +1124,9 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy)
DECL_IF_COPY(Content);
DECL_IF_COPY(UserInterface);
DECL_IF_COPY(Aural);
#ifdef INCLUDE_XUL
DECL_IF_COPY(XUL);
#endif
#ifdef DEBUG_REFS
++gInstanceCount;
@ -1126,6 +1169,9 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void)
CSS_IF_DELETE(mContent);
CSS_IF_DELETE(mUserInterface);
CSS_IF_DELETE(mAural);
#ifdef INCLUDE_XUL
CSS_IF_DELETE(mXUL);
#endif
NS_IF_RELEASE(mImportant);
CSS_IF_DELETE(mOrder);
@ -1161,7 +1207,11 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr)
CSS_IF_GET_ELSE(aSID, Page, aDataPtr)
CSS_IF_GET_ELSE(aSID, Content, aDataPtr)
CSS_IF_GET_ELSE(aSID, UserInterface, aDataPtr)
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) {
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr)
#ifdef INCLUDE_XUL
CSS_IF_GET_ELSE(aSID, XUL, aDataPtr)
#endif
{
return NS_NOINTERFACE;
}
return NS_OK;
@ -1692,6 +1742,18 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_ENSURE(XUL) {
switch (aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient = aValue; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -2427,6 +2489,20 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
CSS_ENSURE_IMPORTANT(XUL) {
switch (aProperty) {
CSS_CASE_IMPORTANT(eCSSProperty_box_orient, mXUL->mBoxOrient);
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3101,6 +3177,18 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_CHECK(XUL) {
switch(aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient.Reset(); break;
CSS_BOGUS_DEFAULT; // Make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3828,6 +3916,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
switch (aProperty) {
case eCSSProperty_box_orient: aValue = mXUL->mBoxOrient; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
else {
aValue.Reset();
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -4615,6 +4718,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
if(mUserInterface && uniqueItems->AddItem(mUserInterface)){
aSize += sizeof(*mUserInterface);
}
#ifdef INCLUDE_XUL
if(mXUL && uniqueItems->AddItem(mXUL)){
aSize += sizeof(*mXUL);
}
#endif
if(mAural && uniqueItems->AddItem(mAural)){
aSize += sizeof(*mAural);
}

View File

@ -78,6 +78,9 @@ static NS_DEFINE_IID(kCSSContentSID, NS_CSS_CONTENT_SID);
static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID);
static NS_DEFINE_IID(kCSSBreaksSID, NS_CSS_BREAKS_SID);
static NS_DEFINE_IID(kCSSPageSID, NS_CSS_PAGE_SID);
#ifdef INCLUDE_XUL
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#endif
// -- nsCSSSelector -------------------------------
@ -3319,6 +3322,34 @@ MapDeclarationPrintInto(nsICSSDeclaration* aDeclaration,
}
}
#ifdef INCLUDE_XUL
static void
MapDeclarationXULInto(nsICSSDeclaration* aDeclaration,
nsIMutableStyleContext* aContext, nsIStyleContext* aParentContext,
nsStyleFont* aFont, nsIPresContext* aPresContext)
{
nsCSSXUL* ourXUL;
if (NS_OK == aDeclaration->GetData(kCSSXULSID, (nsCSSStruct**)&ourXUL)) {
if (nsnull != ourXUL) {
nsStyleXUL* xul = (nsStyleXUL*)aContext->GetMutableStyleData(eStyleStruct_XUL);
const nsStyleXUL* parentXUL = xul;
if (nsnull != aParentContext) {
parentXUL = (const nsStyleXUL*)aParentContext->GetStyleData(eStyleStruct_XUL);
}
// box-orient: enum, inherit
if (eCSSUnit_Enumerated == ourXUL->mBoxOrient.GetUnit()) {
xul->mBoxOrient = ourXUL->mBoxOrient.GetIntValue();
}
else if (eCSSUnit_Inherit == ourXUL->mBoxOrient.GetUnit()) {
xul->mBoxOrient = parentXUL->mBoxOrient;
}
}
}
}
#endif // INCLUDE_XUL
void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
{
@ -3336,6 +3367,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
MapDeclarationContentInto(aDeclaration, aContext, parentContext, font, aPresContext);
MapDeclarationUIInto(aDeclaration, aContext, parentContext, font, aPresContext);
MapDeclarationPrintInto(aDeclaration, aContext, parentContext, font, aPresContext);
#ifdef INCLUDE_XUL
MapDeclarationXULInto(aDeclaration, aContext, parentContext, font, aPresContext);
#endif
NS_IF_RELEASE(parentContext);
}

View File

@ -91,6 +91,11 @@ struct nsCSSStruct {
#define NS_CSS_AURAL_SID \
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
#ifdef INCLUDE_XUL
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
#define NS_CSS_XUL_SID \
{ 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } }
#endif
// IID for the nsICSSDeclaration interface {7b36b9ac-b48d-11d1-9ca5-0060088f9ff7}
#define NS_ICSS_DECLARATION_IID \
@ -384,6 +389,19 @@ struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSValue mVolume;
};
#ifdef INCLUDE_XUL
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
nsCSSXUL(const nsCSSXUL& aCopy);
virtual ~nsCSSXUL(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mBoxOrient;
};
#endif
class nsICSSDeclaration : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_DECLARATION_IID);

View File

@ -97,6 +97,7 @@ CSS_KEY(bengali, bengali)
CSS_KEY(bidi-override, bidi_override)
CSS_KEY(blink, blink)
CSS_KEY(block, block)
CSS_KEY(block-axis, block_axis)
CSS_KEY(bold, bold)
CSS_KEY(bolder, bolder)
CSS_KEY(border-box, border_box)

View File

@ -76,6 +76,9 @@ public:
static const PRInt32 kBorderColorKTable[];
static const PRInt32 kBorderStyleKTable[];
static const PRInt32 kBorderWidthKTable[];
#ifdef INCLUDE_XUL
static const PRInt32 kBoxOrientKTable[];
#endif
static const PRInt32 kBoxSizingKTable[];
static const PRInt32 kCaptionSideKTable[];
static const PRInt32 kClearKTable[];

View File

@ -48,7 +48,9 @@ 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);
#ifdef INCLUDE_XUL
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#endif
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }
@ -973,6 +975,41 @@ void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
fputs(buffer, out);
}
#ifdef INCLUDE_XUL
// --- nsCSSXUL -----------------
nsCSSXUL::nsCSSXUL(void)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::nsCSSXUL(const nsCSSXUL& aCopy)
: mBoxOrient(aCopy.mBoxOrient)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::~nsCSSXUL(void)
{
MOZ_COUNT_DTOR(nsCSSXUL);
}
const nsID& nsCSSXUL::GetID(void)
{
return kCSSXULSID;
}
void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
{
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
mBoxOrient.AppendToString(buffer, eCSSProperty_box_orient);
fputs(buffer, out);
}
#endif // INCLUDE_XUL
// --- nsCSSDeclaration -----------------
@ -1042,6 +1079,9 @@ protected:
nsCSSContent* mContent;
nsCSSUserInterface* mUserInterface;
nsCSSAural* mAural;
#ifdef INCLUDE_XUL
nsCSSXUL* mXUL;
#endif
CSSDeclarationImpl* mImportant;
@ -1084,6 +1124,9 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy)
DECL_IF_COPY(Content);
DECL_IF_COPY(UserInterface);
DECL_IF_COPY(Aural);
#ifdef INCLUDE_XUL
DECL_IF_COPY(XUL);
#endif
#ifdef DEBUG_REFS
++gInstanceCount;
@ -1126,6 +1169,9 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void)
CSS_IF_DELETE(mContent);
CSS_IF_DELETE(mUserInterface);
CSS_IF_DELETE(mAural);
#ifdef INCLUDE_XUL
CSS_IF_DELETE(mXUL);
#endif
NS_IF_RELEASE(mImportant);
CSS_IF_DELETE(mOrder);
@ -1161,7 +1207,11 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr)
CSS_IF_GET_ELSE(aSID, Page, aDataPtr)
CSS_IF_GET_ELSE(aSID, Content, aDataPtr)
CSS_IF_GET_ELSE(aSID, UserInterface, aDataPtr)
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) {
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr)
#ifdef INCLUDE_XUL
CSS_IF_GET_ELSE(aSID, XUL, aDataPtr)
#endif
{
return NS_NOINTERFACE;
}
return NS_OK;
@ -1692,6 +1742,18 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_ENSURE(XUL) {
switch (aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient = aValue; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -2427,6 +2489,20 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
CSS_ENSURE_IMPORTANT(XUL) {
switch (aProperty) {
CSS_CASE_IMPORTANT(eCSSProperty_box_orient, mXUL->mBoxOrient);
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3101,6 +3177,18 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_CHECK(XUL) {
switch(aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient.Reset(); break;
CSS_BOGUS_DEFAULT; // Make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3828,6 +3916,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
switch (aProperty) {
case eCSSProperty_box_orient: aValue = mXUL->mBoxOrient; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
else {
aValue.Reset();
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -4615,6 +4718,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
if(mUserInterface && uniqueItems->AddItem(mUserInterface)){
aSize += sizeof(*mUserInterface);
}
#ifdef INCLUDE_XUL
if(mXUL && uniqueItems->AddItem(mXUL)){
aSize += sizeof(*mXUL);
}
#endif
if(mAural && uniqueItems->AddItem(mAural)){
aSize += sizeof(*mAural);
}

View File

@ -97,6 +97,7 @@ CSS_KEY(bengali, bengali)
CSS_KEY(bidi-override, bidi_override)
CSS_KEY(blink, blink)
CSS_KEY(block, block)
CSS_KEY(block-axis, block_axis)
CSS_KEY(bold, bold)
CSS_KEY(bolder, bolder)
CSS_KEY(border-box, border_box)

View File

@ -1318,6 +1318,7 @@ PRBool CSSParserImpl::ParseSelectorList(PRInt32& aErrorCode,
REPORT_UNEXPECTED_EOF();
break;
}
if (eCSSToken_Symbol == tk->mType) {
if (',' == tk->mSymbol) {
SelectorList* newList = nsnull;
@ -3187,6 +3188,11 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode,
case eCSSProperty_left:
case eCSSProperty_right:
return ParseVariant(aErrorCode, aValue, VARIANT_AHLP, nsnull);
#ifdef INCLUDE_XUL
case eCSSProperty_box_orient:
return ParseVariant(aErrorCode, aValue, VARIANT_HK,
nsCSSProps::kBoxOrientKTable);
#endif
case eCSSProperty_box_sizing:
return ParseVariant(aErrorCode, aValue, VARIANT_HK,
nsCSSProps::kBoxSizingKTable);

View File

@ -76,6 +76,9 @@ public:
static const PRInt32 kBorderColorKTable[];
static const PRInt32 kBorderStyleKTable[];
static const PRInt32 kBorderWidthKTable[];
#ifdef INCLUDE_XUL
static const PRInt32 kBoxOrientKTable[];
#endif
static const PRInt32 kBoxSizingKTable[];
static const PRInt32 kCaptionSideKTable[];
static const PRInt32 kClearKTable[];

View File

@ -48,7 +48,9 @@ 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);
#ifdef INCLUDE_XUL
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#endif
#define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; }
@ -973,6 +975,41 @@ void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
fputs(buffer, out);
}
#ifdef INCLUDE_XUL
// --- nsCSSXUL -----------------
nsCSSXUL::nsCSSXUL(void)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::nsCSSXUL(const nsCSSXUL& aCopy)
: mBoxOrient(aCopy.mBoxOrient)
{
MOZ_COUNT_CTOR(nsCSSXUL);
}
nsCSSXUL::~nsCSSXUL(void)
{
MOZ_COUNT_DTOR(nsCSSXUL);
}
const nsID& nsCSSXUL::GetID(void)
{
return kCSSXULSID;
}
void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
{
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoString buffer;
mBoxOrient.AppendToString(buffer, eCSSProperty_box_orient);
fputs(buffer, out);
}
#endif // INCLUDE_XUL
// --- nsCSSDeclaration -----------------
@ -1042,6 +1079,9 @@ protected:
nsCSSContent* mContent;
nsCSSUserInterface* mUserInterface;
nsCSSAural* mAural;
#ifdef INCLUDE_XUL
nsCSSXUL* mXUL;
#endif
CSSDeclarationImpl* mImportant;
@ -1084,6 +1124,9 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy)
DECL_IF_COPY(Content);
DECL_IF_COPY(UserInterface);
DECL_IF_COPY(Aural);
#ifdef INCLUDE_XUL
DECL_IF_COPY(XUL);
#endif
#ifdef DEBUG_REFS
++gInstanceCount;
@ -1126,6 +1169,9 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void)
CSS_IF_DELETE(mContent);
CSS_IF_DELETE(mUserInterface);
CSS_IF_DELETE(mAural);
#ifdef INCLUDE_XUL
CSS_IF_DELETE(mXUL);
#endif
NS_IF_RELEASE(mImportant);
CSS_IF_DELETE(mOrder);
@ -1161,7 +1207,11 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr)
CSS_IF_GET_ELSE(aSID, Page, aDataPtr)
CSS_IF_GET_ELSE(aSID, Content, aDataPtr)
CSS_IF_GET_ELSE(aSID, UserInterface, aDataPtr)
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) {
CSS_IF_GET_ELSE(aSID, Aural, aDataPtr)
#ifdef INCLUDE_XUL
CSS_IF_GET_ELSE(aSID, XUL, aDataPtr)
#endif
{
return NS_NOINTERFACE;
}
return NS_OK;
@ -1692,6 +1742,18 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_ENSURE(XUL) {
switch (aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient = aValue; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -2427,6 +2489,20 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
CSS_ENSURE_IMPORTANT(XUL) {
switch (aProperty) {
CSS_CASE_IMPORTANT(eCSSProperty_box_orient, mXUL->mBoxOrient);
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3101,6 +3177,18 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
CSS_CHECK(XUL) {
switch(aProperty) {
case eCSSProperty_box_orient: mXUL->mBoxOrient.Reset(); break;
CSS_BOGUS_DEFAULT; // Make compiler happy
}
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -3828,6 +3916,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue)
}
break;
#ifdef INCLUDE_XUL
// nsCSSXUL
case eCSSProperty_box_orient:
if (nsnull != mXUL) {
switch (aProperty) {
case eCSSProperty_box_orient: aValue = mXUL->mBoxOrient; break;
CSS_BOGUS_DEFAULT; // make compiler happy
}
}
else {
aValue.Reset();
}
break;
#endif
// nsCSSAural
case eCSSProperty_azimuth:
case eCSSProperty_elevation:
@ -4615,6 +4718,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
if(mUserInterface && uniqueItems->AddItem(mUserInterface)){
aSize += sizeof(*mUserInterface);
}
#ifdef INCLUDE_XUL
if(mXUL && uniqueItems->AddItem(mXUL)){
aSize += sizeof(*mXUL);
}
#endif
if(mAural && uniqueItems->AddItem(mAural)){
aSize += sizeof(*mAural);
}

View File

@ -78,6 +78,9 @@ static NS_DEFINE_IID(kCSSContentSID, NS_CSS_CONTENT_SID);
static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID);
static NS_DEFINE_IID(kCSSBreaksSID, NS_CSS_BREAKS_SID);
static NS_DEFINE_IID(kCSSPageSID, NS_CSS_PAGE_SID);
#ifdef INCLUDE_XUL
static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID);
#endif
// -- nsCSSSelector -------------------------------
@ -3319,6 +3322,34 @@ MapDeclarationPrintInto(nsICSSDeclaration* aDeclaration,
}
}
#ifdef INCLUDE_XUL
static void
MapDeclarationXULInto(nsICSSDeclaration* aDeclaration,
nsIMutableStyleContext* aContext, nsIStyleContext* aParentContext,
nsStyleFont* aFont, nsIPresContext* aPresContext)
{
nsCSSXUL* ourXUL;
if (NS_OK == aDeclaration->GetData(kCSSXULSID, (nsCSSStruct**)&ourXUL)) {
if (nsnull != ourXUL) {
nsStyleXUL* xul = (nsStyleXUL*)aContext->GetMutableStyleData(eStyleStruct_XUL);
const nsStyleXUL* parentXUL = xul;
if (nsnull != aParentContext) {
parentXUL = (const nsStyleXUL*)aParentContext->GetStyleData(eStyleStruct_XUL);
}
// box-orient: enum, inherit
if (eCSSUnit_Enumerated == ourXUL->mBoxOrient.GetUnit()) {
xul->mBoxOrient = ourXUL->mBoxOrient.GetIntValue();
}
else if (eCSSUnit_Inherit == ourXUL->mBoxOrient.GetUnit()) {
xul->mBoxOrient = parentXUL->mBoxOrient;
}
}
}
}
#endif // INCLUDE_XUL
void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
{
@ -3336,6 +3367,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
MapDeclarationContentInto(aDeclaration, aContext, parentContext, font, aPresContext);
MapDeclarationUIInto(aDeclaration, aContext, parentContext, font, aPresContext);
MapDeclarationPrintInto(aDeclaration, aContext, parentContext, font, aPresContext);
#ifdef INCLUDE_XUL
MapDeclarationXULInto(aDeclaration, aContext, parentContext, font, aPresContext);
#endif
NS_IF_RELEASE(parentContext);
}

View File

@ -1734,6 +1734,63 @@ PRUint32 StylePrintImpl::ComputeCRC32(PRUint32 aCrc) const
#pragma mark -
#endif
#ifdef INCLUDE_XUL
// --------------------
// nsStyleXUL
//
nsStyleXUL::nsStyleXUL() { }
nsStyleXUL::~nsStyleXUL() { }
struct StyleXULImpl: public nsStyleXUL {
StyleXULImpl() { }
void ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext);
void SetFrom(const nsStyleXUL& aSource);
void CopyTo(nsStyleXUL& aDest) const;
PRInt32 CalcDifference(const StyleXULImpl& aOther) const;
PRUint32 ComputeCRC32(PRUint32 aCrc) const;
private: // These are not allowed
StyleXULImpl(const StyleXULImpl& aOther);
StyleXULImpl& operator=(const StyleXULImpl& aOther);
};
void StyleXULImpl::ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext)
{
mBoxOrient = NS_STYLE_BOX_ORIENT_HORIZONTAL;
}
void StyleXULImpl::SetFrom(const nsStyleXUL& aSource)
{
nsCRT::memcpy((nsStyleXUL*)this, &aSource, sizeof(nsStyleXUL));
}
void StyleXULImpl::CopyTo(nsStyleXUL& aDest) const
{
nsCRT::memcpy(&aDest, (const nsStyleXUL*)this, sizeof(nsStyleXUL));
}
PRInt32 StyleXULImpl::CalcDifference(const StyleXULImpl& aOther) const
{
if (mBoxOrient == aOther.mBoxOrient)
return NS_STYLE_HINT_NONE;
return NS_STYLE_HINT_REFLOW;
}
PRUint32 StyleXULImpl::ComputeCRC32(PRUint32 aCrc) const
{
PRUint32 crc = aCrc;
#ifdef COMPUTE_STYLEDATA_CRC
crc = AccumulateCRC(crc,(const char *)&mBoxOrient,sizeof(mBoxOrient));
#endif
return crc;
}
#ifdef XP_MAC
#pragma mark -
#endif
#endif // INCLUDE_XUL
//----------------------------------------------------------------------
#ifdef SHARE_STYLECONTEXTS
@ -1945,6 +2002,22 @@ void StyleOutlineImplLog::ResetFrom(const nsStyleOutline* aParent, nsIPresContex
mSetFromParent = (aParent != nsnull);
}
#ifdef INCLUDE_XUL
// StyleXULImpl mXUL;
struct StyleXULImplLog: public StyleXULImpl {
void ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext);
StyleXULImpl mInternalXUL;
bool mSetFromParent;
};
void StyleXULImplLog::ResetFrom(const nsStyleXUL* aParent, nsIPresContext* aPresContext)
{
StyleXULImpl::ResetFrom(aParent, aPresContext);
CopyTo(mInternalXUL);
mSetFromParent = (aParent != nsnull);
}
#endif // INCLUDE_XUL
#ifdef XP_MAC
#pragma mark -
#endif
@ -1996,6 +2069,9 @@ private: // all data and methods private: only friends have access
StylePaddingImplLog mPadding;
StyleBorderImplLog mBorder;
StyleOutlineImplLog mOutline;
#ifdef INCLUDE_XUL
StyleXULImplLog mXUL;
#endif
#else
StyleFontImpl mFont;
StyleColorImpl mColor;
@ -2011,6 +2087,9 @@ private: // all data and methods private: only friends have access
StylePaddingImpl mPadding;
StyleBorderImpl mBorder;
StyleOutlineImpl mOutline;
#ifdef INCLUDE_XUL
StyleXULImpl mXUL;
#endif
#endif
PRUint32 mRefCnt;
@ -2145,6 +2224,9 @@ static void LogStyleStructs(nsStyleContextData* aStyleContextData)
case eStyleStruct_Padding: printf("eStyleStruct_Padding "); sizeOfStruct = sizeof(StylePaddingImpl); break;
case eStyleStruct_Border: printf("eStyleStruct_Border "); sizeOfStruct = sizeof(StyleBorderImpl); break;
case eStyleStruct_Outline: printf("eStyleStruct_Outline "); sizeOfStruct = sizeof(StyleOutlineImpl); break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL: printf("eStyleStruct_XUL "); sizeOfStruct = sizeof(StyleXULImpl); break;
#endif
}
short percentDefault = (totalCount == 0 ? 0 : ((100 * defaultStruct[i]) / totalCount));
short percentFromParent = (defaultStruct[i] == 0 ? 0 : ((100 * setFromParent[i]) / defaultStruct[i]));
@ -2284,6 +2366,15 @@ static void LogStyleStructs(nsStyleContextData* aStyleContextData)
setFromParent[i]++;
}
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
if (aStyleContextData->mXUL.CalcDifference(aStyleContextData->mXUL.mInternalXUL) == NS_STYLE_HINT_NONE) {
defaultStruct[i]++;
if (aStyleContextData->mXUL.mSetFromParent)
setFromParent[i]++;
}
break;
#endif
}
}
@ -2330,6 +2421,9 @@ PRUint32 nsStyleContextData::ComputeCRC32(PRUint32 aCrc) const
crc = mPadding.ComputeCRC32(crc);
crc = mBorder.ComputeCRC32(crc);
crc = mOutline.ComputeCRC32(crc);
#ifdef INCLUDE_XUL
crc = mXUL.ComputeCRC32(crc);
#endif
#else
crc = 0;
#endif
@ -2467,6 +2561,9 @@ protected:
StylePaddingImpl mPadding;
StyleBorderImpl mBorder;
StyleOutlineImpl mOutline;
#ifdef INCLUDE_XUL
StyleXULImpl mXUL;
#endif
#endif // #ifdef SHARE_STYLECONTEXTS
@ -2512,6 +2609,9 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent,
mTable(),
mContent(),
mUserInterface(),
#ifdef INCLUDE_XUL
mXUL(),
#endif
mPrint()
#endif
{
@ -2900,6 +3000,9 @@ static void LogGetStyleDataCall(nsStyleStructID aSID, LogCallType aLogCallType,
case eStyleStruct_Border: printf("eStyleStruct_Border "); break;
case eStyleStruct_Outline: printf("eStyleStruct_Outline "); break;
case eStyleStruct_BorderPaddingShortcut: printf("BorderPaddingShortcut "); break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL: printf("eStyleStruct_XUL "); break;
#endif
}
short percent = 100*calls[i]/totalCalls;
short avdepth = calls[i] == 0 ? 0 : round(float(depth[i])/float(calls[i]));
@ -3028,6 +3131,11 @@ const nsStyleStruct* StyleContextImpl::GetStyleData(nsStyleStructID aSID)
case eStyleStruct_Outline:
result = & GETSCDATA(Outline);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
result = & GETSCDATA(XUL);
break;
#endif
default:
NS_ERROR("Invalid style struct id");
break;
@ -3090,6 +3198,11 @@ nsStyleStruct* StyleContextImpl::GetMutableStyleData(nsStyleStructID aSID)
case eStyleStruct_Outline:
result = & GETSCDATA(Outline);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
result = & GETSCDATA(XUL);
break;
#endif
default:
NS_ERROR("Invalid style struct id");
break;
@ -3170,6 +3283,11 @@ StyleContextImpl::GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const
case eStyleStruct_Outline:
GETSCDATA(Outline).CopyTo((nsStyleOutline&)aStruct);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
GETSCDATA(XUL).CopyTo((nsStyleXUL&)aStruct);
break;
#endif
case eStyleStruct_BorderPaddingShortcut: {
nsMargin border, padding;
if (GETSCDATA(Border).GetBorder(border)) {
@ -3239,6 +3357,11 @@ StyleContextImpl::SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct)
case eStyleStruct_Outline:
GETSCDATA(Outline).SetFrom((const nsStyleOutline&)aStruct);
break;
#ifdef INCLUDE_XUL
case eStyleStruct_XUL:
GETSCDATA(XUL).SetFrom((const nsStyleXUL&)aStruct);
break;
#endif
default:
NS_ERROR("Invalid style struct id");
result = NS_ERROR_INVALID_ARG;
@ -3299,6 +3422,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
GETSCDATA(Padding).ResetFrom(&(mParent->GETSCDATA(Padding)), aPresContext);
GETSCDATA(Border).ResetFrom(&(mParent->GETSCDATA(Border)), aPresContext);
GETSCDATA(Outline).ResetFrom(&(mParent->GETSCDATA(Outline)), aPresContext);
#ifdef INCLUDE_XUL
GETSCDATA(XUL).ResetFrom(&(mParent->GETSCDATA(XUL)), aPresContext);
#endif
}
else {
GETSCDATA(Font).ResetFrom(nsnull, aPresContext);
@ -3315,6 +3441,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
GETSCDATA(Padding).ResetFrom(nsnull, aPresContext);
GETSCDATA(Border).ResetFrom(nsnull, aPresContext);
GETSCDATA(Outline).ResetFrom(nsnull, aPresContext);
#ifdef INCLUDE_XUL
GETSCDATA(XUL).ResetFrom(nsnull, aPresContext);
#endif
}
PRUint32 cnt = 0;
@ -3396,6 +3525,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
GETSCDATA(Padding).ResetFrom(nsnull, aPresContext);
GETSCDATA(Border).ResetFrom(nsnull, aPresContext);
GETSCDATA(Outline).ResetFrom(nsnull, aPresContext);
#ifdef INCLUDE_XUL
GETSCDATA(XUL).ResetFrom(nsnull, aPresContext);
#endif
GETSCDATA(Display).mVisible = visible;
GETSCDATA(Display).mDirection = direction;
GETSCDATA(Display).mLanguage = language;
@ -3589,6 +3721,15 @@ StyleContextImpl::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint,PR
aHint = hint;
}
}
#ifdef INCLUDE_XUL
if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;
if (aHint < NS_STYLE_HINT_MAX) {
hint = GETSCDATA(XUL).CalcDifference(other->GETSCDATA(XUL));
if (aHint < hint) {
aHint = hint;
}
}
#endif
}
return NS_OK;
}
@ -3897,6 +4038,10 @@ void StyleContextImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
totalSize += (long)sizeof(GETSCDATA(Border));
printf( " - StyleOutlineImpl: %ld\n", (long)sizeof(GETSCDATA(Outline)));
totalSize += (long)sizeof(GETSCDATA(Outline));
#ifdef INCLUDE_XUL
printf( " - StyleXULImpl: %ld\n", (long)sizeof(GETSCDATA(XUL)));
totalSize += (long)sizeof(GETSCDATA(XUL));
#endif
printf( " - Total: %ld\n", (long)totalSize);
printf( "*************************************\n");
}