Fixing bug 161042. If a table cell doesn't have an align attribute, ask the cell's row for the alignment. r=peterv@netscape.com, sr=bzbarsky@mit.edu

git-svn-id: svn://10.0.0.236/trunk@129193 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2002-09-11 01:57:40 +00:00
parent bf86951e60
commit 29bd38f228
2 changed files with 34 additions and 6 deletions

View File

@@ -280,7 +280,6 @@ nsHTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
NS_IMPL_STRING_ATTR(nsHTMLTableCellElement, Abbr, abbr)
NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableCellElement, Align, align, "left")
NS_IMPL_STRING_ATTR(nsHTMLTableCellElement, Axis, axis)
NS_IMPL_STRING_ATTR(nsHTMLTableCellElement, BgColor, bgcolor)
NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableCellElement, Ch, _char, ".")
@@ -295,6 +294,32 @@ NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableCellElement, VAlign, valign, "middl
NS_IMPL_STRING_ATTR(nsHTMLTableCellElement, Width, width)
NS_IMETHODIMP
nsHTMLTableCellElement::GetAlign(nsAString& aValue)
{
nsresult rv = GetAttr(kNameSpaceID_None, nsHTMLAtoms::align, aValue);
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
// There's no align attribute, ask the row for the alignment.
nsCOMPtr<nsIDOMHTMLTableRowElement> row;
GetRow(getter_AddRefs(row));
if (row) {
return row->GetAlign(aValue);
}
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableCellElement::SetAlign(const nsAString& aValue)
{
return SetAttr(kNameSpaceID_None, nsHTMLAtoms::align, aValue, PR_TRUE);
}
static nsGenericHTMLElement::EnumTable kCellScopeTable[] = {
{ "row", NS_STYLE_CELL_SCOPE_ROW },
{ "col", NS_STYLE_CELL_SCOPE_COL },

View File

@@ -529,13 +529,16 @@ NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableRowElement, VAlign, valign, "middle
NS_IMETHODIMP
nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute,
const nsAString& aValue,
nsHTMLValue& aResult)
const nsAString& aValue,
nsHTMLValue& aResult)
{
/* ignore these attributes, stored simply as strings
ch
/*
* ignore these attributes, stored simply as strings
*
* ch
*/
/* attributes that resolve to integers with default=0*/
/* attributes that resolve to integers with default = 0 */
if (aAttribute == nsHTMLAtoms::charoff) {
if (ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;