PRInt32 maxChange, minChange = NS_STYLE_HINT_NONE;
nsChangeHint maxChange = NS_STYLE_HINT_NONE, minChange = NS_STYLE_HINT_NONE;
MapAttributesInto(nsIPresContext* aPresContext,                  nsIContent*     aCellContent,                  nsIFrame*       aCellFrame,                  nsIFrame*       aCellInnerFrame){  nsTableCellFrame* cellFrame = NS_STATIC_CAST(nsTableCellFrame*, aCellFrame);  nsTableCellFrame* sibling;  PRInt32 rowIndex, colIndex;  nsresult rv = cellFrame->GetCellIndexes(rowIndex, colIndex);  NS_ASSERTION(NS_SUCCEEDED(rv), "cannot find the position of the cell frame");  if (NS_FAILED(rv)) return;  nsIFrame* tableFrame;  nsIFrame* rowgroupFrame;  nsIFrame* rowFrame;  cellFrame->GetParent(&rowFrame);  rowFrame->GetParent(&rowgroupFrame);  rowgroupFrame->GetParent(&tableFrame);  DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TABLE_ROW);  DEBUG_VERIFY_THAT_FRAME_IS(rowgroupFrame, TABLE_ROW_GROUP);  DEBUG_VERIFY_THAT_FRAME_IS(tableFrame, TABLE);#ifdef NS_DEBUG  PRBool originates;  ((nsTableFrame*)tableFrame)->GetCellInfoAt(rowIndex, colIndex, &originates);  NS_ASSERTION(originates, "internal error");#endif  nsIAtom* atom;  PRUnichar* attr;  nsAutoString value;  PRBool hasChanged = PR_FALSE;  NS_NAMED_LITERAL_STRING(trueStr, "true");  //////////////////////////////////////  // process attributes that depend on the index of the row:  // rowalign, rowlines  // see if the rowalign attribute is not already set  atom = nsMathMLAtoms::rowalign_;  rv = aCellContent->GetAttr(kNameSpaceID_None, atom, value);  if (NS_CONTENT_ATTR_NOT_THERE == rv) {    // see if the rowalign attribute was specified on the row    attr = GetValueAt(aPresContext, rowFrame, atom, rowIndex);    if (!attr) {    	// see if the rowalign attribute was specified on the table      attr = GetValueAt(aPresContext, tableFrame, atom, rowIndex);    }    // set the attribute without notifying that we want a reflow    if (attr) {      hasChanged = PR_TRUE;      aCellContent->SetAttr(kNameSpaceID_None, atom, nsDependentString(attr), PR_FALSE);    }  }  // if we are not on the first row, see if |rowlines| was specified on the table.  // Note that we pass 'rowIndex-1' because the CSS rule in mathml.css is associated  // to 'border-top', and it is as if we draw the line on behalf of the previous cell.  // This way of doing so allows us to handle selective lines, [row]\hline[row][row]',  // and cases of spanning cells without further complications.  if (rowIndex > 0) {    attr = GetValueAt(aPresContext, tableFrame, nsMathMLAtoms::rowlines_, rowIndex-1);    // set the special -moz-math-rowline without notifying that we want a reflow    if (attr) {      hasChanged = PR_TRUE;      aCellContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::rowline, nsDependentString(attr), PR_FALSE);    }  }  else {    // set the special -moz-math-firstrow to annotate that we are on the first row    hasChanged = PR_TRUE;    aCellContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::firstrow, trueStr, PR_FALSE);  }  // if we are on the last row, set the special -moz-math-lastrow  PRInt32 rowSpan = ((nsTableFrame*)tableFrame)->GetEffectiveRowSpan(*cellFrame);  sibling = ((nsTableFrame*)tableFrame)->GetCellFrameAt(rowIndex+rowSpan, colIndex);  if (!sibling) {    hasChanged = PR_TRUE;    aCellContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::lastrow, trueStr, PR_FALSE);  }  //////////////////////////////////////  // process attributes that depend on the index of the column:  // columnalign, columnlines, XXX need columnwidth too  // see if the columnalign attribute is not already set  atom = nsMathMLAtoms::columnalign_;  rv = aCellContent->GetAttr(kNameSpaceID_None, atom, value);  if (NS_CONTENT_ATTR_NOT_THERE == rv) {    // see if the columnalign attribute was specified on the row    attr = GetValueAt(aPresContext, rowFrame, atom, colIndex);    if (!attr) {    	// see if the columnalign attribute was specified on the table      attr = GetValueAt(aPresContext, tableFrame, atom, colIndex);    }    if (attr) {      hasChanged = PR_TRUE;      aCellContent->SetAttr(kNameSpaceID_None, atom, nsDependentString(attr), PR_FALSE);    }  }  // if we are not on the first column, see if |columnlines| was specified on  // the table. Note that we pass 'colIndex-1' because the CSS rule in mathml.css  // is associated to 'border-left', and it is as if we draw the line on behalf  // of the previous cell. This way of doing so allows us to handle selective lines,  // e.g., 'r|cl', and cases of spanning cells without further complications.  if (colIndex > 0) {    attr = GetValueAt(aPresContext, tableFrame, nsMathMLAtoms::columnlines_, colIndex-1);    // set the special -moz-math-columnline without notifying that we want a reflow    if (attr) {      hasChanged = PR_TRUE;      aCellContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::columnline, nsDependentString(attr), PR_FALSE);    }  }  else {    // set the special -moz-math-firstcolumn to annotate that we are on the first column    hasChanged = PR_TRUE;    aCellContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::firstcolumn, trueStr, PR_FALSE);  }  // if we are on the last column, set the special -moz-math-lastcolumn  PRInt32 colSpan = ((nsTableFrame*)tableFrame)->GetEffectiveColSpan(*cellFrame);  sibling = ((nsTableFrame*)tableFrame)->GetCellFrameAt(rowIndex, colIndex+colSpan);  if (!sibling) {    hasChanged = PR_TRUE;    aCellContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::lastcolumn, trueStr, PR_FALSE);  }  // now, re-resolve the style contexts in our subtree to pick up any changes  if (hasChanged) {    nsCOMPtr<nsIPresShell> presShell;    aPresContext->GetShell(getter_AddRefs(presShell));    if (presShell) {      nsCOMPtr<nsIFrameManager> fm;      presShell->GetFrameManager(getter_AddRefs(fm));      if (fm) {        PRInt32 maxChange, minChange = NS_STYLE_HINT_NONE;        nsStyleChangeList changeList;        fm->ComputeStyleChangeFor(aPresContext, aCellFrame, kNameSpaceID_None, nsnull,                                  changeList, minChange, maxChange);      }    }  }}