Continuing to factor handlers to rebuild automatic data during dynamic changes

This commit is contained in:
rbs%maths.uq.edu.au 2002-02-02 05:43:03 +00:00
Родитель e215b50f24
Коммит 0a35caab09
9 изменённых файлов: 32 добавлений и 86 удалений

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

@ -898,8 +898,8 @@ nsMathMLContainerFrame::SetInitialChildList(nsIPresContext* aPresContext,
}
// There are precise rules governing children of a MathML frame,
// and properties such as the scriptlevel or depends on those rules.
// Hence for things to work, caller must use Append/Insert/etc wisely.
// and properties such as the scriptlevel depends on those rules.
// Hence for things to work, callers must use Append/Insert/etc wisely.
nsresult
nsMathMLContainerFrame::ChildListChanged(nsIPresContext* aPresContext,

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

@ -32,8 +32,8 @@ nsMathMLFrame::InheritAutomaticData(nsIPresContext* aPresContext,
mPresentationData.flags = 0;
mPresentationData.mstyle = nsnull;
mPresentationData.scriptLevel = 0;
mEmbellishData.flags = 0;
mEmbellishData.flags = 0;
mEmbellishData.nextFrame = nsnull;
mEmbellishData.coreFrame = nsnull;
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;

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

@ -67,22 +67,6 @@ nsMathMLmiFrame::~nsMathMLmiFrame()
{
}
NS_IMETHODIMP
nsMathMLmiFrame::Init(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aParent,
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow)
{
nsresult rv = NS_OK;
rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
#endif
return rv;
}
static PRBool
IsStyleInvariant(PRUnichar aChar)
{
@ -91,14 +75,11 @@ IsStyleInvariant(PRUnichar aChar)
// if our content is not a single character, we turn the font to normal
NS_IMETHODIMP
nsMathMLmiFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
nsMathMLmiFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
{
nsresult rv;
// First, let the base class do its work
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
#endif
// Get the text content that we enclose and its length
// our content can include comment-nodes, attribute-nodes, text-nodes...
@ -138,7 +119,7 @@ nsMathMLmiFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsMathMLAtoms::fontstyle_, fontstyle))
{
if (fontstyle.Equals(NS_LITERAL_STRING("italic")))
return rv;
return NS_OK;
}
}
@ -161,7 +142,7 @@ nsMathMLmiFrame::SetInitialChildList(nsIPresContext* aPresContext,
}
}
}
return rv;
return NS_OK;
}
NS_IMETHODIMP

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

@ -33,22 +33,13 @@
class nsMathMLmiFrame : public nsMathMLContainerFrame {
public:
friend nsresult NS_NewMathMLmiFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
Init(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aParent,
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow);
/* mi implements its own SetInitialChildList() method
* to switch to a normal-font (rather than italics) if its text
* content is not a single character (as per the MathML REC).
/* <mi> needs to switch to a normal-font (rather than italics) if
* its text content is not a single character (as per the MathML REC).
* special care is also needed for style-invariant chars - bug 65951
*/
NS_IMETHOD
SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
TransmitAutomaticData(nsIPresContext* aPresContext);
NS_IMETHOD
Reflow(nsIPresContext* aPresContext,

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

@ -185,19 +185,15 @@ nsMathMLmoFrame::Init(nsIPresContext* aPresContext,
mFlags |= NS_MATHML_OPERATOR_MUTABLE;
}
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
#endif
return rv;
}
NS_IMETHODIMP
nsMathMLmoFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
nsMathMLmoFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
{
nsresult rv;
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
#endif
// fill our mEmbellishData member variable
nsIFrame* firstChild = mFrames.FirstChild();
@ -276,7 +272,7 @@ nsMathMLmoFrame::SetInitialChildList(nsIPresContext* aPresContext,
}
}
}
return rv;
return NS_OK;
}
void

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

@ -49,11 +49,6 @@ public:
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD
SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD
Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -73,6 +68,9 @@ public:
PRBool aPlaceOrigin,
nsHTMLReflowMetrics& aDesiredSize);
NS_IMETHOD
TransmitAutomaticData(nsIPresContext* aPresContext);
// This method is called by the parent frame to ask <mo>
// to stretch itself.
NS_IMETHOD

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

@ -82,13 +82,11 @@ nsMathMLmpaddedFrame::~nsMathMLmpaddedFrame()
}
NS_IMETHODIMP
nsMathMLmpaddedFrame::Init(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aParent,
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow)
nsMathMLmpaddedFrame::InheritAutomaticData(nsIPresContext* aPresContext,
nsIFrame* aParent)
{
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aPresContext, aParent);
/*
parse the attributes
@ -138,7 +136,7 @@ nsMathMLmpaddedFrame::Init(nsIPresContext* aPresContext,
ParseAttribute(value, mLeftSpaceSign, mLeftSpace, mLeftSpacePseudoUnit);
}
return rv;
return NS_OK;
}
PRBool

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

@ -35,11 +35,8 @@ public:
friend nsresult NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
NS_IMETHOD
Init(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aParent,
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow);
InheritAutomaticData(nsIPresContext* aPresContext,
nsIFrame* aParent);
NS_IMETHOD
TransmitAutomaticData(nsIPresContext* aPresContext)

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

@ -118,30 +118,15 @@ nsMathMLmstyleFrame::InheritAutomaticData(nsIPresContext* aPresContext,
return NS_OK;
}
// mstyle needs special care for its scriptlevel and displaystyle attributes
NS_IMETHODIMP
nsMathMLmstyleFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
{
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
// figure out our current presentation data
nsPresentationData oldData = mPresentationData;
InheritAutomaticData(aPresContext, mParent);
// propagate to our children if something changed
if (oldData.flags != mPresentationData.flags ||
oldData.scriptLevel != mPresentationData.scriptLevel) {
PRUint32 whichFlags = NS_MATHML_DISPLAYSTYLE;
PRUint32 newValues = NS_MATHML_DISPLAYSTYLE & mPresentationData.flags;
if (newValues == (oldData.flags & NS_MATHML_DISPLAYSTYLE)) {
newValues = 0;
whichFlags = 0;
}
// use the base method here because we really want to reflect any updates
nsMathMLContainerFrame::UpdatePresentationDataFromChildAt(aPresContext, 0, -1,
mPresentationData.scriptLevel - oldData.scriptLevel, newValues, whichFlags);
}
// Nothing particular to do here, the values that we computed in
// InheritAutomaticData() are the values that we wanted to pass to
// our children. Our children would have inherited these values in
// their own InheritAutomaticData() as we descended the frame tree.
return NS_OK;
}