nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { nsIMathMLFrame* mathMLFrame; nsresult res = childFrame->QueryInterface( NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (NS_SUCCEEDED(res) && mathMLFrame) { mathMLFrame->ReResolveScriptStyle(aPresContext, mStyleContext, mPresentationData.scriptLevel); } childFrame->GetNextSibling(&childFrame); } return NS_OK; }
nsMathMLContainerFrame::ReResolveScriptStyle(nsIPresContext*  aPresContext,                                             nsIStyleContext* aParentContext,                                             PRInt32          aParentScriptLevel){  PRInt32 gap = mPresentationData.scriptLevel - aParentScriptLevel;  if (gap) {  	// By default scriptminsize=8pt and scriptsizemultiplier=0.71    nscoord scriptminsize = NSIntPointsToTwips(NS_MATHML_SCRIPTMINSIZE);    float scriptsizemultiplier = NS_MATHML_SCRIPTSIZEMULTIPLIER;#if 0    // XXX Bug 44201    // user-supplied scriptminsize and scriptsizemultiplier that are    // restricted to particular elements are not supported because our    // css rules are fixed in mathml.css and are applicable to all elements.    // see if there is a scriptminsize attribute on a <mstyle> that wraps us    if (NS_CONTENT_ATTR_HAS_VALUE ==        GetAttribute(nsnull, mPresentationData.mstyle,                     nsMathMLAtoms::scriptminsize_, fontsize)) {      nsCSSValue cssValue;      if (ParseNumericValue(fontsize, cssValue)) {        nsCSSUnit unit = cssValue.GetUnit();        if (eCSSUnit_Number == unit)          scriptminsize = nscoord(float(scriptminsize) * cssValue.GetFloatValue());        else if (eCSSUnit_Percent == unit)          scriptminsize = nscoord(float(scriptminsize) * cssValue.GetPercentValue());        else if (eCSSUnit_Null != unit)          scriptminsize = CalcLength(aPresContext, mStyleContext, cssValue);      }    }#endif    // get the incremental factor    nsAutoString fontsize;    if (0 > gap) { // the size is going to be increased      if (gap < NS_MATHML_CSS_NEGATIVE_SCRIPTLEVEL_LIMIT)        gap = NS_MATHML_CSS_NEGATIVE_SCRIPTLEVEL_LIMIT;      gap = -gap;      scriptsizemultiplier = 1.0f / scriptsizemultiplier;      fontsize.AssignWithConversion("-");    }    else { // the size is going to be decreased      if (gap > NS_MATHML_CSS_POSITIVE_SCRIPTLEVEL_LIMIT)        gap = NS_MATHML_CSS_POSITIVE_SCRIPTLEVEL_LIMIT;      fontsize.AssignWithConversion("+");    }    fontsize.AppendInt(gap, 10);    // we want to make sure that the size will stay readable    const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,      aParentContext->GetStyleData(eStyleStruct_Font));    nscoord newFontSize = font->mFont.size;    while (0 < gap--) {      newFontSize = (nscoord)((float)(newFontSize) * scriptsizemultiplier);    }    if (newFontSize <= scriptminsize) {      fontsize.AssignWithConversion("scriptminsize");    }    // set the -moz-math-font-size attribute without notifying that we want a reflow    mContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::fontsize,                      fontsize, PR_FALSE);    // then, re-resolve the style contexts in our subtree    nsCOMPtr<nsIStyleContext> newStyleContext;    aPresContext->ResolveStyleContextFor(mContent, aParentContext,                                         PR_FALSE, getter_AddRefs(newStyleContext));    if (newStyleContext && newStyleContext.get() != mStyleContext) {      SetStyleContext(aPresContext, newStyleContext);      nsIFrame* childFrame = mFrames.FirstChild();      while (childFrame) {        aPresContext->ReParentStyleContext(childFrame, newStyleContext);        childFrame->GetNextSibling(&childFrame);      }    }  }  // let children with different scriptsizes handle that themselves   nsIFrame* childFrame = mFrames.FirstChild();  while (childFrame) {    nsIMathMLFrame* mathMLFrame;    nsresult res = childFrame->QueryInterface(      NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);    if (NS_SUCCEEDED(res) && mathMLFrame) {      mathMLFrame->ReResolveScriptStyle(aPresContext, mStyleContext,                                        mPresentationData.scriptLevel);    }    childFrame->GetNextSibling(&childFrame);  }  return NS_OK;}