Ongoing deCOMtamination. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2003-07-08 11:00:00 +00:00
Родитель 094e6e3f3a
Коммит 87d53ca294
23 изменённых файлов: 172 добавлений и 295 удалений

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

@ -154,8 +154,7 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra
// where it is assumed that the frame's rect is still acting as place holder // where it is assumed that the frame's rect is still acting as place holder
// for the frame's ascent and descent information // for the frame's ascent and descent information
nsRect rect; nsRect rect = aFrame->GetRect();
aFrame->GetRect(rect);
aReflowMetrics.descent = rect.x; aReflowMetrics.descent = rect.x;
aReflowMetrics.ascent = rect.y; aReflowMetrics.ascent = rect.y;
aReflowMetrics.width = rect.width; aReflowMetrics.width = rect.width;
@ -200,7 +199,6 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIPresContext* aPresContex
NS_MATHML_WILL_STRETCH_ALL_CHILDREN_HORIZONTALLY(mPresentationData.flags) || NS_MATHML_WILL_STRETCH_ALL_CHILDREN_HORIZONTALLY(mPresentationData.flags) ||
NS_MATHML_WILL_STRETCH_ALL_CHILDREN_VERTICALLY(mPresentationData.flags), NS_MATHML_WILL_STRETCH_ALL_CHILDREN_VERTICALLY(mPresentationData.flags),
"invalid call to GetPreferredStretchSize"); "invalid call to GetPreferredStretchSize");
nsRect rect;
PRBool firstTime = PR_TRUE; PRBool firstTime = PR_TRUE;
nsBoundingMetrics bm, bmChild; nsBoundingMetrics bm, bmChild;
nsIFrame* childFrame; nsIFrame* childFrame;
@ -208,7 +206,7 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIPresContext* aPresContex
FirstChild(aPresContext, nsnull, &childFrame); FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) { while (childFrame) {
// initializations in case this child happens not to be a MathML frame // initializations in case this child happens not to be a MathML frame
childFrame->GetRect(rect); nsRect rect = childFrame->GetRect();
bmChild.ascent = rect.y; bmChild.ascent = rect.y;
bmChild.descent = rect.x; bmChild.descent = rect.x;
bmChild.width = rect.width; bmChild.width = rect.width;
@ -262,7 +260,7 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIPresContext* aPresContex
break; break;
} }
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
aPreferredStretchSize = bm; aPreferredStretchSize = bm;
} }
@ -334,8 +332,7 @@ nsMathMLContainerFrame::Stretch(nsIPresContext* aPresContext,
mEmbellishData.direction, containerSize, childSize); mEmbellishData.direction, containerSize, childSize);
// store the updated metrics // store the updated metrics
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childSize.descent, childSize.ascent,
nsRect(childSize.descent, childSize.ascent,
childSize.width, childSize.height)); childSize.width, childSize.height));
// Remember the siblings which were _deferred_. // Remember the siblings which were _deferred_.
@ -363,12 +360,11 @@ nsMathMLContainerFrame::Stretch(nsIPresContext* aPresContext,
mathMLFrame->Stretch(aPresContext, aRenderingContext, mathMLFrame->Stretch(aPresContext, aRenderingContext,
stretchDir, containerSize, childSize); stretchDir, containerSize, childSize);
// store the updated metrics // store the updated metrics
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childSize.descent, childSize.ascent,
nsRect(childSize.descent, childSize.ascent,
childSize.width, childSize.height)); childSize.width, childSize.height));
} }
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
@ -402,12 +398,11 @@ nsMathMLContainerFrame::Stretch(nsIPresContext* aPresContext,
aDesiredStretchSize.mBoundingMetrics.leftBearing += dx; aDesiredStretchSize.mBoundingMetrics.leftBearing += dx;
aDesiredStretchSize.mBoundingMetrics.rightBearing += dx; aDesiredStretchSize.mBoundingMetrics.rightBearing += dx;
nsPoint origin;
childFrame = mFrames.FirstChild(); childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
childFrame->GetOrigin(origin); childFrame->SetPosition(childFrame->GetPosition()
childFrame->MoveTo(aPresContext, origin.x + dx, origin.y); + nsPoint(dx, 0));
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
} }
@ -538,7 +533,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFor(nsIPresContext* aPresContex
while (childFrame) { while (childFrame) {
PropagatePresentationDataFor(aPresContext, childFrame, PropagatePresentationDataFor(aPresContext, childFrame,
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate); aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
} }
@ -565,7 +560,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsIPresContext* aPr
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate); aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
} }
index++; index++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
@ -594,8 +589,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext,
nsStyleContext* oldStyleContext = aFrame->GetStyleContext(); nsStyleContext* oldStyleContext = aFrame->GetStyleContext();
nsStyleContext* parentContext = oldStyleContext->GetParent(); nsStyleContext* parentContext = oldStyleContext->GetParent();
nsCOMPtr<nsIContent> content; nsIContent* content = aFrame->GetContent();
aFrame->GetContent(getter_AddRefs(content));
if (!gap) { if (!gap) {
// unset any -moz-math-font-size attribute without notifying that we want a reflow // unset any -moz-math-font-size attribute without notifying that we want a reflow
content->UnsetAttr(kNameSpaceID_None, nsMathMLAtoms::fontsize, PR_FALSE); content->UnsetAttr(kNameSpaceID_None, nsMathMLAtoms::fontsize, PR_FALSE);
@ -671,8 +665,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext,
minChange, maxChange); minChange, maxChange);
#ifdef DEBUG #ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such // Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame; nsIFrame* parentFrame = aFrame->GetParent();
aFrame->GetParent(&parentFrame);
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame); fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame);
#endif #endif
} }
@ -692,7 +685,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext,
else { else {
PropagateScriptStyleFor(aPresContext, childFrame, aParentScriptLevel); PropagateScriptStyleFor(aPresContext, childFrame, aParentScriptLevel);
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
@ -716,7 +709,7 @@ nsMathMLContainerFrame::WrapForeignFrames(nsIPresContext* aPresContext)
nsIFrame* next = mFrames.FirstChild(); nsIFrame* next = mFrames.FirstChild();
while (next) { while (next) {
nsIFrame* child = next; nsIFrame* child = next;
next->GetNextSibling(&next); next = next->GetNextSibling();
nsInlineFrame* inlineFrame; nsInlineFrame* inlineFrame;
child->QueryInterface(kInlineFrameCID, (void**)&inlineFrame); child->QueryInterface(kInlineFrameCID, (void**)&inlineFrame);
if (inlineFrame) { if (inlineFrame) {
@ -853,7 +846,7 @@ nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsIPresContext* aPresCon
childMathMLFrame->InheritAutomaticData(aPresContext, aParentFrame); childMathMLFrame->InheritAutomaticData(aPresContext, aParentFrame);
} }
RebuildAutomaticDataForChildren(aPresContext, childFrame); RebuildAutomaticDataForChildren(aPresContext, childFrame);
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
nsIMathMLFrame* mathMLFrame; nsIMathMLFrame* mathMLFrame;
aParentFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); aParentFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame);
@ -881,8 +874,7 @@ nsMathMLContainerFrame::ReLayoutChildren(nsIPresContext* aPresContext,
} }
// stop if we reach the root <math> tag // stop if we reach the root <math> tag
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
nsCOMPtr<nsIContent> content; nsIContent* content = frame->GetContent();
frame->GetContent(getter_AddRefs(content));
NS_ASSERTION(content, "dangling frame without a content node"); NS_ASSERTION(content, "dangling frame without a content node");
if (!content) if (!content)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -891,10 +883,8 @@ nsMathMLContainerFrame::ReLayoutChildren(nsIPresContext* aPresContext,
break; break;
} }
// mark the frame dirty, and continue to climb up // mark the frame dirty, and continue to climb up
nsFrameState state; frame->AddStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
frame->GetFrameState(&state); frame = frame->GetParent();
frame->SetFrameState(state | NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
frame->GetParent(&frame);
} }
NS_ASSERTION(frame, "bad MathML markup - could not find the top <math> element"); NS_ASSERTION(frame, "bad MathML markup - could not find the top <math> element");
if (!frame) if (!frame)
@ -931,7 +921,7 @@ nsMathMLContainerFrame::ReLayoutChildren(nsIPresContext* aPresContext,
else { else {
PropagateScriptStyleFor(aPresContext, childFrame, parentScriptLevel); PropagateScriptStyleFor(aPresContext, childFrame, parentScriptLevel);
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
// Ask our parent frame to reflow us // Ask our parent frame to reflow us
@ -1107,10 +1097,9 @@ printf("\n");
// At this stage, the origin points of the children have no use, so we will use the // At this stage, the origin points of the children have no use, so we will use the
// origins as placeholders to store the child's ascent and descent. Later on, // origins as placeholders to store the child's ascent and descent. Later on,
// we should set the origins so as to overwrite what we are storing there now. // we should set the origins so as to overwrite what we are storing there now.
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height)); childDesiredSize.width, childDesiredSize.height));
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
///////////// /////////////
@ -1151,11 +1140,10 @@ printf("\n");
mathMLFrame->Stretch(aPresContext, *aReflowState.rendContext, mathMLFrame->Stretch(aPresContext, *aReflowState.rendContext,
stretchDir, containerSize, childDesiredSize); stretchDir, containerSize, childDesiredSize);
// store the updated metrics // store the updated metrics
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height)); childDesiredSize.width, childDesiredSize.height));
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
@ -1361,7 +1349,7 @@ nsMathMLContainerFrame::Place(nsIPresContext* aPresContext,
// another math frame // another math frame
mBoundingMetrics.width += italicCorrection; mBoundingMetrics.width += italicCorrection;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
aDesiredSize.width = mBoundingMetrics.width; aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent; aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
@ -1406,7 +1394,7 @@ nsMathMLContainerFrame::Place(nsIPresContext* aPresContext,
FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0); FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0);
// add child size + italic correction // add child size + italic correction
dx += bmChild.width + italicCorrection; dx += bmChild.width + italicCorrection;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
@ -1432,7 +1420,7 @@ GetInterFrameSpacingFor(nsIPresContext* aPresContext,
nsCOMPtr<nsIAtom> childFrameType; nsCOMPtr<nsIAtom> childFrameType;
nsCOMPtr<nsIAtom> prevFrameType; nsCOMPtr<nsIAtom> prevFrameType;
childFrame->GetFrameType(getter_AddRefs(childFrameType)); childFrame->GetFrameType(getter_AddRefs(childFrameType));
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
while (childFrame) { while (childFrame) {
prevFrameType = childFrameType; prevFrameType = childFrameType;
childFrame->GetFrameType(getter_AddRefs(childFrameType)); childFrame->GetFrameType(getter_AddRefs(childFrameType));
@ -1446,7 +1434,7 @@ GetInterFrameSpacingFor(nsIPresContext* aPresContext,
// we are done // we are done
return space * thinSpace; return space * thinSpace;
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
NS_NOTREACHED("child not in the childlist of its parent"); NS_NOTREACHED("child not in the childlist of its parent");
@ -1458,8 +1446,7 @@ nsMathMLContainerFrame::FixInterFrameSpacing(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize) nsHTMLReflowMetrics& aDesiredSize)
{ {
nsCOMPtr<nsIAtom> parentTag; nsCOMPtr<nsIAtom> parentTag;
nsCOMPtr<nsIContent> parentContent; nsIContent* parentContent = mParent->GetContent();
mParent->GetContent(getter_AddRefs(parentContent));
parentContent->GetTag(getter_AddRefs(parentTag)); parentContent->GetTag(getter_AddRefs(parentTag));
if (parentTag == nsMathMLAtoms::math || if (parentTag == nsMathMLAtoms::math ||
parentTag == nsMathMLAtoms::mtd_) { parentTag == nsMathMLAtoms::mtd_) {
@ -1473,10 +1460,8 @@ nsMathMLContainerFrame::FixInterFrameSpacing(nsIPresContext* aPresContext,
if (gap) { if (gap) {
nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
nsPoint origin; childFrame->SetPosition(childFrame->GetPosition() + nsPoint(gap, 0));
childFrame->GetOrigin(origin); childFrame = childFrame->GetNextSibling();
childFrame->MoveTo(aPresContext, origin.x + gap, origin.y);
childFrame->GetNextSibling(&childFrame);
} }
mBoundingMetrics.leftBearing += gap; mBoundingMetrics.leftBearing += gap;
mBoundingMetrics.rightBearing += gap; mBoundingMetrics.rightBearing += gap;

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

@ -169,8 +169,7 @@ nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
} }
// stop if we reach the root <math> tag // stop if we reach the root <math> tag
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
nsCOMPtr<nsIContent> content; nsIContent* content = frame->GetContent();
frame->GetContent(getter_AddRefs(content));
NS_ASSERTION(content, "dangling frame without a content node"); NS_ASSERTION(content, "dangling frame without a content node");
if (!content) if (!content)
break; break;
@ -182,22 +181,11 @@ nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
} }
break; break;
} }
frame->GetParent(&frame); frame = frame->GetParent();
} }
NS_ASSERTION(frame, "bad MathML markup - could not find the top <math> element"); NS_ASSERTION(frame, "bad MathML markup - could not find the top <math> element");
} }
/* static */ PRBool
nsMathMLFrame::HasNextSibling(nsIFrame* aFrame)
{
if (aFrame) {
nsIFrame* sibling;
aFrame->GetNextSibling(&sibling);
return sibling != nsnull;
}
return PR_FALSE;
}
// helper to get an attribute from the content or the surrounding <mstyle> hierarchy // helper to get an attribute from the content or the surrounding <mstyle> hierarchy
/* static */ nsresult /* static */ nsresult
nsMathMLFrame::GetAttribute(nsIContent* aContent, nsMathMLFrame::GetAttribute(nsIContent* aContent,
@ -215,11 +203,7 @@ nsMathMLFrame::GetAttribute(nsIContent* aContent,
if (NS_CONTENT_ATTR_NOT_THERE == rv) { if (NS_CONTENT_ATTR_NOT_THERE == rv) {
// see if we can get the attribute from the mstyle frame // see if we can get the attribute from the mstyle frame
if (aMathMLmstyleFrame) { if (aMathMLmstyleFrame) {
nsCOMPtr<nsIContent> mstyleContent; nsIFrame* mstyleParent = aMathMLmstyleFrame->GetParent();
aMathMLmstyleFrame->GetContent(getter_AddRefs(mstyleContent));
nsIFrame* mstyleParent;
aMathMLmstyleFrame->GetParent(&mstyleParent);
nsPresentationData mstyleParentData; nsPresentationData mstyleParentData;
mstyleParentData.mstyle = nsnull; mstyleParentData.mstyle = nsnull;
@ -233,7 +217,8 @@ nsMathMLFrame::GetAttribute(nsIContent* aContent,
} }
// recurse all the way up into the <mstyle> hierarchy // recurse all the way up into the <mstyle> hierarchy
rv = GetAttribute(mstyleContent, mstyleParentData.mstyle, aAttributeAtom, aValue); rv = GetAttribute(aMathMLmstyleFrame->GetContent(),
mstyleParentData.mstyle, aAttributeAtom, aValue);
} }
} }
return rv; return rv;
@ -699,9 +684,7 @@ nsMathMLFrame::MapAttributesIntoCSS(nsIPresContext* aPresContext,
nsMathMLFrame::MapAttributesIntoCSS(nsIPresContext* aPresContext, nsMathMLFrame::MapAttributesIntoCSS(nsIPresContext* aPresContext,
nsIFrame* aFrame) nsIFrame* aFrame)
{ {
nsCOMPtr<nsIContent> content; PRInt32 ruleCount = MapAttributesIntoCSS(aPresContext, aFrame->GetContent());
aFrame->GetContent(getter_AddRefs(content));
PRInt32 ruleCount = MapAttributesIntoCSS(aPresContext, content);
if (!ruleCount) if (!ruleCount)
return 0; return 0;
@ -718,8 +701,7 @@ nsMathMLFrame::MapAttributesIntoCSS(nsIPresContext* aPresContext,
changeList, minChange, maxChange); changeList, minChange, maxChange);
#ifdef DEBUG #ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such // Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame; nsIFrame* parentFrame = aFrame->GetParent();
aFrame->GetParent(&parentFrame);
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame); fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame);
#endif #endif
} }

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

