mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 06:05:44 +00:00
Changed table code to pay attention to the ALIGN attribute
This commit is contained in:
parent
8c077bc14e
commit
341b30497d
@ -552,6 +552,25 @@ PRBool nsHTMLTagContent::DivAlignParamToString(const nsHTMLValue& aValue,
|
||||
return EnumValueToString(aValue, kDivAlignTable, aResult);
|
||||
}
|
||||
|
||||
static nsHTMLTagContent::EnumTable kTableAlignTable[] = {
|
||||
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
|
||||
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
|
||||
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
PRBool nsHTMLTagContent::ParseTableAlignParam(const nsString& aString,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return ParseEnumValue(aString, kTableAlignTable, aResult);
|
||||
}
|
||||
|
||||
PRBool nsHTMLTagContent::TableAlignParamToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult)
|
||||
{
|
||||
return EnumValueToString(aValue, kTableAlignTable, aResult);
|
||||
}
|
||||
|
||||
void nsHTMLTagContent::ParseValueOrPercent(const nsString& aString,
|
||||
nsHTMLValue& aResult,
|
||||
nsHTMLUnit aValueUnit)
|
||||
|
@ -170,6 +170,11 @@ public:
|
||||
static PRBool DivAlignParamToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseTableAlignParam(const nsString& aString, nsHTMLValue& aRes);
|
||||
|
||||
static PRBool TableAlignParamToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
protected:
|
||||
nsHTMLTagContent();
|
||||
|
||||
|
@ -41,6 +41,7 @@ static NS_DEFINE_IID(kITableContentIID, NS_ITABLECONTENT_IID);
|
||||
static NS_DEFINE_IID(kStylePositionSID, NS_STYLEPOSITION_SID);
|
||||
static NS_DEFINE_IID(kStyleBorderSID, NS_STYLEBORDER_SID);
|
||||
static NS_DEFINE_IID(kStyleSpacingSID, NS_STYLESPACING_SID);
|
||||
static NS_DEFINE_IID(kStyleDisplaySID, NS_STYLEDISPLAY_SID);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gsDebug = PR_FALSE;
|
||||
@ -1053,6 +1054,13 @@ void nsTablePart::SetAttribute(nsIAtom* aAttribute, const nsString& aValue)
|
||||
nsHTMLTagContent::SetAttribute(aAttribute, val);
|
||||
return;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::align) {
|
||||
nsHTMLValue val;
|
||||
if (ParseTableAlignParam(aValue, val)) {
|
||||
nsHTMLTagContent::SetAttribute(aAttribute, val);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void nsTablePart::MapAttributesInto(nsIStyleContext* aContext,
|
||||
@ -1082,6 +1090,23 @@ void nsTablePart::MapAttributesInto(nsIStyleContext* aContext,
|
||||
}
|
||||
// border
|
||||
GetTableBorder(this, aContext, aPresContext, PR_FALSE);
|
||||
|
||||
// align
|
||||
GetAttribute(nsHTMLAtoms::align, value);
|
||||
if (value.GetUnit() != eHTMLUnit_Null) {
|
||||
NS_ASSERTION(value.GetUnit() == eHTMLUnit_Enumerated, "unexpected unit");
|
||||
nsStyleDisplay* display = (nsStyleDisplay*)aContext->GetData(kStyleDisplaySID);
|
||||
|
||||
switch (value.GetIntValue()) {
|
||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||
display->mFloats = NS_STYLE_FLOAT_LEFT;
|
||||
break;
|
||||
|
||||
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
||||
display->mFloats = NS_STYLE_FLOAT_RIGHT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsTablePart::GetTableBorder(nsIHTMLContent* aContent,
|
||||
|
Loading…
Reference in New Issue
Block a user