зеркало из https://github.com/mozilla/gecko-dev.git
Catching up with recent changes of the nsIFrame API
This commit is contained in:
Родитель
1409d66985
Коммит
1f5a5c5cf7
|
@ -123,18 +123,19 @@ nsMathMLContainerFrame::IsOnlyWhitespace(nsIFrame* aFrame)
|
|||
}
|
||||
|
||||
void
|
||||
nsMathMLContainerFrame::ReflowEmptyChild(nsIFrame* aFrame)
|
||||
nsMathMLContainerFrame::ReflowEmptyChild(nsIPresContext& aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
// nsHTMLReflowMetrics emptySize(nsnull);
|
||||
// nsHTMLReflowState emptyReflowState(aPresContext, aReflowState, aFrame, nsSize(0,0));
|
||||
// nsresult rv = ReflowChild(aFrame, aPresContext, emptySize, emptyReflowState, aStatus);
|
||||
|
||||
// 0-size the frame
|
||||
aFrame->SetRect(nsRect(0,0,0,0));
|
||||
aFrame->SetRect(&aPresContext, nsRect(0,0,0,0));
|
||||
|
||||
// 0-size the view
|
||||
// 0-size the view, if any
|
||||
nsIView* view = nsnull;
|
||||
aFrame->GetView(&view);
|
||||
aFrame->GetView(&aPresContext, &view);
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
|
@ -404,7 +405,7 @@ nsMathMLContainerFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState, childFrame, availSize);
|
||||
|
@ -417,7 +418,8 @@ nsMathMLContainerFrame::Reflow(nsIPresContext& aPresContext,
|
|||
// 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. Before return,
|
||||
// we should set the origins so as to overwrite what we are storing there now.
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(&aPresContext,
|
||||
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
|
||||
aDesiredSize.width += childDesiredSize.width;
|
||||
|
@ -455,7 +457,8 @@ nsMathMLContainerFrame::Reflow(nsIPresContext& aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && nsnull != aMathMLFrame) {
|
||||
aMathMLFrame->Stretch(aPresContext, stretchDir, parentSize, childSize);
|
||||
// store the updated metrics
|
||||
childFrame->SetRect(nsRect(childSize.descent, childSize.ascent,
|
||||
childFrame->SetRect(&aPresContext,
|
||||
nsRect(childSize.descent, childSize.ascent,
|
||||
childSize.width, childSize.height));
|
||||
}
|
||||
|
||||
|
@ -479,7 +482,7 @@ nsMathMLContainerFrame::Reflow(nsIPresContext& aPresContext,
|
|||
while (nsnull != childFrame) {
|
||||
childFrame->GetRect(rect);
|
||||
offset.y = aDesiredSize.ascent - rect.y;
|
||||
childFrame->MoveTo(offset.x,offset.y);
|
||||
childFrame->MoveTo(&aPresContext, offset.x,offset.y);
|
||||
offset.x += rect.width;
|
||||
rv = childFrame->GetNextSibling(&childFrame);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get next child");
|
||||
|
|
|
@ -115,7 +115,8 @@ public:
|
|||
IsOnlyWhitespace(nsIFrame* aFrame);
|
||||
|
||||
static void
|
||||
ReflowEmptyChild(nsIFrame* aFrame);
|
||||
ReflowEmptyChild(nsIPresContext& aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ nsMathMLmfracFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (2 > count) {
|
||||
|
||||
|
@ -238,8 +238,8 @@ nsMathMLmfracFrame::Reflow(nsIPresContext& aPresContext,
|
|||
rect[0].y = 0;
|
||||
rect[1].y = aDesiredSize.height - rect[1].height;
|
||||
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
SetLineOrigin(nsPoint(0,rect[0].height)); // position the fraction bar
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
|
|
|
@ -93,7 +93,7 @@ nsMathMLmmultiscriptsFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
|
@ -150,7 +150,8 @@ nsMathMLmmultiscriptsFrame::Reflow(nsIPresContext& aPresContext,
|
|||
// At this stage, the origin points of the children have no use, so we will use the
|
||||
// origins to store the child's ascent and descent. At the next pass, we should
|
||||
// set the origins so as to overwrite what we are storing there now
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(&aPresContext,
|
||||
nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
isSubscript = !isSubscript;
|
||||
count++;
|
||||
|
@ -198,7 +199,7 @@ nsMathMLmmultiscriptsFrame::Reflow(nsIPresContext& aPresContext,
|
|||
childFrame->GetRect(rect[0]);
|
||||
rect[0].x = offset;
|
||||
rect[0].y = aDesiredSize.height - subHeight;
|
||||
childFrame->SetRect(rect[0]);
|
||||
childFrame->SetRect(&aPresContext, rect[0]);
|
||||
offset += rect[0].width;
|
||||
}
|
||||
else if (mprescriptsFrame != childFrame) {
|
||||
|
@ -219,8 +220,8 @@ nsMathMLmmultiscriptsFrame::Reflow(nsIPresContext& aPresContext,
|
|||
rect[0].x = offset + (width - rect[0].width) / 2; // centering
|
||||
rect[1].x = offset + (width - rect[1].width) / 2;
|
||||
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
offset += width;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext& aPresContext,
|
|||
while (nsnull != childFrame) {
|
||||
if (!IsOnlyWhitespace(childFrame)) {
|
||||
childFrame->GetRect(rect);
|
||||
childFrame->MoveTo(dx, rect.y + mCharOffset.y);
|
||||
childFrame->MoveTo(&aPresContext, dx, rect.y + mCharOffset.y);
|
||||
dx += rect.width;
|
||||
}
|
||||
childFrame->GetNextSibling(&childFrame);
|
||||
|
|
|
@ -89,7 +89,7 @@ nsMathMLmoverFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (2 > count) {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
|
@ -140,8 +140,8 @@ nsMathMLmoverFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.ascent -= leading;
|
||||
rect[0].y -= leading;
|
||||
//
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -89,7 +89,7 @@ nsMathMLmsubFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (2 > count) {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
|
@ -151,8 +151,8 @@ subscriptOffset = PR_MAX(subscriptOffset,fmAscent-(xHeight*4)/5);
|
|||
rect[1].y = aDesiredSize.height - rect[1].height;
|
||||
aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -90,7 +90,7 @@ nsMathMLmsubsupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (3 > count) {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
|
@ -159,9 +159,9 @@ subscriptOffset = PR_MAX(subscriptOffset,fmAscent-(xHeight*4)/5);
|
|||
rect[1].y = aDesiredSize.height - rect[1].height;
|
||||
rect[0].y = aDesiredSize.height - subHeight;
|
||||
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[2]->SetRect(rect[2]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
child[2]->SetRect(&aPresContext, rect[2]);
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -89,7 +89,7 @@ nsMathMLmsupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (2 > count) {
|
||||
|
||||
|
@ -138,8 +138,8 @@ nsMathMLmsupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
rect[0].y = aDesiredSize.height - rect[0].height;
|
||||
aDesiredSize.ascent = aDesiredSize.height - aDesiredSize.descent;
|
||||
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -89,7 +89,7 @@ nsMathMLmunderFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (2 > count) {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
|
@ -151,8 +151,8 @@ nsMathMLmunderFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.descent -= leading;
|
||||
rect[1].y -= leading;
|
||||
//
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
|
@ -91,7 +91,7 @@ nsMathMLmunderoverFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//////////////
|
||||
// WHITESPACE: don't forget that whitespace doesn't count in MathML!
|
||||
if (IsOnlyWhitespace(childFrame)) {
|
||||
ReflowEmptyChild(childFrame);
|
||||
ReflowEmptyChild(aPresContext, childFrame);
|
||||
}
|
||||
else if (3 > count) {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
|
@ -151,9 +151,9 @@ nsMathMLmunderoverFrame::Reflow(nsIPresContext& aPresContext,
|
|||
rect[0].y -= leading;
|
||||
rect[1].y -= 2*leading;
|
||||
//
|
||||
child[0]->SetRect(rect[0]);
|
||||
child[1]->SetRect(rect[1]);
|
||||
child[2]->SetRect(rect[2]);
|
||||
child[0]->SetRect(&aPresContext, rect[0]);
|
||||
child[1]->SetRect(&aPresContext, rect[1]);
|
||||
child[2]->SetRect(&aPresContext, rect[2]);
|
||||
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
|
|
Загрузка…
Ссылка в новой задаче