зеркало из https://github.com/mozilla/pjs.git
Added two APIs, InheritAutomaticData() & TransmitAutomaticData(), to respond to dynamic changes that affect automatic data (i.e., data inferred from the actual definition of each MathML tag). The computation of the data was so far mostly locked in Init() and SetInitialChildList() which are meant to be called only once in the life-time of a frame. Factored this computation into the two APIs to be used to rebuild the data, and which can be called repeatedly as appropriate, when dynamic changes arise in the content model. Shuffled code to stay in sync and consolidated the hooks used dynamic changes with the APIs
This commit is contained in:
Родитель
0e9d4c77d1
Коммит
625a7d05a7
|
@ -175,6 +175,30 @@ public:
|
|||
NS_IMETHOD
|
||||
SetPresentationData(const nsPresentationData& aPresentationData) = 0;
|
||||
|
||||
/* InheritAutomaticData() / TransmitAutomaticData() :
|
||||
* There are precise rules governing each MathML frame and its children.
|
||||
* Properties such as the scriptlevel or the embellished nature of a frame
|
||||
* depend on those rules. Also, certain properties that we use to emulate
|
||||
* TeX rendering rules are frame-dependent too. These two methods are meant
|
||||
* to be implemented by frame classes that need to assert specific properties
|
||||
* within their subtrees.
|
||||
*
|
||||
* InheritAutomaticData() is called in a top-down manner [like nsIFrame::Init],
|
||||
* as we descend the frame tree during its construction, whereas
|
||||
* TransmitAutomaticData() is called in a bottom-up manner, as we ascend the
|
||||
* frame tree after its construction [like nsIFrame::SetInitialChildList].
|
||||
* However, unlike Init() and SetInitialChildList() which are called only
|
||||
* once during the life-time of a frame, these two methods are called
|
||||
* whenever we are walking the frame tree to handle dynamic changes that
|
||||
* happen in the content model.
|
||||
*/
|
||||
|
||||
NS_IMETHOD
|
||||
InheritAutomaticData(nsIPresContext* aPresContext, nsIFrame* aParent) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
/* UpdatePresentationData :
|
||||
* Increments the scriptlevel of the frame, and updates its displaystyle and
|
||||
* compression flags. The displaystyle flag of an environment gets updated
|
||||
|
|
|
@ -729,6 +729,49 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext,
|
|||
* =============================================================================
|
||||
*/
|
||||
|
||||
// We use this to wrap non-MathML frames so that foreign elements (e.g.,
|
||||
// html:img) can mix better with other surrounding MathML markups.
|
||||
// Currently we only wrap nsInlineFrames because problems were observed only
|
||||
// in the presence of such frames. By construction, a foreign frame wrapper
|
||||
// has one and only one child, and the life of the wrapper is bound to the
|
||||
// life of that unique child. Not all child list operations are applicable
|
||||
// with a wrapper. One must either use the parent (or the unique child)
|
||||
// for such operations (@see nsMathMLForeignFrameWrapper).
|
||||
nsresult
|
||||
nsMathMLContainerFrame::WrapForeignFrames(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsIFrame* next = mFrames.FirstChild();
|
||||
while (next) {
|
||||
nsIFrame* child = next;
|
||||
next->GetNextSibling(&next);
|
||||
nsInlineFrame* inlineFrame;
|
||||
child->QueryInterface(nsInlineFrame::kInlineFrameCID, (void**)&inlineFrame);
|
||||
if (inlineFrame) {
|
||||
// create a new wrapper frame to wrap this child
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame* wrapper;
|
||||
nsresult rv = NS_NewMathMLForeignFrameWrapper(shell, &wrapper);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIStyleContext> newStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::mozAnonymousBlock,
|
||||
mStyleContext, PR_FALSE,
|
||||
getter_AddRefs(newStyleContext));
|
||||
rv = wrapper->Init(aPresContext, mContent, this, newStyleContext, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
wrapper->Destroy(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
mFrames.ReplaceFrame(this, child, wrapper);
|
||||
child->SetParent(wrapper);
|
||||
child->SetNextSibling(nsnull);
|
||||
aPresContext->ReParentStyleContext(child, newStyleContext);
|
||||
wrapper->SetInitialChildList(aPresContext, nsnull, child);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -821,7 +864,7 @@ nsMathMLContainerFrame::Init(nsIPresContext* aPresContext,
|
|||
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
// now, inherit the scriptlevel and displaystyle from our parent
|
||||
GetPresentationDataFrom(aParent, mPresentationData);
|
||||
InheritAutomaticData(aPresContext, aParent);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -834,8 +877,7 @@ nsMathMLContainerFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
nsIFrame* aChildList)
|
||||
{
|
||||
// First, let the base class do its job
|
||||
nsresult rv;
|
||||
rv = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
|
||||
// Next, since we are an inline frame, and since we are a container, we have to
|
||||
// be very careful with the way we treat our children. Things look okay when
|
||||
|
@ -847,44 +889,72 @@ nsMathMLContainerFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
// In short, the nsInlineFrame class expects a number of *invariants* that are not
|
||||
// met when we mix things.
|
||||
|
||||
// So what we do here is to wrap children that happen to be nsInlineFrames in
|
||||
// anonymous block frames.
|
||||
// XXX Question: Do we have to handle Insert/Remove/Append on behalf of
|
||||
// these anonymous blocks?
|
||||
// Note: By construction, our anonymous blocks have only one child.
|
||||
// So wrap foreign children in nsMathMLForeignFrameWrapper frames
|
||||
WrapForeignFrames(aPresContext);
|
||||
|
||||
nsIFrame* next = mFrames.FirstChild();
|
||||
while (next) {
|
||||
nsIFrame* child = next;
|
||||
next->GetNextSibling(&next);
|
||||
nsInlineFrame* inlineFrame = nsnull;
|
||||
child->QueryInterface(nsInlineFrame::kInlineFrameCID, (void**)&inlineFrame);
|
||||
if (inlineFrame) {
|
||||
// create a new anonymous block frame to wrap this child...
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame* anonymous;
|
||||
rv = NS_NewBlockFrame(shell, &anonymous);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCOMPtr<nsIStyleContext> newStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::mozAnonymousBlock,
|
||||
mStyleContext, PR_FALSE,
|
||||
getter_AddRefs(newStyleContext));
|
||||
rv = anonymous->Init(aPresContext, mContent, this, newStyleContext, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
anonymous->Destroy(aPresContext);
|
||||
return rv;
|
||||
}
|
||||
mFrames.ReplaceFrame(this, child, anonymous);
|
||||
child->SetParent(anonymous);
|
||||
child->SetNextSibling(nsnull);
|
||||
aPresContext->ReParentStyleContext(child, newStyleContext);
|
||||
anonymous->SetInitialChildList(aPresContext, nsnull, child);
|
||||
// Now that our subtree is fully constructed, set the automatic
|
||||
// presentation data and embellishment data that apply in our subtree
|
||||
return TransmitAutomaticData(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.
|
||||
|
||||
nsresult
|
||||
nsMathMLContainerFrame::ChildListChanged(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell)
|
||||
{
|
||||
// wrap any new foreign child that may have crept in
|
||||
WrapForeignFrames(aPresContext);
|
||||
|
||||
// re-sync our presentation data and embellishment data
|
||||
#ifdef DEBUG_rbs
|
||||
PRBool old = NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags);
|
||||
#endif
|
||||
|
||||
RebuildAutomaticDataFor(aPresContext, this);
|
||||
|
||||
#ifdef DEBUG_rbs
|
||||
PRBool now = NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags);
|
||||
if (old != now)
|
||||
NS_WARNING("REMIND: case where the embellished hierarchy has to be rebuilt too");
|
||||
#endif
|
||||
|
||||
// grab the scriptlevel of our parent and re-resolve the style data in
|
||||
// our subtree to sync any change of script sizes
|
||||
nsPresentationData parentData;
|
||||
GetPresentationDataFrom(mParent, parentData);
|
||||
PropagateScriptStyleFor(aPresContext, this, parentData.scriptLevel);
|
||||
|
||||
// Ask our parent frame to reflow us
|
||||
return ReflowDirtyChild(&aPresShell, nsnull);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsMathMLContainerFrame::RebuildAutomaticDataFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
// 1. As we descend the tree, make each child frame inherit data from
|
||||
// the parent
|
||||
// 2. As we ascend the tree, transmit any specific change that we want
|
||||
// down the subtrees
|
||||
nsIFrame* childFrame;
|
||||
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
|
||||
while (childFrame) {
|
||||
nsIMathMLFrame* childMathMLFrame;
|
||||
childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&childMathMLFrame);
|
||||
if (childMathMLFrame) {
|
||||
childMathMLFrame->InheritAutomaticData(aPresContext, aFrame);
|
||||
}
|
||||
RebuildAutomaticDataFor(aPresContext, childFrame);
|
||||
childFrame->GetNextSibling(&childFrame);
|
||||
}
|
||||
nsIMathMLFrame* mathMLFrame;
|
||||
aFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->TransmitAutomaticData(aPresContext);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -898,8 +968,7 @@ nsMathMLContainerFrame::AppendFrames(nsIPresContext* aPresContext,
|
|||
}
|
||||
if (aFrameList) {
|
||||
mFrames.AppendFrames(this, aFrameList);
|
||||
// Ask the parent frame to reflow me.
|
||||
ReflowDirtyChild(&aPresShell, nsnull);
|
||||
return ChildListChanged(aPresContext, aPresShell);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -917,8 +986,7 @@ nsMathMLContainerFrame::InsertFrames(nsIPresContext* aPresContext,
|
|||
if (aFrameList) {
|
||||
// Insert frames after aPrevFrame
|
||||
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
|
||||
// Ask the parent frame to reflow me.
|
||||
ReflowDirtyChild(&aPresShell, nsnull);
|
||||
return ChildListChanged(aPresContext, aPresShell);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -932,44 +1000,9 @@ nsMathMLContainerFrame::RemoveFrame(nsIPresContext* aPresContext,
|
|||
if (aListName) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
if (aOldFrame) {
|
||||
// Loop and destroy the frame and all of its continuations.
|
||||
PRBool generateReflowCommand = PR_FALSE;
|
||||
nsIFrame* oldFrameParent;
|
||||
aOldFrame->GetParent(&oldFrameParent);
|
||||
while (aOldFrame) {
|
||||
// If the frame being removed has zero size then don't bother
|
||||
// generating a reflow command, otherwise make sure we do.
|
||||
nsRect rect;
|
||||
aOldFrame->GetRect(rect);
|
||||
if (!rect.IsEmpty()) {
|
||||
generateReflowCommand = PR_TRUE;
|
||||
}
|
||||
// When the parent is an inline frame we have a simple task - just
|
||||
// remove the frame from its parent's list and generate a reflow
|
||||
// command.
|
||||
nsIFrame* oldFrameNextInFlow;
|
||||
aOldFrame->GetNextInFlow(&oldFrameNextInFlow);
|
||||
nsSplittableType st;
|
||||
aOldFrame->IsSplittable(st);
|
||||
if (NS_FRAME_NOT_SPLITTABLE != st) {
|
||||
nsSplittableFrame::RemoveFromFlow(aOldFrame);
|
||||
}
|
||||
nsIFrame* firstSibling;
|
||||
oldFrameParent->FirstChild(aPresContext, nsnull, &firstSibling);
|
||||
nsFrameList frameList(firstSibling);
|
||||
frameList.DestroyFrame(aPresContext, aOldFrame);
|
||||
aOldFrame = oldFrameNextInFlow;
|
||||
if (aOldFrame) {
|
||||
aOldFrame->GetParent(&oldFrameParent);
|
||||
}
|
||||
}
|
||||
if (generateReflowCommand) {
|
||||
// Ask the parent frame to reflow me.
|
||||
ReflowDirtyChild(&aPresShell, nsnull);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
// remove the child frame
|
||||
mFrames.DestroyFrame(aPresContext, aOldFrame);
|
||||
return ChildListChanged(aPresContext, aPresShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -982,11 +1015,16 @@ nsMathMLContainerFrame::ReplaceFrame(nsIPresContext* aPresContext,
|
|||
if (aListName || !aOldFrame || !aNewFrame) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
// Replace the old frame with the new frame in the list, then remove the old frame
|
||||
// Replace the old frame with the new frame in the list
|
||||
mFrames.ReplaceFrame(this, aOldFrame, aNewFrame);
|
||||
|
||||
// XXX now destroy the old frame, really? the usage of ReplaceFrame() vs.
|
||||
// XXX ReplaceFrameAndDestroy() is ambiguous - see bug 122748
|
||||
// XXX The style system doesn't call ReplaceFrame() and that's why
|
||||
// XXX nobody seems to have been biten by the ambiguity yet
|
||||
aOldFrame->Destroy(aPresContext);
|
||||
// Ask the parent frame to reflow me.
|
||||
return ReflowDirtyChild(&aPresShell, nsnull);
|
||||
|
||||
return ChildListChanged(aPresContext, aPresShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1537,6 +1575,7 @@ nsMathMLContainerFrame::FixInterFrameSpacing(nsIPresContext* aPresContext,
|
|||
|
||||
|
||||
//==========================
|
||||
|
||||
nsresult
|
||||
NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
|
@ -1552,6 +1591,8 @@ NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//==========================
|
||||
|
||||
nsresult
|
||||
NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
// --------------------------------------------------------------------------
|
||||
// Overloaded nsHTMLContainerFrame methods -- see documentation in nsIFrame.h
|
||||
|
||||
|
||||
NS_IMETHOD
|
||||
GetFrameType(nsIAtom** aType) const;
|
||||
|
||||
|
@ -185,6 +185,17 @@ public:
|
|||
// --------------------------------------------------------------------------
|
||||
// Additional methods
|
||||
|
||||
// helper to sync our automatic data and notify our parent to reflow us
|
||||
// when changes (e.g., append/insert/remove) happen in our child list
|
||||
virtual nsresult
|
||||
ChildListChanged(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell);
|
||||
|
||||
// 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(nsIPresContext* aPresContext);
|
||||
|
||||
// helper to get the preferred size that a container frame should use to fire
|
||||
// the stretch on its stretchy child frames.
|
||||
virtual void
|
||||
|
@ -194,10 +205,8 @@ public:
|
|||
nsStretchDirection aStretchDirection,
|
||||
nsBoundingMetrics& aPreferredStretchSize);
|
||||
|
||||
// error handlers to report than an error (typically invalid markup)
|
||||
// was encountered during reflow. By default the user will see the
|
||||
// Unicode REPLACEMENT CHAR U+FFFD at the spot where the error was
|
||||
// encountered.
|
||||
// error handlers to provide a visual feedback to the user when an error
|
||||
// (typically invalid markup) was encountered during reflow.
|
||||
virtual nsresult
|
||||
ReflowError(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -290,6 +299,13 @@ public:
|
|||
PRUint32 aFlagsValues,
|
||||
PRUint32 aFlagsToUpdate);
|
||||
|
||||
// helper to let the rebuild of automatic data (presentation data
|
||||
// and embellishement data) walk through a subtree that may contain
|
||||
// non-MathML container frames
|
||||
static void
|
||||
RebuildAutomaticDataFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
protected:
|
||||
virtual PRIntn GetSkipSides() const { return 0; }
|
||||
};
|
||||
|
@ -307,20 +323,16 @@ class nsMathMLmathBlockFrame : public nsBlockFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// beware, mFrames is not set by nsBlockFrame, FirstChild() is your friend
|
||||
// when you need to access the child list of the block
|
||||
// beware, mFrames is not set by nsBlockFrame
|
||||
// cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = nsBlockFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
|
||||
nsresult rv = nsBlockFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
// re-resolve our subtree to set any mathml-expected scriptsizes
|
||||
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, 0);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -329,6 +341,8 @@ protected:
|
|||
virtual ~nsMathMLmathBlockFrame() {}
|
||||
};
|
||||
|
||||
// --------------
|
||||
|
||||
class nsMathMLmathInlineFrame : public nsInlineFrame {
|
||||
public:
|
||||
friend nsresult NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
@ -338,12 +352,9 @@ public:
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsInlineFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
|
||||
nsresult rv = nsInlineFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
// re-resolve our subtree to set any mathml-expected scriptsizes
|
||||
nsMathMLContainerFrame::PropagateScriptStyleFor(aPresContext, this, 0);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -351,4 +362,5 @@ protected:
|
|||
nsMathMLmathInlineFrame() {}
|
||||
virtual ~nsMathMLmathInlineFrame() {}
|
||||
};
|
||||
|
||||
#endif /* nsMathMLContainerFrame_h___ */
|
||||
|
|
|
@ -25,6 +25,25 @@
|
|||
|
||||
NS_IMPL_QUERY_INTERFACE1(nsMathMLFrame, nsIMathMLFrame)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLFrame::InheritAutomaticData(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent)
|
||||
{
|
||||
mPresentationData.flags = 0;
|
||||
mPresentationData.mstyle = nsnull;
|
||||
mPresentationData.scriptLevel = 0;
|
||||
mEmbellishData.flags = 0;
|
||||
|
||||
mEmbellishData.nextFrame = nsnull;
|
||||
mEmbellishData.coreFrame = nsnull;
|
||||
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
mEmbellishData.leftSpace = mEmbellishData.rightSpace = 0;
|
||||
|
||||
// by default, just inherit the display & scriptlevel of our parent
|
||||
GetPresentationDataFrom(aParent, mPresentationData);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLFrame::UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
PRInt32 aScriptLevelIncrement,
|
||||
|
|
|
@ -127,6 +127,16 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
InheritAutomaticData(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent);
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
PRInt32 aScriptLevelIncrement,
|
||||
|
|
|
@ -95,12 +95,8 @@ nsMathMLmfracFrame::Init(nsIPresContext* aPresContext,
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (IsBevelled()) {
|
||||
// enable the bevelled rendering
|
||||
|
@ -112,10 +108,39 @@ nsMathMLmfracFrame::Init(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmfracFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
|
||||
// 1. The REC says:
|
||||
// The <mfrac> element sets displaystyle to "false", or if it was already
|
||||
// false increments scriptlevel by 1, within numerator and denominator.
|
||||
// 2. The TeXbook (Ch 17. p.141) says the numerator inherits the compression
|
||||
// while the denominator is compressed
|
||||
PRInt32 increment =
|
||||
NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags) ? 0 : 1;
|
||||
mInnerScriptLevel = mPresentationData.scriptLevel + increment;
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, increment,
|
||||
~NS_MATHML_DISPLAYSTYLE,
|
||||
NS_MATHML_DISPLAYSTYLE);
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 1, 1, 0,
|
||||
NS_MATHML_COMPRESSED,
|
||||
NS_MATHML_COMPRESSED);
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
// even when embellished, we need to record that <mfrac> won't fire
|
||||
// Stretch() on its embellished child
|
||||
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
// break the embellished hierarchy to stop propagating the stretching
|
||||
// process, but keep access to mEmbellishData.coreFrame for convenience
|
||||
mEmbellishData.nextFrame = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
|
|
@ -112,6 +112,9 @@ public:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
PRInt32 aScriptLevelIncrement,
|
||||
|
@ -126,38 +129,6 @@ public:
|
|||
PRUint32 aFlagsValues,
|
||||
PRUint32 aFlagsToUpdate);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
// 1. The REC says:
|
||||
// The <mfrac> element sets displaystyle to "false", or if it was already
|
||||
// false increments scriptlevel by 1, within numerator and denominator.
|
||||
// 2. The TeXbook (Ch 17. p.141) says the numerator inherits the compression
|
||||
// while the denominator is compressed
|
||||
PRInt32 increment =
|
||||
NS_MATHML_IS_DISPLAYSTYLE(mPresentationData.flags) ? 0 : 1;
|
||||
mInnerScriptLevel = mPresentationData.scriptLevel + increment;
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, increment,
|
||||
~NS_MATHML_DISPLAYSTYLE,
|
||||
NS_MATHML_DISPLAYSTYLE);
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 1, 1, 0,
|
||||
NS_MATHML_COMPRESSED,
|
||||
NS_MATHML_COMPRESSED);
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
// even when embellished, we need to record that <mfrac> won't fire
|
||||
// Stretch() on its embellished child
|
||||
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
// break the embellished hierarchy to stop propagating the stretching
|
||||
// process, but keep access to mEmbellishData.coreFrame for convenience
|
||||
mEmbellishData.nextFrame = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// helper to translate the thickness attribute into a usable form
|
||||
static nscoord
|
||||
CalcLineThickness(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -99,10 +99,26 @@ nsMathMLmmultiscriptsFrame::Init(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
// The REC says:
|
||||
// The <mmultiscripts> element increments scriptlevel by 1, and sets
|
||||
// displaystyle to "false", within each of its arguments except base, but
|
||||
// leaves both attributes unchanged within base.
|
||||
// XXX Need to update the compression flags in the sub/sup pairs as per TeX
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
|
||||
~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -42,31 +42,15 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
PRBool aPlaceOrigin,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
// The REC says:
|
||||
// The <mmultiscripts> element increments scriptlevel by 1, and sets
|
||||
// displaystyle to "false", within each of its arguments except base, but
|
||||
// leaves both attributes unchanged within base.
|
||||
// XXX Need to update the compression flags in the sub/sup pairs as per TeX
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
|
||||
~NS_MATHML_DISPLAYSTYLE, NS_MATHML_DISPLAYSTYLE);
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
return rv;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsMathMLmmultiscriptsFrame();
|
||||
virtual ~nsMathMLmmultiscriptsFrame();
|
||||
|
|
|
@ -69,23 +69,6 @@ nsMathMLmoverFrame::~nsMathMLmoverFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmoverFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmoverFrame::UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
PRInt32 aScriptLevelIncrement,
|
||||
|
@ -147,18 +130,19 @@ nsMathMLmoverFrame::UpdatePresentationDataFromChildAt(nsIPresContext* aPresConte
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmoverFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
nsMathMLmoverFrame::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
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
|
||||
// set our accent flag
|
||||
|
||||
|
||||
/* The REC says:
|
||||
The default value of accent is false, unless overscript
|
||||
is an <mo> element or an embellished operator. If overscript is
|
||||
|
@ -206,8 +190,8 @@ XXX The winner is the outermost in conflicting settings like these:
|
|||
}
|
||||
}
|
||||
else { // no attribute, get the value from the core
|
||||
rv = mEmbellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
mEmbellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(embellishData.flags)) {
|
||||
mPresentationData.flags |= NS_MATHML_MOVABLELIMITS;
|
||||
|
@ -218,13 +202,13 @@ XXX The winner is the outermost in conflicting settings like these:
|
|||
|
||||
// see if the overscriptFrame is <mo> or an embellished operator
|
||||
if (overscriptFrame) {
|
||||
rv = overscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&overscriptMathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && overscriptMathMLFrame) {
|
||||
overscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&overscriptMathMLFrame);
|
||||
if (overscriptMathMLFrame) {
|
||||
overscriptMathMLFrame->GetEmbellishData(embellishData);
|
||||
// core of the overscriptFrame
|
||||
if (NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags) && embellishData.coreFrame) {
|
||||
rv = embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
// if we have the accent attribute, tell the core to behave as
|
||||
// requested (otherwise leave the core with its default behavior)
|
||||
|
@ -274,7 +258,7 @@ XXX The winner is the outermost in conflicting settings like these:
|
|||
mEmbellishData.flags &= ~NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -35,13 +35,6 @@ class nsMathMLmoverFrame : public nsMathMLContainerFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -49,9 +42,7 @@ public:
|
|||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -90,8 +90,6 @@ nsMathMLmpaddedFrame::Init(nsIPresContext* aPresContext,
|
|||
{
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
/*
|
||||
parse the attributes
|
||||
|
||||
|
@ -140,9 +138,6 @@ nsMathMLmpaddedFrame::Init(nsIPresContext* aPresContext,
|
|||
ParseAttribute(value, mLeftSpaceSign, mLeftSpace, mLeftSpacePseudoUnit);
|
||||
}
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,16 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -67,16 +67,10 @@ nsMathMLmphantomFrame::~nsMathMLmphantomFrame()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmphantomFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
nsMathMLmphantomFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
|
|
|
@ -35,11 +35,7 @@ public:
|
|||
friend nsresult NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
Paint(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -95,15 +95,10 @@ nsMathMLmrootFrame::Init(nsIPresContext* aPresContext,
|
|||
rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent,
|
||||
aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
nsAutoString sqrChar; sqrChar.Assign(kSqrChar);
|
||||
mSqrChar.SetData(aPresContext, sqrChar);
|
||||
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, &mSqrChar);
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,11 @@ public:
|
|||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
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
|
||||
// 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.
|
||||
|
@ -65,7 +64,7 @@ public:
|
|||
NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED);
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 0, 0, 0,
|
||||
NS_MATHML_COMPRESSED, NS_MATHML_COMPRESSED);
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
|
|
|
@ -67,18 +67,13 @@ nsMathMLmrowFrame::~nsMathMLmrowFrame()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmrowFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
nsMathMLmrowFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -35,11 +35,7 @@ public:
|
|||
friend nsresult NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
protected:
|
||||
nsMathMLmrowFrame();
|
||||
|
|
|
@ -95,15 +95,10 @@ nsMathMLmsqrtFrame::Init(nsIPresContext* aPresContext,
|
|||
rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent,
|
||||
aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
nsAutoString sqrChar; sqrChar.Assign(kSqrChar);
|
||||
mSqrChar.SetData(aPresContext, sqrChar);
|
||||
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, &mSqrChar);
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,12 +87,12 @@ public:
|
|||
PRUint32 aFlags = 0);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
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
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
// 1. The REC says:
|
||||
// The <msqrt> element leaves both attributes [displaystyle and scriptlevel]
|
||||
// unchanged within all its arguments.
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, 0,
|
||||
NS_MATHML_COMPRESSED,
|
||||
NS_MATHML_COMPRESSED);
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -68,18 +68,17 @@ nsMathMLmstyleFrame::~nsMathMLmstyleFrame()
|
|||
|
||||
// mstyle needs special care for its scriptlevel and displaystyle attributes
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmstyleFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
nsMathMLmstyleFrame::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);
|
||||
|
||||
// sync with our current state
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
mPresentationData.mstyle = this;
|
||||
|
||||
// cache the values that we would have if we were not special...
|
||||
// cache these values that we would have if we were not special...
|
||||
// In the event of dynamic updates, e.g., if our displastyle and/or
|
||||
// scriptlevel attributes are removed, we will recover our state using
|
||||
// these cached values
|
||||
|
@ -116,11 +115,35 @@ nsMathMLmstyleFrame::Init(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// Examine all other attributes
|
||||
// mstyle needs special care for its scriptlevel and displaystyle attributes
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmstyleFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
|
||||
{
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
||||
|
||||
return rv;
|
||||
// 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);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -43,11 +43,11 @@ public:
|
|||
PRInt32 aHint);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
InheritAutomaticData(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent);
|
||||
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
|
@ -63,20 +63,6 @@ public:
|
|||
PRUint32 aFlagsValues,
|
||||
PRUint32 aFlagsToUpdate);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsMathMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
||||
// This call is peculiar to <mstyle> and will quickly return if there is nothing to update
|
||||
UpdatePresentationDataFromChildAt(aPresContext, 0, -1, 0,
|
||||
NS_MATHML_DISPLAYSTYLE & mPresentationData.flags,
|
||||
NS_MATHML_DISPLAYSTYLE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsMathMLmstyleFrame();
|
||||
virtual ~nsMathMLmstyleFrame();
|
||||
|
|
|
@ -67,22 +67,6 @@ nsMathMLmsubFrame::~nsMathMLmsubFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsubFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult 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;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsubFrame::Place (nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
|
|
@ -35,13 +35,6 @@ class nsMathMLmsubFrame : public nsMathMLContainerFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmsubFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -58,12 +51,14 @@ public:
|
|||
nscoord aScriptSpace = NSFloatPointsToTwips(0.5f));
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
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
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
// 1. The REC says:
|
||||
// The <msub> element increments scriptlevel by 1, and sets displaystyle to
|
||||
// "false", within subscript, but leaves both attributes unchanged within base.
|
||||
|
@ -71,9 +66,7 @@ public:
|
|||
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
|
||||
~NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED,
|
||||
NS_MATHML_DISPLAYSTYLE | NS_MATHML_COMPRESSED);
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -67,23 +67,6 @@ nsMathMLmsubsupFrame::~nsMathMLmsubsupFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsubsupFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult 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;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsubsupFrame::Place (nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
|
|
@ -35,13 +35,6 @@ class nsMathMLmsubsupFrame : public nsMathMLContainerFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -59,12 +52,14 @@ public:
|
|||
nscoord aScriptSpace = NSFloatPointsToTwips(0.5f));
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
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
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
// 1. The REC says:
|
||||
// The <msubsup> element increments scriptlevel by 1, and sets displaystyle to
|
||||
// "false", within subscript and superscript, but leaves both attributes
|
||||
|
@ -77,9 +72,7 @@ public:
|
|||
UpdatePresentationDataFromChildAt(aPresContext, 1, 1, 0,
|
||||
NS_MATHML_COMPRESSED,
|
||||
NS_MATHML_COMPRESSED);
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -66,22 +66,6 @@ nsMathMLmsupFrame::~nsMathMLmsupFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsupFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult 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;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmsupFrame::Place (nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
|
|
@ -35,13 +35,6 @@ class nsMathMLmsupFrame : public nsMathMLContainerFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -58,12 +51,14 @@ public:
|
|||
nscoord aScriptSpace = NSFloatPointsToTwips(0.5f));
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
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
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
// 1. The REC says:
|
||||
// The <msup> element increments scriptlevel by 1, and sets displaystyle to
|
||||
// "false", within superscript, but leaves both attributes unchanged within base.
|
||||
|
@ -72,9 +67,7 @@ public:
|
|||
UpdatePresentationDataFromChildAt(aPresContext, 1, -1, 1,
|
||||
~NS_MATHML_DISPLAYSTYLE,
|
||||
NS_MATHML_DISPLAYSTYLE);
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -203,7 +203,7 @@ MapAttributesInto(nsIPresContext* aPresContext,
|
|||
NS_NAMED_LITERAL_STRING(trueStr, "true");
|
||||
|
||||
//////////////////////////////////////
|
||||
// process attributes that depend on the index of the row
|
||||
// process attributes that depend on the index of the row:
|
||||
// rowalign, rowlines
|
||||
|
||||
// see if the rowalign attribute is not already set
|
||||
|
@ -224,7 +224,7 @@ MapAttributesInto(nsIPresContext* aPresContext,
|
|||
}
|
||||
// if we are not on the first row, see if |rowlines| was specified on the table.
|
||||
// Note that we pass 'rowIndex-1' because the CSS rule in mathml.css is associated
|
||||
// to 'border-top', and it as if we draw the line on behalf of the previous row.
|
||||
// to 'border-top', and it is as if we draw the line on behalf of the previous cell.
|
||||
// This way of doing so allows us to handle selective lines, [row]\hline[row][row]',
|
||||
// and cases of spanning cells without further complications.
|
||||
if (rowIndex > 0) {
|
||||
|
@ -249,7 +249,7 @@ MapAttributesInto(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// process attributes that depend on the index of the column
|
||||
// process attributes that depend on the index of the column:
|
||||
// columnalign, columnlines, XXX need columnwidth too
|
||||
|
||||
// see if the columnalign attribute is not already set
|
||||
|
@ -269,7 +269,7 @@ MapAttributesInto(nsIPresContext* aPresContext,
|
|||
}
|
||||
// if we are not on the first column, see if |columnlines| was specified on
|
||||
// the table. Note that we pass 'colIndex-1' because the CSS rule in mathml.css
|
||||
// is associated to 'border-left', and it as if we draw the line on behalf
|
||||
// is associated to 'border-left', and it is as if we draw the line on behalf
|
||||
// of the previous cell. This way of doing so allows us to handle selective lines,
|
||||
// e.g., 'r|cl', and cases of spanning cells without further complications.
|
||||
if (colIndex > 0) {
|
||||
|
@ -392,18 +392,13 @@ nsMathMLmtableOuterFrame::~nsMathMLmtableOuterFrame()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmtableOuterFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
nsMathMLmtableOuterFrame::InheritAutomaticData(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent)
|
||||
{
|
||||
nsresult rv = nsTableOuterFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
// XXX the REC says that by default, displaystyle=false in <mtable>
|
||||
|
||||
// now, inherit the scriptlevel and displaystyle from our parent
|
||||
GetPresentationDataFrom(aParent, mPresentationData);
|
||||
// let the base class inherit the scriptlevel and displaystyle from our parent
|
||||
nsMathMLFrame::InheritAutomaticData(aPresContext, aParent);
|
||||
|
||||
// see if the displaystyle attribute is there and let it override what we inherited
|
||||
nsAutoString value;
|
||||
|
@ -417,6 +412,21 @@ nsMathMLmtableOuterFrame::Init(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmtableOuterFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsTableOuterFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
// now, inherit the scriptlevel and displaystyle from our parent
|
||||
InheritAutomaticData(aPresContext, aParent);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -473,7 +483,6 @@ nsMathMLmtableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// alignments that are resolved during the reflow of cell frames.
|
||||
|
||||
nscoord oldComputedWidth = reflowState.mComputedWidth;
|
||||
reflowState.availableWidth = NS_UNCONSTRAINEDSIZE;
|
||||
reflowState.mComputedWidth = NS_UNCONSTRAINEDSIZE;
|
||||
reflowState.reason = eReflowReason_Initial;
|
||||
|
||||
|
@ -693,7 +702,7 @@ nsMathMLmtdInnerFrame::Init(nsIPresContext* aPresContext,
|
|||
mState |= NS_FRAME_EXCLUDE_IGNORABLE_WHITESPACE;
|
||||
|
||||
// now, inherit the scriptlevel and displaystyle from our parent
|
||||
GetPresentationDataFrom(aParent, mPresentationData);
|
||||
InheritAutomaticData(aPresContext, aParent);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@ public:
|
|||
|
||||
// Overloaded nsIMathMLFrame methods
|
||||
|
||||
NS_IMETHOD
|
||||
InheritAutomaticData(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent);
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationDataFromChildAt(nsIPresContext* aPresContext,
|
||||
PRInt32 aFirstIndex,
|
||||
|
|
|
@ -69,23 +69,6 @@ nsMathMLmunderFrame::~nsMathMLmunderFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmunderFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags = NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmunderFrame::UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
PRInt32 aScriptLevelIncrement,
|
||||
|
@ -147,12 +130,13 @@ nsMathMLmunderFrame::UpdatePresentationDataFromChildAt(nsIPresContext* aPresCont
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmunderFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
nsMathMLmunderFrame::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
|
||||
|
||||
mEmbellishData.flags = NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
|
@ -205,8 +189,8 @@ XXX The winner is the outermost setting in conflicting settings like these:
|
|||
}
|
||||
}
|
||||
else { // no attribute, get the value from the core
|
||||
rv = mEmbellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
mEmbellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(embellishData.flags)) {
|
||||
mPresentationData.flags |= NS_MATHML_MOVABLELIMITS;
|
||||
|
@ -214,16 +198,16 @@ XXX The winner is the outermost setting in conflicting settings like these:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// see if the underscriptFrame is <mo> or an embellished operator
|
||||
if (underscriptFrame) {
|
||||
rv = underscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&underscriptMathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && underscriptMathMLFrame) {
|
||||
underscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&underscriptMathMLFrame);
|
||||
if (underscriptMathMLFrame) {
|
||||
underscriptMathMLFrame->GetEmbellishData(embellishData);
|
||||
// core of the underscriptFrame
|
||||
if (NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags) && embellishData.coreFrame) {
|
||||
rv = embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
// if we have the accentunder attribute, tell the core to behave as
|
||||
// requested (otherwise leave the core with its default behavior)
|
||||
|
@ -268,7 +252,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
|
|||
mEmbellishData.flags &= ~NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -35,13 +35,6 @@ class nsMathMLmunderFrame : public nsMathMLContainerFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmunderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -49,9 +42,7 @@ public:
|
|||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -69,23 +69,6 @@ nsMathMLmunderoverFrame::~nsMathMLmunderoverFrame()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmunderoverFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsMathMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
|
||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmunderoverFrame::UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
PRInt32 aScriptLevelIncrement,
|
||||
|
@ -152,12 +135,13 @@ nsMathMLmunderoverFrame::UpdatePresentationDataFromChildAt(nsIPresContext* aPres
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLmunderoverFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
nsMathMLmunderoverFrame::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
|
||||
|
||||
mEmbellishData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
|
||||
// check whether or not this is an embellished operator
|
||||
EmbellishOperator();
|
||||
|
@ -210,8 +194,8 @@ nsMathMLmunderoverFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
else { // no attribute, get the value from the core
|
||||
rv = mEmbellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
mEmbellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(embellishData.flags)) {
|
||||
mPresentationData.flags |= NS_MATHML_MOVABLELIMITS;
|
||||
|
@ -222,13 +206,13 @@ nsMathMLmunderoverFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
|
||||
// see if the underscriptFrame is <mo> or an embellished operator
|
||||
if (underscriptFrame) {
|
||||
rv = underscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&underscriptMathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && underscriptMathMLFrame) {
|
||||
underscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&underscriptMathMLFrame);
|
||||
if (underscriptMathMLFrame) {
|
||||
underscriptMathMLFrame->GetEmbellishData(embellishData);
|
||||
// core of the underscriptFrame
|
||||
if (NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags) && embellishData.coreFrame) {
|
||||
rv = embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
// if we have the accentunder attribute, tell the core to behave as
|
||||
// requested (otherwise leave the core with its default behavior)
|
||||
|
@ -250,13 +234,13 @@ nsMathMLmunderoverFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
|
||||
// see if the overscriptFrame is <mo> or an embellished operator
|
||||
if (overscriptFrame) {
|
||||
rv = overscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&overscriptMathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && overscriptMathMLFrame) {
|
||||
overscriptFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&overscriptMathMLFrame);
|
||||
if (overscriptMathMLFrame) {
|
||||
overscriptMathMLFrame->GetEmbellishData(embellishData);
|
||||
// core of the overscriptFrame
|
||||
if (NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags) && embellishData.coreFrame) {
|
||||
rv = embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (NS_SUCCEEDED(rv) && mathMLFrame) {
|
||||
embellishData.coreFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
mathMLFrame->GetEmbellishData(embellishData);
|
||||
// if we have the accent attribute, tell the core to behave as
|
||||
// requested (otherwise leave the core with its default behavior)
|
||||
|
@ -325,7 +309,7 @@ nsMathMLmunderoverFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
mEmbellishData.flags &= ~NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -35,13 +35,6 @@ class nsMathMLmunderoverFrame : public nsMathMLContainerFrame {
|
|||
public:
|
||||
friend nsresult NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD
|
||||
Place(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -49,9 +42,7 @@ public:
|
|||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
NS_IMETHOD
|
||||
SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
TransmitAutomaticData(nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD
|
||||
UpdatePresentationData(nsIPresContext* aPresContext,
|
||||
|
|
Загрузка…
Ссылка в новой задаче