@ -192,11 +192,6 @@ public:
nsPresentationData& aPresentationData, nsPresentationData& aPresentationData,
PRBool aClimbTree = PR_TRUE); PRBool aClimbTree = PR_TRUE);
// helper to check if a frame has a next sibling - used to report
// an error when a next sibling is found where unexpected
static PRBool
HasNextSibling(nsIFrame* aFrame);
// helper to check if a content has an attribute. If content is nsnull or if // 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 // 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" // @return NS_CONTENT_ATTR_HAS_VALUE --if attribute has non-empty value, attr="value"

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

@ -123,10 +123,8 @@ nsMathMLTokenFrame::SetInitialChildList(nsIPresContext* aPresContext,
mState |= NS_FRAME_OUTSIDE_CHILDREN; mState |= NS_FRAME_OUTSIDE_CHILDREN;
nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
nsFrameState state; childFrame->AddStateBits(NS_FRAME_OUTSIDE_CHILDREN);
childFrame->GetFrameState(&state); childFrame = childFrame->GetNextSibling();
childFrame->SetFrameState(state | NS_FRAME_OUTSIDE_CHILDREN);
childFrame->GetNextSibling(&childFrame);
} }
SetQuotes(aPresContext); SetQuotes(aPresContext);
@ -172,8 +170,7 @@ printf("\n");
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// origins are used as placeholders to store the child's ascent and descent. // origins are used as placeholders to store the child's ascent and descent.
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height)); childDesiredSize.width, childDesiredSize.height));
// compute and cache the bounding metrics // compute and cache the bounding metrics
if (0 == count) if (0 == count)
@ -182,7 +179,7 @@ printf("\n");
aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics; aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics;
count++; count++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
if (aDesiredSize.mComputeMEW) { if (aDesiredSize.mComputeMEW) {
@ -221,11 +218,10 @@ nsMathMLTokenFrame::Place(nsIPresContext* aPresContext,
if (aPlaceOrigin) { if (aPlaceOrigin) {
nscoord dy, dx = 0; nscoord dy, dx = 0;
nsRect rect;
nsIFrame* childFrame; nsIFrame* childFrame;
FirstChild(aPresContext, nsnull, &childFrame); FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) { while (childFrame) {
childFrame->GetRect(rect); nsRect rect = childFrame->GetRect();
nsHTMLReflowMetrics childSize(nsnull); nsHTMLReflowMetrics childSize(nsnull);
childSize.width = rect.width; childSize.width = rect.width;
childSize.height = aDesiredSize.height; //rect.height; childSize.height = aDesiredSize.height; //rect.height;
@ -234,7 +230,7 @@ nsMathMLTokenFrame::Place(nsIPresContext* aPresContext,
dy = rect.IsEmpty() ? 0 : aDesiredSize.ascent - rect.y; dy = rect.IsEmpty() ? 0 : aDesiredSize.ascent - rect.y;
FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0); FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0);
dx += rect.width; dx += rect.width;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
@ -359,8 +355,7 @@ nsMathMLTokenFrame::SetTextStyle(nsIPresContext* aPresContext)
changeList, minChange, maxChange); changeList, minChange, maxChange);
#ifdef DEBUG #ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such // Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame; nsIFrame* parentFrame = GetParent();
GetParent(&parentFrame);
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : this); fm->DebugVerifyStyleTree(parentFrame ? parentFrame : this);
#endif #endif
} }
@ -399,8 +394,7 @@ SetQuote(nsIPresContext* aPresContext,
aFrame = textFrame; aFrame = textFrame;
} while (textFrame); } while (textFrame);
if (textFrame) { if (textFrame) {
nsCOMPtr<nsIContent> quoteContent; nsIContent* quoteContent = textFrame->GetContent();
textFrame->GetContent(getter_AddRefs(quoteContent));
if (quoteContent) { if (quoteContent) {
nsCOMPtr<nsIDOMText> domText(do_QueryInterface(quoteContent)); nsCOMPtr<nsIDOMText> domText(do_QueryInterface(quoteContent));
if (domText) { if (domText) {
@ -425,9 +419,9 @@ nsMathMLTokenFrame::SetQuotes(nsIPresContext* aPresContext)
nsIFrame* baseFrame = nsnull; nsIFrame* baseFrame = nsnull;
nsIFrame* leftFrame = mFrames.FirstChild(); nsIFrame* leftFrame = mFrames.FirstChild();
if (leftFrame) if (leftFrame)
leftFrame->GetNextSibling(&baseFrame); baseFrame = leftFrame->GetNextSibling();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&rightFrame); rightFrame = baseFrame->GetNextSibling();
if (!leftFrame || !baseFrame || !rightFrame) if (!leftFrame || !baseFrame || !rightFrame)
return; return;

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

@ -194,7 +194,7 @@ nsMathMLmactionFrame::GetSelectedFrame()
if (++count == selection) if (++count == selection)
mSelectedFrame = childFrame; mSelectedFrame = childFrame;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
// cater for invalid user-supplied selection // cater for invalid user-supplied selection
if (selection > count || selection < 1) if (selection > count || selection < 1)
@ -243,8 +243,7 @@ nsMathMLmactionFrame::GetFrameForPoint(nsIPresContext* aPresContext,
{ {
nsIFrame* childFrame = GetSelectedFrame(); nsIFrame* childFrame = GetSelectedFrame();
if (childFrame) { if (childFrame) {
nsPoint pt; nsPoint pt(aPoint.x - mRect.x, aPoint.y - mRect.y);
pt.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y);
return childFrame->GetFrameForPoint(aPresContext, pt, aWhichLayer, aFrame); return childFrame->GetFrameForPoint(aPresContext, pt, aWhichLayer, aFrame);
} }
return nsFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame); return nsFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame);
@ -314,8 +313,7 @@ nsMathMLmactionFrame::Reflow(nsIPresContext* aPresContext,
childFrame, availSize, reason); childFrame, availSize, reason);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, rv = ReflowChild(childFrame, aPresContext, aDesiredSize,
childReflowState, aStatus); childReflowState, aStatus);
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(aDesiredSize.descent,aDesiredSize.ascent,
nsRect(aDesiredSize.descent,aDesiredSize.ascent,
aDesiredSize.width,aDesiredSize.height)); aDesiredSize.width,aDesiredSize.height));
mBoundingMetrics = aDesiredSize.mBoundingMetrics; mBoundingMetrics = aDesiredSize.mBoundingMetrics;
FinalizeReflow(aPresContext, *aReflowState.rendContext, aDesiredSize); FinalizeReflow(aPresContext, *aReflowState.rendContext, aDesiredSize);

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

@ -319,8 +319,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
// At this stage, the origin points of the children have no use, so we will use the // At this stage, the origin points of the children have no use, so we will use the
// origins as placeholders to store the child's ascent and descent. Later on, // origins as placeholders to store the child's ascent and descent. Later on,
// we should set the origins so as to overwrite what we are storing there now. // we should set the origins so as to overwrite what we are storing there now.
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height)); childDesiredSize.width, childDesiredSize.height));
// compute the bounding metrics right now for mfrac // compute the bounding metrics right now for mfrac
@ -333,7 +332,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
else else
aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics; aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
///////////// /////////////
@ -364,8 +363,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
mathmlChild->Stretch(aPresContext, *aReflowState.rendContext, mathmlChild->Stretch(aPresContext, *aReflowState.rendContext,
stretchDir, containerSize, childDesiredSize); stretchDir, containerSize, childDesiredSize);
// store the updated metrics // store the updated metrics
childFrame->SetRect(aPresContext, childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height)); childDesiredSize.width, childDesiredSize.height));
if (aDesiredSize.descent < childDesiredSize.descent) if (aDesiredSize.descent < childDesiredSize.descent)
@ -373,7 +371,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
if (aDesiredSize.ascent < childDesiredSize.ascent) if (aDesiredSize.ascent < childDesiredSize.ascent)
aDesiredSize.ascent = childDesiredSize.ascent; aDesiredSize.ascent = childDesiredSize.ascent;
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
// bug 121748: for surrounding fences & separators, use a size that covers everything // bug 121748: for surrounding fences & separators, use a size that covers everything
mathMLFrame->GetPreferredStretchSize(aPresContext, *aReflowState.rendContext, mathMLFrame->GetPreferredStretchSize(aPresContext, *aReflowState.rendContext,
@ -449,7 +447,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
} }
i++; i++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
if (aCloseChar) { if (aCloseChar) {

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

@ -264,8 +264,8 @@ nsMathMLmfracFrame::Place(nsIPresContext* aPresContext,
nsIFrame* frameDen = nsnull; nsIFrame* frameDen = nsnull;
nsIFrame* frameNum = mFrames.FirstChild(); nsIFrame* frameNum = mFrames.FirstChild();
if (frameNum) if (frameNum)
frameNum->GetNextSibling(&frameDen); frameDen = frameNum->GetNextSibling();
if (!frameNum || !frameDen || HasNextSibling(frameDen)) { if (!frameNum || !frameDen || frameDen->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize); return ReflowError(aPresContext, aRenderingContext, aDesiredSize);

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

@ -82,10 +82,8 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
nsAutoVoidArray subScriptFrames; nsAutoVoidArray subScriptFrames;
nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
nsCOMPtr<nsIContent> childContent;
nsCOMPtr<nsIAtom> childTag; nsCOMPtr<nsIAtom> childTag;
childFrame->GetContent(getter_AddRefs(childContent)); childFrame->GetContent()->GetTag(getter_AddRefs(childTag));
childContent->GetTag(getter_AddRefs(childTag));
if (childTag.get() == nsMathMLAtoms::mprescripts_) { if (childTag.get() == nsMathMLAtoms::mprescripts_) {
// mprescripts frame // mprescripts frame
} }
@ -104,7 +102,7 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
isSubScript = !isSubScript; isSubScript = !isSubScript;
} }
count++; count++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
for (PRInt32 i = subScriptFrames.Count() - 1; i >= 0; i--) { for (PRInt32 i = subScriptFrames.Count() - 1; i >= 0; i--) {
childFrame = (nsIFrame*)subScriptFrames[i]; childFrame = (nsIFrame*)subScriptFrames[i];
@ -260,10 +258,8 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext,
nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
nsCOMPtr<nsIContent> childContent;
nsCOMPtr<nsIAtom> childTag; nsCOMPtr<nsIAtom> childTag;
childFrame->GetContent(getter_AddRefs(childContent)); childFrame->GetContent()->GetTag(getter_AddRefs(childTag));
childContent->GetTag(getter_AddRefs(childTag));
if (childTag.get() == nsMathMLAtoms::mprescripts_) { if (childTag.get() == nsMathMLAtoms::mprescripts_) {
if (mprescriptsFrame) { if (mprescriptsFrame) {
@ -373,7 +369,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext,
isSubScript = !isSubScript; isSubScript = !isSubScript;
} }
count++; count++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
// note: width=0 if all sup-sub pairs match correctly // note: width=0 if all sup-sub pairs match correctly
if ((0 != width) || !baseFrame || !subScriptFrame || !supScriptFrame) { if ((0 != width) || !baseFrame || !subScriptFrame || !supScriptFrame) {
@ -455,7 +451,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext,
dx += mScriptSpace + width; dx += mScriptSpace + width;
} }
} }
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} while (mprescriptsFrame != childFrame); } while (mprescriptsFrame != childFrame);
} }

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

