Remove prescontext args for a bunch of MathML methods. Also includes the

MathML part of the patch for bug 244581.  Patch by Vidar Braut Haarr
<bugmail@q1n.org>, r=rbs, sr=bzbarsky
This commit is contained in:
bzbarsky%mit.edu 2005-02-07 01:57:50 +00:00
Родитель b1c8c66ee4
Коммит 2b1acc7897
44 изменённых файлов: 402 добавлений и 553 удалений

Просмотреть файл

@ -103,8 +103,7 @@ public:
* of the frame, on output the size after stretching.
*/
NS_IMETHOD
Stretch(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Stretch(nsIRenderingContext& aRenderingContext,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize) = 0;
@ -140,8 +139,7 @@ public:
* space you want for border/padding in the desired size you return.
*/
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize) = 0;
@ -207,11 +205,10 @@ public:
*/
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent) = 0;
InheritAutomaticData(nsIFrame* aParent) = 0;
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext) = 0;
TransmitAutomaticData() = 0;
/* UpdatePresentationData :
* Increments the scriptlevel of the frame, and updates its displaystyle and
@ -243,8 +240,7 @@ public:
* update some flags in the frame, leaving the other flags unchanged.
*/
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate) = 0;
@ -279,8 +275,7 @@ public:
* for more details about this parameter.
*/
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -315,8 +310,7 @@ public:
* http://groups.google.com/groups?selm=3A9192B5.D22B6C38%40maths.uq.edu.au
*/
NS_IMETHOD
ReResolveScriptStyle(nsPresContext* aPresContext,
PRInt32 aParentScriptLevel) = 0;
ReResolveScriptStyle(PRInt32 aParentScriptLevel) = 0;
};
// struct used by a container frame to keep track of its embellishments.

Просмотреть файл

