enabled "physical" and "virtual" as synonyms for <textarea> "wrap" attribute value

bug = ???, it's been reassigned to someone else, this was part of a larger problem
that has mostly been fixed already
r=rods
This commit is contained in:
buster%netscape.com 2000-02-14 02:03:36 +00:00
Родитель e526225795
Коммит 86108be131
4 изменённых файлов: 30 добавлений и 28 удалений

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

@ -66,10 +66,13 @@ static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID);
// For figuring out the "WRAP" property
#define kTextControl_Wrap_Soft "SOFT"
#define kTextControl_Wrap_Virtual "VIRTUAL" // "virtual" is a synonym for "soft"
#define kTextControl_Wrap_Hard "HARD"
#define kTextControl_Wrap_Physical "PHYSICAL" // "physical" is a synonym for "hard"
#define kTextControl_Wrap_Off "OFF"
MOZ_DECL_CTOR_COUNTER(nsFormControlHelper);
nsFormControlHelper::nsFormControlHelper()
@ -180,29 +183,27 @@ nsresult
nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap& aWrapProp)
{
nsString wrap;
aWrapProp = eHTMLTextWrap_Off; // the default
nsresult result = GetWrapProperty(aContent, wrap);
if (NS_CONTENT_ATTR_NOT_THERE != result) {
nsAutoString wrapOff(kTextControl_Wrap_Off);
if (wrap.EqualsIgnoreCase(wrapOff)) {
aWrapProp = eHTMLTextWrap_Off;
return result;
}
nsAutoString wrapHard(kTextControl_Wrap_Hard);
if (wrap.EqualsIgnoreCase(wrapHard)) {
nsAutoString wrapPhysical(kTextControl_Wrap_Physical);
if (wrap.EqualsIgnoreCase(wrapHard) ||
wrap.EqualsIgnoreCase(wrapPhysical)) {
aWrapProp = eHTMLTextWrap_Hard;
return result;
}
nsAutoString wrapSoft(kTextControl_Wrap_Soft);
if (wrap.EqualsIgnoreCase(wrapSoft)) {
nsAutoString wrapVirtual(kTextControl_Wrap_Virtual);
if (wrap.EqualsIgnoreCase(wrapSoft) ||
wrap.EqualsIgnoreCase(wrapVirtual)) {
aWrapProp = eHTMLTextWrap_Soft;
return result;
}
aWrapProp = eHTMLTextWrap_Unknown;
} else {
aWrapProp = eHTMLTextWrap_Off;
}
return result;
}

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

@ -160,11 +160,11 @@ public:
static nsCompatibility GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2);
// wrap can be one of these three values.
typedef enum {
eHTMLTextWrap_Unknown = 0,
eHTMLTextWrap_Off = 1,
eHTMLTextWrap_Hard = 2,
eHTMLTextWrap_Soft = 3
eHTMLTextWrap_Off = 1, // the default
eHTMLTextWrap_Hard = 2, // "hard" or "physical"
eHTMLTextWrap_Soft = 3 // "soft" or "virtual"
} nsHTMLTextWrap;
/** returns the value of the "wrap" property in aOutValue

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

@ -66,10 +66,13 @@ static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID);
// For figuring out the "WRAP" property
#define kTextControl_Wrap_Soft "SOFT"
#define kTextControl_Wrap_Virtual "VIRTUAL" // "virtual" is a synonym for "soft"
#define kTextControl_Wrap_Hard "HARD"
#define kTextControl_Wrap_Physical "PHYSICAL" // "physical" is a synonym for "hard"
#define kTextControl_Wrap_Off "OFF"
MOZ_DECL_CTOR_COUNTER(nsFormControlHelper);
nsFormControlHelper::nsFormControlHelper()
@ -180,29 +183,27 @@ nsresult
nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap& aWrapProp)
{
nsString wrap;
aWrapProp = eHTMLTextWrap_Off; // the default
nsresult result = GetWrapProperty(aContent, wrap);
if (NS_CONTENT_ATTR_NOT_THERE != result) {
nsAutoString wrapOff(kTextControl_Wrap_Off);
if (wrap.EqualsIgnoreCase(wrapOff)) {
aWrapProp = eHTMLTextWrap_Off;
return result;
}
nsAutoString wrapHard(kTextControl_Wrap_Hard);
if (wrap.EqualsIgnoreCase(wrapHard)) {
nsAutoString wrapPhysical(kTextControl_Wrap_Physical);
if (wrap.EqualsIgnoreCase(wrapHard) ||
wrap.EqualsIgnoreCase(wrapPhysical)) {
aWrapProp = eHTMLTextWrap_Hard;
return result;
}
nsAutoString wrapSoft(kTextControl_Wrap_Soft);
if (wrap.EqualsIgnoreCase(wrapSoft)) {
nsAutoString wrapVirtual(kTextControl_Wrap_Virtual);
if (wrap.EqualsIgnoreCase(wrapSoft) ||
wrap.EqualsIgnoreCase(wrapVirtual)) {
aWrapProp = eHTMLTextWrap_Soft;
return result;
}
aWrapProp = eHTMLTextWrap_Unknown;
} else {
aWrapProp = eHTMLTextWrap_Off;
}
return result;
}

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

@ -160,11 +160,11 @@ public:
static nsCompatibility GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2);
// wrap can be one of these three values.
typedef enum {
eHTMLTextWrap_Unknown = 0,
eHTMLTextWrap_Off = 1,
eHTMLTextWrap_Hard = 2,
eHTMLTextWrap_Soft = 3
eHTMLTextWrap_Off = 1, // the default
eHTMLTextWrap_Hard = 2, // "hard" or "physical"
eHTMLTextWrap_Soft = 3 // "soft" or "virtual"
} nsHTMLTextWrap;
/** returns the value of the "wrap" property in aOutValue