@ -125,9 +125,8 @@ nsMathMLmoFrame::IsFrameInSelection(nsIPresContext* aPresContext,
if (!frameSelection) if (!frameSelection)
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection)); rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
if (NS_SUCCEEDED(rv) && frameSelection) { if (NS_SUCCEEDED(rv) && frameSelection) {
nsCOMPtr<nsIContent> content; frameSelection->LookUpSelection(aFrame->GetContent(),
aFrame->GetContent(getter_AddRefs(content)); 0, 1, &details, PR_TRUE);
frameSelection->LookUpSelection(content, 0, 1, &details, PR_TRUE);
} }
} }
if (!details) if (!details)
@ -165,7 +164,7 @@ nsMathMLmoFrame::Paint(nsIPresContext* aPresContext,
nsRect selectedRect; nsRect selectedRect;
nsIFrame* firstChild = mFrames.FirstChild(); nsIFrame* firstChild = mFrames.FirstChild();
if (IsFrameInSelection(aPresContext, firstChild)) { if (IsFrameInSelection(aPresContext, firstChild)) {
firstChild->GetRect(selectedRect); selectedRect = firstChild->GetRect();
isSelected = PR_TRUE; isSelected = PR_TRUE;
} }
rv = mMathMLChar.Paint(aPresContext, aRenderingContext, aDirtyRect, rv = mMathMLChar.Paint(aPresContext, aRenderingContext, aDirtyRect,
@ -373,7 +372,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsIPresContext* aPresContext)
nsIFrame* parentAncestor = this; nsIFrame* parentAncestor = this;
do { do {
embellishAncestor = parentAncestor; embellishAncestor = parentAncestor;
embellishAncestor->GetParent(&parentAncestor); parentAncestor = embellishAncestor->GetParent();
GetEmbellishDataFrom(parentAncestor, embellishData); GetEmbellishDataFrom(parentAncestor, embellishData);
} while (embellishData.coreFrame == this); } while (embellishData.coreFrame == this);
@ -389,8 +388,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsIPresContext* aPresContext)
parentAncestor->FirstChild(aPresContext, nsnull, &firstChild); parentAncestor->FirstChild(aPresContext, nsnull, &firstChild);
nsFrameList frameList(firstChild); nsFrameList frameList(firstChild);
nsIFrame* nextSibling; nsIFrame* nextSibling = embellishAncestor->GetNextSibling();
embellishAncestor->GetNextSibling(&nextSibling);
nsIFrame* prevSibling = frameList.GetPrevSiblingFor(embellishAncestor); nsIFrame* prevSibling = frameList.GetPrevSiblingFor(embellishAncestor);
// flag to distinguish from a real infix // flag to distinguish from a real infix
@ -849,9 +847,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
aDesiredStretchSize.ascent = mBoundingMetrics.ascent + leading; aDesiredStretchSize.ascent = mBoundingMetrics.ascent + leading;
aDesiredStretchSize.descent = mBoundingMetrics.descent; aDesiredStretchSize.descent = mBoundingMetrics.descent;
nsPoint origin; firstChild->SetPosition(firstChild->GetPosition() - nsPoint(0, dy));
firstChild->GetOrigin(origin);
firstChild->MoveTo(aPresContext, origin.x, origin.y - dy);
} }
else if (useMathMLChar) { else if (useMathMLChar) {
nscoord ascent, descent; nscoord ascent, descent;
@ -899,17 +895,17 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
aDesiredStretchSize.mBoundingMetrics.leftBearing += leftSpace; aDesiredStretchSize.mBoundingMetrics.leftBearing += leftSpace;
aDesiredStretchSize.mBoundingMetrics.rightBearing += leftSpace; aDesiredStretchSize.mBoundingMetrics.rightBearing += leftSpace;
nsRect rect;
if (useMathMLChar) { if (useMathMLChar) {
nsRect rect;
mMathMLChar.GetRect(rect); mMathMLChar.GetRect(rect);
mMathMLChar.SetRect(nsRect(rect.x + leftSpace, rect.y, rect.width, rect.height)); mMathMLChar.SetRect(nsRect(rect.x + leftSpace, rect.y, rect.width, rect.height));
} }
else { else {
nsIFrame* childFrame = firstChild; nsIFrame* childFrame = firstChild;
while (childFrame) { while (childFrame) {
childFrame->GetRect(rect); childFrame->SetPosition(childFrame->GetPosition()
childFrame->MoveTo(aPresContext, rect.x + leftSpace, rect.y); + nsPoint(leftSpace, 0));
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
} }
} }
@ -918,8 +914,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
if (mFrames.GetLength() != 1) if (mFrames.GetLength() != 1)
return NS_OK; return NS_OK;
nsRect rect; nsRect rect = firstChild->GetRect();
firstChild->GetRect(rect);
if (useMathMLChar) { if (useMathMLChar) {
// even though our child text frame is not doing the rendering, we make it play // even though our child text frame is not doing the rendering, we make it play
// nice with other operations that the MathMLChar doesn't handle (e.g., caret) // nice with other operations that the MathMLChar doesn't handle (e.g., caret)
@ -928,7 +923,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
rect.y = 0; rect.y = 0;
} }
rect.height = aDesiredStretchSize.height; rect.height = aDesiredStretchSize.height;
firstChild->SetRect(aPresContext, rect); firstChild->SetRect(rect);
return NS_OK; return NS_OK;
} }
@ -984,7 +979,7 @@ nsMathMLmoFrame::ReflowDirtyChild(nsIPresShell* aPresShell,
nsIFrame* target = this; nsIFrame* target = this;
nsEmbellishData embellishData; nsEmbellishData embellishData;
do { do {
target->GetParent(&target); target = target->GetParent();
GetEmbellishDataFrom(target, embellishData); GetEmbellishDataFrom(target, embellishData);
} while (embellishData.coreFrame == this); } while (embellishData.coreFrame == this);
@ -1010,7 +1005,7 @@ nsMathMLmoFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIFrame* target = this; nsIFrame* target = this;
nsEmbellishData embellishData; nsEmbellishData embellishData;
do { do {
target->GetParent(&target); target = target->GetParent();
GetEmbellishDataFrom(target, embellishData); GetEmbellishDataFrom(target, embellishData);
} while (embellishData.coreFrame == this); } while (embellishData.coreFrame == this);

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

@ -133,7 +133,7 @@ nsMathMLmoverFrame::UpdatePresentationDataFromChildAt(nsIPresContext* aPresConte
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate); aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
} }
index++; index++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
return NS_OK; return NS_OK;
@ -179,7 +179,7 @@ XXX The winner is the outermost in conflicting settings like these:
nsIFrame* overscriptFrame = nsnull; nsIFrame* overscriptFrame = nsnull;
nsIFrame* baseFrame = mFrames.FirstChild(); nsIFrame* baseFrame = mFrames.FirstChild();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&overscriptFrame); overscriptFrame = baseFrame->GetNextSibling();
if (!baseFrame || !overscriptFrame) if (!baseFrame || !overscriptFrame)
return NS_OK; // a visual error indicator will be reported later during layout return NS_OK; // a visual error indicator will be reported later during layout
@ -282,8 +282,8 @@ nsMathMLmoverFrame::Place(nsIPresContext* aPresContext,
nsIFrame* overFrame = nsnull; nsIFrame* overFrame = nsnull;
nsIFrame* baseFrame = mFrames.FirstChild(); nsIFrame* baseFrame = mFrames.FirstChild();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&overFrame); overFrame = baseFrame->GetNextSibling();
if (!baseFrame || !overFrame || HasNextSibling(overFrame)) { if (!baseFrame || !overFrame || overFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize); return ReflowError(aPresContext, aRenderingContext, aDesiredSize);

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

@ -447,9 +447,8 @@ nsMathMLmpaddedFrame::Reflow(nsIPresContext* aPresContext,
if (dx || dy) { if (dx || dy) {
nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
childFrame->GetRect(rect); childFrame->SetPosition(childFrame->GetPosition() + nsPoint(dx, dy));
childFrame->MoveTo(aPresContext, rect.x + dx, rect.y + dy); childFrame = childFrame->GetNextSibling();
childFrame->GetNextSibling(&childFrame);
} }
} }

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

