Fixed up argument parsing issue with table align=left/right (bug 7352)

This commit is contained in:
kipp%netscape.com 1999-09-21 00:12:09 +00:00
Родитель afa96f78e8
Коммит c3f602b0cf
16 изменённых файлов: 204 добавлений и 84 удалений

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

@ -1690,20 +1690,6 @@ static nsGenericHTMLElement::EnumTable kScrollingStandardTable[] = {
{ 0 }
};
static nsGenericHTMLElement::EnumTable kTableHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
// The following are non-standard but necessary for Nav4 compatibility
{ "middle", NS_STYLE_TEXT_ALIGN_CENTER },
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};
static nsGenericHTMLElement::EnumTable kTableVAlignTable[] = {
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
@ -1730,13 +1716,91 @@ nsGenericHTMLElement::ParseAlignValue(const nsString& aString,
return ParseEnumValue(aString, kAlignTable, aResult);
}
//----------------------------------------
// Vanilla table as defined by the html4 spec...
static nsGenericHTMLElement::EnumTable kTableHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
{ 0 }
};
// This table is used for TABLE when in compatability mode
static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
{ "abscenter", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};
PRBool
nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString,
nsHTMLValue& aResult)
nsHTMLValue& aResult) const
{
if (InNavQuirksMode()) {
return ParseEnumValue(aString, kCompatTableHAlignTable, aResult);
}
return ParseEnumValue(aString, kTableHAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
{
if (InNavQuirksMode()) {
return EnumValueToString(aValue, kCompatTableHAlignTable, aResult);
}
return EnumValueToString(aValue, kTableHAlignTable, aResult);
}
//----------------------------------------
// This table is used for TD,TH,TR, etc (but not TABLE) when in
// compatability mode
static nsGenericHTMLElement::EnumTable kCompatTableCellHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
// Note: use compatible version of alignment constants so that
// nested tables will be right aligned or center aligned.
{ "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_MOZ_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
// The following are non-standard but necessary for Nav4 compatibility
{ "middle", NS_STYLE_TEXT_ALIGN_CENTER },
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },// XXX is this right???
{ 0 }
};
PRBool
nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString,
nsHTMLValue& aResult) const
{
if (InNavQuirksMode()) {
return ParseEnumValue(aString, kCompatTableCellHAlignTable, aResult);
}
return ParseEnumValue(aString, kTableHAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
{
if (InNavQuirksMode()) {
return EnumValueToString(aValue, kCompatTableCellHAlignTable, aResult);
}
return EnumValueToString(aValue, kTableHAlignTable, aResult);
}
//----------------------------------------
PRBool
nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString,
nsHTMLValue& aResult)
@ -1751,13 +1815,6 @@ nsGenericHTMLElement::AlignValueToString(const nsHTMLValue& aValue,
return EnumValueToString(aValue, kAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult)
{
return EnumValueToString(aValue, kTableHAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableVAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult)

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

@ -189,25 +189,28 @@ public:
PRBool ParseDivAlignValue(const nsString& aString,
nsHTMLValue& aResult) const;
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
static PRBool ParseTableHAlignValue(const nsString& aString,
nsHTMLValue& aResult);
PRBool ParseTableHAlignValue(const nsString& aString,
nsHTMLValue& aResult) const;
PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
PRBool ParseTableCellHAlignValue(const nsString& aString,
nsHTMLValue& aResult) const;
PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
static PRBool ParseTableVAlignValue(const nsString& aString,
nsHTMLValue& aResult);
static PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
static PRBool TableVAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
static PRBool AlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
static PRBool ParseImageAttribute(nsIAtom* aAttribute,
const nsString& aString,
nsHTMLValue& aResult);

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

@ -373,7 +373,7 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -407,7 +407,7 @@ nsHTMLTableCellElement::AttributeToString(nsIAtom* aAttribute,
choff, colspan, rowspan, height, width, nowrap, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -181,7 +181,7 @@ nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -205,7 +205,7 @@ nsHTMLTableColElement::AttributeToString(nsIAtom* aAttribute,
choff, span
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -170,7 +170,7 @@ nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -194,7 +194,7 @@ nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute,
choff, repeat
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -877,7 +877,7 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -920,7 +920,7 @@ nsHTMLTableElement::AttributeToString(nsIAtom* aAttribute,
border, cellpadding, cellspacing, cols, height, width, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -598,7 +598,7 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -627,7 +627,7 @@ nsHTMLTableRowElement::AttributeToString(nsIAtom* aAttribute,
choff, height, width, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -239,7 +239,7 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -269,7 +269,7 @@ nsHTMLTableSectionElement::AttributeToString(nsIAtom* aAttribute,
choff, height, width, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -1690,20 +1690,6 @@ static nsGenericHTMLElement::EnumTable kScrollingStandardTable[] = {
{ 0 }
};
static nsGenericHTMLElement::EnumTable kTableHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
// The following are non-standard but necessary for Nav4 compatibility
{ "middle", NS_STYLE_TEXT_ALIGN_CENTER },
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};
static nsGenericHTMLElement::EnumTable kTableVAlignTable[] = {
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
@ -1730,13 +1716,91 @@ nsGenericHTMLElement::ParseAlignValue(const nsString& aString,
return ParseEnumValue(aString, kAlignTable, aResult);
}
//----------------------------------------
// Vanilla table as defined by the html4 spec...
static nsGenericHTMLElement::EnumTable kTableHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
{ 0 }
};
// This table is used for TABLE when in compatability mode
static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
{ "abscenter", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};
PRBool
nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString,
nsHTMLValue& aResult)
nsHTMLValue& aResult) const
{
if (InNavQuirksMode()) {
return ParseEnumValue(aString, kCompatTableHAlignTable, aResult);
}
return ParseEnumValue(aString, kTableHAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
{
if (InNavQuirksMode()) {
return EnumValueToString(aValue, kCompatTableHAlignTable, aResult);
}
return EnumValueToString(aValue, kTableHAlignTable, aResult);
}
//----------------------------------------
// This table is used for TD,TH,TR, etc (but not TABLE) when in
// compatability mode
static nsGenericHTMLElement::EnumTable kCompatTableCellHAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
// Note: use compatible version of alignment constants so that
// nested tables will be right aligned or center aligned.
{ "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_MOZ_CENTER },
{ "char", NS_STYLE_TEXT_ALIGN_CHAR },
{ "justify",NS_STYLE_TEXT_ALIGN_JUSTIFY },
// The following are non-standard but necessary for Nav4 compatibility
{ "middle", NS_STYLE_TEXT_ALIGN_CENTER },
{ "absmiddle", NS_STYLE_TEXT_ALIGN_CENTER },// XXX is this right???
{ 0 }
};
PRBool
nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString,
nsHTMLValue& aResult) const
{
if (InNavQuirksMode()) {
return ParseEnumValue(aString, kCompatTableCellHAlignTable, aResult);
}
return ParseEnumValue(aString, kTableHAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
{
if (InNavQuirksMode()) {
return EnumValueToString(aValue, kCompatTableCellHAlignTable, aResult);
}
return EnumValueToString(aValue, kTableHAlignTable, aResult);
}
//----------------------------------------
PRBool
nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString,
nsHTMLValue& aResult)
@ -1751,13 +1815,6 @@ nsGenericHTMLElement::AlignValueToString(const nsHTMLValue& aValue,
return EnumValueToString(aValue, kAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult)
{
return EnumValueToString(aValue, kTableHAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableVAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult)

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

@ -189,25 +189,28 @@ public:
PRBool ParseDivAlignValue(const nsString& aString,
nsHTMLValue& aResult) const;
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
static PRBool ParseTableHAlignValue(const nsString& aString,
nsHTMLValue& aResult);
PRBool ParseTableHAlignValue(const nsString& aString,
nsHTMLValue& aResult) const;
PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
PRBool ParseTableCellHAlignValue(const nsString& aString,
nsHTMLValue& aResult) const;
PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
static PRBool ParseTableVAlignValue(const nsString& aString,
nsHTMLValue& aResult);
static PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
static PRBool TableVAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
static PRBool AlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
static PRBool ParseImageAttribute(nsIAtom* aAttribute,
const nsString& aString,
nsHTMLValue& aResult);

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

@ -373,7 +373,7 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -407,7 +407,7 @@ nsHTMLTableCellElement::AttributeToString(nsIAtom* aAttribute,
choff, colspan, rowspan, height, width, nowrap, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -181,7 +181,7 @@ nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -205,7 +205,7 @@ nsHTMLTableColElement::AttributeToString(nsIAtom* aAttribute,
choff, span
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -170,7 +170,7 @@ nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -194,7 +194,7 @@ nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute,
choff, repeat
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -877,7 +877,7 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -920,7 +920,7 @@ nsHTMLTableElement::AttributeToString(nsIAtom* aAttribute,
border, cellpadding, cellspacing, cols, height, width, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -598,7 +598,7 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -627,7 +627,7 @@ nsHTMLTableRowElement::AttributeToString(nsIAtom* aAttribute,
choff, height, width, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}

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

@ -239,7 +239,7 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute,
/* other attributes */
else if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseTableHAlignValue(aValue, aResult)) {
if (mInner.ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
@ -269,7 +269,7 @@ nsHTMLTableSectionElement::AttributeToString(nsIAtom* aAttribute,
choff, height, width, background, bgcolor
*/
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::TableHAlignValueToString(aValue, aResult)) {
if (mInner.TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}