diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp
index db087185cff6..5ce205c64206 100644
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -2892,6 +2892,23 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = {
{ 0 }
};
+// Elements that should return vertical align values "middle", "bottom", and "top"
+// instead of "center", "baseline", and "texttop" from GetAttribute() should use this
+static nsGenericHTMLElement::EnumTable kVAlignTable[] = {
+ { "left", NS_STYLE_TEXT_ALIGN_LEFT },
+ { "right", NS_STYLE_TEXT_ALIGN_RIGHT },
+ { "top", NS_STYLE_VERTICAL_ALIGN_TOP },//verified
+ { "texttop", NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },// verified
+ { "bottom", NS_STYLE_VERTICAL_ALIGN_BASELINE },//verified
+ { "baseline", NS_STYLE_VERTICAL_ALIGN_BASELINE },// verified
+ { "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },//verified
+ { "center", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
+ { "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },//verified
+ { "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },/* XXX not the same as ebina */
+ { "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },/* XXX ditto */
+ { 0 }
+};
+
static nsGenericHTMLElement::EnumTable kDivAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT },
@@ -3060,6 +3077,13 @@ nsGenericHTMLElement::AlignValueToString(const nsHTMLValue& aValue,
return EnumValueToString(aValue, kAlignTable, aResult);
}
+PRBool
+nsGenericHTMLElement::VAlignValueToString(const nsHTMLValue& aValue,
+ nsAWritableString& aResult)
+{
+ return EnumValueToString(aValue, kVAlignTable, aResult);
+}
+
PRBool
nsGenericHTMLElement::TableVAlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult)
diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h
index c5c222ba940a..c26e58ff0f17 100644
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -295,6 +295,9 @@ public:
static PRBool AlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult);
+ static PRBool VAlignValueToString(const nsHTMLValue& aValue,
+ nsAWritableString& aResult);
+
static PRBool ParseImageAttribute(nsIAtom* aAttribute,
const nsAReadableString& aString,
nsHTMLValue& aResult);
diff --git a/content/html/content/src/nsHTMLAppletElement.cpp b/content/html/content/src/nsHTMLAppletElement.cpp
index e51abe9c871f..42625b44b829 100644
--- a/content/html/content/src/nsHTMLAppletElement.cpp
+++ b/content/html/content/src/nsHTMLAppletElement.cpp
@@ -207,7 +207,7 @@ nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute,
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
- nsGenericHTMLElement::AlignValueToString(aValue, aResult);
+ nsGenericHTMLElement::VAlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/content/html/content/src/nsHTMLIFrameElement.cpp b/content/html/content/src/nsHTMLIFrameElement.cpp
index 704e5e4dcba2..a4c0afd46a5f 100644
--- a/content/html/content/src/nsHTMLIFrameElement.cpp
+++ b/content/html/content/src/nsHTMLIFrameElement.cpp
@@ -313,7 +313,7 @@ nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute,
}
else if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
- AlignValueToString(aValue, aResult);
+ VAlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp
index 2a9f634bd174..afb706f6beec 100644
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -583,7 +583,7 @@ nsHTMLImageElement::AttributeToString(nsIAtom* aAttribute,
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
- AlignValueToString(aValue, aResult);
+ VAlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp
index fb09e60ab9e3..0dba727ecaf6 100644
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -1445,7 +1445,7 @@ nsHTMLInputElement::AttributeToString(nsIAtom* aAttribute,
}
else if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
- AlignValueToString(aValue, aResult);
+ VAlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp
index 6a52681ced20..4716137e7918 100644
--- a/content/html/content/src/nsHTMLObjectElement.cpp
+++ b/content/html/content/src/nsHTMLObjectElement.cpp
@@ -218,7 +218,7 @@ nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute,
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
- AlignValueToString(aValue, aResult);
+ VAlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp
index 6a52681ced20..4716137e7918 100644
--- a/content/html/content/src/nsHTMLSharedObjectElement.cpp
+++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp
@@ -218,7 +218,7 @@ nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute,
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
- AlignValueToString(aValue, aResult);
+ VAlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}