mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Output correct values for 'align' attribute for img, iframe, object, applet, and input elements: b=112276, r=brade, sr=jst, a=blizzard/drivers
This commit is contained in:
parent
2862c0163e
commit
4ceb48affa
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user