added char support

update to new property and keyword enums and apis
removed warnings
This commit is contained in:
peterl%netscape.com 1999-07-18 00:28:43 +00:00
parent 64ca5956b4
commit 72465e27a5
6 changed files with 30 additions and 21 deletions

View File

@ -17,9 +17,7 @@
*/
#include "nsCSSValue.h"
#include "nsString.h"
//#include "nsCRT.h"
#include "nsCSSProps.h"
#include "nsCSSPropIDs.h"
#include "nsUnitConversion.h"
//#include "nsStyleConsts.h"
@ -186,6 +184,9 @@ nscoord nsCSSValue::GetLengthTwips(void) const
return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Cicero:
return NS_CICEROS_TO_TWIPS(mValue.mFloat);
default:
NS_ERROR("should never get here");
break;
}
}
return 0;
@ -271,14 +272,14 @@ void nsCSSValue::SetNormalValue(void)
mUnit = eCSSUnit_Normal;
}
void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const
{
if (eCSSUnit_Null == mUnit) {
return;
}
if (-1 < aPropID) {
aBuffer.Append(nsCSSProps::kNameTable[aPropID].name);
aBuffer.Append(nsCSSProps::GetStringValue(aPropID));
aBuffer.Append(": ");
}
@ -366,7 +367,7 @@ void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
aBuffer.Append(' ');
}
void nsCSSValue::ToString(nsString& aBuffer, PRInt32 aPropID) const
void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const
{
aBuffer.Truncate();
AppendToString(aBuffer, aPropID);

View File

@ -22,6 +22,7 @@
#include "nsColor.h"
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSProps.h"
enum nsCSSUnit {
@ -67,6 +68,7 @@ enum nsCSSUnit {
eCSSUnit_EN = 801, // (float) .5 em
eCSSUnit_XHeight = 802, // (float) distance from top of lower case x to baseline
eCSSUnit_CapHeight = 803, // (float) distance from top of uppercase case H to baseline
eCSSUnit_Char = 804, // (float) number of characters, used for width with monospace font
// Screen relative measure
eCSSUnit_Pixel = 900, // (float)
@ -131,8 +133,8 @@ public:
void SetNormalValue(void);
// debugging methods only
void AppendToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
void ToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
void AppendToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const;
void ToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const;
protected:
nsCSSUnit mUnit;

View File

@ -17,9 +17,7 @@
*/
#include "nsCSSValue.h"
#include "nsString.h"
//#include "nsCRT.h"
#include "nsCSSProps.h"
#include "nsCSSPropIDs.h"
#include "nsUnitConversion.h"
//#include "nsStyleConsts.h"
@ -186,6 +184,9 @@ nscoord nsCSSValue::GetLengthTwips(void) const
return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Cicero:
return NS_CICEROS_TO_TWIPS(mValue.mFloat);
default:
NS_ERROR("should never get here");
break;
}
}
return 0;
@ -271,14 +272,14 @@ void nsCSSValue::SetNormalValue(void)
mUnit = eCSSUnit_Normal;
}
void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const
{
if (eCSSUnit_Null == mUnit) {
return;
}
if (-1 < aPropID) {
aBuffer.Append(nsCSSProps::kNameTable[aPropID].name);
aBuffer.Append(nsCSSProps::GetStringValue(aPropID));
aBuffer.Append(": ");
}
@ -366,7 +367,7 @@ void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
aBuffer.Append(' ');
}
void nsCSSValue::ToString(nsString& aBuffer, PRInt32 aPropID) const
void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const
{
aBuffer.Truncate();
AppendToString(aBuffer, aPropID);

View File

@ -22,6 +22,7 @@
#include "nsColor.h"
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSProps.h"
enum nsCSSUnit {
@ -67,6 +68,7 @@ enum nsCSSUnit {
eCSSUnit_EN = 801, // (float) .5 em
eCSSUnit_XHeight = 802, // (float) distance from top of lower case x to baseline
eCSSUnit_CapHeight = 803, // (float) distance from top of uppercase case H to baseline
eCSSUnit_Char = 804, // (float) number of characters, used for width with monospace font
// Screen relative measure
eCSSUnit_Pixel = 900, // (float)
@ -131,8 +133,8 @@ public:
void SetNormalValue(void);
// debugging methods only
void AppendToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
void ToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
void AppendToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const;
void ToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const;
protected:
nsCSSUnit mUnit;

View File

@ -17,9 +17,7 @@
*/
#include "nsCSSValue.h"
#include "nsString.h"
//#include "nsCRT.h"
#include "nsCSSProps.h"
#include "nsCSSPropIDs.h"
#include "nsUnitConversion.h"
//#include "nsStyleConsts.h"
@ -186,6 +184,9 @@ nscoord nsCSSValue::GetLengthTwips(void) const
return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Cicero:
return NS_CICEROS_TO_TWIPS(mValue.mFloat);
default:
NS_ERROR("should never get here");
break;
}
}
return 0;
@ -271,14 +272,14 @@ void nsCSSValue::SetNormalValue(void)
mUnit = eCSSUnit_Normal;
}
void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const
{
if (eCSSUnit_Null == mUnit) {
return;
}
if (-1 < aPropID) {
aBuffer.Append(nsCSSProps::kNameTable[aPropID].name);
aBuffer.Append(nsCSSProps::GetStringValue(aPropID));
aBuffer.Append(": ");
}
@ -366,7 +367,7 @@ void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
aBuffer.Append(' ');
}
void nsCSSValue::ToString(nsString& aBuffer, PRInt32 aPropID) const
void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const
{
aBuffer.Truncate();
AppendToString(aBuffer, aPropID);

View File

@ -22,6 +22,7 @@
#include "nsColor.h"
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSProps.h"
enum nsCSSUnit {
@ -67,6 +68,7 @@ enum nsCSSUnit {
eCSSUnit_EN = 801, // (float) .5 em
eCSSUnit_XHeight = 802, // (float) distance from top of lower case x to baseline
eCSSUnit_CapHeight = 803, // (float) distance from top of uppercase case H to baseline
eCSSUnit_Char = 804, // (float) number of characters, used for width with monospace font
// Screen relative measure
eCSSUnit_Pixel = 900, // (float)
@ -131,8 +133,8 @@ public:
void SetNormalValue(void);
// debugging methods only
void AppendToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
void ToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
void AppendToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const;
void ToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const;
protected:
nsCSSUnit mUnit;