mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 05:14:24 +00:00
Continuation of tyding
This commit is contained in:
parent
1987db669c
commit
cf9d24490b
@ -775,41 +775,6 @@ CompressWhitespace(nsIContent* aContent)
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsMathMLContainerFrame::GetPresentationDataFrom(nsIFrame* aFrame,
|
||||
nsPresentationData& aPresentationData)
|
||||
{
|
||||
nsIFrame* frame = aFrame;
|
||||
while (frame) {
|
||||
nsIMathMLFrame* mathMLFrame;
|
||||
frame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
nsPresentationData presentationData;
|
||||
mathMLFrame->GetPresentationData(presentationData);
|
||||
aPresentationData.mstyle = presentationData.mstyle;
|
||||
aPresentationData.scriptLevel = presentationData.scriptLevel;
|
||||
if (NS_MATHML_IS_DISPLAYSTYLE(presentationData.flags)) {
|
||||
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// stop if we reach the root <math> tag
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
content->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsMathMLAtoms::math) {
|
||||
const nsStyleDisplay* display;
|
||||
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
|
||||
if (display->mDisplay == NS_STYLE_DISPLAY_BLOCK) {
|
||||
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
}
|
||||
|
||||
// This method is called in a top-down manner, as we descend the frame tree
|
||||
// during its construction
|
||||
NS_IMETHODIMP
|
||||
|
@ -170,14 +170,6 @@ public:
|
||||
// --------------------------------------------------------------------------
|
||||
// Additional methods
|
||||
|
||||
// helper to get the presentation data of a frame. If we happen to
|
||||
// be surrounded by non-MathML helper frames needed for our support,
|
||||
// we walk up the frame hierarchy until we reach a MathML frame
|
||||
// or the <root> math element.
|
||||
static void
|
||||
GetPresentationDataFrom(nsIFrame* aFrame,
|
||||
nsPresentationData& aPresentationData);
|
||||
|
||||
// helper to get the preferred size that a container frame should use to fire
|
||||
// the stretch on its stretchy child frames.
|
||||
virtual void
|
||||
|
@ -92,8 +92,45 @@ nsMathMLFrame::ResolveMathMLCharStyle(nsIPresContext* aPresContext,
|
||||
return isStretchy;
|
||||
}
|
||||
|
||||
// helper to get the presentation data of a frame, by possibly walking up
|
||||
// the frame hierarchy if we happen to be surrounded by non-MathML frames.
|
||||
/* static */ void
|
||||
nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
|
||||
nsPresentationData& aPresentationData)
|
||||
{
|
||||
nsIFrame* frame = aFrame;
|
||||
while (frame) {
|
||||
nsIMathMLFrame* mathMLFrame;
|
||||
frame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
|
||||
if (mathMLFrame) {
|
||||
nsPresentationData presentationData;
|
||||
mathMLFrame->GetPresentationData(presentationData);
|
||||
aPresentationData.mstyle = presentationData.mstyle;
|
||||
aPresentationData.scriptLevel = presentationData.scriptLevel;
|
||||
if (NS_MATHML_IS_DISPLAYSTYLE(presentationData.flags)) {
|
||||
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// stop if we reach the root <math> tag
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
content->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsMathMLAtoms::math) {
|
||||
const nsStyleDisplay* display;
|
||||
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
|
||||
if (display->mDisplay == NS_STYLE_DISPLAY_BLOCK) {
|
||||
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
}
|
||||
|
||||
// helper to get an attribute from the content or the surrounding <mstyle> hierarchy
|
||||
nsresult
|
||||
/* static */ nsresult
|
||||
nsMathMLFrame::GetAttribute(nsIContent* aContent,
|
||||
nsIFrame* aMathMLmstyleFrame,
|
||||
nsIAtom* aAttributeAtom,
|
||||
|
@ -151,10 +151,6 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helper to check if a frame is embellished
|
||||
static PRBool
|
||||
IsEmbellishOperator(nsIFrame* aFrame);
|
||||
|
||||
// helper to give a style context suitable for doing the stretching to the
|
||||
// MathMLChar. Frame classes that use this should make the extra style contexts
|
||||
// accessible to the Style System via Get/Set AdditionalStyleContext.
|
||||
@ -165,6 +161,18 @@ public:
|
||||
nsIStyleContext* aParenStyleContext,
|
||||
nsMathMLChar* aMathMLChar);
|
||||
|
||||
// helper to check if a frame is embellished
|
||||
static PRBool
|
||||
IsEmbellishOperator(nsIFrame* aFrame);
|
||||
|
||||
// helper to get the presentation data of a frame. If we happen to
|
||||
// be surrounded by non-MathML helper frames needed for our support,
|
||||
// we walk up the frame hierarchy until we reach a MathML frame
|
||||
// or the <root> math element.
|
||||
static void
|
||||
GetPresentationDataFrom(nsIFrame* aFrame,
|
||||
nsPresentationData& aPresentationData);
|
||||
|
||||
// helper to check if a content has an attribute. If content is nsnull or if
|
||||
// the attribute is not there, check if the attribute is on the mstyle hierarchy
|
||||
// @return NS_CONTENT_ATTR_HAS_VALUE --if attribute has non-empty value, attr="value"
|
||||
|
@ -286,13 +286,12 @@ nsMathMLmtableOuterFrame::Init(nsIPresContext* aPresContext,
|
||||
// XXX the REC says that by default, displaystyle=false in <mtable>
|
||||
|
||||
// now, inherit the scriptlevel and displaystyle from our parent
|
||||
nsMathMLContainerFrame::GetPresentationDataFrom(aParent, mPresentationData);
|
||||
GetPresentationDataFrom(aParent, mPresentationData);
|
||||
|
||||
// see if the displaystyle attribute is there and let it override what we inherited
|
||||
nsAutoString value;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
nsMathMLContainerFrame::GetAttribute(mContent, nsnull,
|
||||
nsMathMLAtoms::displaystyle_, value)) {
|
||||
GetAttribute(mContent, nsnull, nsMathMLAtoms::displaystyle_, value)) {
|
||||
if (value.Equals(NS_LITERAL_STRING("true"))) {
|
||||
mPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
@ -351,8 +350,7 @@ nsMathMLmtableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
||||
PRBool alignAttribute = PR_FALSE;
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
nsMathMLContainerFrame::GetAttribute(mContent, nsnull,
|
||||
nsMathMLAtoms::align_, value)) {
|
||||
GetAttribute(mContent, nsnull, nsMathMLAtoms::align_, value)) {
|
||||
if (value.Equals(NS_LITERAL_STRING("top"))) {
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.descent = aDesiredSize.height;
|
||||
@ -444,7 +442,7 @@ nsMathMLmtdInnerFrame::Init(nsIPresContext* aPresContext,
|
||||
mState |= NS_FRAME_EXCLUDE_IGNORABLE_WHITESPACE;
|
||||
|
||||
// now, inherit the scriptlevel and displaystyle from our parent
|
||||
nsMathMLContainerFrame::GetPresentationDataFrom(aParent, mPresentationData);
|
||||
GetPresentationDataFrom(aParent, mPresentationData);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user