diff --git a/mozilla/content/shared/public/nsLayoutAtoms.h b/mozilla/content/shared/public/nsLayoutAtoms.h index fb4e12f05ba..38c19bf0d09 100644 --- a/mozilla/content/shared/public/nsLayoutAtoms.h +++ b/mozilla/content/shared/public/nsLayoutAtoms.h @@ -33,23 +33,23 @@ public: static void AddrefAtoms(); static void ReleaseAtoms(); - // Alphabetical list of atoms + // Alphabetical list of media type atoms static nsIAtom* all; static nsIAtom* aural; - static nsIAtom* braille; - static nsIAtom* embossed; - static nsIAtom* handheld; - static nsIAtom* print; static nsIAtom* projection; - static nsIAtom* screen; - static nsIAtom* tty; static nsIAtom* tv; + + // Alphabetical list of frame additional child list names + static nsIAtom* absoluteList; + static nsIAtom* colGroupList; + static nsIAtom* floaterList; + static nsIAtom* bulletList; }; #endif /* nsLayoutAtoms_h___ */ diff --git a/mozilla/content/shared/src/nsLayoutAtoms.cpp b/mozilla/content/shared/src/nsLayoutAtoms.cpp index 01f2b8a2fb6..feb39c517d7 100644 --- a/mozilla/content/shared/src/nsLayoutAtoms.cpp +++ b/mozilla/content/shared/src/nsLayoutAtoms.cpp @@ -30,6 +30,11 @@ nsIAtom* nsLayoutAtoms::screen; nsIAtom* nsLayoutAtoms::tty; nsIAtom* nsLayoutAtoms::tv; +nsIAtom* nsLayoutAtoms::absoluteList; +nsIAtom* nsLayoutAtoms::colGroupList; +nsIAtom* nsLayoutAtoms::floaterList; +nsIAtom* nsLayoutAtoms::bulletList; + static nsrefcnt gRefCnt; void nsLayoutAtoms::AddrefAtoms() @@ -45,6 +50,11 @@ void nsLayoutAtoms::AddrefAtoms() screen = NS_NewAtom("SCREEN"); tty = NS_NewAtom("TTY"); tv = NS_NewAtom("TV"); + + absoluteList = NS_NewAtom("Absolute-list"); + colGroupList = NS_NewAtom("ColGroup-list"); + floaterList = NS_NewAtom("Floater-list"); + bulletList = NS_NewAtom("Bullet-list"); } ++gRefCnt; } @@ -63,6 +73,11 @@ void nsLayoutAtoms::ReleaseAtoms() NS_RELEASE(screen); NS_RELEASE(tty); NS_RELEASE(tv); + + NS_RELEASE(absoluteList); + NS_RELEASE(colGroupList); + NS_RELEASE(floaterList); + NS_RELEASE(bulletList); } } diff --git a/mozilla/layout/base/nsLayoutAtoms.cpp b/mozilla/layout/base/nsLayoutAtoms.cpp index 01f2b8a2fb6..feb39c517d7 100644 --- a/mozilla/layout/base/nsLayoutAtoms.cpp +++ b/mozilla/layout/base/nsLayoutAtoms.cpp @@ -30,6 +30,11 @@ nsIAtom* nsLayoutAtoms::screen; nsIAtom* nsLayoutAtoms::tty; nsIAtom* nsLayoutAtoms::tv; +nsIAtom* nsLayoutAtoms::absoluteList; +nsIAtom* nsLayoutAtoms::colGroupList; +nsIAtom* nsLayoutAtoms::floaterList; +nsIAtom* nsLayoutAtoms::bulletList; + static nsrefcnt gRefCnt; void nsLayoutAtoms::AddrefAtoms() @@ -45,6 +50,11 @@ void nsLayoutAtoms::AddrefAtoms() screen = NS_NewAtom("SCREEN"); tty = NS_NewAtom("TTY"); tv = NS_NewAtom("TV"); + + absoluteList = NS_NewAtom("Absolute-list"); + colGroupList = NS_NewAtom("ColGroup-list"); + floaterList = NS_NewAtom("Floater-list"); + bulletList = NS_NewAtom("Bullet-list"); } ++gRefCnt; } @@ -63,6 +73,11 @@ void nsLayoutAtoms::ReleaseAtoms() NS_RELEASE(screen); NS_RELEASE(tty); NS_RELEASE(tv); + + NS_RELEASE(absoluteList); + NS_RELEASE(colGroupList); + NS_RELEASE(floaterList); + NS_RELEASE(bulletList); } } diff --git a/mozilla/layout/base/nsLayoutAtoms.h b/mozilla/layout/base/nsLayoutAtoms.h index fb4e12f05ba..38c19bf0d09 100644 --- a/mozilla/layout/base/nsLayoutAtoms.h +++ b/mozilla/layout/base/nsLayoutAtoms.h @@ -33,23 +33,23 @@ public: static void AddrefAtoms(); static void ReleaseAtoms(); - // Alphabetical list of atoms + // Alphabetical list of media type atoms static nsIAtom* all; static nsIAtom* aural; - static nsIAtom* braille; - static nsIAtom* embossed; - static nsIAtom* handheld; - static nsIAtom* print; static nsIAtom* projection; - static nsIAtom* screen; - static nsIAtom* tty; static nsIAtom* tv; + + // Alphabetical list of frame additional child list names + static nsIAtom* absoluteList; + static nsIAtom* colGroupList; + static nsIAtom* floaterList; + static nsIAtom* bulletList; }; #endif /* nsLayoutAtoms_h___ */ diff --git a/mozilla/layout/base/public/nsLayoutAtoms.h b/mozilla/layout/base/public/nsLayoutAtoms.h index fb4e12f05ba..38c19bf0d09 100644 --- a/mozilla/layout/base/public/nsLayoutAtoms.h +++ b/mozilla/layout/base/public/nsLayoutAtoms.h @@ -33,23 +33,23 @@ public: static void AddrefAtoms(); static void ReleaseAtoms(); - // Alphabetical list of atoms + // Alphabetical list of media type atoms static nsIAtom* all; static nsIAtom* aural; - static nsIAtom* braille; - static nsIAtom* embossed; - static nsIAtom* handheld; - static nsIAtom* print; static nsIAtom* projection; - static nsIAtom* screen; - static nsIAtom* tty; static nsIAtom* tv; + + // Alphabetical list of frame additional child list names + static nsIAtom* absoluteList; + static nsIAtom* colGroupList; + static nsIAtom* floaterList; + static nsIAtom* bulletList; }; #endif /* nsLayoutAtoms_h___ */ diff --git a/mozilla/layout/base/src/nsLayoutAtoms.cpp b/mozilla/layout/base/src/nsLayoutAtoms.cpp index 01f2b8a2fb6..feb39c517d7 100644 --- a/mozilla/layout/base/src/nsLayoutAtoms.cpp +++ b/mozilla/layout/base/src/nsLayoutAtoms.cpp @@ -30,6 +30,11 @@ nsIAtom* nsLayoutAtoms::screen; nsIAtom* nsLayoutAtoms::tty; nsIAtom* nsLayoutAtoms::tv; +nsIAtom* nsLayoutAtoms::absoluteList; +nsIAtom* nsLayoutAtoms::colGroupList; +nsIAtom* nsLayoutAtoms::floaterList; +nsIAtom* nsLayoutAtoms::bulletList; + static nsrefcnt gRefCnt; void nsLayoutAtoms::AddrefAtoms() @@ -45,6 +50,11 @@ void nsLayoutAtoms::AddrefAtoms() screen = NS_NewAtom("SCREEN"); tty = NS_NewAtom("TTY"); tv = NS_NewAtom("TV"); + + absoluteList = NS_NewAtom("Absolute-list"); + colGroupList = NS_NewAtom("ColGroup-list"); + floaterList = NS_NewAtom("Floater-list"); + bulletList = NS_NewAtom("Bullet-list"); } ++gRefCnt; } @@ -63,6 +73,11 @@ void nsLayoutAtoms::ReleaseAtoms() NS_RELEASE(screen); NS_RELEASE(tty); NS_RELEASE(tv); + + NS_RELEASE(absoluteList); + NS_RELEASE(colGroupList); + NS_RELEASE(floaterList); + NS_RELEASE(bulletList); } } diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index bac46766431..90c2461e181 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -43,6 +43,7 @@ #include "nsDOMEvent.h" #include "nsIHTMLContent.h" #include "prprf.h" +#include "nsLayoutAtoms.h" // XXX temporary for :first-letter support #include "nsITextContent.h" @@ -395,9 +396,6 @@ nsBlockReflowState::GetAvailableSpace() //---------------------------------------------------------------------- -nsIAtom* nsBaseIBFrame::gFloaterAtom; -nsIAtom* nsBaseIBFrame::gBulletAtom; - /* 52b33130-0b99-11d2-932e-00805f8add32 */ #define NS_BLOCK_FRAME_CID \ { 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -406,13 +404,6 @@ static const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; nsBaseIBFrame::nsBaseIBFrame() { - // XXX for now these are a memory leak - if (nsnull == gFloaterAtom) { - gFloaterAtom = NS_NewAtom("Floater-list"); - } - if (nsnull == gBulletAtom) { - gBulletAtom = NS_NewAtom("Bullet-list"); - } } nsBaseIBFrame::~nsBaseIBFrame() @@ -4208,11 +4199,11 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull; return NS_OK; } - else if (aListName == gFloaterAtom) { + else if (aListName == nsLayoutAtoms::floaterList) { aFirstChild = mFloaters; return NS_OK; } - else if (aListName == gBulletAtom) { + else if (aListName == nsLayoutAtoms::bulletList) { aFirstChild = mBullet; return NS_OK; } @@ -4230,11 +4221,11 @@ nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOATER_LIST_INDEX: - atom = gFloaterAtom; + atom = nsLayoutAtoms::floaterList; NS_ADDREF(atom); break; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - atom = gBulletAtom; + atom = nsLayoutAtoms::bulletList; NS_ADDREF(atom); break; } @@ -4701,13 +4692,13 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, gBulletAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (nsnull != mFloaters) { - rv = GetFrameForPointUsing(aPoint, gFloaterAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index 6fa9f9fb65f..edf896f49df 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -274,6 +274,14 @@ protected: #define nsBlockFrameSuper nsBaseIBFrame +/** + * The block frame has two additional named child lists: + * - "Floater-list" which contains the floated frames + * - "Bullet-list" which contains the bullet frame + * + * @see nsLayoutAtoms::bulletList + * @see nsLayoutAtoms::floaterList + */ class nsBlockFrame : public nsBlockFrameSuper { public: diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index bac46766431..90c2461e181 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -43,6 +43,7 @@ #include "nsDOMEvent.h" #include "nsIHTMLContent.h" #include "prprf.h" +#include "nsLayoutAtoms.h" // XXX temporary for :first-letter support #include "nsITextContent.h" @@ -395,9 +396,6 @@ nsBlockReflowState::GetAvailableSpace() //---------------------------------------------------------------------- -nsIAtom* nsBaseIBFrame::gFloaterAtom; -nsIAtom* nsBaseIBFrame::gBulletAtom; - /* 52b33130-0b99-11d2-932e-00805f8add32 */ #define NS_BLOCK_FRAME_CID \ { 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -406,13 +404,6 @@ static const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; nsBaseIBFrame::nsBaseIBFrame() { - // XXX for now these are a memory leak - if (nsnull == gFloaterAtom) { - gFloaterAtom = NS_NewAtom("Floater-list"); - } - if (nsnull == gBulletAtom) { - gBulletAtom = NS_NewAtom("Bullet-list"); - } } nsBaseIBFrame::~nsBaseIBFrame() @@ -4208,11 +4199,11 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull; return NS_OK; } - else if (aListName == gFloaterAtom) { + else if (aListName == nsLayoutAtoms::floaterList) { aFirstChild = mFloaters; return NS_OK; } - else if (aListName == gBulletAtom) { + else if (aListName == nsLayoutAtoms::bulletList) { aFirstChild = mBullet; return NS_OK; } @@ -4230,11 +4221,11 @@ nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOATER_LIST_INDEX: - atom = gFloaterAtom; + atom = nsLayoutAtoms::floaterList; NS_ADDREF(atom); break; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - atom = gBulletAtom; + atom = nsLayoutAtoms::bulletList; NS_ADDREF(atom); break; } @@ -4701,13 +4692,13 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, gBulletAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (nsnull != mFloaters) { - rv = GetFrameForPointUsing(aPoint, gFloaterAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index bac46766431..90c2461e181 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -43,6 +43,7 @@ #include "nsDOMEvent.h" #include "nsIHTMLContent.h" #include "prprf.h" +#include "nsLayoutAtoms.h" // XXX temporary for :first-letter support #include "nsITextContent.h" @@ -395,9 +396,6 @@ nsBlockReflowState::GetAvailableSpace() //---------------------------------------------------------------------- -nsIAtom* nsBaseIBFrame::gFloaterAtom; -nsIAtom* nsBaseIBFrame::gBulletAtom; - /* 52b33130-0b99-11d2-932e-00805f8add32 */ #define NS_BLOCK_FRAME_CID \ { 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -406,13 +404,6 @@ static const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; nsBaseIBFrame::nsBaseIBFrame() { - // XXX for now these are a memory leak - if (nsnull == gFloaterAtom) { - gFloaterAtom = NS_NewAtom("Floater-list"); - } - if (nsnull == gBulletAtom) { - gBulletAtom = NS_NewAtom("Bullet-list"); - } } nsBaseIBFrame::~nsBaseIBFrame() @@ -4208,11 +4199,11 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull; return NS_OK; } - else if (aListName == gFloaterAtom) { + else if (aListName == nsLayoutAtoms::floaterList) { aFirstChild = mFloaters; return NS_OK; } - else if (aListName == gBulletAtom) { + else if (aListName == nsLayoutAtoms::bulletList) { aFirstChild = mBullet; return NS_OK; } @@ -4230,11 +4221,11 @@ nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOATER_LIST_INDEX: - atom = gFloaterAtom; + atom = nsLayoutAtoms::floaterList; NS_ADDREF(atom); break; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - atom = gBulletAtom; + atom = nsLayoutAtoms::bulletList; NS_ADDREF(atom); break; } @@ -4701,13 +4692,13 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, gBulletAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (nsnull != mFloaters) { - rv = GetFrameForPointUsing(aPoint, gFloaterAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index bac46766431..90c2461e181 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -43,6 +43,7 @@ #include "nsDOMEvent.h" #include "nsIHTMLContent.h" #include "prprf.h" +#include "nsLayoutAtoms.h" // XXX temporary for :first-letter support #include "nsITextContent.h" @@ -395,9 +396,6 @@ nsBlockReflowState::GetAvailableSpace() //---------------------------------------------------------------------- -nsIAtom* nsBaseIBFrame::gFloaterAtom; -nsIAtom* nsBaseIBFrame::gBulletAtom; - /* 52b33130-0b99-11d2-932e-00805f8add32 */ #define NS_BLOCK_FRAME_CID \ { 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -406,13 +404,6 @@ static const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; nsBaseIBFrame::nsBaseIBFrame() { - // XXX for now these are a memory leak - if (nsnull == gFloaterAtom) { - gFloaterAtom = NS_NewAtom("Floater-list"); - } - if (nsnull == gBulletAtom) { - gBulletAtom = NS_NewAtom("Bullet-list"); - } } nsBaseIBFrame::~nsBaseIBFrame() @@ -4208,11 +4199,11 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull; return NS_OK; } - else if (aListName == gFloaterAtom) { + else if (aListName == nsLayoutAtoms::floaterList) { aFirstChild = mFloaters; return NS_OK; } - else if (aListName == gBulletAtom) { + else if (aListName == nsLayoutAtoms::bulletList) { aFirstChild = mBullet; return NS_OK; } @@ -4230,11 +4221,11 @@ nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOATER_LIST_INDEX: - atom = gFloaterAtom; + atom = nsLayoutAtoms::floaterList; NS_ADDREF(atom); break; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - atom = gBulletAtom; + atom = nsLayoutAtoms::bulletList; NS_ADDREF(atom); break; } @@ -4701,13 +4692,13 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, gBulletAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (nsnull != mFloaters) { - rv = GetFrameForPointUsing(aPoint, gFloaterAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index 6fa9f9fb65f..edf896f49df 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -274,6 +274,14 @@ protected: #define nsBlockFrameSuper nsBaseIBFrame +/** + * The block frame has two additional named child lists: + * - "Floater-list" which contains the floated frames + * - "Bullet-list" which contains the bullet frame + * + * @see nsLayoutAtoms::bulletList + * @see nsLayoutAtoms::floaterList + */ class nsBlockFrame : public nsBlockFrameSuper { public: diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index bac46766431..90c2461e181 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -43,6 +43,7 @@ #include "nsDOMEvent.h" #include "nsIHTMLContent.h" #include "prprf.h" +#include "nsLayoutAtoms.h" // XXX temporary for :first-letter support #include "nsITextContent.h" @@ -395,9 +396,6 @@ nsBlockReflowState::GetAvailableSpace() //---------------------------------------------------------------------- -nsIAtom* nsBaseIBFrame::gFloaterAtom; -nsIAtom* nsBaseIBFrame::gBulletAtom; - /* 52b33130-0b99-11d2-932e-00805f8add32 */ #define NS_BLOCK_FRAME_CID \ { 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -406,13 +404,6 @@ static const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; nsBaseIBFrame::nsBaseIBFrame() { - // XXX for now these are a memory leak - if (nsnull == gFloaterAtom) { - gFloaterAtom = NS_NewAtom("Floater-list"); - } - if (nsnull == gBulletAtom) { - gBulletAtom = NS_NewAtom("Bullet-list"); - } } nsBaseIBFrame::~nsBaseIBFrame() @@ -4208,11 +4199,11 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull; return NS_OK; } - else if (aListName == gFloaterAtom) { + else if (aListName == nsLayoutAtoms::floaterList) { aFirstChild = mFloaters; return NS_OK; } - else if (aListName == gBulletAtom) { + else if (aListName == nsLayoutAtoms::bulletList) { aFirstChild = mBullet; return NS_OK; } @@ -4230,11 +4221,11 @@ nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOATER_LIST_INDEX: - atom = gFloaterAtom; + atom = nsLayoutAtoms::floaterList; NS_ADDREF(atom); break; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - atom = gBulletAtom; + atom = nsLayoutAtoms::bulletList; NS_ADDREF(atom); break; } @@ -4701,13 +4692,13 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, gBulletAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (nsnull != mFloaters) { - rv = GetFrameForPointUsing(aPoint, gFloaterAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index bac46766431..90c2461e181 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -43,6 +43,7 @@ #include "nsDOMEvent.h" #include "nsIHTMLContent.h" #include "prprf.h" +#include "nsLayoutAtoms.h" // XXX temporary for :first-letter support #include "nsITextContent.h" @@ -395,9 +396,6 @@ nsBlockReflowState::GetAvailableSpace() //---------------------------------------------------------------------- -nsIAtom* nsBaseIBFrame::gFloaterAtom; -nsIAtom* nsBaseIBFrame::gBulletAtom; - /* 52b33130-0b99-11d2-932e-00805f8add32 */ #define NS_BLOCK_FRAME_CID \ { 0x52b33130, 0x0b99, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -406,13 +404,6 @@ static const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; nsBaseIBFrame::nsBaseIBFrame() { - // XXX for now these are a memory leak - if (nsnull == gFloaterAtom) { - gFloaterAtom = NS_NewAtom("Floater-list"); - } - if (nsnull == gBulletAtom) { - gBulletAtom = NS_NewAtom("Bullet-list"); - } } nsBaseIBFrame::~nsBaseIBFrame() @@ -4208,11 +4199,11 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull; return NS_OK; } - else if (aListName == gFloaterAtom) { + else if (aListName == nsLayoutAtoms::floaterList) { aFirstChild = mFloaters; return NS_OK; } - else if (aListName == gBulletAtom) { + else if (aListName == nsLayoutAtoms::bulletList) { aFirstChild = mBullet; return NS_OK; } @@ -4230,11 +4221,11 @@ nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOATER_LIST_INDEX: - atom = gFloaterAtom; + atom = nsLayoutAtoms::floaterList; NS_ADDREF(atom); break; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - atom = gBulletAtom; + atom = nsLayoutAtoms::bulletList; NS_ADDREF(atom); break; } @@ -4701,13 +4692,13 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, gBulletAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (nsnull != mFloaters) { - rv = GetFrameForPointUsing(aPoint, gFloaterAtom, aFrame); + rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsBodyFrame.cpp b/mozilla/layout/html/base/src/nsBodyFrame.cpp index b184340bdfa..d98d3c31a94 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.cpp +++ b/mozilla/layout/html/base/src/nsBodyFrame.cpp @@ -34,11 +34,10 @@ #include "nsIWebShell.h" #include "nsHTMLValue.h" #include "nsHTMLParts.h" +#include "nsLayoutAtoms.h" static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID); -nsIAtom* nsBodyFrame::gAbsoluteAtom; - nsresult NS_NewBodyFrame(nsIFrame*& aResult, PRUint32 aFlags) { @@ -55,10 +54,6 @@ nsBodyFrame::nsBodyFrame() { mSpaceManager = new nsSpaceManager(this); NS_ADDREF(mSpaceManager); - // XXX for now this is a memory leak - if (nsnull == gAbsoluteAtom) { - gAbsoluteAtom = NS_NewAtom("Absolute-list"); - } } nsBodyFrame::~nsBodyFrame() @@ -104,7 +99,7 @@ nsBodyFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; if (NS_BODY_FRAME_ABSOLUTE_LIST_INDEX == aIndex) { - atom = gAbsoluteAtom; + atom = nsLayoutAtoms::absoluteList; NS_ADDREF(atom); } aListName = atom; @@ -114,7 +109,7 @@ nsBodyFrame::GetAdditionalChildListName(PRInt32 aIndex, NS_IMETHODIMP nsBodyFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const { - if (aListName == gAbsoluteAtom) { + if (aListName == nsLayoutAtoms::absoluteList) { aFirstChild = mAbsoluteFrames; return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsBodyFrame.h b/mozilla/layout/html/base/src/nsBodyFrame.h index 968a1490af9..b62ef24a6e0 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.h +++ b/mozilla/layout/html/base/src/nsBodyFrame.h @@ -34,6 +34,12 @@ struct nsStylePosition; */ #define NS_BODY_FRAME_ABSOLUTE_LIST_INDEX (NS_BLOCK_FRAME_LAST_LIST_INDEX + 1) +/** + * The body frame has an additional named child list: + * - "Absolute-list" which contains the absolutely positioned frames + * + * @see nsLayoutAtoms::absoluteList + */ class nsBodyFrame : public nsBlockFrame, public nsIAbsoluteItems { diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 38d03ad7be6..ce53da0c124 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -41,6 +41,7 @@ #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" #include "nsIReflowCommand.h" +#include "nsLayoutAtoms.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -266,8 +267,6 @@ void ColumnInfoCache::GetColumnsByType(const nsStyleUnit aType, /* --------------------- nsTableFrame -------------------- */ -nsIAtom* nsTableFrame::gColGroupAtom=nsnull; - nsTableFrame::nsTableFrame() : nsHTMLContainerFrame(), mCellMap(nsnull), @@ -288,10 +287,6 @@ nsTableFrame::nsTableFrame() mColGroups=nsnull; mDefaultCellSpacing=0; mDefaultCellPadding=0; - // XXX for now these are a memory leak - if (nsnull == gColGroupAtom) { - gColGroupAtom = NS_NewAtom("ColGroup-list"); - } } NS_IMETHODIMP @@ -1370,7 +1365,7 @@ nsTableFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = mFirstChild; return NS_OK; } - else if (aListName == gColGroupAtom) { + else if (aListName == nsLayoutAtoms::colGroupList) { aFirstChild = mColGroups; return NS_OK; } @@ -1388,7 +1383,7 @@ nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_TABLE_FRAME_COLGROUP_LIST_INDEX: - atom = gColGroupAtom; + atom = nsLayoutAtoms::colGroupList; NS_ADDREF(atom); break; } diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 35d132afe2c..3a69e050e58 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -56,7 +56,7 @@ struct nsStyleSpacing; * named child list: * - "ColGroup-list" which contains the col group frames * - * @author sclark + * @see nsLayoutAtoms::colGroupList * * TODO: make methods virtual so nsTableFrame can be used as a base class in the future. */ diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 38d03ad7be6..ce53da0c124 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -41,6 +41,7 @@ #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" #include "nsIReflowCommand.h" +#include "nsLayoutAtoms.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -266,8 +267,6 @@ void ColumnInfoCache::GetColumnsByType(const nsStyleUnit aType, /* --------------------- nsTableFrame -------------------- */ -nsIAtom* nsTableFrame::gColGroupAtom=nsnull; - nsTableFrame::nsTableFrame() : nsHTMLContainerFrame(), mCellMap(nsnull), @@ -288,10 +287,6 @@ nsTableFrame::nsTableFrame() mColGroups=nsnull; mDefaultCellSpacing=0; mDefaultCellPadding=0; - // XXX for now these are a memory leak - if (nsnull == gColGroupAtom) { - gColGroupAtom = NS_NewAtom("ColGroup-list"); - } } NS_IMETHODIMP @@ -1370,7 +1365,7 @@ nsTableFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const aFirstChild = mFirstChild; return NS_OK; } - else if (aListName == gColGroupAtom) { + else if (aListName == nsLayoutAtoms::colGroupList) { aFirstChild = mColGroups; return NS_OK; } @@ -1388,7 +1383,7 @@ nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom* atom = nsnull; switch (aIndex) { case NS_TABLE_FRAME_COLGROUP_LIST_INDEX: - atom = gColGroupAtom; + atom = nsLayoutAtoms::colGroupList; NS_ADDREF(atom); break; } diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 35d132afe2c..3a69e050e58 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -56,7 +56,7 @@ struct nsStyleSpacing; * named child list: * - "ColGroup-list" which contains the col group frames * - * @author sclark + * @see nsLayoutAtoms::colGroupList * * TODO: make methods virtual so nsTableFrame can be used as a base class in the future. */