зеркало из https://github.com/mozilla/pjs.git
Removed GetContentIndex() from nsIFrame
This commit is contained in:
Родитель
0b6b895778
Коммит
cc44601bb8
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче