Bug 731293. Remove nsFrameManager parameter from nsLayoutUtils::GetParentOrPlaceholderFor. r=mats

This commit is contained in:
Robert O'Callahan 2012-06-09 00:22:25 +12:00
parent d5c17c1b06
commit 31953a0563
7 changed files with 16 additions and 29 deletions

View File

@ -302,11 +302,10 @@ struct BidiParagraphData {
{
// Advance aLine to the line containing aFrame
nsIFrame* child = aFrame;
nsFrameManager* frameManager = aFrame->PresContext()->FrameManager();
nsIFrame* parent = nsLayoutUtils::GetParentOrPlaceholderFor(frameManager, child);
nsIFrame* parent = nsLayoutUtils::GetParentOrPlaceholderFor(child);
while (parent && !nsLayoutUtils::GetAsBlock(parent)) {
child = parent;
parent = nsLayoutUtils::GetParentOrPlaceholderFor(frameManager, child);
parent = nsLayoutUtils::GetParentOrPlaceholderFor(child);
}
NS_ASSERTION (parent, "aFrame is not a descendent of aBlockFrame");
while (!IsFrameInCurrentLine(aLineIter, aPrevFrame, child)) {

View File

@ -804,8 +804,7 @@ nsCSSRendering::FindNonTransparentBackgroundFrame(nsIFrame* aFrame,
nsIFrame* frame = nsnull;
if (aStartAtParent) {
frame = nsLayoutUtils::GetParentOrPlaceholderFor(
aFrame->PresContext()->FrameManager(), aFrame);
frame = nsLayoutUtils::GetParentOrPlaceholderFor(aFrame);
}
if (!frame) {
frame = aFrame;
@ -820,8 +819,7 @@ nsCSSRendering::FindNonTransparentBackgroundFrame(nsIFrame* aFrame,
if (frame->IsThemed())
break;
nsIFrame* parent = nsLayoutUtils::GetParentOrPlaceholderFor(
frame->PresContext()->FrameManager(), frame);
nsIFrame* parent = nsLayoutUtils::GetParentOrPlaceholderFor(frame);
if (!parent)
break;

View File

@ -92,10 +92,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
}
static void MarkFrameForDisplay(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
nsFrameManager* frameManager = aFrame->PresContext()->PresShell()->FrameManager();
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetParentOrPlaceholderFor(frameManager, f)) {
f = nsLayoutUtils::GetParentOrPlaceholderFor(f)) {
if (f->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)
return;
f->AddStateBits(NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO);
@ -159,10 +157,8 @@ static void UnmarkFrameForDisplay(nsIFrame* aFrame) {
presContext->PropertyTable()->
Delete(aFrame, nsDisplayListBuilder::OutOfFlowDirtyRectProperty());
nsFrameManager* frameManager = presContext->PresShell()->FrameManager();
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetParentOrPlaceholderFor(frameManager, f)) {
f = nsLayoutUtils::GetParentOrPlaceholderFor(f)) {
if (!(f->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO))
return;
f->RemoveStateBits(NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO);

View File

@ -668,12 +668,12 @@ nsLayoutUtils::DoCompareTreePosition(nsIContent* aContent1,
}
static nsIFrame* FillAncestors(nsIFrame* aFrame,
nsIFrame* aStopAtAncestor, nsFrameManager* aFrameManager,
nsIFrame* aStopAtAncestor,
nsTArray<nsIFrame*>* aAncestors)
{
while (aFrame && aFrame != aStopAtAncestor) {
aAncestors->AppendElement(aFrame);
aFrame = nsLayoutUtils::GetParentOrPlaceholderFor(aFrameManager, aFrame);
aFrame = nsLayoutUtils::GetParentOrPlaceholderFor(aFrame);
}
return aFrame;
}
@ -706,17 +706,16 @@ nsLayoutUtils::DoCompareTreePosition(nsIFrame* aFrame1,
NS_ERROR("no common ancestor at all, different documents");
return 0;
}
nsFrameManager* frameManager = presContext->PresShell()->FrameManager();
nsAutoTArray<nsIFrame*,20> frame1Ancestors;
if (!FillAncestors(aFrame1, aCommonAncestor, frameManager, &frame1Ancestors)) {
if (!FillAncestors(aFrame1, aCommonAncestor, &frame1Ancestors)) {
// We reached the root of the frame tree ... if aCommonAncestor was set,
// it is wrong
aCommonAncestor = nsnull;
}
nsAutoTArray<nsIFrame*,20> frame2Ancestors;
if (!FillAncestors(aFrame2, aCommonAncestor, frameManager, &frame2Ancestors) &&
if (!FillAncestors(aFrame2, aCommonAncestor, &frame2Ancestors) &&
aCommonAncestor) {
// We reached the root of the frame tree ... aCommonAncestor was wrong.
// Try again with no hint.
@ -2098,21 +2097,19 @@ nsLayoutUtils::GetNonGeneratedAncestor(nsIFrame* aFrame)
if (!(aFrame->GetStateBits() & NS_FRAME_GENERATED_CONTENT))
return aFrame;
nsFrameManager* frameManager = aFrame->PresContext()->FrameManager();
nsIFrame* f = aFrame;
do {
f = GetParentOrPlaceholderFor(frameManager, f);
f = GetParentOrPlaceholderFor(f);
} while (f->GetStateBits() & NS_FRAME_GENERATED_CONTENT);
return f;
}
nsIFrame*
nsLayoutUtils::GetParentOrPlaceholderFor(nsFrameManager* aFrameManager,
nsIFrame* aFrame)
nsLayoutUtils::GetParentOrPlaceholderFor(nsIFrame* aFrame)
{
if ((aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
&& !aFrame->GetPrevInFlow()) {
return aFrameManager->GetPlaceholderFrameFor(aFrame);
return aFrame->PresContext()->PresShell()->FrameManager()->GetPlaceholderFrameFor(aFrame);
}
return aFrame->GetParent();
}

View File

@ -809,8 +809,7 @@ public:
* If aFrame is an out of flow frame, return its placeholder, otherwise
* return its parent.
*/
static nsIFrame* GetParentOrPlaceholderFor(nsFrameManager* aFrameManager,
nsIFrame* aFrame);
static nsIFrame* GetParentOrPlaceholderFor(nsIFrame* aFrame);
/**
* Get a frame's next-in-flow, or, if it doesn't have one, its special sibling.

View File

@ -4486,8 +4486,7 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext,
for (nsIFrame* f = this, *fChild = nsnull;
f;
fChild = f,
f = nsLayoutUtils::GetParentOrPlaceholderFor(
aPresContext->FrameManager(), f))
f = nsLayoutUtils::GetParentOrPlaceholderFor(f))
{
nsStyleContext *const context = f->GetStyleContext();
if (!context->HasTextDecorationLines()) {

View File

@ -446,8 +446,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
}
}
} while (0 != decorMask &&
(f = nsLayoutUtils::GetParentOrPlaceholderFor(
presContext->FrameManager(), f)));
(f = nsLayoutUtils::GetParentOrPlaceholderFor(f)));
nsRefPtr<nsFontMetrics> fontMet;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));