Update to match recent changes in the nsIFrame API.
git-svn-id: svn://10.0.0.236/trunk@49657 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -31,6 +31,7 @@ LIBRARY_NAME = raptormathmlbase_s
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../../base/public \
|
||||
-I$(srcdir)/../../../html/style/src \
|
||||
-I$(srcdir)/../../../html/base/src \
|
||||
-I$(srcdir)/../../../html/content/src \
|
||||
|
||||
@@ -78,6 +78,7 @@ LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
|
||||
-I..\..\..\html\table\src \
|
||||
-I$(PUBLIC)\dom \
|
||||
-I..\..\content\src \
|
||||
-I..\..\..\base\public \
|
||||
-I$(PUBLIC)\netlib -I..\..\..\base\src -I$(PUBLIC)\pref
|
||||
|
||||
LCFLAGS = \
|
||||
|
||||
@@ -37,10 +37,10 @@ public:
|
||||
/* SUPPORT FOR STRETCHY ELEMENTS: <mo> */
|
||||
/*====================================================================*/
|
||||
|
||||
/* method used to ask a stretchy MathML frame to stretch
|
||||
/* Stretch :
|
||||
* method used to ask a stretchy MathML frame to stretch
|
||||
* itself depending on its context
|
||||
*/
|
||||
|
||||
NS_IMETHOD
|
||||
Stretch(nsIPresContext& aPresContext,
|
||||
nsStretchDirection aStretchDirection,
|
||||
@@ -52,13 +52,14 @@ public:
|
||||
/*====================================================================*/
|
||||
|
||||
/* GetPresentationData :
|
||||
/* returns the scriptlevel and displaystyle of the frame */
|
||||
* returns the scriptlevel and displaystyle of the frame
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetPresentationData(PRInt32* aScriptLevel,
|
||||
PRBool* aDisplayStyle) = 0;
|
||||
|
||||
/* UpdatePresentationData :
|
||||
/* Increment the scriptlevel of the frame, and set its displaystyle.
|
||||
* Increments the scriptlevel of the frame, and set its displaystyle.
|
||||
* Note that <mstyle> is the only tag which allows to set
|
||||
* <mstyle displaystyle="true|false" scriptlevel="[+|-]number">
|
||||
* Therefore <mstyle> has its peculiar version of this method.
|
||||
@@ -67,9 +68,8 @@ public:
|
||||
UpdatePresentationData(PRInt32 aScriptLevelIncrement,
|
||||
PRBool aDisplayStyle) = 0;
|
||||
|
||||
|
||||
/* UpdatePresentationDataFromChildAt :
|
||||
/* Increments the scriplevel and set the display level on the whole tree.
|
||||
* Increments the scriplevel and set the display level on the whole tree.
|
||||
* For child frames at: aIndex, aIndex+1, aIndex+2, etc, this method set
|
||||
* their mDisplayStyle to aDisplayStyle and increment their mScriptLevel
|
||||
* with aScriptLevelIncrement. The increment is propagated down to the
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~nsMathMLChar()
|
||||
virtual ~nsMathMLChar()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,8 @@ nsMathMLContainerFrame::IsOnlyWhitespace(nsIFrame* aFrame)
|
||||
// by empty frame we mean a leaf frame whose text content is empty...
|
||||
nsCOMPtr<nsIContent> aContent;
|
||||
aFrame->GetContent(getter_AddRefs(aContent));
|
||||
if (nsnull == aContent)
|
||||
return PR_TRUE;
|
||||
PRInt32 numKids;
|
||||
aContent->ChildCount(numKids);
|
||||
if (0 == numKids) {
|
||||
@@ -146,7 +148,7 @@ nsMathMLContainerFrame::ReflowEmptyChild(nsIFrame* aFrame)
|
||||
* munderover, mmultiscripts, mfrac, mroot, mtable).
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLContainerFrame::Stretch(nsIPresContext& aPresContext,
|
||||
nsStretchDirection aStretchDirection,
|
||||
@@ -199,6 +201,90 @@ nsMathMLContainerFrame::UpdatePresentationDataFromChildAt(PRInt32 aIndex,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helper method to alter the style context
|
||||
// This method is used for switching the font to a subscript/superscript font in
|
||||
// mfrac, msub, msup, msubsup, munder, mover, munderover, mmultiscripts
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLContainerFrame::InsertScriptLevelStyleContext(nsIPresContext& aPresContext)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIFrame* nextFrame = mFrames.FirstChild();
|
||||
while (nsnull != nextFrame && NS_SUCCEEDED(rv)) {
|
||||
nsIFrame* childFrame = nextFrame;
|
||||
rv = nextFrame->GetNextSibling(&nextFrame);
|
||||
if (!IsOnlyWhitespace(childFrame) && NS_SUCCEEDED(rv)) {
|
||||
|
||||
// see if the child frame implements the nsIMathMLFrame interface
|
||||
nsIMathMLFrame* aMathMLFrame;
|
||||
rv = childFrame->QueryInterface(nsIMathMLFrame::GetIID(), (void**)&aMathMLFrame);
|
||||
if (nsnull != aMathMLFrame && NS_SUCCEEDED(rv)) {
|
||||
|
||||
// get the scriptlevel of the child
|
||||
PRInt32 childLevel;
|
||||
PRBool childDisplayStyle;
|
||||
aMathMLFrame->GetPresentationData(&childLevel, &childDisplayStyle);
|
||||
|
||||
// Iteration to set a style context for the script level font.
|
||||
// Wow, here is what is happening: the style system requires that any style context
|
||||
// *must* be uniquely associated to a frame. So we insert as many frames as needed
|
||||
// to scale-down (or scale-up) the fontsize.
|
||||
|
||||
PRInt32 gap = childLevel - mScriptLevel;
|
||||
if (0 != gap) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
childFrame->GetContent(getter_AddRefs(childContent));
|
||||
|
||||
nsIFrame* firstFrame = nsnull;
|
||||
nsIFrame* lastFrame = this;
|
||||
nsIStyleContext* lastStyleContext = mStyleContext;
|
||||
nsCOMPtr<nsIStyleContext> newStyleContext;
|
||||
|
||||
nsAutoString fontSize = (0 < gap)
|
||||
? ":-moz-math-font-size-smaller"
|
||||
: ":-moz-math-font-size-larger";
|
||||
nsCOMPtr<nsIAtom> fontAtom(getter_AddRefs(NS_NewAtom(fontSize)));
|
||||
if (0 > gap) gap = -gap; // absolute value
|
||||
while (0 < gap--) {
|
||||
|
||||
aPresContext.ResolvePseudoStyleContextFor(childContent, fontAtom, lastStyleContext,
|
||||
PR_FALSE, getter_AddRefs(newStyleContext));
|
||||
if (nsnull == newStyleContext || lastStyleContext == newStyleContext) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// create a new frame and append it as sole child of the last created frame
|
||||
nsIFrame* newFrame = nsnull;
|
||||
NS_NewMathMLContainerFrame(&newFrame);
|
||||
NS_ASSERTION(newFrame, "Failed to create new frame");
|
||||
|
||||
newFrame->Init(aPresContext, childContent, lastFrame, newStyleContext, nsnull);
|
||||
|
||||
if (nsnull == firstFrame) {
|
||||
firstFrame = newFrame;
|
||||
}
|
||||
if (this != lastFrame) {
|
||||
lastFrame->SetInitialChildList(aPresContext, nsnull, newFrame);
|
||||
}
|
||||
lastStyleContext = newStyleContext;
|
||||
lastFrame = newFrame;
|
||||
}
|
||||
}
|
||||
if (nsnull != firstFrame) { // at least one new frame was created
|
||||
mFrames.ReplaceFrame(this, childFrame, firstFrame);
|
||||
lastFrame->SetInitialChildList(aPresContext, nsnull, childFrame);
|
||||
childFrame->SetParent(lastFrame);
|
||||
childFrame->SetNextSibling(nsnull);
|
||||
aPresContext.ReParentStyleContext(childFrame, lastStyleContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/* //////////////////
|
||||
* Frame construction
|
||||
* =============================================================================
|
||||
@@ -327,7 +413,7 @@ nsMathMLContainerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get next child");
|
||||
}
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
|
||||
|
||||
/////////////
|
||||
// Place Children now by re-adjusting the origins to align the baselines
|
||||
|
||||
@@ -350,69 +436,3 @@ nsMathMLContainerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This method is an implementation of nsIFrame::ReResolveStyleContext
|
||||
// It is used for switching the font to a subscript/superscript font in
|
||||
// msub, msup, msubsup, munder, mover, munderover, mmultiscripts
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange)
|
||||
{
|
||||
// re calculate our own style context
|
||||
PRInt32 ourChange = aParentChange;
|
||||
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
|
||||
ourChange, aChangeList, &ourChange);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (aLocalChange) {
|
||||
*aLocalChange = ourChange;
|
||||
}
|
||||
|
||||
// re-resolve children
|
||||
|
||||
nsIFrame* child = mFrames.FirstChild();
|
||||
while (nsnull != child && NS_SUCCEEDED(rv)) {
|
||||
|
||||
if (!IsOnlyWhitespace(child)) {
|
||||
|
||||
// default is to inherit the parent style
|
||||
nsIStyleContext* aStyleContext = mStyleContext;
|
||||
nsIStyleContext* newStyleContext = mStyleContext;
|
||||
|
||||
// see if the child frame implements the nsIMathMLFrame interface
|
||||
nsIMathMLFrame* aMathMLFrame;
|
||||
rv = child->QueryInterface(nsIMathMLFrame::GetIID(), (void**)&aMathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && nsnull != aMathMLFrame) {
|
||||
|
||||
// get the scriptlevel of the child
|
||||
PRInt32 childLevel;
|
||||
PRBool childDisplayStyle;
|
||||
aMathMLFrame->GetPresentationData(&childLevel, &childDisplayStyle);
|
||||
|
||||
// iteration to get a pseudo style context for the script level font
|
||||
nsAutoString fontSize;
|
||||
PRInt32 gap = childLevel - mScriptLevel;
|
||||
fontSize = (0 < gap)? ":-moz-math-font-size-smaller" : ":-moz-math-font-size-larger";
|
||||
nsCOMPtr<nsIAtom> fontAtom(getter_AddRefs(NS_NewAtom(fontSize)));
|
||||
if (0 > gap) gap = -gap; // absolute value
|
||||
while (0 < gap) {
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, fontAtom, aStyleContext,
|
||||
PR_FALSE, &newStyleContext);
|
||||
aStyleContext = newStyleContext;
|
||||
gap--;
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 childChange;
|
||||
rv = child->ReResolveStyleContext(aPresContext, newStyleContext,
|
||||
ourChange, aChangeList, &childChange);
|
||||
}
|
||||
child->GetNextSibling(&child);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -34,43 +34,23 @@
|
||||
* mrow. By default, this frame uses its Reflow() method to lay its
|
||||
* children horizontally and ensure that their baselines are aligned.
|
||||
*
|
||||
* This frame is a *math-aware frame* in the sense that given the
|
||||
* markup <tag>base arguments</tag>, the method ReResolveStyleContext()
|
||||
* This frame is a *math-aware frame* in the sense that given the markup
|
||||
* <tag>base arguments</tag>, the method InsertScriptLevelStyleContext()
|
||||
* can be used to render the 'base' in normal-font, and the 'arguments'
|
||||
* in small-font. This is a common functionality to tags like msub, msup,
|
||||
* msubsup, mover, munder, munderover, mmultiscripts. All are derived
|
||||
* from this base class. They use SetInitialChildList() to trigger
|
||||
* ReResolveStyleContext() for the very first time as soon as all their
|
||||
* children are known. However, each of these tags has its own Reflow()
|
||||
* InsertScriptLevelStyleContext() for the very first time as soon as all
|
||||
* their children are known. However, each of these tags has its own Reflow()
|
||||
* method to lay its children as appropriate, thus overriding the default
|
||||
* Reflow() method in this base class.
|
||||
*
|
||||
* Other tags like mi that do not have 'arguments' can be derived from
|
||||
* this base class as well. The class caters for empty arguments.
|
||||
* Notice that mi implements its own ReResolveStyleContext() method
|
||||
* Notice that 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).
|
||||
*
|
||||
* In general therefore, to derive other tags from this base class,
|
||||
* ReResolveStyleContext() must be coded to produce the desired stylistic
|
||||
* effects. For example, mfrac has its own ReResolveStyleContext() method
|
||||
* to set both the numerator and denominator to a small font size, whereas
|
||||
* mrow does not have its own implementation of ReResolveStyleContext(),
|
||||
* and instead uses the one in the base class nsHTMLContainerFrame.
|
||||
*
|
||||
* The advantage provided by the default ReResolveStyleContext() herein is
|
||||
* that MathML tags that need scriptstyle switching can be derived from this
|
||||
* base class with minimum footprint. For the few tags that need different
|
||||
* style switching or that do not need style switching at all, you *should*
|
||||
* override the default ReResolveStyleContext() method provided in this base.
|
||||
* Do not use this nsMathMLContainerFrame::ReResolveStyleContext for a
|
||||
* <tag>base arguments</tag> not needing 'arguments' in small font size.
|
||||
* Instead, you should use nsHTMLContainerFrame::ReResolveStyleContext or
|
||||
* provide your own.
|
||||
*
|
||||
* ReResolveStyleContext() implements nsIFrame::ReResolveStyleContext().
|
||||
* See the documentation in nsIFrame.h for additional information on the
|
||||
* frame API.
|
||||
*/
|
||||
|
||||
class nsMathMLContainerFrame : public nsHTMLContainerFrame, public nsIMathMLFrame {
|
||||
@@ -114,12 +94,10 @@ public:
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// helper method for altering the style contexts of subscript/superscript elements
|
||||
|
||||
NS_IMETHOD
|
||||
ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange);
|
||||
InsertScriptLevelStyleContext(nsIPresContext& aPresContext);
|
||||
|
||||
// helper methods for processing empty MathML frames (with whitespace only)
|
||||
|
||||
@@ -131,8 +109,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
PRInt32 mScriptLevel; // Only relevant to nested frames within: msub, msup, msubsup,
|
||||
// munder, mover, munderover, mmultiscripts, mfrac, mroot, mtable.
|
||||
PRInt32 mScriptLevel; // Relevant to nested frames within: msub, msup, msubsup, munder,
|
||||
// mover, munderover, mmultiscripts, mfrac, mroot, mtable.
|
||||
|
||||
PRBool mDisplayStyle; // displaystyle="false" is intended to slightly alter how the
|
||||
// rendering in done in inline mode.
|
||||
|
||||
@@ -43,4 +43,8 @@ extern nsresult NS_NewMathMLmmultiscriptsFrame ( nsIFrame** aNewFrame );
|
||||
extern nsresult NS_NewMathMLmstyleFrame ( nsIFrame** aNewFrame );
|
||||
extern nsresult NS_NewMathMLmtdFrame ( nsIFrame** aNewFrame );
|
||||
|
||||
inline nsresult NS_NewMathMLContainerFrame( nsIFrame** aNewFrame ) {
|
||||
return NS_NewMathMLmrowFrame(aNewFrame);
|
||||
}
|
||||
|
||||
#endif /* nsMathMLParts_h___ */
|
||||
|
||||
@@ -114,7 +114,7 @@ nsMathMLmfracFrame::Init(nsIPresContext& aPresContext,
|
||||
mLineOrigin.x = 0;
|
||||
mLineOrigin.y = 0;
|
||||
|
||||
// TODO: other attributes like displaystyle...
|
||||
// TODO: other attributes...
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ nsMathMLmfracFrame::Reflow(nsIPresContext& aPresContext,
|
||||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
childFrame->SetRect(nsRect(0,0,0,0));
|
||||
ReflowEmptyChild(childFrame);
|
||||
}
|
||||
else if (2 > count) {
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(0, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ nsMathMLmiFrame::~nsMathMLmiFrame()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmiFrame::Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
@@ -81,19 +82,25 @@ nsMathMLmiFrame::Init(nsIPresContext& aPresContext,
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// if our content is not a single character, we turn the font style to normal.
|
||||
// XXX TrimWhitespace / CompressWhitespace?
|
||||
|
||||
// if our content is a single character, we turn the font to italic
|
||||
// if our content is not a single character, we turn the font to normal
|
||||
// XXX TrimWhitespace / CompressWhitespace?
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmiFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange)
|
||||
nsMathMLmiFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// First, let the base class to its work
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
|
||||
|
||||
// Get the length of the text content that we enclose
|
||||
// our content can include comment-nodes, attribute-nodes, text-nodes...
|
||||
// we use to DOM to make sure that we are only looking at text-nodes...
|
||||
PRInt32 aLength = 0;
|
||||
@@ -116,33 +123,39 @@ nsMathMLmiFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
// re calculate our own style context
|
||||
PRInt32 ourChange = aParentChange;
|
||||
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
|
||||
ourChange, aChangeList, &ourChange);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (aLocalChange) {
|
||||
*aLocalChange = ourChange;
|
||||
// Insert a new pseudo frame between our children and us, i.e., the new frame
|
||||
// becomes our sole child, and our children become children of the new frame.
|
||||
|
||||
// Get a pseudo style context for the appropriate style font
|
||||
// XXX how important is the PseudoStyleContext?
|
||||
nsAutoString fontStyle = (1 == aLength)
|
||||
? ":-moz-math-font-style-italic"
|
||||
: ":-moz-math-font-style-normal";
|
||||
nsCOMPtr<nsIAtom> fontAtom(getter_AddRefs(NS_NewAtom(fontStyle)));
|
||||
nsCOMPtr<nsIStyleContext> newStyleContext;
|
||||
aPresContext.ResolvePseudoStyleContextFor(mContent, fontAtom, mStyleContext,
|
||||
PR_FALSE, getter_AddRefs(newStyleContext));
|
||||
|
||||
if (nsnull != newStyleContext && mStyleContext != newStyleContext) {
|
||||
|
||||
nsIFrame* newFrame = nsnull;
|
||||
NS_NewMathMLContainerFrame(&newFrame);
|
||||
NS_ASSERTION(newFrame, "Failed to create new frame");
|
||||
|
||||
newFrame->Init(aPresContext, mContent, this, newStyleContext, nsnull);
|
||||
|
||||
// our children become children of the new frame
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
newFrame->SetInitialChildList(aPresContext, nsnull, childFrame);
|
||||
while (nsnull != childFrame) {
|
||||
childFrame->SetParent(newFrame);
|
||||
aPresContext.ReParentStyleContext(childFrame, newStyleContext);
|
||||
childFrame->GetNextSibling(&childFrame);
|
||||
}
|
||||
|
||||
// the new frame becomes our sole child
|
||||
mFrames.SetFrames(newFrame);
|
||||
}
|
||||
|
||||
// get a pseudo style context for the normal style font
|
||||
nsCOMPtr<nsIAtom> fontAtom(getter_AddRefs(NS_NewAtom(":-moz-math-font-style-normal")));
|
||||
nsIStyleContext* newStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, fontAtom, mStyleContext,
|
||||
PR_FALSE, &newStyleContext);
|
||||
// re-resolve children
|
||||
PRInt32 childChange;
|
||||
nsIFrame* child = mFrames.FirstChild();
|
||||
while (nsnull != child && NS_SUCCEEDED(rv)) {
|
||||
if (!IsOnlyWhitespace(child)) {
|
||||
rv = child->ReResolveStyleContext(aPresContext,
|
||||
(1 == aLength)? mStyleContext : newStyleContext,
|
||||
ourChange, aChangeList, &childChange);
|
||||
}
|
||||
child->GetNextSibling(&child);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,24 +41,10 @@ public:
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext& aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIFrame* aChildList);
|
||||
protected:
|
||||
nsMathMLmiFrame();
|
||||
virtual ~nsMathMLmiFrame();
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,19 +41,6 @@ public:
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
// We override the nsMathMLContainerFrame::ReResolveStyleContext() method
|
||||
// because this container <tag>base arguments</tag> does not need its
|
||||
// 'arguments' in a smaller font size that the 'base'.
|
||||
NS_IMETHOD
|
||||
ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange)
|
||||
{
|
||||
return nsHTMLContainerFrame::ReResolveStyleContext(aPresContext, aParentContext, aParentChange, aChangeList, aLocalChange);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsMathMLmrowFrame();
|
||||
virtual ~nsMathMLmrowFrame();
|
||||
|
||||
@@ -79,6 +79,7 @@ nsMathMLmstyleFrame::Init(nsIPresContext& aPresContext,
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mFlags = 0;
|
||||
mInnerScriptLevelIncrement = 0;
|
||||
|
||||
// see if the displaystyle attribute is there
|
||||
nsAutoString value;
|
||||
@@ -105,15 +106,15 @@ nsMathMLmstyleFrame::Init(nsIPresContext& aPresContext,
|
||||
mScriptLevel = aUserValue; // explicit value...
|
||||
}
|
||||
else {
|
||||
mScriptLevel += aUserValue; // incremental value...
|
||||
// mScriptLevel += aUserValue; // incremental value...
|
||||
mInnerScriptLevelIncrement = aUserValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO:
|
||||
// Examine all other attributes and update the style context to be
|
||||
// inherited by all children.
|
||||
// Examine all other attributes
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -122,7 +123,9 @@ NS_IMETHODIMP
|
||||
nsMathMLmstyleFrame::UpdatePresentationData(PRInt32 aScriptLevelIncrement,
|
||||
PRBool aDisplayStyle)
|
||||
{
|
||||
// The scriptlevel and displaystyle attributes of mstyle take precedence.
|
||||
// mstyle is special...
|
||||
// Since UpdatePresentationData() can be called by a parent frame, the
|
||||
// scriptlevel and displaystyle attributes of mstyle must take precedence.
|
||||
// Update only if attributes are not there
|
||||
if (!(NS_MATHML_MSTYLE_HAS_DISPLAYSTYLE(mFlags))) {
|
||||
mDisplayStyle = aDisplayStyle;
|
||||
|
||||
@@ -67,7 +67,8 @@ public:
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
UpdatePresentationDataFromChildAt(0, mInnerScriptLevelIncrement, mDisplayStyle);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
UpdatePresentationDataFromChildAt(1, 1, PR_FALSE);
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
InsertScriptLevelStyleContext(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user