moved from nsCSSDeclaration
git-svn-id: svn://10.0.0.236/trunk@12255 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
344
mozilla/content/html/style/src/nsCSSValue.cpp
Normal file
344
mozilla/content/html/style/src/nsCSSValue.cpp
Normal file
@@ -0,0 +1,344 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsString.h"
|
||||
//#include "nsCRT.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSPropIDs.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
//#include "nsStyleConsts.h"
|
||||
|
||||
|
||||
nsCSSValue::nsCSSValue(nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION(mUnit <= eCSSUnit_Normal, "not a valueless unit");
|
||||
if (aUnit > eCSSUnit_Normal) {
|
||||
mUnit = eCSSUnit_Null;
|
||||
}
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit), "not an int value");
|
||||
if ((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit)) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Percent <= aUnit, "not a float value");
|
||||
if (eCSSUnit_Percent <= aUnit) {
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(const nsString& aValue)
|
||||
: mUnit(eCSSUnit_String)
|
||||
{
|
||||
mValue.mString = aValue.ToNewString();
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(nscolor aValue)
|
||||
: mUnit(eCSSUnit_Color)
|
||||
{
|
||||
mValue.mColor = aValue;
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
|
||||
: mUnit(aCopy.mUnit)
|
||||
{
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != aCopy.mValue.mString) {
|
||||
mValue.mString = (aCopy.mValue.mString)->ToNewString();
|
||||
}
|
||||
else {
|
||||
mValue.mString = nsnull;
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
mValue.mColor = aCopy.mValue.mColor;
|
||||
}
|
||||
else {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::~nsCSSValue(void)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
nsCSSValue& nsCSSValue::operator=(const nsCSSValue& aCopy)
|
||||
{
|
||||
Reset();
|
||||
mUnit = aCopy.mUnit;
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != aCopy.mValue.mString) {
|
||||
mValue.mString = (aCopy.mValue.mString)->ToNewString();
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
mValue.mColor = aCopy.mValue.mColor;
|
||||
}
|
||||
else {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PRBool nsCSSValue::operator==(const nsCSSValue& aOther) const
|
||||
{
|
||||
if (mUnit == aOther.mUnit) {
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull == mValue.mString) {
|
||||
if (nsnull == aOther.mValue.mString) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (nsnull != aOther.mValue.mString) {
|
||||
return mValue.mString->Equals(*(aOther.mValue.mString));
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
return PRBool(mValue.mInt == aOther.mValue.mInt);
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
return PRBool(mValue.mColor == aOther.mValue.mColor);
|
||||
}
|
||||
else {
|
||||
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nscoord nsCSSValue::GetLengthTwips(void) const
|
||||
{
|
||||
NS_ASSERTION(IsFixedLengthUnit(), "not a fixed length unit");
|
||||
|
||||
if (IsFixedLengthUnit()) {
|
||||
switch (mUnit) {
|
||||
case eCSSUnit_Inch:
|
||||
return NS_INCHES_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Foot:
|
||||
return NS_FEET_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Mile:
|
||||
return NS_MILES_TO_TWIPS(mValue.mFloat);
|
||||
|
||||
case eCSSUnit_Millimeter:
|
||||
return NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Centimeter:
|
||||
return NS_CENTIMETERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Meter:
|
||||
return NS_METERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Kilometer:
|
||||
return NS_KILOMETERS_TO_TWIPS(mValue.mFloat);
|
||||
|
||||
case eCSSUnit_Point:
|
||||
return NSFloatPointsToTwips(mValue.mFloat);
|
||||
case eCSSUnit_Pica:
|
||||
return NS_PICAS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Didot:
|
||||
return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Cicero:
|
||||
return NS_CICEROS_TO_TWIPS(mValue.mFloat);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nsCSSValue::Reset(void)
|
||||
{
|
||||
if ((eCSSUnit_String == mUnit) && (nsnull != mValue.mString)) {
|
||||
delete mValue.mString;
|
||||
}
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
};
|
||||
|
||||
void nsCSSValue::SetIntValue(PRInt32 aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit), "not an int value");
|
||||
Reset();
|
||||
if ((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit)) {
|
||||
mUnit = aUnit;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSValue::SetPercentValue(float aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Percent;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Number <= aUnit, "not a float value");
|
||||
Reset();
|
||||
if (eCSSUnit_Number <= aUnit) {
|
||||
mUnit = aUnit;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSValue::SetStringValue(const nsString& aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_String;
|
||||
mValue.mString = aValue.ToNewString();
|
||||
}
|
||||
|
||||
void nsCSSValue::SetColorValue(nscolor aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Color;
|
||||
mValue.mColor = aValue;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetAutoValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Auto;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetInheritValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Inherit;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetNoneValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_None;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetNormalValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Normal;
|
||||
}
|
||||
|
||||
void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
|
||||
{
|
||||
if (eCSSUnit_Null == mUnit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (-1 < aPropID) {
|
||||
aBuffer.Append(nsCSSProps::kNameTable[aPropID].name);
|
||||
aBuffer.Append(": ");
|
||||
}
|
||||
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != mValue.mString) {
|
||||
aBuffer.Append('"');
|
||||
aBuffer.Append(*(mValue.mString));
|
||||
aBuffer.Append('"');
|
||||
}
|
||||
else {
|
||||
aBuffer.Append("null str");
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
aBuffer.Append(mValue.mInt, 10);
|
||||
aBuffer.Append("[0x");
|
||||
aBuffer.Append(mValue.mInt, 16);
|
||||
aBuffer.Append(']');
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
aBuffer.Append("(0x");
|
||||
aBuffer.Append(NS_GET_R(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_G(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_B(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_A(mValue.mColor), 16);
|
||||
aBuffer.Append(')');
|
||||
}
|
||||
else if (eCSSUnit_Percent == mUnit) {
|
||||
aBuffer.Append(mValue.mFloat * 100.0f);
|
||||
}
|
||||
else if (eCSSUnit_Percent < mUnit) {
|
||||
aBuffer.Append(mValue.mFloat);
|
||||
}
|
||||
|
||||
switch (mUnit) {
|
||||
case eCSSUnit_Null: break;
|
||||
case eCSSUnit_Auto: aBuffer.Append("auto"); break;
|
||||
case eCSSUnit_Inherit: aBuffer.Append("inherit"); break;
|
||||
case eCSSUnit_None: aBuffer.Append("none"); break;
|
||||
case eCSSUnit_String: break;
|
||||
case eCSSUnit_Integer: aBuffer.Append("int"); break;
|
||||
case eCSSUnit_Enumerated: aBuffer.Append("enum"); break;
|
||||
case eCSSUnit_Color: aBuffer.Append("rbga"); break;
|
||||
case eCSSUnit_Percent: aBuffer.Append("%"); break;
|
||||
case eCSSUnit_Number: aBuffer.Append("#"); break;
|
||||
case eCSSUnit_Inch: aBuffer.Append("in"); break;
|
||||
case eCSSUnit_Foot: aBuffer.Append("ft"); break;
|
||||
case eCSSUnit_Mile: aBuffer.Append("mi"); break;
|
||||
case eCSSUnit_Millimeter: aBuffer.Append("mm"); break;
|
||||
case eCSSUnit_Centimeter: aBuffer.Append("cm"); break;
|
||||
case eCSSUnit_Meter: aBuffer.Append("m"); break;
|
||||
case eCSSUnit_Kilometer: aBuffer.Append("km"); break;
|
||||
case eCSSUnit_Point: aBuffer.Append("pt"); break;
|
||||
case eCSSUnit_Pica: aBuffer.Append("pc"); break;
|
||||
case eCSSUnit_Didot: aBuffer.Append("dt"); break;
|
||||
case eCSSUnit_Cicero: aBuffer.Append("cc"); break;
|
||||
case eCSSUnit_EM: aBuffer.Append("em"); break;
|
||||
case eCSSUnit_EN: aBuffer.Append("en"); break;
|
||||
case eCSSUnit_XHeight: aBuffer.Append("ex"); break;
|
||||
case eCSSUnit_CapHeight: aBuffer.Append("cap"); break;
|
||||
case eCSSUnit_Pixel: aBuffer.Append("px"); break;
|
||||
}
|
||||
aBuffer.Append(' ');
|
||||
}
|
||||
|
||||
void nsCSSValue::ToString(nsString& aBuffer, PRInt32 aPropID) const
|
||||
{
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer, aPropID);
|
||||
}
|
||||
|
||||
173
mozilla/content/html/style/src/nsCSSValue.h
Normal file
173
mozilla/content/html/style/src/nsCSSValue.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsCSSValue_h___
|
||||
#define nsCSSValue_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
|
||||
|
||||
enum nsCSSUnit {
|
||||
eCSSUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
eCSSUnit_Auto = 1, // (n/a) value is algorithmic
|
||||
eCSSUnit_Inherit = 2, // (n/a) value is inherited
|
||||
eCSSUnit_None = 3, // (n/a) value is none
|
||||
eCSSUnit_Normal = 4, // (n/a) value is normal (algorithmic, different than auto)
|
||||
eCSSUnit_String = 10, // (nsString) a string value
|
||||
eCSSUnit_Integer = 50, // (int) simple value
|
||||
eCSSUnit_Enumerated = 51, // (int) value has enumerated meaning
|
||||
eCSSUnit_Color = 80, // (color) an RGBA value
|
||||
eCSSUnit_Percent = 90, // (float) 1.0 == 100%) value is percentage of something
|
||||
eCSSUnit_Number = 91, // (float) value is numeric (usually multiplier, different behavior that percent)
|
||||
|
||||
// US English
|
||||
eCSSUnit_Inch = 100, // (float) Standard length
|
||||
eCSSUnit_Foot = 101, // (float) 12 inches
|
||||
eCSSUnit_Mile = 102, // (float) 5280 feet
|
||||
|
||||
// Metric
|
||||
eCSSUnit_Millimeter = 207, // (float) 1/1000 meter
|
||||
eCSSUnit_Centimeter = 208, // (float) 1/100 meter
|
||||
eCSSUnit_Meter = 210, // (float) Standard length
|
||||
eCSSUnit_Kilometer = 213, // (float) 1000 meters
|
||||
|
||||
// US Typographic
|
||||
eCSSUnit_Point = 300, // (float) 1/72 inch
|
||||
eCSSUnit_Pica = 301, // (float) 12 points == 1/6 inch
|
||||
|
||||
// European Typographic
|
||||
eCSSUnit_Didot = 400, // (float) 15 didots == 16 points
|
||||
eCSSUnit_Cicero = 401, // (float) 12 didots
|
||||
|
||||
// relative units
|
||||
// Font relative measure
|
||||
eCSSUnit_EM = 800, // (float) == current font size
|
||||
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
|
||||
|
||||
// Screen relative measure
|
||||
eCSSUnit_Pixel = 900 // (float)
|
||||
};
|
||||
|
||||
class nsCSSValue {
|
||||
public:
|
||||
nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null); // for valueless units only (null, auto, inherit, none, normal)
|
||||
nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(float aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(const nsString& aValue);
|
||||
nsCSSValue(nscolor aValue);
|
||||
nsCSSValue(const nsCSSValue& aCopy);
|
||||
~nsCSSValue(void);
|
||||
|
||||
nsCSSValue& operator=(const nsCSSValue& aCopy);
|
||||
PRBool operator==(const nsCSSValue& aOther) const;
|
||||
|
||||
nsCSSUnit GetUnit(void) const { return mUnit; };
|
||||
PRBool IsLengthUnit(void) const
|
||||
{ return PRBool(eCSSUnit_Inch <= mUnit); }
|
||||
PRBool IsFixedLengthUnit(void) const
|
||||
{ return PRBool((eCSSUnit_Inch <= mUnit) && (mUnit < eCSSUnit_EM)); }
|
||||
PRBool IsRelativeLengthUnit(void) const
|
||||
{ return PRBool(eCSSUnit_EM <= mUnit); }
|
||||
|
||||
PRInt32 GetIntValue(void) const;
|
||||
float GetPercentValue(void) const;
|
||||
float GetFloatValue(void) const;
|
||||
nsString& GetStringValue(nsString& aBuffer) const;
|
||||
nscolor GetColorValue(void) const;
|
||||
nscoord GetLengthTwips(void) const;
|
||||
|
||||
void Reset(void); // sets to null
|
||||
void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit);
|
||||
void SetPercentValue(float aValue);
|
||||
void SetFloatValue(float aValue, nsCSSUnit aUnit);
|
||||
void SetStringValue(const nsString& aValue);
|
||||
void SetColorValue(nscolor aValue);
|
||||
void SetAutoValue(void);
|
||||
void SetInheritValue(void);
|
||||
void SetNoneValue(void);
|
||||
void SetNormalValue(void);
|
||||
|
||||
// debugging methods only
|
||||
void AppendToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
|
||||
void ToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
|
||||
|
||||
protected:
|
||||
nsCSSUnit mUnit;
|
||||
union {
|
||||
PRInt32 mInt;
|
||||
float mFloat;
|
||||
nsString* mString;
|
||||
nscolor mColor;
|
||||
} mValue;
|
||||
};
|
||||
|
||||
inline PRInt32 nsCSSValue::GetIntValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Integer) ||
|
||||
(mUnit == eCSSUnit_Enumerated), "not an int value");
|
||||
if ((mUnit == eCSSUnit_Integer) ||
|
||||
(mUnit == eCSSUnit_Enumerated)) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float nsCSSValue::GetPercentValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Percent), "not a percent value");
|
||||
if ((mUnit == eCSSUnit_Percent)) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float nsCSSValue::GetFloatValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit >= eCSSUnit_Number), "not a float value");
|
||||
if ((mUnit >= eCSSUnit_Number)) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline nsString& nsCSSValue::GetStringValue(nsString& aBuffer) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_String), "not a string value");
|
||||
aBuffer.Truncate();
|
||||
if ((mUnit == eCSSUnit_String) && (nsnull != mValue.mString)) {
|
||||
aBuffer.Append(*(mValue.mString));
|
||||
}
|
||||
return aBuffer;
|
||||
}
|
||||
|
||||
inline nscolor nsCSSValue::GetColorValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Color), "not a color value");
|
||||
if (mUnit == eCSSUnit_Color) {
|
||||
return mValue.mColor;
|
||||
}
|
||||
return NS_RGB(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
#endif /* nsCSSValue_h___ */
|
||||
|
||||
344
mozilla/layout/html/style/src/nsCSSValue.cpp
Normal file
344
mozilla/layout/html/style/src/nsCSSValue.cpp
Normal file
@@ -0,0 +1,344 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsString.h"
|
||||
//#include "nsCRT.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSPropIDs.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
//#include "nsStyleConsts.h"
|
||||
|
||||
|
||||
nsCSSValue::nsCSSValue(nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION(mUnit <= eCSSUnit_Normal, "not a valueless unit");
|
||||
if (aUnit > eCSSUnit_Normal) {
|
||||
mUnit = eCSSUnit_Null;
|
||||
}
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit), "not an int value");
|
||||
if ((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit)) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Percent <= aUnit, "not a float value");
|
||||
if (eCSSUnit_Percent <= aUnit) {
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(const nsString& aValue)
|
||||
: mUnit(eCSSUnit_String)
|
||||
{
|
||||
mValue.mString = aValue.ToNewString();
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(nscolor aValue)
|
||||
: mUnit(eCSSUnit_Color)
|
||||
{
|
||||
mValue.mColor = aValue;
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
|
||||
: mUnit(aCopy.mUnit)
|
||||
{
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != aCopy.mValue.mString) {
|
||||
mValue.mString = (aCopy.mValue.mString)->ToNewString();
|
||||
}
|
||||
else {
|
||||
mValue.mString = nsnull;
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
mValue.mColor = aCopy.mValue.mColor;
|
||||
}
|
||||
else {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::~nsCSSValue(void)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
nsCSSValue& nsCSSValue::operator=(const nsCSSValue& aCopy)
|
||||
{
|
||||
Reset();
|
||||
mUnit = aCopy.mUnit;
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != aCopy.mValue.mString) {
|
||||
mValue.mString = (aCopy.mValue.mString)->ToNewString();
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
mValue.mColor = aCopy.mValue.mColor;
|
||||
}
|
||||
else {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PRBool nsCSSValue::operator==(const nsCSSValue& aOther) const
|
||||
{
|
||||
if (mUnit == aOther.mUnit) {
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull == mValue.mString) {
|
||||
if (nsnull == aOther.mValue.mString) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (nsnull != aOther.mValue.mString) {
|
||||
return mValue.mString->Equals(*(aOther.mValue.mString));
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
return PRBool(mValue.mInt == aOther.mValue.mInt);
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
return PRBool(mValue.mColor == aOther.mValue.mColor);
|
||||
}
|
||||
else {
|
||||
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nscoord nsCSSValue::GetLengthTwips(void) const
|
||||
{
|
||||
NS_ASSERTION(IsFixedLengthUnit(), "not a fixed length unit");
|
||||
|
||||
if (IsFixedLengthUnit()) {
|
||||
switch (mUnit) {
|
||||
case eCSSUnit_Inch:
|
||||
return NS_INCHES_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Foot:
|
||||
return NS_FEET_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Mile:
|
||||
return NS_MILES_TO_TWIPS(mValue.mFloat);
|
||||
|
||||
case eCSSUnit_Millimeter:
|
||||
return NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Centimeter:
|
||||
return NS_CENTIMETERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Meter:
|
||||
return NS_METERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Kilometer:
|
||||
return NS_KILOMETERS_TO_TWIPS(mValue.mFloat);
|
||||
|
||||
case eCSSUnit_Point:
|
||||
return NSFloatPointsToTwips(mValue.mFloat);
|
||||
case eCSSUnit_Pica:
|
||||
return NS_PICAS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Didot:
|
||||
return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Cicero:
|
||||
return NS_CICEROS_TO_TWIPS(mValue.mFloat);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nsCSSValue::Reset(void)
|
||||
{
|
||||
if ((eCSSUnit_String == mUnit) && (nsnull != mValue.mString)) {
|
||||
delete mValue.mString;
|
||||
}
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
};
|
||||
|
||||
void nsCSSValue::SetIntValue(PRInt32 aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit), "not an int value");
|
||||
Reset();
|
||||
if ((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit)) {
|
||||
mUnit = aUnit;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSValue::SetPercentValue(float aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Percent;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Number <= aUnit, "not a float value");
|
||||
Reset();
|
||||
if (eCSSUnit_Number <= aUnit) {
|
||||
mUnit = aUnit;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSValue::SetStringValue(const nsString& aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_String;
|
||||
mValue.mString = aValue.ToNewString();
|
||||
}
|
||||
|
||||
void nsCSSValue::SetColorValue(nscolor aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Color;
|
||||
mValue.mColor = aValue;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetAutoValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Auto;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetInheritValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Inherit;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetNoneValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_None;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetNormalValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Normal;
|
||||
}
|
||||
|
||||
void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
|
||||
{
|
||||
if (eCSSUnit_Null == mUnit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (-1 < aPropID) {
|
||||
aBuffer.Append(nsCSSProps::kNameTable[aPropID].name);
|
||||
aBuffer.Append(": ");
|
||||
}
|
||||
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != mValue.mString) {
|
||||
aBuffer.Append('"');
|
||||
aBuffer.Append(*(mValue.mString));
|
||||
aBuffer.Append('"');
|
||||
}
|
||||
else {
|
||||
aBuffer.Append("null str");
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
aBuffer.Append(mValue.mInt, 10);
|
||||
aBuffer.Append("[0x");
|
||||
aBuffer.Append(mValue.mInt, 16);
|
||||
aBuffer.Append(']');
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
aBuffer.Append("(0x");
|
||||
aBuffer.Append(NS_GET_R(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_G(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_B(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_A(mValue.mColor), 16);
|
||||
aBuffer.Append(')');
|
||||
}
|
||||
else if (eCSSUnit_Percent == mUnit) {
|
||||
aBuffer.Append(mValue.mFloat * 100.0f);
|
||||
}
|
||||
else if (eCSSUnit_Percent < mUnit) {
|
||||
aBuffer.Append(mValue.mFloat);
|
||||
}
|
||||
|
||||
switch (mUnit) {
|
||||
case eCSSUnit_Null: break;
|
||||
case eCSSUnit_Auto: aBuffer.Append("auto"); break;
|
||||
case eCSSUnit_Inherit: aBuffer.Append("inherit"); break;
|
||||
case eCSSUnit_None: aBuffer.Append("none"); break;
|
||||
case eCSSUnit_String: break;
|
||||
case eCSSUnit_Integer: aBuffer.Append("int"); break;
|
||||
case eCSSUnit_Enumerated: aBuffer.Append("enum"); break;
|
||||
case eCSSUnit_Color: aBuffer.Append("rbga"); break;
|
||||
case eCSSUnit_Percent: aBuffer.Append("%"); break;
|
||||
case eCSSUnit_Number: aBuffer.Append("#"); break;
|
||||
case eCSSUnit_Inch: aBuffer.Append("in"); break;
|
||||
case eCSSUnit_Foot: aBuffer.Append("ft"); break;
|
||||
case eCSSUnit_Mile: aBuffer.Append("mi"); break;
|
||||
case eCSSUnit_Millimeter: aBuffer.Append("mm"); break;
|
||||
case eCSSUnit_Centimeter: aBuffer.Append("cm"); break;
|
||||
case eCSSUnit_Meter: aBuffer.Append("m"); break;
|
||||
case eCSSUnit_Kilometer: aBuffer.Append("km"); break;
|
||||
case eCSSUnit_Point: aBuffer.Append("pt"); break;
|
||||
case eCSSUnit_Pica: aBuffer.Append("pc"); break;
|
||||
case eCSSUnit_Didot: aBuffer.Append("dt"); break;
|
||||
case eCSSUnit_Cicero: aBuffer.Append("cc"); break;
|
||||
case eCSSUnit_EM: aBuffer.Append("em"); break;
|
||||
case eCSSUnit_EN: aBuffer.Append("en"); break;
|
||||
case eCSSUnit_XHeight: aBuffer.Append("ex"); break;
|
||||
case eCSSUnit_CapHeight: aBuffer.Append("cap"); break;
|
||||
case eCSSUnit_Pixel: aBuffer.Append("px"); break;
|
||||
}
|
||||
aBuffer.Append(' ');
|
||||
}
|
||||
|
||||
void nsCSSValue::ToString(nsString& aBuffer, PRInt32 aPropID) const
|
||||
{
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer, aPropID);
|
||||
}
|
||||
|
||||
173
mozilla/layout/html/style/src/nsCSSValue.h
Normal file
173
mozilla/layout/html/style/src/nsCSSValue.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsCSSValue_h___
|
||||
#define nsCSSValue_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
|
||||
|
||||
enum nsCSSUnit {
|
||||
eCSSUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
eCSSUnit_Auto = 1, // (n/a) value is algorithmic
|
||||
eCSSUnit_Inherit = 2, // (n/a) value is inherited
|
||||
eCSSUnit_None = 3, // (n/a) value is none
|
||||
eCSSUnit_Normal = 4, // (n/a) value is normal (algorithmic, different than auto)
|
||||
eCSSUnit_String = 10, // (nsString) a string value
|
||||
eCSSUnit_Integer = 50, // (int) simple value
|
||||
eCSSUnit_Enumerated = 51, // (int) value has enumerated meaning
|
||||
eCSSUnit_Color = 80, // (color) an RGBA value
|
||||
eCSSUnit_Percent = 90, // (float) 1.0 == 100%) value is percentage of something
|
||||
eCSSUnit_Number = 91, // (float) value is numeric (usually multiplier, different behavior that percent)
|
||||
|
||||
// US English
|
||||
eCSSUnit_Inch = 100, // (float) Standard length
|
||||
eCSSUnit_Foot = 101, // (float) 12 inches
|
||||
eCSSUnit_Mile = 102, // (float) 5280 feet
|
||||
|
||||
// Metric
|
||||
eCSSUnit_Millimeter = 207, // (float) 1/1000 meter
|
||||
eCSSUnit_Centimeter = 208, // (float) 1/100 meter
|
||||
eCSSUnit_Meter = 210, // (float) Standard length
|
||||
eCSSUnit_Kilometer = 213, // (float) 1000 meters
|
||||
|
||||
// US Typographic
|
||||
eCSSUnit_Point = 300, // (float) 1/72 inch
|
||||
eCSSUnit_Pica = 301, // (float) 12 points == 1/6 inch
|
||||
|
||||
// European Typographic
|
||||
eCSSUnit_Didot = 400, // (float) 15 didots == 16 points
|
||||
eCSSUnit_Cicero = 401, // (float) 12 didots
|
||||
|
||||
// relative units
|
||||
// Font relative measure
|
||||
eCSSUnit_EM = 800, // (float) == current font size
|
||||
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
|
||||
|
||||
// Screen relative measure
|
||||
eCSSUnit_Pixel = 900 // (float)
|
||||
};
|
||||
|
||||
class nsCSSValue {
|
||||
public:
|
||||
nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null); // for valueless units only (null, auto, inherit, none, normal)
|
||||
nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(float aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(const nsString& aValue);
|
||||
nsCSSValue(nscolor aValue);
|
||||
nsCSSValue(const nsCSSValue& aCopy);
|
||||
~nsCSSValue(void);
|
||||
|
||||
nsCSSValue& operator=(const nsCSSValue& aCopy);
|
||||
PRBool operator==(const nsCSSValue& aOther) const;
|
||||
|
||||
nsCSSUnit GetUnit(void) const { return mUnit; };
|
||||
PRBool IsLengthUnit(void) const
|
||||
{ return PRBool(eCSSUnit_Inch <= mUnit); }
|
||||
PRBool IsFixedLengthUnit(void) const
|
||||
{ return PRBool((eCSSUnit_Inch <= mUnit) && (mUnit < eCSSUnit_EM)); }
|
||||
PRBool IsRelativeLengthUnit(void) const
|
||||
{ return PRBool(eCSSUnit_EM <= mUnit); }
|
||||
|
||||
PRInt32 GetIntValue(void) const;
|
||||
float GetPercentValue(void) const;
|
||||
float GetFloatValue(void) const;
|
||||
nsString& GetStringValue(nsString& aBuffer) const;
|
||||
nscolor GetColorValue(void) const;
|
||||
nscoord GetLengthTwips(void) const;
|
||||
|
||||
void Reset(void); // sets to null
|
||||
void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit);
|
||||
void SetPercentValue(float aValue);
|
||||
void SetFloatValue(float aValue, nsCSSUnit aUnit);
|
||||
void SetStringValue(const nsString& aValue);
|
||||
void SetColorValue(nscolor aValue);
|
||||
void SetAutoValue(void);
|
||||
void SetInheritValue(void);
|
||||
void SetNoneValue(void);
|
||||
void SetNormalValue(void);
|
||||
|
||||
// debugging methods only
|
||||
void AppendToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
|
||||
void ToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
|
||||
|
||||
protected:
|
||||
nsCSSUnit mUnit;
|
||||
union {
|
||||
PRInt32 mInt;
|
||||
float mFloat;
|
||||
nsString* mString;
|
||||
nscolor mColor;
|
||||
} mValue;
|
||||
};
|
||||
|
||||
inline PRInt32 nsCSSValue::GetIntValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Integer) ||
|
||||
(mUnit == eCSSUnit_Enumerated), "not an int value");
|
||||
if ((mUnit == eCSSUnit_Integer) ||
|
||||
(mUnit == eCSSUnit_Enumerated)) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float nsCSSValue::GetPercentValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Percent), "not a percent value");
|
||||
if ((mUnit == eCSSUnit_Percent)) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float nsCSSValue::GetFloatValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit >= eCSSUnit_Number), "not a float value");
|
||||
if ((mUnit >= eCSSUnit_Number)) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline nsString& nsCSSValue::GetStringValue(nsString& aBuffer) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_String), "not a string value");
|
||||
aBuffer.Truncate();
|
||||
if ((mUnit == eCSSUnit_String) && (nsnull != mValue.mString)) {
|
||||
aBuffer.Append(*(mValue.mString));
|
||||
}
|
||||
return aBuffer;
|
||||
}
|
||||
|
||||
inline nscolor nsCSSValue::GetColorValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Color), "not a color value");
|
||||
if (mUnit == eCSSUnit_Color) {
|
||||
return mValue.mColor;
|
||||
}
|
||||
return NS_RGB(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
#endif /* nsCSSValue_h___ */
|
||||
|
||||
344
mozilla/layout/style/nsCSSValue.cpp
Normal file
344
mozilla/layout/style/nsCSSValue.cpp
Normal file
@@ -0,0 +1,344 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsString.h"
|
||||
//#include "nsCRT.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSPropIDs.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
//#include "nsStyleConsts.h"
|
||||
|
||||
|
||||
nsCSSValue::nsCSSValue(nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION(mUnit <= eCSSUnit_Normal, "not a valueless unit");
|
||||
if (aUnit > eCSSUnit_Normal) {
|
||||
mUnit = eCSSUnit_Null;
|
||||
}
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit), "not an int value");
|
||||
if ((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit)) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit)
|
||||
: mUnit(aUnit)
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Percent <= aUnit, "not a float value");
|
||||
if (eCSSUnit_Percent <= aUnit) {
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(const nsString& aValue)
|
||||
: mUnit(eCSSUnit_String)
|
||||
{
|
||||
mValue.mString = aValue.ToNewString();
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(nscolor aValue)
|
||||
: mUnit(eCSSUnit_Color)
|
||||
{
|
||||
mValue.mColor = aValue;
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
|
||||
: mUnit(aCopy.mUnit)
|
||||
{
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != aCopy.mValue.mString) {
|
||||
mValue.mString = (aCopy.mValue.mString)->ToNewString();
|
||||
}
|
||||
else {
|
||||
mValue.mString = nsnull;
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
mValue.mColor = aCopy.mValue.mColor;
|
||||
}
|
||||
else {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue::~nsCSSValue(void)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
nsCSSValue& nsCSSValue::operator=(const nsCSSValue& aCopy)
|
||||
{
|
||||
Reset();
|
||||
mUnit = aCopy.mUnit;
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != aCopy.mValue.mString) {
|
||||
mValue.mString = (aCopy.mValue.mString)->ToNewString();
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
mValue.mColor = aCopy.mValue.mColor;
|
||||
}
|
||||
else {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PRBool nsCSSValue::operator==(const nsCSSValue& aOther) const
|
||||
{
|
||||
if (mUnit == aOther.mUnit) {
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull == mValue.mString) {
|
||||
if (nsnull == aOther.mValue.mString) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (nsnull != aOther.mValue.mString) {
|
||||
return mValue.mString->Equals(*(aOther.mValue.mString));
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
return PRBool(mValue.mInt == aOther.mValue.mInt);
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
return PRBool(mValue.mColor == aOther.mValue.mColor);
|
||||
}
|
||||
else {
|
||||
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nscoord nsCSSValue::GetLengthTwips(void) const
|
||||
{
|
||||
NS_ASSERTION(IsFixedLengthUnit(), "not a fixed length unit");
|
||||
|
||||
if (IsFixedLengthUnit()) {
|
||||
switch (mUnit) {
|
||||
case eCSSUnit_Inch:
|
||||
return NS_INCHES_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Foot:
|
||||
return NS_FEET_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Mile:
|
||||
return NS_MILES_TO_TWIPS(mValue.mFloat);
|
||||
|
||||
case eCSSUnit_Millimeter:
|
||||
return NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Centimeter:
|
||||
return NS_CENTIMETERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Meter:
|
||||
return NS_METERS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Kilometer:
|
||||
return NS_KILOMETERS_TO_TWIPS(mValue.mFloat);
|
||||
|
||||
case eCSSUnit_Point:
|
||||
return NSFloatPointsToTwips(mValue.mFloat);
|
||||
case eCSSUnit_Pica:
|
||||
return NS_PICAS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Didot:
|
||||
return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
|
||||
case eCSSUnit_Cicero:
|
||||
return NS_CICEROS_TO_TWIPS(mValue.mFloat);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nsCSSValue::Reset(void)
|
||||
{
|
||||
if ((eCSSUnit_String == mUnit) && (nsnull != mValue.mString)) {
|
||||
delete mValue.mString;
|
||||
}
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
};
|
||||
|
||||
void nsCSSValue::SetIntValue(PRInt32 aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit), "not an int value");
|
||||
Reset();
|
||||
if ((eCSSUnit_Integer == aUnit) ||
|
||||
(eCSSUnit_Enumerated == aUnit)) {
|
||||
mUnit = aUnit;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSValue::SetPercentValue(float aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Percent;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
NS_ASSERTION(eCSSUnit_Number <= aUnit, "not a float value");
|
||||
Reset();
|
||||
if (eCSSUnit_Number <= aUnit) {
|
||||
mUnit = aUnit;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSValue::SetStringValue(const nsString& aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_String;
|
||||
mValue.mString = aValue.ToNewString();
|
||||
}
|
||||
|
||||
void nsCSSValue::SetColorValue(nscolor aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Color;
|
||||
mValue.mColor = aValue;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetAutoValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Auto;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetInheritValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Inherit;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetNoneValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_None;
|
||||
}
|
||||
|
||||
void nsCSSValue::SetNormalValue(void)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_Normal;
|
||||
}
|
||||
|
||||
void nsCSSValue::AppendToString(nsString& aBuffer, PRInt32 aPropID) const
|
||||
{
|
||||
if (eCSSUnit_Null == mUnit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (-1 < aPropID) {
|
||||
aBuffer.Append(nsCSSProps::kNameTable[aPropID].name);
|
||||
aBuffer.Append(": ");
|
||||
}
|
||||
|
||||
if (eCSSUnit_String == mUnit) {
|
||||
if (nsnull != mValue.mString) {
|
||||
aBuffer.Append('"');
|
||||
aBuffer.Append(*(mValue.mString));
|
||||
aBuffer.Append('"');
|
||||
}
|
||||
else {
|
||||
aBuffer.Append("null str");
|
||||
}
|
||||
}
|
||||
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
|
||||
aBuffer.Append(mValue.mInt, 10);
|
||||
aBuffer.Append("[0x");
|
||||
aBuffer.Append(mValue.mInt, 16);
|
||||
aBuffer.Append(']');
|
||||
}
|
||||
else if (eCSSUnit_Color == mUnit){
|
||||
aBuffer.Append("(0x");
|
||||
aBuffer.Append(NS_GET_R(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_G(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_B(mValue.mColor), 16);
|
||||
aBuffer.Append(" 0x");
|
||||
aBuffer.Append(NS_GET_A(mValue.mColor), 16);
|
||||
aBuffer.Append(')');
|
||||
}
|
||||
else if (eCSSUnit_Percent == mUnit) {
|
||||
aBuffer.Append(mValue.mFloat * 100.0f);
|
||||
}
|
||||
else if (eCSSUnit_Percent < mUnit) {
|
||||
aBuffer.Append(mValue.mFloat);
|
||||
}
|
||||
|
||||
switch (mUnit) {
|
||||
case eCSSUnit_Null: break;
|
||||
case eCSSUnit_Auto: aBuffer.Append("auto"); break;
|
||||
case eCSSUnit_Inherit: aBuffer.Append("inherit"); break;
|
||||
case eCSSUnit_None: aBuffer.Append("none"); break;
|
||||
case eCSSUnit_String: break;
|
||||
case eCSSUnit_Integer: aBuffer.Append("int"); break;
|
||||
case eCSSUnit_Enumerated: aBuffer.Append("enum"); break;
|
||||
case eCSSUnit_Color: aBuffer.Append("rbga"); break;
|
||||
case eCSSUnit_Percent: aBuffer.Append("%"); break;
|
||||
case eCSSUnit_Number: aBuffer.Append("#"); break;
|
||||
case eCSSUnit_Inch: aBuffer.Append("in"); break;
|
||||
case eCSSUnit_Foot: aBuffer.Append("ft"); break;
|
||||
case eCSSUnit_Mile: aBuffer.Append("mi"); break;
|
||||
case eCSSUnit_Millimeter: aBuffer.Append("mm"); break;
|
||||
case eCSSUnit_Centimeter: aBuffer.Append("cm"); break;
|
||||
case eCSSUnit_Meter: aBuffer.Append("m"); break;
|
||||
case eCSSUnit_Kilometer: aBuffer.Append("km"); break;
|
||||
case eCSSUnit_Point: aBuffer.Append("pt"); break;
|
||||
case eCSSUnit_Pica: aBuffer.Append("pc"); break;
|
||||
case eCSSUnit_Didot: aBuffer.Append("dt"); break;
|
||||
case eCSSUnit_Cicero: aBuffer.Append("cc"); break;
|
||||
case eCSSUnit_EM: aBuffer.Append("em"); break;
|
||||
case eCSSUnit_EN: aBuffer.Append("en"); break;
|
||||
case eCSSUnit_XHeight: aBuffer.Append("ex"); break;
|
||||
case eCSSUnit_CapHeight: aBuffer.Append("cap"); break;
|
||||
case eCSSUnit_Pixel: aBuffer.Append("px"); break;
|
||||
}
|
||||
aBuffer.Append(' ');
|
||||
}
|
||||
|
||||
void nsCSSValue::ToString(nsString& aBuffer, PRInt32 aPropID) const
|
||||
{
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer, aPropID);
|
||||
}
|
||||
|
||||
173
mozilla/layout/style/nsCSSValue.h
Normal file
173
mozilla/layout/style/nsCSSValue.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsCSSValue_h___
|
||||
#define nsCSSValue_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCoord.h"
|
||||
|
||||
|
||||
enum nsCSSUnit {
|
||||
eCSSUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
eCSSUnit_Auto = 1, // (n/a) value is algorithmic
|
||||
eCSSUnit_Inherit = 2, // (n/a) value is inherited
|
||||
eCSSUnit_None = 3, // (n/a) value is none
|
||||
eCSSUnit_Normal = 4, // (n/a) value is normal (algorithmic, different than auto)
|
||||
eCSSUnit_String = 10, // (nsString) a string value
|
||||
eCSSUnit_Integer = 50, // (int) simple value
|
||||
eCSSUnit_Enumerated = 51, // (int) value has enumerated meaning
|
||||
eCSSUnit_Color = 80, // (color) an RGBA value
|
||||
eCSSUnit_Percent = 90, // (float) 1.0 == 100%) value is percentage of something
|
||||
eCSSUnit_Number = 91, // (float) value is numeric (usually multiplier, different behavior that percent)
|
||||
|
||||
// US English
|
||||
eCSSUnit_Inch = 100, // (float) Standard length
|
||||
eCSSUnit_Foot = 101, // (float) 12 inches
|
||||
eCSSUnit_Mile = 102, // (float) 5280 feet
|
||||
|
||||
// Metric
|
||||
eCSSUnit_Millimeter = 207, // (float) 1/1000 meter
|
||||
eCSSUnit_Centimeter = 208, // (float) 1/100 meter
|
||||
eCSSUnit_Meter = 210, // (float) Standard length
|
||||
eCSSUnit_Kilometer = 213, // (float) 1000 meters
|
||||
|
||||
// US Typographic
|
||||
eCSSUnit_Point = 300, // (float) 1/72 inch
|
||||
eCSSUnit_Pica = 301, // (float) 12 points == 1/6 inch
|
||||
|
||||
// European Typographic
|
||||
eCSSUnit_Didot = 400, // (float) 15 didots == 16 points
|
||||
eCSSUnit_Cicero = 401, // (float) 12 didots
|
||||
|
||||
// relative units
|
||||
// Font relative measure
|
||||
eCSSUnit_EM = 800, // (float) == current font size
|
||||
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
|
||||
|
||||
// Screen relative measure
|
||||
eCSSUnit_Pixel = 900 // (float)
|
||||
};
|
||||
|
||||
class nsCSSValue {
|
||||
public:
|
||||
nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null); // for valueless units only (null, auto, inherit, none, normal)
|
||||
nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(float aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(const nsString& aValue);
|
||||
nsCSSValue(nscolor aValue);
|
||||
nsCSSValue(const nsCSSValue& aCopy);
|
||||
~nsCSSValue(void);
|
||||
|
||||
nsCSSValue& operator=(const nsCSSValue& aCopy);
|
||||
PRBool operator==(const nsCSSValue& aOther) const;
|
||||
|
||||
nsCSSUnit GetUnit(void) const { return mUnit; };
|
||||
PRBool IsLengthUnit(void) const
|
||||
{ return PRBool(eCSSUnit_Inch <= mUnit); }
|
||||
PRBool IsFixedLengthUnit(void) const
|
||||
{ return PRBool((eCSSUnit_Inch <= mUnit) && (mUnit < eCSSUnit_EM)); }
|
||||
PRBool IsRelativeLengthUnit(void) const
|
||||
{ return PRBool(eCSSUnit_EM <= mUnit); }
|
||||
|
||||
PRInt32 GetIntValue(void) const;
|
||||
float GetPercentValue(void) const;
|
||||
float GetFloatValue(void) const;
|
||||
nsString& GetStringValue(nsString& aBuffer) const;
|
||||
nscolor GetColorValue(void) const;
|
||||
nscoord GetLengthTwips(void) const;
|
||||
|
||||
void Reset(void); // sets to null
|
||||
void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit);
|
||||
void SetPercentValue(float aValue);
|
||||
void SetFloatValue(float aValue, nsCSSUnit aUnit);
|
||||
void SetStringValue(const nsString& aValue);
|
||||
void SetColorValue(nscolor aValue);
|
||||
void SetAutoValue(void);
|
||||
void SetInheritValue(void);
|
||||
void SetNoneValue(void);
|
||||
void SetNormalValue(void);
|
||||
|
||||
// debugging methods only
|
||||
void AppendToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
|
||||
void ToString(nsString& aBuffer, PRInt32 aPropID = -1) const;
|
||||
|
||||
protected:
|
||||
nsCSSUnit mUnit;
|
||||
union {
|
||||
PRInt32 mInt;
|
||||
float mFloat;
|
||||
nsString* mString;
|
||||
nscolor mColor;
|
||||
} mValue;
|
||||
};
|
||||
|
||||
inline PRInt32 nsCSSValue::GetIntValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Integer) ||
|
||||
(mUnit == eCSSUnit_Enumerated), "not an int value");
|
||||
if ((mUnit == eCSSUnit_Integer) ||
|
||||
(mUnit == eCSSUnit_Enumerated)) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float nsCSSValue::GetPercentValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Percent), "not a percent value");
|
||||
if ((mUnit == eCSSUnit_Percent)) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float nsCSSValue::GetFloatValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit >= eCSSUnit_Number), "not a float value");
|
||||
if ((mUnit >= eCSSUnit_Number)) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline nsString& nsCSSValue::GetStringValue(nsString& aBuffer) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_String), "not a string value");
|
||||
aBuffer.Truncate();
|
||||
if ((mUnit == eCSSUnit_String) && (nsnull != mValue.mString)) {
|
||||
aBuffer.Append(*(mValue.mString));
|
||||
}
|
||||
return aBuffer;
|
||||
}
|
||||
|
||||
inline nscolor nsCSSValue::GetColorValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eCSSUnit_Color), "not a color value");
|
||||
if (mUnit == eCSSUnit_Color) {
|
||||
return mValue.mColor;
|
||||
}
|
||||
return NS_RGB(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
#endif /* nsCSSValue_h___ */
|
||||
|
||||
Reference in New Issue
Block a user