зеркало из https://github.com/mozilla/pjs.git
Implement List method
This commit is contained in:
Родитель
f89f3350dd
Коммит
147322f9aa
|
@ -21,6 +21,8 @@
|
|||
#include "nsSize.h"
|
||||
#include <stdlib.h>
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsString.h"
|
||||
|
||||
static NS_DEFINE_IID(kISpaceManagerIID, NS_ISPACEMANAGER_IID);
|
||||
|
||||
|
@ -59,10 +61,10 @@ nsSpaceManager::BandList::Clear()
|
|||
BandRect* bandRect = Head();
|
||||
|
||||
while (bandRect != this) {
|
||||
BandRect* next = bandRect->Next();
|
||||
BandRect* nxt = bandRect->Next();
|
||||
|
||||
delete bandRect;
|
||||
bandRect = next;
|
||||
bandRect = nxt;
|
||||
}
|
||||
|
||||
PR_INIT_CLIST(this);
|
||||
|
@ -918,6 +920,57 @@ nsSpaceManager::ClearRegions()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSpaceManager::List(FILE* out)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsAutoString tmp;
|
||||
|
||||
fprintf(out, "SpaceManager@%p", this);
|
||||
if (mFrame) {
|
||||
mFrame->GetFrameName(tmp);
|
||||
fprintf(out, " frame=");
|
||||
fputs(tmp, out);
|
||||
fprintf(out, "@%p", mFrame);
|
||||
}
|
||||
fprintf(out, " xy=%d,%d <\n", mX, mY);
|
||||
if (mBandList.IsEmpty()) {
|
||||
fprintf(out, " no bands\n");
|
||||
}
|
||||
else {
|
||||
BandRect* band = mBandList.Head();
|
||||
do {
|
||||
fprintf(out, " left=%d top=%d right=%d bottom=%d numFrames=%d",
|
||||
band->mLeft, band->mTop, band->mRight, band->mBottom,
|
||||
band->mNumFrames);
|
||||
if (1 == band->mNumFrames) {
|
||||
band->mFrame->GetFrameName(tmp);
|
||||
fprintf(out, " frame=");
|
||||
fputs(tmp, out);
|
||||
fprintf(out, "@%p", band->mFrame);
|
||||
}
|
||||
else if (1 < band->mNumFrames) {
|
||||
fprintf(out, "\n ");
|
||||
nsVoidArray* a = band->mFrames;
|
||||
PRInt32 i, n = a->Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIFrame* frame = (nsIFrame*) a->ElementAt(i);
|
||||
if (frame) {
|
||||
frame->GetFrameName(tmp);
|
||||
fputs(tmp, out);
|
||||
fprintf(out, "@%p ", frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
band = band->Next();
|
||||
} while (band != mBandList.Head());
|
||||
}
|
||||
fprintf(out, ">\n");
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSpaceManager::FrameInfo*
|
||||
nsSpaceManager::GetFrameInfoFor(nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
NS_IMETHOD RemoveRegion(nsIFrame* aFrame);
|
||||
|
||||
NS_IMETHOD ClearRegions();
|
||||
NS_IMETHOD List(FILE* out);
|
||||
|
||||
protected:
|
||||
// Structure that maintains information about the region associated
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIReflowCommandIID, NS_IREFLOWCOMMAND_IID);
|
||||
|
||||
|
@ -73,7 +74,7 @@ nsHTMLReflowCommand::~nsHTMLReflowCommand()
|
|||
|
||||
NS_IMPL_ISUPPORTS(nsHTMLReflowCommand, kIReflowCommandIID);
|
||||
|
||||
nsIFrame* nsHTMLReflowCommand::GetContainingBlock(nsIFrame* aFloater)
|
||||
nsIFrame* nsHTMLReflowCommand::GetContainingBlock(nsIFrame* aFloater) const
|
||||
{
|
||||
nsIFrame* containingBlock;
|
||||
aFloater->GetParent(&containingBlock);
|
||||
|
@ -206,3 +207,71 @@ NS_IMETHODIMP nsHTMLReflowCommand::GetPrevSiblingFrame(nsIFrame*& aSiblingFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLReflowCommand::List(FILE* out) const
|
||||
{
|
||||
#ifdef DEBUG
|
||||
static const char* kReflowCommandType[] = {
|
||||
"ContentChanged",
|
||||
"StyleChanged",
|
||||
"PullupReflow",
|
||||
"PushReflow",
|
||||
"CheckPullupReflow",
|
||||
"ReflowDirty",
|
||||
"UserDefined",
|
||||
};
|
||||
|
||||
fprintf(out, "ReflowCommand@%p[%s]:",
|
||||
this, kReflowCommandType[mType]);
|
||||
if (mTargetFrame) {
|
||||
fprintf(out, " target=");
|
||||
nsFrame::ListTag(out, mTargetFrame);
|
||||
}
|
||||
if (mChildFrame) {
|
||||
fprintf(out, " child=");
|
||||
nsFrame::ListTag(out, mChildFrame);
|
||||
}
|
||||
if (mPrevSiblingFrame) {
|
||||
fprintf(out, " prevSibling=");
|
||||
nsFrame::ListTag(out, mPrevSiblingFrame);
|
||||
}
|
||||
if (mAttribute) {
|
||||
fprintf(out, " attr=");
|
||||
nsAutoString attr;
|
||||
mAttribute->ToString(attr);
|
||||
fputs(attr, out);
|
||||
}
|
||||
if (mListName) {
|
||||
fprintf(out, " list=");
|
||||
nsAutoString attr;
|
||||
mListName->ToString(attr);
|
||||
fputs(attr, out);
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
|
||||
// Show the path, but without using mPath which is in an undefined
|
||||
// state at this point.
|
||||
if (mTargetFrame) {
|
||||
// Floating frames are handled differently. The path goes from the target
|
||||
// frame to the containing block, and then up the hierarchy
|
||||
PRBool didOne = PR_FALSE;
|
||||
nsIFrame* start = mTargetFrame;
|
||||
const nsStyleDisplay* display;
|
||||
mTargetFrame->GetStyleData(eStyleStruct_Display,
|
||||
(const nsStyleStruct*&) display);
|
||||
if (NS_STYLE_FLOAT_NONE != display->mFloats) {
|
||||
start = GetContainingBlock(mTargetFrame);
|
||||
}
|
||||
for (nsIFrame* f = start; nsnull != f; f->GetParent(&f)) {
|
||||
if (f != mTargetFrame) {
|
||||
fprintf(out, " ");
|
||||
nsFrame::ListTag(out, f);
|
||||
didOne = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (didOne) {
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,11 @@ public:
|
|||
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const;
|
||||
NS_IMETHOD SetChildListName(nsIAtom* aListName);
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
|
||||
NS_IMETHOD List(FILE* out) const;
|
||||
|
||||
protected:
|
||||
void BuildPath();
|
||||
nsIFrame* GetContainingBlock(nsIFrame* aFloater);
|
||||
nsIFrame* GetContainingBlock(nsIFrame* aFloater) const;
|
||||
|
||||
private:
|
||||
ReflowType mType;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "nsSize.h"
|
||||
#include <stdlib.h>
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsString.h"
|
||||
|
||||
static NS_DEFINE_IID(kISpaceManagerIID, NS_ISPACEMANAGER_IID);
|
||||
|
||||
|
@ -59,10 +61,10 @@ nsSpaceManager::BandList::Clear()
|
|||
BandRect* bandRect = Head();
|
||||
|
||||
while (bandRect != this) {
|
||||
BandRect* next = bandRect->Next();
|
||||
BandRect* nxt = bandRect->Next();
|
||||
|
||||
delete bandRect;
|
||||
bandRect = next;
|
||||
bandRect = nxt;
|
||||
}
|
||||
|
||||
PR_INIT_CLIST(this);
|
||||
|
@ -918,6 +920,57 @@ nsSpaceManager::ClearRegions()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSpaceManager::List(FILE* out)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsAutoString tmp;
|
||||
|
||||
fprintf(out, "SpaceManager@%p", this);
|
||||
if (mFrame) {
|
||||
mFrame->GetFrameName(tmp);
|
||||
fprintf(out, " frame=");
|
||||
fputs(tmp, out);
|
||||
fprintf(out, "@%p", mFrame);
|
||||
}
|
||||
fprintf(out, " xy=%d,%d <\n", mX, mY);
|
||||
if (mBandList.IsEmpty()) {
|
||||
fprintf(out, " no bands\n");
|
||||
}
|
||||
else {
|
||||
BandRect* band = mBandList.Head();
|
||||
do {
|
||||
fprintf(out, " left=%d top=%d right=%d bottom=%d numFrames=%d",
|
||||
band->mLeft, band->mTop, band->mRight, band->mBottom,
|
||||
band->mNumFrames);
|
||||
if (1 == band->mNumFrames) {
|
||||
band->mFrame->GetFrameName(tmp);
|
||||
fprintf(out, " frame=");
|
||||
fputs(tmp, out);
|
||||
fprintf(out, "@%p", band->mFrame);
|
||||
}
|
||||
else if (1 < band->mNumFrames) {
|
||||
fprintf(out, "\n ");
|
||||
nsVoidArray* a = band->mFrames;
|
||||
PRInt32 i, n = a->Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIFrame* frame = (nsIFrame*) a->ElementAt(i);
|
||||
if (frame) {
|
||||
frame->GetFrameName(tmp);
|
||||
fputs(tmp, out);
|
||||
fprintf(out, "@%p ", frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
band = band->Next();
|
||||
} while (band != mBandList.Head());
|
||||
}
|
||||
fprintf(out, ">\n");
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSpaceManager::FrameInfo*
|
||||
nsSpaceManager::GetFrameInfoFor(nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
NS_IMETHOD RemoveRegion(nsIFrame* aFrame);
|
||||
|
||||
NS_IMETHOD ClearRegions();
|
||||
NS_IMETHOD List(FILE* out);
|
||||
|
||||
protected:
|
||||
// Structure that maintains information about the region associated
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsFrame.h"
|
||||
|
||||
static NS_DEFINE_IID(kIReflowCommandIID, NS_IREFLOWCOMMAND_IID);
|
||||
|
||||
|
@ -73,7 +74,7 @@ nsHTMLReflowCommand::~nsHTMLReflowCommand()
|
|||
|
||||
NS_IMPL_ISUPPORTS(nsHTMLReflowCommand, kIReflowCommandIID);
|
||||
|
||||
nsIFrame* nsHTMLReflowCommand::GetContainingBlock(nsIFrame* aFloater)
|
||||
nsIFrame* nsHTMLReflowCommand::GetContainingBlock(nsIFrame* aFloater) const
|
||||
{
|
||||
nsIFrame* containingBlock;
|
||||
aFloater->GetParent(&containingBlock);
|
||||
|
@ -206,3 +207,71 @@ NS_IMETHODIMP nsHTMLReflowCommand::GetPrevSiblingFrame(nsIFrame*& aSiblingFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLReflowCommand::List(FILE* out) const
|
||||
{
|
||||
#ifdef DEBUG
|
||||
static const char* kReflowCommandType[] = {
|
||||
"ContentChanged",
|
||||
"StyleChanged",
|
||||
"PullupReflow",
|
||||
"PushReflow",
|
||||
"CheckPullupReflow",
|
||||
"ReflowDirty",
|
||||
"UserDefined",
|
||||
};
|
||||
|
||||
fprintf(out, "ReflowCommand@%p[%s]:",
|
||||
this, kReflowCommandType[mType]);
|
||||
if (mTargetFrame) {
|
||||
fprintf(out, " target=");
|
||||
nsFrame::ListTag(out, mTargetFrame);
|
||||
}
|
||||
if (mChildFrame) {
|
||||
fprintf(out, " child=");
|
||||
nsFrame::ListTag(out, mChildFrame);
|
||||
}
|
||||
if (mPrevSiblingFrame) {
|
||||
fprintf(out, " prevSibling=");
|
||||
nsFrame::ListTag(out, mPrevSiblingFrame);
|
||||
}
|
||||
if (mAttribute) {
|
||||
fprintf(out, " attr=");
|
||||
nsAutoString attr;
|
||||
mAttribute->ToString(attr);
|
||||
fputs(attr, out);
|
||||
}
|
||||
if (mListName) {
|
||||
fprintf(out, " list=");
|
||||
nsAutoString attr;
|
||||
mListName->ToString(attr);
|
||||
fputs(attr, out);
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
|
||||
// Show the path, but without using mPath which is in an undefined
|
||||
// state at this point.
|
||||
if (mTargetFrame) {
|
||||
// Floating frames are handled differently. The path goes from the target
|
||||
// frame to the containing block, and then up the hierarchy
|
||||
PRBool didOne = PR_FALSE;
|
||||
nsIFrame* start = mTargetFrame;
|
||||
const nsStyleDisplay* display;
|
||||
mTargetFrame->GetStyleData(eStyleStruct_Display,
|
||||
(const nsStyleStruct*&) display);
|
||||
if (NS_STYLE_FLOAT_NONE != display->mFloats) {
|
||||
start = GetContainingBlock(mTargetFrame);
|
||||
}
|
||||
for (nsIFrame* f = start; nsnull != f; f->GetParent(&f)) {
|
||||
if (f != mTargetFrame) {
|
||||
fprintf(out, " ");
|
||||
nsFrame::ListTag(out, f);
|
||||
didOne = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (didOne) {
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,11 @@ public:
|
|||
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const;
|
||||
NS_IMETHOD SetChildListName(nsIAtom* aListName);
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
|
||||
NS_IMETHOD List(FILE* out) const;
|
||||
|
||||
protected:
|
||||
void BuildPath();
|
||||
nsIFrame* GetContainingBlock(nsIFrame* aFloater);
|
||||
nsIFrame* GetContainingBlock(nsIFrame* aFloater) const;
|
||||
|
||||
private:
|
||||
ReflowType mType;
|
||||
|
|
Загрузка…
Ссылка в новой задаче