diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp
index c60e5e71758..211e19b3a3e 100644
--- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp
+++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp
@@ -1396,7 +1396,24 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
rv = ConstructFrameByDisplayType(aPresContext, display,
aContent, aParentFrame,
styleContext, aFrameSubTree);
+
+
}
+
+#if 0
+ // If the frame is a block-level frame and it has a fixed height and overflow
+ // property of scroll, then wrap it in a scroll frame.
+ // XXX Deal with replaced elements and overflow of auto and width, too
+ nsIFrame* kidFrame = nsnull;
+ nsresult rv;
+ if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
+ (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
+ rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
+ if (NS_OK == rv) {
+ kidFrame->SetStyleContext(aPresContext, kidSC);
+ }
+ }
+#endif
}
}
NS_RELEASE(styleContext);
diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h
index f42003e6c30..ebfe549bda9 100644
--- a/mozilla/layout/base/public/nsIFrame.h
+++ b/mozilla/layout/base/public/nsIFrame.h
@@ -142,14 +142,6 @@ public:
*/
NS_IMETHOD GetContent(nsIContent*& aContent) const = 0;
- /**
- * Get the index in parent of the frame's content object
- * XXX This really doesn't belong in nsIFrame. It's just a helper
- * function that asks the content parent for the index-in-container of
- * this frame's content object...
- */
- NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const = 0;
-
/**
* Get the style context associated with this frame. Note that GetStyleContext()
* adds a reference to the style context so the caller must do a release.
diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp
index 13ea06969d7..68c6a72c4ec 100644
--- a/mozilla/layout/forms/nsFormControlFrame.cpp
+++ b/mozilla/layout/forms/nsFormControlFrame.cpp
@@ -361,8 +361,6 @@ nsFormControlFrame::GetWidget(nsIView* aView, nsIWidget** aWidget)
result = NS_ERROR_FAILURE;
} else {
- const nsIID id = GetIID();
-
result = widget->QueryInterface(kIWidgetIID, (void**)aWidget); // keep the ref
if (NS_FAILED(result)) {
NS_ASSERTION(0, "The widget interface is invalid"); // need to print out more details of the widget
diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp
index 9029832a920..c98b768b86c 100644
--- a/mozilla/layout/generic/nsBlockFrame.cpp
+++ b/mozilla/layout/generic/nsBlockFrame.cpp
@@ -458,9 +458,7 @@ BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
NS_IMETHODIMP
BulletFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p", contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -469,10 +467,7 @@ BulletFrame::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p ",
- contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p ", ContentIndexInContainer(this), this);
nsIView* view;
GetView(view);
if (nsnull != view) {
@@ -1581,9 +1576,7 @@ nsBlockFrame::ListTag(FILE* out) const
atom->ToString(tmp);
fputs(tmp, out);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
} else {
nsBlockFrameSuper::ListTag(out);
}
@@ -2046,19 +2039,6 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
isBlock = PR_FALSE;
}
- // XXX CONSTRUCTION See if it wants to be scrolled if overflows...
-#if 0
- nsIFrame* kidFrame = nsnull;
- nsresult rv;
- if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
- (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
- rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
- if (NS_OK == rv) {
- kidFrame->SetStyleContext(aPresContext, kidSC);
- }
- }
-#endif
-
// If the child is an inline then add it to the lastLine (if it's
// an inline line, otherwise make a new line). If the child is a
// block then make a new line and put the child in that line.
diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp
index 9029832a920..c98b768b86c 100644
--- a/mozilla/layout/generic/nsBlockReflowState.cpp
+++ b/mozilla/layout/generic/nsBlockReflowState.cpp
@@ -458,9 +458,7 @@ BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
NS_IMETHODIMP
BulletFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p", contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -469,10 +467,7 @@ BulletFrame::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p ",
- contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p ", ContentIndexInContainer(this), this);
nsIView* view;
GetView(view);
if (nsnull != view) {
@@ -1581,9 +1576,7 @@ nsBlockFrame::ListTag(FILE* out) const
atom->ToString(tmp);
fputs(tmp, out);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
} else {
nsBlockFrameSuper::ListTag(out);
}
@@ -2046,19 +2039,6 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
isBlock = PR_FALSE;
}
- // XXX CONSTRUCTION See if it wants to be scrolled if overflows...
-#if 0
- nsIFrame* kidFrame = nsnull;
- nsresult rv;
- if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
- (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
- rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
- if (NS_OK == rv) {
- kidFrame->SetStyleContext(aPresContext, kidSC);
- }
- }
-#endif
-
// If the child is an inline then add it to the lastLine (if it's
// an inline line, otherwise make a new line). If the child is a
// block then make a new line and put the child in that line.
diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h
index 9029832a920..c98b768b86c 100644
--- a/mozilla/layout/generic/nsBlockReflowState.h
+++ b/mozilla/layout/generic/nsBlockReflowState.h
@@ -458,9 +458,7 @@ BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
NS_IMETHODIMP
BulletFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p", contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -469,10 +467,7 @@ BulletFrame::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p ",
- contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p ", ContentIndexInContainer(this), this);
nsIView* view;
GetView(view);
if (nsnull != view) {
@@ -1581,9 +1576,7 @@ nsBlockFrame::ListTag(FILE* out) const
atom->ToString(tmp);
fputs(tmp, out);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
} else {
nsBlockFrameSuper::ListTag(out);
}
@@ -2046,19 +2039,6 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
isBlock = PR_FALSE;
}
- // XXX CONSTRUCTION See if it wants to be scrolled if overflows...
-#if 0
- nsIFrame* kidFrame = nsnull;
- nsresult rv;
- if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
- (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
- rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
- if (NS_OK == rv) {
- kidFrame->SetStyleContext(aPresContext, kidSC);
- }
- }
-#endif
-
// If the child is an inline then add it to the lastLine (if it's
// an inline line, otherwise make a new line). If the child is a
// block then make a new line and put the child in that line.
diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp
index 716a19bfdaa..d05547f1c9d 100644
--- a/mozilla/layout/generic/nsFrame.cpp
+++ b/mozilla/layout/generic/nsFrame.cpp
@@ -345,20 +345,6 @@ NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const
return NS_OK;
}
-NS_METHOD nsFrame::GetContentIndex(PRInt32& aIndexInParent) const
-{
- nsIContent* parent;
- mContent->GetParent(parent);
- if (nsnull != parent) {
- parent->IndexOf(mContent, aIndexInParent);
- NS_RELEASE(parent);
- }
- else {
- aIndexInParent = 0;
- }
- return NS_OK;
-}
-
NS_METHOD nsFrame::GetStyleContext(nsIPresContext* aPresContext,
nsIStyleContext*& aStyleContext)
{
@@ -1428,6 +1414,26 @@ NS_METHOD nsFrame::Scrolled(nsIView *aView)
return NS_OK;
}
+PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
+{
+ nsIContent* content;
+ PRInt32 result = -1;
+
+ aFrame->GetContent(content);
+ if (nsnull != content) {
+ nsIContent* parentContent;
+
+ content->GetParent(parentContent);
+ if (nsnull != parentContent) {
+ parentContent->IndexOf(content, result);
+ NS_RELEASE(parentContent);
+ }
+ NS_RELEASE(content);
+ }
+
+ return result;
+}
+
// Debugging
NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
@@ -1471,10 +1477,8 @@ NS_METHOD nsFrame::ListTag(FILE* out) const
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)@%p", contentIndex, this);
+ fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h
index 8b812fc3ac8..3669a196a1d 100644
--- a/mozilla/layout/generic/nsFrame.h
+++ b/mozilla/layout/generic/nsFrame.h
@@ -110,7 +110,6 @@ public:
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
NS_IMETHOD GetContent(nsIContent*& aContent) const;
- NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const;
NS_IMETHOD GetStyleContext(nsIPresContext* aContext,
nsIStyleContext*& aStyleContext);
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
@@ -220,6 +219,10 @@ public:
void Invalidate(const nsRect& aDamageRect,
PRBool aImmediate = PR_FALSE) const;
+ // Helper function to return the index in parent of the frame's content
+ // object. Returns -1 on error or if the frame doesn't have a content object
+ static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
+
#ifdef NS_DEBUG
/**
* Tracing method that writes a method enter/exit routine to the
diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp
index a65d1f51f32..630e38cba37 100644
--- a/mozilla/layout/generic/nsFrameSetFrame.cpp
+++ b/mozilla/layout/generic/nsFrameSetFrame.cpp
@@ -1407,6 +1407,8 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
WillReflow(aPresContext);
nsFramesetDrag drag(mDragger->mVertical, mDragger->mPrevNeighbor, change, this);
Reflow(aPresContext, &drag, metrics, state, status);
+ // XXX Compiler warning that didStatus is being used without having been
+ // initialized...
DidReflow(aPresContext, didStatus);
NS_IF_RELEASE(acx);
}
diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h
index f42003e6c30..ebfe549bda9 100644
--- a/mozilla/layout/generic/nsIFrame.h
+++ b/mozilla/layout/generic/nsIFrame.h
@@ -142,14 +142,6 @@ public:
*/
NS_IMETHOD GetContent(nsIContent*& aContent) const = 0;
- /**
- * Get the index in parent of the frame's content object
- * XXX This really doesn't belong in nsIFrame. It's just a helper
- * function that asks the content parent for the index-in-container of
- * this frame's content object...
- */
- NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const = 0;
-
/**
* Get the style context associated with this frame. Note that GetStyleContext()
* adds a reference to the style context so the caller must do a release.
diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp
index 239d2e434e6..279f685754d 100644
--- a/mozilla/layout/generic/nsPlaceholderFrame.cpp
+++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp
@@ -159,8 +159,6 @@ nsPlaceholderFrame::AttributeChanged(nsIPresContext* aPresContext,
NS_IMETHODIMP nsPlaceholderFrame::ListTag(FILE* out) const
{
fputs("*placeholder", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)@%p", contentIndex, this);
+ fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp
index ba6d0408575..1fbdd9abaf4 100644
--- a/mozilla/layout/generic/nsTextFrame.cpp
+++ b/mozilla/layout/generic/nsTextFrame.cpp
@@ -1671,9 +1671,7 @@ ToCString(const PRUnichar* cp, PRInt32 aLen, nsString& aBuf)
NS_IMETHODIMP
TextFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Text(%d)@%p", contentIndex, this);
+ fprintf(out, "Text(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp b/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp
index a70966034a9..6258e9799c6 100644
--- a/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp
+++ b/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp
@@ -154,8 +154,6 @@ nsIFrame* nsAbsoluteFrame::GetContainingBlock() const
NS_IMETHODIMP nsAbsoluteFrame::ListTag(FILE* out) const
{
fputs("*absolute", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)@%p", contentIndex, this);
+ fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp
index 9029832a920..c98b768b86c 100644
--- a/mozilla/layout/html/base/src/nsBlockFrame.cpp
+++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp
@@ -458,9 +458,7 @@ BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
NS_IMETHODIMP
BulletFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p", contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -469,10 +467,7 @@ BulletFrame::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p ",
- contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p ", ContentIndexInContainer(this), this);
nsIView* view;
GetView(view);
if (nsnull != view) {
@@ -1581,9 +1576,7 @@ nsBlockFrame::ListTag(FILE* out) const
atom->ToString(tmp);
fputs(tmp, out);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
} else {
nsBlockFrameSuper::ListTag(out);
}
@@ -2046,19 +2039,6 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
isBlock = PR_FALSE;
}
- // XXX CONSTRUCTION See if it wants to be scrolled if overflows...
-#if 0
- nsIFrame* kidFrame = nsnull;
- nsresult rv;
- if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
- (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
- rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
- if (NS_OK == rv) {
- kidFrame->SetStyleContext(aPresContext, kidSC);
- }
- }
-#endif
-
// If the child is an inline then add it to the lastLine (if it's
// an inline line, otherwise make a new line). If the child is a
// block then make a new line and put the child in that line.
diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp
index 9029832a920..c98b768b86c 100644
--- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp
+++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp
@@ -458,9 +458,7 @@ BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
NS_IMETHODIMP
BulletFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p", contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -469,10 +467,7 @@ BulletFrame::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p ",
- contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p ", ContentIndexInContainer(this), this);
nsIView* view;
GetView(view);
if (nsnull != view) {
@@ -1581,9 +1576,7 @@ nsBlockFrame::ListTag(FILE* out) const
atom->ToString(tmp);
fputs(tmp, out);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
} else {
nsBlockFrameSuper::ListTag(out);
}
@@ -2046,19 +2039,6 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
isBlock = PR_FALSE;
}
- // XXX CONSTRUCTION See if it wants to be scrolled if overflows...
-#if 0
- nsIFrame* kidFrame = nsnull;
- nsresult rv;
- if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
- (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
- rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
- if (NS_OK == rv) {
- kidFrame->SetStyleContext(aPresContext, kidSC);
- }
- }
-#endif
-
// If the child is an inline then add it to the lastLine (if it's
// an inline line, otherwise make a new line). If the child is a
// block then make a new line and put the child in that line.
diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h
index 9029832a920..c98b768b86c 100644
--- a/mozilla/layout/html/base/src/nsBlockReflowState.h
+++ b/mozilla/layout/html/base/src/nsBlockReflowState.h
@@ -458,9 +458,7 @@ BulletFrame::DeleteFrame(nsIPresContext& aPresContext)
NS_IMETHODIMP
BulletFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p", contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -469,10 +467,7 @@ BulletFrame::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Bullet(%d)@%p ",
- contentIndex, this);
+ fprintf(out, "Bullet(%d)@%p ", ContentIndexInContainer(this), this);
nsIView* view;
GetView(view);
if (nsnull != view) {
@@ -1581,9 +1576,7 @@ nsBlockFrame::ListTag(FILE* out) const
atom->ToString(tmp);
fputs(tmp, out);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
} else {
nsBlockFrameSuper::ListTag(out);
}
@@ -2046,19 +2039,6 @@ nsBlockFrame::AppendNewFrames(nsIPresContext& aPresContext,
isBlock = PR_FALSE;
}
- // XXX CONSTRUCTION See if it wants to be scrolled if overflows...
-#if 0
- nsIFrame* kidFrame = nsnull;
- nsresult rv;
- if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
- (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
- rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
- if (NS_OK == rv) {
- kidFrame->SetStyleContext(aPresContext, kidSC);
- }
- }
-#endif
-
// If the child is an inline then add it to the lastLine (if it's
// an inline line, otherwise make a new line). If the child is a
// block then make a new line and put the child in that line.
diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp
index 716a19bfdaa..d05547f1c9d 100644
--- a/mozilla/layout/html/base/src/nsFrame.cpp
+++ b/mozilla/layout/html/base/src/nsFrame.cpp
@@ -345,20 +345,6 @@ NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const
return NS_OK;
}
-NS_METHOD nsFrame::GetContentIndex(PRInt32& aIndexInParent) const
-{
- nsIContent* parent;
- mContent->GetParent(parent);
- if (nsnull != parent) {
- parent->IndexOf(mContent, aIndexInParent);
- NS_RELEASE(parent);
- }
- else {
- aIndexInParent = 0;
- }
- return NS_OK;
-}
-
NS_METHOD nsFrame::GetStyleContext(nsIPresContext* aPresContext,
nsIStyleContext*& aStyleContext)
{
@@ -1428,6 +1414,26 @@ NS_METHOD nsFrame::Scrolled(nsIView *aView)
return NS_OK;
}
+PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
+{
+ nsIContent* content;
+ PRInt32 result = -1;
+
+ aFrame->GetContent(content);
+ if (nsnull != content) {
+ nsIContent* parentContent;
+
+ content->GetParent(parentContent);
+ if (nsnull != parentContent) {
+ parentContent->IndexOf(content, result);
+ NS_RELEASE(parentContent);
+ }
+ NS_RELEASE(content);
+ }
+
+ return result;
+}
+
// Debugging
NS_METHOD nsFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{
@@ -1471,10 +1477,8 @@ NS_METHOD nsFrame::ListTag(FILE* out) const
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)@%p", contentIndex, this);
+ fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h
index 8b812fc3ac8..3669a196a1d 100644
--- a/mozilla/layout/html/base/src/nsFrame.h
+++ b/mozilla/layout/html/base/src/nsFrame.h
@@ -110,7 +110,6 @@ public:
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
NS_IMETHOD GetContent(nsIContent*& aContent) const;
- NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const;
NS_IMETHOD GetStyleContext(nsIPresContext* aContext,
nsIStyleContext*& aStyleContext);
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
@@ -220,6 +219,10 @@ public:
void Invalidate(const nsRect& aDamageRect,
PRBool aImmediate = PR_FALSE) const;
+ // Helper function to return the index in parent of the frame's content
+ // object. Returns -1 on error or if the frame doesn't have a content object
+ static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
+
#ifdef NS_DEBUG
/**
* Tracing method that writes a method enter/exit routine to the
diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp
index 239d2e434e6..279f685754d 100644
--- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp
+++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp
@@ -159,8 +159,6 @@ nsPlaceholderFrame::AttributeChanged(nsIPresContext* aPresContext,
NS_IMETHODIMP nsPlaceholderFrame::ListTag(FILE* out) const
{
fputs("*placeholder", out);
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)@%p", contentIndex, this);
+ fprintf(out, "(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp
index f0be22227ea..9f508fde9e9 100644
--- a/mozilla/layout/html/base/src/nsScrollFrame.cpp
+++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp
@@ -294,9 +294,7 @@ nsScrollBodyFrame::ListTag(FILE* out) const
fputs(tmp, out);
NS_RELEASE(atom);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -431,9 +429,7 @@ nsScrollInnerFrame::ListTag(FILE* out) const
fputs(tmp, out);
NS_RELEASE(atom);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
@@ -551,9 +547,7 @@ nsScrollOuterFrame::ListTag(FILE* out) const
fputs(tmp, out);
NS_RELEASE(atom);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, ">(%d)@%p", contentIndex, this);
+ fprintf(out, ">(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp
index ba6d0408575..1fbdd9abaf4 100644
--- a/mozilla/layout/html/base/src/nsTextFrame.cpp
+++ b/mozilla/layout/html/base/src/nsTextFrame.cpp
@@ -1671,9 +1671,7 @@ ToCString(const PRUnichar* cp, PRInt32 aLen, nsString& aBuf)
NS_IMETHODIMP
TextFrame::ListTag(FILE* out) const
{
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "Text(%d)@%p", contentIndex, this);
+ fprintf(out, "Text(%d)@%p", ContentIndexInContainer(this), this);
return NS_OK;
}
diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp
index a65d1f51f32..630e38cba37 100644
--- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp
+++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp
@@ -1407,6 +1407,8 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
WillReflow(aPresContext);
nsFramesetDrag drag(mDragger->mVertical, mDragger->mPrevNeighbor, change, this);
Reflow(aPresContext, &drag, metrics, state, status);
+ // XXX Compiler warning that didStatus is being used without having been
+ // initialized...
DidReflow(aPresContext, didStatus);
NS_IF_RELEASE(acx);
}
diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp
index 13ea06969d7..68c6a72c4ec 100644
--- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp
+++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp
@@ -361,8 +361,6 @@ nsFormControlFrame::GetWidget(nsIView* aView, nsIWidget** aWidget)
result = NS_ERROR_FAILURE;
} else {
- const nsIID id = GetIID();
-
result = widget->QueryInterface(kIWidgetIID, (void**)aWidget); // keep the ref
if (NS_FAILED(result)) {
NS_ASSERTION(0, "The widget interface is invalid"); // need to print out more details of the widget
diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp
index c60e5e71758..211e19b3a3e 100644
--- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp
+++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp
@@ -1396,7 +1396,24 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
rv = ConstructFrameByDisplayType(aPresContext, display,
aContent, aParentFrame,
styleContext, aFrameSubTree);
+
+
}
+
+#if 0
+ // If the frame is a block-level frame and it has a fixed height and overflow
+ // property of scroll, then wrap it in a scroll frame.
+ // XXX Deal with replaced elements and overflow of auto and width, too
+ nsIFrame* kidFrame = nsnull;
+ nsresult rv;
+ if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
+ (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
+ rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
+ if (NS_OK == rv) {
+ kidFrame->SetStyleContext(aPresContext, kidSC);
+ }
+ }
+#endif
}
}
NS_RELEASE(styleContext);
diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
index dc7736a1602..81b59c5222c 100644
--- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
@@ -1047,10 +1047,8 @@ NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp
index 16b42a37eea..6969d820aa4 100644
--- a/mozilla/layout/html/table/src/nsTableColFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp
@@ -117,10 +117,8 @@ NS_METHOD nsTableColFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilt
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp
index 8637fbf3c3d..3ec1e941957 100644
--- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp
@@ -385,10 +385,8 @@ NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp
index a804d680454..50a46d7b7de 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableFrame.cpp
@@ -3309,10 +3309,8 @@ NS_METHOD nsTableFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
index a0d2fc752ea..992e2a7c46e 100644
--- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
@@ -1165,10 +1165,8 @@ NS_METHOD nsTableOuterFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFi
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
index 081d566fd09..8ab99aac347 100644
--- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
@@ -1044,10 +1044,8 @@ NS_METHOD nsTableRowFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilt
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
index 052624386e6..831d088b226 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
@@ -912,10 +912,8 @@ NS_METHOD nsTableRowGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp
index c60e5e71758..211e19b3a3e 100644
--- a/mozilla/layout/style/nsHTMLStyleSheet.cpp
+++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp
@@ -1396,7 +1396,24 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
rv = ConstructFrameByDisplayType(aPresContext, display,
aContent, aParentFrame,
styleContext, aFrameSubTree);
+
+
}
+
+#if 0
+ // If the frame is a block-level frame and it has a fixed height and overflow
+ // property of scroll, then wrap it in a scroll frame.
+ // XXX Deal with replaced elements and overflow of auto and width, too
+ nsIFrame* kidFrame = nsnull;
+ nsresult rv;
+ if ((NS_STYLE_OVERFLOW_SCROLL == kidDisplay->mOverflow) ||
+ (NS_STYLE_OVERFLOW_AUTO == kidDisplay->mOverflow)) {
+ rv = NS_NewScrollFrame(&kidFrame, aKid, aParentFrame);
+ if (NS_OK == rv) {
+ kidFrame->SetStyleContext(aPresContext, kidSC);
+ }
+ }
+#endif
}
}
NS_RELEASE(styleContext);
diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp
index dc7736a1602..81b59c5222c 100644
--- a/mozilla/layout/tables/nsTableCellFrame.cpp
+++ b/mozilla/layout/tables/nsTableCellFrame.cpp
@@ -1047,10 +1047,8 @@ NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp
index 16b42a37eea..6969d820aa4 100644
--- a/mozilla/layout/tables/nsTableColFrame.cpp
+++ b/mozilla/layout/tables/nsTableColFrame.cpp
@@ -117,10 +117,8 @@ NS_METHOD nsTableColFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilt
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp
index 8637fbf3c3d..3ec1e941957 100644
--- a/mozilla/layout/tables/nsTableColGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp
@@ -385,10 +385,8 @@ NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index a804d680454..50a46d7b7de 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -3309,10 +3309,8 @@ NS_METHOD nsTableFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp
index a0d2fc752ea..992e2a7c46e 100644
--- a/mozilla/layout/tables/nsTableOuterFrame.cpp
+++ b/mozilla/layout/tables/nsTableOuterFrame.cpp
@@ -1165,10 +1165,8 @@ NS_METHOD nsTableOuterFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFi
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp
index 081d566fd09..8ab99aac347 100644
--- a/mozilla/layout/tables/nsTableRowFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowFrame.cpp
@@ -1044,10 +1044,8 @@ NS_METHOD nsTableRowFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilt
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
index 052624386e6..831d088b226 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
@@ -912,10 +912,8 @@ NS_METHOD nsTableRowGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
fputs(buf, out);
NS_RELEASE(tag);
}
- PRInt32 contentIndex;
- GetContentIndex(contentIndex);
- fprintf(out, "(%d)", contentIndex);
+ fprintf(out, "(%d)", ContentIndexInContainer(this));
out << mRect;
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);