@ -207,7 +207,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext,
bmIndex = childDesiredSize.mBoundingMetrics; bmIndex = childDesiredSize.mBoundingMetrics;
} }
count++; count++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
if (aDesiredSize.mComputeMEW) { if (aDesiredSize.mComputeMEW) {
aDesiredSize.mMaxElementWidth = childDesiredSize.mMaxElementWidth; aDesiredSize.mMaxElementWidth = childDesiredSize.mMaxElementWidth;

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

@ -280,14 +280,12 @@ nsMathMLmsqrtFrame::Reflow(nsIPresContext* aPresContext,
////////////////// //////////////////
// Adjust the origins to leave room for the sqrt char and the overline bar // Adjust the origins to leave room for the sqrt char and the overline bar
nsPoint origin;
dx = radicalSize.width; dx = radicalSize.width;
dy = aDesiredSize.ascent - baseSize.ascent; dy = aDesiredSize.ascent - baseSize.ascent;
nsIFrame* childFrame = mFrames.FirstChild(); nsIFrame* childFrame = mFrames.FirstChild();
while (childFrame) { while (childFrame) {
childFrame->GetOrigin(origin); childFrame->SetPosition(childFrame->GetPosition() + nsPoint(dx, dy));
childFrame->MoveTo(aPresContext, origin.x + dx, origin.y + dy); childFrame = childFrame->GetNextSibling();
childFrame->GetNextSibling(&childFrame);
} }
if (aDesiredSize.mComputeMEW) { if (aDesiredSize.mComputeMEW) {

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

@ -140,8 +140,8 @@ nsMathMLmsubFrame::PlaceSubScript (nsIPresContext* aPresContext,
aFrame->FirstChild(aPresContext, nsnull, &baseFrame); aFrame->FirstChild(aPresContext, nsnull, &baseFrame);
nsIFrame* subScriptFrame = nsnull; nsIFrame* subScriptFrame = nsnull;
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&subScriptFrame); subScriptFrame = baseFrame->GetNextSibling();
if (!baseFrame || !subScriptFrame || HasNextSibling(subScriptFrame)) { if (!baseFrame || !subScriptFrame || subScriptFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return NS_STATIC_CAST(nsMathMLContainerFrame*, return NS_STATIC_CAST(nsMathMLContainerFrame*,

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

@ -159,10 +159,11 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsIPresContext* aPresContext,
nsIFrame* supScriptFrame = nsnull; nsIFrame* supScriptFrame = nsnull;
aFrame->FirstChild(aPresContext, nsnull, &baseFrame); aFrame->FirstChild(aPresContext, nsnull, &baseFrame);
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&subScriptFrame); subScriptFrame = baseFrame->GetNextSibling();
if (subScriptFrame) if (subScriptFrame)
subScriptFrame->GetNextSibling(&supScriptFrame); supScriptFrame = subScriptFrame->GetNextSibling();
if (!baseFrame || !subScriptFrame || !supScriptFrame || HasNextSibling(supScriptFrame)) { if (!baseFrame || !subScriptFrame || !supScriptFrame ||
supScriptFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return NS_STATIC_CAST(nsMathMLContainerFrame*, return NS_STATIC_CAST(nsMathMLContainerFrame*,

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

@ -141,8 +141,8 @@ nsMathMLmsupFrame::PlaceSuperScript(nsIPresContext* aPresContext,
nsIFrame* supScriptFrame = nsnull; nsIFrame* supScriptFrame = nsnull;
aFrame->FirstChild(aPresContext, nsnull, &baseFrame); aFrame->FirstChild(aPresContext, nsnull, &baseFrame);
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&supScriptFrame); supScriptFrame = baseFrame->GetNextSibling();
if (!baseFrame || !supScriptFrame || HasNextSibling(supScriptFrame)) { if (!baseFrame || !supScriptFrame || supScriptFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return NS_STATIC_CAST(nsMathMLContainerFrame*, return NS_STATIC_CAST(nsMathMLContainerFrame*,

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

@ -127,9 +127,8 @@ GetValueAt(nsIPresContext* aPresContext,
if (!valueList) { if (!valueList) {
// The property isn't there yet, so set it // The property isn't there yet, so set it
nsAutoString values; nsAutoString values;
nsCOMPtr<nsIContent> content; if (NS_CONTENT_ATTR_HAS_VALUE ==
aTableOrRowFrame->GetContent(getter_AddRefs(content)); aTableOrRowFrame->GetContent()->GetAttr(kNameSpaceID_None, aAttributeAtom, values)) {
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, aAttributeAtom, values)) {
valueList = new nsValueList(values); valueList = new nsValueList(values);
if (valueList) { if (valueList) {
frameManager->SetFrameProperty(aTableOrRowFrame, aAttributeAtom, frameManager->SetFrameProperty(aTableOrRowFrame, aAttributeAtom,
@ -170,13 +169,9 @@ MapAttributesInto(nsIPresContext* aPresContext,
NS_ASSERTION(NS_SUCCEEDED(rv), "cannot find the position of the cell frame"); NS_ASSERTION(NS_SUCCEEDED(rv), "cannot find the position of the cell frame");
if (NS_FAILED(rv)) return; if (NS_FAILED(rv)) return;
nsIFrame* tableFrame; nsIFrame* rowFrame = cellFrame->GetParent();
nsIFrame* rowgroupFrame; nsIFrame* rowgroupFrame = rowFrame->GetParent();
nsIFrame* rowFrame; nsIFrame* tableFrame = rowgroupFrame->GetParent();
cellFrame->GetParent(&rowFrame);
rowFrame->GetParent(&rowgroupFrame);
rowgroupFrame->GetParent(&tableFrame);
DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TABLE_ROW); DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TABLE_ROW);
DEBUG_VERIFY_THAT_FRAME_IS(rowgroupFrame, TABLE_ROW_GROUP); DEBUG_VERIFY_THAT_FRAME_IS(rowgroupFrame, TABLE_ROW_GROUP);
DEBUG_VERIFY_THAT_FRAME_IS(tableFrame, TABLE); DEBUG_VERIFY_THAT_FRAME_IS(tableFrame, TABLE);
@ -297,8 +292,7 @@ MapAttributesInto(nsIPresContext* aPresContext,
changeList, minChange, maxChange); changeList, minChange, maxChange);
#ifdef DEBUG #ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such // Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame; nsIFrame* parentFrame = aCellFrame->GetParent();
aCellFrame->GetParent(&parentFrame);
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aCellFrame); fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aCellFrame);
#endif #endif
} }
@ -516,14 +510,11 @@ nsMathMLmtableOuterFrame::Reflow(nsIPresContext* aPresContext,
rowFrame = GetRowFrameAt(aPresContext, rowIndex); rowFrame = GetRowFrameAt(aPresContext, rowIndex);
if (rowFrame) { if (rowFrame) {
// translate the coordinates to be relative to us // translate the coordinates to be relative to us
nsRect rect;
nsIFrame* frame = rowFrame; nsIFrame* frame = rowFrame;
frame->GetRect(rect); height = frame->GetSize().height;
height = rect.height;
do { do {
dy += rect.y; dy += frame->GetPosition().y;
frame->GetParent(&frame); frame = frame->GetParent();
frame->GetRect(rect);
} while (frame != this); } while (frame != this);
} }
} }

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

@ -133,7 +133,7 @@ nsMathMLmunderFrame::UpdatePresentationDataFromChildAt(nsIPresContext* aPresCont
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate); aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
} }
index++; index++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
return NS_OK; return NS_OK;
@ -179,7 +179,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
nsIFrame* underscriptFrame = nsnull; nsIFrame* underscriptFrame = nsnull;
nsIFrame* baseFrame = mFrames.FirstChild(); nsIFrame* baseFrame = mFrames.FirstChild();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&underscriptFrame); underscriptFrame = baseFrame->GetNextSibling();
if (!baseFrame || !underscriptFrame) if (!baseFrame || !underscriptFrame)
return NS_OK; // a visual error indicator will be reported later during layout return NS_OK; // a visual error indicator will be reported later during layout
@ -279,8 +279,8 @@ nsMathMLmunderFrame::Place(nsIPresContext* aPresContext,
nsIFrame* underFrame = nsnull; nsIFrame* underFrame = nsnull;
nsIFrame* baseFrame = mFrames.FirstChild(); nsIFrame* baseFrame = mFrames.FirstChild();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&underFrame); underFrame = baseFrame->GetNextSibling();
if (!baseFrame || !underFrame || HasNextSibling(underFrame)) { if (!baseFrame || !underFrame || underFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize); return ReflowError(aPresContext, aRenderingContext, aDesiredSize);

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

@ -139,7 +139,7 @@ nsMathMLmunderoverFrame::UpdatePresentationDataFromChildAt(nsIPresContext* aPres
aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate); aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate);
} }
index++; index++;
childFrame->GetNextSibling(&childFrame); childFrame = childFrame->GetNextSibling();
} }
return NS_OK; return NS_OK;
@ -181,9 +181,9 @@ nsMathMLmunderoverFrame::TransmitAutomaticData(nsIPresContext* aPresContext)
nsIFrame* underscriptFrame = nsnull; nsIFrame* underscriptFrame = nsnull;
nsIFrame* baseFrame = mFrames.FirstChild(); nsIFrame* baseFrame = mFrames.FirstChild();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&underscriptFrame); underscriptFrame = baseFrame->GetNextSibling();
if (underscriptFrame) if (underscriptFrame)
underscriptFrame->GetNextSibling(&overscriptFrame); overscriptFrame = underscriptFrame->GetNextSibling();
if (!baseFrame || !underscriptFrame || !overscriptFrame) if (!baseFrame || !underscriptFrame || !overscriptFrame)
return NS_OK; // a visual error indicator will be reported later during layout return NS_OK; // a visual error indicator will be reported later during layout
@ -319,10 +319,10 @@ nsMathMLmunderoverFrame::Place(nsIPresContext* aPresContext,
nsIFrame* underFrame = nsnull; nsIFrame* underFrame = nsnull;
nsIFrame* baseFrame = mFrames.FirstChild(); nsIFrame* baseFrame = mFrames.FirstChild();
if (baseFrame) if (baseFrame)
baseFrame->GetNextSibling(&underFrame); underFrame = baseFrame->GetNextSibling();
if (underFrame) if (underFrame)
underFrame->GetNextSibling(&overFrame); overFrame = underFrame->GetNextSibling();
if (!baseFrame || !underFrame || !overFrame || HasNextSibling(overFrame)) { if (!baseFrame || !underFrame || !overFrame || overFrame->GetNextSibling()) {
// report an error, encourage people to get their markups in order // report an error, encourage people to get their markups in order
NS_WARNING("invalid markup"); NS_WARNING("invalid markup");
return ReflowError(aPresContext, aRenderingContext, aDesiredSize); return ReflowError(aPresContext, aRenderingContext, aDesiredSize);

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

@ -336,8 +336,8 @@ nsSVGForeignObjectFrame::Reflow(nsIPresContext* aPresContext,
y -= height/2.0f; y -= height/2.0f;
// move ourselves to (x,y): // move ourselves to (x,y):
MoveTo(aPresContext, (nscoord) (x*twipsPerPx), (nscoord) (y*twipsPerPx)); SetPosition(nsPoint((nscoord) (x*twipsPerPx), (nscoord) (y*twipsPerPx)));
// XXX: if we have a view, move that // Xxx: if zewe have a view, move that
// create a new reflow state, setting our max size to (width,height): // create a new reflow state, setting our max size to (width,height):
nsSize availableSpace((nscoord)(width*twipsPerPx), (nscoord)(height*twipsPerPx)); nsSize availableSpace((nscoord)(width*twipsPerPx), (nscoord)(height*twipsPerPx));
@ -607,7 +607,7 @@ ArtUta* nsSVGForeignObjectFrame::DoReflow()
WillReflow(presContext); WillReflow(presContext);
Reflow(presContext, desiredSize, reflowState, status); Reflow(presContext, desiredSize, reflowState, status);
SizeTo(presContext, desiredSize.width, desiredSize.height); SetSize(nsSize(desiredSize.width, desiredSize.height));
DidReflow(presContext, &reflowState, NS_FRAME_REFLOW_FINISHED); DidReflow(presContext, &reflowState, NS_FRAME_REFLOW_FINISHED);
AccumulateUta(&dirtyRegion, GetUta()); AccumulateUta(&dirtyRegion, GetUta());

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

@ -206,14 +206,13 @@ nsSVGGFrame::AppendFrames(nsIPresContext* aPresContext,
// Insert the new frames // Insert the new frames
mFrames.AppendFrames(this, aFrameList); mFrames.AppendFrames(this, aFrameList);
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
return rv; return rv;
@ -234,14 +233,13 @@ nsSVGGFrame::InsertFrames(nsIPresContext* aPresContext,
#endif #endif
mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList); mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
return rv; return rv;
@ -287,13 +285,12 @@ NS_IMETHODIMP
nsSVGGFrame::DidModifySVGObservable (nsISVGValue* observable) nsSVGGFrame::DidModifySVGObservable (nsISVGValue* observable)
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) if (SVGFrame)
SVGFrame->NotifyCTMChanged(); SVGFrame->NotifyCTMChanged();
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -305,13 +302,12 @@ nsSVGGFrame::DidModifySVGObservable (nsISVGValue* observable)
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGFrame::Paint(nsSVGRenderingContext* renderingContext) nsSVGGFrame::Paint(nsSVGRenderingContext* renderingContext)
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) if (SVGFrame)
SVGFrame->Paint(renderingContext); SVGFrame->Paint(renderingContext);
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
@ -342,8 +338,8 @@ NS_IMETHODIMP
nsSVGGFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) nsSVGGFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
{ {
*hit = nsnull; *hit = nsnull;
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
@ -355,7 +351,6 @@ nsSVGGFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
// have a singly linked list... // have a singly linked list...
} }
} }
kid->GetNextSibling(&kid);
} }
return *hit ? NS_OK : NS_ERROR_FAILURE; return *hit ? NS_OK : NS_ERROR_FAILURE;
@ -364,14 +359,13 @@ nsSVGGFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGFrame::NotifyCTMChanged() nsSVGGFrame::NotifyCTMChanged()
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); SVGFrame->NotifyCTMChanged();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -379,14 +373,13 @@ nsSVGGFrame::NotifyCTMChanged()
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGFrame::NotifyRedrawSuspended() nsSVGGFrame::NotifyRedrawSuspended()
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyRedrawSuspended(); SVGFrame->NotifyRedrawSuspended();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -394,14 +387,13 @@ nsSVGGFrame::NotifyRedrawSuspended()
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGFrame::NotifyRedrawUnsuspended() nsSVGGFrame::NotifyRedrawUnsuspended()
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyRedrawUnsuspended(); SVGFrame->NotifyRedrawUnsuspended();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }

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

@ -192,14 +192,13 @@ nsSVGGenericContainerFrame::AppendFrames(nsIPresContext* aPresContext,
// Insert the new frames // Insert the new frames
mFrames.AppendFrames(this, aFrameList); mFrames.AppendFrames(this, aFrameList);
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
return rv; return rv;
@ -220,14 +219,13 @@ nsSVGGenericContainerFrame::InsertFrames(nsIPresContext* aPresContext,
#endif #endif
mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList); mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
return rv; return rv;
@ -294,14 +292,12 @@ nsSVGGenericContainerFrame::WillModifySVGObservable(nsISVGValue* observable)
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGenericContainerFrame::DidModifySVGObservable(nsISVGValue* observable) nsSVGGenericContainerFrame::DidModifySVGObservable(nsISVGValue* observable)
{ {
for (nsIFrame* kid = mFrames.FirstChild(); kid;
nsIFrame* kid = mFrames.FirstChild(); kid = kid->GetNextSibling()) {
while (kid) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) if (SVGFrame)
SVGFrame->NotifyCTMChanged(); SVGFrame->NotifyCTMChanged();
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -313,13 +309,12 @@ nsSVGGenericContainerFrame::DidModifySVGObservable(nsISVGValue* observable)
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGenericContainerFrame::Paint(nsSVGRenderingContext* renderingContext) nsSVGGenericContainerFrame::Paint(nsSVGRenderingContext* renderingContext)
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) if (SVGFrame)
SVGFrame->Paint(renderingContext); SVGFrame->Paint(renderingContext);
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
@ -350,8 +345,8 @@ NS_IMETHODIMP
nsSVGGenericContainerFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) nsSVGGenericContainerFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
{ {
*hit = nsnull; *hit = nsnull;
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
@ -363,7 +358,6 @@ nsSVGGenericContainerFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
// have a singly linked list... // have a singly linked list...
} }
} }
kid->GetNextSibling(&kid);
} }
return *hit ? NS_OK : NS_ERROR_FAILURE; return *hit ? NS_OK : NS_ERROR_FAILURE;
@ -372,14 +366,13 @@ nsSVGGenericContainerFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGenericContainerFrame::NotifyCTMChanged() nsSVGGenericContainerFrame::NotifyCTMChanged()
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); SVGFrame->NotifyCTMChanged();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -387,14 +380,13 @@ nsSVGGenericContainerFrame::NotifyCTMChanged()
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGenericContainerFrame::NotifyRedrawSuspended() nsSVGGenericContainerFrame::NotifyRedrawSuspended()
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyRedrawSuspended(); SVGFrame->NotifyRedrawSuspended();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -402,14 +394,13 @@ nsSVGGenericContainerFrame::NotifyRedrawSuspended()
NS_IMETHODIMP NS_IMETHODIMP
nsSVGGenericContainerFrame::NotifyRedrawUnsuspended() nsSVGGenericContainerFrame::NotifyRedrawUnsuspended()
{ {
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyRedrawUnsuspended(); SVGFrame->NotifyRedrawUnsuspended();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }

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

@ -118,8 +118,6 @@ public:
PRInt32 aModType, PRInt32 aModType,
PRInt32 aHint); PRInt32 aHint);
// NS_IMETHOD SetView(nsIPresContext* aPresContext, nsIView* aView);
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
const nsPoint& aPoint, const nsPoint& aPoint,
nsFramePaintLayer aWhichLayer, nsFramePaintLayer aWhichLayer,
@ -482,16 +480,12 @@ nsSVGOuterSVGFrame::DidReflow(nsIPresContext* aPresContext,
nsIFrame* frame = this; nsIFrame* frame = this;
nsPoint origin(0,0); nsPoint origin(0,0);
do { do {
nsPoint tmpOrigin; origin += frame->GetPosition();
frame->GetOrigin(tmpOrigin);
origin += tmpOrigin;
nsFrameState state; if(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
frame->GetFrameState(&state);
if(state & NS_FRAME_OUT_OF_FLOW)
break; break;
frame->GetParent(&frame); frame = frame->GetParent();
} while(frame); } while(frame);
float pxPerTwips = GetPxPerTwips(); float pxPerTwips = GetPxPerTwips();
@ -532,20 +526,17 @@ nsSVGOuterSVGFrame::AppendFrames(nsIPresContext* aPresContext,
// get the view manager, so that we can wrap this up in a batch // get the view manager, so that we can wrap this up in a batch
// update. // update.
NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); nsIViewManager* vm = aPresContext->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
mPresShell->GetViewManager(getter_AddRefs(vm));
vm->BeginUpdateViewBatch(); vm->BeginUpdateViewBatch();
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
@ -580,20 +571,17 @@ nsSVGOuterSVGFrame::InsertFrames(nsIPresContext* aPresContext,
// get the view manager, so that we can wrap this up in a batch // get the view manager, so that we can wrap this up in a batch
// update. // update.
NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); nsIViewManager* vm = aPresContext->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
mPresShell->GetViewManager(getter_AddRefs(vm));
vm->BeginUpdateViewBatch(); vm->BeginUpdateViewBatch();
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
@ -626,20 +614,17 @@ nsSVGOuterSVGFrame::RemoveFrame(nsIPresContext* aPresContext,
// get the view manager, so that we can wrap this up in a batch // get the view manager, so that we can wrap this up in a batch
// update. // update.
NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); nsIViewManager* vm = aPresContext->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
mPresShell->GetViewManager(getter_AddRefs(vm));
vm->BeginUpdateViewBatch(); vm->BeginUpdateViewBatch();
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyCTMChanged(); //XXX use different function SVGFrame->NotifyCTMChanged(); //XXX use different function
} }
kid->GetNextSibling(&kid);
} }
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
@ -690,15 +675,6 @@ nsSVGOuterSVGFrame::AttributeChanged(nsIPresContext* aPresContext,
} }
//----------------------------------------------------------------------
//
// NS_IMETHODIMP
// nsSVGOuterSVGFrame::SetView(nsIPresContext* aPresContext, nsIView* aView)
// {
// mView = aView;
// return nsSVGOuterSVGFrameBase::SetView(aPresContext, aView);
// }
nsresult nsresult
nsSVGOuterSVGFrame::GetFrameForPoint(nsIPresContext* aPresContext, nsSVGOuterSVGFrame::GetFrameForPoint(nsIPresContext* aPresContext,
const nsPoint& aPoint, const nsPoint& aPoint,
@ -719,9 +695,9 @@ nsSVGOuterSVGFrame::GetFrameForPoint(nsIPresContext* aPresContext,
} }
*aFrame = this; *aFrame = this;
nsIFrame* kid = mFrames.FirstChild();
nsIFrame* hit = nsnull; nsIFrame* hit = nsnull;
while (kid) { for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
@ -732,7 +708,6 @@ nsSVGOuterSVGFrame::GetFrameForPoint(nsIPresContext* aPresContext,
// have a singly linked list... // have a singly linked list...
} }
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
@ -777,13 +752,12 @@ nsSVGOuterSVGFrame::Paint(nsIPresContext* aPresContext,
Paint(&SVGCtx); Paint(&SVGCtx);
// paint children: // paint children:
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) if (SVGFrame)
SVGFrame->Paint(&SVGCtx); SVGFrame->Paint(&SVGCtx);
kid->GetNextSibling(&kid);
} }
SVGCtx.Render(); SVGCtx.Render();
@ -832,15 +806,10 @@ nsSVGOuterSVGFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw)
if (!uta && !bRedraw) return NS_OK; if (!uta && !bRedraw) return NS_OK;
NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); nsIView* view = GetClosestView();
nsCOMPtr<nsIPresContext> presCtx;
mPresShell->GetPresContext(getter_AddRefs(presCtx));
NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);
nsIView* view = GetClosestView(presCtx);
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> vm; nsIViewManager* vm = view->GetViewManager();
view->GetViewManager(*getter_AddRefs(vm));
vm->BeginUpdateViewBatch(); vm->BeginUpdateViewBatch();
if (uta) { if (uta) {
@ -884,21 +853,17 @@ nsSVGOuterSVGFrame::NotifyRedrawSuspended()
// get the view manager, so that we can wrap this up in a batch // get the view manager, so that we can wrap this up in a batch
// update. // update.
NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); nsIViewManager* vm = GetPresContext()->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
mPresShell->GetViewManager(getter_AddRefs(vm));
vm->BeginUpdateViewBatch(); vm->BeginUpdateViewBatch();
for (nsIFrame* kid = mFrames.FirstChild(); kid;
nsIFrame* kid = mFrames.FirstChild(); kid = kid->GetNextSibling()) {
while (kid) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyRedrawSuspended(); SVGFrame->NotifyRedrawSuspended();
} }
kid->GetNextSibling(&kid);
} }
return NS_OK; return NS_OK;
} }
@ -915,18 +880,15 @@ nsSVGOuterSVGFrame::NotifyRedrawUnsuspended()
// get the view manager, so that we can wrap this up in a batch // get the view manager, so that we can wrap this up in a batch
// update. // update.
NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); nsIViewManager* vm = GetPresContext()->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
mPresShell->GetViewManager(getter_AddRefs(vm));
nsIFrame* kid = mFrames.FirstChild(); for (nsIFrame* kid = mFrames.FirstChild(); kid;
while (kid) { kid = kid->GetNextSibling()) {
nsISVGFrame* SVGFrame=0; nsISVGFrame* SVGFrame=0;
kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame);
if (SVGFrame) { if (SVGFrame) {
SVGFrame->NotifyRedrawUnsuspended(); SVGFrame->NotifyRedrawUnsuspended();
} }
kid->GetNextSibling(&kid);
} }
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);