NS_IMETHODIMP nsMathMLmfracFrame::TransmitAutomaticData() { // 1. The REC says: // The <mfrac> element sets displaystyle to "false", or if it was already // false increments scriptlevel by 1, within numerator and denominator. // 2. The TeXbook (Ch 17. p.141) says the numerator inherits the compression // while the denominator is compressed bool increment = !NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags); SetIncrementScriptLevel(0, increment); SetIncrementScriptLevel(1, increment); UpdatePresentationDataFromChildAt(0, -1, ~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE); UpdatePresentationDataFromChildAt(1, 1, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); // if our numerator is an embellished operator, let its state bubble to us GetEmbellishDataFrom(mFrames.FirstChild(), mEmbellishData); if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags)) { // even when embellished, we need to record that <mfrac> won't fire // Stretch() on its embellished child mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED; } return NS_OK; }
NS_IMETHODIMP nsMathMLmrootFrame::TransmitAutomaticData() { // 1. The REC says: // The <mroot> element increments scriptlevel by 2, and sets displaystyle to // "false", within index, but leaves both attributes unchanged within base. // 2. The TeXbook (Ch 17. p.141) says \sqrt is compressed UpdatePresentationDataFromChildAt(1, 1, ~NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED, NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED); UpdatePresentationDataFromChildAt(0, 0, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); return NS_OK; }
NS_IMETHODIMP nsMathMLmfracFrame::TransmitAutomaticData() { // The TeXbook (Ch 17. p.141) says the numerator inherits the compression // while the denominator is compressed UpdatePresentationDataFromChildAt(1, 1, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); // If displaystyle is false, then scriptlevel is incremented, so notify the // children of this. if (!StyleFont()->mMathDisplay) { PropagateFrameFlagFor(mFrames.FirstChild(), NS_FRAME_MATHML_SCRIPT_DESCENDANT); PropagateFrameFlagFor(mFrames.LastChild(), NS_FRAME_MATHML_SCRIPT_DESCENDANT); } // if our numerator is an embellished operator, let its state bubble to us GetEmbellishDataFrom(mFrames.FirstChild(), mEmbellishData); if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags)) { // even when embellished, we need to record that <mfrac> won't fire // Stretch() on its embellished child mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED; } return NS_OK; }
NS_IMETHODIMP nsMathMLmrootFrame::TransmitAutomaticData() { // 1. The REC says: // The <mroot> element increments scriptlevel by 2, and sets displaystyle to // "false", within index, but leaves both attributes unchanged within base. // 2. The TeXbook (Ch 17. p.141) says \sqrt is compressed UpdatePresentationDataFromChildAt(1, 1, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); UpdatePresentationDataFromChildAt(0, 0, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); PropagateFrameFlagFor(mFrames.LastChild(), NS_FRAME_MATHML_SCRIPT_DESCENDANT); return NS_OK; }
NS_IMETHODIMP nsMathMLmencloseFrame::TransmitAutomaticData() { if (IsToDraw(NOTATION_RADICAL)) { // The TeXBook (Ch 17. p.141) says that \sqrt is cramped UpdatePresentationDataFromChildAt(0, -1, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); } return NS_OK; }
NS_IMETHODIMP nsMathMLmsqrtFrame::TransmitAutomaticData() { // 1. The REC says: // The <msqrt> element leaves both attributes [displaystyle and scriptlevel] // unchanged within all its arguments. // 2. The TeXBook (Ch 17. p.141) says that \sqrt is cramped UpdatePresentationDataFromChildAt(0, -1, 0, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); return NS_OK; }
NS_IMETHODIMP nsMathMLmsubsupFrame::TransmitAutomaticData() { // if our base is an embellished operator, let its state bubble to us mPresentationData.baseFrame = mFrames.FirstChild(); GetEmbellishDataFrom(mPresentationData.baseFrame, mEmbellishData); // 1. The REC says: // The <msubsup> element increments scriptlevel by 1, and sets displaystyle to // "false", within subscript and superscript, but leaves both attributes // unchanged within base. // 2. The TeXbook (Ch 17. p.141) says the superscript inherits the compression // while the subscript is compressed UpdatePresentationDataFromChildAt(1, -1, ~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE); UpdatePresentationDataFromChildAt(1, 1, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); return NS_OK; }
NS_IMETHODIMP nsMathMLmmultiscriptsFrame::TransmitAutomaticData() { // if our base is an embellished operator, let its state bubble to us mPresentationData.baseFrame = mFrames.FirstChild(); GetEmbellishDataFrom(mPresentationData.baseFrame, mEmbellishData); // The REC says: // The <mmultiscripts> element increments scriptlevel by 1, and sets // displaystyle to "false", within each of its arguments except base UpdatePresentationDataFromChildAt(1, -1, ~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE); // The TeXbook (Ch 17. p.141) says the superscript inherits the compression // while the subscript is compressed. So here we collect subscripts and set // the compression flag in them. PRInt32 count = 0; bool isSubScript = false; nsAutoTArray<nsIFrame*, 8> subScriptFrames; nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { if (childFrame->GetContent()->Tag() == nsGkAtoms::mprescripts_) { // mprescripts frame } else if (0 == count) { // base frame } else { // super/subscript block if (isSubScript) { // subscript subScriptFrames.AppendElement(childFrame); } else { // superscript } isSubScript = !isSubScript; } count++; childFrame = childFrame->GetNextSibling(); } for (PRInt32 i = subScriptFrames.Length() - 1; i >= 0; i--) { childFrame = subScriptFrames[i]; PropagatePresentationDataFor(childFrame, NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED); } return NS_OK; }
NS_IMETHODIMP nsMathMLmsupFrame::TransmitAutomaticData() { // if our base is an embellished operator, its flags bubble to us mPresentationData.baseFrame = mFrames.FirstChild(); GetEmbellishDataFrom(mPresentationData.baseFrame, mEmbellishData); // 1. The REC says: // The <msup> element increments scriptlevel by 1, and sets displaystyle to // "false", within superscript, but leaves both attributes unchanged within base. // 2. The TeXbook (Ch 17. p.141) says the superscript *inherits* the compression, // so we don't set the compression flag. Our parent will propagate its own. UpdatePresentationDataFromChildAt(1, -1, ~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE); return NS_OK; }