@ -82,8 +82,7 @@ NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLContainerFrame, nsHTMLContainerFrame,
// error handlers
// provide a feedback to the user when a frame with bad markup can not be rendered
nsresult
nsMathMLContainerFrame::ReflowError(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLContainerFrame::ReflowError(nsIRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize)
{
nsresult rv;
@ -126,8 +125,7 @@ nsMathMLContainerFrame::ReflowError(nsPresContext* aPresContext,
}
nsresult
nsMathMLContainerFrame::PaintError(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLContainerFrame::PaintError(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer)
{
@ -194,8 +192,7 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra
// helper to get the preferred size that a container frame should use to fire
// the stretch on its stretchy child frames.
void
nsMathMLContainerFrame::GetPreferredStretchSize(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLContainerFrame::GetPreferredStretchSize(nsIRenderingContext& aRenderingContext,
PRUint32 aOptions,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aPreferredStretchSize)
@ -207,7 +204,7 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsPresContext* aPresContext
else if (aOptions & STRETCH_CONSIDER_EMBELLISHMENTS) {
// compute our up-to-date size using Place()
nsHTMLReflowMetrics metrics(nsnull);
Place(aPresContext, aRenderingContext, PR_FALSE, metrics);
Place(aRenderingContext, PR_FALSE, metrics);
aPreferredStretchSize = metrics.mBoundingMetrics;
}
else {
@ -283,8 +280,7 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsPresContext* aPresContext
}
NS_IMETHODIMP
nsMathMLContainerFrame::Stretch(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLContainerFrame::Stretch(nsIRenderingContext& aRenderingContext,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize)
@ -337,14 +333,14 @@ nsMathMLContainerFrame::Stretch(nsPresContext* aPresContext,
containerSize = childSize.mBoundingMetrics;
}
else {
GetPreferredStretchSize(aPresContext, aRenderingContext,
GetPreferredStretchSize(aRenderingContext,
stretchAll ? STRETCH_CONSIDER_EMBELLISHMENTS : 0,
mEmbellishData.direction, containerSize);
}
}
// do the stretching...
mathMLFrame->Stretch(aPresContext, aRenderingContext,
mathMLFrame->Stretch(aRenderingContext,
mEmbellishData.direction, containerSize, childSize);
// store the updated metrics
@ -361,7 +357,7 @@ nsMathMLContainerFrame::Stretch(nsPresContext* aPresContext,
NS_MATHML_WILL_STRETCH_ALL_CHILDREN_VERTICALLY(mPresentationData.flags) ?
NS_STRETCH_DIRECTION_VERTICAL : NS_STRETCH_DIRECTION_HORIZONTAL;
GetPreferredStretchSize(aPresContext, aRenderingContext, STRETCH_CONSIDER_EMBELLISHMENTS,
GetPreferredStretchSize(aRenderingContext, STRETCH_CONSIDER_EMBELLISHMENTS,
stretchDir, containerSize);
childFrame = mFrames.FirstChild();
@ -373,8 +369,8 @@ nsMathMLContainerFrame::Stretch(nsPresContext* aPresContext,
GetReflowAndBoundingMetricsFor(childFrame,
childSize, childSize.mBoundingMetrics);
// do the stretching...
mathMLFrame->Stretch(aPresContext, aRenderingContext,
stretchDir, containerSize, childSize);
mathMLFrame->Stretch(aRenderingContext, stretchDir,
containerSize, childSize);
// store the updated metrics
childFrame->SetRect(nsRect(childSize.descent, childSize.ascent,
childSize.width, childSize.height));
@ -385,7 +381,7 @@ nsMathMLContainerFrame::Stretch(nsPresContext* aPresContext,
}
// re-position all our children
Place(aPresContext, aRenderingContext, PR_TRUE, aDesiredStretchSize);
Place(aRenderingContext, PR_TRUE, aDesiredStretchSize);
// If our parent is not embellished, it means we are the outermost embellished
// container and so we put the spacing, otherwise we don't include the spacing,
@ -428,8 +424,7 @@ nsMathMLContainerFrame::Stretch(nsPresContext* aPresContext,
}
nsresult
nsMathMLContainerFrame::FinalizeReflow(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLContainerFrame::FinalizeReflow(nsIRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize)
{
// During reflow, we use rect.x and rect.y as placeholders for the child's ascent
@ -456,7 +451,7 @@ nsMathMLContainerFrame::FinalizeReflow(nsPresContext* aPresContext,
PRBool placeOrigin = !NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) ||
(mEmbellishData.coreFrame != this && !mEmbellishData.nextFrame &&
mEmbellishData.direction == NS_STRETCH_DIRECTION_UNSUPPORTED);
Place(aPresContext, aRenderingContext, placeOrigin, aDesiredSize);
Place(aRenderingContext, placeOrigin, aDesiredSize);
if (!placeOrigin) {
// This means the rect.x and rect.y of our children were not set!!
@ -493,11 +488,11 @@ nsMathMLContainerFrame::FinalizeReflow(nsPresContext* aPresContext,
}
else { /* case of <msup><mo>...</mo>...</msup> or friends */
// compute a size that doesn't include embellishments
GetPreferredStretchSize(aPresContext, aRenderingContext, 0,
mEmbellishData.direction, defaultSize);
GetPreferredStretchSize(aRenderingContext, 0, mEmbellishData.direction,
defaultSize);
}
Stretch(aPresContext, aRenderingContext, NS_STRETCH_DIRECTION_DEFAULT,
defaultSize, aDesiredSize);
Stretch(aRenderingContext, NS_STRETCH_DIRECTION_DEFAULT, defaultSize,
aDesiredSize);
}
}
if (aDesiredSize.mComputeMEW) {
@ -507,7 +502,7 @@ nsMathMLContainerFrame::FinalizeReflow(nsPresContext* aPresContext,
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
// see if we should fix the spacing
FixInterFrameSpacing(aPresContext, aDesiredSize);
FixInterFrameSpacing(aDesiredSize);
return NS_OK;
}
@ -523,8 +518,7 @@ nsMathMLContainerFrame::FinalizeReflow(nsPresContext* aPresContext,
// helper to let the update of presentation data pass through
// a subtree that may contain non-mathml container frames
/* static */ void
nsMathMLContainerFrame::PropagatePresentationDataFor(nsPresContext* aPresContext,
nsIFrame* aFrame,
nsMathMLContainerFrame::PropagatePresentationDataFor(nsIFrame* aFrame,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
@ -535,18 +529,18 @@ nsMathMLContainerFrame::PropagatePresentationDataFor(nsPresContext* aPresContext
aFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
if (mathMLFrame) {
// update
mathMLFrame->UpdatePresentationData(aPresContext,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
mathMLFrame->UpdatePresentationData(aScriptLevelIncrement, aFlagsValues,
aFlagsToUpdate);
// propagate using the base method to make sure that the control
// is passed on to MathML frames that may be overloading the method
mathMLFrame->UpdatePresentationDataFromChildAt(aPresContext,
0, -1, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
mathMLFrame->UpdatePresentationDataFromChildAt(0, -1,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
}
else {
// propagate down the subtrees
nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);
while (childFrame) {
PropagatePresentationDataFor(aPresContext, childFrame,
PropagatePresentationDataFor(childFrame,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
childFrame = childFrame->GetNextSibling();
}
@ -554,8 +548,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFor(nsPresContext* aPresContext
}
/* static */ void
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsPresContext* aPresContext,
nsIFrame* aParentFrame,
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsIFrame* aParentFrame,
PRInt32 aFirstChildIndex,
PRInt32 aLastChildIndex,
PRInt32 aScriptLevelIncrement,
@ -570,7 +563,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsPresContext* aPre
if ((index >= aFirstChildIndex) &&
((aLastChildIndex <= 0) || ((aLastChildIndex > 0) &&
(index <= aLastChildIndex)))) {
PropagatePresentationDataFor(aPresContext, childFrame,
PropagatePresentationDataFor(childFrame,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
}
index++;
@ -584,8 +577,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsPresContext* aPre
// to do about it at the moment. For background on the problem @see
// http://groups.google.com/groups?selm=3A9192B5.D22B6C38%40maths.uq.edu.au
/* static */ void
nsMathMLContainerFrame::PropagateScriptStyleFor(nsPresContext* aPresContext,
nsIFrame* aFrame,
nsMathMLContainerFrame::PropagateScriptStyleFor(nsIFrame* aFrame,
PRInt32 aParentScriptLevel)
{
nsIMathMLFrame* mathMLFrame;
@ -630,7 +622,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsPresContext* aPresContext,
else if (eCSSUnit_Percent == unit)
scriptminsize = nscoord(float(scriptminsize) * cssValue.GetPercentValue());
else if (eCSSUnit_Null != unit)
scriptminsize = CalcLength(aPresContext, mStyleContext, cssValue);
scriptminsize = CalcLength(mStyleContext, cssValue);
}
}
#endif
@ -666,7 +658,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsPresContext* aPresContext,
}
// now, re-resolve the style contexts in our subtree
nsFrameManager *fm = aPresContext->FrameManager();
nsFrameManager *fm = aFrame->GetPresContext()->FrameManager();
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(aFrame, &changeList, NS_STYLE_HINT_NONE);
#ifdef DEBUG
@ -683,10 +675,10 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsPresContext* aPresContext,
if (mathMLFrame) {
// propagate using the base method to make sure that the control
// is passed on to MathML frames that may be overloading the method
mathMLFrame->ReResolveScriptStyle(aPresContext, aParentScriptLevel);
mathMLFrame->ReResolveScriptStyle(aParentScriptLevel);
}
else {
PropagateScriptStyleFor(aPresContext, childFrame, aParentScriptLevel);
PropagateScriptStyleFor(childFrame, aParentScriptLevel);
}
childFrame = childFrame->GetNextSibling();
}
@ -707,10 +699,11 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsPresContext* aPresContext,
// with a wrapper. One must either use the parent (or the unique child)
// for such operations (@see nsMathMLForeignFrameWrapper).
nsresult
nsMathMLContainerFrame::WrapForeignFrames(nsPresContext* aPresContext)
nsMathMLContainerFrame::WrapForeignFrames()
{
nsIFrame* next = mFrames.FirstChild();
nsFrameManager *frameManager = aPresContext->FrameManager();
nsPresContext* presContext = GetPresContext();
nsFrameManager *frameManager = presContext->FrameManager();
while (next) {
nsIFrame* child = next;
@ -720,24 +713,24 @@ nsMathMLContainerFrame::WrapForeignFrames(nsPresContext* aPresContext)
if (inlineFrame) {
// create a new wrapper frame to wrap this child
nsIFrame* wrapper;
nsresult rv = NS_NewMathMLForeignFrameWrapper(aPresContext->PresShell(),
nsresult rv = NS_NewMathMLForeignFrameWrapper(presContext->PresShell(),
&wrapper);
if (NS_FAILED(rv)) return rv;
nsRefPtr<nsStyleContext> newStyleContext;
newStyleContext = aPresContext->StyleSet()->
newStyleContext = presContext->StyleSet()->
ResolvePseudoStyleFor(mContent,
nsCSSAnonBoxes::mozAnonymousBlock,
mStyleContext);
rv = wrapper->Init(aPresContext, mContent, this, newStyleContext, nsnull);
rv = wrapper->Init(presContext, mContent, this, newStyleContext, nsnull);
if (NS_FAILED(rv)) {
wrapper->Destroy(aPresContext);
wrapper->Destroy(presContext);
return rv;
}
mFrames.ReplaceFrame(aPresContext, this, child, wrapper, PR_FALSE);
mFrames.ReplaceFrame(this, child, wrapper, PR_FALSE);
child->SetParent(wrapper);
child->SetNextSibling(nsnull);
frameManager->ReParentStyleContext(child, newStyleContext);
wrapper->SetInitialChildList(aPresContext, nsnull, child);
wrapper->SetInitialChildList(presContext, nsnull, child);
}
}
return NS_OK;
@ -756,8 +749,7 @@ nsMathMLContainerFrame::Paint(nsPresContext* aPresContext,
// report an error if something wrong was found in this frame
if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) {
return PaintError(aPresContext, aRenderingContext,
aDirtyRect, aWhichLayer);
return PaintError(aRenderingContext, aDirtyRect, aWhichLayer);
}
// Paint inline element backgrounds in the foreground layer (bug 36710).
@ -831,7 +823,7 @@ nsMathMLContainerFrame::SetInitialChildList(nsPresContext* aPresContext,
// met when we mix things.
// So wrap foreign children in nsMathMLForeignFrameWrapper frames
WrapForeignFrames(aPresContext);
WrapForeignFrames();
return rv;
// ...We will build our automatic MathML data once the entire <math>...</math>
@ -842,8 +834,7 @@ nsMathMLContainerFrame::SetInitialChildList(nsPresContext* aPresContext,
// in aParentFrame itself (except for those particular operations that the
// parent frame may do in its TransmitAutomaticData()).
/* static */ void
nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsPresContext* aPresContext,
nsIFrame* aParentFrame)
nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsIFrame* aParentFrame)
{
// 1. As we descend the tree, make each child frame inherit data from
// the parent
@ -854,21 +845,20 @@ nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsPresContext* aPresCont
nsIMathMLFrame* childMathMLFrame;
childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&childMathMLFrame);
if (childMathMLFrame) {
childMathMLFrame->InheritAutomaticData(aPresContext, aParentFrame);
childMathMLFrame->InheritAutomaticData(aParentFrame);
}
RebuildAutomaticDataForChildren(aPresContext, childFrame);
RebuildAutomaticDataForChildren(childFrame);
childFrame = childFrame->GetNextSibling();
}
nsIMathMLFrame* mathMLFrame;
aParentFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
if (mathMLFrame) {
mathMLFrame->TransmitAutomaticData(aPresContext);
mathMLFrame->TransmitAutomaticData();
}
}
/* static */ nsresult
nsMathMLContainerFrame::ReLayoutChildren(nsPresContext* aPresContext,
nsIFrame* aParentFrame)
nsMathMLContainerFrame::ReLayoutChildren(nsIFrame* aParentFrame)
{
// walk-up to the first frame that is a MathML frame, stop if we reach <math>
PRInt32 parentScriptLevel = 0;
@ -906,7 +896,7 @@ nsMathMLContainerFrame::ReLayoutChildren(nsPresContext* aPresContext,
GetEmbellishDataFrom(frame, oldData);
#endif
RebuildAutomaticDataForChildren(aPresContext, frame);
RebuildAutomaticDataForChildren(frame);
#ifdef DEBUG_rbs
nsEmbellishData newData;
@ -925,16 +915,16 @@ nsMathMLContainerFrame::ReLayoutChildren(nsPresContext* aPresContext,
if (mathMLFrame) {
// propagate using the base method to make sure that the control
// is passed on to MathML frames that may be overloading the method
mathMLFrame->ReResolveScriptStyle(aPresContext, parentScriptLevel);
mathMLFrame->ReResolveScriptStyle(parentScriptLevel);
}
else {
PropagateScriptStyleFor(aPresContext, childFrame, parentScriptLevel);
PropagateScriptStyleFor(childFrame, parentScriptLevel);
}
childFrame = childFrame->GetNextSibling();
}
// Ask our parent frame to reflow us
return frame->ReflowDirtyChild(aPresContext->PresShell(), nsnull);
return frame->ReflowDirtyChild(frame->GetPresContext()->PresShell(), nsnull);
}
// There are precise rules governing children of a MathML frame,
@ -942,20 +932,17 @@ nsMathMLContainerFrame::ReLayoutChildren(nsPresContext* aPresContext,
// Hence for things to work, callers must use Append/Insert/etc wisely.
nsresult
nsMathMLContainerFrame::ChildListChanged(nsPresContext* aPresContext,
PRInt32 aModType)
nsMathMLContainerFrame::ChildListChanged(PRInt32 aModType)
{
if (aModType != nsIDOMMutationEvent::REMOVAL) {
// wrap any new foreign child that may have crept in
WrapForeignFrames(aPresContext);
WrapForeignFrames();
}
return ReLayoutChildren(aPresContext, this);
return ReLayoutChildren(this);
}
NS_IMETHODIMP
nsMathMLContainerFrame::AppendFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsMathMLContainerFrame::AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList)
{
if (aListName) {
@ -963,15 +950,13 @@ nsMathMLContainerFrame::AppendFrames(nsPresContext* aPresContext,
}
if (aFrameList) {
mFrames.AppendFrames(this, aFrameList);
return ChildListChanged(aPresContext, nsIDOMMutationEvent::ADDITION);
return ChildListChanged(nsIDOMMutationEvent::ADDITION);
}
return NS_OK;
}
NS_IMETHODIMP
nsMathMLContainerFrame::InsertFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsMathMLContainerFrame::InsertFrames(nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
@ -981,29 +966,25 @@ nsMathMLContainerFrame::InsertFrames(nsPresContext* aPresContext,
if (aFrameList) {
// Insert frames after aPrevFrame
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
return ChildListChanged(aPresContext, nsIDOMMutationEvent::ADDITION);
return ChildListChanged(nsIDOMMutationEvent::ADDITION);
}
return NS_OK;
}
NS_IMETHODIMP
nsMathMLContainerFrame::RemoveFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsMathMLContainerFrame::RemoveFrame(nsIAtom* aListName,
nsIFrame* aOldFrame)
{
if (aListName) {
return NS_ERROR_INVALID_ARG;
}
// remove the child frame
mFrames.DestroyFrame(aPresContext, aOldFrame);
return ChildListChanged(aPresContext, nsIDOMMutationEvent::REMOVAL);
mFrames.DestroyFrame(GetPresContext(), aOldFrame);
return ChildListChanged(nsIDOMMutationEvent::REMOVAL);
}
NS_IMETHODIMP
nsMathMLContainerFrame::ReplaceFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsMathMLContainerFrame::ReplaceFrame(nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
@ -1011,9 +992,9 @@ nsMathMLContainerFrame::ReplaceFrame(nsPresContext* aPresContext,
return NS_ERROR_INVALID_ARG;
}
// Replace the old frame with the new frame in the list
mFrames.ReplaceFrame(aPresContext, this, aOldFrame, aNewFrame, PR_TRUE);
mFrames.ReplaceFrame(this, aOldFrame, aNewFrame, PR_TRUE);
return ChildListChanged(aPresContext, nsIDOMMutationEvent::MODIFICATION);
return ChildListChanged(nsIDOMMutationEvent::MODIFICATION);
}
NS_IMETHODIMP
@ -1127,8 +1108,8 @@ printf("\n");
// We don't use STRETCH_CONSIDER_EMBELLISHMENTS -- because we don't want to
// include them in the caculations of the size of stretchy elements
nsBoundingMetrics containerSize;
GetPreferredStretchSize(aPresContext, *aReflowState.rendContext, 0,
stretchDir, containerSize);
GetPreferredStretchSize(*aReflowState.rendContext, 0, stretchDir,
containerSize);
// fire the stretch on each child
childFrame = mFrames.FirstChild();
@ -1140,8 +1121,8 @@ printf("\n");
GetReflowAndBoundingMetricsFor(childFrame,
childDesiredSize, childDesiredSize.mBoundingMetrics);
mathMLFrame->Stretch(aPresContext, *aReflowState.rendContext,
stretchDir, containerSize, childDesiredSize);
mathMLFrame->Stretch(*aReflowState.rendContext, stretchDir,
containerSize, childDesiredSize);
// store the updated metrics
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height));
@ -1156,7 +1137,7 @@ printf("\n");
/////////////
// Place children now by re-adjusting the origins to align the baselines
FinalizeReflow(aPresContext, *aReflowState.rendContext, aDesiredSize);
FinalizeReflow(*aReflowState.rendContext, aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
@ -1284,8 +1265,7 @@ GetInterFrameSpacing(PRInt32 aScriptLevel,
}
NS_IMETHODIMP
nsMathMLContainerFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLContainerFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -1387,7 +1367,8 @@ nsMathMLContainerFrame::Place(nsPresContext* aPresContext,
prevFrameType = childFrameType;
// add left correction
dx += leftCorrection;
FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0);
FinishReflowChild(childFrame, GetPresContext(), nsnull, childSize,
dx, dy, 0);
// add child size + italic correction
dx += bmChild.width + italicCorrection;
childFrame = childFrame->GetNextSibling();
@ -1401,8 +1382,7 @@ nsMathMLContainerFrame::Place(nsPresContext* aPresContext,
// e.g., it fixes <math> <mi>f</mi> <mo>q</mo> <mi>f</mi> <mo>I</mo> </math>
static nscoord
GetInterFrameSpacingFor(nsPresContext* aPresContext,
PRInt32 aScriptLevel,
GetInterFrameSpacingFor(PRInt32 aScriptLevel,
nsIFrame* aParentFrame,
nsIFrame* aChildFrame)
{
@ -1436,15 +1416,14 @@ GetInterFrameSpacingFor(nsPresContext* aPresContext,
}
nsresult
nsMathMLContainerFrame::FixInterFrameSpacing(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize)
nsMathMLContainerFrame::FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize)
{
nsIContent* parentContent = mParent->GetContent();
nsIAtom *parentTag = parentContent->Tag();
if (parentTag == nsMathMLAtoms::math ||
parentTag == nsMathMLAtoms::mtd_) {
nscoord gap = GetInterFrameSpacingFor(aPresContext,
mPresentationData.scriptLevel, mParent, this);
nscoord gap = GetInterFrameSpacingFor(mPresentationData.scriptLevel,
mParent, this);
// add our own italic correction
nscoord leftCorrection = 0, italicCorrection = 0;
GetItalicCorrection(mBoundingMetrics, leftCorrection, italicCorrection);

Просмотреть файл

@ -83,36 +83,32 @@ public:
// Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h
NS_IMETHOD
Stretch(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Stretch(nsIRenderingContext& aRenderingContext,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
PropagatePresentationDataFromChildAt(aPresContext, this,
aFirstIndex, aLastIndex, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
PropagatePresentationDataFromChildAt(this, aFirstIndex, aLastIndex,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
return NS_OK;
}
NS_IMETHOD
ReResolveScriptStyle(nsPresContext* aPresContext,
PRInt32 aParentScriptLevel)
ReResolveScriptStyle(PRInt32 aParentScriptLevel)
{
PropagateScriptStyleFor(aPresContext, this, aParentScriptLevel);
PropagateScriptStyleFor(this, aParentScriptLevel);
return NS_OK;
}
@ -134,28 +130,20 @@ public:
nsIFrame* aChildList);
NS_IMETHOD
AppendFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList);
NS_IMETHOD
InsertFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
InsertFrames(nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
NS_IMETHOD
RemoveFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
RemoveFrame(nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD
ReplaceFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
ReplaceFrame(nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
@ -215,19 +203,17 @@ public:
// helper to re-sync the automatic data in our children and notify our parent to
// reflow us when changes (e.g., append/insert/remove) happen in our child list
virtual nsresult
ChildListChanged(nsPresContext* aPresContext,
PRInt32 aModType);
ChildListChanged(PRInt32 aModType);
// helper to wrap non-MathML frames so that foreign elements (e.g., html:img)
// can mix better with other surrounding MathML markups
virtual nsresult
WrapForeignFrames(nsPresContext* aPresContext);
WrapForeignFrames();
// helper to get the preferred size that a container frame should use to fire
// the stretch on its stretchy child frames.
virtual void
GetPreferredStretchSize(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
GetPreferredStretchSize(nsIRenderingContext& aRenderingContext,
PRUint32 aOptions,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aPreferredStretchSize);
@ -235,12 +221,10 @@ public:
// error handlers to provide a visual feedback to the user when an error
// (typically invalid markup) was encountered during reflow.
virtual nsresult
ReflowError(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
ReflowError(nsIRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize);
virtual nsresult
PaintError(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
PaintError(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
@ -266,14 +250,12 @@ public:
// emulate the spacing that would have been done by a <mrow> container.
// e.g., it fixes <math> <mi>f</mi> <mo>q</mo> <mi>f</mi> <mo>I</mo> </math>
virtual nsresult
FixInterFrameSpacing(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize);
FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize);
// helper method to complete the post-reflow hook and ensure that embellished
// operators don't terminate their Reflow without receiving a Stretch command.
virtual nsresult
FinalizeReflow(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
FinalizeReflow(nsIRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize);
// helper method to facilitate getting the reflow and bounding metrics
@ -288,22 +270,19 @@ public:
// helper to let the scriptstyle re-resolution pass through
// a subtree that may contain non-MathML container frames
static void
PropagateScriptStyleFor(nsPresContext* aPresContext,
nsIFrame* aFrame,
PropagateScriptStyleFor(nsIFrame* aFrame,
PRInt32 aParentScriptLevel);
// helper to let the update of presentation data pass through
// a subtree that may contain non-MathML container frames
static void
PropagatePresentationDataFor(nsPresContext* aPresContext,
nsIFrame* aFrame,
PropagatePresentationDataFor(nsIFrame* aFrame,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
static void
PropagatePresentationDataFromChildAt(nsPresContext* aPresContext,
nsIFrame* aParentFrame,
PropagatePresentationDataFromChildAt(nsIFrame* aParentFrame,
PRInt32 aFirstChildIndex,
PRInt32 aLastChildIndex,
PRInt32 aScriptLevelIncrement,
@ -323,8 +302,7 @@ public:
// has to request the re-build from its parent. Unfortunately, the extra cost
// for this is that it will re-sync in the siblings of the child as well.
static void
RebuildAutomaticDataForChildren(nsPresContext* aPresContext,
nsIFrame* aParentFrame);
RebuildAutomaticDataForChildren(nsIFrame* aParentFrame);
// helper to blow away the automatic data cached in a frame's subtree and
// re-layout its subtree to reflect changes that may have happen. In the
@ -335,8 +313,7 @@ public:
// frame itself (except for those particular operations that the parent frame
// may do do its TransmitAutomaticData()). @see RebuildAutomaticDataForChildren
static nsresult
ReLayoutChildren(nsPresContext* aPresContext,
nsIFrame* aParentFrame);
ReLayoutChildren(nsIFrame* aParentFrame);
protected:
virtual PRIntn GetSkipSides() const { return 0; }
@ -365,7 +342,7 @@ public:
nsresult rv = nsBlockFrame::SetInitialChildList(aPresContext, aListName, aChildList);
// re-resolve our subtree to set any mathml-expected data
nsMathMLContainerFrame::MapAttributesIntoCSS(aPresContext, this);
nsMathMLContainerFrame::RebuildAutomaticDataForChildren(aPresContext, this);
nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
return rv;
}
@ -377,54 +354,47 @@ public:
{
if (mScriptStyleChanged) {
mScriptStyleChanged = PR_FALSE;
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, 0);
nsMathMLContainerFrame::PropagateScriptStyleFor(this, 0);
}
return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
NS_IMETHOD
AppendFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList)
{
nsresult rv = nsBlockFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsBlockFrame::AppendFrames(aListName, aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
NS_IMETHOD
InsertFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
InsertFrames(nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
nsresult rv = nsBlockFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsBlockFrame::InsertFrames(aListName, aPrevFrame,
aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
NS_IMETHOD
ReplaceFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
ReplaceFrame(nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
nsresult rv = nsBlockFrame::ReplaceFrame(aPresContext, aPresShell, aListName, aOldFrame, aNewFrame);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsBlockFrame::ReplaceFrame(aListName, aOldFrame, aNewFrame);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
NS_IMETHOD
RemoveFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
RemoveFrame(nsIAtom* aListName,
nsIFrame* aOldFrame)
{
nsresult rv = nsBlockFrame::RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsBlockFrame::RemoveFrame(aListName, aOldFrame);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
@ -456,7 +426,7 @@ public:
nsresult rv = nsInlineFrame::SetInitialChildList(aPresContext, aListName, aChildList);
// re-resolve our subtree to set any mathml-expected data
nsMathMLContainerFrame::MapAttributesIntoCSS(aPresContext, this);
nsMathMLContainerFrame::RebuildAutomaticDataForChildren(aPresContext, this);
nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
return rv;
}
@ -468,54 +438,47 @@ public:
{
if (mScriptStyleChanged) {
mScriptStyleChanged = PR_FALSE;
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, 0);
nsMathMLContainerFrame::PropagateScriptStyleFor(this, 0);
}
return nsInlineFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
NS_IMETHOD
AppendFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList)
{
nsresult rv = nsInlineFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsInlineFrame::AppendFrames(aListName, aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
NS_IMETHOD
InsertFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
InsertFrames(nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
nsresult rv = nsInlineFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsInlineFrame::InsertFrames(aListName, aPrevFrame,
aFrameList);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
NS_IMETHOD
ReplaceFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
ReplaceFrame(nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
nsresult rv = nsInlineFrame::ReplaceFrame(aPresContext, aPresShell, aListName, aOldFrame, aNewFrame);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsInlineFrame::ReplaceFrame(aListName, aOldFrame, aNewFrame);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}
NS_IMETHOD
RemoveFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
RemoveFrame(nsIAtom* aListName,
nsIFrame* aOldFrame)
{
nsresult rv = nsInlineFrame::RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
nsMathMLContainerFrame::ReLayoutChildren(aPresContext, this);
nsresult rv = nsInlineFrame::RemoveFrame(aListName, aOldFrame);
nsMathMLContainerFrame::ReLayoutChildren(this);
return rv;
}

Просмотреть файл

@ -56,23 +56,21 @@ public:
// Overloaded nsIMathMLFrame methods
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(aPresContext, this,
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
aFirstIndex, aLastIndex, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
return NS_OK;
}
NS_IMETHOD
ReResolveScriptStyle(nsPresContext* aPresContext,
PRInt32 aParentScriptLevel)
ReResolveScriptStyle(PRInt32 aParentScriptLevel)
{
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, aParentScriptLevel);
nsMathMLContainerFrame::PropagateScriptStyleFor(this, aParentScriptLevel);
return NS_OK;
}
@ -108,9 +106,7 @@ public:
// we are just a wrapper and these methods shouldn't be called
NS_IMETHOD
AppendFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList)
{
NS_NOTREACHED("unsupported operation");
@ -118,9 +114,7 @@ public:
}
NS_IMETHOD
InsertFrames(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
InsertFrames(nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
@ -132,29 +126,25 @@ public:
// as two operations: remove & insert; In our case, removing the child will
// remove us too... so we have to operate from our parent's perspective
NS_IMETHOD
ReplaceFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
ReplaceFrame(nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
nsresult rv = mParent->ReplaceFrame(aPresContext, aPresShell, aListName, this, aNewFrame);
nsresult rv = mParent->ReplaceFrame(aListName, this, aNewFrame);
// XXX the usage of ReplaceFrame() vs. ReplaceFrameAndDestroy() is
// XXX ambiguous - see bug 122748. The style system doesn't call ReplaceFrame()
// XXX and that's why nobody seems to have been biten by the ambiguity yet
aOldFrame->Destroy(aPresContext);
aOldFrame->Destroy(GetPresContext());
return rv;
}
// Our life is bound to the life of our unique child.
// When our child goes away, we ask our parent to delete us
NS_IMETHOD
RemoveFrame(nsPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
RemoveFrame(nsIAtom* aListName,
nsIFrame* aOldFrame)
{
return mParent->RemoveFrame(aPresContext, aPresShell, aListName, this);
return mParent->RemoveFrame(aListName, this);
}
protected:

Просмотреть файл

@ -63,8 +63,7 @@ static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
NS_IMPL_QUERY_INTERFACE1(nsMathMLFrame, nsIMathMLFrame)
NS_IMETHODIMP
nsMathMLFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent)
{
mEmbellishData.flags = 0;
mEmbellishData.nextFrame = nsnull;
@ -94,8 +93,7 @@ nsMathMLFrame::InheritAutomaticData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLFrame::UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
nsMathMLFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{

Просмотреть файл

@ -96,8 +96,7 @@ public:
}
NS_IMETHOD
Stretch(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Stretch(nsIRenderingContext& aRenderingContext,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize)
@ -106,8 +105,7 @@ public:
}
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -139,24 +137,21 @@ public:
}
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext)
TransmitAutomaticData()
{
return NS_OK;
}
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -166,8 +161,7 @@ public:
}
NS_IMETHOD
ReResolveScriptStyle(nsPresContext* aPresContext,
PRInt32 aParentScriptLevel)
ReResolveScriptStyle(PRInt32 aParentScriptLevel)
{
return NS_OK;
}
@ -263,28 +257,27 @@ public:
// helper methods for getting sup/subdrop's from a child
static void
GetSubDropFromChild(nsPresContext* aPresContext,
nsIFrame* aChild,
GetSubDropFromChild(nsIFrame* aChild,
nscoord& aSubDrop)
{
const nsStyleFont* font = aChild->GetStyleFont();
nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font->mFont);
nsCOMPtr<nsIFontMetrics> fm = aChild->GetPresContext()->GetMetricsFor(
font->mFont);
GetSubDrop(fm, aSubDrop);
}
static void
GetSupDropFromChild(nsPresContext* aPresContext,
nsIFrame* aChild,
GetSupDropFromChild(nsIFrame* aChild,
nscoord& aSupDrop)
{
const nsStyleFont* font = aChild->GetStyleFont();
nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font->mFont);
nsCOMPtr<nsIFontMetrics> fm = aChild->GetPresContext()->GetMetricsFor(
font->mFont);
GetSupDrop(fm, aSupDrop);
}
static void
GetSkewCorrectionFromChild(nsPresContext* aPresContext,
nsIFrame* aChild,
GetSkewCorrectionFromChild(nsIFrame* aChild,
nscoord& aSkewCorrection)
{
// default is 0

Просмотреть файл

@ -205,7 +205,7 @@ printf("\n");
mBoundingMetrics = aDesiredSize.mBoundingMetrics;
// place and size children
FinalizeReflow(aPresContext, *aReflowState.rendContext, aDesiredSize);
FinalizeReflow(*aReflowState.rendContext, aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
@ -216,13 +216,12 @@ printf("\n");
// pass, it is not computed here because our children may be text frames
// that do not implement the GetBoundingMetrics() interface.
nsresult
nsMathMLTokenFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLTokenFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
nsCOMPtr<nsIFontMetrics> fm =
aPresContext->GetMetricsFor(GetStyleFont()->mFont);
GetPresContext()->GetMetricsFor(GetStyleFont()->mFont);
nscoord ascent, descent;
fm->GetMaxAscent(ascent);
fm->GetMaxDescent(descent);
@ -244,7 +243,7 @@ nsMathMLTokenFrame::Place(nsPresContext* aPresContext,
// place and size the child; (dx,0) makes the caret happy - bug 188146
dy = rect.IsEmpty() ? 0 : aDesiredSize.ascent - rect.y;
FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0);
FinishReflowChild(childFrame, GetPresContext(), nsnull, childSize, dx, dy, 0);
dx += rect.width;
childFrame = childFrame->GetNextSibling();
}

Просмотреть файл

@ -70,8 +70,7 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);

Просмотреть файл

@ -332,7 +332,7 @@ nsMathMLmactionFrame::Reflow(nsPresContext* aPresContext,
childFrame->SetRect(nsRect(aDesiredSize.descent,aDesiredSize.ascent,
aDesiredSize.width,aDesiredSize.height));
mBoundingMetrics = aDesiredSize.mBoundingMetrics;
FinalizeReflow(aPresContext, *aReflowState.rendContext, aDesiredSize);
FinalizeReflow(*aReflowState.rendContext, aDesiredSize);
}
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return rv;
@ -340,8 +340,7 @@ nsMathMLmactionFrame::Reflow(nsPresContext* aPresContext,
// Only place the selected child ...
NS_IMETHODIMP
nsMathMLmactionFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmactionFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -352,7 +351,7 @@ nsMathMLmactionFrame::Place(nsPresContext* aPresContext,
if (childFrame) {
GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics);
if (aPlaceOrigin) {
FinishReflowChild(childFrame, aPresContext, nsnull, aDesiredSize, 0, 0, 0);
FinishReflowChild(childFrame, GetPresContext(), nsnull, aDesiredSize, 0, 0, 0);
}
mReference.x = 0;
mReference.y = aDesiredSize.ascent;

Просмотреть файл

@ -85,8 +85,7 @@ public:
PRUint32 aFlags = 0);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);

Просмотреть файл

@ -78,11 +78,10 @@ nsMathMLmfencedFrame::~nsMathMLmfencedFrame()
}
NS_IMETHODIMP
nsMathMLmfencedFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmfencedFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
@ -119,13 +118,12 @@ nsMathMLmfencedFrame::AttributeChanged(nsIContent* aContent,
}
nsresult
nsMathMLmfencedFrame::ChildListChanged(nsPresContext* aPresContext,
PRInt32 aModType)
nsMathMLmfencedFrame::ChildListChanged(PRInt32 aModType)
{
RemoveFencesAndSeparators();
CreateFencesAndSeparators(aPresContext);
CreateFencesAndSeparators(GetPresContext());
return nsMathMLContainerFrame::ChildListChanged(aPresContext, aModType);
return nsMathMLContainerFrame::ChildListChanged(aModType);
}
void
@ -362,7 +360,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
}
else {
// case when the call is made for mfenced
mathMLFrame->GetPreferredStretchSize(aPresContext, *aReflowState.rendContext,
mathMLFrame->GetPreferredStretchSize(*aReflowState.rendContext,
0, /* i.e., without embellishments */
stretchDir, containerSize);
childFrame = firstChild;
@ -373,7 +371,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
// retrieve the metrics that was stored at the previous pass
GetReflowAndBoundingMetricsFor(childFrame, childDesiredSize, childDesiredSize.mBoundingMetrics);
mathmlChild->Stretch(aPresContext, *aReflowState.rendContext,
mathmlChild->Stretch(*aReflowState.rendContext,
stretchDir, containerSize, childDesiredSize);
// store the updated metrics
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
@ -387,7 +385,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
childFrame = childFrame->GetNextSibling();
}
// bug 121748: for surrounding fences & separators, use a size that covers everything
mathMLFrame->GetPreferredStretchSize(aPresContext, *aReflowState.rendContext,
mathMLFrame->GetPreferredStretchSize(*aReflowState.rendContext,
STRETCH_CONSIDER_EMBELLISHMENTS,
stretchDir, containerSize);
}

Просмотреть файл

@ -57,8 +57,7 @@ public:
GetAdditionalStyleContext(PRInt32 aIndex) const;
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
SetInitialChildList(nsPresContext* aPresContext,
@ -86,8 +85,7 @@ public:
// override the base method because we must keep separators in sync
virtual nsresult
ChildListChanged(nsPresContext* aPresContext,
PRInt32 aModType);
ChildListChanged(PRInt32 aModType);
// exported routine that both mfenced and mfrac share.
// mfrac uses this when its bevelled attribute is set.

Просмотреть файл

@ -135,7 +135,7 @@ nsMathMLmfracFrame::Init(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmfracFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmfracFrame::TransmitAutomaticData()
{
// 1. The REC says:
// The <mfrac> element sets displaystyle to "false", or if it was already
@ -145,10 +145,10 @@ nsMathMLmfracFrame::TransmitAutomaticData(nsPresContext* aPresContext)
PRInt32 increment =
NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags) ? 0 : 1;
mInnerScriptLevel = mPresentationData.scriptLevel + increment;
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, increment,
UpdatePresentationDataFromChildAt(0, -1, increment,
~NS_MATHML_DISPLAYSTYLE,
NS_MATHML_DISPLAYSTYLE);
UpdatePresentationDataFromChildAt(aPresContext, 1, 1, 0,
UpdatePresentationDataFromChildAt(1, 1, 0,
NS_MATHML_COMPRESSED,
NS_MATHML_COMPRESSED);
@ -267,14 +267,12 @@ nsMathMLmfracFrame::Reflow(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmfracFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmfracFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
////////////////////////////////////
// Get the children's desired sizes
nsBoundingMetrics bmNum, bmDen;
nsHTMLReflowMetrics sizeNum (nsnull);
nsHTMLReflowMetrics sizeDen (nsnull);
@ -285,7 +283,7 @@ nsMathMLmfracFrame::Place(nsPresContext* aPresContext,
if (!frameNum || !frameDen || frameDen->GetNextSibling()) {
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize);
return ReflowError(aRenderingContext, aDesiredSize);
}
GetReflowAndBoundingMetricsFor(frameNum, sizeNum, bmNum);
GetReflowAndBoundingMetricsFor(frameDen, sizeDen, bmDen);
@ -293,7 +291,8 @@ nsMathMLmfracFrame::Place(nsPresContext* aPresContext,
//////////////////
// Get shifts
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
nsPresContext* presContext = GetPresContext();
nscoord onePixel = presContext->IntScaledPixelsToTwips(1);
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
nsCOMPtr<nsIFontMetrics> fm;
@ -316,8 +315,8 @@ nsMathMLmfracFrame::Place(nsPresContext* aPresContext,
// see if the linethickness attribute is there
nsAutoString value;
GetAttribute(mContent, mPresentationData.mstyle, nsMathMLAtoms::linethickness_, value);
mLineRect.height = CalcLineThickness(aPresContext, mStyleContext,
value, onePixel, defaultRuleThickness);
mLineRect.height = CalcLineThickness(presContext, mStyleContext, value,
onePixel, defaultRuleThickness);
nscoord numShift = 0;
nscoord denShift = 0;
@ -440,10 +439,10 @@ nsMathMLmfracFrame::Place(nsPresContext* aPresContext,
nscoord dy;
// place numerator
dy = 0;
FinishReflowChild(frameNum, aPresContext, nsnull, sizeNum, dxNum, dy, 0);
FinishReflowChild(frameNum, presContext, nsnull, sizeNum, dxNum, dy, 0);
// place denominator
dy = aDesiredSize.height - sizeDen.height;
FinishReflowChild(frameDen, aPresContext, nsnull, sizeDen, dxDen, dy, 0);
FinishReflowChild(frameDen, presContext, nsnull, sizeDen, dxDen, dy, 0);
// place the fraction bar - dy is top of bar
dy = aDesiredSize.ascent - (axisHeight + actualRuleThickness/2);
mLineRect.SetRect(leftSpace, dy, width - (leftSpace + rightSpace), actualRuleThickness);
@ -485,8 +484,7 @@ nsMathMLmfracFrame::AttributeChanged(nsIContent* aContent,
}
NS_IMETHODIMP
nsMathMLmfracFrame::UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
nsMathMLmfracFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
@ -508,7 +506,7 @@ nsMathMLmfracFrame::UpdatePresentationData(nsPresContext* aPresContext,
if (NS_MATHML_IS_DISPLAYSTYLE(aFlagsValues)) {
// ...and is being set to true, so undo the inner increment now
mInnerScriptLevel = mPresentationData.scriptLevel;
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, -1, 0, 0);
UpdatePresentationDataFromChildAt(0, -1, -1, 0, 0);
}
}
else {
@ -519,19 +517,19 @@ nsMathMLmfracFrame::UpdatePresentationData(nsPresContext* aPresContext,
NS_ASSERTION(NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags), "out of sync");
if (!NS_MATHML_IS_DISPLAYSTYLE(aFlagsValues)) {
mInnerScriptLevel = mPresentationData.scriptLevel + 1;
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, 1, 0, 0);
UpdatePresentationDataFromChildAt(0, -1, 1, 0, 0);
}
}
}
mInnerScriptLevel += aScriptLevelIncrement;
return nsMathMLContainerFrame::
UpdatePresentationData(aPresContext, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
UpdatePresentationData(aScriptLevelIncrement, aFlagsValues,
aFlagsToUpdate);
}
NS_IMETHODIMP
nsMathMLmfracFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
nsMathMLmfracFrame::UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -552,7 +550,7 @@ nsMathMLmfracFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContex
aFlagsValues &= ~NS_MATHML_DISPLAYSTYLE;
#endif
return nsMathMLContainerFrame::
UpdatePresentationDataFromChildAt(aPresContext, aFirstIndex, aLastIndex,
UpdatePresentationDataFromChildAt(aFirstIndex, aLastIndex,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
}

Просмотреть файл

@ -113,8 +113,7 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
@ -126,17 +125,15 @@ public:
PRUint32 aFlags = 0);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,

Просмотреть файл

@ -77,7 +77,7 @@ nsMathMLmmultiscriptsFrame::~nsMathMLmmultiscriptsFrame()
}
NS_IMETHODIMP
nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmmultiscriptsFrame::TransmitAutomaticData()
{
// if our base is an embellished operator, let its state bubble to us
GetEmbellishDataFrom(mFrames.FirstChild(), mEmbellishData);
@ -87,7 +87,7 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsPresContext* aPresContext)
// The REC says:
// The <mmultiscripts> element increments scriptlevel by 1, and sets
// displaystyle to "false", within each of its arguments except base
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
UpdatePresentationDataFromChildAt(1, -1, 1,
~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE);
// The TeXbook (Ch 17. p.141) says the superscript inherits the compression
@ -120,7 +120,7 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsPresContext* aPresContext)
}
for (PRInt32 i = subScriptFrames.Count() - 1; i >= 0; i--) {
childFrame = (nsIFrame*)subScriptFrames[i];
PropagatePresentationDataFor(aPresContext, childFrame, 0,
PropagatePresentationDataFor(childFrame, 0,
NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED);
}
@ -128,7 +128,7 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsPresContext* aPresContext)
}
void
nsMathMLmmultiscriptsFrame::ProcessAttributes(nsPresContext* aPresContext)
nsMathMLmmultiscriptsFrame::ProcessAttributes()
{
mSubScriptShift = 0;
mSupScriptShift = 0;
@ -140,7 +140,7 @@ nsMathMLmmultiscriptsFrame::ProcessAttributes(nsPresContext* aPresContext)
nsMathMLAtoms::subscriptshift_, value)) {
nsCSSValue cssValue;
if (ParseNumericValue(value, cssValue) && cssValue.IsLengthUnit()) {
mSubScriptShift = CalcLength(aPresContext, mStyleContext, cssValue);
mSubScriptShift = CalcLength(GetPresContext(), mStyleContext, cssValue);
}
}
// check if the superscriptshift attribute is there
@ -148,14 +148,13 @@ nsMathMLmmultiscriptsFrame::ProcessAttributes(nsPresContext* aPresContext)
nsMathMLAtoms::superscriptshift_, value)) {
nsCSSValue cssValue;
if (ParseNumericValue(value, cssValue) && cssValue.IsLengthUnit()) {
mSupScriptShift = CalcLength(aPresContext, mStyleContext, cssValue);
mSupScriptShift = CalcLength(GetPresContext(), mStyleContext, cssValue);
}
}
}
NS_IMETHODIMP
nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -169,7 +168,7 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
// depend only on the current font
////////////////////////////////////////
ProcessAttributes(aPresContext);
ProcessAttributes();
// get x-height (an ex)
aRenderingContext.SetFont(GetStyleFont()->mFont, nsnull);
@ -277,7 +276,7 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
// duplicate <mprescripts/> found
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize);
return ReflowError(aRenderingContext, aDesiredSize);
}
mprescriptsFrame = childFrame;
firstPrescriptsPair = PR_TRUE;
@ -303,7 +302,7 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
subScriptFrame = childFrame;
GetReflowAndBoundingMetricsFor(subScriptFrame, subScriptSize, bmSubScript);
// get the subdrop from the subscript font
GetSubDropFromChild (aPresContext, subScriptFrame, subDrop);
GetSubDropFromChild (subScriptFrame, subDrop);
// parameter v, Rule 18a, App. G, TeXbook
minSubScriptShift = bmBase.descent + subDrop;
trySubScriptShift = PR_MAX(minSubScriptShift,subScriptShift);
@ -319,7 +318,7 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
supScriptFrame = childFrame;
GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize, bmSupScript);
// get the supdrop from the supscript font
GetSupDropFromChild (aPresContext, supScriptFrame, supDrop);
GetSupDropFromChild (supScriptFrame, supDrop);
// parameter u, Rule 18a, App. G, TeXbook
minSupScriptShift = bmBase.ascent - supDrop;
// get min supscript shift limit from x-height
@ -386,7 +385,7 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
if ((0 != width) || !baseFrame || !subScriptFrame || !supScriptFrame) {
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize);
return ReflowError(aRenderingContext, aDesiredSize);
}
// we left out the width of prescripts, so ...
@ -428,7 +427,7 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
// place the base ...
childFrame = baseFrame;
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
FinishReflowChild (baseFrame, GetPresContext(), nsnull, baseSize, dx, dy, 0);
dx += bmBase.width + mScriptSpace + italicCorrection;
}
else if (mprescriptsFrame != childFrame) {
@ -451,12 +450,12 @@ nsMathMLmmultiscriptsFrame::Place(nsPresContext* aPresContext,
dy = aDesiredSize.ascent - subScriptSize.ascent +
maxSubScriptShift;
FinishReflowChild (subScriptFrame, aPresContext, nsnull, subScriptSize,
FinishReflowChild (subScriptFrame, GetPresContext(), nsnull, subScriptSize,
dx + (width-subScriptSize.width)/2, dy, 0);
dy = aDesiredSize.ascent - supScriptSize.ascent -
maxSupScriptShift;
FinishReflowChild (supScriptFrame, aPresContext, nsnull, supScriptSize,
FinishReflowChild (supScriptFrame, GetPresContext(), nsnull, supScriptSize,
dx + (width-supScriptSize.width)/2, dy, 0);
dx += mScriptSpace + width;

Просмотреть файл

@ -52,11 +52,10 @@ public:
friend nsresult NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
@ -73,7 +72,7 @@ private:
nscoord mSupScriptShift;
void
ProcessAttributes(nsPresContext* aPresContext);
ProcessAttributes();
};
#endif /* nsMathMLmmultiscriptsFrame_h___ */

Просмотреть файл

@ -113,8 +113,7 @@ nsMathMLmoFrame::GetType() const
// frame's state bit in our child text frame. So we will first check
// its selected state bit, and use this little helper to double check.
PRBool
nsMathMLmoFrame::IsFrameInSelection(nsPresContext* aPresContext,
nsIFrame* aFrame)
nsMathMLmoFrame::IsFrameInSelection(nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "null arg");
if (!aFrame)
@ -126,11 +125,12 @@ nsMathMLmoFrame::IsFrameInSelection(nsPresContext* aPresContext,
return PR_FALSE;
SelectionDetails* details = nsnull;
nsIPresShell *shell = aPresContext->GetPresShell();
nsIPresShell *shell = GetPresContext()->GetPresShell();
if (shell) {
nsCOMPtr<nsIFrameSelection> frameSelection;
nsCOMPtr<nsISelectionController> selCon;
nsresult rv = GetSelectionController(aPresContext, getter_AddRefs(selCon));
nsresult rv = GetSelectionController(GetPresContext(),
getter_AddRefs(selCon));
if (NS_SUCCEEDED(rv) && selCon)
frameSelection = do_QueryInterface(selCon);
if (!frameSelection)
@ -173,7 +173,7 @@ nsMathMLmoFrame::Paint(nsPresContext* aPresContext,
PRBool isSelected = PR_FALSE;
nsRect selectedRect;
nsIFrame* firstChild = mFrames.FirstChild();
if (IsFrameInSelection(aPresContext, firstChild)) {
if (IsFrameInSelection(firstChild)) {
selectedRect = firstChild->GetRect();
isSelected = PR_TRUE;
}
@ -284,7 +284,7 @@ nsMathMLmoFrame::ProcessTextData(nsPresContext* aPresContext)
// called very often. We depend on many things that may change around us.
// However, we re-use unchanged values.
void
nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
nsMathMLmoFrame::ProcessOperatorData()
{
// if we have been here before, we will just use our cached form
nsOperatorFlags form = NS_MATHML_OPERATOR_GET_FORM(mFlags);
@ -364,6 +364,8 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
return;
}
nsPresContext* presContext = GetPresContext();
// beware of bug 133814 - there is a two-way dependency in the
// embellished hierarchy: our embellished ancestors need to set
// their flags based on some of our state (set above), and here we
@ -431,7 +433,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
// since these values are relative to the 'em' unit, convert to twips now
nscoord em;
nsCOMPtr<nsIFontMetrics> fm =
aPresContext->GetMetricsFor(GetStyleFont()->mFont);
presContext->GetMetricsFor(GetStyleFont()->mFont);
GetEmHeight(fm, em);
mEmbellishData.leftSpace = NSToCoordRound(lspace * em);
@ -468,7 +470,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
leftSpace = 0;
else if (cssValue.IsLengthUnit())
leftSpace = CalcLength(aPresContext, mStyleContext, cssValue);
leftSpace = CalcLength(presContext, mStyleContext, cssValue);
mFlags |= NS_MATHML_OPERATOR_LEFTSPACE_ATTR;
}
}
@ -484,7 +486,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
rightSpace = 0;
else if (cssValue.IsLengthUnit())
rightSpace = CalcLength(aPresContext, mStyleContext, cssValue);
rightSpace = CalcLength(presContext, mStyleContext, cssValue);
mFlags |= NS_MATHML_OPERATOR_RIGHTSPACE_ATTR;
}
}
@ -492,7 +494,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
// little extra tuning to round lspace & rspace to at least a pixel so that
// operators don't look as if they are colliding with their operands
if (leftSpace || rightSpace) {
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
nscoord onePixel = presContext->IntScaledPixelsToTwips(1);
if (leftSpace && leftSpace < onePixel)
leftSpace = onePixel;
if (rightSpace && rightSpace < onePixel)
@ -558,7 +560,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
else if (eCSSUnit_Percent == unit)
mMinSize = cssValue.GetPercentValue();
else if (eCSSUnit_Null != unit) {
mMinSize = float(CalcLength(aPresContext, mStyleContext, cssValue));
mMinSize = float(CalcLength(presContext, mStyleContext, cssValue));
mFlags |= NS_MATHML_OPERATOR_MINSIZE_EXPLICIT;
}
@ -568,7 +570,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
nsMathMLAtoms::minsize_, value)) {
if (ParseNumericValue(value, cssValue)) {
if (cssValue.IsLengthUnit()) {
mMinSize *= float(CalcLength(aPresContext, mStyleContext, cssValue));
mMinSize *= float(CalcLength(presContext, mStyleContext, cssValue));
mFlags |= NS_MATHML_OPERATOR_MINSIZE_EXPLICIT;
}
}
@ -591,7 +593,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
else if (eCSSUnit_Percent == unit)
mMaxSize = cssValue.GetPercentValue();
else if (eCSSUnit_Null != unit) {
mMaxSize = float(CalcLength(aPresContext, mStyleContext, cssValue));
mMaxSize = float(CalcLength(presContext, mStyleContext, cssValue));
mFlags |= NS_MATHML_OPERATOR_MAXSIZE_EXPLICIT;
}
@ -601,7 +603,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
nsMathMLAtoms::maxsize_, value)) {
if (ParseNumericValue(value, cssValue)) {
if (cssValue.IsLengthUnit()) {
mMaxSize *= float(CalcLength(aPresContext, mStyleContext, cssValue));
mMaxSize *= float(CalcLength(presContext, mStyleContext, cssValue));
mFlags |= NS_MATHML_OPERATOR_MAXSIZE_EXPLICIT;
}
}
@ -615,8 +617,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsPresContext* aPresContext)
// On input - it contains our current size
// On output - the same size or the new size that we want
NS_IMETHODIMP
nsMathMLmoFrame::Stretch(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize)
@ -776,7 +777,7 @@ nsMathMLmoFrame::Stretch(nsPresContext* aPresContext,
}
// let the MathMLChar stretch itself...
nsresult res = mMathMLChar.Stretch(aPresContext, aRenderingContext,
nsresult res = mMathMLChar.Stretch(GetPresContext(), aRenderingContext,
aStretchDirection, container, charSize, stretchHint);
if (NS_FAILED(res)) {
// gracefully handle cases where stretching the char failed (i.e., GetBoundingMetrics failed)
@ -817,7 +818,7 @@ nsMathMLmoFrame::Stretch(nsPresContext* aPresContext,
// Place our children using the default method
// This will allow our child text frame to get its DidReflow()
Place(aPresContext, aRenderingContext, PR_TRUE, aDesiredStretchSize);
Place(aRenderingContext, PR_TRUE, aDesiredStretchSize);
// Fixup for the final height.
// On one hand, our stretchy height can sometimes be shorter than surrounding
@ -930,24 +931,23 @@ nsMathMLmoFrame::Stretch(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmoFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmoFrame::InheritAutomaticData(nsIFrame* aParent)
{
// retain our native direction, it only changes if our text content changes
nsStretchDirection direction = mEmbellishData.direction;
nsMathMLTokenFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLTokenFrame::InheritAutomaticData(aParent);
mEmbellishData.direction = direction;
return NS_OK;
}
NS_IMETHODIMP
nsMathMLmoFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmoFrame::TransmitAutomaticData()
{
// this will cause us to re-sync our flags from scratch
// but our returned 'form' is still not final (bug 133429), it will
// be recomputed to its final value during the next call in Reflow()
mEmbellishData.coreFrame = nsnull;
ProcessOperatorData(aPresContext);
ProcessOperatorData();
return NS_OK;
}
@ -959,7 +959,7 @@ nsMathMLmoFrame::Reflow(nsPresContext* aPresContext,
{
// certain values use units that depend on our style context, so
// it is safer to just process the whole lot here
ProcessOperatorData(aPresContext);
ProcessOperatorData();
return nsMathMLTokenFrame::Reflow(aPresContext, aDesiredSize,
aReflowState, aStatus);
}
@ -973,8 +973,7 @@ nsMathMLmoFrame::ReflowDirtyChild(nsIPresShell* aPresShell,
// an re-build the automatic data from the parent of our outermost embellished
// container (we ensure that we are the core, not just a sibling of the core)
nsPresContext *presContext = aPresShell->GetPresContext();
ProcessTextData(presContext);
ProcessTextData(GetPresContext());
nsIFrame* target = this;
nsEmbellishData embellishData;
@ -984,7 +983,7 @@ nsMathMLmoFrame::ReflowDirtyChild(nsIPresShell* aPresShell,
} while (embellishData.coreFrame == this);
// we have automatic data to update in the children of the target frame
return ReLayoutChildren(presContext, target);
return ReLayoutChildren(target);
}
NS_IMETHODIMP
@ -1008,7 +1007,7 @@ nsMathMLmoFrame::AttributeChanged(nsIContent* aContent,
} while (embellishData.coreFrame == this);
// we have automatic data to update in the children of the target frame
return ReLayoutChildren(GetPresContext(), target);
return ReLayoutChildren(target);
}
return nsMathMLTokenFrame::

Просмотреть файл

@ -67,11 +67,10 @@ public:
PRUint32 aFlags = 0);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
Reflow(nsPresContext* aPresContext,
@ -92,8 +91,7 @@ public:
// This method is called by the parent frame to ask <mo>
// to stretch itself.
NS_IMETHOD
Stretch(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Stretch(nsIRenderingContext& aRenderingContext,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize);
@ -117,12 +115,11 @@ protected:
// our default data that may come from there, and to complete the setup
// using attributes that we may have
void
ProcessOperatorData(nsPresContext* aPresContext);
ProcessOperatorData();
// helper to double check thar our char should be rendered as a selected char
PRBool
IsFrameInSelection(nsPresContext* aPresContext,
nsIFrame* aFrame);
IsFrameInSelection(nsIFrame* aFrame);
};
#endif /* nsMathMLmoFrame_h___ */

Просмотреть файл

@ -88,7 +88,7 @@ nsMathMLmoverFrame::AttributeChanged(nsIContent* aContent,
if (nsMathMLAtoms::accent_ == aAttribute) {
// When we have automatic data to update within ourselves, we ask our
// parent to re-layout its children
return ReLayoutChildren(GetPresContext(), mParent);
return ReLayoutChildren(mParent);
}
return nsMathMLContainerFrame::
@ -97,12 +97,11 @@ nsMathMLmoverFrame::AttributeChanged(nsIContent* aContent,
}
NS_IMETHODIMP
nsMathMLmoverFrame::UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
nsMathMLmoverFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
nsMathMLContainerFrame::UpdatePresentationData(aPresContext,
nsMathMLContainerFrame::UpdatePresentationData(
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
// disable the stretch-all flag if we are going to act like a superscript
if ( NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
@ -116,8 +115,7 @@ nsMathMLmoverFrame::UpdatePresentationData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmoverFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
nsMathMLmoverFrame::UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -143,8 +141,8 @@ nsMathMLmoverFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContex
aFlagsToUpdate &= ~NS_MATHML_DISPLAYSTYLE;
aFlagsValues &= ~NS_MATHML_DISPLAYSTYLE;
}
PropagatePresentationDataFor(aPresContext, childFrame,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
PropagatePresentationDataFor(childFrame, aScriptLevelIncrement,
aFlagsValues, aFlagsToUpdate);
}
index++;
childFrame = childFrame->GetNextSibling();
@ -156,11 +154,10 @@ nsMathMLmoverFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContex
}
NS_IMETHODIMP
nsMathMLmoverFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmoverFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
@ -168,7 +165,7 @@ nsMathMLmoverFrame::InheritAutomaticData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmoverFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmoverFrame::TransmitAutomaticData()
{
// At this stage, all our children are in sync and we can fully
// resolve our own mEmbellishData struct
@ -246,7 +243,7 @@ XXX The winner is the outermost in conflicting settings like these:
? 0 : 1;
PRUint32 compress = NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)
? NS_MATHML_COMPRESSED : 0;
PropagatePresentationDataFor(aPresContext, overscriptFrame, increment,
PropagatePresentationDataFor(overscriptFrame, increment,
~NS_MATHML_DISPLAYSTYLE | compress,
NS_MATHML_DISPLAYSTYLE | compress);
@ -272,15 +269,14 @@ i.e.:
*/
NS_IMETHODIMP
nsMathMLmoverFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmoverFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
if ( NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
!NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags)) {
// place like superscript
return nsMathMLmsupFrame::PlaceSuperScript(aPresContext,
return nsMathMLmsupFrame::PlaceSuperScript(GetPresContext(),
aRenderingContext,
aPlaceOrigin,
aDesiredSize,
@ -300,12 +296,12 @@ nsMathMLmoverFrame::Place(nsPresContext* aPresContext,
if (!baseFrame || !overFrame || overFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize);
return ReflowError(aRenderingContext, aDesiredSize);
}
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
GetReflowAndBoundingMetricsFor(overFrame, overSize, bmOver);
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1);
////////////////////
// Place Children
@ -427,11 +423,11 @@ nsMathMLmoverFrame::Place(nsPresContext* aPresContext,
if (aPlaceOrigin) {
// place base
nscoord dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0);
FinishReflowChild (baseFrame, GetPresContext(), nsnull, baseSize, dxBase, dy, 0);
// place overscript
dy = aDesiredSize.ascent -
mBoundingMetrics.ascent + bmOver.ascent - overSize.ascent;
FinishReflowChild (overFrame, aPresContext, nsnull, overSize, dxOver, dy, 0);
FinishReflowChild (overFrame, GetPresContext(), nsnull, overSize, dxOver, dy, 0);
}
return NS_OK;
}

Просмотреть файл

@ -52,27 +52,23 @@ public:
friend nsresult NS_NewMathMLmoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,

Просмотреть файл

@ -90,11 +90,10 @@ nsMathMLmpaddedFrame::~nsMathMLmpaddedFrame()
}
NS_IMETHODIMP
nsMathMLmpaddedFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmpaddedFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
@ -102,7 +101,7 @@ nsMathMLmpaddedFrame::InheritAutomaticData(nsPresContext* aPresContext,
}
void
nsMathMLmpaddedFrame::ProcessAttributes(nsPresContext* aPresContext)
nsMathMLmpaddedFrame::ProcessAttributes()
{
/*
parse the attributes
@ -378,7 +377,7 @@ nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
ProcessAttributes(aPresContext);
ProcessAttributes();
///////////////
// Let the base class format our content like an inferred mrow

Просмотреть файл

@ -51,8 +51,7 @@ public:
friend nsresult NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
Reflow(nsPresContext* aPresContext,
@ -84,7 +83,7 @@ private:
// helpers to process the attributes
void
ProcessAttributes(nsPresContext* aPresContext);
ProcessAttributes();
static PRBool
ParseAttribute(nsString& aString,

Просмотреть файл

@ -75,11 +75,10 @@ nsMathMLmphantomFrame::~nsMathMLmphantomFrame()
}
NS_IMETHODIMP
nsMathMLmphantomFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmphantomFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;

Просмотреть файл

@ -51,8 +51,7 @@ public:
friend nsresult NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
Paint(nsPresContext* aPresContext,

Просмотреть файл

@ -114,16 +114,16 @@ nsMathMLmrootFrame::Init(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmrootFrame::TransmitAutomaticData(nsPresContext* aPresContext)
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(aPresContext, 1, 1, 2,
UpdatePresentationDataFromChildAt(1, 1, 2,
~NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED,
NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED);
UpdatePresentationDataFromChildAt(aPresContext, 0, 0, 0,
UpdatePresentationDataFromChildAt(0, 0, 0,
NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED);
return NS_OK;
@ -233,7 +233,7 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
if (2 != count) {
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, renderingContext, aDesiredSize);
return ReflowError(renderingContext, aDesiredSize);
}
////////////

Просмотреть файл

@ -65,7 +65,7 @@ public:
nsIFrame* aPrevInFlow);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
Reflow(nsPresContext* aPresContext,

Просмотреть файл

@ -76,11 +76,10 @@ nsMathMLmrowFrame::~nsMathMLmrowFrame()
}
NS_IMETHODIMP
nsMathMLmrowFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;

Просмотреть файл

@ -51,8 +51,7 @@ public:
friend nsresult NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
protected:
nsMathMLmrowFrame();

Просмотреть файл

@ -114,25 +114,25 @@ nsMathMLmsqrtFrame::Init(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmsqrtFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
return NS_OK;
}
NS_IMETHODIMP
nsMathMLmsqrtFrame::TransmitAutomaticData(nsPresContext* aPresContext)
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(aPresContext, 0, -1, 0,
UpdatePresentationDataFromChildAt(0, -1, 0,
NS_MATHML_COMPRESSED,
NS_MATHML_COMPRESSED);

Просмотреть файл

@ -102,14 +102,13 @@ public:
PRUint32 aFlags = 0);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
virtual nsresult
FixInterFrameSpacing(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize)
FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize)
{
// XXX the base method doesn't work properly with <msqrt> because it
// only slides child frames and has no idea that we have a sqrt glyph

Просмотреть файл

@ -78,11 +78,10 @@ nsMathMLmstyleFrame::~nsMathMLmstyleFrame()
// mstyle needs special care for its scriptlevel and displaystyle attributes
NS_IMETHODIMP
nsMathMLmstyleFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmstyleFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
// sync with our current state
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
@ -122,7 +121,7 @@ nsMathMLmstyleFrame::InheritAutomaticData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmstyleFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmstyleFrame::TransmitAutomaticData()
{
// Nothing particular to do here, the values that we computed in
// InheritAutomaticData() are the values that we wanted to pass to
@ -133,8 +132,7 @@ nsMathMLmstyleFrame::TransmitAutomaticData(nsPresContext* aPresContext)
}
NS_IMETHODIMP
nsMathMLmstyleFrame::UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
nsMathMLmstyleFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
@ -174,8 +172,7 @@ nsMathMLmstyleFrame::UpdatePresentationData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmstyleFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
nsMathMLmstyleFrame::UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -201,7 +198,7 @@ nsMathMLmstyleFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresConte
// let the base class worry about the update
return
nsMathMLContainerFrame::UpdatePresentationDataFromChildAt(
aPresContext, aFirstIndex, aLastIndex, aScriptLevelIncrement,
aFirstIndex, aLastIndex, aScriptLevelIncrement,
aFlagsValues, aFlagsToUpdate);
}
@ -216,5 +213,5 @@ nsMathMLmstyleFrame::AttributeChanged(nsIContent* aContent,
// them in our subtree. However, our siblings will be re-laid too. We used
// to have a more speedier but more verbose alternative that didn't re-layout
// our siblings. See bug 114909 - attachment 67668.
return ReLayoutChildren(GetPresContext(), mParent);
return ReLayoutChildren(mParent);
}

Просмотреть файл

@ -57,21 +57,18 @@ public:
PRInt32 aModType);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,

Просмотреть файл

@ -77,7 +77,7 @@ nsMathMLmsubFrame::~nsMathMLmsubFrame()
}
NS_IMETHODIMP
nsMathMLmsubFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmsubFrame::TransmitAutomaticData()
{
// if our base is an embellished operator, let its state bubble to us
nsIFrame* baseFrame = mFrames.FirstChild();
@ -89,7 +89,7 @@ nsMathMLmsubFrame::TransmitAutomaticData(nsPresContext* aPresContext)
// The <msub> element increments scriptlevel by 1, and sets displaystyle to
// "false", within subscript, but leaves both attributes unchanged within base.
// 2. The TeXbook (Ch 17. p.141) says the subscript is compressed
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
UpdatePresentationDataFromChildAt(1, -1, 1,
~NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED,
NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED);
@ -97,8 +97,7 @@ nsMathMLmsubFrame::TransmitAutomaticData(nsPresContext* aPresContext)
}
NS_IMETHODIMP
nsMathMLmsubFrame::Place (nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmsubFrame::Place (nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -112,11 +111,11 @@ nsMathMLmsubFrame::Place (nsPresContext* aPresContext,
nsMathMLAtoms::subscriptshift_, value)) {
nsCSSValue cssValue;
if (ParseNumericValue(value, cssValue) && cssValue.IsLengthUnit()) {
subScriptShift = CalcLength(aPresContext, mStyleContext, cssValue);
subScriptShift = CalcLength(GetPresContext(), mStyleContext, cssValue);
}
}
return nsMathMLmsubFrame::PlaceSubScript(aPresContext,
return nsMathMLmsubFrame::PlaceSubScript(GetPresContext(),
aRenderingContext,
aPlaceOrigin,
aDesiredSize,
@ -158,8 +157,7 @@ nsMathMLmsubFrame::PlaceSubScript (nsPresContext* aPresContext,
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return NS_STATIC_CAST(nsMathMLContainerFrame*,
aFrame)->ReflowError(aPresContext,
aRenderingContext,
aFrame)->ReflowError(aRenderingContext,
aDesiredSize);
}
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
@ -167,7 +165,7 @@ nsMathMLmsubFrame::PlaceSubScript (nsPresContext* aPresContext,
// get the subdrop from the subscript font
nscoord subDrop;
GetSubDropFromChild(aPresContext, subScriptFrame, subDrop);
GetSubDropFromChild(subScriptFrame, subDrop);
// parameter v, Rule 18a, App. G, TeXbook
nscoord minSubScriptShift = bmBase.descent + subDrop;

Просмотреть файл

@ -52,11 +52,10 @@ public:
friend nsresult NS_NewMathMLmsubFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);

Просмотреть файл

@ -77,7 +77,7 @@ nsMathMLmsubsupFrame::~nsMathMLmsubsupFrame()
}
NS_IMETHODIMP
nsMathMLmsubsupFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmsubsupFrame::TransmitAutomaticData()
{
// if our base is an embellished operator, let its state bubble to us
nsIFrame* baseFrame = mFrames.FirstChild();
@ -91,10 +91,10 @@ nsMathMLmsubsupFrame::TransmitAutomaticData(nsPresContext* aPresContext)
// unchanged within base.
// 2. The TeXbook (Ch 17. p.141) says the superscript inherits the compression
// while the subscript is compressed
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
UpdatePresentationDataFromChildAt(1, -1, 1,
~NS_MATHML_DISPLAYSTYLE,
NS_MATHML_DISPLAYSTYLE);
UpdatePresentationDataFromChildAt(aPresContext, 1, 1, 0,
UpdatePresentationDataFromChildAt(1, 1, 0,
NS_MATHML_COMPRESSED,
NS_MATHML_COMPRESSED);
@ -102,8 +102,7 @@ nsMathMLmsubsupFrame::TransmitAutomaticData(nsPresContext* aPresContext)
}
NS_IMETHODIMP
nsMathMLmsubsupFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmsubsupFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -117,7 +116,7 @@ nsMathMLmsubsupFrame::Place(nsPresContext* aPresContext,
nsMathMLAtoms::subscriptshift_, value)) {
nsCSSValue cssValue;
if (ParseNumericValue(value, cssValue) && cssValue.IsLengthUnit()) {
subScriptShift = CalcLength(aPresContext, mStyleContext, cssValue);
subScriptShift = CalcLength(GetPresContext(), mStyleContext, cssValue);
}
}
// check if the superscriptshift attribute is there
@ -126,11 +125,11 @@ nsMathMLmsubsupFrame::Place(nsPresContext* aPresContext,
nsMathMLAtoms::superscriptshift_, value)) {
nsCSSValue cssValue;
if (ParseNumericValue(value, cssValue) && cssValue.IsLengthUnit()) {
supScriptShift = CalcLength(aPresContext, mStyleContext, cssValue);
supScriptShift = CalcLength(GetPresContext(), mStyleContext, cssValue);
}
}
return nsMathMLmsubsupFrame::PlaceSubSupScript(aPresContext,
return nsMathMLmsubsupFrame::PlaceSubSupScript(GetPresContext(),
aRenderingContext,
aPlaceOrigin,
aDesiredSize,
@ -180,8 +179,7 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return NS_STATIC_CAST(nsMathMLContainerFrame*,
aFrame)->ReflowError(aPresContext,
aRenderingContext,
aFrame)->ReflowError(aRenderingContext,
aDesiredSize);
}
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
@ -190,13 +188,13 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
// get the subdrop from the subscript font
nscoord subDrop;
GetSubDropFromChild(aPresContext, subScriptFrame, subDrop);
GetSubDropFromChild(subScriptFrame, subDrop);
// parameter v, Rule 18a, App. G, TeXbook
nscoord minSubScriptShift = bmBase.descent + subDrop;
// get the supdrop from the supscript font
nscoord supDrop;
GetSupDropFromChild(aPresContext, supScriptFrame, supDrop);
GetSupDropFromChild(supScriptFrame, supDrop);
// parameter u, Rule 18a, App. G, TeXbook
nscoord minSupScriptShift = bmBase.ascent - supDrop;
@ -359,15 +357,18 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
FinishReflowChild(baseFrame, aPresContext, nsnull,
baseSize, dx, dy, 0);
// ... and subscript
dx = bmBase.width + aScriptSpace;
dy = aDesiredSize.ascent - (subScriptSize.ascent - subScriptShift);
FinishReflowChild(subScriptFrame, aPresContext, nsnull, subScriptSize, dx, dy, 0);
FinishReflowChild(subScriptFrame, aPresContext, nsnull,
subScriptSize, dx, dy, 0);
// ... and the superscript
dx = bmBase.width + aScriptSpace + italicCorrection;
dy = aDesiredSize.ascent - (supScriptSize.ascent + supScriptShift);
FinishReflowChild(supScriptFrame, aPresContext, nsnull, supScriptSize, dx, dy, 0);
FinishReflowChild(supScriptFrame, aPresContext, nsnull,
supScriptSize, dx, dy, 0);
}
return NS_OK;

Просмотреть файл

@ -52,11 +52,10 @@ public:
friend nsresult NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);

Просмотреть файл

@ -76,7 +76,7 @@ nsMathMLmsupFrame::~nsMathMLmsupFrame()
}
NS_IMETHODIMP
nsMathMLmsupFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmsupFrame::TransmitAutomaticData()
{
// if our base is an embellished operator, its flags bubble to us
nsIFrame* baseFrame = mFrames.FirstChild();
@ -89,7 +89,7 @@ nsMathMLmsupFrame::TransmitAutomaticData(nsPresContext* aPresContext)
// "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(aPresContext, 1, -1, 1,
UpdatePresentationDataFromChildAt(1, -1, 1,
~NS_MATHML_DISPLAYSTYLE,
NS_MATHML_DISPLAYSTYLE);
@ -97,8 +97,7 @@ nsMathMLmsupFrame::TransmitAutomaticData(nsPresContext* aPresContext)
}
NS_IMETHODIMP
nsMathMLmsupFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmsupFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
@ -112,11 +111,11 @@ nsMathMLmsupFrame::Place(nsPresContext* aPresContext,
nsMathMLAtoms::superscriptshift_, value)) {
nsCSSValue cssValue;
if (ParseNumericValue(value, cssValue) && cssValue.IsLengthUnit()) {
supScriptShift = CalcLength(aPresContext, mStyleContext, cssValue);
supScriptShift = CalcLength(GetPresContext(), mStyleContext, cssValue);
}
}
return nsMathMLmsupFrame::PlaceSuperScript(aPresContext,
return nsMathMLmsupFrame::PlaceSuperScript(GetPresContext(),
aRenderingContext,
aPlaceOrigin,
aDesiredSize,
@ -159,8 +158,7 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return NS_STATIC_CAST(nsMathMLContainerFrame*,
aFrame)->ReflowError(aPresContext,
aRenderingContext,
aFrame)->ReflowError(aRenderingContext,
aDesiredSize);
}
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
@ -168,7 +166,7 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
// get the supdrop from the supscript font
nscoord supDrop;
GetSupDropFromChild(aPresContext, supScriptFrame, supDrop);
GetSupDropFromChild(supScriptFrame, supDrop);
// parameter u, Rule 18a, App. G, TeXbook
nscoord minSupScriptShift = bmBase.ascent - supDrop;

Просмотреть файл

@ -52,11 +52,10 @@ public:
friend nsresult NS_NewMathMLmsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);

Просмотреть файл

@ -386,13 +386,12 @@ nsMathMLmtableOuterFrame::~nsMathMLmtableOuterFrame()
}
NS_IMETHODIMP
nsMathMLmtableOuterFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmtableOuterFrame::InheritAutomaticData(nsIFrame* aParent)
{
// XXX the REC says that by default, displaystyle=false in <mtable>
// let the base class inherit the scriptlevel and displaystyle from our parent
nsMathMLFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLFrame::InheritAutomaticData(aParent);
// see if the displaystyle attribute is there and let it override what we inherited
nsAutoString value;

Просмотреть файл

@ -56,27 +56,24 @@ public:
// Overloaded nsIMathMLFrame methods
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(aPresContext, this,
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
aFirstIndex, aLastIndex, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
return NS_OK;
}
NS_IMETHOD
ReResolveScriptStyle(nsPresContext* aPresContext,
PRInt32 aParentScriptLevel)
ReResolveScriptStyle(PRInt32 aParentScriptLevel)
{
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, aParentScriptLevel);
nsMathMLContainerFrame::PropagateScriptStyleFor(this, aParentScriptLevel);
return NS_OK;
}
@ -137,23 +134,21 @@ public:
// Overloaded nsIMathMLFrame methods
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(aPresContext, this,
nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
aFirstIndex, aLastIndex, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
return NS_OK;
}
NS_IMETHOD
ReResolveScriptStyle(nsPresContext* aPresContext,
PRInt32 aParentScriptLevel)
ReResolveScriptStyle(PRInt32 aParentScriptLevel)
{
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, aParentScriptLevel);
nsMathMLContainerFrame::PropagateScriptStyleFor(this, aParentScriptLevel);
return NS_OK;
}

Просмотреть файл

@ -88,7 +88,7 @@ nsMathMLmunderFrame::AttributeChanged(nsIContent* aContent,
if (nsMathMLAtoms::accentunder_ == aAttribute) {
// When we have automatic data to update within ourselves, we ask our
// parent to re-layout its children
return ReLayoutChildren(GetPresContext(), mParent);
return ReLayoutChildren(mParent);
}
return nsMathMLContainerFrame::
@ -97,12 +97,11 @@ nsMathMLmunderFrame::AttributeChanged(nsIContent* aContent,
}
NS_IMETHODIMP
nsMathMLmunderFrame::UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
nsMathMLmunderFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
nsMathMLContainerFrame::UpdatePresentationData(aPresContext,
nsMathMLContainerFrame::UpdatePresentationData(
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
// disable the stretch-all flag if we are going to act like a subscript
if ( NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
@ -116,8 +115,7 @@ nsMathMLmunderFrame::UpdatePresentationData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmunderFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
nsMathMLmunderFrame::UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -143,7 +141,7 @@ nsMathMLmunderFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresConte
aFlagsToUpdate &= ~NS_MATHML_DISPLAYSTYLE;
aFlagsValues &= ~NS_MATHML_DISPLAYSTYLE;
}
PropagatePresentationDataFor(aPresContext, childFrame,
PropagatePresentationDataFor(childFrame,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
}
index++;
@ -156,11 +154,10 @@ nsMathMLmunderFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresConte
}
NS_IMETHODIMP
nsMathMLmunderFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmunderFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
@ -168,7 +165,7 @@ nsMathMLmunderFrame::InheritAutomaticData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmunderFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmunderFrame::TransmitAutomaticData()
{
// At this stage, all our children are in sync and we can fully
// resolve our own mEmbellishData struct
@ -242,7 +239,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
*/
PRInt32 increment = NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)
? 0 : 1;
PropagatePresentationDataFor(aPresContext, underscriptFrame, increment,
PropagatePresentationDataFor(underscriptFrame, increment,
~NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED,
NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED);
@ -269,15 +266,14 @@ i.e.,:
*/
NS_IMETHODIMP
nsMathMLmunderFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
if ( NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
!NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags)) {
// place like subscript
return nsMathMLmsubFrame::PlaceSubScript(aPresContext,
return nsMathMLmsubFrame::PlaceSubScript(GetPresContext(),
aRenderingContext,
aPlaceOrigin,
aDesiredSize,
@ -297,12 +293,12 @@ nsMathMLmunderFrame::Place(nsPresContext* aPresContext,
if (!baseFrame || !underFrame || underFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize);
return ReflowError(aRenderingContext, aDesiredSize);
}
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
GetReflowAndBoundingMetricsFor(underFrame, underSize, bmUnder);
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1);
////////////////////
// Place Children
@ -380,10 +376,10 @@ nsMathMLmunderFrame::Place(nsPresContext* aPresContext,
if (aPlaceOrigin) {
nscoord dy = 0;
// place base
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0);
FinishReflowChild(baseFrame, GetPresContext(), nsnull, baseSize, dxBase, dy, 0);
// place underscript
dy = aDesiredSize.ascent + mBoundingMetrics.descent - bmUnder.descent - underSize.ascent;
FinishReflowChild(underFrame, aPresContext, nsnull, underSize, dxUnder, dy, 0);
FinishReflowChild(underFrame, GetPresContext(), nsnull, underSize, dxUnder, dy, 0);
}
return NS_OK;

Просмотреть файл

@ -52,27 +52,23 @@ public:
friend nsresult NS_NewMathMLmunderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,

Просмотреть файл

@ -89,7 +89,7 @@ nsMathMLmunderoverFrame::AttributeChanged(nsIContent* aContent,
nsMathMLAtoms::accentunder_ == aAttribute) {
// When we have automatic data to update within ourselves, we ask our
// parent to re-layout its children
return ReLayoutChildren(GetPresContext(), mParent);
return ReLayoutChildren(mParent);
}
return nsMathMLContainerFrame::
@ -98,13 +98,12 @@ nsMathMLmunderoverFrame::AttributeChanged(nsIContent* aContent,
}
NS_IMETHODIMP
nsMathMLmunderoverFrame::UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
nsMathMLmunderoverFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate)
{
nsMathMLContainerFrame::UpdatePresentationData(aPresContext,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
nsMathMLContainerFrame::UpdatePresentationData(aScriptLevelIncrement,
aFlagsValues, aFlagsToUpdate);
// disable the stretch-all flag if we are going to act like a subscript-superscript pair
if ( NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
!NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags)) {
@ -117,8 +116,7 @@ nsMathMLmunderoverFrame::UpdatePresentationData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmunderoverFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
nsMathMLmunderoverFrame::UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
@ -149,7 +147,7 @@ nsMathMLmunderoverFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresC
aFlagsToUpdate &= ~NS_MATHML_DISPLAYSTYLE;
aFlagsValues &= ~NS_MATHML_DISPLAYSTYLE;
}
PropagatePresentationDataFor(aPresContext, childFrame,
PropagatePresentationDataFor(childFrame,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
}
index++;
@ -162,11 +160,10 @@ nsMathMLmunderoverFrame::UpdatePresentationDataFromChildAt(nsPresContext* aPresC
}
NS_IMETHODIMP
nsMathMLmunderoverFrame::InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent)
nsMathMLmunderoverFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
@ -174,7 +171,7 @@ nsMathMLmunderoverFrame::InheritAutomaticData(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsMathMLmunderoverFrame::TransmitAutomaticData(nsPresContext* aPresContext)
nsMathMLmunderoverFrame::TransmitAutomaticData()
{
// At this stage, all our children are in sync and we can fully
// resolve our own mEmbellishData struct
@ -270,7 +267,7 @@ nsMathMLmunderoverFrame::TransmitAutomaticData(nsPresContext* aPresContext)
? 0 : 1;
PRUint32 compress = NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)
? NS_MATHML_COMPRESSED : 0;
PropagatePresentationDataFor(aPresContext, overscriptFrame, increment,
PropagatePresentationDataFor(overscriptFrame, increment,
~NS_MATHML_DISPLAYSTYLE | compress,
NS_MATHML_DISPLAYSTYLE | compress);
@ -280,7 +277,7 @@ nsMathMLmunderoverFrame::TransmitAutomaticData(nsPresContext* aPresContext)
*/
increment = NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)
? 0 : 1;
PropagatePresentationDataFor(aPresContext, underscriptFrame, increment,
PropagatePresentationDataFor(underscriptFrame, increment,
~NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED,
NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED);
@ -307,15 +304,14 @@ i.e.,:
*/
NS_IMETHODIMP
nsMathMLmunderoverFrame::Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize)
{
if ( NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
!NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags)) {
// place like sub-superscript pair
return nsMathMLmsubsupFrame::PlaceSubSupScript(aPresContext,
return nsMathMLmsubsupFrame::PlaceSubSupScript(GetPresContext(),
aRenderingContext,
aPlaceOrigin,
aDesiredSize,
@ -339,13 +335,13 @@ nsMathMLmunderoverFrame::Place(nsPresContext* aPresContext,
if (!baseFrame || !underFrame || !overFrame || overFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order
NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize);
return ReflowError(aRenderingContext, aDesiredSize);
}
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
GetReflowAndBoundingMetricsFor(underFrame, underSize, bmUnder);
GetReflowAndBoundingMetricsFor(overFrame, overSize, bmOver);
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1);
////////////////////
// Place Children
@ -503,13 +499,13 @@ nsMathMLmunderoverFrame::Place(nsPresContext* aPresContext,
nscoord dy;
// place overscript
dy = aDesiredSize.ascent - mBoundingMetrics.ascent + bmOver.ascent - overSize.ascent;
FinishReflowChild (overFrame, aPresContext, nsnull, overSize, dxOver, dy, 0);
FinishReflowChild (overFrame, GetPresContext(), nsnull, overSize, dxOver, dy, 0);
// place base
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0);
FinishReflowChild (baseFrame, GetPresContext(), nsnull, baseSize, dxBase, dy, 0);
// place underscript
dy = aDesiredSize.ascent + mBoundingMetrics.descent - bmUnder.descent - underSize.ascent;
FinishReflowChild (underFrame, aPresContext, nsnull, underSize, dxUnder, dy, 0);
FinishReflowChild (underFrame, GetPresContext(), nsnull, underSize, dxUnder, dy, 0);
}
return NS_OK;
}

Просмотреть файл

@ -52,27 +52,23 @@ public:
friend nsresult NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
Place(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
Place(nsIRenderingContext& aRenderingContext,
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
NS_IMETHOD
InheritAutomaticData(nsPresContext* aPresContext,
nsIFrame* aParent);
InheritAutomaticData(nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsPresContext* aPresContext);
TransmitAutomaticData();
NS_IMETHOD
UpdatePresentationData(nsPresContext* aPresContext,
PRInt32 aScriptLevelIncrement,
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,
PRUint32 aFlagsToUpdate);
NS_IMETHOD
UpdatePresentationDataFromChildAt(nsPresContext* aPresContext,
PRInt32 aFirstIndex,
UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
PRInt32 aLastIndex,
PRInt32 aScriptLevelIncrement,
PRUint32 aFlagsValues,