Bug 653649 - New way of getting child lists from frames. (part 4/5) r=roc
authorMats Palmgren <matspal@gmail.com>
Wed, 24 Aug 2011 22:54:30 +0200
changeset 76883 d9797d99f5f739ebd244ce27748a548f4b3b9cfd
parent 76882 de17763f5ba71293a5193266f815151047466eb5
child 76884 427a6b2313db302c4c2d5c726aeddfd9c05b66ba
push id340
push userclegnitto@mozilla.com
push dateTue, 08 Nov 2011 22:56:33 +0000
treeherdermozilla-beta@f745dc151615 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs653649
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 653649 - New way of getting child lists from frames. (part 4/5) r=roc Remove the nsIAtom* child list names and use child list ID enum instead.
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/html/nsHyperTextAccessible.cpp
content/base/src/nsGkAtomList.h
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsTextEditorState.cpp
dom/base/nsGlobalWindow.cpp
layout/base/nsBidiPresUtils.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSRendering.cpp
layout/base/nsCaret.cpp
layout/base/nsDisplayList.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsFrameManager.cpp
layout/base/nsFrameManager.h
layout/base/nsFrameTraversal.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresShell.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.h
layout/forms/nsListControlFrame.cpp
layout/forms/nsListControlFrame.h
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
layout/generic/TextOverflow.cpp
layout/generic/nsAbsoluteContainingBlock.cpp
layout/generic/nsAbsoluteContainingBlock.h
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsBlockReflowContext.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsContainerFrame.h
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFirstLetterFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsFrameSetFrame.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsIFrame.h
layout/generic/nsInlineFrame.cpp
layout/generic/nsInlineFrame.h
layout/generic/nsObjectFrame.cpp
layout/generic/nsPlaceholderFrame.cpp
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsTextFrameThebes.cpp
layout/generic/nsViewportFrame.cpp
layout/generic/nsViewportFrame.h
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLContainerFrame.h
layout/mathml/nsMathMLForeignFrameWrapper.h
layout/mathml/nsMathMLTokenFrame.cpp
layout/mathml/nsMathMLTokenFrame.h
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmactionFrame.h
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmfencedFrame.cpp
layout/mathml/nsMathMLmfencedFrame.h
layout/mathml/nsMathMLmpaddedFrame.cpp
layout/mathml/nsMathMLmrowFrame.cpp
layout/mathml/nsMathMLmsubFrame.cpp
layout/mathml/nsMathMLmsubsupFrame.cpp
layout/mathml/nsMathMLmsupFrame.cpp
layout/mathml/nsMathMLmtableFrame.cpp
layout/mathml/nsMathMLmtableFrame.h
layout/printing/nsPrintEngine.cpp
layout/style/nsComputedDOMStyle.cpp
layout/svg/base/src/nsSVGClipPathFrame.cpp
layout/svg/base/src/nsSVGContainerFrame.cpp
layout/svg/base/src/nsSVGContainerFrame.h
layout/svg/base/src/nsSVGEffects.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.h
layout/svg/base/src/nsSVGGlyphFrame.cpp
layout/svg/base/src/nsSVGOuterSVGFrame.cpp
layout/svg/base/src/nsSVGTextContainerFrame.cpp
layout/svg/base/src/nsSVGTextContainerFrame.h
layout/svg/base/src/nsSVGUtils.cpp
layout/tables/nsCellMap.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableCellFrame.h
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableColGroupFrame.h
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableOuterFrame.h
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsBoxFrame.h
layout/xul/base/src/nsBoxObject.cpp
layout/xul/base/src/nsDeckFrame.cpp
layout/xul/base/src/nsDeckFrame.h
layout/xul/base/src/nsMenuBarFrame.cpp
layout/xul/base/src/nsMenuFrame.cpp
layout/xul/base/src/nsMenuFrame.h
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.h
layout/xul/base/src/nsPopupSetFrame.cpp
layout/xul/base/src/nsPopupSetFrame.h
layout/xul/base/src/nsProgressMeterFrame.cpp
layout/xul/base/src/nsRootBoxFrame.cpp
layout/xul/base/src/nsScrollbarButtonFrame.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsSliderFrame.h
layout/xul/base/src/nsSplitterFrame.cpp
layout/xul/base/src/nsXULPopupManager.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeColumns.cpp
widget/src/cocoa/nsNativeThemeCocoa.mm
widget/src/xpwidgets/nsNativeTheme.cpp
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -379,17 +379,17 @@ nsAccessibilityService::CreateHTMLObject
       return socketAccessible;
     }
 #endif
   }
 #endif
 
   // 3) for images and imagemaps, or anything else with a child frame
   // we have the object frame, get the image frame
-  nsIFrame* frame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* frame = aFrame->GetFirstPrincipalChild();
   return frame ? frame->CreateAccessible() : nsnull;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIContent* aContent,
                                                         nsIPresShell* aPresShell)
 {
   nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -940,17 +940,17 @@ void nsAccessible::GetBoundsRect(nsRect&
     aTotalBounds.UnionRect(aTotalBounds, currFrameBounds);
 
     nsIFrame *iterNextFrame = nsnull;
 
     if (nsCoreUtils::IsCorrectFrameType(iterFrame,
                                         nsAccessibilityAtoms::inlineFrame)) {
       // Only do deeper bounds search if we're on an inline frame
       // Inline frames can contain larger frames inside of them
-      iterNextFrame = iterFrame->GetFirstChild(nsnull);
+      iterNextFrame = iterFrame->GetFirstPrincipalChild();
     }
 
     if (iterNextFrame) 
       ++depth;  // Child was found in code above this: We are going deeper in this iteration of the loop
     else {  
       // Use next sibling if it exists, or go back up the tree to get the first next-in-flow or next-sibling 
       // within our search
       while (iterFrame) {
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -1702,17 +1702,17 @@ PRInt32 nsHyperTextAccessible::GetCaretL
     if (hyperTextContent == caretFrame->GetContent()) {
       return lineNumber; // Must be in a single line hyper text, there is no line iterator
     }
     nsIFrame *parentFrame = caretFrame->GetParent();
     if (!parentFrame)
       break;
 
     // Add lines for the sibling frames before the caret
-    nsIFrame *sibling = parentFrame->GetFirstChild(nsnull);
+    nsIFrame *sibling = parentFrame->GetFirstPrincipalChild();
     while (sibling && sibling != caretFrame) {
       nsAutoLineIterator lineIterForSibling = sibling->GetLineIterator();
       if (lineIterForSibling) {
         // For the frames before that grab all the lines
         PRInt32 addLines = lineIterForSibling->GetNumLines();
         lineNumber += addLines;
       }
       sibling = sibling->GetNextSibling();
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -75,17 +75,16 @@ GK_ATOM(_moz_target, "_moz_target")
 GK_ATOM(_moz_type, "_moz-type")
 GK_ATOM(menuactive, "_moz-menuactive")
 GK_ATOM(_poundDefault, "#default")
 GK_ATOM(_asterix, "*")
 GK_ATOM(a, "a")
 GK_ATOM(abbr, "abbr")
 GK_ATOM(abort, "abort")
 GK_ATOM(above, "above")
-GK_ATOM(absoluteList, "Absolute-list")
 GK_ATOM(acceltext, "acceltext")
 GK_ATOM(accept, "accept")
 GK_ATOM(acceptcharset, "accept-charset")
 GK_ATOM(accesskey, "accesskey")
 GK_ATOM(acronym, "acronym")
 GK_ATOM(action, "action")
 GK_ATOM(active, "active")
 GK_ATOM(activetitlebarcolor, "activetitlebarcolor")
@@ -162,24 +161,22 @@ GK_ATOM(bottompadding, "bottompadding")
 GK_ATOM(bottomright, "bottomright")
 GK_ATOM(box, "box")
 GK_ATOM(br, "br")
 GK_ATOM(braille, "braille")
 GK_ATOM(broadcast, "broadcast")
 GK_ATOM(broadcaster, "broadcaster")
 GK_ATOM(broadcasterset, "broadcasterset")
 GK_ATOM(browser, "browser")
-GK_ATOM(bulletList, "Bullet-list")
 GK_ATOM(bulletinboard, "bulletinboard")
 GK_ATOM(button, "button")
 GK_ATOM(callTemplate, "call-template")
 GK_ATOM(cancel, "cancel")
 GK_ATOM(canvas, "canvas")
 GK_ATOM(caption, "caption")
-GK_ATOM(captionList, "Caption-list")
 GK_ATOM(capture, "capture")
 GK_ATOM(caseOrder, "case-order")
 GK_ATOM(cdataSectionElements, "cdata-section-elements")
 GK_ATOM(ceiling, "ceiling")
 GK_ATOM(cell, "cell")
 GK_ATOM(cellpadding, "cellpadding")
 GK_ATOM(cellspacing, "cellspacing")
 GK_ATOM(center, "center")
@@ -210,17 +207,16 @@ GK_ATOM(close, "close")
 GK_ATOM(closed, "closed")
 GK_ATOM(closemenu, "closemenu")
 GK_ATOM(coalesceduplicatearcs, "coalesceduplicatearcs")
 GK_ATOM(code, "code")
 GK_ATOM(codebase, "codebase")
 GK_ATOM(codetype, "codetype")
 GK_ATOM(col, "col")
 GK_ATOM(colgroup, "colgroup")
-GK_ATOM(colGroupList, "ColGroup-list")
 GK_ATOM(collapse, "collapse")
 GK_ATOM(collapsed, "collapsed")
 GK_ATOM(color, "color")
 GK_ATOM(colorIndex, "color-index")
 GK_ATOM(cols, "cols")
 GK_ATOM(colspan, "colspan")
 GK_ATOM(column, "column")
 GK_ATOM(columns, "columns")
@@ -355,38 +351,35 @@ GK_ATOM(enctype, "enctype")
 GK_ATOM(end, "end")
 GK_ATOM(end_after, "end_after")
 GK_ATOM(end_before, "end_before")
 GK_ATOM(equalsize, "equalsize")
 GK_ATOM(error, "error")
 GK_ATOM(even, "even")
 GK_ATOM(event, "event")
 GK_ATOM(events, "events")
-GK_ATOM(excessOverflowContainersList, "ExcessOverflowContainers-list")
 GK_ATOM(excludeResultPrefixes, "exclude-result-prefixes")
 GK_ATOM(excludes, "excludes")
 GK_ATOM(expr, "expr")
 GK_ATOM(extends, "extends")
 GK_ATOM(extensionElementPrefixes, "extension-element-prefixes")
 GK_ATOM(face, "face")
 GK_ATOM(fallback, "fallback")
 GK_ATOM(_false, "false")
 GK_ATOM(farthest, "farthest")
 GK_ATOM(field, "field")
 GK_ATOM(fieldset, "fieldset")
 GK_ATOM(figcaption, "figcaption")
 GK_ATOM(figure, "figure")
 GK_ATOM(fixed, "fixed")
-GK_ATOM(fixedList, "Fixed-list")
 GK_ATOM(flags, "flags")
 GK_ATOM(flex, "flex")
 GK_ATOM(flexgroup, "flexgroup")
 GK_ATOM(flip, "flip")
 GK_ATOM(floating, "floating")
-GK_ATOM(floatList, "Float-list")
 GK_ATOM(floor, "floor")
 GK_ATOM(flowlength, "flowlength")
 GK_ATOM(focus, "focus")
 GK_ATOM(following, "following")
 GK_ATOM(followingSibling, "following-sibling")
 GK_ATOM(font, "font")
 GK_ATOM(fontWeight, "font-weight")
 GK_ATOM(fontpicker, "fontpicker")
@@ -744,20 +737,17 @@ GK_ATOM(option, "option")
 GK_ATOM(_or, "or")
 GK_ATOM(order, "order")
 GK_ATOM(ordinal, "ordinal")
 GK_ATOM(orient, "orient")
 GK_ATOM(orientation, "orientation")
 GK_ATOM(otherwise, "otherwise")
 GK_ATOM(output, "output")
 GK_ATOM(overflow, "overflow")
-GK_ATOM(overflowList, "Overflow-list")
 GK_ATOM(overflowchanged, "overflowchanged")
-GK_ATOM(overflowContainersList, "OverflowContainers-list")
-GK_ATOM(overflowOutOfFlowList, "OverflowOutOfFlow-list")
 GK_ATOM(overlay, "overlay")
 GK_ATOM(overlap, "overlap")
 GK_ATOM(p, "p")
 GK_ATOM(pack, "pack")
 GK_ATOM(page, "page")
 GK_ATOM(pageincrement, "pageincrement")
 GK_ATOM(pagex, "pagex")
 GK_ATOM(pagey, "pagey")
@@ -782,17 +772,16 @@ GK_ATOM(plaintext, "plaintext")
 #ifdef MOZ_MEDIA
 GK_ATOM(playbackrate, "playbackrate")
 GK_ATOM(playcount, "playcount")
 #endif
 GK_ATOM(pointSize, "point-size")
 GK_ATOM(poly, "poly")
 GK_ATOM(polygon, "polygon")
 GK_ATOM(popup, "popup")
-GK_ATOM(popupList, "Popup-list")
 GK_ATOM(popupalign, "popupalign")
 GK_ATOM(popupanchor, "popupanchor")
 GK_ATOM(popupgroup, "popupgroup")
 GK_ATOM(popuphidden, "popuphidden")
 GK_ATOM(popuphiding, "popuphiding")
 GK_ATOM(popuplistener, "popuplistener")
 GK_ATOM(popupset, "popupset")
 GK_ATOM(popupshowing, "popupshowing")
@@ -823,17 +812,16 @@ GK_ATOM(progressmeter, "progressmeter")
 GK_ATOM(progressNormal, "progressNormal")
 GK_ATOM(progressUndetermined, "progressUndetermined")
 GK_ATOM(projection, "projection")
 GK_ATOM(prompt, "prompt")
 GK_ATOM(propagate, "propagate")
 GK_ATOM(properties, "properties")
 GK_ATOM(property, "property")
 GK_ATOM(pubdate, "pubdate")
-GK_ATOM(pushedFloatsList, "PushedFloats-list")
 GK_ATOM(q, "q")
 GK_ATOM(query, "query")
 GK_ATOM(queryset, "queryset")
 GK_ATOM(querytype, "querytype")
 GK_ATOM(radio, "radio")
 GK_ATOM(radiogroup, "radiogroup")
 GK_ATOM(readonly, "readonly")
 GK_ATOM(rect, "rect")
@@ -888,17 +876,16 @@ GK_ATOM(script, "script")
 GK_ATOM(scriptEnabledBeforePrintOrPreview, "scriptEnabledBeforePrintOrPreview")
 GK_ATOM(scrollbar, "scrollbar")
 GK_ATOM(scrollbarbutton, "scrollbarbutton")
 GK_ATOM(scrollbox, "scrollbox")
 GK_ATOM(scrollcorner, "scrollcorner")
 GK_ATOM(scrolling, "scrolling")
 GK_ATOM(section, "section")
 GK_ATOM(select, "select")
-GK_ATOM(selectPopupList, "selectPopupList")
 GK_ATOM(selectable, "selectable")
 GK_ATOM(selected, "selected")
 GK_ATOM(selectedIndex, "selectedIndex")
 GK_ATOM(selectedindex, "selectedindex")
 GK_ATOM(self, "self")
 GK_ATOM(seltype, "seltype")
 GK_ATOM(setcookie, "set-cookie")
 GK_ATOM(setter, "setter")
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -16,17 +16,17 @@
  * The Original Code is Mozilla Communicator client code.
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *   Ms2ger <ms2ger@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
@@ -1444,17 +1444,17 @@ nsGenericHTMLElement::GetFormControlFram
   if (frame) {
     nsIFormControlFrame* form_frame = do_QueryFrame(frame);
     if (form_frame) {
       return form_frame;
     }
 
     // If we have generated content, the primary frame will be a
     // wrapper frame..  out real frame will be in its child list.
-    for (frame = frame->GetFirstChild(nsnull);
+    for (frame = frame->GetFirstPrincipalChild();
          frame;
          frame = frame->GetNextSibling()) {
       form_frame = do_QueryFrame(frame);
       if (form_frame) {
         return form_frame;
       }
     }
   }
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -1702,17 +1702,17 @@ nsHTMLInputElement::SetCheckedInternal(P
 
 NS_IMETHODIMP
 nsHTMLInputElement::Focus()
 {
   if (mType == NS_FORM_INPUT_FILE) {
     // for file inputs, focus the button instead
     nsIFrame* frame = GetPrimaryFrame();
     if (frame) {
-      nsIFrame* childFrame = frame->GetFirstChild(nsnull);
+      nsIFrame* childFrame = frame->GetFirstPrincipalChild();
       while (childFrame) {
         // see if the child is a button control
         nsCOMPtr<nsIFormControl> formCtrl =
           do_QueryInterface(childFrame->GetContent());
         if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_BUTTON) {
           nsCOMPtr<nsIDOMElement> element(do_QueryInterface(formCtrl));
           nsIFocusManager* fm = nsFocusManager::GetFocusManager();
           if (fm && element)
--- a/content/html/content/src/nsTextEditorState.cpp
+++ b/content/html/content/src/nsTextEditorState.cpp
@@ -1868,17 +1868,17 @@ nsTextEditorState::SetValue(const nsAStr
           selPriv->EndBatchChanges();
       }
     }
 
     // This second check _shouldn't_ be necessary, but let's be safe.
     if (!weakFrame.IsAlive()) {
       return;
     }
-    nsIScrollableFrame* scrollableFrame = do_QueryFrame(mBoundFrame->GetFirstChild(nsnull));
+    nsIScrollableFrame* scrollableFrame = do_QueryFrame(mBoundFrame->GetFirstPrincipalChild());
     if (scrollableFrame)
     {
       // Scroll the upper left corner of the text control's
       // content area back into view.
       scrollableFrame->ScrollTo(nsPoint(0, 0), nsIScrollableFrame::INSTANT);
     }
 
     if (aUserInput) {
@@ -1921,17 +1921,17 @@ nsTextEditorState::InitializeKeyboardEve
                                     NS_EVENT_FLAG_BUBBLE |
                                     NS_EVENT_FLAG_SYSTEM_EVENT);
     manager->AddEventListenerByType(mTextListener,
                                     NS_LITERAL_STRING("keyup"),
                                     NS_EVENT_FLAG_BUBBLE |
                                     NS_EVENT_FLAG_SYSTEM_EVENT);
   }
 
-  mSelCon->SetScrollableFrame(do_QueryFrame(mBoundFrame->GetFirstChild(nsnull)));
+  mSelCon->SetScrollableFrame(do_QueryFrame(mBoundFrame->GetFirstPrincipalChild()));
 }
 
 /* static */ void
 nsTextEditorState::ShutDown()
 {
   NS_IF_RELEASE(sNativeTextAreaBindings);
   NS_IF_RELEASE(sNativeInputBindings);
 }
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7976,17 +7976,17 @@ nsGlobalWindow::DispatchSyncPopState()
 // child lists.  aFrame must be non-null.
 static nsCanvasFrame* FindCanvasFrame(nsIFrame* aFrame)
 {
     nsCanvasFrame* canvasFrame = do_QueryFrame(aFrame);
     if (canvasFrame) {
         return canvasFrame;
     }
 
-    nsIFrame* kid = aFrame->GetFirstChild(nsnull);
+    nsIFrame* kid = aFrame->GetFirstPrincipalChild();
     while (kid) {
         canvasFrame = FindCanvasFrame(kid);
         if (canvasFrame) {
             return canvasFrame;
         }
         kid = kid->GetNextSibling();
     }
 
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -372,23 +372,23 @@ SplitInlineAncestors(nsIFrame*     aFram
 
     // Reparent views as necessary
     rv = nsContainerFrame::ReparentFrameViewList(presContext, tail, parent, newParent);
     if (NS_FAILED(rv)) {
       return rv;
     }
     
     // The parent's continuation adopts the siblings after the split.
-    rv = newParent->InsertFrames(nsGkAtoms::nextBidi, nsnull, tail);
+    rv = newParent->InsertFrames(nsIFrame::kNoReflowPrincipalList, nsnull, tail);
     if (NS_FAILED(rv)) {
       return rv;
     }
-    // The list name nsGkAtoms::nextBidi would indicate we don't want reflow
+    // The list name kNoReflowPrincipalList would indicate we don't want reflow
     nsFrameList temp(newParent, newParent);
-    rv = grandparent->InsertFrames(nsGkAtoms::nextBidi, parent, temp);
+    rv = grandparent->InsertFrames(nsIFrame::kNoReflowPrincipalList, parent, temp);
     if (NS_FAILED(rv)) {
       return rv;
     }
     
     frame = parent;
     parent = grandparent;
   }
   
@@ -459,20 +459,20 @@ CreateContinuation(nsIFrame*  aFrame,
   }
 
   rv = presShell->FrameConstructor()->
     CreateContinuingFrame(presContext, aFrame, parent, aNewFrame, aIsFluid);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  // The list name nsGkAtoms::nextBidi would indicate we don't want reflow
+  // The list name kNoReflowPrincipalList would indicate we don't want reflow
   // XXXbz this needs higher-level framelist love
   nsFrameList temp(*aNewFrame, *aNewFrame);
-  rv = parent->InsertFrames(nsGkAtoms::nextBidi, aFrame, temp);
+  rv = parent->InsertFrames(nsIFrame::kNoReflowPrincipalList, aFrame, temp);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (!aIsFluid) {  
     // Split inline ancestor frames
     rv = SplitInlineAncestors(aFrame);
     if (NS_FAILED(rv)) {
@@ -535,17 +535,17 @@ nsBidiPresUtils::Resolve(nsBlockFrame* a
       bpd.PushBidiControl(ch);
     }
   }
   for (nsBlockFrame* block = aBlockFrame; block;
        block = static_cast<nsBlockFrame*>(block->GetNextContinuation())) {
     block->RemoveStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
     nsBlockInFlowLineIterator lineIter(block, block->begin_lines(), PR_FALSE);
     bpd.mPrevFrame = nsnull;
-    TraverseFrames(aBlockFrame, &lineIter, block->GetFirstChild(nsnull), &bpd);
+    TraverseFrames(aBlockFrame, &lineIter, block->GetFirstPrincipalChild(), &bpd);
   }
 
   if (ch != 0) {
     bpd.PopBidiControl();
   }
 
   return ResolveParagraph(aBlockFrame, &bpd);
 }
@@ -785,17 +785,17 @@ nsBidiPresUtils::ResolveParagraph(nsBloc
 #endif
 #endif
 
   return rv;
 }
 
 // Should this frame be treated as a leaf (e.g. when building mLogicalFrames)?
 PRBool IsBidiLeaf(nsIFrame* aFrame) {
-  nsIFrame* kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame* kid = aFrame->GetFirstPrincipalChild();
   return !kid
     || !aFrame->IsFrameOfType(nsIFrame::eBidiInlineContainer);
 }
 
 void
 nsBidiPresUtils::TraverseFrames(nsBlockFrame*              aBlockFrame,
                                 nsBlockInFlowLineIterator* aLineIter,
                                 nsIFrame*                  aCurrentFrame,
@@ -994,17 +994,17 @@ nsBidiPresUtils::TraverseFrames(nsBlockF
         if (!frame->GetStyleContext()->GetStyleDisplay()->IsInlineOutside()) {
           // if it is not inline, end the paragraph
           ResolveParagraphWithinBlock(aBlockFrame, aBpd);
         }
       }
     }
     else {
       // For a non-leaf frame, recurse into TraverseFrames
-      nsIFrame* kid = frame->GetFirstChild(nsnull);
+      nsIFrame* kid = frame->GetFirstPrincipalChild();
       TraverseFrames(aBlockFrame, aLineIter, kid, aBpd);
     }
 
     // If the element is attributed by dir, indicate direction pop (add PDF frame)
     if (ch != 0 && isLastFrame) {
       // Add a dummy frame pointer representing a bidi control code after the
       // last frame of an element specifying embedding or override
       aBpd->PopBidiControl();
@@ -1023,47 +1023,47 @@ nsBidiPresUtils::ResolveParagraphWithinB
 }
 
 void
 nsBidiPresUtils::ReorderFrames(nsIFrame*            aFirstFrameOnLine,
                                PRInt32              aNumFramesOnLine)
 {
   // If this line consists of a line frame, reorder the line frame's children.
   if (aFirstFrameOnLine->GetType() == nsGkAtoms::lineFrame) {
-    aFirstFrameOnLine = aFirstFrameOnLine->GetFirstChild(nsnull);
+    aFirstFrameOnLine = aFirstFrameOnLine->GetFirstPrincipalChild();
     if (!aFirstFrameOnLine)
       return;
     // All children of the line frame are on the first line. Setting aNumFramesOnLine
     // to -1 makes InitLogicalArrayFromLine look at all of them.
     aNumFramesOnLine = -1;
   }
 
   BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine);
   RepositionInlineFrames(&bld, aFirstFrameOnLine);
 }
 
 nsBidiLevel
 nsBidiPresUtils::GetFrameEmbeddingLevel(nsIFrame* aFrame)
 {
   nsIFrame* firstLeaf = aFrame;
   while (!IsBidiLeaf(firstLeaf)) {
-    nsIFrame* firstChild = firstLeaf->GetFirstChild(nsnull);
+    nsIFrame* firstChild = firstLeaf->GetFirstPrincipalChild();
     nsIFrame* realFrame = nsPlaceholderFrame::GetRealFrameFor(firstChild);
     firstLeaf = (realFrame->GetType() == nsGkAtoms::letterFrame) ?
                  realFrame : firstChild;
   }
   return NS_GET_EMBEDDING_LEVEL(firstLeaf);
 }
 
 nsBidiLevel
 nsBidiPresUtils::GetFrameBaseLevel(nsIFrame* aFrame)
 {
   nsIFrame* firstLeaf = aFrame;
   while (!IsBidiLeaf(firstLeaf)) {
-    firstLeaf = firstLeaf->GetFirstChild(nsnull);
+    firstLeaf = firstLeaf->GetFirstPrincipalChild();
   }
   return NS_GET_BASE_LEVEL(firstLeaf);
 }
 
 void
 nsBidiPresUtils::IsLeftOrRightMost(nsIFrame*              aFrame,
                                    nsContinuationStates*  aContinuationStates,
                                    PRBool&                aIsLeftMost /* out */,
@@ -1202,17 +1202,17 @@ nsBidiPresUtils::RepositionFrame(nsIFram
     if (isLeftMost) {
       x += borderPadding.left;
     }
 
     // If aIsOddLevel is true, so we need to traverse the child list
     // in reverse order, to make it O(n) we store the list locally and
     // iterate the list reversely
     nsTArray<nsIFrame*> childList;
-    nsIFrame *frame = aFrame->GetFirstChild(nsnull);
+    nsIFrame *frame = aFrame->GetFirstPrincipalChild();
     if (frame && aIsOddLevel) {
       childList.AppendElement((nsIFrame*)nsnull);
       while (frame) {
         childList.AppendElement(frame);
         frame = frame->GetNextSibling();
       }
       frame = childList[childList.Length() - 1];
     }
@@ -1250,17 +1250,17 @@ nsBidiPresUtils::InitContinuationStates(
 {
   nsFrameContinuationState* state = aContinuationStates->PutEntry(aFrame);
   state->mFirstVisualFrame = nsnull;
   state->mFrameCount = 0;
 
   if (!IsBidiLeaf(aFrame)) {
     // Continue for child frames
     nsIFrame* frame;
-    for (frame = aFrame->GetFirstChild(nsnull);
+    for (frame = aFrame->GetFirstPrincipalChild();
          frame;
          frame = frame->GetNextSibling()) {
       InitContinuationStates(frame,
                              aContinuationStates);
     }
   }
 }
 
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -354,17 +354,17 @@ static PRInt32 FFWC_doSibling=0;
 static PRInt32 FFWC_recursions=0;
 static PRInt32 FFWC_nextInFlows=0;
 #endif
 
 static inline nsIFrame*
 GetFieldSetBlockFrame(nsIFrame* aFieldsetFrame)
 {
   // Depends on the fieldset child frame order - see ConstructFieldSetFrame() below.
-  nsIFrame* firstChild = aFieldsetFrame->GetFirstChild(nsnull);
+  nsIFrame* firstChild = aFieldsetFrame->GetFirstPrincipalChild();
   return firstChild && firstChild->GetNextSibling() ? firstChild->GetNextSibling() : firstChild;
 }
 
 #define FCDATA_DECL(_flags, _func) \
   { _flags, { (FrameCreationFunc)_func } }
 
 //----------------------------------------------------------------------
 
@@ -461,17 +461,17 @@ static nsIFrame* GetSpecialPrevSibling(n
 }
 
 static nsIFrame*
 GetLastSpecialSibling(nsIFrame* aFrame, PRBool aReturnEmptyTrailingInline)
 {
   for (nsIFrame *frame = aFrame, *next; ; frame = next) {
     next = GetSpecialSibling(frame);
     if (!next ||
-        (!aReturnEmptyTrailingInline && !next->GetFirstChild(nsnull) &&
+        (!aReturnEmptyTrailingInline && !next->GetFirstPrincipalChild() &&
          !GetSpecialSibling(next))) {
       NS_ASSERTION(!next || !IsInlineOutside(frame),
                    "Should have a block here!");
       return frame;
     }
   }
   NS_NOTREACHED("unreachable code");
   return nsnull;
@@ -576,34 +576,34 @@ FindFirstNonBlock(const nsFrameList& aLi
   return link;
 }
 
 inline void
 SetInitialSingleChild(nsIFrame* aParent, nsIFrame* aFrame)
 {
   NS_PRECONDITION(!aFrame->GetNextSibling(), "Should be using a frame list");
   nsFrameList temp(aFrame, aFrame);
-  aParent->SetInitialChildList(nsnull, temp);
+  aParent->SetInitialChildList(nsIFrame::kPrincipalList, temp);
 }
 
 // -----------------------------------------------------------
 
 // Structure used when constructing formatting object trees.
 struct nsFrameItems : public nsFrameList
 {
   // Appends the frame to the end of the list
   void AddChild(nsIFrame* aChild);
 };
 
 void 
 nsFrameItems::AddChild(nsIFrame* aChild)
 {
   NS_PRECONDITION(aChild, "nsFrameItems::AddChild");
 
-  // It'd be really nice if we could just AppendFrames(nsnull, aChild) here,
+  // It'd be really nice if we could just AppendFrames(nsIFrame::kPrincipalList, aChild) here,
   // but some of our callers put frames that have different
   // parents (caption, I'm looking at you) on the same framelist, and
   // nsFrameList asserts if you try to do that.
   if (IsEmpty()) {
     SetFrames(aChild);
   }
   else {
     NS_ASSERTION(aChild != mLastChild,
@@ -653,28 +653,29 @@ nsAbsoluteItems::AddChild(nsIFrame* aChi
 }
 
 // -----------------------------------------------------------
 
 // Structure for saving the existing state when pushing/poping containing
 // blocks. The destructor restores the state to its previous state
 class NS_STACK_CLASS nsFrameConstructorSaveState {
 public:
+  typedef nsIFrame::ChildListID ChildListID;
   nsFrameConstructorSaveState();
   ~nsFrameConstructorSaveState();
 
 private:
   nsAbsoluteItems* mItems;                // pointer to struct whose data we save/restore
   PRPackedBool*    mFixedPosIsAbsPos;
 
   nsAbsoluteItems  mSavedItems;           // copy of original data
   PRPackedBool     mSavedFixedPosIsAbsPos;
 
   // The name of the child list in which our frames would belong
-  nsIAtom* mChildListName;
+  ChildListID mChildListID;
   nsFrameConstructorState* mState;
 
   friend class nsFrameConstructorState;
 };
 
 // Structure used to keep track of a list of bindings we need to call
 // AddToAttachedQueue on.  These should be in post-order depth-first
 // flattened tree traversal order.
@@ -691,22 +692,24 @@ struct PendingBinding : public PRCList
 
   nsRefPtr<nsXBLBinding> mBinding;
 };
 
 // Structure used for maintaining state information during the
 // frame construction process
 class NS_STACK_CLASS nsFrameConstructorState {
 public:
+  typedef nsIFrame::ChildListID ChildListID;
+
   nsPresContext            *mPresContext;
   nsIPresShell             *mPresShell;
   nsFrameManager           *mFrameManager;
 
 #ifdef MOZ_XUL
-  // Frames destined for the nsGkAtoms::popupList.
+  // Frames destined for the kPopupList.
   nsAbsoluteItems           mPopupItems;
 #endif
 
   // Containing block information for out-of-flow frames.
   nsAbsoluteItems           mFixedItems;
   nsAbsoluteItems           mAbsoluteItems;
   nsAbsoluteItems           mFloatedItems;
 
@@ -863,20 +866,20 @@ public:
     PR_INSERT_BEFORE(aPendingBinding, mCurrentPendingBindingInsertionPoint);
   }
 
 protected:
   friend class nsFrameConstructorSaveState;
 
   /**
    * ProcessFrameInsertions takes the frames in aFrameItems and adds them as
-   * kids to the aChildListName child list of |aFrameItems.containingBlock|.
+   * kids to the aChildListID child list of |aFrameItems.containingBlock|.
    */
   void ProcessFrameInsertions(nsAbsoluteItems& aFrameItems,
-                              nsIAtom* aChildListName);
+                              ChildListID aChildListID);
 
   // Our list of all pending bindings.  When we're done, we need to call
   // AddToAttachedQueue on all of them, in order.
   PRCList mPendingBindings;
 
   PRCList* mCurrentPendingBindingInsertionPoint;
 };
 
@@ -957,21 +960,21 @@ nsFrameConstructorState::~nsFrameConstru
   // have been inserted into the frame tree. So for example if we have a new float
   // containing the placeholder for a new abs-pos frame, and we process the abs-pos
   // insertion first, then we won't be able to find the right place to insert in
   // in the abs-pos list. So put floats in first, because they can contain placeholders
   // for abs-pos and fixed-pos items whose containing blocks are outside the floats.
   // Then put abs-pos frames in, because they can contain placeholders for fixed-pos
   // items whose containing block is outside the abs-pos frames. 
   MOZ_COUNT_DTOR(nsFrameConstructorState);
-  ProcessFrameInsertions(mFloatedItems, nsGkAtoms::floatList);
-  ProcessFrameInsertions(mAbsoluteItems, nsGkAtoms::absoluteList);
-  ProcessFrameInsertions(mFixedItems, nsGkAtoms::fixedList);
+  ProcessFrameInsertions(mFloatedItems, nsIFrame::kFloatList);
+  ProcessFrameInsertions(mAbsoluteItems, nsIFrame::kAbsoluteList);
+  ProcessFrameInsertions(mFixedItems, nsIFrame::kFixedList);
 #ifdef MOZ_XUL
-  ProcessFrameInsertions(mPopupItems, nsGkAtoms::popupList);
+  ProcessFrameInsertions(mPopupItems, nsIFrame::kPopupList);
 #endif
   for (PRInt32 i = mGeneratedTextNodesWithInitializer.Count() - 1; i >= 0; --i) {
     mGeneratedTextNodesWithInitializer[i]->
       DeleteProperty(nsGkAtoms::genConInitializerProperty);
   }
   if (!PR_CLIST_IS_EMPTY(&mPendingBindings)) {
     nsBindingManager* bindingManager = mPresShell->GetDocument()->BindingManager();
     do {
@@ -997,17 +1000,17 @@ AdjustAbsoluteContainingBlock(nsIFrame* 
 }
 
 void
 nsFrameConstructorState::PushAbsoluteContainingBlock(nsIFrame* aNewAbsoluteContainingBlock,
                                                      nsFrameConstructorSaveState& aSaveState)
 {
   aSaveState.mItems = &mAbsoluteItems;
   aSaveState.mSavedItems = mAbsoluteItems;
-  aSaveState.mChildListName = nsGkAtoms::absoluteList;
+  aSaveState.mChildListID = nsIFrame::kAbsoluteList;
   aSaveState.mState = this;
 
   /* Store whether we're wiring the abs-pos and fixed-pos lists together. */
   aSaveState.mFixedPosIsAbsPos = &mFixedPosIsAbsPos;
   aSaveState.mSavedFixedPosIsAbsPos = mFixedPosIsAbsPos;
 
   mAbsoluteItems = 
     nsAbsoluteItems(AdjustAbsoluteContainingBlock(aNewAbsoluteContainingBlock));
@@ -1023,17 +1026,17 @@ void
 nsFrameConstructorState::PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock,
                                                   nsFrameConstructorSaveState& aSaveState)
 {
   NS_PRECONDITION(!aNewFloatContainingBlock ||
                   aNewFloatContainingBlock->IsFloatContainingBlock(),
                   "Please push a real float containing block!");
   aSaveState.mItems = &mFloatedItems;
   aSaveState.mSavedItems = mFloatedItems;
-  aSaveState.mChildListName = nsGkAtoms::floatList;
+  aSaveState.mChildListID = nsIFrame::kFloatList;
   aSaveState.mState = this;
   mFloatedItems = nsAbsoluteItems(aNewFloatContainingBlock);
 }
 
 nsIFrame*
 nsFrameConstructorState::GetGeometricParent(const nsStyleDisplay* aStyleDisplay,
                                             nsIFrame* aContentParentFrame)
 {
@@ -1173,51 +1176,51 @@ nsFrameConstructorState::AddChild(nsIFra
     frameItems->AddChild(aNewFrame);
   }
   
   return NS_OK;
 }
 
 void
 nsFrameConstructorState::ProcessFrameInsertions(nsAbsoluteItems& aFrameItems,
-                                                nsIAtom* aChildListName)
-{
-#define NS_NONXUL_LIST_TEST (&aFrameItems == &mFloatedItems &&             \
-                             aChildListName == nsGkAtoms::floatList)    || \
-                            (&aFrameItems == &mAbsoluteItems &&            \
-                             aChildListName == nsGkAtoms::absoluteList) || \
-                            (&aFrameItems == &mFixedItems &&               \
-                             aChildListName == nsGkAtoms::fixedList)
+                                                ChildListID aChildListID)
+{
+#define NS_NONXUL_LIST_TEST (&aFrameItems == &mFloatedItems &&            \
+                             aChildListID == nsIFrame::kFloatList)    ||  \
+                            (&aFrameItems == &mAbsoluteItems &&           \
+                             aChildListID == nsIFrame::kAbsoluteList) ||  \
+                            (&aFrameItems == &mFixedItems &&              \
+                             aChildListID == nsIFrame::kFixedList)
 #ifdef MOZ_XUL
   NS_PRECONDITION(NS_NONXUL_LIST_TEST ||
                   (&aFrameItems == &mPopupItems &&
-                   aChildListName == nsGkAtoms::popupList), 
-                  "Unexpected aFrameItems/aChildListName combination");
+                   aChildListID == nsIFrame::kPopupList), 
+                  "Unexpected aFrameItems/aChildListID combination");
 #else
   NS_PRECONDITION(NS_NONXUL_LIST_TEST,
-                  "Unexpected aFrameItems/aChildListName combination");
+                  "Unexpected aFrameItems/aChildListID combination");
 #endif
 
   if (aFrameItems.IsEmpty()) {
     return;
   }
   
   nsIFrame* containingBlock = aFrameItems.containingBlock;
 
   NS_ASSERTION(containingBlock,
                "Child list without containing block?");
   
   // Insert the frames hanging out in aItems.  We can use SetInitialChildList()
   // if the containing block hasn't been reflowed yet (so NS_FRAME_FIRST_REFLOW
-  // is set) and doesn't have any frames in the aChildListName child list yet.
-  const nsFrameList& childList = containingBlock->GetChildList(aChildListName);
+  // is set) and doesn't have any frames in the aChildListID child list yet.
+  const nsFrameList& childList = containingBlock->GetChildList(aChildListID);
   nsresult rv = NS_OK;
   if (childList.IsEmpty() &&
       (containingBlock->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
-    rv = containingBlock->SetInitialChildList(aChildListName, aFrameItems);
+    rv = containingBlock->SetInitialChildList(aChildListID, aFrameItems);
   } else {
     // Note that whether the frame construction context is doing an append or
     // not is not helpful here, since it could be appending to some frame in
     // the middle of the document, which means we're not necessarily
     // appending to the children of the containing block.
     //
     // We need to make sure the 'append to the end of document' case is fast.
     // So first test the last child of the containing block
@@ -1225,32 +1228,32 @@ nsFrameConstructorState::ProcessFrameIns
 
     // CompareTreePosition uses placeholder hierarchy for out of flow frames,
     // so this will make out-of-flows respect the ordering of placeholders,
     // which is great because it takes care of anonymous content.
     nsIFrame* firstNewFrame = aFrameItems.FirstChild();  
     if (!lastChild ||
         nsLayoutUtils::CompareTreePosition(lastChild, firstNewFrame, containingBlock) < 0) {
       // no lastChild, or lastChild comes before the new children, so just append
-      rv = containingBlock->AppendFrames(aChildListName, aFrameItems);
+      rv = containingBlock->AppendFrames(aChildListID, aFrameItems);
     } else {
       // try the other children
       nsIFrame* insertionPoint = nsnull;
       for (nsIFrame* f = childList.FirstChild(); f != lastChild;
            f = f->GetNextSibling()) {
         PRInt32 compare =
           nsLayoutUtils::CompareTreePosition(f, firstNewFrame, containingBlock);
         if (compare > 0) {
           // f comes after the new children, so stop here and insert after
           // the previous frame
           break;
         }
         insertionPoint = f;
       }
-      rv = containingBlock->InsertFrames(aChildListName, insertionPoint,
+      rv = containingBlock->InsertFrames(aChildListID, insertionPoint,
                                          aFrameItems);
     }
   }
 
   NS_POSTCONDITION(aFrameItems.IsEmpty(), "How did that happen?");
 
   // XXXbz And if NS_FAILED(rv), what?  I guess we need to clean up the list
   // and deal with all the placeholders... but what if the placeholders aren't
@@ -1259,27 +1262,27 @@ nsFrameConstructorState::ProcessFrameIns
 }
 
 
 nsFrameConstructorSaveState::nsFrameConstructorSaveState()
   : mItems(nsnull),
     mFixedPosIsAbsPos(nsnull),
     mSavedItems(nsnull),
     mSavedFixedPosIsAbsPos(PR_FALSE),
-    mChildListName(nsnull),
+    mChildListID(nsIFrame::kPrincipalList),
     mState(nsnull)
 {
 }
 
 nsFrameConstructorSaveState::~nsFrameConstructorSaveState()
 {
   // Restore the state
   if (mItems) {
     NS_ASSERTION(mState, "Can't have mItems set without having a state!");
-    mState->ProcessFrameInsertions(*mItems, mChildListName);
+    mState->ProcessFrameInsertions(*mItems, mChildListID);
     *mItems = mSavedItems;
 #ifdef DEBUG
     // We've transferred the child list, so drop the pointer we held to it.
     // Note that this only matters for the assert in ~nsAbsoluteItems.
     mSavedItems.Clear();
 #endif
   }
   if (mFixedPosIsAbsPos) {
@@ -1328,21 +1331,21 @@ MoveChildrenTo(nsPresContext* aPresConte
     nsContainerFrame::ReparentFrameViewList(aPresContext, aFrameList,
                                             aOldParent, aNewParent);
   }
 
   for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
     e.get()->SetParent(aNewParent);
   }
 
-  if (aNewParent->GetChildList(nsnull).IsEmpty() &&
+  if (aNewParent->PrincipalChildList().IsEmpty() &&
       (aNewParent->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
-    aNewParent->SetInitialChildList(nsnull, aFrameList);
+    aNewParent->SetInitialChildList(nsIFrame::kPrincipalList, aFrameList);
   } else {
-    aNewParent->AppendFrames(nsnull, aFrameList);
+    aNewParent->AppendFrames(nsIFrame::kPrincipalList, aFrameList);
   }
 }
 
 //----------------------------------------------------------------------
 
 nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument *aDocument,
                                              nsIPresShell *aPresShell)
   : mDocument(aDocument)
@@ -1763,19 +1766,19 @@ IsTablePseudo(nsIFrame* aFrame)
      pseudoType == nsCSSAnonBoxes::tableColGroup ||
      pseudoType == nsCSSAnonBoxes::tableRowGroup ||
      pseudoType == nsCSSAnonBoxes::tableRow ||
      pseudoType == nsCSSAnonBoxes::tableCell ||
      (pseudoType == nsCSSAnonBoxes::cellContent &&
       aFrame->GetParent()->GetStyleContext()->GetPseudo() ==
         nsCSSAnonBoxes::tableCell) ||
      (pseudoType == nsCSSAnonBoxes::tableOuter &&
-      (aFrame->GetFirstChild(nsnull)->GetStyleContext()->GetPseudo() ==
+      (aFrame->GetFirstPrincipalChild()->GetStyleContext()->GetPseudo() ==
          nsCSSAnonBoxes::table ||
-       aFrame->GetFirstChild(nsnull)->GetStyleContext()->GetPseudo() ==
+       aFrame->GetFirstPrincipalChild()->GetStyleContext()->GetPseudo() ==
          nsCSSAnonBoxes::inlineTable)));
 }
 
 /* static */
 nsCSSFrameConstructor::ParentType
 nsCSSFrameConstructor::GetParentType(nsIAtom* aFrameType)
 {
   if (aFrameType == nsGkAtoms::tableFrame) {
@@ -1931,21 +1934,21 @@ nsCSSFrameConstructor::ConstructTable(ns
   }
   // XXXbz what about cleaning up?
   if (NS_FAILED(rv)) return rv;
 
   nsFrameItems captionItems;
   PullOutCaptionFrames(childItems, captionItems);
 
   // Set the inner table frame's initial primary list 
-  innerFrame->SetInitialChildList(nsnull, childItems);
+  innerFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
 
   // Set the outer table frame's secondary childlist lists
   if (captionItems.NotEmpty()) {
-    newFrame->SetInitialChildList(nsGkAtoms::captionList, captionItems);
+    newFrame->SetInitialChildList(nsIFrame::kCaptionList, captionItems);
   }
 
   *aNewFrame = newFrame;
   return rv;
 }
 
 nsresult
 nsCSSFrameConstructor::ConstructTableRow(nsFrameConstructorState& aState,
@@ -1978,17 +1981,17 @@ nsCSSFrameConstructor::ConstructTableRow
     rv = ConstructFramesFromItemList(aState, aItem.mChildItems, newFrame,
                                      childItems);
   } else {
     rv = ProcessChildren(aState, content, styleContext, newFrame,
                          PR_TRUE, childItems, PR_FALSE, aItem.mPendingBinding);
   }
   if (NS_FAILED(rv)) return rv;
 
-  newFrame->SetInitialChildList(nsnull, childItems);
+  newFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
   aFrameItems.AddChild(newFrame);
   *aNewFrame = newFrame;
 
   return NS_OK;
 }
 
 nsresult
 nsCSSFrameConstructor::ConstructTableCol(nsFrameConstructorState& aState,
@@ -2118,17 +2121,17 @@ nsCSSFrameConstructor::ConstructTableCel
   if (NS_FAILED(rv)) {
     // Clean up
     // XXXbz kids of this stuff need to be cleaned up too!
     cellInnerFrame->Destroy();
     newFrame->Destroy();
     return rv;
   }
 
-  cellInnerFrame->SetInitialChildList(nsnull, childItems);
+  cellInnerFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
   SetInitialSingleChild(newFrame, cellInnerFrame);
   aFrameItems.AddChild(newFrame);
   *aNewFrame = newFrame;
 
   return NS_OK;
 }
 
 static inline PRBool 
@@ -2486,17 +2489,17 @@ nsCSSFrameConstructor::ConstructDocEleme
 
     NS_ASSERTION(!nsLayoutUtils::GetAsBlock(contentFrame),
                  "Only XUL and SVG frames should reach here");
     // Use a null PendingBinding, since our binding is not in fact pending.
     ProcessChildren(state, aDocElement, styleContext, contentFrame, PR_TRUE,
                     childItems, PR_FALSE, nsnull);
 
     // Set the initial child lists
-    contentFrame->SetInitialChildList(nsnull, childItems);
+    contentFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
   }
 
   SetInitialSingleChild(mDocElementContainingBlock, *aNewFrame);
 
   return NS_OK;
 }
 
 
@@ -2770,17 +2773,17 @@ nsCSSFrameConstructor::SetUpDocElementCo
     mDocElementContainingBlock = canvasFrame;
     mHasRootAbsPosContainingBlock = PR_TRUE;
   }
 
   if (viewportFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     SetInitialSingleChild(viewportFrame, newFrame);
   } else {
     nsFrameList newFrameList(newFrame, newFrame);
-    viewportFrame->AppendFrames(nsnull, newFrameList);
+    viewportFrame->AppendFrames(nsIFrame::kPrincipalList, newFrameList);
   }
 
   return NS_OK;
 }
 
 nsresult
 nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell*  aPresShell,
                                           nsPresContext* aPresContext,
@@ -2812,34 +2815,34 @@ nsCSSFrameConstructor::ConstructPageFram
   nsIFrame* pageContentFrame = NS_NewPageContentFrame(aPresShell, pageContentPseudoStyle);
   if (NS_UNLIKELY(!pageContentFrame))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Initialize the page content frame and force it to have a view. Also make it the
   // containing block for fixed elements which are repeated on every page.
   nsIFrame* prevPageContentFrame = nsnull;
   if (aPrevPageFrame) {
-    prevPageContentFrame = aPrevPageFrame->GetFirstChild(nsnull);
+    prevPageContentFrame = aPrevPageFrame->GetFirstPrincipalChild();
     NS_ASSERTION(prevPageContentFrame, "missing page content frame");
   }
   pageContentFrame->Init(nsnull, aPageFrame, prevPageContentFrame);
   SetInitialSingleChild(aPageFrame, pageContentFrame);
   mFixedContainingBlock = pageContentFrame;
 
   nsRefPtr<nsStyleContext> canvasPseudoStyle;
   canvasPseudoStyle = styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::canvas,
                                                          pageContentPseudoStyle);
 
   aCanvasFrame = NS_NewCanvasFrame(aPresShell, canvasPseudoStyle);
   if (NS_UNLIKELY(!aCanvasFrame))
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsIFrame* prevCanvasFrame = nsnull;
   if (prevPageContentFrame) {
-    prevCanvasFrame = prevPageContentFrame->GetFirstChild(nsnull);
+    prevCanvasFrame = prevPageContentFrame->GetFirstPrincipalChild();
     NS_ASSERTION(prevCanvasFrame, "missing canvas frame");
   }
   aCanvasFrame->Init(nsnull, pageContentFrame, prevCanvasFrame);
   SetInitialSingleChild(pageContentFrame, aCanvasFrame);
 
   return NS_OK;
 }
 
@@ -2984,33 +2987,34 @@ nsCSSFrameConstructor::ConstructButtonFr
 #endif
 
     rv = ProcessChildren(aState, content, styleContext, blockFrame, PR_TRUE,
                          childItems, aStyleDisplay->IsBlockInside(),
                          aItem.mPendingBinding);
     if (NS_FAILED(rv)) return rv;
   
     // Set the areas frame's initial child lists
-    blockFrame->SetInitialChildList(nsnull, childItems);
+    blockFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
   }
 
   SetInitialSingleChild(buttonFrame, blockFrame);
 
   if (isLeaf) {
     ClearLazyBits(content->GetFirstChild(), nsnull);
 
     nsFrameItems  anonymousChildItems;
     // if there are any anonymous children create frames for them.  Note that
     // we're doing this using a different parent frame from the one we pass to
     // ProcessChildren!
     CreateAnonymousFrames(aState, content, buttonFrame, aItem.mPendingBinding,
                           anonymousChildItems);
     if (anonymousChildItems.NotEmpty()) {
       // the anonymous content is already parented to the area frame
-      aState.mFrameManager->AppendFrames(blockFrame, nsnull,
+      aState.mFrameManager->AppendFrames(blockFrame,
+                                         nsIFrame::kPrincipalList,
                                          anonymousChildItems);
     }
   }
 
   // our new button frame returned is the top frame. 
   *aNewFrame = buttonFrame; 
 
   return NS_OK;  
@@ -3100,23 +3104,23 @@ nsCSSFrameConstructor::ConstructSelectFr
       // Create display and button frames from the combobox's anonymous content.
       // The anonymous content is appended to existing anonymous content for this
       // element (the scrollbars).
 
       nsFrameItems childItems;
       CreateAnonymousFrames(aState, content, comboboxFrame,
                             aItem.mPendingBinding, childItems);
   
-      comboboxFrame->SetInitialChildList(nsnull, childItems);
+      comboboxFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
 
       // Initialize the additional popup child list which contains the
       // dropdown list frame.
       nsFrameItems popupItems;
       popupItems.AddChild(listFrame);
-      comboboxFrame->SetInitialChildList(nsGkAtoms::selectPopupList,
+      comboboxFrame->SetInitialChildList(nsIFrame::kSelectPopupList,
                                          popupItems);
 
       *aNewFrame = comboboxFrame;
       aState.mFrameState = historyState;
       if (aState.mFrameState && aState.mFrameManager) {
         // Restore frame state for the entire subtree of |comboboxFrame|.
         aState.mFrameManager->RestoreFrameState(comboboxFrame,
                                                 aState.mFrameState);
@@ -3204,17 +3208,17 @@ nsCSSFrameConstructor::InitializeSelectF
     // absolutely positioned
     aState.PushAbsoluteContainingBlock(scrolledFrame, absoluteSaveState);
   }
 
   ProcessChildren(aState, aContent, aStyleContext, scrolledFrame, PR_FALSE,
                   childItems, PR_FALSE, aPendingBinding);
 
   // Set the scrolled frame's initial child lists
-  scrolledFrame->SetInitialChildList(nsnull, childItems);
+  scrolledFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
   return NS_OK;
 }
 
 nsresult
 nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
                                               FrameConstructionItem&   aItem,
                                               nsIFrame*                aParentFrame,
                                               const nsStyleDisplay*    aStyleDisplay,
@@ -3279,20 +3283,20 @@ nsCSSFrameConstructor::ConstructFieldSet
       childItems.RemoveFrame(legendFrame);
       // Make sure to reparent the legend so it has the fieldset as the parent.
       fieldsetKids.InsertFrame(newFrame, nsnull, legendFrame);
       break;
     }
   }
 
   // Set the inner frame's initial child lists
-  blockFrame->SetInitialChildList(nsnull, childItems);
+  blockFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
 
   // Set the outer frame's initial child list
-  newFrame->SetInitialChildList(nsnull, fieldsetKids);
+  newFrame->SetInitialChildList(nsIFrame::kPrincipalList, fieldsetKids);
 
   // our new frame returned is the top frame which is the list frame. 
   *aNewFrame = newFrame; 
 
   return NS_OK;
 }
 
 static nsIFrame*
@@ -3800,17 +3804,17 @@ nsCSSFrameConstructor::ConstructFrameFro
       }
 
       childItems = newItems;
     }
 
     // Set the frame's initial child list
     // Note that MathML depends on this being called even if
     // childItems is empty!
-    newFrame->SetInitialChildList(nsnull, childItems);
+    newFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
   }
 
   NS_ASSERTION(newFrame->IsFrameOfType(nsIFrame::eLineParticipant) ==
                ((bits & FCDATA_IS_LINE_PARTICIPANT) != 0),
                "Incorrectly set FCDATA_IS_LINE_PARTICIPANT bits");
 
   // Even if mCreatingExtraFrames is set, we may need to SetPrimaryFrame for
   // generated content that doesn't have one yet.  Note that we have to examine
@@ -4204,28 +4208,28 @@ nsCSSFrameConstructor::BeginBuildingScro
   aNewFrame = gfxScrollFrame;
 
   // we used the style that was passed in. So resolve another one.
   nsStyleSet *styleSet = mPresShell->StyleSet();
   nsStyleContext* aScrolledChildStyle =
     styleSet->ResolveAnonymousBoxStyle(aScrolledPseudo, contentStyle).get();
 
   if (gfxScrollFrame) {
-     gfxScrollFrame->SetInitialChildList(nsnull, anonymousItems);
+     gfxScrollFrame->SetInitialChildList(nsIFrame::kPrincipalList, anonymousItems);
   }
 
   return aScrolledChildStyle;
 }
 
 void
 nsCSSFrameConstructor::FinishBuildingScrollFrame(nsIFrame* aScrollFrame,
                                                  nsIFrame* aScrolledFrame)
 {
   nsFrameList scrolled(aScrolledFrame, aScrolledFrame);
-  aScrollFrame->AppendFrames(nsnull, scrolled);
+  aScrollFrame->AppendFrames(nsIFrame::kPrincipalList, scrolled);
 }
 
 
 /**
  * Called to wrap a gfx scrollframe around a frame. The hierarchy will look like this
  *
  * ------- for gfx scrollbars ------
  *
@@ -4583,17 +4587,17 @@ nsCSSFrameConstructor::FlushAccumulatedB
                           NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
   if (NS_UNLIKELY(!blockFrame))
     return NS_ERROR_OUT_OF_MEMORY;
 
   InitAndRestoreFrame(aState, aContent, aParentFrame, nsnull, blockFrame);
   ReparentFrames(aState.mFrameManager, blockFrame, *aBlockItems);
   // abs-pos and floats are disabled in MathML children so we don't have to
   // worry about messing up those.
-  blockFrame->SetInitialChildList(nsnull, *aBlockItems);
+  blockFrame->SetInitialChildList(nsIFrame::kPrincipalList, *aBlockItems);
   NS_ASSERTION(aBlockItems->IsEmpty(), "What happened?");
   aBlockItems->Clear();
   aNewItems->AddChild(blockFrame);
   return NS_OK;
 }
 
 // Only <math> elements can be floated or positioned.  All other MathML
 // should be in-flow.
@@ -4891,17 +4895,17 @@ nsCSSFrameConstructor::ConstructSVGForei
   nsFrameItems childItems;
   // Claim to be relatively positioned so that we end up being the
   // absolute containing block.
   rv = ConstructBlock(aState, innerPseudoStyle->GetStyleDisplay(), content,
                       newFrame, newFrame, innerPseudoStyle,
                       &blockFrame, childItems, PR_TRUE,
                       aItem.mPendingBinding);
 
-  newFrame->SetInitialChildList(nsnull, childItems);
+  newFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
 
   *aNewFrame = newFrame;
 
   return rv;
 }
 
 void
 nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
@@ -5619,57 +5623,57 @@ AdjustAppendParentForAfterContent(nsPres
 static nsIFrame*
 FindAppendPrevSibling(nsIFrame* aParentFrame, nsIFrame* aAfterFrame)
 {
   if (aAfterFrame) {
     NS_ASSERTION(aAfterFrame->GetParent() == aParentFrame, "Wrong parent");
     return aAfterFrame->GetPrevSibling();
   }
 
-  return aParentFrame->GetLastChild(nsnull);
+  return aParentFrame->GetLastChild(nsIFrame::kPrincipalList);
 }
 
 /**
  * This function will get the next sibling for a frame insert operation given
  * the parent and previous sibling.  aPrevSibling may be null.
  */
 static nsIFrame*
 GetInsertNextSibling(nsIFrame* aParentFrame, nsIFrame* aPrevSibling)
 {
   if (aPrevSibling) {
     return aPrevSibling->GetNextSibling();
   }
 
-  return aParentFrame->GetFirstChild(nsnull);
+  return aParentFrame->GetFirstPrincipalChild();
 }
 
 /**
  * This function is called by ContentAppended() and ContentInserted() when
  * appending flowed frames to a parent's principal child list. It handles the
  * case where the parent is the trailing inline of an {ib} split.
  */
 nsresult
 nsCSSFrameConstructor::AppendFrames(nsFrameConstructorState&       aState,
                                     nsIFrame*                      aParentFrame,
                                     nsFrameItems&                  aFrameList,
                                     nsIFrame*                      aPrevSibling,
                                     PRBool                         aIsRecursiveCall)
 {
   NS_PRECONDITION(!IsFrameSpecial(aParentFrame) ||
                   !GetSpecialSibling(aParentFrame) ||
-                  !GetSpecialSibling(aParentFrame)->GetFirstChild(nsnull),
+                  !GetSpecialSibling(aParentFrame)->GetFirstPrincipalChild(),
                   "aParentFrame has a special sibling with kids?");
   NS_PRECONDITION(!aPrevSibling || aPrevSibling->GetParent() == aParentFrame,
                   "Parent and prevsibling don't match");
 
   nsIFrame* nextSibling = ::GetInsertNextSibling(aParentFrame, aPrevSibling);
 
   NS_ASSERTION(nextSibling ||
                !aParentFrame->GetNextContinuation() ||
-               !aParentFrame->GetNextContinuation()->GetFirstChild(nsnull) ||
+               !aParentFrame->GetNextContinuation()->GetFirstPrincipalChild() ||
                aIsRecursiveCall,
                "aParentFrame has later continuations with kids?");
   NS_ASSERTION(nextSibling ||
                !IsFrameSpecial(aParentFrame) ||
                (IsInlineFrame(aParentFrame) &&
                 !GetSpecialSibling(aParentFrame) &&
                 !aParentFrame->GetNextContinuation()) ||
                aIsRecursiveCall,
@@ -5684,17 +5688,17 @@ nsCSSFrameConstructor::AppendFrames(nsFr
     // continuations have no siblings, then put the initial blocks from the
     // frame list into the previous block of the {ib} split.  Note that we
     // didn't want to stop at the block part of the split when figuring out
     // initial parent, because that could screw up float parenting; it's easier
     // to do this little fixup here instead.
     if (aFrameList.NotEmpty() && !IsInlineOutside(aFrameList.FirstChild())) {
       // See whether our trailing inline is empty
       nsIFrame* firstContinuation = aParentFrame->GetFirstContinuation();
-      if (firstContinuation->GetChildList(nsnull).IsEmpty()) {
+      if (firstContinuation->PrincipalChildList().IsEmpty()) {
         // Our trailing inline is empty.  Collect our starting blocks from
         // aFrameList, get the right parent frame for them, and put them in.
         nsFrameList::FrameLinkEnumerator firstNonBlockEnumerator =
           FindFirstNonBlock(aFrameList);
         nsFrameList blockKids = aFrameList.ExtractHead(firstNonBlockEnumerator);
         NS_ASSERTION(blockKids.NotEmpty(), "No blocks?");
 
         nsIFrame* prevBlock =
@@ -5706,17 +5710,19 @@ nsCSSFrameConstructor::AppendFrames(nsFr
     }
 
     // We want to put some of the frames into this inline frame.
     nsFrameList::FrameLinkEnumerator firstBlockEnumerator(aFrameList);
     FindFirstBlock(firstBlockEnumerator);
 
     nsFrameList inlineKids = aFrameList.ExtractHead(firstBlockEnumerator);
     if (!inlineKids.IsEmpty()) {
-      aState.mFrameManager->AppendFrames(aParentFrame, nsnull, inlineKids);
+      aState.mFrameManager->AppendFrames(aParentFrame,
+                                         nsIFrame::kPrincipalList,
+                                         inlineKids);
     }
 
     if (!aFrameList.IsEmpty()) {
       const nsStyleDisplay* parentDisplay = aParentFrame->GetStyleDisplay();
       PRBool positioned =
         parentDisplay->mPosition == NS_STYLE_POSITION_RELATIVE ||
         parentDisplay->HasTransform();
       nsFrameItems ibSiblings;
@@ -5734,17 +5740,19 @@ nsCSSFrameConstructor::AppendFrames(nsFr
       return AppendFrames(aState, aParentFrame->GetParent(), ibSiblings,
                           aParentFrame, PR_TRUE);
     }
 
     return NS_OK;
   }
   
   // Insert the frames after our aPrevSibling
-  return aState.mFrameManager->InsertFrames(aParentFrame, nsnull, aPrevSibling,
+  return aState.mFrameManager->InsertFrames(aParentFrame,
+                                            nsIFrame::kPrincipalList,
+                                            aPrevSibling,
                                             aFrameList);
 }
 
 #define UNSET_DISPLAY 255
 
 // This gets called to see if the frames corresponding to aSibling and aContent
 // should be siblings in the frame tree. Although (1) rows and cols, (2) row
 // groups and col groups, (3) row groups and captions, (4) legends and content
@@ -6665,17 +6673,17 @@ nsCSSFrameConstructor::ContentAppended(n
 
   // Notify the parent frame passing it the list of new frames
   // Append the flowed frames to the principal child list; captions
   // need special treatment
   if (captionItems.NotEmpty()) { // append the caption to the outer table
     NS_ASSERTION(nsGkAtoms::tableFrame == frameType, "how did that happen?");
     nsIFrame* outerTable = parentFrame->GetParent();
     if (outerTable) {
-      state.mFrameManager->AppendFrames(outerTable, nsGkAtoms::captionList,
+      state.mFrameManager->AppendFrames(outerTable, nsIFrame::kCaptionList,
                                         captionItems);
     }
   }
 
   if (frameItems.NotEmpty()) { // append the in-flow kids
     AppendFrames(state, parentFrame, frameItems, prevSibling);
   }
 
@@ -7060,17 +7068,17 @@ nsCSSFrameConstructor::ContentRangeInser
       container = parentFrame->GetContent();
       frameType = parentFrame->GetType();
     }
   }
 
   if (!prevSibling) {
     // We're inserting the new frames as the first child. See if the
     // parent has a :before pseudo-element
-    nsIFrame* firstChild = parentFrame->GetFirstChild(nsnull);
+    nsIFrame* firstChild = parentFrame->GetFirstPrincipalChild();
 
     if (firstChild &&
         nsLayoutUtils::IsGeneratedContentFor(container, firstChild,
                                              nsCSSPseudoElements::before)) {
       // Insert the new frames after the last continuation of the :before
       prevSibling = firstChild->GetTailContinuation();
       parentFrame = prevSibling->GetParent()->GetContentInsertionFrame();
       // Don't change isAppend here; we'll can call AppendFrames as needed, and
@@ -7250,31 +7258,35 @@ nsCSSFrameConstructor::ContentRangeInser
       // If the parent of our current prevSibling is different from the frame
       // we'll actually use as the parent, then the calculated insertion
       // point is now invalid (bug 341382).
       if (captionPrevSibling &&
           captionPrevSibling->GetParent() != outerTable) {
           captionPrevSibling = nsnull;
       }
       if (captionIsAppend) {
-        state.mFrameManager->AppendFrames(outerTable, nsGkAtoms::captionList,
+        state.mFrameManager->AppendFrames(outerTable,
+                                          nsIFrame::kCaptionList,
                                           captionItems);
       } else {
-        state.mFrameManager->InsertFrames(outerTable, nsGkAtoms::captionList,
+        state.mFrameManager->InsertFrames(outerTable,
+                                          nsIFrame::kCaptionList,
                                           captionPrevSibling, captionItems);
       }
     }
   }
 
   if (frameItems.NotEmpty()) {
     // Notify the parent frame
     if (isAppend) {
       AppendFrames(state, parentFrame, frameItems, prevSibling);
     } else {
-      state.mFrameManager->InsertFrames(parentFrame, nsnull, prevSibling,
+      state.mFrameManager->InsertFrames(parentFrame,
+                                        nsIFrame::kPrincipalList,
+                                        prevSibling,
                                         frameItems);
     }
   }
 
   if (haveFirstLetterStyle) {
     // Recover the letter frames for the containing block when
     // it has first-letter style.
     RecoverLetterFrames(state.mFloatedItems.containingBlock);
@@ -7356,17 +7368,17 @@ nsCSSFrameConstructor::ContentRemoved(ns
   // particular, having a null aContainer is necessary but NOT sufficient.  Due
   // to how we process reframes, the content node might not even be in our
   // document by now.  So explicitly check whether the viewport's first kid's
   // content node is aChild.
   PRBool isRoot = PR_FALSE;
   if (!aContainer) {
     nsIFrame* viewport = frameManager->GetRootFrame();
     if (viewport) {
-      nsIFrame* firstChild = viewport->GetFirstChild(nsnull);
+      nsIFrame* firstChild = viewport->GetFirstPrincipalChild();
       if (firstChild && firstChild->GetContent() == aChild) {
         isRoot = PR_TRUE;
         childFrame = firstChild;
         NS_ASSERTION(!childFrame->GetNextSibling(), "How did that happen?");
       }
     }
   }
 
@@ -7411,17 +7423,17 @@ nsCSSFrameConstructor::ContentRemoved(ns
 
     // Undo XUL wrapping if it's no longer needed.
     // (If we're in the XUL block-wrapping situation, parentFrame is the
     // wrapper frame.)
     nsIFrame* grandparentFrame = parentFrame->GetParent();
     if (grandparentFrame && grandparentFrame->IsBoxFrame() &&
         (grandparentFrame->GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
         // check if this frame is the only one needing wrapping
-        aChild == AnyKidsNeedBlockParent(parentFrame->GetFirstChild(nsnull)) &&
+        aChild == AnyKidsNeedBlockParent(parentFrame->GetFirstPrincipalChild()) &&
         !AnyKidsNeedBlockParent(childFrame->GetNextSibling())) {
       *aDidReconstruct = PR_TRUE;
       LAYOUT_PHASE_TEMP_EXIT();
       nsresult rv = RecreateFramesForContent(grandparentFrame->GetContent(), PR_TRUE);
       LAYOUT_PHASE_TEMP_REENTER();
       return rv;
     }
 
@@ -8314,33 +8326,33 @@ nsCSSFrameConstructor::CreateContinuingO
 
   if (newFrame) {
     newFrame->Init(aContent, aParentFrame, aFrame);
 
     // Create a continuing inner table frame, and if there's a caption then
     // replicate the caption
     nsFrameItems  newChildFrames;
 
-    nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);
+    nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
     if (childFrame) {
       nsIFrame* continuingTableFrame;
       nsresult rv = CreateContinuingFrame(aPresContext, childFrame, newFrame,
                                           &continuingTableFrame);
       if (NS_FAILED(rv)) {
         newFrame->Destroy();
         *aContinuingFrame = nsnull;
         return rv;
       }
       newChildFrames.AddChild(continuingTableFrame);
       
       NS_ASSERTION(!childFrame->GetNextSibling(),"there can be only one inner table frame");
     }
 
     // Set the outer table's initial child list
-    newFrame->SetInitialChildList(nsnull, newChildFrames);
+    newFrame->SetInitialChildList(nsIFrame::kPrincipalList, newChildFrames);
     
     *aContinuingFrame = newFrame;
     return NS_OK;
   }
   else {
     *aContinuingFrame = nsnull;
     return NS_ERROR_OUT_OF_MEMORY;
   }
@@ -8357,17 +8369,17 @@ nsCSSFrameConstructor::CreateContinuingT
 {
   nsIFrame* newFrame = NS_NewTableFrame(aPresShell, aStyleContext);
 
   if (newFrame) {
     newFrame->Init(aContent, aParentFrame, aFrame);
 
     // Replicate any header/footer frames
     nsFrameItems  childFrames;
-    nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);
+    nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
     for ( ; childFrame; childFrame = childFrame->GetNextSibling()) {
       // See if it's a header/footer, possibly wrapped in a scroll frame.
       nsTableRowGroupFrame* rowGroupFrame =
         static_cast<nsTableRowGroupFrame*>(childFrame);
       // If the row group was continued, then don't replicate it.
       nsIFrame* rgNextInFlow = rowGroupFrame->GetNextInFlow();
       if (rgNextInFlow) {
         rowGroupFrame->SetRepeatable(PR_FALSE);
@@ -8384,29 +8396,29 @@ nsCSSFrameConstructor::CreateContinuingT
         headerFooterFrame = static_cast<nsTableRowGroupFrame*>
                                        (NS_NewTableRowGroupFrame(aPresShell, rowGroupFrame->GetStyleContext()));
         nsIContent* headerFooter = rowGroupFrame->GetContent();
         headerFooterFrame->Init(headerFooter, newFrame, nsnull);
         ProcessChildren(state, headerFooter, rowGroupFrame->GetStyleContext(),
                         headerFooterFrame, PR_TRUE, childItems, PR_FALSE,
                         nsnull);
         NS_ASSERTION(state.mFloatedItems.IsEmpty(), "unexpected floated element");
-        headerFooterFrame->SetInitialChildList(nsnull, childItems);
+        headerFooterFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
         headerFooterFrame->SetRepeatable(PR_TRUE);
 
         // Table specific initialization
         headerFooterFrame->InitRepeatedFrame(aPresContext, rowGroupFrame);
 
         // XXX Deal with absolute and fixed frames...
         childFrames.AddChild(headerFooterFrame);
       }
     }
     
     // Set the table frame's initial child list
-    newFrame->SetInitialChildList(nsnull, childFrames);
+    newFrame->SetInitialChildList(nsIFrame::kPrincipalList, childFrames);
     
     *aContinuingFrame = newFrame;
     return NS_OK;
   }
   else {
     *aContinuingFrame = nsnull;
     return NS_ERROR_OUT_OF_MEMORY;
   }
@@ -8498,17 +8510,17 @@ nsCSSFrameConstructor::CreateContinuingF
   } else if (nsGkAtoms::tableRowFrame == frameType) {
     newFrame = NS_NewTableRowFrame(shell, styleContext);
 
     if (newFrame) {
       newFrame->Init(content, aParentFrame, aFrame);
 
       // Create a continuing frame for each table cell frame
       nsFrameItems  newChildList;
-      nsIFrame* cellFrame = aFrame->GetFirstChild(nsnull);
+      nsIFrame* cellFrame = aFrame->GetFirstPrincipalChild();
       while (cellFrame) {
         // See if it's a table cell frame
         if (IS_TABLE_CELL(cellFrame->GetType())) {
           nsIFrame* continuingCellFrame;
           rv = CreateContinuingFrame(aPresContext, cellFrame, newFrame,
                                      &continuingCellFrame);
           if (NS_FAILED(rv)) {
             newChildList.DestroyFrames();
@@ -8517,31 +8529,31 @@ nsCSSFrameConstructor::CreateContinuingF
             return NS_ERROR_OUT_OF_MEMORY;
           }
           newChildList.AddChild(continuingCellFrame);
         }
         cellFrame = cellFrame->GetNextSibling();
       }
       
       // Set the table cell's initial child list
-      newFrame->SetInitialChildList(nsnull, newChildList);
+      newFrame->SetInitialChildList(nsIFrame::kPrincipalList, newChildList);
     }
 
   } else if (IS_TABLE_CELL(frameType)) {
     // Warning: If you change this and add a wrapper frame around table cell
     // frames, make sure Bug 368554 doesn't regress!
     // See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
     newFrame = NS_NewTableCellFrame(shell, styleContext, IsBorderCollapse(aParentFrame));
 
     if (newFrame) {
       newFrame->Init(content, aParentFrame, aFrame);
 
       // Create a continuing area frame
       nsIFrame* continuingBlockFrame;
-      nsIFrame* blockFrame = aFrame->GetFirstChild(nsnull);
+      nsIFrame* blockFrame = aFrame->GetFirstPrincipalChild();
       rv = CreateContinuingFrame(aPresContext, blockFrame, newFrame,
                                  &continuingBlockFrame);
       if (NS_FAILED(rv)) {
         newFrame->Destroy();
         *aContinuingFrame = nsnull;
         return rv;
       }
 
@@ -8667,25 +8679,25 @@ nsCSSFrameConstructor::ReplicateFixedFra
   // Now deal with fixed-pos things....  They should appear on all pages,
   // so we want to move over the placeholders when processing the child
   // of the pageContentFrame.
 
   nsIFrame* prevPageContentFrame = aParentFrame->GetPrevInFlow();
   if (!prevPageContentFrame) {
     return NS_OK;
   }
-  nsIFrame* canvasFrame = aParentFrame->GetFirstChild(nsnull);
-  nsIFrame* prevCanvasFrame = prevPageContentFrame->GetFirstChild(nsnull);
+  nsIFrame* canvasFrame = aParentFrame->GetFirstPrincipalChild();
+  nsIFrame* prevCanvasFrame = prevPageContentFrame->GetFirstPrincipalChild();
   if (!canvasFrame || !prevCanvasFrame) {
     // document's root element frame missing
     return NS_ERROR_UNEXPECTED;
   }
 
   nsFrameItems fixedPlaceholders;
-  nsIFrame* firstFixed = prevPageContentFrame->GetFirstChild(nsGkAtoms::fixedList);
+  nsIFrame* firstFixed = prevPageContentFrame->GetFirstChild(nsIFrame::kFixedList);
   if (!firstFixed) {
     return NS_OK;
   }
 
   // Don't allow abs-pos descendants of the fixed content to escape the content.
   // This should not normally be possible (because fixed-pos elements should
   // be absolute containers) but fixed-pos tables currently aren't abs-pos
   // containers.
@@ -8726,19 +8738,19 @@ nsCSSFrameConstructor::ReplicateFixedFra
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
   }
 
   // Add the placeholders to our primary child list.
   // XXXbz this is a little screwed up, since the fixed frames will have 
   // broken auto-positioning. Oh, well.
-  NS_ASSERTION(!canvasFrame->GetFirstChild(nsnull),
+  NS_ASSERTION(!canvasFrame->GetFirstPrincipalChild(),
                "leaking frames; doc root continuation must be empty");
-  canvasFrame->SetInitialChildList(nsnull, fixedPlaceholders);
+  canvasFrame->SetInitialChildList(nsIFrame::kPrincipalList, fixedPlaceholders);
   return NS_OK;
 }
 
 nsresult
 nsCSSFrameConstructor::GetInsertionPoint(nsIFrame*     aParentFrame,
                                          nsIContent*   aChildContent,
                                          nsIFrame**    aInsertionPoint,
                                          PRBool*       aMultiple)
@@ -8849,17 +8861,17 @@ nsCSSFrameConstructor::MaybeRecreateFram
     }
   }
   return result;
 }
 
 static nsIFrame*
 FindFirstNonWhitespaceChild(nsIFrame* aParentFrame)
 {
-  nsIFrame* f = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* f = aParentFrame->GetFirstPrincipalChild();
   while (f && f->GetType() == nsGkAtoms::textFrame &&
          f->GetContent()->TextIsOnlyWhitespace()) {
     f = f->GetNextSibling();
   }
   return f;
 }
 
 static nsIFrame*
@@ -8914,20 +8926,20 @@ nsCSSFrameConstructor::MaybeRecreateCont
   NS_ASSERTION(inFlowFrame, "How did that happen?");
   nsIFrame* parent = inFlowFrame->GetParent();
   if (IsTablePseudo(parent)) {
     if (FindFirstNonWhitespaceChild(parent) == inFlowFrame ||
         !FindNextNonWhitespaceSibling(inFlowFrame->GetLastContinuation()) ||
         // If we're a table-column-group, then the GetFirstChild check above is
         // not going to catch cases when we're the first child.
         (inFlowFrame->GetType() == nsGkAtoms::tableColGroupFrame &&
-         parent->GetFirstChild(nsGkAtoms::colGroupList) == inFlowFrame) ||
+         parent->GetFirstChild(nsIFrame::kColGroupList) == inFlowFrame) ||
         // Similar if we're a table-caption.
         (inFlowFrame->GetType() == nsGkAtoms::tableCaptionFrame &&
-         parent->GetFirstChild(nsGkAtoms::captionList) == inFlowFrame)) {
+         parent->GetFirstChild(nsIFrame::kCaptionList) == inFlowFrame)) {
       // We're the first or last frame in the pseudo.  Need to reframe.
       // Good enough to recreate frames for |parent|'s content
       *aResult = RecreateFramesForContent(parent->GetContent(), PR_TRUE);
       return PR_TRUE;
     }
   }
 
   // Might need to reconstruct things if this frame's nextSibling is a table
@@ -8967,17 +8979,17 @@ nsCSSFrameConstructor::MaybeRecreateCont
   // special, since in that case the removal of aFrame might affect the
   // splitting of its parent.
   if (!IsFrameSpecial(parent)) {
     return PR_FALSE;
   }
 
   // If inFlowFrame is not the only in-flow child of |parent|, then removing
   // it will change nothing about the {ib} split.
-  if (inFlowFrame != parent->GetFirstChild(nsnull) ||
+  if (inFlowFrame != parent->GetFirstPrincipalChild() ||
       inFlowFrame->GetLastContinuation()->GetNextSibling()) {
     return PR_FALSE;
   }
 
   // If the parent is the first or last part of the {ib} split, then
   // removing one of its kids will have no effect on the splitting.
   // Get the first continuation up front so we don't have to do it twice.
   nsIFrame* parentFirstContinuation = parent->GetFirstContinuation();
@@ -9631,17 +9643,17 @@ nsCSSFrameConstructor::ProcessChildren(n
     // a real block placed here wouldn't get those set on it.
 
     InitAndRestoreFrame(aState, aContent, aFrame, nsnull,
                         blockFrame, PR_FALSE);
 
     NS_ASSERTION(!blockFrame->HasView(), "need to do view reparenting");
     ReparentFrames(aState.mFrameManager, blockFrame, aFrameItems);
 
-    blockFrame->SetInitialChildList(nsnull, aFrameItems);
+    blockFrame->SetInitialChildList(nsIFrame::kPrincipalList, aFrameItems);
     NS_ASSERTION(aFrameItems.IsEmpty(), "How did that happen?");
     aFrameItems.Clear();
     aFrameItems.AddChild(blockFrame);
 
     aFrame->AddStateBits(NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK);
   }
 
   return rv;
@@ -9708,21 +9720,23 @@ nsCSSFrameConstructor::WrapFramesInFirst
       NS_ASSERTION(aLineFrame->GetStyleContext() == firstLineStyle,
                    "Bogus style context on line frame");
     }
   }
 
   if (aLineFrame) {
     // Give the inline frames to the lineFrame <b>after</b> reparenting them
     ReparentFrames(aState.mFrameManager, aLineFrame, firstLineChildren);
-    if (aLineFrame->GetChildList(nsnull).IsEmpty() &&
+    if (aLineFrame->PrincipalChildList().IsEmpty() &&
         (aLineFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
-      aLineFrame->SetInitialChildList(nsnull, firstLineChildren);
+      aLineFrame->SetInitialChildList(nsIFrame::kPrincipalList, firstLineChildren);
     } else {
-      aState.mFrameManager->AppendFrames(aLineFrame, nsnull, firstLineChildren);
+      aState.mFrameManager->AppendFrames(aLineFrame,
+                                         nsIFrame::kPrincipalList,
+                                         firstLineChildren);
     }
   }
   else {
     rv = NS_ERROR_OUT_OF_MEMORY;
   }
 
   return rv;
 }
@@ -9734,17 +9748,17 @@ nsresult
 nsCSSFrameConstructor::AppendFirstLineFrames(
   nsFrameConstructorState& aState,
   nsIContent*              aBlockContent,
   nsIFrame*                aBlockFrame,
   nsFrameItems&            aFrameItems)
 {
   // It's possible that aBlockFrame needs to have a first-line frame
   // created because it doesn't currently have any children.
-  const nsFrameList& blockKids = aBlockFrame->GetChildList(nsnull);
+  const nsFrameList& blockKids = aBlockFrame->PrincipalChildList();
   if (blockKids.IsEmpty()) {
     return WrapFramesInFirstLineFrame(aState, aBlockContent,
                                       aBlockFrame, nsnull, aFrameItems);
   }
 
   // Examine the last block child - if it's a first-line frame then
   // appended frames need special treatment.
   nsIFrame* lastBlockKid = blockKids.LastChild();
@@ -9780,25 +9794,27 @@ nsCSSFrameConstructor::InsertFirstLineFr
 #if 0
   nsIFrame* parentFrame = *aParentFrame;
   nsIFrame* newFrame = aFrameItems.childList;
   PRBool isInline = IsInlineOutside(newFrame);
 
   if (!aPrevSibling) {
     // Insertion will become the first frame. Two cases: we either
     // already have a first-line frame or we don't.
-    nsIFrame* firstBlockKid = aBlockFrame->GetFirstChild(nsnull);
+    nsIFrame* firstBlockKid = aBlockFrame->GetFirstPrincipalChild();
     if (firstBlockKid->GetType() == nsGkAtoms::lineFrame) {
       // We already have a first-line frame
       nsIFrame* lineFrame = firstBlockKid;
 
       if (isInline) {
         // Easy case: the new inline frame will go into the lineFrame.
         ReparentFrame(aState.mFrameManager, lineFrame, newFrame);
-        aState.mFrameManager->InsertFrames(lineFrame, nsnull, nsnull,
+        aState.mFrameManager->InsertFrames(lineFrame,
+                                           nsIFrame::kPrincipalList,
+                                           nsnull,
                                            newFrame);
 
         // Since the frame is going into the lineFrame, don't let it
         // go into the block too.
         aFrameItems.childList = nsnull;
         aFrameItems.lastChild = nsnull;
       }
       else {
@@ -9834,17 +9850,17 @@ nsCSSFrameConstructor::InsertFirstLineFr
           aFrameItems.childList = lineFrame;
           aFrameItems.lastChild = lineFrame;
 
           // Give the inline frames to the lineFrame <b>after</b>
           // reparenting them
           NS_ASSERTION(lineFrame->GetStyleContext() == firstLineStyle,
                        "Bogus style context on line frame");
           ReparentFrame(aPresContext, lineFrame, newFrame);
-          lineFrame->SetInitialChildList(nsnull, newFrame);
+          lineFrame->SetInitialChildList(nsIFrame::kPrincipalList, newFrame);
         }
       }
       else {
         // Easy case: the regular insertion logic can insert the new
         // frame because it's a block frame.
       }
     }
   }
@@ -9885,24 +9901,25 @@ nsCSSFrameConstructor::InsertFirstLineFr
           }
 
           nsLineFrame* nextLineFrame = (nsLineFrame*) lineFrame;
           for (;;) {
             nextLineFrame = nextLineFrame->GetNextInFlow();
             if (!nextLineFrame) {
               break;
             }
-            nsIFrame* kids = nextLineFrame->GetFirstChild(nsnull);
+            nsIFrame* kids = nextLineFrame->GetFirstPrincipalChild();
           }
         }
         else {
           // We got lucky: aPrevSibling was the last inline frame in
           // the line-frame.
           ReparentFrame(aState.mFrameManager, aBlockFrame, newFrame);
-          aState.mFrameManager->InsertFrames(aBlockFrame, nsnull,
+          aState.mFrameManager->InsertFrames(aBlockFrame,
+                                             nsIFrame::kPrincipalList,
                                              prevSiblingParent, newFrame);
           aFrameItems.childList = nsnull;
           aFrameItems.lastChild = nsnull;
         }
       }
     }
   }
 
@@ -10174,20 +10191,20 @@ nsCSSFrameConstructor::WrapFramesInFirst
     if (parentFrame == aBlockFrame) {
       // Take textFrame out of the block's frame list and substitute the
       // letter frame(s) instead.
       aBlockFrames.DestroyFrame(textFrame);
       aBlockFrames.InsertFrames(nsnull, prevFrame, letterFrames);
     }
     else {
       // Take the old textFrame out of the inline parent's child list
-      mPresShell->FrameManager()->RemoveFrame(nsnull, textFrame);
+      mPresShell->FrameManager()->RemoveFrame(nsIFrame::kPrincipalList, textFrame);
 
       // Insert in the letter frame(s)
-      parentFrame->InsertFrames(nsnull, prevFrame, letterFrames);
+      parentFrame->InsertFrames(nsIFrame::kPrincipalList, prevFrame, letterFrames);
     }
   }
 
   return rv;
 }
 
 nsresult
 nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
@@ -10225,17 +10242,17 @@ nsCSSFrameConstructor::WrapFramesInFirst
         *aModifiedParent = aParentFrame;
         *aTextFrame = frame;
         *aPrevFrame = prevFrame;
         *aStopLooking = PR_TRUE;
         return NS_OK;
       }
     }
     else if (IsInlineFrame(frame) && frameType != nsGkAtoms::brFrame) {
-      nsIFrame* kids = frame->GetFirstChild(nsnull);
+      nsIFrame* kids = frame->GetFirstPrincipalChild();
       WrapFramesInFirstLetterFrame(aBlockFrame, aBlockContinuation, frame,
                                    kids, aModifiedParent, aTextFrame,
                                    aPrevFrame, aLetterFrames, aStopLooking);
       if (*aStopLooking) {
         return NS_OK;
       }
     }
     else {
@@ -10260,32 +10277,32 @@ nsresult
 nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
   nsPresContext* aPresContext,
   nsIPresShell* aPresShell,
   nsFrameManager* aFrameManager,
   nsIFrame* aBlockFrame,
   PRBool* aStopLooking)
 {
   // First look for the float frame that is a letter frame
-  nsIFrame* floatFrame = aBlockFrame->GetFirstChild(nsGkAtoms::floatList);
+  nsIFrame* floatFrame = aBlockFrame->GetFirstChild(nsIFrame::kFloatList);
   while (floatFrame) {
     // See if we found a floating letter frame
     if (nsGkAtoms::letterFrame == floatFrame->GetType()) {
       break;
     }
     floatFrame = floatFrame->GetNextSibling();
   }
   if (!floatFrame) {
     // No such frame
     return NS_OK;
   }
 
   // Take the text frame away from the letter frame (so it isn't
   // destroyed when we destroy the letter frame).
-  nsIFrame* textFrame = floatFrame->GetFirstChild(nsnull);
+  nsIFrame* textFrame = floatFrame->GetFirstPrincipalChild();
   if (!textFrame) {
     return NS_OK;
   }
 
   // Discover the placeholder frame for the letter frame
   nsIFrame* parentFrame;
   nsPlaceholderFrame* placeholderFrame = 
     aFrameManager->GetPlaceholderFrameFor(floatFrame);
@@ -10322,57 +10339,58 @@ nsCSSFrameConstructor::RemoveFloatingFir
   }
   newTextFrame->Init(textContent, parentFrame, nsnull);
 
   // Destroy the old text frame's continuations (the old text frame
   // will be destroyed when its letter frame is destroyed).
   nsIFrame* frameToDelete = textFrame->GetLastContinuation();
   while (frameToDelete != textFrame) {
     nsIFrame* nextFrameToDelete = frameToDelete->GetPrevContinuation();
-    aFrameManager->RemoveFrame(nsnull, frameToDelete);
+    aFrameManager->RemoveFrame(nsIFrame::kPrincipalList, frameToDelete);
     frameToDelete = nextFrameToDelete;
   }
 
   nsIFrame* prevSibling = placeholderFrame->GetPrevSibling();
 
   // Now that everything is set...
 #ifdef NOISY_FIRST_LETTER
   printf("RemoveFloatingFirstLetterFrames: textContent=%p oldTextFrame=%p newTextFrame=%p\n",
          textContent.get(), textFrame, newTextFrame);
 #endif
 
   // Remove placeholder frame and the float
-  aFrameManager->RemoveFrame(nsnull, placeholderFrame);
+  aFrameManager->RemoveFrame(nsIFrame::kPrincipalList, placeholderFrame);
 
   // Now that the old frames are gone, we can start pointing to our
   // new primary frame.
   textContent->SetPrimaryFrame(newTextFrame);
 
   // Insert text frame in its place
   nsFrameList textList(newTextFrame, newTextFrame);
-  aFrameManager->InsertFrames(parentFrame, nsnull, prevSibling, textList);
+  aFrameManager->InsertFrames(parentFrame, nsIFrame::kPrincipalList,
+                              prevSibling, textList);
 
   return NS_OK;
 }
 
 nsresult
 nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
                                                nsIPresShell* aPresShell,
                                                nsFrameManager* aFrameManager,
                                                nsIFrame* aFrame,
                                                nsIFrame* aBlockFrame,
                                                PRBool* aStopLooking)
 {
   nsIFrame* prevSibling = nsnull;
-  nsIFrame* kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame* kid = aFrame->GetFirstPrincipalChild();
 
   while (kid) {
     if (nsGkAtoms::letterFrame == kid->GetType()) {
       // Bingo. Found it. First steal away the text frame.
-      nsIFrame* textFrame = kid->GetFirstChild(nsnull);
+      nsIFrame* textFrame = kid->GetFirstPrincipalChild();
       if (!textFrame) {
         break;
       }
 
       // Create a new textframe
       nsStyleContext* parentSC = aFrame->GetStyleContext();
       if (!parentSC) {
         break;
@@ -10385,25 +10403,26 @@ nsCSSFrameConstructor::RemoveFirstLetter
       newSC = aPresShell->StyleSet()->ResolveStyleForNonElement(parentSC);
       if (!newSC) {
         break;
       }
       textFrame = NS_NewTextFrame(aPresShell, newSC);
       textFrame->Init(textContent, aFrame, nsnull);
 
       // Next rip out the kid and replace it with the text frame
-      aFrameManager->RemoveFrame(nsnull, kid);
+      aFrameManager->RemoveFrame(nsIFrame::kPrincipalList, kid);
 
       // Now that the old frames are gone, we can start pointing to our
       // new primary frame.
       textContent->SetPrimaryFrame(textFrame);
 
       // Insert text frame in its place
       nsFrameList textList(textFrame, textFrame);
-      aFrameManager->InsertFrames(aFrame, nsnull, prevSibling, textList);
+      aFrameManager->InsertFrames(aFrame, nsIFrame::kPrincipalList,
+                                  prevSibling, textList);
 
       *aStopLooking = PR_TRUE;
       NS_ASSERTION(!aBlockFrame->GetPrevContinuation(),
                    "should have the first continuation here");
       aBlockFrame->RemoveStateBits(NS_BLOCK_HAS_FIRST_LETTER_CHILD);
       break;
     }
     else if (IsInlineFrame(kid)) {
@@ -10460,34 +10479,34 @@ nsCSSFrameConstructor::RecoverLetterFram
   nsIFrame* prevFrame = nsnull;
   nsFrameItems letterFrames;
   PRBool stopLooking = PR_FALSE;
   nsresult rv;
   do {
     // XXX shouldn't this bit be set already (bug 408493), assert instead?
     continuation->AddStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE);
     rv = WrapFramesInFirstLetterFrame(aBlockFrame, continuation, continuation,
-                                      continuation->GetFirstChild(nsnull),
+                                      continuation->GetFirstPrincipalChild(),
                                       &parentFrame, &textFrame, &prevFrame,
                                       letterFrames, &stopLooking);
     if (NS_FAILED(rv)) {
       return rv;
     }
     if (stopLooking) {
       break;
     }
     continuation = continuation->GetNextContinuation();
   } while (continuation);
 
   if (parentFrame) {
     // Take the old textFrame out of the parents child list
-    mPresShell->FrameManager()->RemoveFrame(nsnull, textFrame);
+    mPresShell->FrameManager()->RemoveFrame(nsIFrame::kPrincipalList, textFrame);
 
     // Insert in the letter frame(s)
-    parentFrame->InsertFrames(nsnull, prevFrame, letterFrames);
+    parentFrame->InsertFrames(nsIFrame::kPrincipalList, prevFrame, letterFrames);
   }
   return rv;
 }
 
 //----------------------------------------------------------------------
 
 // listbox Widget Routines
 
@@ -10622,17 +10641,17 @@ nsCSSFrameConstructor::ConstructBlock(ns
   }
 
   // Process the child content
   nsFrameItems childItems;
   rv = ProcessChildren(aState, aContent, aStyleContext, blockFrame, PR_TRUE,
                        childItems, PR_TRUE, aPendingBinding);
 
   // Set the frame's initial child list
-  blockFrame->SetInitialChildList(nsnull, childItems);
+  blockFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
 
   return rv;
 }
 
 nsresult
 nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
                                        FrameConstructionItem&   aItem,
                                        nsIFrame*                aParentFrame,
@@ -10740,30 +10759,30 @@ nsCSSFrameConstructor::ConstructInline(n
 
   if (aItem.mIsAllInline || firstBlockEnumerator.AtEnd()) { 
     // This part is easy.  We either already know we have no non-inline kids,
     // or haven't found any when constructing actual frames (the latter can
     // happen only if out-of-flows that we thought had no containing block
     // acquired one when ancestor inline frames and {ib} splits got
     // constructed).  Just put all the kids into the single inline frame and
     // bail.
-    newFrame->SetInitialChildList(nsnull, childItems);
+    newFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
     if (NS_SUCCEEDED(rv)) {
       aState.AddChild(newFrame, aFrameItems, content, styleContext, aParentFrame);
       *aNewFrame = newFrame;
     }
     return rv;
   }
 
   // This inline frame contains several types of children. Therefore this frame
   // has to be chopped into several pieces, as described above.
 
   // Grab the first inline's kids
   nsFrameList firstInlineKids = childItems.ExtractHead(firstBlockEnumerator);
-  newFrame->SetInitialChildList(nsnull, firstInlineKids);
+  newFrame->SetInitialChildList(nsIFrame::kPrincipalList, firstInlineKids);
 
   aFrameItems.AddChild(newFrame);
 
   CreateIBSiblings(aState, newFrame, positioned, childItems, aFrameItems);
 
   *aNewFrame = newFrame;
   return NS_OK;
 }
@@ -11023,17 +11042,17 @@ nsCSSFrameConstructor::WipeContainingBlo
         if (iter == start) {
           // Leading whitespace.  How to handle this depends on our
           // previous sibling and aFrame.  See the long comment above.
           nsIFrame* prevSibling = aPrevSibling;
           if (!prevSibling) {
             // Try to find one after all
             nsIFrame* parentPrevCont = aFrame->GetPrevContinuation();
             while (parentPrevCont) {
-              prevSibling = parentPrevCont->GetLastChild(nsnull);
+              prevSibling = parentPrevCont->GetLastChild(nsIFrame::kPrincipalList);
               if (prevSibling) {
                 break;
               }
               parentPrevCont = parentPrevCont->GetPrevContinuation();
             }
           };
           if (prevSibling) {
             if (IsTablePseudo(prevSibling)) {
@@ -11055,17 +11074,17 @@ nsCSSFrameConstructor::WipeContainingBlo
           // Trailing whitespace.  How to handle this depeds on aIsAppend, our
           // next sibling and aFrame.  See the long comment above.
           okToDrop = aIsAppend && !nextSibling;
           if (!okToDrop) {
             if (!nextSibling) {
               // Try to find one after all
               nsIFrame* parentNextCont = aFrame->GetNextContinuation();
               while (parentNextCont) {
-                nextSibling = parentNextCont->GetFirstChild(nsnull);
+                nextSibling = parentNextCont->GetFirstPrincipalChild();
                 if (nextSibling) {
                   break;
                 }
                 parentNextCont = parentNextCont->GetNextContinuation();
               }
             }
 
             okToDrop = (nextSibling && !IsTablePseudo(nextSibling)) ||
@@ -11691,17 +11710,17 @@ nsCSSFrameConstructor::GenerateChildFram
     nsresult rv = ProcessChildren(state, aFrame->GetContent(), aFrame->GetStyleContext(),
                                   aFrame, PR_FALSE, childItems, PR_FALSE,
                                   nsnull);
     if (NS_FAILED(rv)) {
       EndUpdate();
       return rv;
     }
 
-    aFrame->SetInitialChildList(nsnull, childItems);
+    aFrame->SetInitialChildList(nsIFrame::kPrincipalList, childItems);
 
     EndUpdate();
   }
 
 #ifdef ACCESSIBILITY
   nsAccessibilityService* accService = nsIPresShell::AccService();
   if (accService) {
     nsIContent* container = aFrame->GetContent();
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -718,17 +718,17 @@ nsCSSRendering::PaintOutline(nsPresConte
   // the anonymous blocks.
   nsIFrame *frameForArea = aForFrame;
   do {
     nsIAtom *pseudoType = frameForArea->GetStyleContext()->GetPseudo();
     if (pseudoType != nsCSSAnonBoxes::mozAnonymousBlock &&
         pseudoType != nsCSSAnonBoxes::mozAnonymousPositionedBlock)
       break;
     // If we're done, we really want it and all its later siblings.
-    frameForArea = frameForArea->GetFirstChild(nsnull);
+    frameForArea = frameForArea->GetFirstPrincipalChild();
     NS_ASSERTION(frameForArea, "anonymous block with no children?");
   } while (frameForArea);
   nsRect innerRect; // relative to aBorderArea.TopLeft()
   if (frameForArea == aForFrame) {
     innerRect = GetOutlineInnerRect(aForFrame);
   } else {
     for (; frameForArea; frameForArea = frameForArea->GetNextSibling()) {
       // The outline has already been included in aForFrame's overflow
@@ -2566,17 +2566,17 @@ PrepareBackgroundLayer(nsPresContext* aP
     default:
       NS_ERROR("Unknown background-inline-policy value!  "
                "Please, teach me what to do.");
     case NS_STYLE_BG_INLINE_POLICY_CONTINUOUS:
       bgPositioningArea = gInlineBGData->GetContinuousRect(aForFrame);
       break;
     }
   } else if (frameType == nsGkAtoms::canvasFrame) {
-    geometryFrame = aForFrame->GetFirstChild(nsnull);
+    geometryFrame = aForFrame->GetFirstPrincipalChild();
     // geometryFrame might be null if this canvas is a page created
     // as an overflow container (e.g. the in-flow content has already
     // finished and this page only displays the continuations of
     // absolutely positioned content).
     if (geometryFrame) {
       bgPositioningArea = geometryFrame->GetRect();
     }
   } else {
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -93,17 +93,17 @@ CheckForTrailingTextFrameRecursive(nsIFr
 {
   if (aFrame == aStopAtFrame ||
       ((aFrame->GetType() == nsGkAtoms::textFrame &&
        (static_cast<nsTextFrame*>(aFrame))->IsAtEndOfLine())))
     return aFrame;
   if (!aFrame->IsFrameOfType(nsIFrame::eLineParticipant))
     return nsnull;
 
-  for (nsIFrame* f = aFrame->GetFirstChild(nsnull); f; f = f->GetNextSibling())
+  for (nsIFrame* f = aFrame->GetFirstPrincipalChild(); f; f = f->GetNextSibling())
   {
     nsIFrame* r = CheckForTrailingTextFrameRecursive(f, aStopAtFrame);
     if (r)
       return r;
   }
   return nsnull;
 }
 
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -101,17 +101,17 @@ nsDisplayListBuilder::nsDisplayListBuild
     if (selcon) {
       selcon->GetSelection(nsISelectionController::SELECTION_NORMAL,
                            getter_AddRefs(mBoundingSelection));
     }
   }
 
   if(mReferenceFrame->GetType() == nsGkAtoms::viewportFrame) {
     ViewportFrame* viewportFrame = static_cast<ViewportFrame*>(mReferenceFrame);
-    if (!viewportFrame->GetChildList(nsGkAtoms::fixedList).IsEmpty()) {
+    if (!viewportFrame->GetChildList(nsIFrame::kFixedList).IsEmpty()) {
       mHasFixedItems = PR_TRUE;
     }
   }
 
   LayerBuilder()->Init(this);
 
   PR_STATIC_ASSERT(nsDisplayItem::TYPE_MAX < (1 << nsDisplayItem::TYPE_BITS));
 }
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -18,17 +18,17 @@
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Dan Rosen <dr@netscape.com>
  *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -3778,17 +3778,17 @@ DocumentViewerImpl::PrintPreviewNavigate
   if (aType == nsIWebBrowserPrint::PRINTPREVIEW_END) {
     aType    = nsIWebBrowserPrint::PRINTPREVIEW_GOTO_PAGENUM;
     aPageNum = pageCount;
   }
 
   // Now, locate the current page we are on and
   // and the page of the page number
   nscoord gap = 0;
-  nsIFrame* pageFrame = seqFrame->GetFirstChild(nsnull);
+  nsIFrame* pageFrame = seqFrame->GetFirstPrincipalChild();
   while (pageFrame != nsnull) {
     nsRect pageRect = pageFrame->GetRect();
     if (pageNum == 1) {
       gap = pageRect.y;
     }
     if (pageRect.Contains(pageRect.x, pt.y)) {
       currentPage = pageFrame;
     }
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -468,30 +468,30 @@ nsFrameManager::ClearAllUndisplayedConte
     }
   }
 }
 
 //----------------------------------------------------------------------
 
 nsresult
 nsFrameManager::InsertFrames(nsIFrame*       aParentFrame,
-                             nsIAtom*        aListName,
+                             ChildListID     aListID,
                              nsIFrame*       aPrevFrame,
                              nsFrameList&    aFrameList)
 {
   NS_PRECONDITION(!aPrevFrame || (!aPrevFrame->GetNextContinuation()
                   || IS_TRUE_OVERFLOW_CONTAINER(aPrevFrame->GetNextContinuation()))
                   && !IS_TRUE_OVERFLOW_CONTAINER(aPrevFrame),
                   "aPrevFrame must be the last continuation in its chain!");
 
-  return aParentFrame->InsertFrames(aListName, aPrevFrame, aFrameList);
+  return aParentFrame->InsertFrames(aListID, aPrevFrame, aFrameList);
 }
 
 nsresult
-nsFrameManager::RemoveFrame(nsIAtom*        aListName,
+nsFrameManager::RemoveFrame(ChildListID     aListID,
                             nsIFrame*       aOldFrame)
 {
   PRBool wasDestroyingFrames = mIsDestroyingFrames;
   mIsDestroyingFrames = PR_TRUE;
 
   // In case the reflow doesn't invalidate anything since it just leaves
   // a gap where the old frame was, we invalidate it here.  (This is
   // reasonably likely to happen when removing a last child in a way
@@ -502,17 +502,17 @@ nsFrameManager::RemoveFrame(nsIAtom*    
 
   NS_ASSERTION(!aOldFrame->GetPrevContinuation() ||
                // exception for nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames
                aOldFrame->GetType() == nsGkAtoms::textFrame,
                "Must remove first continuation.");
   NS_ASSERTION(!(aOldFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW &&
                  GetPlaceholderFrameFor(aOldFrame)),
                "Must call RemoveFrame on placeholder for out-of-flows.");
-  nsresult rv = aOldFrame->GetParent()->RemoveFrame(aListName, aOldFrame);
+  nsresult rv = aOldFrame->GetParent()->RemoveFrame(aListID, aOldFrame);
 
   mIsDestroyingFrames = wasDestroyingFrames;
 
   return rv;
 }
 
 //----------------------------------------------------------------------
 
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -74,16 +74,17 @@ struct TreeMatchContext;
  * they're queued and processed later.
  *
  * Do not add virtual methods to this class, or bryner will punish you.
  */
 
 class nsFrameManager : public nsFrameManagerBase
 {
   typedef mozilla::css::RestyleTracker RestyleTracker;
+  typedef nsIFrame::ChildListID ChildListID;
 
 public:
   nsFrameManager() NS_HIDDEN;
   ~nsFrameManager() NS_HIDDEN;
 
   void* operator new(size_t aSize, nsIPresShell* aHost) {
     NS_ASSERTION(aSize == sizeof(nsFrameManager), "Unexpected subclass");
     NS_ASSERTION(aSize == sizeof(nsFrameManagerBase),
@@ -118,28 +119,28 @@ public:
   NS_HIDDEN_(void) ChangeUndisplayedContent(nsIContent* aContent,
                                             nsStyleContext* aStyleContext);
   NS_HIDDEN_(void) ClearUndisplayedContentIn(nsIContent* aContent,
                                              nsIContent* aParentContent);
   NS_HIDDEN_(void) ClearAllUndisplayedContentIn(nsIContent* aParentContent);
 
   // Functions for manipulating the frame model
   NS_HIDDEN_(nsresult) AppendFrames(nsIFrame*       aParentFrame,
-                                    nsIAtom*        aListName,
+                                    ChildListID     aListID,
                                     nsFrameList&    aFrameList)
   {
-    return aParentFrame->AppendFrames(aListName, aFrameList);
+    return aParentFrame->AppendFrames(aListID, aFrameList);
   }
 
   NS_HIDDEN_(nsresult) InsertFrames(nsIFrame*       aParentFrame,
-                                    nsIAtom*        aListName,
+                                    ChildListID     aListID,
                                     nsIFrame*       aPrevFrame,
                                     nsFrameList&    aFrameList);
 
-  NS_HIDDEN_(nsresult) RemoveFrame(nsIAtom*        aListName,
+  NS_HIDDEN_(nsresult) RemoveFrame(ChildListID     aListID,
                                    nsIFrame*       aOldFrame);
 
   /*
    * Notification that a frame is about to be destroyed. This allows any
    * outstanding references to the frame to be cleaned up.
    */
   NS_HIDDEN_(void)     NotifyDestroyingFrame(nsIFrame* aFrame);
 
--- a/layout/base/nsFrameTraversal.cpp
+++ b/layout/base/nsFrameTraversal.cpp
@@ -40,16 +40,18 @@
 #include "nsFrameTraversal.h"
 #include "nsFrameList.h"
 #include "nsPlaceholderFrame.h"
 
 
 class nsFrameIterator : public nsIFrameEnumerator
 {
 public:
+  typedef nsIFrame::ChildListID ChildListID;
+
   NS_DECL_ISUPPORTS
 
   virtual void First();
   virtual void Next();
   virtual nsIFrame* CurrentItem();
   virtual PRBool IsDone();
 
   virtual void Last();
@@ -479,22 +481,22 @@ nsFrameIterator::GetPrevSibling(nsIFrame
   if (mFollowOOFs && IsPopupFrame(result))
     result = GetPrevSibling(result);
 
   return result;
 }
 
 nsIFrame*
 nsFrameIterator::GetFirstChildInner(nsIFrame* aFrame) {
-  return aFrame->GetFirstChild(nsnull);
+  return aFrame->GetFirstPrincipalChild();
 }
 
 nsIFrame*
 nsFrameIterator::GetLastChildInner(nsIFrame* aFrame) {
-  return aFrame->GetChildList(nsnull).LastChild();
+  return aFrame->PrincipalChildList().LastChild();
 }
 
 nsIFrame*
 nsFrameIterator::GetNextSiblingInner(nsIFrame* aFrame) {
   return aFrame->GetNextSibling();
 }
 
 nsIFrame*
@@ -526,31 +528,31 @@ nsFrameIterator::IsPopupFrame(nsIFrame* 
   return (aFrame &&
           aFrame->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_POPUP);
 }
 
 // nsVisualIterator implementation
 
 nsIFrame*
 nsVisualIterator::GetFirstChildInner(nsIFrame* aFrame) {
-  return aFrame->GetChildList(nsnull).GetNextVisualFor(nsnull);
+  return aFrame->PrincipalChildList().GetNextVisualFor(nsnull);
 }
 
 nsIFrame*
 nsVisualIterator::GetLastChildInner(nsIFrame* aFrame) {
-  return aFrame->GetChildList(nsnull).GetPrevVisualFor(nsnull);
+  return aFrame->PrincipalChildList().GetPrevVisualFor(nsnull);
 }
 
 nsIFrame*
 nsVisualIterator::GetNextSiblingInner(nsIFrame* aFrame) {
   nsIFrame* parent = GetParentFrame(aFrame);
   if (!parent)
     return nsnull;
-  return parent->GetChildList(nsnull).GetNextVisualFor(aFrame);
+  return parent->PrincipalChildList().GetNextVisualFor(aFrame);
 }
 
 nsIFrame*
 nsVisualIterator::GetPrevSiblingInner(nsIFrame* aFrame) {
   nsIFrame* parent = GetParentFrame(aFrame);
   if (!parent)
     return nsnull;
-  return parent->GetChildList(nsnull).GetPrevVisualFor(aFrame);
+  return parent->PrincipalChildList().GetPrevVisualFor(aFrame);
 }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -218,17 +218,17 @@ nsLayoutUtils::GetDisplayPort(nsIContent
   return true;
 }
 
 nsIFrame*
 nsLayoutUtils::GetLastContinuationWithChild(nsIFrame* aFrame)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
   aFrame = aFrame->GetLastContinuation();
-  while (!aFrame->GetFirstChild(nsnull) &&
+  while (!aFrame->GetFirstPrincipalChild() &&
          aFrame->GetPrevContinuation()) {
     aFrame = aFrame->GetPrevContinuation();
   }
   return aFrame;
 }
 
 /**
  * GetFirstChildFrame returns the first "real" child frame of a
@@ -239,17 +239,17 @@ nsLayoutUtils::GetLastContinuationWithCh
  */
 static nsIFrame*
 GetFirstChildFrame(nsIFrame*       aFrame,
                    nsIContent*     aContent)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
 
   // Get the first child frame
-  nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
 
   // If the child frame is a pseudo-frame, then return its first child.
   // Note that the frame we create for the generated content is also a
   // pseudo-frame and so don't drill down in that case
   if (childFrame &&
       childFrame->IsPseudoFrame(aContent) &&
       !childFrame->IsGeneratedContentFrame()) {
     return GetFirstChildFrame(childFrame, aContent);
@@ -267,19 +267,20 @@ GetFirstChildFrame(nsIFrame*       aFram
  */
 static nsIFrame*
 GetLastChildFrame(nsIFrame*       aFrame,
                   nsIContent*     aContent)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
 
   // Get the last continuation frame that's a parent
-  nsIFrame* lastParentContinuation = nsLayoutUtils::GetLastContinuationWithChild(aFrame);
-
-  nsIFrame* lastChildFrame = lastParentContinuation->GetLastChild(nsnull);
+  nsIFrame* lastParentContinuation =
+    nsLayoutUtils::GetLastContinuationWithChild(aFrame);
+  nsIFrame* lastChildFrame =
+    lastParentContinuation->GetLastChild(nsIFrame::kPrincipalList);
   if (lastChildFrame) {
     // Get the frame's first continuation. This matters in case the frame has
     // been continued across multiple lines or split by BiDi resolution.
     lastChildFrame = lastChildFrame->GetFirstContinuation();
 
     // If the last child frame is a pseudo-frame, then return its last child.
     // Note that the frame we create for the generated content is also a
     // pseudo-frame and so don't drill down in that case
@@ -291,103 +292,105 @@ GetLastChildFrame(nsIFrame*       aFrame
 
     return lastChildFrame;
   }
 
   return nsnull;
 }
 
 //static
-nsIAtom*
+nsIFrame::ChildListID
 nsLayoutUtils::GetChildListNameFor(nsIFrame* aChildFrame)
 {
-  nsIAtom*      listName;
+  nsIFrame::ChildListID id = nsIFrame::kPrincipalList;
 
   if (aChildFrame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER) {
     nsIFrame* pif = aChildFrame->GetPrevInFlow();
     if (pif->GetParent() == aChildFrame->GetParent()) {
-      listName = nsGkAtoms::excessOverflowContainersList;
+      id = nsIFrame::kExcessOverflowContainersList;
     }
     else {
-      listName = nsGkAtoms::overflowContainersList;
+      id = nsIFrame::kOverflowContainersList;
     }
   }
   // See if the frame is moved out of the flow
   else if (aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
     // Look at the style information to tell
     const nsStyleDisplay* disp = aChildFrame->GetStyleDisplay();
 
     if (NS_STYLE_POSITION_ABSOLUTE == disp->mPosition) {
-      listName = nsGkAtoms::absoluteList;
+      id = nsIFrame::kAbsoluteList;
     } else if (NS_STYLE_POSITION_FIXED == disp->mPosition) {
       if (nsLayoutUtils::IsReallyFixedPos(aChildFrame)) {
-        listName = nsGkAtoms::fixedList;
+        id = nsIFrame::kFixedList;
       } else {
-        listName = nsGkAtoms::absoluteList;
+        id = nsIFrame::kAbsoluteList;
       }
 #ifdef MOZ_XUL
     } else if (NS_STYLE_DISPLAY_POPUP == disp->mDisplay) {
       // Out-of-flows that are DISPLAY_POPUP must be kids of the root popup set
 #ifdef DEBUG
       nsIFrame* parent = aChildFrame->GetParent();
       NS_ASSERTION(parent && parent->GetType() == nsGkAtoms::popupSetFrame,
                    "Unexpected parent");
 #endif // DEBUG
 
       // XXX FIXME: Bug 350740
       // Return here, because the postcondition for this function actually
       // fails for this case, since the popups are not in a "real" frame list
       // in the popup set.
-      return nsGkAtoms::popupList;
+      return nsIFrame::kPopupList;
 #endif // MOZ_XUL
     } else {
       NS_ASSERTION(aChildFrame->GetStyleDisplay()->IsFloating(),
                    "not a floated frame");
-      listName = nsGkAtoms::floatList;
+      id = nsIFrame::kFloatList;
     }
 
   } else {
     nsIAtom* childType = aChildFrame->GetType();
     if (nsGkAtoms::menuPopupFrame == childType) {
       nsIFrame* parent = aChildFrame->GetParent();
       nsIFrame* firstPopup = (parent)
-                             ? parent->GetFirstChild(nsGkAtoms::popupList)
+                             ? parent->GetFirstChild(nsIFrame::kPopupList)
                              : nsnull;
       NS_ASSERTION(!firstPopup || !firstPopup->GetNextSibling(),
                    "We assume popupList only has one child, but it has more.");
-      listName = firstPopup == aChildFrame ? nsGkAtoms::popupList : nsnull;
+      id = firstPopup == aChildFrame
+             ? nsIFrame::kPopupList
+             : nsIFrame::kPrincipalList;
     } else if (nsGkAtoms::tableColGroupFrame == childType) {
-      listName = nsGkAtoms::colGroupList;
+      id = nsIFrame::kColGroupList;
     } else if (nsGkAtoms::tableCaptionFrame == aChildFrame->GetType()) {
-      listName = nsGkAtoms::captionList;
+      id = nsIFrame::kCaptionList;
     } else {
-      listName = nsnull;
+      id = nsIFrame::kPrincipalList;
     }
   }
 
 #ifdef NS_DEBUG
   // Verify that the frame is actually in that child list or in the
   // corresponding overflow list.
   nsIFrame* parent = aChildFrame->GetParent();
-  PRBool found = parent->GetChildList(listName).ContainsFrame(aChildFrame);
+  PRBool found = parent->GetChildList(id).ContainsFrame(aChildFrame);
   if (!found) {
     if (!(aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
-      found = parent->GetChildList(nsGkAtoms::overflowList)
+      found = parent->GetChildList(nsIFrame::kOverflowList)
                 .ContainsFrame(aChildFrame);
     }
     else if (aChildFrame->GetStyleDisplay()->IsFloating()) {
-      found = parent->GetChildList(nsGkAtoms::overflowOutOfFlowList)
+      found = parent->GetChildList(nsIFrame::kOverflowOutOfFlowList)
                 .ContainsFrame(aChildFrame);
     }
-    // else it's positioned and should have been on the 'listName' child list.
+    // else it's positioned and should have been on the 'id' child list.
     NS_POSTCONDITION(found, "not in child list");
   }
 #endif
 
-  return listName;
+  return id;
 }
 
 // static
 nsIFrame*
 nsLayoutUtils::GetBeforeFrame(nsIFrame* aFrame)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
   NS_ASSERTION(!aFrame->GetPrevContinuation(),
@@ -431,17 +434,17 @@ nsLayoutUtils::GetClosestFrameOfType(nsI
   return nsnull;
 }
 
 // static
 nsIFrame*
 nsLayoutUtils::GetStyleFrame(nsIFrame* aFrame)
 {
   if (aFrame->GetType() == nsGkAtoms::tableOuterFrame) {
-    nsIFrame* inner = aFrame->GetFirstChild(nsnull);
+    nsIFrame* inner = aFrame->GetFirstPrincipalChild();
     NS_ASSERTION(inner, "Outer table must have an inner");
     return inner;
   }
 
   return aFrame;
 }
 
 nsIFrame*
@@ -1443,17 +1446,17 @@ GetNextPage(nsIFrame* aPageContentFrame)
   nsIFrame* pageFrame = aPageContentFrame->GetParent();
   NS_ASSERTION(pageFrame->GetType() == nsGkAtoms::pageFrame,
                "pageContentFrame has unexpected parent");
   nsIFrame* nextPageFrame = pageFrame->GetNextSibling();
   if (!nextPageFrame)
     return nsnull;
   NS_ASSERTION(nextPageFrame->GetType() == nsGkAtoms::pageFrame,
                "pageFrame's sibling is not a page frame...");
-  nsIFrame* f = nextPageFrame->GetFirstChild(nsnull);
+  nsIFrame* f = nextPageFrame->GetFirstPrincipalChild();
   NS_ASSERTION(f, "pageFrame has no page content frame!");
   NS_ASSERTION(f->GetType() == nsGkAtoms::pageContentFrame,
                "pageFrame's child is not page content!");
   return f;
 }
 
 nsresult
 nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame,
@@ -1794,26 +1797,26 @@ nsLayoutUtils::BinarySearchForPosition(n
 
 static void
 AddBoxesForFrame(nsIFrame* aFrame,
                  nsLayoutUtils::BoxCallback* aCallback)
 {
   nsIAtom* pseudoType = aFrame->GetStyleContext()->GetPseudo();
 
   if (pseudoType == nsCSSAnonBoxes::tableOuter) {
-    AddBoxesForFrame(aFrame->GetFirstChild(nsnull), aCallback);
-    nsIFrame* kid = aFrame->GetFirstChild(nsGkAtoms::captionList);
+    AddBoxesForFrame(aFrame->GetFirstPrincipalChild(), aCallback);
+    nsIFrame* kid = aFrame->GetFirstChild(nsIFrame::kCaptionList);
     if (kid) {
       AddBoxesForFrame(kid, aCallback);
     }
   } else if (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock ||
              pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
              pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
              pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
-    for (nsIFrame* kid = aFrame->GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) {
+    for (nsIFrame* kid = aFrame->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
       AddBoxesForFrame(kid, aCallback);
     }
   } else {
     aCallback->AddBox(aFrame);
   }
 }
 
 void
@@ -3068,17 +3071,17 @@ nsLayoutUtils::GetFirstLinePosition(cons
         *aResult = kidPosition + aFrame->GetUsedBorderAndPadding().top;
         return PR_TRUE;
       }
       return PR_FALSE;
     }
 
     if (fType == nsGkAtoms::fieldSetFrame) {
       LinePosition kidPosition;
-      nsIFrame* kid = aFrame->GetFirstChild(nsnull);
+      nsIFrame* kid = aFrame->GetFirstPrincipalChild();
       // kid might be a legend frame here, but that's ok.
       if (GetFirstLinePosition(kid, &kidPosition)) {
         *aResult = kidPosition + kid->GetPosition().y;
         return PR_TRUE;
       }
       return PR_FALSE;
     }
 
@@ -3749,17 +3752,17 @@ nsLayoutUtils::GetFrameTransparency(nsIF
     return transparency == nsITheme::eTransparent
          ? eTransparencyTransparent
          : eTransparencyOpaque;
 
   // We need an uninitialized window to be treated as opaque because
   // doing otherwise breaks window display effects on some platforms,
   // specifically Vista. (bug 450322)
   if (aBackgroundFrame->GetType() == nsGkAtoms::viewportFrame &&
-      !aBackgroundFrame->GetFirstChild(nsnull)) {
+      !aBackgroundFrame->GetFirstPrincipalChild()) {
     return eTransparencyOpaque;
   }
 
   nsStyleContext* bgSC;
   if (!nsCSSRendering::FindBackground(aBackgroundFrame->PresContext(),
                                       aBackgroundFrame, &bgSC)) {
     return eTransparencyTransparent;
   }
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -97,20 +97,20 @@ public:
   static nsIContent* FindContentFor(ViewID aId);
 
   /**
    * Get display port for the given element.
    */
   static bool GetDisplayPort(nsIContent* aContent, nsRect *aResult);
 
   /**
-   * Use heuristics to figure out the name of the child list that
+   * Use heuristics to figure out the child list that
    * aChildFrame is currently in.
    */
-  static nsIAtom* GetChildListNameFor(nsIFrame* aChildFrame);
+  static nsIFrame::ChildListID GetChildListNameFor(nsIFrame* aChildFrame);
 
   /**
    * GetBeforeFrame returns the outermost :before frame of the given frame, if
    * one exists.  This is typically O(1).  The frame passed in must be
    * the first-in-flow.
    *
    * @param aFrame the frame whose :before is wanted
    * @return the :before frame or nsnull if there isn't one
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -3354,17 +3354,17 @@ nsIPresShell::GetRootFrameExternal() con
 
 nsIFrame*
 nsIPresShell::GetRootScrollFrame() const
 {
   nsIFrame* rootFrame = FrameManager()->GetRootFrame();
   // Ensure root frame is a viewport frame
   if (!rootFrame || nsGkAtoms::viewportFrame != rootFrame->GetType())
     return nsnull;
-  nsIFrame* theFrame = rootFrame->GetFirstChild(nsnull);
+  nsIFrame* theFrame = rootFrame->GetFirstPrincipalChild();
   if (!theFrame || nsGkAtoms::scrollFrame != theFrame->GetType())
     return nsnull;
   return theFrame;
 }
 
 nsIScrollableFrame*
 nsIPresShell::GetRootScrollFrameAsScrollable() const
 {
@@ -6600,17 +6600,17 @@ PresShell::HandleEvent(nsIView         *
           NS_ASSERTION(capturingContent->GetCurrentDoc() == GetDocument(),
                        "Unexpected document");
           nsIFrame* captureFrame = capturingContent->GetPrimaryFrame();
           if (captureFrame) {
             if (capturingContent->Tag() == nsGkAtoms::select &&
                 capturingContent->IsHTML()) {
               // a dropdown <select> has a child in its selectPopupList and we should
               // capture on that instead.
-              nsIFrame* childFrame = captureFrame->GetChildList(nsGkAtoms::selectPopupList).FirstChild();
+              nsIFrame* childFrame = captureFrame->GetChildList(nsIFrame::kSelectPopupList).FirstChild();
               if (childFrame) {
                 captureFrame = childFrame;
               }
             }
 
             // scrollable frames should use the scrolling container as
             // the root instead of the document
             nsIScrollableFrame* scrollFrame = do_QueryFrame(captureFrame);
@@ -8463,17 +8463,17 @@ FindTopFrame(nsIFrame* aRoot)
       content->GetTag(tag);
       if (nsnull != tag) {
         NS_RELEASE(tag);
         return aRoot;
       }
     }
 
     // Try one of the children
-    nsIFrame* kid = aRoot->GetFirstChild(nsnull);
+    nsIFrame* kid = aRoot->GetFirstPrincipalChild();
     while (nsnull != kid) {
       nsIFrame* result = FindTopFrame(kid);
       if (nsnull != result) {
         return result;
       }
       kid = kid->GetNextSibling();
     }
   }
@@ -9097,17 +9097,17 @@ static void RecurseIndiTotals(nsPresCont
     char * name = ToNewCString(counter->mName);
     for (PRInt32 i=0;i<aLevel;i++) printf(" ");
     printf("%s - %p   [%d][", name, (void*)aParentFrame, counter->mCount);
     printf("%d", counter->mCounter.GetTotal());
     printf("]\n");
     nsMemory::Free(name);
   }
 
-  nsIFrame* child = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* child = aParentFrame->GetFirstPrincipalChild();
   while (child) {
     RecurseIndiTotals(aPresContext, aHT, child, aLevel+1);
     child = child->GetNextSibling();
   }
 
 }
 
 //------------------------------------------------------------------
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -16,17 +16,17 @@
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Pierre Phaneuf <pp@ludusdesign.com>
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -1199,17 +1199,17 @@ nsComboboxControlFrame::CreateFrameFor(n
     mDisplayFrame = nsnull;
     textFrame->Destroy();
     textFrame = nsnull;
     return nsnull;
   }
   mDisplayContent->SetPrimaryFrame(textFrame);
 
   nsFrameList textList(textFrame, textFrame);
-  mDisplayFrame->SetInitialChildList(nsnull, textList);
+  mDisplayFrame->SetInitialChildList(kPrincipalList, textList);
   return mDisplayFrame;
 }
 
 void
 nsComboboxControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   // Revoke any pending RedisplayTextEvent
   mRedisplayTextEvent.Revoke();
@@ -1249,33 +1249,33 @@ nsComboboxControlFrame::GetChildList(Chi
 void
 nsComboboxControlFrame::GetChildLists(nsTArray<ChildList>* aLists) const
 {
   nsBlockFrame::GetChildLists(aLists);
   mPopupFrames.AppendIfNonempty(aLists, kSelectPopupList);
 }
 
 NS_IMETHODIMP
-nsComboboxControlFrame::SetInitialChildList(nsIAtom*        aListName,
+nsComboboxControlFrame::SetInitialChildList(ChildListID     aListID,
                                             nsFrameList&    aChildList)
 {
   nsresult rv = NS_OK;
-  if (nsGkAtoms::selectPopupList == aListName) {
+  if (kSelectPopupList == aListID) {
     mPopupFrames.SetFrames(aChildList);
   } else {
     for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
       nsCOMPtr<nsIFormControl> formControl =
         do_QueryInterface(e.get()->GetContent());
       if (formControl && formControl->GetType() == NS_FORM_BUTTON_BUTTON) {
         mButtonFrame = e.get();
         break;
       }
     }
     NS_ASSERTION(mButtonFrame, "missing button frame in initial child list");
-    rv = nsBlockFrame::SetInitialChildList(aListName, aChildList);
+    rv = nsBlockFrame::SetInitialChildList(aListID, aChildList);
   }
   return rv;
 }
 
 //----------------------------------------------------------------------
   //nsIRollupListener
 //----------------------------------------------------------------------
 NS_IMETHODIMP 
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -16,17 +16,17 @@
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Dean Tessman <dean_tessman@hotmail.com>
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -68,22 +68,16 @@
 #include "nsIDOMEventListener.h"
 #include "nsThreadUtils.h"
 
 class nsIView;
 class nsStyleContext;
 class nsIListControlFrame;
 class nsComboboxDisplayFrame;
 
-/**
- * Child list name indices
- * @see #GetAdditionalChildListName()
- */
-#define NS_COMBO_LIST_COUNT   (NS_BLOCK_LIST_COUNT + 1)
-
 class nsComboboxControlFrame : public nsBlockFrame,
                                public nsIFormControlFrame,
                                public nsIComboboxControlFrame,
                                public nsIAnonymousContentCreator,
                                public nsISelectControlFrame,
                                public nsIRollupListener,
                                public nsIStatefulFrame
 {
@@ -140,20 +134,20 @@ public:
   virtual nsIScrollableFrame* GetScrollTargetFrame() {
     return do_QueryFrame(mDropdownFrame);
   }
 
 #ifdef NS_DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
+  virtual nsFrameList GetChildList(ChildListID aListID) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
   virtual nsIFrame* GetContentInsertionFrame();
 
   // nsIFormControlFrame
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const; 
   /**
    * Inform the control that it got (or lost) focus.
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -66,17 +66,17 @@
 class nsLegendFrame;
 
 class nsFieldSetFrame : public nsHTMLContainerFrame {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   nsFieldSetFrame(nsStyleContext* aContext);
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*       aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID    aListID,
                                  nsFrameList&   aChildList);
 
   NS_HIDDEN_(nscoord)
     GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
                       nsLayoutUtils::IntrinsicWidthType);
   virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
   virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext);
   virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
@@ -92,22 +92,22 @@ public:
                                
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   void PaintBorderBackground(nsRenderingContext& aRenderingContext,
     nsPoint aPt, const nsRect& aDirtyRect, PRUint32 aBGFlags);
 
-  NS_IMETHOD AppendFrames(nsIAtom*       aListName,
+  NS_IMETHOD AppendFrames(ChildListID    aListID,
                           nsFrameList&   aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*       aListName,
+  NS_IMETHOD InsertFrames(ChildListID    aListID,
                           nsIFrame*      aPrevFrame,
                           nsFrameList&   aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*       aListName,
+  NS_IMETHOD RemoveFrame(ChildListID    aListID,
                          nsIFrame*      aOldFrame);
 
   virtual nsIAtom* GetType() const;
   virtual PRBool IsContainingBlock() const;
 
 #ifdef ACCESSIBILITY  
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
@@ -153,31 +153,31 @@ nsFieldSetFrame::GetType() const
 
 PRBool
 nsFieldSetFrame::IsContainingBlock() const
 {
   return PR_TRUE;
 }
 
 NS_IMETHODIMP
-nsFieldSetFrame::SetInitialChildList(nsIAtom*       aListName,
+nsFieldSetFrame::SetInitialChildList(ChildListID    aListID,
                                      nsFrameList&   aChildList)
 {
   // Get the content and legend frames.
   if (!aChildList.OnlyChild()) {
     NS_ASSERTION(aChildList.GetLength() == 2, "Unexpected child list");
     mContentFrame = aChildList.LastChild();
     mLegendFrame  = aChildList.FirstChild();
   } else {
     mContentFrame = aChildList.FirstChild();
     mLegendFrame  = nsnull;
   }
 
   // Queue up the frames for the content frame
-  return nsHTMLContainerFrame::SetInitialChildList(nsnull, aChildList);
+  return nsHTMLContainerFrame::SetInitialChildList(kPrincipalList, aChildList);
 }
 
 class nsDisplayFieldSetBorderBackground : public nsDisplayItem {
 public:
   nsDisplayFieldSetBorderBackground(nsDisplayListBuilder* aBuilder,
                                     nsFieldSetFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayFieldSetBorderBackground);
@@ -613,48 +613,48 @@ nsFieldSetFrame::Reflow(nsPresContext*  
 
 PRIntn
 nsFieldSetFrame::GetSkipSides() const
 {
   return 0;
 }
 
 NS_IMETHODIMP
-nsFieldSetFrame::AppendFrames(nsIAtom*       aListName,
+nsFieldSetFrame::AppendFrames(ChildListID    aListID,
                               nsFrameList&   aFrameList)
 {
   // aFrameList is not allowed to contain "the legend" for this fieldset
   ReparentFrameList(aFrameList);
-  return mContentFrame->AppendFrames(aListName, aFrameList);
+  return mContentFrame->AppendFrames(aListID, aFrameList);
 }
 
 NS_IMETHODIMP
-nsFieldSetFrame::InsertFrames(nsIAtom*       aListName,
+nsFieldSetFrame::InsertFrames(ChildListID    aListID,
                               nsIFrame*      aPrevFrame,
                               nsFrameList&   aFrameList)
 {
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this ||
                aPrevFrame->GetParent() == mContentFrame,
                "inserting after sibling frame with different parent");
 
   // aFrameList is not allowed to contain "the legend" for this fieldset
   ReparentFrameList(aFrameList);
   if (NS_UNLIKELY(aPrevFrame == mLegendFrame)) {
     aPrevFrame = nsnull;
   }
-  return mContentFrame->InsertFrames(aListName, aPrevFrame, aFrameList);
+  return mContentFrame->InsertFrames(aListID, aPrevFrame, aFrameList);
 }
 
 NS_IMETHODIMP
-nsFieldSetFrame::RemoveFrame(nsIAtom*       aListName,
+nsFieldSetFrame::RemoveFrame(ChildListID    aListID,
                              nsIFrame*      aOldFrame)
 {
   // For reference, see bug 70648, bug 276104 and bug 236071.
   NS_ASSERTION(aOldFrame != mLegendFrame, "Cannot remove mLegendFrame here");
-  return mContentFrame->RemoveFrame(aListName, aOldFrame);
+  return mContentFrame->RemoveFrame(aListID, aOldFrame);
 }
 
 #ifdef ACCESSIBILITY
 already_AddRefed<nsAccessible>
 nsFieldSetFrame::CreateAccessible()
 {
   nsAccessibilityService* accService = nsIPresShell::AccService();
   if (accService) {
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -15,17 +15,17 @@
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *   Geoff Lankow <geoff@darktrojan.net>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
@@ -615,17 +615,17 @@ NS_IMETHODIMP nsFileControlFrame::Reflow
 }
 
 nsNewFrame*
 nsFileControlFrame::GetTextControlFrame(nsPresContext* aPresContext, nsIFrame* aStart)
 {
   nsNewFrame* result = nsnull;
 #ifndef DEBUG_NEWFRAME
   // find the text control frame.
-  nsIFrame* childFrame = aStart->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aStart->GetFirstPrincipalChild();
 
   while (childFrame) {
     // see if the child is a text control
     nsCOMPtr<nsIFormControl> formCtrl =
       do_QueryInterface(childFrame->GetContent());
 
     if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_TEXT) {
       result = (nsNewFrame*)childFrame;
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -399,31 +399,31 @@ nsHTMLButtonControlFrame::GetAdditionalS
 void
 nsHTMLButtonControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, 
                                                     nsStyleContext* aStyleContext)
 {
   mRenderer.SetStyleContext(aIndex, aStyleContext);
 }
 
 NS_IMETHODIMP 
-nsHTMLButtonControlFrame::AppendFrames(nsIAtom*        aListName,
+nsHTMLButtonControlFrame::AppendFrames(ChildListID     aListID,
                                        nsFrameList&    aFrameList)
 {
   NS_NOTREACHED("unsupported operation");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-nsHTMLButtonControlFrame::InsertFrames(nsIAtom*        aListName,
+nsHTMLButtonControlFrame::InsertFrames(ChildListID     aListID,
                                        nsIFrame*       aPrevFrame,
                                        nsFrameList&    aFrameList)
 {
   NS_NOTREACHED("unsupported operation");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-nsHTMLButtonControlFrame::RemoveFrame(nsIAtom*        aListName,
+nsHTMLButtonControlFrame::RemoveFrame(ChildListID     aListID,
                                       nsIFrame*       aOldFrame)
 {
   NS_NOTREACHED("unsupported operation");
   return NS_ERROR_UNEXPECTED;
 }
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -88,24 +88,24 @@ public:
   NS_IMETHOD  Init(nsIContent*      aContent,
                    nsIFrame*        aParent,
                    nsIFrame*        asPrevInFlow);
 
   virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const;
   virtual void SetAdditionalStyleContext(PRInt32 aIndex, 
                                          nsStyleContext* aStyleContext);
  
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
 
   virtual nsIAtom* GetType() const;
   
@@ -119,17 +119,17 @@ public:
 
   // nsIFormControlFrame
   void SetFocus(PRBool aOn, PRBool aRepaint);
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const; 
 
   // Inserted child content gets its frames parented by our child block
   virtual nsIFrame* GetContentInsertionFrame() {
-    return GetFirstChild(nsnull)->GetContentInsertionFrame();
+    return GetFirstPrincipalChild()->GetContentInsertionFrame();
   }
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     return nsHTMLContainerFrame::IsFrameOfType(aFlags &
       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
   }
 
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -299,17 +299,17 @@ void nsListControlFrame::PaintFocus(nsRe
     // if we found a node use it, if not get the first child (this is for empty selects)
     if (node) {
       focusedContent = do_QueryInterface(node);
       childframe = focusedContent->GetPrimaryFrame();
     }
     if (!childframe) {
       // Failing all else, try the first thing we have, but only if
       // it's an element.  Text frames need not apply.
-      childframe = containerFrame->GetFirstChild(nsnull);
+      childframe = containerFrame->GetFirstPrincipalChild();
       if (childframe && !childframe->GetContent()->IsElement()) {
         childframe = nsnull;
       }
       result = NS_OK;
     }
   }
 
   nsRect fRect;
@@ -382,17 +382,17 @@ nsListControlFrame::CreateAccessible()
   return nsnull;
 }
 #endif
 
 static nscoord
 GetMaxOptionHeight(nsIFrame* aContainer)
 {
   nscoord result = 0;
-  for (nsIFrame* option = aContainer->GetFirstChild(nsnull);
+  for (nsIFrame* option = aContainer->GetFirstPrincipalChild();
        option; option = option->GetNextSibling()) {
     nscoord optionHeight;
     if (nsCOMPtr<nsIDOMHTMLOptGroupElement>
         (do_QueryInterface(option->GetContent()))) {
       // an optgroup
       optionHeight = GetMaxOptionHeight(option);
     } else {
       // an option
@@ -1027,26 +1027,26 @@ nsListControlFrame::HandleEvent(nsPresCo
     return NS_OK;
 
   return nsHTMLScrollFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
 }
 
 
 //---------------------------------------------------------
 NS_IMETHODIMP
-nsListControlFrame::SetInitialChildList(nsIAtom*       aListName,
+nsListControlFrame::SetInitialChildList(ChildListID    aListID,
                                         nsFrameList&   aChildList)
 {
   // First check to see if all the content has been added
   mIsAllContentHere = mContent->IsDoneAddingChildren();
   if (!mIsAllContentHere) {
     mIsAllFramesHere    = PR_FALSE;
     mHasBeenInitialized = PR_FALSE;
   }
-  nsresult rv = nsHTMLScrollFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsHTMLScrollFrame::SetInitialChildList(aListID, aChildList);
 
   // If all the content is here now check
   // to see if all the frames have been created
   /*if (mIsAllContentHere) {
     // If all content and frames are here
     // the reset/initialize
     if (CheckIfAllFramesHere()) {
       ResetList(aPresContext);
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -15,17 +15,17 @@
  * The Original Code is Mozilla Communicator client code.
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -80,17 +80,17 @@ public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
     // nsIFrame
   NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
                          nsGUIEvent* aEvent,
                          nsEventStatus* aEventStatus);
   
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
 
   NS_IMETHOD Reflow(nsPresContext*          aCX,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -263,17 +263,17 @@ nsTextControlFrame::CalcIntrinsicSize(ns
     if (PresContext()->CompatibilityMode() == eCompatibility_FullStandards) {
       aIntrinsicSize.width += 1;
     }
 
     // Also add in the padding of our value div child.  Note that it hasn't
     // been reflowed yet, so we can't get its used padding, but it shouldn't be
     // using percentage padding anyway.
     nsMargin childPadding;
-    nsIFrame* firstChild = GetFirstChild(nsnull);
+    nsIFrame* firstChild = GetFirstPrincipalChild();
     if (firstChild && firstChild->GetStylePadding()->GetPadding(childPadding)) {
       aIntrinsicSize.width += childPadding.LeftRight();
     } else {
       NS_ERROR("Percentage padding on value div?");
     }
   }
 
   // Increment width with cols * letter-spacing.
@@ -288,17 +288,17 @@ nsTextControlFrame::CalcIntrinsicSize(ns
   }
 
   // Set the height equal to total number of rows (times the height of each
   // line, of course)
   aIntrinsicSize.height = lineHeight * GetRows();
 
   // Add in the size of the scrollbars for textarea
   if (IsTextArea()) {
-    nsIFrame* first = GetFirstChild(nsnull);
+    nsIFrame* first = GetFirstPrincipalChild();
 
     nsIScrollableFrame *scrollableFrame = do_QueryFrame(first);
     NS_ASSERTION(scrollableFrame, "Child must be scrollable");
 
     if (scrollableFrame) {
       nsMargin scrollbarSizes =
       scrollableFrame->GetDesiredScrollbarSizes(PresContext(), aRenderingContext);
 
@@ -1411,22 +1411,22 @@ nsTextControlFrame::CheckFireOnChange()
                                          PR_FALSE);
   }
   return NS_OK;
 }
 
 // END IMPLEMENTING NS_IFORMCONTROLFRAME
 
 NS_IMETHODIMP
-nsTextControlFrame::SetInitialChildList(nsIAtom*        aListName,
+nsTextControlFrame::SetInitialChildList(ChildListID     aListID,
                                         nsFrameList&    aChildList)
 {
-  nsresult rv = nsBoxFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsBoxFrame::SetInitialChildList(aListID, aChildList);
 
-  nsIFrame* first = GetFirstChild(nsnull);
+  nsIFrame* first = GetFirstPrincipalChild();
 
   // Mark the scroll frame as being a reflow root. This will allow
   // incremental reflows to be initiated at the scroll frame, rather
   // than descending from the root frame of the frame hierarchy.
   if (first) {
     first->AddStateBits(NS_FRAME_REFLOW_ROOT);
 
     nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -72,17 +72,17 @@ public:
   nsTextControlFrame(nsIPresShell* aShell, nsStyleContext* aContext);
   virtual ~nsTextControlFrame();
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
   virtual nsIScrollableFrame* GetScrollTargetFrame() {
     if (!IsScrollable())
       return nsnull;
-    return do_QueryFrame(GetFirstChild(nsnull));
+    return do_QueryFrame(GetFirstPrincipalChild());
   }
 
   virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
   virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
@@ -123,17 +123,17 @@ public:
 
   // nsIAnonymousContentCreator
   virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
   virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
                                         PRUint32 aFilter);
 
   // Utility methods to set current widget state
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
 //==== BEGIN NSIFORMCONTROLFRAME
   virtual void SetFocus(PRBool aOn , PRBool aRepaint); 
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const; 
 
 
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -335,17 +335,17 @@ TextOverflow::ExamineFrameSubtree(nsIFra
       AnalyzeMarkerEdges(aFrame, frameType, aInsideMarkersArea,
                          aFramesToHide, aAlignmentEdges);
     }
   }
   if (isAtomic) {
     return;
   }
 
-  nsIFrame* child = aFrame->GetFirstChild(nsnull);
+  nsIFrame* child = aFrame->GetFirstPrincipalChild();
   while (child) {
     ExamineFrameSubtree(child, aContentArea, aInsideMarkersArea,
                         aFramesToHide, aAlignmentEdges);
     child = child->GetNextSibling();
   }
 }
 
 void
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -51,33 +51,33 @@
 #include "nsCSSFrameConstructor.h"
 
 #ifdef DEBUG
 #include "nsBlockFrame.h"
 #endif
 
 nsresult
 nsAbsoluteContainingBlock::SetInitialChildList(nsIFrame*       aDelegatingFrame,
-                                               nsIAtom*        aListName,
+                                               ChildListID     aListID,
                                                nsFrameList&    aChildList)
 {
-  NS_PRECONDITION(GetChildListName() == aListName, "unexpected child list name");
+  NS_PRECONDITION(GetChildListID() == aListID, "unexpected child list name");
 #ifdef NS_DEBUG
   nsFrame::VerifyDirtyBitSet(aChildList);
 #endif
   mAbsoluteFrames.SetFrames(aChildList);
   return NS_OK;
 }
 
 nsresult
 nsAbsoluteContainingBlock::AppendFrames(nsIFrame*      aDelegatingFrame,
-                                        nsIAtom*       aListName,
+                                        ChildListID    aListID,
                                         nsFrameList&   aFrameList)
 {
-  NS_ASSERTION(GetChildListName() == aListName, "unexpected child list");
+  NS_ASSERTION(GetChildListID() == aListID, "unexpected child list");
 
   // Append the frames to our list of absolutely positioned frames
 #ifdef NS_DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mAbsoluteFrames.AppendFrames(nsnull, aFrameList);
 
   // no damage to intrinsic widths, since absolutely positioned frames can't
@@ -86,21 +86,21 @@ nsAbsoluteContainingBlock::AppendFrames(
     FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize,
                      NS_FRAME_HAS_DIRTY_CHILDREN);
 
   return NS_OK;
 }
 
 nsresult
 nsAbsoluteContainingBlock::InsertFrames(nsIFrame*      aDelegatingFrame,
-                                        nsIAtom*       aListName,
+                                        ChildListID    aListID,
                                         nsIFrame*      aPrevFrame,
                                         nsFrameList&   aFrameList)
 {
-  NS_ASSERTION(GetChildListName() == aListName, "unexpected child list");
+  NS_ASSERTION(GetChildListID() == aListID, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == aDelegatingFrame,
                "inserting after sibling frame with different parent");
 
 #ifdef NS_DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mAbsoluteFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
 
@@ -110,20 +110,20 @@ nsAbsoluteContainingBlock::InsertFrames(
     FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize,
                      NS_FRAME_HAS_DIRTY_CHILDREN);
 
   return NS_OK;
 }
 
 void
 nsAbsoluteContainingBlock::RemoveFrame(nsIFrame*       aDelegatingFrame,
-                                       nsIAtom*        aListName,
+                                       ChildListID     aListID,
                                        nsIFrame*       aOldFrame)
 {
-  NS_ASSERTION(GetChildListName() == aListName, "unexpected child list");
+  NS_ASSERTION(GetChildListID() == aListID, "unexpected child list");
   nsIFrame* nif = aOldFrame->GetNextInFlow();
   if (nif) {
     static_cast<nsContainerFrame*>(nif->GetParent())
       ->DeleteNextInFlowChild(aOldFrame->PresContext(), nif, PR_FALSE);
   }
 
   mAbsoluteFrames.DestroyFrame(aOldFrame);
 }
@@ -356,17 +356,17 @@ nsAbsoluteContainingBlock::DoMarkFramesD
   }
 }
 
 // XXX Optimize the case where it's a resize reflow and the absolutely
 // positioned child has the exact same size and position and skip the
 // reflow...
 
 // When bug 154892 is checked in, make sure that when 
-// GetChildListName() == nsGkAtoms::fixedList, the height is unconstrained.
+// GetChildListID() == kFixedList, the height is unconstrained.
 // since we don't allow replicated frames to split.
 
 nsresult
 nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame*                aDelegatingFrame,
                                                nsPresContext*          aPresContext,
                                                const nsHTMLReflowState& aReflowState,
                                                nscoord                  aContainingBlockWidth,
                                                nscoord                  aContainingBlockHeight,
--- a/layout/generic/nsAbsoluteContainingBlock.h
+++ b/layout/generic/nsAbsoluteContainingBlock.h
@@ -55,60 +55,61 @@ class nsPresContext;
 /**
  * This class contains the logic for being an absolute containing block.  This
  * class is used within viewport frames (for frames representing content with
  * fixed position) and blocks (for frames representing absolutely positioned
  * content), since each set of frames is absolutely positioned with respect to
  * its parent.
  *
  * There is no principal child list, just a named child list which contains
- * the absolutely positioned frames.
+ * the absolutely positioned frames (kAbsoluteList or kFixedList).
  *
  * All functions include as the first argument the frame that is delegating
  * the request.
  *
- * @see nsGkAtoms::absoluteList and nsGkAtoms::fixedList
  */
 class nsAbsoluteContainingBlock
 {
 public:
-  nsAbsoluteContainingBlock(nsIAtom* aChildListName)
+  typedef nsIFrame::ChildListID ChildListID;
+
+  nsAbsoluteContainingBlock(ChildListID aChildListID)
 #ifdef DEBUG
-    : mChildListName(aChildListName)
+    : mChildListID(aChildListID)
 #endif
   {
-    NS_ASSERTION(mChildListName == nsGkAtoms::absoluteList ||
-                 mChildListName == nsGkAtoms::fixedList,
+    NS_ASSERTION(mChildListID == nsIFrame::kAbsoluteList ||
+                 mChildListID == nsIFrame::kFixedList,
                  "should either represent position:fixed or absolute content");
   }
 
 #ifdef DEBUG
-  nsIAtom* GetChildListName() const { return mChildListName; }
+  ChildListID GetChildListID() const { return mChildListID; }
 #endif
 
   const nsFrameList& GetChildList() const { return mAbsoluteFrames; }
   void AppendChildList(nsTArray<nsIFrame::ChildList>* aLists,
                        ChildListID aListID) const
   {
     NS_ASSERTION(aListID == GetChildListID(), "wrong list ID");
     GetChildList().AppendIfNonempty(aLists, aListID);
   }
 
   nsresult SetInitialChildList(nsIFrame*       aDelegatingFrame,
-                               nsIAtom*        aListName,
+                               ChildListID     aListID,
                                nsFrameList&    aChildList);
   nsresult AppendFrames(nsIFrame*      aDelegatingFrame,
-                        nsIAtom*       aListName,
+                        ChildListID    aListID,
                         nsFrameList&   aFrameList);
   nsresult InsertFrames(nsIFrame*      aDelegatingFrame,
-                        nsIAtom*       aListName,
+                        ChildListID    aListID,
                         nsIFrame*      aPrevFrame,
                         nsFrameList&   aFrameList);
   void RemoveFrame(nsIFrame*      aDelegatingFrame,
-                   nsIAtom*       aListName,
+                   ChildListID    aListID,
                    nsIFrame*      aOldFrame);
 
   // Called by the delegating frame after it has done its reflow first. This
   // function will reflow any absolutely positioned child frames that need to
   // be reflowed, e.g., because the absolutely positioned child frame has
   // 'auto' for an offset, or a percentage based width or height.
   // aOverflowAreas, if non-null, is unioned with (in the local
   // coordinate space) the overflow areas of the absolutely positioned
@@ -162,17 +163,17 @@ protected:
   // marked with NS_FRAME_IS_DIRTY.  Otherwise, the size-dependant ones will be
   // marked with NS_FRAME_HAS_DIRTY_CHILDREN.
   void DoMarkFramesDirty(PRBool aMarkAllDirty);
 
 protected:
   nsFrameList mAbsoluteFrames;  // additional named child list
 
 #ifdef DEBUG
-  nsIAtom* const mChildListName; // nsGkAtoms::fixedList or nsGkAtoms::absoluteList
+  ChildListID const mChildListID; // kFixedList or kAbsoluteList
 
   // helper routine for debug printout
   void PrettyUC(nscoord aSize,
                 char*   aBuf);
 #endif
 };
 
 #endif /* nsnsAbsoluteContainingBlock_h___ */
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2089,17 +2089,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
       }
 
       needToRecoverState = PR_TRUE;
 
       if (reflowedPrevLine && !line->IsBlock() &&
           aState.mPresContext->HasPendingInterrupt()) {
         // Need to make sure to pull overflows from any prev-in-flows
         for (nsIFrame* inlineKid = line->mFirstChild; inlineKid;
-             inlineKid = inlineKid->GetFirstChild(nsnull)) {
+             inlineKid = inlineKid->GetFirstPrincipalChild()) {
           inlineKid->PullOverflowsFromPrevInFlow();
         }
       }
     }
 
     // Record if we need to clear floats before reflowing the next
     // line. Note that inlineFloatBreakType will be handled and
     // cleared before the next line is processed, so there is no
@@ -4669,27 +4669,27 @@ nsBlockFrame::RemovePushedFloats()
   NS_ASSERTION(result, "value should always be non-empty when state set");
   return result;
 }
 
 //////////////////////////////////////////////////////////////////////
 // Frame list manipulation routines
 
 NS_IMETHODIMP
-nsBlockFrame::AppendFrames(nsIAtom*  aListName,
+nsBlockFrame::AppendFrames(ChildListID  aListID,
                            nsFrameList& aFrameList)
 {
   if (aFrameList.IsEmpty()) {
     return NS_OK;
   }
-  if (aListName) {
-    if (nsGkAtoms::absoluteList == aListName) {
-      return mAbsoluteContainer.AppendFrames(this, aListName, aFrameList);
-    }
-    else if (nsGkAtoms::floatList == aListName) {
+  if (aListID != kPrincipalList) {
+    if (kAbsoluteList == aListID) {
+      return mAbsoluteContainer.AppendFrames(this, aListID, aFrameList);
+    }
+    else if (kFloatList == aListID) {
       mFloats.AppendFrames(nsnull, aFrameList);
       return NS_OK;
     }
     else {
       NS_ERROR("unexpected child list");
       return NS_ERROR_INVALID_ARG;
     }
   }
@@ -4716,34 +4716,34 @@ nsBlockFrame::AppendFrames(nsIAtom*  aLi
 
   PresContext()->PresShell()->
     FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                      NS_FRAME_HAS_DIRTY_CHILDREN); // XXX sufficient?
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBlockFrame::InsertFrames(nsIAtom*  aListName,
+nsBlockFrame::InsertFrames(ChildListID aListID,
                            nsIFrame* aPrevFrame,
                            nsFrameList& aFrameList)
 {
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
-  if (aListName) {
-    if (nsGkAtoms::absoluteList == aListName) {
-      return mAbsoluteContainer.InsertFrames(this, aListName, aPrevFrame,
+  if (aListID != kPrincipalList) {
+    if (kAbsoluteList == aListID) {
+      return mAbsoluteContainer.InsertFrames(this, aListID, aPrevFrame,
                                              aFrameList);
     }
-    else if (nsGkAtoms::floatList == aListName) {
+    else if (kFloatList == aListID) {
       mFloats.InsertFrames(this, aPrevFrame, aFrameList);
       return NS_OK;
     }
 #ifdef IBMBIDI
-    else if (nsGkAtoms::nextBidi == aListName) {}
+    else if (kNoReflowPrincipalList == aListID) {}
 #endif // IBMBIDI
     else {
       NS_ERROR("unexpected child list");
       return NS_ERROR_INVALID_ARG;
     }
   }
 
 #ifdef NOISY_REFLOW_REASON
@@ -4756,17 +4756,17 @@ nsBlockFrame::InsertFrames(nsIAtom*  aLi
   }
   printf("\n");
 #endif
   nsresult rv = AddFrames(aFrameList, aPrevFrame);
   if (NS_FAILED(rv)) {
     return rv;
   }
 #ifdef IBMBIDI
-  if (aListName != nsGkAtoms::nextBidi)
+  if (aListID != kNoReflowPrincipalList)
 #endif // IBMBIDI
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN); // XXX sufficient?
   return NS_OK;
 }
 
 static PRBool
@@ -4975,68 +4975,68 @@ static void MarkSameFloatManagerLinesDir
 /**
  * Returns PR_TRUE if aFrame is a block that has one or more float children.
  */
 static PRBool BlockHasAnyFloats(nsIFrame* aFrame)
 {
   nsBlockFrame* block = nsLayoutUtils::GetAsBlock(aFrame);
   if (!block)
     return PR_FALSE;
-  if (block->GetFirstChild(nsGkAtoms::floatList))
+  if (block->GetFirstChild(nsIFrame::kFloatList))
     return PR_TRUE;
     
   nsLineList::iterator line = block->begin_lines();
   nsLineList::iterator endLine = block->end_lines();
   while (line != endLine) {
     if (line->IsBlock() && BlockHasAnyFloats(line->mFirstChild))
       return PR_TRUE;
     ++line;
   }
   return PR_FALSE;
 }
 
 NS_IMETHODIMP
-nsBlockFrame::RemoveFrame(nsIAtom*  aListName,
+nsBlockFrame::RemoveFrame(ChildListID aListID,
                           nsIFrame* aOldFrame)
 {
   nsresult rv = NS_OK;
 
 #ifdef NOISY_REFLOW_REASON
   ListTag(stdout);
   printf(": remove ");
   nsFrame::ListTag(stdout, aOldFrame);
   printf("\n");
 #endif
 
-  if (nsnull == aListName) {
+  if (aListID == kPrincipalList) {
     PRBool hasFloats = BlockHasAnyFloats(aOldFrame);
     rv = DoRemoveFrame(aOldFrame, REMOVE_FIXED_CONTINUATIONS);
     if (hasFloats) {
       MarkSameFloatManagerLinesDirty(this);
     }
   }
-  else if (nsGkAtoms::absoluteList == aListName) {
-    mAbsoluteContainer.RemoveFrame(this, aListName, aOldFrame);
+  else if (kAbsoluteList == aListID) {
+    mAbsoluteContainer.RemoveFrame(this, aListID, aOldFrame);
     return NS_OK;
   }
-  else if (nsGkAtoms::floatList == aListName) {
+  else if (kFloatList == aListID) {
     // Make sure to mark affected lines dirty for the float frame
     // we are removing; this way is a bit messy, but so is the rest of the code.
     // See bug 390762.
     NS_ASSERTION(!aOldFrame->GetPrevContinuation(),
                  "RemoveFrame should not be called on pushed floats.");
     for (nsIFrame* f = aOldFrame;
          f && !(f->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER);
          f = f->GetNextContinuation()) {
       MarkSameFloatManagerLinesDirty(static_cast<nsBlockFrame*>(f->GetParent()));
     }
     DoRemoveOutOfFlowFrame(aOldFrame);
   }
 #ifdef IBMBIDI
-  else if (nsGkAtoms::nextBidi == aListName) {
+  else if (kNoReflowPrincipalList == aListID) {
     // Skip the call to |FrameNeedsReflow| below by returning now.
     return DoRemoveFrame(aOldFrame, REMOVE_FIXED_CONTINUATIONS);
   }
 #endif // IBMBIDI
   else {
     NS_ERROR("unexpected child list");
     rv = NS_ERROR_INVALID_ARG;
   }
@@ -5055,17 +5055,17 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsI
   // The containing block is always the parent of aFrame.
   nsBlockFrame* block = (nsBlockFrame*)aFrame->GetParent();
 
   // Remove aFrame from the appropriate list.
   const nsStyleDisplay* display = aFrame->GetStyleDisplay();
   if (display->IsAbsolutelyPositioned()) {
     // This also deletes the next-in-flows
     block->mAbsoluteContainer.RemoveFrame(block,
-                                          nsGkAtoms::absoluteList,
+                                          kAbsoluteList,
                                           aFrame);
   }
   else {
     // First remove aFrame's next-in-flows
     nsIFrame* nif = aFrame->GetNextInFlow();
     if (nif) {
       static_cast<nsContainerFrame*>(nif->GetParent())
         ->DeleteNextInFlowChild(aFrame->PresContext(), nif, PR_FALSE);
@@ -5971,17 +5971,17 @@ nsBlockFrame::RecoverFloats(nsFloatManag
   for (nsIFrame* f = mFloats.FirstChild(); f && f != stop; f = f->GetNextSibling()) {
     nsRect region = nsFloatManager::GetRegionFor(f);
     aFloatManager.AddFloat(f, region);
     if (!stop && f->GetNextInFlow())
       stop = f->GetNextInFlow();
   }
 
   // Recurse into our overflow container children
-  for (nsIFrame* oc = GetFirstChild(nsGkAtoms::overflowContainersList);
+  for (nsIFrame* oc = GetFirstChild(kOverflowContainersList);
        oc; oc = oc->GetNextSibling()) {
     RecoverFloatsFor(oc, aFloatManager);
   }
 
   // Recurse into our normal children
   for (nsBlockFrame::line_iterator line = begin_lines(); line != end_lines(); ++line) {
     if (line->IsBlock()) {
       RecoverFloatsFor(line->mFirstChild, aFloatManager);
@@ -6444,25 +6444,25 @@ nsBlockFrame::Init(nsIContent*      aCon
   if (!aPrevInFlow ||
       aPrevInFlow->GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
     AddStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsBlockFrame::SetInitialChildList(nsIAtom*        aListName,
+nsBlockFrame::SetInitialChildList(ChildListID     aListID,
                                   nsFrameList&    aChildList)
 {
   nsresult rv = NS_OK;
 
-  if (nsGkAtoms::absoluteList == aListName) {
-    mAbsoluteContainer.SetInitialChildList(this, aListName, aChildList);
-  }
-  else if (nsGkAtoms::floatList == aListName) {
+  if (kAbsoluteList == aListID) {
+    mAbsoluteContainer.SetInitialChildList(this, aListID, aChildList);
+  }
+  else if (kFloatList == aListID) {
     mFloats.SetFrames(aChildList);
   }
   else {
     nsPresContext* presContext = PresContext();
 
 #ifdef DEBUG
     // The only times a block that is an anonymous box is allowed to have a
     // first-letter frame are when it's the block inside a non-anonymous cell,
@@ -6861,22 +6861,22 @@ void nsBlockFrame::CollectFloats(nsIFram
             oofs.mList.RemoveFrame(outOfFlowFrame);
           } else {
             mFloats.RemoveFrame(outOfFlowFrame);
           }
           aList.AppendFrame(nsnull, outOfFlowFrame);
         }
       }
 
-      CollectFloats(aFrame->GetFirstChild(nsnull), 
+      CollectFloats(aFrame->GetFirstPrincipalChild(), 
                     aList, aFromOverflow, PR_TRUE);
       // Note: Even though we're calling CollectFloats on aFrame's overflow
       // list, we'll pass down aFromOverflow unchanged because we're still
       // traversing the regular-children subtree of the 'this' frame.
-      CollectFloats(aFrame->GetFirstChild(nsGkAtoms::overflowList), 
+      CollectFloats(aFrame->GetFirstChild(kOverflowList), 
                     aList, aFromOverflow, PR_TRUE);
     }
     if (!aCollectSiblings)
       break;
     aFrame = aFrame->GetNextSibling();
   }
 }
 
@@ -6995,18 +6995,18 @@ nsBlockFrame::WidthToClearPastFloats(nsB
   nscoord leftOffset, rightOffset;
   nsCSSOffsetState offsetState(aFrame, aState.mReflowState.rendContext,
                                aState.mContentArea.width);
 
   ReplacedElementWidthToClear result;
   // A table outer frame is an exception in that it is a block child
   // that is not a containing block for its children.
   if (aFrame->GetType() == nsGkAtoms::tableOuterFrame) {
-    nsIFrame *innerTable = aFrame->GetFirstChild(nsnull);
-    nsIFrame *caption = aFrame->GetFirstChild(nsGkAtoms::captionList);
+    nsIFrame *innerTable = aFrame->GetFirstPrincipalChild();
+    nsIFrame *caption = aFrame->GetFirstChild(kCaptionList);
 
     nsMargin tableMargin, captionMargin;
     {
       nsCSSOffsetState tableOS(innerTable, aState.mReflowState.rendContext,
                                aState.mContentArea.width);
       tableMargin = tableOS.mComputedMargin;
     }
 
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -75,21 +75,16 @@ enum LineReflowStatus {
 };
 
 class nsBlockReflowState;
 class nsBlockInFlowLineIterator;
 class nsBulletFrame;
 class nsLineBox;
 class nsFirstLineFrame;
 class nsIntervalSet;
-/**
- * Child list name indices
- * @see #GetAdditionalChildListName()
- */
-#define NS_BLOCK_LIST_COUNT  (NS_CONTAINER_LIST_COUNT_INCL_OC + 5)
 
 /**
  * Some invariants:
  * -- The overflow out-of-flows list contains the out-of-
  * flow frames whose placeholders are in the overflow list.
  * -- A given piece of content has at most one placeholder
  * frame in a block's normal child list.
  * -- While a block is being reflowed, and from then until
@@ -127,20 +122,18 @@ class nsIntervalSet;
 // flow with 'clear' set to something other than 'none'
 // (including <BR CLEAR="..."> frames)
 #define NS_BLOCK_HAS_CLEAR_CHILDREN         NS_FRAME_STATE_BIT(27)
 
 #define nsBlockFrameSuper nsHTMLContainerFrame
 
 /*
  * Base class for block and inline frames.
- * The block frame has an additional named child list:
- * - "Absolute-list" which contains the absolutely positioned frames
- *
- * @see nsGkAtoms::absoluteList
+ * The block frame has an additional child list, kAbsoluteList, which
+ * contains the absolutely positioned frames.
  */ 
 class nsBlockFrame : public nsBlockFrameSuper
 {
 public:
   NS_DECL_QUERYFRAME_TARGET(nsBlockFrame)
   NS_DECL_FRAMEARENA_HELPERS
 
   typedef nsLineList::iterator                  line_iterator;
@@ -168,29 +161,29 @@ public:
 
   // nsQueryFrame
   NS_DECL_QUERYFRAME
 
   // nsIFrame
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
-  NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD  AppendFrames(ChildListID     aListID,
                            nsFrameList&    aFrameList);
-  NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD  InsertFrames(ChildListID     aListID,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList);
-  NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD  RemoveFrame(ChildListID     aListID,
                           nsIFrame*       aOldFrame);
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
+  virtual nsFrameList GetChildList(ChildListID aListID) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
   virtual nscoord GetBaseline() const;
   virtual nscoord GetCaretBaseline() const;
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   virtual nsSplittableType GetSplittableType() const;
   virtual PRBool IsContainingBlock() const;
   virtual PRBool IsFloatContainingBlock() const;
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
   virtual void InvalidateInternal(const nsRect& aDamageRect,
@@ -336,17 +329,17 @@ public:
    */
   static nsBlockFrame* GetNearestAncestorBlock(nsIFrame* aCandidate);
   
 protected:
   nsBlockFrame(nsStyleContext* aContext)
     : nsHTMLContainerFrame(aContext)
     , mMinWidth(NS_INTRINSIC_WIDTH_UNKNOWN)
     , mPrefWidth(NS_INTRINSIC_WIDTH_UNKNOWN)
-    , mAbsoluteContainer(nsGkAtoms::absoluteList)
+    , mAbsoluteContainer(kAbsoluteList)
   {
 #ifdef DEBUG
   InitDebugFlags();
 #endif
   }
   virtual ~nsBlockFrame();
 
 #ifdef DEBUG
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -72,17 +72,17 @@ nsBlockReflowContext::nsBlockReflowConte
     mMetrics()
 {
 }
 
 static nsIFrame* DescendIntoBlockLevelFrame(nsIFrame* aFrame)
 {
   nsIAtom* type = aFrame->GetType();
   if (type == nsGkAtoms::columnSetFrame)
-    return DescendIntoBlockLevelFrame(aFrame->GetFirstChild(nsnull));
+    return DescendIntoBlockLevelFrame(aFrame->GetFirstPrincipalChild());
   return aFrame;
 }
 
 PRBool
 nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
   nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame,
   PRBool* aMayNeedRetry, PRBool* aBlockIsEmpty)
 {
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -117,43 +117,44 @@ nsCanvasFrame::SetHasFocus(PRBool aHasFo
         mAddedScrollPositionListener = PR_TRUE;
       }
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsCanvasFrame::SetInitialChildList(nsIAtom*        aListName,
+nsCanvasFrame::SetInitialChildList(ChildListID     aListID,
                                    nsFrameList&    aChildList)
 {
-  if (nsGkAtoms::absoluteList == aListName)
-    return mAbsoluteContainer.SetInitialChildList(this, aListName, aChildList);
+  if (kAbsoluteList == aListID)
+    return mAbsoluteContainer.SetInitialChildList(this, aListID, aChildList);
 
-  NS_ASSERTION(aListName || aChildList.IsEmpty() || aChildList.OnlyChild(),
+  NS_ASSERTION(aListID != kPrincipalList ||
+               aChildList.IsEmpty() || aChildList.OnlyChild(),
                "Primary child list can have at most one frame in it");
-  return nsHTMLContainerFrame::SetInitialChildList(aListName, aChildList);
+  return nsHTMLContainerFrame::SetInitialChildList(aListID, aChildList);
 }
 
 NS_IMETHODIMP
-nsCanvasFrame::AppendFrames(nsIAtom*        aListName,
+nsCanvasFrame::AppendFrames(ChildListID     aListID,
                             nsFrameList&    aFrameList)
 {
-  if (nsGkAtoms::absoluteList == aListName)
-    return mAbsoluteContainer.AppendFrames(this, aListName, aFrameList);
+  if (kAbsoluteList == aListID)
+    return mAbsoluteContainer.AppendFrames(this, aListID, aFrameList);
 
-  NS_ASSERTION(!aListName, "unexpected child list name");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list ID");
   NS_PRECONDITION(mFrames.IsEmpty(), "already have a child frame");
-  if (aListName) {
-    // We only support unnamed principal child list
+  if (aListID != kPrincipalList) {
+    // We only support the Principal and Absolute child lists.
     return NS_ERROR_INVALID_ARG;
   }
 
   if (!mFrames.IsEmpty()) {
-    // We only allow a single child frame
+    // We only allow a single principal child frame.
     return NS_ERROR_INVALID_ARG;
   }
 
   // Insert the new frames
   NS_ASSERTION(aFrameList.FirstChild() == aFrameList.LastChild(),
                "Only one principal child frame allowed");
 #ifdef NS_DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
@@ -163,44 +164,44 @@ nsCanvasFrame::AppendFrames(nsIAtom*    
   PresContext()->PresShell()->
     FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                      NS_FRAME_HAS_DIRTY_CHILDREN);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsCanvasFrame::InsertFrames(nsIAtom*        aListName,
+nsCanvasFrame::InsertFrames(ChildListID     aListID,
                             nsIFrame*       aPrevFrame,
                             nsFrameList&    aFrameList)
 {
-  if (nsGkAtoms::absoluteList == aListName)
-    return mAbsoluteContainer.InsertFrames(this, aListName, aPrevFrame, aFrameList);
+  if (kAbsoluteList == aListID)
+    return mAbsoluteContainer.InsertFrames(this, aListID, aPrevFrame, aFrameList);
 
   // Because we only support a single child frame inserting is the same
   // as appending
   NS_PRECONDITION(!aPrevFrame, "unexpected previous sibling frame");
   if (aPrevFrame)
     return NS_ERROR_UNEXPECTED;
 
-  return AppendFrames(aListName, aFrameList);
+  return AppendFrames(aListID, aFrameList);
 }
 
 NS_IMETHODIMP
-nsCanvasFrame::RemoveFrame(nsIAtom*        aListName,
+nsCanvasFrame::RemoveFrame(ChildListID     aListID,
                            nsIFrame*       aOldFrame)
 {
-  if (nsGkAtoms::absoluteList == aListName) {
-    mAbsoluteContainer.RemoveFrame(this, aListName, aOldFrame);
+  if (kAbsoluteList == aListID) {
+    mAbsoluteContainer.RemoveFrame(this, aListID, aOldFrame);
     return NS_OK;
   }
 
-  NS_ASSERTION(!aListName, "unexpected child list name");
-  if (aListName) {
-    // We only support the unnamed principal child list
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list ID");
+  if (aListID != kPrincipalList) {
+    // We only support the Principal and Absolute child lists.
     return NS_ERROR_INVALID_ARG;
   }
 
   if (aOldFrame != mFrames.FirstChild())
     return NS_ERROR_FAILURE;
 
   // It's our one and only child frame
   // Damage the area occupied by the deleted frame
@@ -212,25 +213,16 @@ nsCanvasFrame::RemoveFrame(nsIAtom*     
   mFrames.DestroyFrame(aOldFrame);
 
   PresContext()->PresShell()->
     FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                      NS_FRAME_HAS_DIRTY_CHILDREN);
   return NS_OK;
 }
 
-nsIAtom*
-nsCanvasFrame::GetAdditionalChildListName(PRInt32 aIndex) const
-{
-  if (CANVAS_ABS_POS_CHILD_LIST == aIndex)
-    return nsGkAtoms::absoluteList;
-
-  return nsHTMLContainerFrame::GetAdditionalChildListName(aIndex);
-}
-
 nsFrameList
 nsCanvasFrame::GetChildList(ChildListID aListID) const
 {
   if (kAbsoluteList == aListID)
     return mAbsoluteContainer.GetChildList();
 
   return nsHTMLContainerFrame::GetChildList(aListID);
 }
@@ -332,17 +324,17 @@ nsCanvasFrame::BuildDisplayList(nsDispla
   // calling DisplayBorderBackgroundOutline.
   if (IsVisibleForPainting(aBuilder)) { 
     rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
            nsDisplayCanvasBackground(aBuilder, this));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsIFrame* kid;
-  for (kid = GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) {
+  for (kid = GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
     // Put our child into its own pseudo-stack.
     rv = BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
 #ifdef DEBUG_CANVAS_FOCUS
   nsCOMPtr<nsIContent> focusContent;
   aPresContext->EventStateManager()->
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -60,33 +60,33 @@ class nsEvent;
 class nsCanvasFrame : public nsHTMLContainerFrame,
                       public nsIScrollPositionListener
 {
 public:
   nsCanvasFrame(nsStyleContext* aContext)
   : nsHTMLContainerFrame(aContext),
     mDoPaintFocus(PR_FALSE),
     mAddedScrollPositionListener(PR_FALSE),
-    mAbsoluteContainer(nsGkAtoms::absoluteList) {}
+    mAbsoluteContainer(kAbsoluteList) {}
 
   NS_DECL_QUERYFRAME_TARGET(nsCanvasFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsFrameList GetChildList(ChildListID aListID) const;
   virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -53,37 +53,37 @@
 #include "nsCSSRendering.h"
 
 class nsColumnSetFrame : public nsHTMLContainerFrame {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   nsColumnSetFrame(nsStyleContext* aContext);
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
                                
-  NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD  AppendFrames(ChildListID     aListID,
                            nsFrameList&    aFrameList);
-  NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD  InsertFrames(ChildListID     aListID,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList);
-  NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD  RemoveFrame(ChildListID     aListID,
                           nsIFrame*       aOldFrame);
 
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);  
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   virtual nsIFrame* GetContentInsertionFrame() {
-    nsIFrame* frame = GetFirstChild(nsnull);
+    nsIFrame* frame = GetFirstPrincipalChild();
 
     // if no children return nsnull
     if (!frame)
       return nsnull;
 
     return frame->GetContentInsertionFrame();
   }
 
@@ -282,24 +282,25 @@ nsColumnSetFrame::PaintColumnRule(nsRend
         (1 << NS_SIDE_TOP | 1 << NS_SIDE_RIGHT | 1 << NS_SIDE_BOTTOM));
 
     child = nextSibling;
     nextSibling = nextSibling->GetNextSibling();
   }
 }
 
 NS_IMETHODIMP
-nsColumnSetFrame::SetInitialChildList(nsIAtom*        aListName,
+nsColumnSetFrame::SetInitialChildList(ChildListID     aListID,
                                       nsFrameList&    aChildList)
 {
-  NS_ASSERTION(!aListName, "Only default child list supported");
+  NS_ASSERTION(aListID == kPrincipalList,
+               "Only default child list supported");
   NS_ASSERTION(aChildList.OnlyChild(),
                "initial child list must have exactly one child");
   // Queue up the frames for the content frame
-  return nsHTMLContainerFrame::SetInitialChildList(nsnull, aChildList);
+  return nsHTMLContainerFrame::SetInitialChildList(kPrincipalList, aChildList);
 }
 
 static nscoord
 GetAvailableContentWidth(const nsHTMLReflowState& aReflowState)
 {
   if (aReflowState.availableWidth == NS_INTRINSICSIZE) {
     return NS_INTRINSICSIZE;
   }
@@ -1103,31 +1104,31 @@ nsColumnSetFrame::BuildDisplayList(nsDis
 
 PRIntn
 nsColumnSetFrame::GetSkipSides() const
 {
   return 0;
 }
 
 NS_IMETHODIMP
-nsColumnSetFrame::AppendFrames(nsIAtom*        aListName,
+nsColumnSetFrame::AppendFrames(ChildListID     aListID,
                                nsFrameList&    aFrameList)
 {
   NS_NOTREACHED("AppendFrames not supported");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsColumnSetFrame::InsertFrames(nsIAtom*        aListName,
+nsColumnSetFrame::InsertFrames(ChildListID     aListID,
                                nsIFrame*       aPrevFrame,
                                nsFrameList&    aFrameList)
 {
   NS_NOTREACHED("InsertFrames not supported");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsColumnSetFrame::RemoveFrame(nsIAtom*        aListName,
+nsColumnSetFrame::RemoveFrame(ChildListID     aListID,
                               nsIFrame*       aOldFrame)
 {
   NS_NOTREACHED("RemoveFrame not supported");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -104,123 +104,123 @@ nsContainerFrame::Init(nsIContent* aCont
     // has a child with a view so that we'll properly reposition it.
     if (aPrevInFlow->GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW)
       AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsContainerFrame::SetInitialChildList(nsIAtom*     aListName,
+nsContainerFrame::SetInitialChildList(ChildListID  aListID,
                                       nsFrameList& aChildList)
 {
   nsresult  result;
   if (mFrames.NotEmpty()) {
     // We already have child frames which means we've already been
     // initialized
     NS_NOTREACHED("unexpected second call to SetInitialChildList");
     result = NS_ERROR_UNEXPECTED;
-  } else if (aListName) {
-    // All we know about is the unnamed principal child list
+  } else if (aListID != kPrincipalList) {
+    // All we know about is the principal child list.
     NS_NOTREACHED("unknown frame list");
     result = NS_ERROR_INVALID_ARG;
   } else {
 #ifdef NS_DEBUG
     nsFrame::VerifyDirtyBitSet(aChildList);
 #endif
     mFrames.SetFrames(aChildList);
     result = NS_OK;
   }
   return result;
 }
 
 NS_IMETHODIMP
-nsContainerFrame::AppendFrames(nsIAtom*  aListName,
+nsContainerFrame::AppendFrames(ChildListID  aListID,
                                nsFrameList& aFrameList)
 {
-  if (nsnull != aListName) {
+  if (aListID != kPrincipalList) {
 #ifdef IBMBIDI
-    if (aListName != nsGkAtoms::nextBidi)
+    if (aListID != kNoReflowPrincipalList)
 #endif
     {
       NS_ERROR("unexpected child list");
       return NS_ERROR_INVALID_ARG;
     }
   }
   if (aFrameList.NotEmpty()) {
     mFrames.AppendFrames(this, aFrameList);
 
     // Ask the parent frame to reflow me.
 #ifdef IBMBIDI
-    if (nsnull == aListName)
+    if (aListID == kPrincipalList)
 #endif
     {
       PresContext()->PresShell()->
         FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                          NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsContainerFrame::InsertFrames(nsIAtom*  aListName,
+nsContainerFrame::InsertFrames(ChildListID aListID,
                                nsIFrame* aPrevFrame,
                                nsFrameList& aFrameList)
 {
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
-  if (nsnull != aListName) {
+  if (aListID != kPrincipalList) {
 #ifdef IBMBIDI
-    if (aListName != nsGkAtoms::nextBidi)
+    if (aListID != kNoReflowPrincipalList)
 #endif
     {
       NS_ERROR("unexpected child list");
       return NS_ERROR_INVALID_ARG;
     }
   }
   if (aFrameList.NotEmpty()) {
     // Insert frames after aPrevFrame
     mFrames.InsertFrames(this, aPrevFrame, aFrameList);
 
 #ifdef IBMBIDI
-    if (nsnull == aListName)
+    if (aListID == kPrincipalList)
 #endif
     {
       PresContext()->PresShell()->
         FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                          NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsContainerFrame::RemoveFrame(nsIAtom*  aListName,
+nsContainerFrame::RemoveFrame(ChildListID aListID,
                               nsIFrame* aOldFrame)
 {
-  if (nsnull != aListName) {
+  if (aListID != kPrincipalList) {
 #ifdef IBMBIDI
-    if (nsGkAtoms::nextBidi != aListName)
+    if (kNoReflowPrincipalList != aListID)
 #endif
     {
       NS_ERROR("unexpected child list");
       return NS_ERROR_INVALID_ARG;
     }
   }
 
   if (aOldFrame) {
     // Loop and destroy the frame and all of its continuations.
     // If the frame we are removing is a brFrame, we need a reflow so
     // the line the brFrame was on can attempt to pull up any frames
     // that can fit from lines below it.
     PRBool generateReflowCommand = PR_TRUE;
 #ifdef IBMBIDI
-    if (nsGkAtoms::nextBidi == aListName) {
+    if (kNoReflowPrincipalList == aListID) {
       generateReflowCommand = PR_FALSE;
     }
 #endif
     nsContainerFrame* parent = static_cast<nsContainerFrame*>(aOldFrame->GetParent());
     while (aOldFrame) {
       // When the parent is an inline frame we have a simple task - just
       // remove the frame from its parents list and generate a reflow
       // command.
@@ -234,17 +234,17 @@ nsContainerFrame::RemoveFrame(nsIAtom*  
           // Try to remove it from our overflow list, if we have one.
           // The simplest way is to reuse StealFrame.
           StealFrame(PresContext(), aOldFrame, PR_TRUE);
           aOldFrame->Destroy();
         }
       } else {
         // This recursive call takes care of all continuations after aOldFrame,
         // so we don't need to loop anymore.
-        parent->RemoveFrame(nsnull, aOldFrame);
+        parent->RemoveFrame(kPrincipalList, aOldFrame);
         break;
       }
       aOldFrame = oldFrameNextContinuation;
       if (aOldFrame) {
         parent = static_cast<nsContainerFrame*>(aOldFrame->GetParent());
       }
     }
 
--- a/layout/generic/nsContainerFrame.h
+++ b/layout/generic/nsContainerFrame.h
@@ -41,25 +41,16 @@
 #ifndef nsContainerFrame_h___
 #define nsContainerFrame_h___
 
 #include "nsSplittableFrame.h"
 #include "nsFrameList.h"
 #include "nsLayoutUtils.h"
 #include "nsAutoPtr.h"
 
-/**
- * Child list name indices
- * @see #GetAdditionalChildListName()
- */
-#define NS_CONTAINER_LIST_COUNT_SANS_OC 1
-  // for frames that don't use overflow containers
-#define NS_CONTAINER_LIST_COUNT_INCL_OC 3
-  // for frames that support overflow containers
-
 // Option flags for ReflowChild() and FinishReflowChild()
 // member functions
 #define NS_FRAME_NO_MOVE_VIEW         0x0001
 #define NS_FRAME_NO_MOVE_FRAME        (0x0002 | NS_FRAME_NO_MOVE_VIEW)
 #define NS_FRAME_NO_SIZE_VIEW         0x0004
 #define NS_FRAME_NO_VISIBILITY        0x0008
 // Only applies to ReflowChild: if true, invalidate the child if it's
 // being moved
@@ -76,28 +67,28 @@ public:
   NS_DECL_FRAMEARENA_HELPERS
   NS_DECL_QUERYFRAME_TARGET(nsContainerFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
   NS_IMETHOD Init(nsIContent* aContent,
                   nsIFrame*   aParent,
                   nsIFrame*   aPrevInFlow);
-  NS_IMETHOD SetInitialChildList(nsIAtom*     aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID  aListID,
                                  nsFrameList& aChildList);
-  NS_IMETHOD AppendFrames(nsIAtom*  aListName,
+  NS_IMETHOD AppendFrames(ChildListID  aListID,
                           nsFrameList& aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*  aListName,
+  NS_IMETHOD InsertFrames(ChildListID aListID,
                           nsIFrame* aPrevFrame,
                           nsFrameList& aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*  aListName,
+  NS_IMETHOD RemoveFrame(ChildListID aListID,
                          nsIFrame* aOldFrame);
 
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
+  virtual nsFrameList GetChildList(ChildListID aList) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   virtual void ChildIsDirty(nsIFrame* aChild);
 
   virtual PRBool IsLeaf() const;
   virtual PRBool PeekOffsetNoAmount(PRBool aForward, PRInt32* aOffset);
   virtual PRBool PeekOffsetCharacter(PRBool aForward, PRInt32* aOffset,
                                      PRBool aRespectClusters = PR_TRUE);
   
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -100,17 +100,17 @@ nsFirstLetterFrame::Init(nsIContent*    
         SetStyleContextWithoutNotification(newSC);
     }
   }
 
   return nsFirstLetterFrameSuper::Init(aContent, aParent, aPrevInFlow);
 }
 
 NS_IMETHODIMP
-nsFirstLetterFrame::SetInitialChildList(nsIAtom*     aListName,
+nsFirstLetterFrame::SetInitialChildList(ChildListID  aListID,
                                         nsFrameList& aChildList)
 {
   nsFrameManager *frameManager = PresContext()->FrameManager();
 
   for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
     NS_ASSERTION(e.get()->GetParent() == this, "Unexpected parent");
     frameManager->ReparentStyleContext(e.get());
   }
@@ -345,21 +345,21 @@ nsFirstLetterFrame::CreateContinuationFo
     nsRefPtr<nsStyleContext> newSC;
     newSC = presShell->StyleSet()->ResolveStyleForNonElement(parentSC);
     if (newSC) {
       continuation->SetStyleContext(newSC);
     }
   }
 
   //XXX Bidi may not be involved but we have to use the list name
-  // nsGkAtoms::nextBidi because this is just like creating a continuation
+  // kNoReflowPrincipalList because this is just like creating a continuation
   // except we have to insert it in a different place and we don't want a
   // reflow command to try to be issued.
   nsFrameList temp(continuation, continuation);
-  rv = parent->InsertFrames(nsGkAtoms::nextBidi, placeholderFrame, temp);
+  rv = parent->InsertFrames(kNoReflowPrincipalList, placeholderFrame, temp);
 
   *aContinuation = continuation;
   return rv;
 }
 
 void
 nsFirstLetterFrame::DrainOverflowFrames(nsPresContext* aPresContext)
 {
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -50,17 +50,17 @@ public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   nsFirstLetterFrame(nsStyleContext* aContext) : nsHTMLContainerFrame(aContext) {}
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 #ifdef NS_DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
   virtual nsIAtom* GetType() const;
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -365,49 +365,49 @@ nsFrame::Init(nsIContent*      aContent,
   DidSetStyleContext(nsnull);
 
   if (IsBoxWrapped())
     InitBoxMetrics(PR_FALSE);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsFrame::SetInitialChildList(nsIAtom*        aListName,
+NS_IMETHODIMP nsFrame::SetInitialChildList(ChildListID     aListID,
                                            nsFrameList&    aChildList)
 {
   // XXX This shouldn't be getting called at all, but currently is for backwards
   // compatility reasons...
 #if 0
   NS_ERROR("not a container");
   return NS_ERROR_UNEXPECTED;
 #else
   NS_ASSERTION(aChildList.IsEmpty(), "not a container");
   return NS_OK;
 #endif
 }
 
 NS_IMETHODIMP
-nsFrame::AppendFrames(nsIAtom*        aListName,
+nsFrame::AppendFrames(ChildListID     aListID,
                       nsFrameList&    aFrameList)
 {
   NS_PRECONDITION(PR_FALSE, "not a container");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-nsFrame::InsertFrames(nsIAtom*        aListName,
+nsFrame::InsertFrames(ChildListID     aListID,
                       nsIFrame*       aPrevFrame,
                       nsFrameList&    aFrameList)
 {
   NS_PRECONDITION(PR_FALSE, "not a container");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-nsFrame::RemoveFrame(nsIAtom*        aListName,
+nsFrame::RemoveFrame(ChildListID     aListID,
                      nsIFrame*       aOldFrame)
 {
   NS_PRECONDITION(PR_FALSE, "not a container");
   return NS_ERROR_UNEXPECTED;
 }
 
 void
 nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
@@ -2736,17 +2736,17 @@ static FrameTarget GetSelectionClosestFr
 // before the first child.  A click on a block whose first child is a block
 // should put the cursor in the child.  The cursor shouldn't be between the
 // blocks, because that's not where it's expected.
 // Note that this method is guaranteed to succeed.
 static FrameTarget DrillDownToSelectionFrame(nsIFrame* aFrame,
                                              PRBool aEndFrame) {
   if (SelectionDescendToKids(aFrame)) {
     nsIFrame* result = nsnull;
-    nsIFrame *frame = aFrame->GetFirstChild(nsnull);
+    nsIFrame *frame = aFrame->GetFirstPrincipalChild();
     if (!aEndFrame) {
       while (frame && (!SelfIsSelectable(frame) ||
                         frame->IsEmpty()))
         frame = frame->GetNextSibling();
       if (frame)
         result = frame;
     } else {
       // Because the frame tree is singly linked, to find the last frame,
@@ -2905,17 +2905,17 @@ static FrameTarget GetSelectionClosestFr
 {
   {
     // Handle blocks; if the frame isn't a block, the method fails
     FrameTarget target = GetSelectionClosestFrameForBlock(aFrame, aPoint);
     if (!target.IsNull())
       return target;
   }
 
-  nsIFrame *kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame *kid = aFrame->GetFirstPrincipalChild();
 
   if (kid) {
     // Go through all the child frames to find the closest one
 
     // Large number to force the comparison to succeed
     const nscoord HUGE_DISTANCE = nscoord_MAX;
     nscoord closestXDistance = HUGE_DISTANCE;
     nscoord closestYDistance = HUGE_DISTANCE;
@@ -5355,23 +5355,23 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsD
     aFrame->GetOffsets(startOffset, endOffset);
     result.mContent = aFrame->GetContent();
     result.mOffset = endOffset - (aDirection == eDirPrevious ? 0 : 1);
     return result;
   }
 
   // Iterate over children and call ourselves recursively
   if (aDirection == eDirPrevious) {
-    nsIFrame* child = aFrame->GetChildList(nsnull).LastChild();
+    nsIFrame* child = aFrame->GetLastChild(nsIFrame::kPrincipalList);
     while(child && !result.mContent) {
       result = FindBlockFrameOrBR(child, aDirection);
       child = child->GetPrevSibling();
     }
   } else { // eDirNext
-    nsIFrame* child = aFrame->GetFirstChild(nsnull);
+    nsIFrame* child = aFrame->GetFirstPrincipalChild();
     while(child && !result.mContent) {
       result = FindBlockFrameOrBR(child, aDirection);
       child = child->GetNextSibling();
     }
   }
   return result;
 }
 
@@ -5654,30 +5654,30 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct*
   tables need to navigate also and the frame that supports it is nsTableRowGroupFrame which is INSIDE
   nsTableOuterFrame.  if we have stumbled onto an nsTableOuter we need to drill into nsTableRowGroup
   if we hit a header or footer that's ok just go into them,
 */
             PRBool searchTableBool = PR_FALSE;
             if (aPos->mResultFrame->GetType() == nsGkAtoms::tableOuterFrame ||
                 aPos->mResultFrame->GetType() == nsGkAtoms::tableCellFrame)
             {
-              nsIFrame *frame = aPos->mResultFrame->GetFirstChild(nsnull);
+              nsIFrame *frame = aPos->mResultFrame->GetFirstPrincipalChild();
               //got the table frame now
               while(frame) //ok time to drill down to find iterator
               {
                 iter = frame->GetLineIterator();
                 if (iter)
                 {
                   aPos->mResultFrame = frame;
                   searchTableBool = PR_TRUE;
                   result = NS_OK;
                   break; //while(frame)
                 }
                 result = NS_ERROR_FAILURE;
-                frame = frame->GetFirstChild(nsnull);
+                frame = frame->GetFirstPrincipalChild();
               }
             }
 
             if (!searchTableBool) {
               iter = aPos->mResultFrame->GetLineIterator();
               result = iter ? NS_OK : NS_ERROR_FAILURE;
             }
             if (NS_SUCCEEDED(result) && iter)//we've struck another block element!
@@ -6389,18 +6389,18 @@ GetCorrectedParent(nsPresContext* aPresC
   if (!parent) {
     *aSpecialParent = nsnull;
   } else {
     nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudo();
     // Outer tables are always anon boxes; if we're in here for an outer
     // table, that actually means its the _inner_ table that wants to
     // know its parent.  So get the pseudo of the inner in that case.
     if (pseudo == nsCSSAnonBoxes::tableOuter) {
-      pseudo =
-        aFrame->GetFirstChild(nsnull)->GetStyleContext()->GetPseudo();
+      pseudo = aFrame->GetFirstPrincipalChild()
+                         ->GetStyleContext()->GetPseudo();
     }
     *aSpecialParent = nsFrame::CorrectStyleParentFrame(parent, pseudo);
   }
 
   return NS_OK;
 }
 
 /* static */
@@ -6526,17 +6526,17 @@ nsFrame::DoGetParentStyleContextFrame(ns
 void
 nsFrame::GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame)
 {
   if (!aFrame || !*aFrame)
     return;
   nsIFrame *child = *aFrame;
   //if we are a block frame then go for the last line of 'this'
   while (1){
-    child = child->GetFirstChild(nsnull);
+    child = child->GetFirstPrincipalChild();
     if (!child)
       return;//nothing to do
     nsIFrame* siblingFrame;
     nsIContent* content;
     //ignore anonymous elements, e.g. mozTableAdd* mozTableRemove*
     //see bug 278197 comment #12 #13 for details
     while ((siblingFrame = child->GetNextSibling()) &&
            (content = siblingFrame->GetContent()) &&
@@ -6548,17 +6548,17 @@ nsFrame::GetLastLeaf(nsPresContext* aPre
 
 void
 nsFrame::GetFirstLeaf(nsPresContext* aPresContext, nsIFrame **aFrame)
 {
   if (!aFrame || !*aFrame)
     return;
   nsIFrame *child = *aFrame;
   while (1){
-    child = child->GetFirstChild(nsnull);
+    child = child->GetFirstPrincipalChild();
     if (!child)
       return;//nothing to do
     *aFrame = child;
   }
 }
 
 /* virtual */ const void*
 nsFrame::GetStyleDataExternal(nsStyleStructID aSID) const
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -170,32 +170,31 @@ public:
   // nsQueryFrame
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // nsIFrame
   NS_IMETHOD  Init(nsIContent*      aContent,
                    nsIFrame*        aParent,
                    nsIFrame*        asPrevInFlow);
-  NS_IMETHOD  SetInitialChildList(nsIAtom*           aListName,
+  NS_IMETHOD  SetInitialChildList(ChildListID        aListID,
                                   nsFrameList&       aChildList);
-  NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD  AppendFrames(ChildListID     aListID,
                            nsFrameList&    aFrameList);
-  NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD  InsertFrames(ChildListID     aListID,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList);
-  NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD  RemoveFrame(ChildListID     aListID,
                           nsIFrame*       aOldFrame);
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const;
   virtual void SetAdditionalStyleContext(PRInt32 aIndex,
                                          nsStyleContext* aStyleContext);
   virtual void SetParent(nsIFrame* aParent);
   virtual nscoord GetBaseline() const;
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
   virtual nsFrameList GetChildList(ChildListID aListID) const {
     return nsFrameList::EmptyList();
   }
   virtual void GetChildLists(nsTArray<ChildList>* aLists) const {}
 
   NS_IMETHOD  HandleEvent(nsPresContext* aPresContext, 
                           nsGUIEvent*     aEvent,
                           nsEventStatus*  aEventStatus);
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -471,28 +471,28 @@ nsHTMLFramesetFrame::Init(nsIContent*   
     mChildCount++;
   }
 
   mNonBorderChildCount = mChildCount;
   return rv;
 }
 
 NS_IMETHODIMP
-nsHTMLFramesetFrame::SetInitialChildList(nsIAtom*     aListName,
+nsHTMLFramesetFrame::SetInitialChildList(ChildListID  aListID,
                                          nsFrameList& aChildList)
 {
   // We do this weirdness where we create our child frames in Init().  On the
   // other hand, we're going to get a SetInitialChildList() with an empty list
   // and null list name after the frame constructor is done creating us.  So
   // just ignore that call.
-  if (!aListName && aChildList.IsEmpty()) {
+  if (aListID == kPrincipalList && aChildList.IsEmpty()) {
     return NS_OK;
   }
 
-  return nsHTMLContainerFrame::SetInitialChildList(aListName, aChildList);
+  return nsHTMLContainerFrame::SetInitialChildList(aListID, aChildList);
 }
 
 // XXX should this try to allocate twips based on an even pixel boundary?
 void nsHTMLFramesetFrame::Scale(nscoord  aDesired, 
                                 PRInt32  aNumIndicies, 
                                 PRInt32* aIndicies, 
                                 PRInt32  aNumItems,
                                 PRInt32* aItems)
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -108,17 +108,17 @@ public:
   nsHTMLFramesetFrame(nsStyleContext* aContext);
 
   virtual ~nsHTMLFramesetFrame();
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*     aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID  aListID,
                                  nsFrameList& aChildList);
 
   static PRBool  gDragInProgress;
 
   void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
 
   void GetSizeOfChildAt(PRInt32  aIndexInParent, 
                         nsSize&  aSize, 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -120,53 +120,53 @@ nsHTMLScrollFrame::AppendAnonymousConten
 void
 nsHTMLScrollFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   mInner.Destroy();
   nsHTMLContainerFrame::DestroyFrom(aDestructRoot);
 }
 
 NS_IMETHODIMP
-nsHTMLScrollFrame::SetInitialChildList(nsIAtom*     aListName,
+nsHTMLScrollFrame::SetInitialChildList(ChildListID  aListID,
                                        nsFrameList& aChildList)
 {
-  nsresult rv = nsHTMLContainerFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsHTMLContainerFrame::SetInitialChildList(aListID, aChildList);
   mInner.ReloadChildFrames();
   return rv;
 }
 
 
 NS_IMETHODIMP
-nsHTMLScrollFrame::AppendFrames(nsIAtom*  aListName,
+nsHTMLScrollFrame::AppendFrames(ChildListID  aListID,
                                 nsFrameList& aFrameList)
 {
-  NS_ASSERTION(!aListName, "Only main list supported");
+  NS_ASSERTION(aListID == kPrincipalList, "Only main list supported");
   mFrames.AppendFrames(nsnull, aFrameList);
   mInner.ReloadChildFrames();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLScrollFrame::InsertFrames(nsIAtom*  aListName,
+nsHTMLScrollFrame::InsertFrames(ChildListID aListID,
                                 nsIFrame* aPrevFrame,
                                 nsFrameList& aFrameList)
 {
-  NS_ASSERTION(!aListName, "Only main list supported");
+  NS_ASSERTION(aListID == kPrincipalList, "Only main list supported");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
   mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
   mInner.ReloadChildFrames();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLScrollFrame::RemoveFrame(nsIAtom*  aListName,
+nsHTMLScrollFrame::RemoveFrame(ChildListID aListID,
                                nsIFrame* aOldFrame)
 {
-  NS_ASSERTION(!aListName, "Only main list supported");
+  NS_ASSERTION(aListID == kPrincipalList, "Only main list supported");
   mFrames.DestroyFrame(aOldFrame);
   mInner.ReloadChildFrames();
   return NS_OK;
 }
 
 nsSplittableType
 nsHTMLScrollFrame::GetSplittableType() const
 {
@@ -1038,49 +1038,49 @@ nsXULScrollFrame::AppendAnonymousContent
 void
 nsXULScrollFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   mInner.Destroy();
   nsBoxFrame::DestroyFrom(aDestructRoot);
 }
 
 NS_IMETHODIMP
-nsXULScrollFrame::SetInitialChildList(nsIAtom*        aListName,
+nsXULScrollFrame::SetInitialChildList(ChildListID     aListID,
                                       nsFrameList&    aChildList)
 {
-  nsresult rv = nsBoxFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsBoxFrame::SetInitialChildList(aListID, aChildList);
   mInner.ReloadChildFrames();
   return rv;
 }
 
 
 NS_IMETHODIMP
-nsXULScrollFrame::AppendFrames(nsIAtom*        aListName,
+nsXULScrollFrame::AppendFrames(ChildListID     aListID,
                                nsFrameList&    aFrameList)
 {
-  nsresult rv = nsBoxFrame::AppendFrames(aListName, aFrameList);
+  nsresult rv = nsBoxFrame::AppendFrames(aListID, aFrameList);
   mInner.ReloadChildFrames();
   return rv;
 }
 
 NS_IMETHODIMP
-nsXULScrollFrame::InsertFrames(nsIAtom*        aListName,
+nsXULScrollFrame::InsertFrames(ChildListID     aListID,
                                nsIFrame*       aPrevFrame,
                                nsFrameList&    aFrameList)
 {
-  nsresult rv = nsBoxFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+  nsresult rv = nsBoxFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
   mInner.ReloadChildFrames();
   return rv;
 }
 
 NS_IMETHODIMP
-nsXULScrollFrame::RemoveFrame(nsIAtom*        aListName,
+nsXULScrollFrame::RemoveFrame(ChildListID     aListID,
                               nsIFrame*       aOldFrame)
 {
-  nsresult rv = nsBoxFrame::RemoveFrame(aListName, aOldFrame);
+  nsresult rv = nsBoxFrame::RemoveFrame(aListID, aOldFrame);
   mInner.ReloadChildFrames();
   return rv;
 }
 
 nsSplittableType
 nsXULScrollFrame::GetSplittableType() const
 {
   return NS_FRAME_NOT_SPLITTABLE;
@@ -1853,17 +1853,17 @@ nsresult
 nsGfxScrollFrameInner::AppendScrollPartsTo(nsDisplayListBuilder*          aBuilder,
                                            const nsRect&                  aDirtyRect,
                                            const nsDisplayListSet&        aLists,
                                            const nsDisplayListCollection& aDest,
                                            PRBool&                        aCreateLayer)
 {
   nsresult rv = NS_OK;
   PRBool hasResizer = HasResizer();
-  for (nsIFrame* kid = mOuter->GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) {
+  for (nsIFrame* kid = mOuter->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
     if (kid != mScrolledFrame) {
       if (kid == mResizerBox && hasResizer) {
         // skip the resizer as this will be drawn later on top of the scrolled content
         continue;
       }
       rv = mOuter->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aDest,
                                             nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
       NS_ENSURE_SUCCESS(rv, rv);
@@ -2325,17 +2325,17 @@ void
 nsGfxScrollFrameInner::ReloadChildFrames()
 {
   mScrolledFrame = nsnull;
   mHScrollbarBox = nsnull;
   mVScrollbarBox = nsnull;
   mScrollCornerBox = nsnull;
   mResizerBox = nsnull;
 
-  nsIFrame* frame = mOuter->GetFirstChild(nsnull);
+  nsIFrame* frame = mOuter->GetFirstPrincipalChild();
   while (frame) {
     nsIContent* content = frame->GetContent();
     if (content == mOuter->GetContent()) {
       NS_ASSERTION(!mScrolledFrame, "Already found the scrolled frame");
       mScrolledFrame = frame;
     } else {
       nsAutoString value;
       content->GetAttr(kNameSpaceID_None, nsGkAtoms::orient, value);
@@ -3140,17 +3140,17 @@ nsGfxScrollFrameInner::ReflowFinished()
 
   // Update scrollbar attributes.
   nsPresContext* presContext = mOuter->PresContext();
 
   if (mMayHaveDirtyFixedChildren) {
     mMayHaveDirtyFixedChildren = PR_FALSE;
     nsIFrame* parentFrame = mOuter->GetParent();
     for (nsIFrame* fixedChild =
-           parentFrame->GetFirstChild(nsGkAtoms::fixedList);
+           parentFrame->GetFirstChild(nsIFrame::kFixedList);
          fixedChild; fixedChild = fixedChild->GetNextSibling()) {
       // force a reflow of the fixed child
       presContext->PresShell()->
         FrameNeedsReflow(fixedChild, nsIPresShell::eResize,
                          NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
 
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -343,17 +343,17 @@ class nsHTMLScrollFrame : public nsHTMLC
 public:
   friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // Called to set the child frames. We typically have three: the scroll area,
   // the vertical scrollbar, and the horizontal scrollbar.
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists) {
     return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
   }
 
@@ -384,26 +384,26 @@ public:
   
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   // Because there can be only one child frame, these two function return
   // NS_ERROR_FAILURE
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
 
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsIScrollableFrame* GetScrollTargetFrame() {
     return this;
   }
 
   virtual nsIFrame* GetContentInsertionFrame() {
     return mInner.GetScrolledFrame()->GetContentInsertionFrame();
@@ -568,41 +568,41 @@ class nsXULScrollFrame : public nsBoxFra
 public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot);
 
   // Called to set the child frames. We typically have three: the scroll area,
   // the vertical scrollbar, and the horizontal scrollbar.
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists) {
     return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
   }
 
   // XXXldb Is this actually used?
 #if 0
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
 #endif
 
   // Because there can be only one child frame, these two function return
   // NS_ERROR_FAILURE
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsIScrollableFrame* GetScrollTargetFrame() {
     return this;
   }
 
   virtual nsIFrame* GetContentInsertionFrame() {
     return mInner.GetScrolledFrame()->GetContentInsertionFrame();
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -860,17 +860,17 @@ static PRBool AreAllEarlierInFlowFramesE
   if (aFrame == aDescendant) {
     *aFound = PR_TRUE;
     return PR_TRUE;
   }
   if (!aFrame->IsSelfEmpty()) {
     *aFound = PR_FALSE;
     return PR_FALSE;
   }
-  for (nsIFrame* f = aFrame->GetFirstChild(nsnull); f; f = f->GetNextSibling()) {
+  for (nsIFrame* f = aFrame->GetFirstPrincipalChild(); f; f = f->GetNextSibling()) {
     PRBool allEmpty = AreAllEarlierInFlowFramesEmpty(f, aDescendant, aFound);
     if (*aFound || !allEmpty) {
       return allEmpty;
     }
   }
   *aFound = PR_FALSE;
   return PR_TRUE;
 }
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -498,17 +498,17 @@ typedef PRBool nsDidReflowStatus;
                                              // separate rect property
 
 //----------------------------------------------------------------------
 
 /**
  * A frame in the layout model. This interface is supported by all frame
  * objects.
  *
- * Frames can have multiple child lists: the default unnamed child list
+ * Frames can have multiple child lists: the default child list
  * (referred to as the <i>principal</i> child list, and additional named
  * child lists. There is an ordering of frames within a child list, but
  * there is no order defined between frames in different child lists of
  * the same parent frame.
  *
  * Frames are NOT reference counted. Use the Destroy() member function
  * to destroy a frame. The lifetime of the frame hierarchy is bounded by the
  * lifetime of the presentation shell which owns the frames.
@@ -581,89 +581,85 @@ public:
 
   /**
    * Called to set the initial list of frames. This happens after the frame
    * has been initialized.
    *
    * This is only called once for a given child list, and won't be called
    * at all for child lists with no initial list of frames.
    *
-   * @param   aListName the name of the child list. A NULL pointer for the atom
-   *            name means the unnamed principal child list
+   * @param   aListID the child list identifier.
    * @param   aChildList list of child frames. Each of the frames has its
    *            NS_FRAME_IS_DIRTY bit set.  Must not be empty.
    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
    *            name,
    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame or if the
    *            initial list of frames has already been set for that child list,
    *          NS_OK otherwise.  In this case, SetInitialChildList empties out
    *            aChildList in the process of moving the frames over to its own
    *            child list.
    * @see     #Init()
    */
-  NS_IMETHOD  SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD  SetInitialChildList(ChildListID     aListID,
                                   nsFrameList&    aChildList) = 0;
 
   /**
    * This method is responsible for appending frames to the frame
    * list.  The implementation should append the frames to the specified
    * child list and then generate a reflow command.
    *
-   * @param   aListName the name of the child list. A NULL pointer for the atom
-   *            name means the unnamed principal child list
+   * @param   aListID the child list identifier.
    * @param   aFrameList list of child frames to append. Each of the frames has
    *            its NS_FRAME_IS_DIRTY bit set.  Must not be empty.
    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
    *            name,
    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
    *          NS_OK otherwise.  In this case, AppendFrames empties out
    *            aChildList in the process of moving the frames over to its own
    *            child list.
    */
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList) = 0;
 
   /**
    * This method is responsible for inserting frames into the frame
    * list.  The implementation should insert the new frames into the specified
    * child list and then generate a reflow command.
    *
-   * @param   aListName the name of the child list. A NULL pointer for the atom
-   *            name means the unnamed principal child list
+   * @param   aListID the child list identifier.
    * @param   aPrevFrame the frame to insert frames <b>after</b>
    * @param   aFrameList list of child frames to insert <b>after</b> aPrevFrame.
    *            Each of the frames has its NS_FRAME_IS_DIRTY bit set
    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
    *            name,
    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
    *          NS_OK otherwise.  In this case, InsertFrames empties out
    *            aChildList in the process of moving the frames over to its own
    *            child list.
    */
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList) = 0;
 
   /**
    * This method is responsible for removing a frame in the frame
    * list.  The implementation should do something with the removed frame
    * and then generate a reflow command. The implementation is responsible
    * for destroying aOldFrame (the caller mustn't destroy aOldFrame).
    *
-   * @param   aListName the name of the child list. A NULL pointer for the atom
-   *            name means the unnamed principal child list
+   * @param   aListID the child list identifier.
    * @param   aOldFrame the frame to remove
    * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified
    *            name,
    *          NS_ERROR_FAILURE if the child frame is not in the specified
    *            child list,
    *          NS_ERROR_UNEXPECTED if the frame is an atomic frame,
    *          NS_OK otherwise
    */
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame) = 0;
 
   /**
    * Get the content object associated with this frame. Does not add a reference.
    */
   nsIContent* GetContent() const { return mContent; }
 
   /**
@@ -2592,17 +2588,17 @@ NS_PTR_TO_INT32(frame->Properties().Get(
   // convenience.
   virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
                          PRBool aRemoveOverflowAreas = PR_FALSE) = 0;
   NS_HIDDEN_(nsresult) Layout(nsBoxLayoutState& aBoxLayoutState);
   nsIBox* GetChildBox() const
   {
     // box layout ends at box-wrapped frames, so don't allow these frames
     // to report child boxes.
-    return IsBoxFrame() ? GetFirstChild(nsnull) : nsnull;
+    return IsBoxFrame() ? GetFirstPrincipalChild() : nsnull;
   }
   nsIBox* GetNextBox() const
   {
     return (mParent && mParent->IsBoxFrame()) ? mNextSibling : nsnull;
   }
   nsIBox* GetParentBox() const
   {
     return (mParent && mParent->IsBoxFrame()) ? mParent : nsnull;
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -263,17 +263,17 @@ nsInlineFrame::ReparentFloatsForInlineCh
   if (ancestor == aOurLineContainer)
     return;
 
   nsBlockFrame* ourBlock = nsLayoutUtils::GetAsBlock(aOurLineContainer);
   NS_ASSERTION(ourBlock, "Not a block, but broke vertically?");
   nsBlockFrame* frameBlock = nsLayoutUtils::GetAsBlock(ancestor);
   NS_ASSERTION(frameBlock, "ancestor not a block");
 
-  const nsFrameList& blockChildren(ancestor->GetChildList(nsnull));
+  const nsFrameList& blockChildren(ancestor->PrincipalChildList());
   PRBool isOverflow = !blockChildren.ContainsFrame(ancestorBlockChild);
 
   while (PR_TRUE) {
     ourBlock->ReparentFloats(aFrame, frameBlock, isOverflow, PR_FALSE);
 
     if (!aReparentSiblings)
       return;
     nsIFrame* next = aFrame->GetNextSibling();
@@ -523,17 +523,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
           frameManager->ReparentStyleContext(nextInFlow);
         }
       }
 
       // Fix the parent pointer for ::first-letter child frame next-in-flows,
       // so nsFirstLetterFrame::Reflow can destroy them safely (bug 401042).
       nsIFrame* realFrame = nsPlaceholderFrame::GetRealFrameFor(frame);
       if (realFrame->GetType() == nsGkAtoms::letterFrame) {
-        nsIFrame* child = realFrame->GetFirstChild(nsnull);
+        nsIFrame* child = realFrame->GetFirstPrincipalChild();
         if (child) {
           NS_ASSERTION(child->GetType() == nsGkAtoms::textFrame,
                        "unexpected frame type");
           nsIFrame* nextInFlow = child->GetNextInFlow();
           for ( ; nextInFlow; nextInFlow = nextInFlow->GetNextInFlow()) {
             NS_ASSERTION(nextInFlow->GetType() == nsGkAtoms::textFrame,
                          "unexpected frame type");
             if (mFrames.ContainsFrame(nextInFlow)) {
@@ -1130,73 +1130,73 @@ NS_IMPL_FRAMEARENA_HELPERS(nsPositionedI
 void
 nsPositionedInlineFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   mAbsoluteContainer.DestroyFrames(this, aDestructRoot);
   nsInlineFrame::DestroyFrom(aDestructRoot);
 }
 
 NS_IMETHODIMP
-nsPositionedInlineFrame::SetInitialChildList(nsIAtom*        aListName,
+nsPositionedInlineFrame::SetInitialChildList(ChildListID     aListID,
                                              nsFrameList&    aChildList)
 {
   nsresult  rv;
 
-  if (nsGkAtoms::absoluteList == aListName) {
-    rv = mAbsoluteContainer.SetInitialChildList(this, aListName, aChildList);
+  if (kAbsoluteList == aListID) {
+    rv = mAbsoluteContainer.SetInitialChildList(this, aListID, aChildList);
   } else {
-    rv = nsInlineFrame::SetInitialChildList(aListName, aChildList);
+    rv = nsInlineFrame::SetInitialChildList(aListID, aChildList);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsPositionedInlineFrame::AppendFrames(nsIAtom*        aListName,
+nsPositionedInlineFrame::AppendFrames(ChildListID     aListID,
                                       nsFrameList&    aFrameList)
 {
   nsresult  rv;
   
-  if (nsGkAtoms::absoluteList == aListName) {
-    rv = mAbsoluteContainer.AppendFrames(this, aListName, aFrameList);
+  if (kAbsoluteList == aListID) {
+    rv = mAbsoluteContainer.AppendFrames(this, aListID, aFrameList);
   } else {
-    rv = nsInlineFrame::AppendFrames(aListName, aFrameList);
+    rv = nsInlineFrame::AppendFrames(aListID, aFrameList);
   }
 
   return rv;
 }
   
 NS_IMETHODIMP
-nsPositionedInlineFrame::InsertFrames(nsIAtom*        aListName,
+nsPositionedInlineFrame::InsertFrames(ChildListID     aListID,
                                       nsIFrame*       aPrevFrame,
                                       nsFrameList&    aFrameList)
 {
   nsresult  rv;
 
-  if (nsGkAtoms::absoluteList == aListName) {
-    rv = mAbsoluteContainer.InsertFrames(this, aListName, aPrevFrame,
+  if (kAbsoluteList == aListID) {
+    rv = mAbsoluteContainer.InsertFrames(this, aListID, aPrevFrame,
                                          aFrameList);
   } else {
-    rv = nsInlineFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+    rv = nsInlineFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
   }
 
   return rv;
 }
   
 NS_IMETHODIMP
-nsPositionedInlineFrame::RemoveFrame(nsIAtom*        aListName,
+nsPositionedInlineFrame::RemoveFrame(ChildListID     aListID,
                                      nsIFrame*       aOldFrame)
 {
   nsresult  rv;
 
-  if (nsGkAtoms::absoluteList == aListName) {
-    mAbsoluteContainer.RemoveFrame(this, aListName, aOldFrame);
+  if (kAbsoluteList == aListID) {
+    mAbsoluteContainer.RemoveFrame(this, aListID, aOldFrame);
     rv = NS_OK;
   } else {
-    rv = nsInlineFrame::RemoveFrame(aListName, aOldFrame);
+    rv = nsInlineFrame::RemoveFrame(aListID, aOldFrame);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsPositionedInlineFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                           const nsRect&           aDirtyRect,
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -237,40 +237,39 @@ protected:
 
 class nsPositionedInlineFrame : public nsInlineFrame
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   nsPositionedInlineFrame(nsStyleContext* aContext)
     : nsInlineFrame(aContext)
-    , mAbsoluteContainer(nsGkAtoms::absoluteList)
+    , mAbsoluteContainer(kAbsoluteList)
   {}
 
   virtual ~nsPositionedInlineFrame() { } // useful for debugging
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
-                                 nsFrameList&    aChildList);
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
-                          nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
-                          nsIFrame*       aPrevFrame,
-                          nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
-                         nsIFrame*       aOldFrame);
+  NS_IMETHOD SetInitialChildList(ChildListID  aListID,
+                                 nsFrameList& aChildList);
+  NS_IMETHOD AppendFrames(ChildListID  aListID,
+                          nsFrameList& aFrameList);
+  NS_IMETHOD InsertFrames(ChildListID  aListID,
+                          nsIFrame*    aPrevFrame,
+                          nsFrameList& aFrameList);
+  NS_IMETHOD RemoveFrame(ChildListID aListID,
+                         nsIFrame*   aOldFrame);
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
-
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
+  virtual nsFrameList GetChildList(ChildListID aListID) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
   
   virtual nsIAtom* GetType() const;
 
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -2540,17 +2540,17 @@ nsObjectFrame::NotifyContentObjectWrappe
 
   nsHTMLPluginObjElementSH::SetupProtoChain(wrapper, cx, obj);
 }
 
 // static
 nsIObjectFrame *
 nsObjectFrame::GetNextObjectFrame(nsPresContext* aPresContext, nsIFrame* aRoot)
 {
-  nsIFrame* child = aRoot->GetFirstChild(nsnull);
+  nsIFrame* child = aRoot->GetFirstPrincipalChild();
 
   while (child) {
     nsIObjectFrame* outFrame = do_QueryFrame(child);
     if (outFrame) {
       nsRefPtr<nsNPAPIPluginInstance> pi;
       outFrame->GetPluginInstance(getter_AddRefs(pi));  // make sure we have a REAL plugin
       if (pi)
         return outFrame;
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -15,17 +15,17 @@
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -160,18 +160,18 @@ nsPlaceholderFrame::DestroyFrom(nsIFrame
     shell->FrameManager()->UnregisterPlaceholderFrame(this);
     mOutOfFlowFrame = nsnull;
     // If aDestructRoot is not an ancestor of the out-of-flow frame,
     // then call RemoveFrame on it here.
     // Also destroy it here if it's a popup frame. (Bug 96291)
     if (shell->FrameManager() &&
         ((GetStateBits() & PLACEHOLDER_FOR_POPUP) ||
          !nsLayoutUtils::IsProperAncestorFrame(aDestructRoot, oof))) {
-      nsIAtom* listName = nsLayoutUtils::GetChildListNameFor(oof);
-      shell->FrameManager()->RemoveFrame(listName, oof);
+      ChildListID listId = nsLayoutUtils::GetChildListNameFor(oof);
+      shell->FrameManager()->RemoveFrame(listId, oof);
     }
     // else oof will be destroyed by its parent
   }
 
   nsFrame::DestroyFrom(aDestructRoot);
 }
 
 nsIAtom*
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -583,17 +583,17 @@ nsSimplePageSequenceFrame::PrintNextPage
     // I will soon improve this to work with IFrames 
     PRBool  continuePrinting = PR_TRUE;
     nscoord width, height;
     width = PresContext()->GetPageSize().width;
     height = PresContext()->GetPageSize().height;
     height -= mMargin.top + mMargin.bottom;
     width  -= mMargin.left + mMargin.right;
     nscoord selectionY = height;
-    nsIFrame* conFrame = mCurrentPageFrame->GetFirstChild(nsnull);
+    nsIFrame* conFrame = mCurrentPageFrame->GetFirstPrincipalChild();
     if (mSelectionHeight >= 0) {
       conFrame->SetPosition(conFrame->GetPosition() + nsPoint(0, -mYSelOffset));
       nsContainerFrame::PositionChildViews(conFrame);
     }
 
     // cast the frame to be a page frame
     nsPageFrame * pf = static_cast<nsPageFrame*>(mCurrentPageFrame);
     pf->SetPageNumInfo(mPageNum, mTotalPages);
@@ -675,17 +675,17 @@ nsSimplePageSequenceFrame::PaintPageSequ
   nsPoint framePos = aPt;
   aRenderingContext.Translate(framePos);
   rect -= framePos;
   aRenderingContext.Scale(scale, scale);
   rect.ScaleRoundOut(1.0f / scale);
 
   // Now the rect and the rendering coordinates are are relative to this frame.
   // Loop over the pages and paint them.
-  nsIFrame* child = GetFirstChild(nsnull);
+  nsIFrame* child = GetFirstPrincipalChild();
   while (child) {
     nsPoint pt = child->GetPosition();
     // The rendering context has to be translated before each call to PaintFrame
     aRenderingContext.PushState();
     aRenderingContext.Translate(pt);
     nsLayoutUtils::PaintFrame(&aRenderingContext, child,
                               nsRegion(rect - pt), NS_RGBA(0,0,0,0),
                               nsLayoutUtils::PAINT_SYNC_DECODE_IMAGES);
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -1066,17 +1066,17 @@ nsSubDocumentFrame::ObtainIntrinsicSizeF
     if (docShell) {
       nsCOMPtr<nsIPresShell> presShell;
       docShell->GetPresShell(getter_AddRefs(presShell));
       if (presShell) {
         nsIScrollableFrame* scrollable = presShell->GetRootScrollFrameAsScrollable();
         if (scrollable) {
           nsIFrame* scrolled = scrollable->GetScrolledFrame();
           if (scrolled) {
-            subDocRoot = scrolled->GetFirstChild(nsnull);
+            subDocRoot = scrolled->GetFirstPrincipalChild();
           }
         }
       }
     }
 
     if (subDocRoot && subDocRoot->GetContent() &&
         subDocRoot->GetContent()->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) {
       return subDocRoot; // SVG documents have an intrinsic size
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -1062,18 +1062,19 @@ CanTextCrossFrameBoundary(nsIFrame* aFra
       result.mScanSiblings = PR_FALSE;
       result.mTextRunCanCrossFrameBoundary = PR_FALSE;
     } else {
       result.mFrameToScan = nsnull;
       result.mTextRunCanCrossFrameBoundary = PR_TRUE;
     }
   } else {
     if (continuesTextRun) {
-      result.mFrameToScan = aFrame->GetFirstChild(nsnull);
-      result.mOverflowFrameToScan = aFrame->GetFirstChild(nsGkAtoms::overflowList);
+      result.mFrameToScan = aFrame->GetFirstPrincipalChild();
+      result.mOverflowFrameToScan =
+        aFrame->GetFirstChild(nsIFrame::kOverflowList);
       NS_WARN_IF_FALSE(!result.mOverflowFrameToScan,
                        "Scanning overflow inline frames is something we should avoid");
       result.mScanSiblings = PR_TRUE;
       result.mTextRunCanCrossFrameBoundary = PR_TRUE;
       result.mLineBreakerCanCrossFrameBoundary = PR_TRUE;
     } else {
       result.mFrameToScan = nsnull;
       result.mOverflowFrameToScan = nsnull;
@@ -1189,17 +1190,17 @@ BuildTextRuns(gfxContext* aContext, nsTe
 
   if (!block) {
     NS_ASSERTION(!aLineContainer->GetPrevInFlow() && !aLineContainer->GetNextInFlow(),
                  "Breakable non-block line containers not supported");
     // Just loop through all the children of the linecontainer ... it's really
     // just one line
     scanner.SetAtStartOfLine();
     scanner.SetCommonAncestorWithLastFrame(nsnull);
-    nsIFrame* child = aLineContainer->GetFirstChild(nsnull);
+    nsIFrame* child = aLineContainer->GetFirstPrincipalChild();
     while (child) {
       scanner.ScanFrame(child);
       child = child->GetNextSibling();
     }
     // Set mStartOfLine so FlushFrames knows its textrun ends a line
     scanner.SetAtStartOfLine();
     scanner.FlushFrames(PR_TRUE, PR_FALSE);
     return;
@@ -6714,17 +6715,17 @@ nsTextFrame::SetLength(PRInt32 aLength, 
       // the bidi resolver's list of frames
       nsPresContext* presContext = PresContext();
       nsIFrame* newFrame;
       nsresult rv = presContext->PresShell()->FrameConstructor()->
         CreateContinuingFrame(presContext, this, GetParent(), &newFrame);
       if (NS_SUCCEEDED(rv)) {
         nsTextFrame* next = static_cast<nsTextFrame*>(newFrame);
         nsFrameList temp(next, next);
-        GetParent()->InsertFrames(nsGkAtoms::nextBidi, this, temp);
+        GetParent()->InsertFrames(kNoReflowPrincipalList, this, temp);
         f = next;
       }
     }
 
     f->mContentOffset = end;
     if (f->GetTextRun() != mTextRun) {
       ClearTextRun(nsnull);
       f->ClearTextRun(nsnull);
@@ -6756,17 +6757,17 @@ nsTextFrame::SetLength(PRInt32 aLength, 
       // and destroy not only the passed-in frame but also all its following
       // in-flows (and sometimes all its following continuations in general).
       // So we remove |f| from the flow first, to make sure that only |f| is
       // destroyed.
       // We skip this optimization if we were called during bidi resolution,
       // since the bidi resolver may try to handle the destroyed frame later
       // and crash
       nsSplittableFrame::RemoveFromFlow(f);
-      f->GetParent()->RemoveFrame(nsGkAtoms::nextBidi, f);
+      f->GetParent()->RemoveFrame(kNoReflowPrincipalList, f);
     }
     f = next;
   }
 
 #ifdef DEBUG
   f = this;
   PRInt32 iterations = 0;
   while (f && iterations < 10) {
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -69,30 +69,30 @@ ViewportFrame::Init(nsIContent*      aCo
 void
 ViewportFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   mFixedContainer.DestroyFrames(this, aDestructRoot);
   nsContainerFrame::DestroyFrom(aDestructRoot);
 }
 
 NS_IMETHODIMP
-ViewportFrame::SetInitialChildList(nsIAtom*        aListName,
+ViewportFrame::SetInitialChildList(ChildListID     aListID,
                                    nsFrameList&    aChildList)
 {
   nsresult rv = NS_OK;
 
   // See which child list to add the frames to
 #ifdef NS_DEBUG
   nsFrame::VerifyDirtyBitSet(aChildList);
 #endif
-  if (nsGkAtoms::fixedList == aListName) {
-    rv = mFixedContainer.SetInitialChildList(this, aListName, aChildList);
+  if (kFixedList == aListID) {
+    rv = mFixedContainer.SetInitialChildList(this, aListID, aChildList);
   } 
   else {
-    rv = nsContainerFrame::SetInitialChildList(aListName, aChildList);
+    rv = nsContainerFrame::SetInitialChildList(aListID, aChildList);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 ViewportFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
@@ -111,65 +111,65 @@ ViewportFrame::BuildDisplayList(nsDispla
 
   // make the kid's BorderBackground our own. This ensures that the canvas
   // frame's background becomes our own background and therefore appears
   // below negative z-index elements.
   return BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
 }
 
 NS_IMETHODIMP
-ViewportFrame::AppendFrames(nsIAtom*        aListName,
+ViewportFrame::AppendFrames(ChildListID     aListID,
                             nsFrameList&    aFrameList)
 {
   nsresult rv = NS_OK;
 
-  if (nsGkAtoms::fixedList == aListName) {
-    rv = mFixedContainer.AppendFrames(this, aListName, aFrameList);
+  if (kFixedList == aListID) {
+    rv = mFixedContainer.AppendFrames(this, aListID, aFrameList);
   }
   else {
-    NS_ASSERTION(!aListName, "unexpected child list");
-    NS_ASSERTION(GetChildList(nsnull).IsEmpty(), "Shouldn't have any kids!");
-    rv = nsContainerFrame::AppendFrames(aListName, aFrameList);
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
+    NS_ASSERTION(GetChildList(aListID).IsEmpty(), "Shouldn't have any kids!");
+    rv = nsContainerFrame::AppendFrames(aListID, aFrameList);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-ViewportFrame::InsertFrames(nsIAtom*        aListName,
+ViewportFrame::InsertFrames(ChildListID     aListID,
                             nsIFrame*       aPrevFrame,
                             nsFrameList&    aFrameList)
 {
   nsresult rv = NS_OK;
 
-  if (nsGkAtoms::fixedList == aListName) {
-    rv = mFixedContainer.InsertFrames(this, aListName, aPrevFrame, aFrameList);
+  if (kFixedList == aListID) {
+    rv = mFixedContainer.InsertFrames(this, aListID, aPrevFrame, aFrameList);
   }
   else {
-    NS_ASSERTION(!aListName, "unexpected child list");
-    NS_ASSERTION(GetChildList(nsnull).IsEmpty(), "Shouldn't have any kids!");
-    rv = nsContainerFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
+    NS_ASSERTION(GetChildList(aListID).IsEmpty(), "Shouldn't have any kids!");
+    rv = nsContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-ViewportFrame::RemoveFrame(nsIAtom*        aListName,
+ViewportFrame::RemoveFrame(ChildListID     aListID,
                            nsIFrame*       aOldFrame)
 {
   nsresult rv = NS_OK;
 
-  if (nsGkAtoms::fixedList == aListName) {
-    mFixedContainer.RemoveFrame(this, aListName, aOldFrame);
+  if (kFixedList == aListID) {
+    mFixedContainer.RemoveFrame(this, aListID, aOldFrame);
     rv = NS_OK;
   }
   else {
-    NS_ASSERTION(!aListName, "unexpected child list");
-    rv = nsContainerFrame::RemoveFrame(aListName, aOldFrame);
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
+    rv = nsContainerFrame::RemoveFrame(aListID, aOldFrame);
   }
 
   return rv;
 }
 
 nsFrameList
 ViewportFrame::GetChildList(ChildListID aListID) const
 {
--- a/layout/generic/nsViewportFrame.h
+++ b/layout/generic/nsViewportFrame.h
@@ -58,42 +58,41 @@ class nsPresContext;
 class ViewportFrame : public nsContainerFrame {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   typedef nsContainerFrame Super;
 
   ViewportFrame(nsStyleContext* aContext)
     : nsContainerFrame(aContext)
-    , mFixedContainer(nsGkAtoms::fixedList)
+    , mFixedContainer(kFixedList)
   {}
   virtual ~ViewportFrame() { } // useful for debugging
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        asPrevInFlow);
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
-
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
+  virtual nsFrameList GetChildList(ChildListID aListID) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
@@ -116,16 +115,15 @@ public:
 
 #ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
 protected:
   nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const;
 
-protected:
   // position: fixed content is really content which is absolutely positioned with
   // respect to the viewport.
   nsAbsoluteContainingBlock mFixedContainer;
 };
 
 
 #endif // nsViewportFrame_h___
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -249,17 +249,17 @@ nsMathMLContainerFrame::GetPreferredStre
       NS_MATHML_WILL_STRETCH_ALL_CHILDREN_VERTICALLY(mPresentationData.flags) ||
       NS_MATHML_WILL_STRETCH_ALL_CHILDREN_HORIZONTALLY(mPresentationData.flags);
     NS_ASSERTION(NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) ||
                  stretchAll,
                  "invalid call to GetPreferredStretchSize");
     PRBool firstTime = PR_TRUE;
     nsBoundingMetrics bm, bmChild;
     nsIFrame* childFrame =
-      stretchAll ? GetFirstChild(nsnull) : mPresentationData.baseFrame;
+      stretchAll ? GetFirstPrincipalChild() : mPresentationData.baseFrame;
     while (childFrame) {
       // initializations in case this child happens not to be a MathML frame
       nsIMathMLFrame* mathMLFrame = do_QueryFrame(childFrame);
       if (mathMLFrame) {
         nsEmbellishData embellishData;
         nsPresentationData presentationData;
         mathMLFrame->GetEmbellishData(embellishData);
         mathMLFrame->GetPresentationData(presentationData);
@@ -507,17 +507,17 @@ nsMathMLContainerFrame::FinalizeReflow(n
 
   // Place() will call FinishReflowChild() when placeOrigin is true but if
   // it returns before reaching FinishReflowChild() due to errors we need
   // to fulfill the reflow protocol by calling DidReflow for the child frames
   // that still needs it here (or we may crash - bug 366012).
   // If placeOrigin is false we should reach Place() with aPlaceOrigin == true
   // through Stretch() eventually.
   if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) {
-    DidReflowChildren(GetFirstChild(nsnull));
+    DidReflowChildren(GetFirstPrincipalChild());
     return rv;
   }
 
   PRBool parentWillFireStretch = PR_FALSE;
   if (!placeOrigin) {
     // This means the rect.x and rect.y of our children were not set!!
     // Don't go without checking to see if our parent will later fire a Stretch() command
     // targeted at us. The Stretch() will cause the rect.x and rect.y to clear...
@@ -554,17 +554,17 @@ nsMathMLContainerFrame::FinalizeReflow(n
                                 defaultSize);
       }
       Stretch(aRenderingContext, NS_STRETCH_DIRECTION_DEFAULT, defaultSize,
               aDesiredSize);
 #ifdef NS_DEBUG
       {
         // The Place() call above didn't request FinishReflowChild(),
         // so let's check that we eventually did through Stretch().
-        nsIFrame* childFrame = GetFirstChild(nsnull);
+        nsIFrame* childFrame = GetFirstPrincipalChild();
         for ( ; childFrame; childFrame = childFrame->GetNextSibling()) {
           NS_ASSERTION(!(childFrame->GetStateBits() & NS_FRAME_IN_REFLOW),
                        "DidReflow() was never called");
         }
       }
 #endif
     }
   }
@@ -610,17 +610,17 @@ nsMathMLContainerFrame::PropagatePresent
                                         aFlagsToUpdate);
     // propagate using the base method to make sure that the control
     // is passed on to MathML frames that may be overloading the method
     mathMLFrame->UpdatePresentationDataFromChildAt(0, -1,
       aFlagsValues, aFlagsToUpdate);
   }
   else {
     // propagate down the subtrees
-    nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);
+    nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
     while (childFrame) {
       PropagatePresentationDataFor(childFrame,
         aFlagsValues, aFlagsToUpdate);
       childFrame = childFrame->GetNextSibling();
     }
   }
 }
 
@@ -629,17 +629,17 @@ nsMathMLContainerFrame::PropagatePresent
                                                              PRInt32         aFirstChildIndex,
                                                              PRInt32         aLastChildIndex,
                                                              PRUint32        aFlagsValues,
                                                              PRUint32        aFlagsToUpdate)
 {
   if (!aParentFrame || !aFlagsToUpdate)
     return;
   PRInt32 index = 0;
-  nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aParentFrame->GetFirstPrincipalChild();
   while (childFrame) {
     if ((index >= aFirstChildIndex) &&
         ((aLastChildIndex <= 0) || ((aLastChildIndex > 0) &&
          (index <= aLastChildIndex)))) {
       PropagatePresentationDataFor(childFrame,
         aFlagsValues, aFlagsToUpdate);
     }
     index++;
@@ -691,17 +691,17 @@ nsMathMLContainerFrame::BuildDisplayList
 // parent frame may do in its TransmitAutomaticData()).
 /* static */ void
 nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsIFrame* aParentFrame)
 {
   // 1. As we descend the tree, make each child frame inherit data from
   // the parent
   // 2. As we ascend the tree, transmit any specific change that we want
   // down the subtrees
-  nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aParentFrame->GetFirstPrincipalChild();
   while (childFrame) {
     nsIMathMLFrame* childMathMLFrame = do_QueryFrame(childFrame);
     if (childMathMLFrame) {
       childMathMLFrame->InheritAutomaticData(aParentFrame);
     }
     RebuildAutomaticDataForChildren(childFrame);
     childFrame = childFrame->GetNextSibling();
   }
@@ -789,44 +789,44 @@ nsMathMLContainerFrame::ChildListChanged
       // does.
       frame->AddStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
   return ReLayoutChildren(frame);
 }
 
 NS_IMETHODIMP
-nsMathMLContainerFrame::AppendFrames(nsIAtom*        aListName,
+nsMathMLContainerFrame::AppendFrames(ChildListID     aListID,
                                      nsFrameList&    aFrameList)
 {
-  if (aListName) {
+  if (aListID != kPrincipalList) {
     return NS_ERROR_INVALID_ARG;
   }
   mFrames.AppendFrames(this, aFrameList);
   return ChildListChanged(nsIDOMMutationEvent::ADDITION);
 }
 
 NS_IMETHODIMP
-nsMathMLContainerFrame::InsertFrames(nsIAtom*        aListName,
+nsMathMLContainerFrame::InsertFrames(ChildListID     aListID,
                                      nsIFrame*       aPrevFrame,
                                      nsFrameList&    aFrameList)
 {
-  if (aListName) {
+  if (aListID != kPrincipalList) {
     return NS_ERROR_INVALID_ARG;
   }
   // Insert frames after aPrevFrame
   mFrames.InsertFrames(this, aPrevFrame, aFrameList);
   return ChildListChanged(nsIDOMMutationEvent::ADDITION);
 }
 
 NS_IMETHODIMP
-nsMathMLContainerFrame::RemoveFrame(nsIAtom*        aListName,
+nsMathMLContainerFrame::RemoveFrame(ChildListID     aListID,
                                     nsIFrame*       aOldFrame)
 {
-  if (aListName) {
+  if (aListID != kPrincipalList) {
     return NS_ERROR_INVALID_ARG;
   }
   // remove the child frame
   mFrames.DestroyFrame(aOldFrame);
   return ChildListChanged(nsIDOMMutationEvent::REMOVAL);
 }
 
 NS_IMETHODIMP
@@ -1332,17 +1332,17 @@ public:
 
 // We only need one of these so we just make it a static global, no need
 // to dynamically allocate/destroy it.
 static ForceReflow gForceReflow;
 
 void
 nsMathMLContainerFrame::SetIncrementScriptLevel(PRInt32 aChildIndex, PRBool aIncrement)
 {
-  nsIFrame* child = GetChildList(nsnull).FrameAt(aChildIndex);
+  nsIFrame* child = PrincipalChildList().FrameAt(aChildIndex);
   if (!child)
     return;
   nsIContent* content = child->GetContent();
   if (!content->IsMathML())
     return;
   nsMathMLElement* element = static_cast<nsMathMLElement*>(content);
 
   if (element->GetIncrementScriptLevel() == aIncrement)
@@ -1357,17 +1357,17 @@ nsMathMLContainerFrame::SetIncrementScri
 // helpers to fix the inter-spacing when <math> is the only parent
 // e.g., it fixes <math> <mi>f</mi> <mo>q</mo> <mi>f</mi> <mo>I</mo> </math>
 
 static nscoord
 GetInterFrameSpacingFor(PRInt32         aScriptLevel,
                         nsIFrame*       aParentFrame,
                         nsIFrame*       aChildFrame)
 {
-  nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aParentFrame->GetFirstPrincipalChild();
   if (!childFrame || aChildFrame == childFrame)
     return 0;
 
   PRInt32 carrySpace = 0;
   eMathMLFrameType fromFrameType = eMathMLFrameType_UNKNOWN;
   eMathMLFrameType prevFrameType = eMathMLFrameType_UNKNOWN;
   eMathMLFrameType childFrameType = nsMathMLFrame::GetMathMLFrameTypeFor(childFrame);
   childFrame = childFrame->GetNextSibling();
@@ -1432,17 +1432,17 @@ nsMathMLContainerFrame::DidReflowChildre
     return;
 
   for (nsIFrame* frame = aFirst;
        frame != aStop;
        frame = frame->GetNextSibling()) {
     NS_ASSERTION(frame, "aStop isn't a sibling");
     if (frame->GetStateBits() & NS_FRAME_IN_REFLOW) {
       // finish off principal descendants, too
-      nsIFrame* grandchild = frame->GetFirstChild(nsnull);
+      nsIFrame* grandchild = frame->GetFirstPrincipalChild();
       if (grandchild)
         DidReflowChildren(grandchild, nsnull);
 
       frame->DidReflow(frame->PresContext(), nsnull,
                        NS_FRAME_REFLOW_FINISHED);
     }
   }
 }
@@ -1470,17 +1470,17 @@ nsMathMLContainerFrame::TransmitAutomati
   //     containing the same arguments would be an embellished operator;
   //   * an mrow whose arguments consist (in any order) of one embellished
   //     operator and zero or more space-like elements.
   //
   nsIFrame *childFrame, *baseFrame;
   PRBool embellishedOpFound = PR_FALSE;
   nsEmbellishData embellishData;
   
-  for (childFrame = GetFirstChild(nsnull);
+  for (childFrame = GetFirstPrincipalChild();
        childFrame;
        childFrame = childFrame->GetNextSibling()) {
     nsIMathMLFrame* mathMLFrame = do_QueryFrame(childFrame);
     if (!mathMLFrame) break;
     if (!mathMLFrame->IsSpaceLike()) {
       if (embellishedOpFound) break;
       baseFrame = childFrame;
       GetEmbellishDataFrom(baseFrame, embellishData);
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -115,26 +115,26 @@ public:
     return !(aFlags & nsIFrame::eLineParticipant) &&
       nsHTMLContainerFrame::IsFrameOfType(aFlags &
               ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
   }
 
   virtual PRIntn GetSkipSides() const { return 0; }
 
   NS_IMETHOD
-  AppendFrames(nsIAtom*        aListName,
+  AppendFrames(ChildListID     aListID,
                nsFrameList&    aFrameList);
 
   NS_IMETHOD
-  InsertFrames(nsIAtom*        aListName,
+  InsertFrames(ChildListID     aListID,
                nsIFrame*       aPrevFrame,
                nsFrameList&    aFrameList);
 
   NS_IMETHOD
-  RemoveFrame(nsIAtom*        aListName,
+  RemoveFrame(ChildListID     aListID,
               nsIFrame*       aOldFrame);
 
   /**
    * Both GetMinWidth and GetPrefWidth return whatever
    * GetIntrinsicWidth returns.
    */
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
@@ -401,59 +401,59 @@ public:
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsIFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
           nsStyleContext* aContext, PRUint32 aFlags);
 
   // beware, mFrames is not set by nsBlockFrame
   // cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*        aListName,
+  SetInitialChildList(ChildListID     aListID,
                       nsFrameList&    aChildList)
   {
-    NS_ASSERTION(!aListName, "unexpected frame list");
-    nsresult rv = nsBlockFrame::SetInitialChildList(aListName, aChildList);
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list");
+    nsresult rv = nsBlockFrame::SetInitialChildList(aListID, aChildList);
     // re-resolve our subtree to set any mathml-expected data
     nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
     return rv;
   }
 
   NS_IMETHOD
-  AppendFrames(nsIAtom*        aListName,
+  AppendFrames(ChildListID     aListID,
                nsFrameList&    aFrameList)
   {
-    NS_ASSERTION(!aListName || nsGkAtoms::nextBidi == aListName,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
                  "unexpected frame list");
-    nsresult rv = nsBlockFrame::AppendFrames(aListName, aFrameList);
-    if (NS_LIKELY(!aListName))
+    nsresult rv = nsBlockFrame::AppendFrames(aListID, aFrameList);
+    if (NS_LIKELY(aListID == kPrincipalList))
       nsMathMLContainerFrame::ReLayoutChildren(this);
     return rv;
   }
 
   NS_IMETHOD
-  InsertFrames(nsIAtom*        aListName,
+  InsertFrames(ChildListID     aListID,
                nsIFrame*       aPrevFrame,
                nsFrameList&    aFrameList)
   {
-    NS_ASSERTION(!aListName || nsGkAtoms::nextBidi == aListName,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
                  "unexpected frame list");
-    nsresult rv = nsBlockFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
-    if (NS_LIKELY(!aListName))
+    nsresult rv = nsBlockFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
+    if (NS_LIKELY(aListID == kPrincipalList))
       nsMathMLContainerFrame::ReLayoutChildren(this);
     return rv;
   }
 
   NS_IMETHOD
-  RemoveFrame(nsIAtom*        aListName,
+  RemoveFrame(ChildListID     aListID,
               nsIFrame*       aOldFrame)
   {
-    NS_ASSERTION(!aListName || nsGkAtoms::nextBidi == aListName,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
                  "unexpected frame list");
-    nsresult rv = nsBlockFrame::RemoveFrame(aListName, aOldFrame);
-    if (NS_LIKELY(!aListName))
+    nsresult rv = nsBlockFrame::RemoveFrame(aListID, aOldFrame);
+    if (NS_LIKELY(aListID == kPrincipalList))
       nsMathMLContainerFrame::ReLayoutChildren(this);
     return rv;
   }
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const {
     return nsBlockFrame::IsFrameOfType(aFlags &
               ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
   }
@@ -471,59 +471,59 @@ protected:
 
 class nsMathMLmathInlineFrame : public nsInlineFrame {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsIFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*        aListName,
+  SetInitialChildList(ChildListID     aListID,
                       nsFrameList&    aChildList)
   {
-    NS_ASSERTION(!aListName, "unexpected frame list");
-    nsresult rv = nsInlineFrame::SetInitialChildList(aListName, aChildList);
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list");
+    nsresult rv = nsInlineFrame::SetInitialChildList(aListID, aChildList);
     // re-resolve our subtree to set any mathml-expected data
     nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
     return rv;
   }
 
   NS_IMETHOD
-  AppendFrames(nsIAtom*        aListName,
+  AppendFrames(ChildListID     aListID,
                nsFrameList&    aFrameList)
   {
-    NS_ASSERTION(!aListName || nsGkAtoms::nextBidi == aListName,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
                  "unexpected frame list");
-    nsresult rv = nsInlineFrame::AppendFrames(aListName, aFrameList);
-    if (NS_LIKELY(!aListName))
+    nsresult rv = nsInlineFrame::AppendFrames(aListID, aFrameList);
+    if (NS_LIKELY(aListID == kPrincipalList))
       nsMathMLContainerFrame::ReLayoutChildren(this);
     return rv;
   }
 
   NS_IMETHOD
-  InsertFrames(nsIAtom*        aListName,
+  InsertFrames(ChildListID     aListID,
                nsIFrame*       aPrevFrame,
                nsFrameList&    aFrameList)
   {
-    NS_ASSERTION(!aListName || nsGkAtoms::nextBidi == aListName,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
                  "unexpected frame list");
-    nsresult rv = nsInlineFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
-    if (NS_LIKELY(!aListName))
+    nsresult rv = nsInlineFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
+    if (NS_LIKELY(aListID == kPrincipalList))
       nsMathMLContainerFrame::ReLayoutChildren(this);
     return rv;
   }
 
   NS_IMETHOD
-  RemoveFrame(nsIAtom*        aListName,
+  RemoveFrame(ChildListID     aListID,
               nsIFrame*       aOldFrame)
   {
-    NS_ASSERTION(!aListName || nsGkAtoms::nextBidi == aListName,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
                  "unexpected frame list");
-    nsresult rv = nsInlineFrame::RemoveFrame(aListName, aOldFrame);
-    if (NS_LIKELY(!aListName))
+    nsresult rv = nsInlineFrame::RemoveFrame(aListID, aOldFrame);
+    if (NS_LIKELY(aListID == kPrincipalList))
       nsMathMLContainerFrame::ReLayoutChildren(this);
     return rv;
   }
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const {
       return nsInlineFrame::IsFrameOfType(aFlags &
                 ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
   }
--- a/layout/mathml/nsMathMLForeignFrameWrapper.h
+++ b/layout/mathml/nsMathMLForeignFrameWrapper.h
@@ -67,56 +67,56 @@ public:
       aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
     return NS_OK;
   }
 
   // overloaded nsBlockFrame methods
 
 #ifdef NS_DEBUG
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*        aListName,
+  SetInitialChildList(ChildListID     aListID,
                       nsFrameList&    aChildList)
   {
     NS_ASSERTION(aChildList.NotEmpty() && aChildList.GetLength() == 1,
                  "there must be one and only one child frame");
-    return nsBlockFrame::SetInitialChildList(aListName, aChildList);
+    return nsBlockFrame::SetInitialChildList(aListID, aChildList);
   }
 #endif
 
   NS_IMETHOD
   Reflow(nsPresContext*          aPresContext,
          nsHTMLReflowMetrics&     aDesiredSize,
          const nsHTMLReflowState& aReflowState,
          nsReflowStatus&          aStatus);
 
   // we are just a wrapper and these methods shouldn't be called
   NS_IMETHOD
-  AppendFrames(nsIAtom*        aListName,
+  AppendFrames(ChildListID     aListID,
                nsFrameList&    aFrameList)
   {
     NS_NOTREACHED("unsupported operation");
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   NS_IMETHOD
-  InsertFrames(nsIAtom*        aListName,
+  InsertFrames(ChildListID     aListID,
                nsIFrame*       aPrevFrame,
                nsFrameList&    aFrameList)
   {
     NS_NOTREACHED("unsupported operation");
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // Our life is bound to the life of our unique child.
   // When our child goes away, we ask our parent to delete us
   NS_IMETHOD
-  RemoveFrame(nsIAtom*        aListName,
+  RemoveFrame(ChildListID     aListID,
               nsIFrame*       aOldFrame)
   {
-    return mParent->RemoveFrame(aListName, this);
+    return mParent->RemoveFrame(aListID, this);
   }
 
 protected:
   nsMathMLForeignFrameWrapper(nsStyleContext* aContext) : nsBlockFrame(aContext) {}
   virtual ~nsMathMLForeignFrameWrapper() {}
 };
 
 #endif /* nsMathMLForeignFrameWrapper_h___ */
--- a/layout/mathml/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/nsMathMLTokenFrame.cpp
@@ -139,21 +139,21 @@ nsMathMLTokenFrame::Init(nsIContent*    
   // XXX the best fix is to skip these in nsTextFrame
   CompressWhitespace(aContent);
 
   // let the base class do its Init()
   return nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow);
 }
 
 NS_IMETHODIMP
-nsMathMLTokenFrame::SetInitialChildList(nsIAtom*        aListName,
+nsMathMLTokenFrame::SetInitialChildList(ChildListID     aListID,
                                         nsFrameList&    aChildList)
 {
   // First, let the base class do its work
-  nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListID, aChildList);
   if (NS_FAILED(rv))
     return rv;
 
   SetQuotes(PR_FALSE);
   ProcessTextData();
   return rv;
 }
 
@@ -166,29 +166,29 @@ nsMathMLTokenFrame::Reflow(nsPresContext
   nsresult rv = NS_OK;
 
   // initializations needed for empty markup like <mtag></mtag>
   aDesiredSize.width = aDesiredSize.height = 0;
   aDesiredSize.ascent = 0;
   aDesiredSize.mBoundingMetrics = nsBoundingMetrics();
 
   nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
-  nsIFrame* childFrame = GetFirstChild(nsnull);
+  nsIFrame* childFrame = GetFirstPrincipalChild();
   while (childFrame) {
     // ask our children to compute their bounding metrics
     nsHTMLReflowMetrics childDesiredSize(aDesiredSize.mFlags
                                          | NS_REFLOW_CALC_BOUNDING_METRICS);
     nsHTMLReflowState childReflowState(aPresContext, aReflowState,
                                        childFrame, availSize);
     rv = ReflowChild(childFrame, aPresContext, childDesiredSize,
                      childReflowState, aStatus);
     //NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
     if (NS_FAILED(rv)) {
       // Call DidReflow() for the child frames we successfully did reflow.
-      DidReflowChildren(GetFirstChild(nsnull), childFrame);
+      DidReflowChildren(GetFirstPrincipalChild(), childFrame);
       return rv;
     }
 
     SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
                                     childDesiredSize.mBoundingMetrics);
 
     childFrame = childFrame->GetNextSibling();
   }
@@ -206,17 +206,17 @@ nsMathMLTokenFrame::Reflow(nsPresContext
 // pass, it is not computed here because our children may be text frames
 // that do not implement the GetBoundingMetrics() interface.
 /* virtual */ nsresult
 nsMathMLTokenFrame::Place(nsRenderingContext& aRenderingContext,
                           PRBool               aPlaceOrigin,
                           nsHTMLReflowMetrics& aDesiredSize)
 {
   mBoundingMetrics = nsBoundingMetrics();
-  for (nsIFrame* childFrame = GetFirstChild(nsnull); childFrame;
+  for (nsIFrame* childFrame = GetFirstPrincipalChild(); childFrame;
        childFrame = childFrame->GetNextSibling()) {
     nsHTMLReflowMetrics childSize;
     GetReflowAndBoundingMetricsFor(childFrame, childSize,
                                    childSize.mBoundingMetrics, nsnull);
     // compute and cache the bounding metrics
     mBoundingMetrics += childSize.mBoundingMetrics;
   }
 
@@ -228,17 +228,17 @@ nsMathMLTokenFrame::Place(nsRenderingCon
   aDesiredSize.mBoundingMetrics = mBoundingMetrics;
   aDesiredSize.width = mBoundingMetrics.width;
   aDesiredSize.ascent = NS_MAX(mBoundingMetrics.ascent, ascent);
   aDesiredSize.height = aDesiredSize.ascent +
                         NS_MAX(mBoundingMetrics.descent, descent);
 
   if (aPlaceOrigin) {
     nscoord dy, dx = 0;
-    for (nsIFrame* childFrame = GetFirstChild(nsnull); childFrame;
+    for (nsIFrame* childFrame = GetFirstPrincipalChild(); childFrame;
          childFrame = childFrame->GetNextSibling()) {
       nsHTMLReflowMetrics childSize;
       GetReflowAndBoundingMetricsFor(childFrame, childSize,
                                      childSize.mBoundingMetrics);
 
       // place and size the child; (dx,0) makes the caret happy - bug 188146
       dy = childSize.height == 0 ? 0 : aDesiredSize.ascent - childSize.ascent;
       FinishReflowChild(childFrame, PresContext(), nsnull, childSize, dx, dy, 0);
@@ -399,17 +399,17 @@ nsMathMLTokenFrame::SetTextStyle()
 // We also check that we are not relying on null pointers...
 
 static void
 SetQuote(nsIFrame* aFrame, nsString& aValue, PRBool aNotify)
 {
   if (!aFrame)
     return;
 
-  nsIFrame* textFrame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* textFrame = aFrame->GetFirstPrincipalChild();
   if (!textFrame)
     return;
 
   nsIContent* quoteContent = textFrame->GetContent();
   if (!quoteContent->IsNodeOfType(nsINode::eTEXT))
     return;
 
   quoteContent->SetText(aValue, aNotify);
--- a/layout/mathml/nsMathMLTokenFrame.h
+++ b/layout/mathml/nsMathMLTokenFrame.h
@@ -68,17 +68,17 @@ public:
   virtual eMathMLFrameType GetMathMLFrameType();
 
   NS_IMETHOD
   Init(nsIContent*      aContent,
        nsIFrame*        aParent,
        nsIFrame*        aPrevInFlow);
 
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*        aListName,
+  SetInitialChildList(ChildListID     aListID,
                       nsFrameList&    aChildList);
 
   NS_IMETHOD
   Reflow(nsPresContext*          aPresContext,
          nsHTMLReflowMetrics&     aDesiredSize,
          const nsHTMLReflowState& aReflowState,
          nsReflowStatus&          aStatus);
 
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -241,20 +241,20 @@ nsMathMLmactionFrame::GetSelectedFrame()
 
   mChildCount = count;
   mSelection = selection;
 
   return mSelectedFrame;
 }
 
 NS_IMETHODIMP
-nsMathMLmactionFrame::SetInitialChildList(nsIAtom*        aListName,
+nsMathMLmactionFrame::SetInitialChildList(ChildListID     aListID,
                                           nsFrameList&    aChildList)
 {
-  nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListID, aChildList);
 
   // This very first call to GetSelectedFrame() will cause us to be marked as an
   // embellished operator if the selected child is an embellished operator
   if (!GetSelectedFrame()) {
     mActionType = NS_MATHML_ACTION_TYPE_NONE;
   }
   else {
     // create mouse event listener and register it
--- a/layout/mathml/nsMathMLmactionFrame.h
+++ b/layout/mathml/nsMathMLmactionFrame.h
@@ -57,17 +57,17 @@ public:
   TransmitAutomaticData();
 
   NS_IMETHOD
   Init(nsIContent*      aContent,
        nsIFrame*        aParent,
        nsIFrame*        aPrevInFlow);
 
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*        aListName,
+  SetInitialChildList(ChildListID     aListID,
                       nsFrameList&    aChildList);
 
   virtual nsresult
   ChildListChanged(PRInt32 aModType);
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -348,17 +348,17 @@ nsMathMLmencloseFrame::PlaceInternal(nsR
   ///////////////
   // Measure the size of our content using the base class to format like an
   // inferred mrow.
   nsHTMLReflowMetrics baseSize;
   nsresult rv =
     nsMathMLContainerFrame::Place(aRenderingContext, PR_FALSE, baseSize);
 
   if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) {
-      DidReflowChildren(GetFirstChild(nsnull));
+      DidReflowChildren(GetFirstPrincipalChild());
       return rv;
     }
 
   nsBoundingMetrics bmBase = baseSize.mBoundingMetrics;
   nscoord dx_left = 0, dx_right = 0;
   nsBoundingMetrics bmLongdivChar, bmRadicalChar;
   nscoord radicalAscent = 0, radicalDescent = 0;
   nscoord longdivAscent = 0, longdivDescent = 0;
--- a/layout/mathml/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/nsMathMLmfencedFrame.cpp
@@ -77,21 +77,21 @@ nsMathMLmfencedFrame::InheritAutomaticDa
 
   RemoveFencesAndSeparators();
   CreateFencesAndSeparators(PresContext());
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMathMLmfencedFrame::SetInitialChildList(nsIAtom*        aListName,
+nsMathMLmfencedFrame::SetInitialChildList(ChildListID     aListID,
                                           nsFrameList&    aChildList)
 {
   // First, let the base class do its work
-  nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListID, aChildList);
   if (NS_FAILED(rv)) return rv;
 
   // InheritAutomaticData will not get called if our parent is not a mathml
   // frame, so initialize NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY for
   // GetPreferredStretchSize() from Reflow().
   mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
   // No need to track the style contexts given to our MathML chars. 
   // The Style System will use Get/SetAdditionalStyleContext() to keep them
@@ -268,17 +268,17 @@ nsMathMLmfencedFrame::Reflow(nsPresConte
   // the *same* initial aDesiredSize.mBoundingMetrics. If we were to use the base
   // method here, our stretchy frames will be stretched and placed, and we may
   // end up stretching our fences/separators with a different aDesiredSize.
   // XXX The above decision was revisited in bug 121748 and this code can be
   // refactored to use nsMathMLContainerFrame::Reflow() at some stage.
 
   nsReflowStatus childStatus;
   nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
-  nsIFrame* firstChild = GetFirstChild(nsnull);
+  nsIFrame* firstChild = GetFirstPrincipalChild();
   nsIFrame* childFrame = firstChild;
   nscoord ascent = 0, descent = 0;
   if (firstChild || mOpenChar || mCloseChar || mSeparatorsCount > 0) {
     // We use the ASCII metrics to get our minimum height. This way,
     // if we have borders or a background, they will fit better with
     // other elements on the line.
     ascent = fm->MaxAscent();
     descent = fm->MaxDescent();
@@ -601,17 +601,17 @@ nsMathMLmfencedFrame::GetIntrinsicWidth(
 
   if (mOpenChar) {
     width +=
       GetMaxCharWidth(presContext, aRenderingContext, mOpenChar,
                       NS_MATHML_OPERATOR_FORM_PREFIX, font->mScriptLevel, em);
   }
 
   PRInt32 i = 0;
-  nsIFrame* childFrame = GetFirstChild(nsnull);
+  nsIFrame* childFrame = GetFirstPrincipalChild();
   while (childFrame) {
     // XXX This includes margin while Reflow currently doesn't consider
     // margin, so we may end up with too much space, but, with stretchy
     // characters, this is an approximation anyway.
     width += nsLayoutUtils::IntrinsicForContainer(aRenderingContext, childFrame,
                                                   nsLayoutUtils::PREF_WIDTH);
 
     if (i < mSeparatorsCount) {
--- a/layout/mathml/nsMathMLmfencedFrame.h
+++ b/layout/mathml/nsMathMLmfencedFrame.h
@@ -59,17 +59,17 @@ public:
                             nsStyleContext*  aStyleContext);
   virtual nsStyleContext*
   GetAdditionalStyleContext(PRInt32 aIndex) const;
 
   NS_IMETHOD
   InheritAutomaticData(nsIFrame* aParent);
 
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*        aListName,
+  SetInitialChildList(ChildListID     aListID,
                       nsFrameList&    aChildList);
 
   NS_IMETHOD
   Reflow(nsPresContext*          aPresContext,
          nsHTMLReflowMetrics&     aDesiredSize,
          const nsHTMLReflowState& aReflowState,
          nsReflowStatus&          aStatus);
 
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -369,17 +369,17 @@ nsMathMLmpaddedFrame::Reflow(nsPresConte
 /* virtual */ nsresult
 nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
                             PRBool               aPlaceOrigin,
                             nsHTMLReflowMetrics& aDesiredSize)
 {
   nsresult rv =
     nsMathMLContainerFrame::Place(aRenderingContext, PR_FALSE, aDesiredSize);
   if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) {
-    DidReflowChildren(GetFirstChild(nsnull));
+    DidReflowChildren(GetFirstPrincipalChild());
     return rv;
   }
 
   nscoord height = mBoundingMetrics.ascent;
   nscoord depth  = mBoundingMetrics.descent;
   // In MathML2 (http://www.w3.org/TR/MathML2/chapter3.html#presm.mpadded),
   // lspace is "the amount of space between the left edge of a bounding box
   // and the start of the rendering of its contents' bounding box" and the
--- a/layout/mathml/nsMathMLmrowFrame.cpp
+++ b/layout/mathml/nsMathMLmrowFrame.cpp
@@ -77,17 +77,17 @@ nsMathMLmrowFrame::AttributeChanged(PRIn
                                     nsIAtom* aAttribute,
                                     PRInt32  aModType)
 {
   // Special for <mtable>: In the frame construction code, we also use
   // this frame class as a wrapper for mtable. Hence, we should pass the
   // notification to the real mtable
   if (mContent->Tag() == nsGkAtoms::mtable_) {
     nsIFrame* frame = mFrames.FirstChild();
-    for ( ; frame; frame = frame->GetFirstChild(nsnull)) {
+    for ( ; frame; frame = frame->GetFirstPrincipalChild()) {
       // drill down to the real mtable
       if (frame->GetType() == nsGkAtoms::tableOuterFrame)
         return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType);
     }
     NS_NOTREACHED("mtable wrapper without the real table frame");
   }
 
   return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
--- a/layout/mathml/nsMathMLmsubFrame.cpp
+++ b/layout/mathml/nsMathMLmsubFrame.cpp
@@ -125,17 +125,17 @@ nsMathMLmsubFrame::PlaceSubScript (nsPre
   aScriptSpace = NS_MAX(nsPresContext::CSSPixelsToAppUnits(1), aScriptSpace);
 
   ////////////////////////////////////
   // Get the children's desired sizes
 
   nsBoundingMetrics bmBase, bmSubScript;
   nsHTMLReflowMetrics baseSize;
   nsHTMLReflowMetrics subScriptSize;
-  nsIFrame* baseFrame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* baseFrame = aFrame->GetFirstPrincipalChild();
   nsIFrame* subScriptFrame = nsnull;
   if (baseFrame)
     subScriptFrame = baseFrame->GetNextSibling();
   if (!baseFrame || !subScriptFrame || subScriptFrame->GetNextSibling()) {
     // report an error, encourage people to get their markups in order
     return aFrame->ReflowError(aRenderingContext, aDesiredSize);
   }
   GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
--- a/layout/mathml/nsMathMLmsubsupFrame.cpp
+++ b/layout/mathml/nsMathMLmsubsupFrame.cpp
@@ -147,17 +147,17 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(
   // Get the children's desired sizes
 
   nsHTMLReflowMetrics baseSize;
   nsHTMLReflowMetrics subScriptSize;
   nsHTMLReflowMetrics supScriptSize;
   nsBoundingMetrics bmBase, bmSubScript, bmSupScript;
   nsIFrame* subScriptFrame = nsnull;
   nsIFrame* supScriptFrame = nsnull;
-  nsIFrame* baseFrame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* baseFrame = aFrame->GetFirstPrincipalChild();
   if (baseFrame)
     subScriptFrame = baseFrame->GetNextSibling();
   if (subScriptFrame)
     supScriptFrame = subScriptFrame->GetNextSibling();
   if (!baseFrame || !subScriptFrame || !supScriptFrame ||
       supScriptFrame->GetNextSibling()) {
     // report an error, encourage people to get their markups in order
     return aFrame->ReflowError(aRenderingContext, aDesiredSize);
--- a/layout/mathml/nsMathMLmsupFrame.cpp
+++ b/layout/mathml/nsMathMLmsupFrame.cpp
@@ -127,17 +127,17 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPr
 
   ////////////////////////////////////
   // Get the children's desired sizes
 
   nsHTMLReflowMetrics baseSize;
   nsHTMLReflowMetrics supScriptSize;
   nsBoundingMetrics bmBase, bmSupScript;
   nsIFrame* supScriptFrame = nsnull;
-  nsIFrame* baseFrame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* baseFrame = aFrame->GetFirstPrincipalChild();
   if (baseFrame)
     supScriptFrame = baseFrame->GetNextSibling();
   if (!baseFrame || !supScriptFrame || supScriptFrame->GetNextSibling()) {
     // report an error, encourage people to get their markups in order
     return aFrame->ReflowError(aRenderingContext, aDesiredSize);
   }
   GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
   GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize, bmSupScript);
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -276,26 +276,26 @@ MapColAttributesIntoCSS(nsIFrame* aTable
 }
 
 // map all attribues within a table -- requires the indices of rows and cells.
 // so it can only happen after they are made ready by the table base class.
 static void
 MapAllAttributesIntoCSS(nsIFrame* aTableFrame)
 {
   // mtable is simple and only has one (pseudo) row-group
-  nsIFrame* rgFrame = aTableFrame->GetFirstChild(nsnull);
+  nsIFrame* rgFrame = aTableFrame->GetFirstPrincipalChild();
   if (!rgFrame || rgFrame->GetType() != nsGkAtoms::tableRowGroupFrame)
     return;
 
-  nsIFrame* rowFrame = rgFrame->GetFirstChild(nsnull);
+  nsIFrame* rowFrame = rgFrame->GetFirstPrincipalChild();
   for ( ; rowFrame; rowFrame = rowFrame->GetNextSibling()) {
     DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TABLE_ROW);
     if (rowFrame->GetType() == nsGkAtoms::tableRowFrame) {
       MapRowAttributesIntoCSS(aTableFrame, rowFrame);
-      nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull);
+      nsIFrame* cellFrame = rowFrame->GetFirstPrincipalChild();
       for ( ; cellFrame; cellFrame = cellFrame->GetNextSibling()) {
         DEBUG_VERIFY_THAT_FRAME_IS(cellFrame, TABLE_CELL);
         if (IS_TABLE_CELL(cellFrame->GetType())) {
           MapColAttributesIntoCSS(aTableFrame, rowFrame, cellFrame);
         }
       }
     }
   }
@@ -455,17 +455,17 @@ nsMathMLmtableOuterFrame::AttributeChang
   // columnalign   : here 
   // columnlines   : here 
   // columnspacing : not yet supported 
 
   // mtable is simple and only has one (pseudo) row-group inside our inner-table
   nsIFrame* tableFrame = mFrames.FirstChild();
   if (!tableFrame || tableFrame->GetType() != nsGkAtoms::tableFrame)
     return NS_OK;
-  nsIFrame* rgFrame = tableFrame->GetFirstChild(nsnull);
+  nsIFrame* rgFrame = tableFrame->GetFirstPrincipalChild();
   if (!rgFrame || rgFrame->GetType() != nsGkAtoms::tableRowGroupFrame)
     return NS_OK;
 
   // align - just need to issue a dirty (resize) reflow command
   if (aAttribute == nsGkAtoms::align) {
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
     return NS_OK;
@@ -499,24 +499,24 @@ nsMathMLmtableOuterFrame::AttributeChang
     return NS_OK;
 
   nsPresContext* presContext = tableFrame->PresContext();
   // clear any cached nsValueList for this table
   presContext->PropertyTable()->
     Delete(tableFrame, AttributeToProperty(aAttribute));
 
   // unset any _moz attribute that we may have set earlier, and re-sync
-  nsIFrame* rowFrame = rgFrame->GetFirstChild(nsnull);
+  nsIFrame* rowFrame = rgFrame->GetFirstPrincipalChild();
   for ( ; rowFrame; rowFrame = rowFrame->GetNextSibling()) {
     if (rowFrame->GetType() == nsGkAtoms::tableRowFrame) {
       if (MOZrowAtom) { // let rows do the work
         rowFrame->GetContent()->UnsetAttr(kNameSpaceID_None, MOZrowAtom, PR_FALSE);
         MapRowAttributesIntoCSS(tableFrame, rowFrame);    
       } else { // let cells do the work
-        nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull);
+        nsIFrame* cellFrame = rowFrame->GetFirstPrincipalChild();
         for ( ; cellFrame; cellFrame = cellFrame->GetNextSibling()) {
           if (IS_TABLE_CELL(cellFrame->GetType())) {
             cellFrame->GetContent()->UnsetAttr(kNameSpaceID_None, MOZcolAtom, PR_FALSE);
             MapColAttributesIntoCSS(tableFrame, rowFrame, cellFrame);
           }
         }
       }
     }
@@ -545,17 +545,17 @@ nsMathMLmtableOuterFrame::GetRowFrameAt(
     --aRowIndex;
   }
 
   // if our inner table says that the index is valid, find the row now
   if (0 <= aRowIndex && aRowIndex <= rowCount) {
     nsIFrame* tableFrame = mFrames.FirstChild();
     if (!tableFrame || tableFrame->GetType() != nsGkAtoms::tableFrame)
       return nsnull;
-    nsIFrame* rgFrame = tableFrame->GetFirstChild(nsnull);
+    nsIFrame* rgFrame = tableFrame->GetFirstPrincipalChild();
     if (!rgFrame || rgFrame->GetType() != nsGkAtoms::tableRowGroupFrame)
       return nsnull;
     nsTableIterator rowIter(*rgFrame);
     nsIFrame* rowFrame = rowIter.First();
     for ( ; rowFrame; rowFrame = rowIter.Next()) {
       if (aRowIndex == 0) {
         DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TABLE_ROW);
         if (rowFrame->GetType() != nsGkAtoms::tableRowFrame)
@@ -684,20 +684,20 @@ NS_NewMathMLmtableFrame(nsIPresShell* aP
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableFrame)
 
 nsMathMLmtableFrame::~nsMathMLmtableFrame()
 {
 }
 
 NS_IMETHODIMP
-nsMathMLmtableFrame::SetInitialChildList(nsIAtom*  aListName,
+nsMathMLmtableFrame::SetInitialChildList(ChildListID  aListID,
                                          nsFrameList& aChildList)
 {
-  nsresult rv = nsTableFrame::SetInitialChildList(aListName, aChildList);
+  nsresult rv = nsTableFrame::SetInitialChildList(aListID, aChildList);
   if (NS_FAILED(rv)) return rv;
   MapAllAttributesIntoCSS(this);
   return rv;
 }
 
 void
 nsMathMLmtableFrame::RestyleTable()
 {
@@ -750,17 +750,17 @@ nsMathMLmtrFrame::AttributeChanged(PRInt
 
   nsPresContext* presContext = PresContext();
   // Clear any cached columnalign's nsValueList for this row
   presContext->PropertyTable()->Delete(this, AttributeToProperty(aAttribute));
 
   // Clear any internal _moz attribute that we may have set earlier
   // in our cells and re-sync their columnalign attribute
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
-  nsIFrame* cellFrame = GetFirstChild(nsnull);
+  nsIFrame* cellFrame = GetFirstPrincipalChild();
   for ( ; cellFrame; cellFrame = cellFrame->GetNextSibling()) {
     if (IS_TABLE_CELL(cellFrame->GetType())) {
       cellFrame->GetContent()->
         UnsetAttr(kNameSpaceID_None, nsGkAtoms::_moz_math_columnalign_,
                   PR_FALSE);
       MapColAttributesIntoCSS(tableFrame, this, cellFrame);
     }
   }
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -107,43 +107,43 @@ class nsMathMLmtableFrame : public nsTab
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsIFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   // Overloaded nsTableFrame methods
 
   NS_IMETHOD
-  SetInitialChildList(nsIAtom*  aListName,
+  SetInitialChildList(ChildListID  aListID,
                       nsFrameList& aChildList);
 
   NS_IMETHOD
-  AppendFrames(nsIAtom*  aListName,
+  AppendFrames(ChildListID  aListID,
                nsFrameList& aFrameList)
   {
-    nsresult rv = nsTableFrame::AppendFrames(aListName, aFrameList);
+    nsresult rv = nsTableFrame::AppendFrames(aListID, aFrameList);
     RestyleTable();
     return rv;
   }
 
   NS_IMETHOD
-  InsertFrames(nsIAtom*  aListName,
+  InsertFrames(ChildListID aListID,
                nsIFrame* aPrevFrame,
                nsFrameList& aFrameList)
   {
-    nsresult rv = nsTableFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+    nsresult rv = nsTableFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     RestyleTable();
     return rv;
   }
 
   NS_IMETHOD
-  RemoveFrame(nsIAtom*  aListName,
+  RemoveFrame(ChildListID aListID,
               nsIFrame* aOldFrame)
   {
-    nsresult rv = nsTableFrame::RemoveFrame(aListName, aOldFrame);
+    nsresult rv = nsTableFrame::RemoveFrame(aListID, aOldFrame);
     RestyleTable();
     return rv;
   }
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     return nsTableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
   }
@@ -170,39 +170,39 @@ public:
   // overloaded nsTableRowFrame methods
 
   NS_IMETHOD
   AttributeChanged(PRInt32  aNameSpaceID,
                    nsIAtom* aAttribute,
                    PRInt32  aModType);
 
   NS_IMETHOD
-  AppendFrames(nsIAtom*  aListName,
+  AppendFrames(ChildListID  aListID,
                nsFrameList& aFrameList)
   {
-    nsresult rv = nsTableRowFrame::AppendFrames(aListName, aFrameList);
+    nsresult rv = nsTableRowFrame::AppendFrames(aListID, aFrameList);
     RestyleTable();
     return rv;
   }
 
   NS_IMETHOD
-  InsertFrames(nsIAtom*  aListName,
+  InsertFrames(ChildListID aListID,
                nsIFrame* aPrevFrame,
                nsFrameList& aFrameList)
   {
-    nsresult rv = nsTableRowFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+    nsresult rv = nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     RestyleTable();
     return rv;
   }
 
   NS_IMETHOD
-  RemoveFrame(nsIAtom*  aListName,
+  RemoveFrame(ChildListID aListID,
               nsIFrame* aOldFrame)
   {
-    nsresult rv = nsTableRowFrame::RemoveFrame(aListName, aOldFrame);
+    nsresult rv = nsTableRowFrame::RemoveFrame(aListID, aOldFrame);
     RestyleTable();
     return rv;
   }
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     return nsTableRowFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
   }
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -41,16 +41,17 @@
 #include "nsIStringBundle.h"
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
 
 #include "nsISelection.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
+#include "nsIFrame.h"
 #include "nsIURI.h"
 #include "nsITextToSubURI.h"
 #include "nsContentErrors.h"
 
 // Print Options
 #include "nsIPrintSettings.h"
 #include "nsIPrintSettingsService.h"
 #include "nsIPrintOptions.h"
@@ -388,17 +389,17 @@ nsPrintEngine::GetSeqFrameAndCountPagesI
     aSeqFrame = do_QueryFrame(seqFrame);
   } else {
     aSeqFrame = nsnull;
   }
   if (aSeqFrame == nsnull) return NS_ERROR_FAILURE;
 
   // first count the total number of pages
   aCount = 0;
-  nsIFrame* pageFrame = aSeqFrame->GetFirstChild(nsnull);
+  nsIFrame* pageFrame = aSeqFrame->GetFirstPrincipalChild();
   while (pageFrame != nsnull) {
     aCount++;
     pageFrame = pageFrame->GetNextSibling();
   }
 
   return NS_OK;
 
 }
@@ -2088,17 +2089,17 @@ nsPrintEngine::CalcNumPrintablePages(PRI
   // and printable pages
   for (PRUint32 i=0; i<mPrt->mPrintDocList.Length(); i++) {
     nsPrintObject* po = mPrt->mPrintDocList.ElementAt(i);
     NS_ASSERTION(po, "nsPrintObject can't be null!");
     if (po->mPresContext && po->mPresContext->IsRootPaginatedDocument()) {
       nsIPageSequenceFrame* pageSequence = po->mPresShell->GetPageSequenceFrame();
       nsIFrame * seqFrame = do_QueryFrame(pageSequence);
       if (seqFrame) {
-        nsIFrame* frame = seqFrame->GetFirstChild(nsnull);
+        nsIFrame* frame = seqFrame->GetFirstPrincipalChild();
         while (frame) {
           aNumPages++;
           frame = frame->GetNextSibling();
         }
       }
     }
   }
 }
@@ -2675,29 +2676,29 @@ nsPrintEngine::GetPageRangeForSelection(
 
 #ifdef DEBUG_rodsX
   printf("Start Page: %p\n", startPageFrame);
   printf("End Page:   %p\n", endPageFrame);
 
   // dump all the pages and their pointers
   {
   PRInt32 pageNum = 1;
-  nsIFrame* child = seqFrame->GetFirstChild(nsnull);
+  nsIFrame* child = seqFrame->GetFirstPrincipalChild();
   while (child != nsnull) {
     printf("Page: %d - %p\n", pageNum, child);
     pageNum++;
     child = child->GetNextSibling();
   }
   }
 #endif
 
   // Now that we have the page frames
   // find out what the page numbers are for each frame
   PRInt32 pageNum = 1;
-  nsIFrame* page = seqFrame->GetFirstChild(nsnull);
+  nsIFrame* page = seqFrame->GetFirstPrincipalChild();
   while (page != nsnull) {
     if (page == startPageFrame) {
       aStartPageNum = pageNum;
     }
     if (page == endPageFrame) {
       aEndPageNum = pageNum;
     }
     pageNum++;
@@ -3462,17 +3463,17 @@ static void DumpFrames(FILE*            
                        nsIFrame *            aFrame,
                        PRInt32               aLevel)
 {
   NS_ASSERTION(out, "Pointer is null!");
   NS_ASSERTION(aPresContext, "Pointer is null!");
   NS_ASSERTION(aRendContext, "Pointer is null!");
   NS_ASSERTION(aFrame, "Pointer is null!");
 
-  nsIFrame* child = aFrame->GetFirstChild(nsnull);
+  nsIFrame* child = aFrame->GetFirstPrincipalChild();
   while (child != nsnull) {
     for (PRInt32 i=0;i<aLevel;i++) {
      fprintf(out, "  ");
     }
     nsAutoString tmp;
     child->GetFrameName(tmp);
     fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
     PRBool isSelected;
@@ -3604,17 +3605,17 @@ static void DumpPrintObjectsList(nsTArra
     nsIFrame* rootFrame = nsnull;
     if (po->mPresShell) {
       rootFrame = po->mPresShell->FrameManager()->GetRootFrame();
       while (rootFrame != nsnull) {
         nsIPageSequenceFrame * sqf = do_QueryFrame(rootFrame);
         if (sqf) {
           break;
         }
-        rootFrame = rootFrame->GetFirstChild(nsnull);
+        rootFrame = rootFrame->GetFirstPrincipalChild();
       }
     }
 
     PR_PL(("%s %d %d %d %p %p %p %p %p   %d   %d,%d,%d,%d\n", types[po->mFrameType],
             po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mDocShell.get(), po->mSeqFrame,
             po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height));
   }
 }
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -486,17 +486,17 @@ nsComputedDOMStyle::GetPropertyCSSValue(
   if (!mPseudo) {
     mOuterFrame = mContent->GetPrimaryFrame();
     mInnerFrame = mOuterFrame;
     if (mOuterFrame) {
       nsIAtom* type = mOuterFrame->GetType();
       if (type == nsGkAtoms::tableOuterFrame) {
         // If the frame is an outer table frame then we should get the style
         // from the inner table frame.
-        mInnerFrame = mOuterFrame->GetFirstChild(nsnull);
+        mInnerFrame = mOuterFrame->GetFirstPrincipalChild();
         NS_ASSERTION(mInnerFrame, "Outer table must have an inner");
         NS_ASSERTION(!mInnerFrame->GetNextSibling(),
                      "Outer table frames should have just one child, "
                      "the inner table");
       }
 
       mStyleContextHolder = mInnerFrame->GetStyleContext();
       NS_ASSERTION(mStyleContextHolder, "Frame without style context?");
@@ -3183,17 +3183,17 @@ nsComputedDOMStyle::GetAbsoluteOffset(mo
 
     if (container->GetType() == nsGkAtoms::viewportFrame) {
       // For absolutely positioned frames scrollbars are taken into
       // account by virtue of getting a containing block that does
       // _not_ include the scrollbars.  For fixed positioned frames,
       // the containing block is the viewport, which _does_ include
       // scrollbars.  We have to do some extra work.
       // the first child in the default frame list is what we want
-      nsIFrame* scrollingChild = container->GetFirstChild(nsnull);
+      nsIFrame* scrollingChild = container->GetFirstPrincipalChild();
       nsIScrollableFrame *scrollFrame = do_QueryFrame(scrollingChild);
       if (scrollFrame) {
         scrollbarSizes = scrollFrame->GetActualScrollbarSizes();
       }
     }
 
     nscoord offset = 0;
     switch (aSide) {
--- a/layout/svg/base/src/nsSVGClipPathFrame.cpp
+++ b/layout/svg/base/src/nsSVGClipPathFrame.cpp
@@ -250,17 +250,17 @@ nsSVGClipPathFrame::IsValid()
   }
 
   for (nsIFrame* kid = mFrames.FirstChild(); kid;
        kid = kid->GetNextSibling()) {
 
     nsIAtom *type = kid->GetType();
 
     if (type == nsGkAtoms::svgUseFrame) {
-      for (nsIFrame* grandKid = kid->GetFirstChild(nsnull); grandKid;
+      for (nsIFrame* grandKid = kid->GetFirstPrincipalChild(); grandKid;
            grandKid = grandKid->GetNextSibling()) {
 
         nsIAtom *type = grandKid->GetType();
 
         if (type != nsGkAtoms::svgPathGeometryFrame &&
             type != nsGkAtoms::svgTextFrame) {
           return PR_FALSE;
         }
--- a/layout/svg/base/src/nsSVGContainerFrame.cpp
+++ b/layout/svg/base/src/nsSVGContainerFrame.cpp
@@ -53,41 +53,41 @@ NS_NewSVGContainerFrame(nsIPresShell* aP
 {
   return new (aPresShell) nsSVGContainerFrame(aContext);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGContainerFrame)
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGDisplayContainerFrame)
 
 NS_IMETHODIMP
-nsSVGContainerFrame::AppendFrames(nsIAtom* aListName,
+nsSVGContainerFrame::AppendFrames(ChildListID  aListID,
                                   nsFrameList& aFrameList)
 {
-  return InsertFrames(aListName, mFrames.LastChild(), aFrameList);  
+  return InsertFrames(aListID, mFrames.LastChild(), aFrameList);  
 }
 
 NS_IMETHODIMP
-nsSVGContainerFrame::InsertFrames(nsIAtom* aListName,
+nsSVGContainerFrame::InsertFrames(ChildListID aListID,
                                   nsIFrame* aPrevFrame,
                                   nsFrameList& aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
   mFrames.InsertFrames(this, aPrevFrame, aFrameList);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSVGContainerFrame::RemoveFrame(nsIAtom* aListName,
+nsSVGContainerFrame::RemoveFrame(ChildListID aListID,
                                  nsIFrame* aOldFrame)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   mFrames.DestroyFrame(aOldFrame);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSVGContainerFrame::Init(nsIContent* aContent,
                           nsIFrame* aParent,
@@ -107,29 +107,29 @@ nsSVGDisplayContainerFrame::Init(nsICont
     AddStateBits(aParent->GetStateBits() &
       (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD));
   }
   nsresult rv = nsSVGContainerFrameBase::Init(aContent, aParent, aPrevInFlow);
   return rv;
 }
 
 NS_IMETHODIMP
-nsSVGDisplayContainerFrame::InsertFrames(nsIAtom* aListName,
+nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID,
                                          nsIFrame* aPrevFrame,
                                          nsFrameList& aFrameList)
 {
   // memorize first old frame after insertion point
   // XXXbz once again, this would work a lot better if the nsIFrame
   // methods returned framelist iterators....
   nsIFrame* firstOldFrame = aPrevFrame ?
-    aPrevFrame->GetNextSibling() : GetChildList(aListName).FirstChild();
+    aPrevFrame->GetNextSibling() : GetChildList(aListID).FirstChild();
   nsIFrame* firstNewFrame = aFrameList.FirstChild();
   
   // Insert the new frames
-  nsSVGContainerFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+  nsSVGContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
 
   // Call InitialUpdate on the new frames ONLY if our nsSVGOuterSVGFrame has had
   // its initial reflow (our NS_FRAME_FIRST_REFLOW bit is clear) - bug 399863.
   if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
     for (nsIFrame* kid = firstNewFrame; kid != firstOldFrame;
          kid = kid->GetNextSibling()) {
       nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
       if (SVGFrame) {
@@ -137,22 +137,22 @@ nsSVGDisplayContainerFrame::InsertFrames
       }
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSVGDisplayContainerFrame::RemoveFrame(nsIAtom* aListName,
+nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
                                         nsIFrame* aOldFrame)
 {
   nsSVGUtils::InvalidateCoveredRegion(aOldFrame);
 
-  nsresult rv = nsSVGContainerFrame::RemoveFrame(aListName, aOldFrame);
+  nsresult rv = nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame);
 
   if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
     nsSVGUtils::NotifyAncestorsOfFilterRegionChange(this);
   }
 
   return rv;
 }
 
--- a/layout/svg/base/src/nsSVGContainerFrame.h
+++ b/layout/svg/base/src/nsSVGContainerFrame.h
@@ -57,22 +57,22 @@ public:
   NS_DECL_QUERYFRAME_TARGET(nsSVGContainerFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // Returns the transform to our gfxContext (to device pixels, not CSS px)
   virtual gfxMatrix GetCanvasTM() { return gfxMatrix(); }
 
   // nsIFrame:
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     return nsSVGContainerFrameBase::IsFrameOfType(
@@ -88,20 +88,20 @@ protected:
     nsSVGContainerFrame(aContext) {}
 
 public:
   NS_DECL_QUERYFRAME_TARGET(nsSVGDisplayContainerFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // nsIFrame:
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
   // nsISVGChildFrame interface:
   NS_IMETHOD PaintSVG(nsSVGRenderState* aContext,
                       const nsIntRect *aDirtyRect);
--- a/layout/svg/base/src/nsSVGEffects.cpp
+++ b/layout/svg/base/src/nsSVGEffects.cpp
@@ -499,17 +499,17 @@ nsSVGEffects::UpdateEffects(nsIFrame *aF
     GetEffectProperty(style->mMarkerStart, aFrame, MarkerBeginProperty(),
                       CreateMarkerProperty);
     GetEffectProperty(style->mMarkerMid, aFrame, MarkerMiddleProperty(),
                       CreateMarkerProperty);
     GetEffectProperty(style->mMarkerEnd, aFrame, MarkerEndProperty(),
                       CreateMarkerProperty);
   }
 
-  nsIFrame *kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame *kid = aFrame->GetFirstPrincipalChild();
   while (kid) {
     if (kid->GetContent()->IsElement()) {
       UpdateEffects(kid);
     }
     kid = kid->GetNextSibling();
   }
 }
 
--- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
@@ -197,17 +197,17 @@ NS_IMETHODIMP
 nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext,
                                   const nsIntRect *aDirtyRect)
 {
   NS_ABORT_IF_FALSE(aDirtyRect, "We expect aDirtyRect to be non-null");
 
   if (IsDisabled())
     return NS_OK;
 
-  nsIFrame* kid = GetFirstChild(nsnull);
+  nsIFrame* kid = GetFirstPrincipalChild();
   if (!kid)
     return NS_OK;
 
   gfxMatrix matrixForChildren = GetCanvasTMForChildren();
   gfxMatrix matrix = GetCanvasTM();
 
   nsRenderingContext *ctx = aContext->GetRenderingContext(this);
 
@@ -282,17 +282,17 @@ nsSVGForeignObjectFrame::GetTransformMat
 }
  
 NS_IMETHODIMP_(nsIFrame*)
 nsSVGForeignObjectFrame::GetFrameForPoint(const nsPoint &aPoint)
 {
   if (IsDisabled() || (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD))
     return nsnull;
 
-  nsIFrame* kid = GetFirstChild(nsnull);
+  nsIFrame* kid = GetFirstPrincipalChild();
   if (!kid)
     return nsnull;
 
   float x, y, width, height;
   static_cast<nsSVGElement*>(mContent)->
     GetAnimatedLengthValues(&x, &y, &width, &height, nsnull);
 
   gfxMatrix tm = GetCanvasTM().Invert();
@@ -485,17 +485,17 @@ nsSVGForeignObjectFrame::GetCanvasTMForC
 }
 
 void nsSVGForeignObjectFrame::RequestReflow(nsIPresShell::IntrinsicDirty aType)
 {
   if (GetStateBits() & NS_FRAME_FIRST_REFLOW)
     // If we haven't had an InitialUpdate yet, nothing to do.
     return;
 
-  nsIFrame* kid = GetFirstChild(nsnull);
+  nsIFrame* kid = GetFirstPrincipalChild();
   if (!kid)
     return;
 
   PresContext()->PresShell()->FrameNeedsReflow(kid, aType, NS_FRAME_IS_DIRTY);
 }
 
 void nsSVGForeignObjectFrame::UpdateGraphic()
 {
@@ -514,17 +514,17 @@ nsSVGForeignObjectFrame::MaybeReflowFrom
   // early, leaving us with a marked-dirty but not-reflowed kid. That'd be bad;
   // it'd mean that all future calls to this method would be doomed to take the
   // NS_FRAME_IS_DIRTY early-return below. To avoid that problem, we need to
   // bail out *before* we mark our kid as dirty.
   if (IsDisabled()) {
     return;
   }
 
-  nsIFrame* kid = GetFirstChild(nsnull);
+  nsIFrame* kid = GetFirstPrincipalChild();
 
   // If we're already scheduled to reflow (if we or our kid is dirty) we don't
   // want to reflow now or else our presShell will do extra work trying to
   // reflow us a second time. (It will also complain if it finds that a reflow
   // root scheduled for reflow isn't dirty).
 
   if (kid->GetStateBits() & NS_FRAME_IS_DIRTY) {
     return;
@@ -550,17 +550,17 @@ nsSVGForeignObjectFrame::DoReflow()
   if (IsDisabled() &&
       !(GetStateBits() & NS_FRAME_FIRST_REFLOW))
     return;
 
   if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)
     return;
 
   nsPresContext *presContext = PresContext();
-  nsIFrame* kid = GetFirstChild(nsnull);
+  nsIFrame* kid = GetFirstPrincipalChild();
   if (!kid)
     return;
 
   // initiate a synchronous reflow here and now:  
   nsSize availableSpace(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
   nsIPresShell* presShell = presContext->PresShell();
   NS_ASSERTION(presShell, "null presShell");
   nsRefPtr<nsRenderingContext> renderingContext =
--- a/layout/svg/base/src/nsSVGForeignObjectFrame.h
+++ b/layout/svg/base/src/nsSVGForeignObjectFrame.h
@@ -68,17 +68,17 @@ public:
                    nsIFrame*   aParent,
                    nsIFrame*   aPrevInFlow);
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   NS_IMETHOD  AttributeChanged(PRInt32         aNameSpaceID,
                                nsIAtom*        aAttribute,
                                PRInt32         aModType);
 
   virtual nsIFrame* GetContentInsertionFrame() {
-    return GetFirstChild(nsnull)->GetContentInsertionFrame();
+    return GetFirstPrincipalChild()->GetContentInsertionFrame();
   }
 
   NS_IMETHOD Reflow(nsPresContext*           aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   /**
--- a/layout/svg/base/src/nsSVGGlyphFrame.cpp
+++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp
@@ -1031,17 +1031,17 @@ nsSVGGlyphFrame::GetHighlight(PRUint32 *
 void
 nsSVGGlyphFrame::SetGlyphPosition(gfxPoint *aPosition, PRBool aForceGlobalTransform)
 {
   float drawScale, metricsScale;
 
   nsSVGTextPathFrame *textPath = FindTextPathParent();
   // In a textPath, the 'y' attribute has no effect, so we reset 'y' here
   // to use aPosition.y for dy only
-  if (textPath && textPath->GetFirstChild(nsnull) == this) {
+  if (textPath && textPath->GetFirstPrincipalChild() == this) {
     aPosition->y = 0.0;
   }
 
   if (!EnsureTextRun(&drawScale, &metricsScale, aForceGlobalTransform))
     return;
 
   mPosition.MoveTo(aPosition->x, aPosition->y - GetBaselineOffset(metricsScale));
 
@@ -1302,17 +1302,17 @@ nsSVGGlyphFrame::IsAbsolutelyPositioned(
 
     // at the start of a 'text' element
     // at the start of each 'textPath' element
     if (frame->GetType() == nsGkAtoms::svgTextPathFrame) {
       hasTextPathAncestor = PR_TRUE;
     }
     if ((frame->GetType() == nsGkAtoms::svgTextFrame ||
          frame->GetType() == nsGkAtoms::svgTextPathFrame) &&
-        frame->GetFirstChild(nsnull) == this) {
+        frame->GetFirstPrincipalChild() == this) {
         return PR_TRUE;
     }
 
     if (frame->GetType() == nsGkAtoms::svgTextFrame)
       break;
   }
 
   // for each character within a 'text', 'tspan', 'tref' and 'altGlyph' element
--- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
@@ -111,17 +111,17 @@ nsSVGMutationObserver::AttributeChanged(
 }
 
 //----------------------------------------------------------------------
 // Implementation helpers
 
 void
 nsSVGMutationObserver::UpdateTextFragmentTrees(nsIFrame *aFrame)
 {
-  nsIFrame* kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame* kid = aFrame->GetFirstPrincipalChild();
   while (kid) {
     if (kid->GetType() == nsGkAtoms::svgTextFrame) {
       nsSVGTextFrame* textFrame = static_cast<nsSVGTextFrame*>(kid);
       textFrame->NotifyGlyphMetricsChange();
     } else {
       UpdateTextFragmentTrees(kid);
     }
     kid = kid->GetNextSibling();
--- a/layout/svg/base/src/nsSVGTextContainerFrame.cpp
+++ b/layout/svg/base/src/nsSVGTextContainerFrame.cpp
@@ -91,34 +91,34 @@ nsSVGTextContainerFrame::GetRotate()
       GetAnimatedNumberList(nsGkAtoms::rotate);
   return animList ? &animList->GetAnimValue() : nsnull;
 }
 
 //----------------------------------------------------------------------
 // nsIFrame methods
 
 NS_IMETHODIMP
-nsSVGTextContainerFrame::InsertFrames(nsIAtom* aListName,
+nsSVGTextContainerFrame::InsertFrames(ChildListID aListID,
                                       nsIFrame* aPrevFrame,
                                       nsFrameList& aFrameList)
 {
-  nsresult rv = nsSVGDisplayContainerFrame::InsertFrames(aListName,
+  nsresult rv = nsSVGDisplayContainerFrame::InsertFrames(aListID,
                                                          aPrevFrame,
                                                          aFrameList);
 
   NotifyGlyphMetricsChange();
   return rv;
 }
 
 NS_IMETHODIMP
-nsSVGTextContainerFrame::RemoveFrame(nsIAtom *aListName, nsIFrame *aOldFrame)
+nsSVGTextContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame *aOldFrame)
 {
   nsSVGTextFrame *textFrame = GetTextFrame();
 
-  nsresult rv = nsSVGDisplayContainerFrame::RemoveFrame(aListName, aOldFrame);
+  nsresult rv = nsSVGDisplayContainerFrame::RemoveFrame(aListID, aOldFrame);
 
   if (textFrame)
     textFrame->NotifyGlyphMetricsChange();
 
   return rv;
 }
 
 NS_IMETHODIMP
--- a/layout/svg/base/src/nsSVGTextContainerFrame.h
+++ b/layout/svg/base/src/nsSVGTextContainerFrame.h
@@ -55,20 +55,20 @@ public:
   virtual void GetDxDy(SVGUserUnitList *aDx, SVGUserUnitList *aDy);
   virtual const SVGNumberList *GetRotate();
   
   NS_DECL_QUERYFRAME_TARGET(nsSVGTextContainerFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // nsIFrame
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom *aListName, nsIFrame *aOldFrame);
+  NS_IMETHOD RemoveFrame(ChildListID aListID, nsIFrame *aOldFrame);
 
   NS_IMETHOD GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval);
   NS_IMETHOD GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval);
   NS_IMETHOD GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval);
   NS_IMETHOD GetRotationOfChar(PRUint32 charnum, float *_retval);
 
   /*
    * Returns the number of characters in a string
--- a/layout/svg/base/src/nsSVGUtils.cpp
+++ b/layout/svg/base/src/nsSVGUtils.cpp
@@ -869,17 +869,17 @@ nsSVGUtils::GetCanvasTM(nsIFrame *aFrame
   }
 
   return static_cast<nsSVGGeometryFrame*>(aFrame)->GetCanvasTM();
 }
 
 void 
 nsSVGUtils::NotifyChildrenOfSVGChange(nsIFrame *aFrame, PRUint32 aFlags)
 {
-  nsIFrame *kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame *kid = aFrame->GetFirstPrincipalChild();
 
   while (kid) {
     nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
     if (SVGFrame) {
       SVGFrame->NotifySVGChanged(aFlags); 
     } else {
       NS_ASSERTION(kid->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected");
       // recurse into the children of container frames e.g. <clipPath>, <mask>
@@ -1082,17 +1082,17 @@ nsSVGUtils::HitTestClip(nsIFrame *aFrame
 }
 
 nsIFrame *
 nsSVGUtils::HitTestChildren(nsIFrame *aFrame, const nsPoint &aPoint)
 {
   // Traverse the list in reverse order, so that if we get a hit we know that's
   // the topmost frame that intersects the point; then we can just return it.
   nsIFrame* result = nsnull;
-  for (nsIFrame* current = aFrame->GetChildList(nsnull).LastChild();
+  for (nsIFrame* current = aFrame->PrincipalChildList().LastChild();
        current;
        current = current->GetPrevSibling()) {
     nsISVGChildFrame* SVGFrame = do_QueryFrame(current);
     if (SVGFrame) {
        result = SVGFrame->GetFrameForPoint(aPoint);
        if (result)
          break;
     }
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -1634,17 +1634,17 @@ void nsCellMap::CollapseZeroColSpan(nsTa
   }
 }
 
 PRBool nsCellMap::CellsSpanOut(nsTArray<nsTableRowFrame*>& aRows) const
 {
   PRInt32 numNewRows = aRows.Length();
   for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) {
     nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX);
-    nsIFrame* childFrame = rowFrame->GetFirstChild(nsnull);
+    nsIFrame* childFrame = rowFrame->GetFirstPrincipalChild();
     while (childFrame) {
       nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
       if (cellFrame) {
         PRBool zeroSpan;
         PRInt32 rowSpan = GetRowSpanForNewCell(cellFrame, rowX, zeroSpan);
         if (zeroSpan || rowX + rowSpan > numNewRows) {
           return PR_TRUE;
         }
@@ -1808,17 +1808,17 @@ nsCellMap::ExpandWithRows(nsTableCellMap
     return;
   }
 
 
   PRInt32 newRowIndex = 0;
   for (PRInt32 rowX = startRowIndex; rowX <= endRowIndex; rowX++) {
     nsTableRowFrame* rFrame = aRowFrames.ElementAt(newRowIndex);
     // append cells
-    nsIFrame* cFrame = rFrame->GetFirstChild(nsnull);
+    nsIFrame* cFrame = rFrame->GetFirstPrincipalChild();
     PRInt32 colIndex = 0;
     while (cFrame) {
       nsTableCellFrame *cellFrame = do_QueryFrame(cFrame);
       if (cellFrame) {
         AppendCell(aMap, cellFrame, rowX, PR_FALSE, aDamageArea, &colIndex);
       }
       cFrame = cFrame->GetNextSibling();
     }
@@ -2271,17 +2271,17 @@ nsCellMap::RebuildConsideringRows(nsTabl
   // Now handle the new rows being inserted, if any.
   PRUint32 copyStartRowIndex;
   rowX = aStartRowIndex;
   if (aRowsToInsert) {
     // add in the new cells and create rows if necessary
     PRInt32 numNewRows = aRowsToInsert->Length();
     for (PRInt32 newRowX = 0; newRowX < numNewRows; newRowX++) {
       nsTableRowFrame* rFrame = aRowsToInsert->ElementAt(newRowX);
-      nsIFrame* cFrame = rFrame->GetFirstChild(nsnull);
+      nsIFrame* cFrame = rFrame->GetFirstPrincipalChild();
       while (cFrame) {
         nsTableCellFrame *cellFrame = do_QueryFrame(cFrame);
         if (cellFrame) {
           AppendCell(aMap, cellFrame, rowX, PR_FALSE, aDamageArea);
         }
         cFrame = cFrame->GetNextSibling();
       }
       rowX++;
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -255,34 +255,34 @@ nsTableCellFrame::DidSetStyleContext(nsS
     GetRowIndex(rowIndex);
     nsRect damageArea(colIndex, rowIndex, GetColSpan(), GetRowSpan());
     tableFrame->SetBCDamageArea(damageArea);
   }
 }
 
 
 NS_IMETHODIMP
-nsTableCellFrame::AppendFrames(nsIAtom*        aListName,
+nsTableCellFrame::AppendFrames(ChildListID     aListID,
                                nsFrameList&    aFrameList)
 {
   NS_PRECONDITION(PR_FALSE, "unsupported operation");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsTableCellFrame::InsertFrames(nsIAtom*        aListName,
+nsTableCellFrame::InsertFrames(ChildListID     aListID,
                                nsIFrame*       aPrevFrame,
                                nsFrameList&    aFrameList)
 {
   NS_PRECONDITION(PR_FALSE, "unsupported operation");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsTableCellFrame::RemoveFrame(nsIAtom*        aListName,
+nsTableCellFrame::RemoveFrame(ChildListID     aListID,
                               nsIFrame*       aOldFrame)
 {
   NS_PRECONDITION(PR_FALSE, "unsupported operation");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 void nsTableCellFrame::SetColIndex(PRInt32 aColIndex)
 {
@@ -643,17 +643,17 @@ nsTableCellFrame::CellHasVisibleContent(
                                         nsTableFrame* tableFrame,
                                         nsIFrame*     kidFrame)
 {
   // see  http://www.w3.org/TR/CSS21/tables.html#empty-cells
   if (height > 0)
     return PR_TRUE;
   if (tableFrame->IsBorderCollapse())
     return PR_TRUE;
-  nsIFrame* innerFrame = kidFrame->GetFirstChild(nsnull);
+  nsIFrame* innerFrame = kidFrame->GetFirstPrincipalChild();
   while(innerFrame) {
     nsIAtom* frameType = innerFrame->GetType();
     if (nsGkAtoms::textFrame == frameType) {
        nsTextFrame* textFrame = static_cast<nsTextFrame*>(innerFrame);
        if (textFrame->HasNoncollapsedCharacters())
          return PR_TRUE;
     }
     else if (nsGkAtoms::placeholderFrame != frameType) {
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -94,26 +94,26 @@ public:
                                PRInt32         aModType);
 
   /** @see nsIFrame::DidSetStyleContext */
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
 
   // table cells contain a block frame which does most of the work, and
   // so these functions should never be called. They assert and return
   // NS_ERROR_NOT_IMPLEMENTED
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsIFrame* GetContentInsertionFrame() {
-    return GetFirstChild(nsnull)->GetContentInsertionFrame();
+    return GetFirstPrincipalChild()->GetContentInsertionFrame();
   }
 
   virtual nsMargin GetUsedMargin() const;
 
   virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState);
 
   virtual PRBool NeedsToObserve(const nsHTMLReflowState& aReflowState);
 
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -76,17 +76,17 @@ void nsTableColGroupFrame::ResetColIndic
       // aFirstColIndex is smaller than the existing starting col index
       if ((colIndex != aFirstColIndex) ||
           (colIndex < colGroupFrame->GetStartColumnIndex()) ||
           !aStartColFrame) {
         colGroupFrame->SetStartColumnIndex(colIndex);
       }
       nsIFrame* colFrame = aStartColFrame; 
       if (!colFrame || (colIndex != aFirstColIndex)) {
-        colFrame = colGroupFrame->GetFirstChild(nsnull);
+        colFrame = colGroupFrame->GetFirstPrincipalChild();
       }
       while (colFrame) {
         if (nsGkAtoms::tableColFrame == colFrame->GetType()) {
           ((nsTableColFrame*)colFrame)->SetColIndex(colIndex);
           colIndex++;
         }
         colFrame = colFrame->GetNextSibling();
       }
@@ -157,27 +157,27 @@ nsTableColGroupFrame::GetLastRealColGrou
     return static_cast<nsTableColGroupFrame*>(nextToLastColGroup);
   }
  
   return static_cast<nsTableColGroupFrame*>(link.PrevFrame());
 }
 
 // don't set mColCount here, it is done in AddColsToTable
 NS_IMETHODIMP
-nsTableColGroupFrame::SetInitialChildList(nsIAtom*        aListName,
+nsTableColGroupFrame::SetInitialChildList(ChildListID     aListID,
                                           nsFrameList&    aChildList)
 {
   if (!mFrames.IsEmpty()) {
     // We already have child frames which means we've already been
     // initialized
     NS_NOTREACHED("unexpected second call to SetInitialChildList");
     return NS_ERROR_UNEXPECTED;
   }
-  if (aListName) {
-    // All we know about is the unnamed principal child list
+  if (aListID != kPrincipalList) {
+    // All we know about is the principal child list.
     NS_NOTREACHED("unknown frame list");
     return NS_ERROR_INVALID_ARG;
   } 
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (!tableFrame)
     return NS_ERROR_NULL_POINTER;
 
   if (aChildList.IsEmpty()) {
@@ -206,45 +206,45 @@ nsTableColGroupFrame::DidSetStyleContext
     nsRect damageArea(GetFirstColumn()->GetColIndex(), 0, colCount,
                       tableFrame->GetRowCount());
     tableFrame->SetBCDamageArea(damageArea);
   }
   return;
 }
 
 NS_IMETHODIMP
-nsTableColGroupFrame::AppendFrames(nsIAtom*        aListName,
+nsTableColGroupFrame::AppendFrames(ChildListID     aListID,
                                    nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   nsTableColFrame* col = GetFirstColumn();
   nsTableColFrame* nextCol;
   while (col && col->GetColType() == eColAnonymousColGroup) {
     // this colgroup spans one or more columns but now that there is a
     // real column below, spanned anonymous columns should be removed,
     // since the HTML spec says to ignore the span of a colgroup if it
     // has content columns in it.
     nextCol = col->GetNextCol();
-    RemoveFrame(nsnull, col);
+    RemoveFrame(kPrincipalList, col);
     col = nextCol;
   }
 
   const nsFrameList::Slice& newFrames =
     mFrames.AppendFrames(this, aFrameList);
   InsertColsReflow(GetStartColumnIndex() + mColCount, newFrames);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableColGroupFrame::InsertFrames(nsIAtom*        aListName,
+nsTableColGroupFrame::InsertFrames(ChildListID     aListID,
                                    nsIFrame*       aPrevFrame,
                                    nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
   nsTableColFrame* col = GetFirstColumn();
   nsTableColFrame* nextCol;
   while (col && col->GetColType() == eColAnonymousColGroup) {
     // this colgroup spans one or more columns but now that there is a
     // real column below, spanned anonymous columns should be removed,
@@ -253,17 +253,17 @@ nsTableColGroupFrame::InsertFrames(nsIAt
     nextCol = col->GetNextCol();
     if (col == aPrevFrame) {
       // This can happen when we're being appended to
       NS_ASSERTION(!nextCol || nextCol->GetColType() != eColAnonymousColGroup,
                    "Inserting in the middle of our anonymous cols?");
       // We'll want to insert at the beginning
       aPrevFrame = nsnull;
     }
-    RemoveFrame(nsnull, col);
+    RemoveFrame(kPrincipalList, col);
     col = nextCol;
   }
 
   NS_ASSERTION(!aPrevFrame || aPrevFrame == aPrevFrame->GetLastContinuation(),
                "Prev frame should be last in continuation chain");
   NS_ASSERTION(!aPrevFrame || !GetNextColumn(aPrevFrame) ||
                GetNextColumn(aPrevFrame)->GetColType() != eColAnonymousCol,
                "Shouldn't be inserting before a spanned colframe");
@@ -314,20 +314,20 @@ nsTableColGroupFrame::RemoveChild(nsTabl
   }
 
   PresContext()->PresShell()->FrameNeedsReflow(this,
                                                nsIPresShell::eTreeChange,
                                                NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 NS_IMETHODIMP
-nsTableColGroupFrame::RemoveFrame(nsIAtom*        aListName,
+nsTableColGroupFrame::RemoveFrame(ChildListID     aListID,
                                   nsIFrame*       aOldFrame)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   if (!aOldFrame) return NS_OK;
   PRBool contentRemoval = PR_FALSE;
   
   if (nsGkAtoms::tableColFrame == aOldFrame->GetType()) {
     nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame;
     if (colFrame->GetColType() == eColContent) {
       contentRemoval = PR_TRUE;
@@ -347,17 +347,17 @@ nsTableColGroupFrame::RemoveFrame(nsIAto
                        "How did that happen??");
         }
         // else colFrame is being removed because of a frame
         // reconstruct on it, and its style context is still the old
         // one, so we can't assert anything about how it compares to
         // col's style context.
 #endif
         nextCol = col->GetNextCol();
-        RemoveFrame(nsnull, col);
+        RemoveFrame(kPrincipalList, col);
         col = nextCol;
       }
     }
     
     PRInt32 colIndex = colFrame->GetColIndex();
     // The RemoveChild call handles calling FrameNeedsReflow on us.
     RemoveChild(*colFrame, PR_TRUE);
     
--- a/layout/tables/nsTableColGroupFrame.h
+++ b/layout/tables/nsTableColGroupFrame.h
@@ -68,17 +68,17 @@ public:
     *
     * @return           the frame that was created
     */
   friend nsIFrame* NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   /** Initialize the colgroup frame with a set of children.
     * @see nsIFrame::SetInitialChildList
     */
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
   /**
    * ColGroups never paint anything, nor receive events.
    */
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists) { return NS_OK; }
@@ -108,22 +108,22 @@ public:
     */
   static nsTableColGroupFrame* GetLastRealColGroup(nsTableFrame* aTableFrame);
 
   /** @see nsIFrame::DidSetStyleContext */
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
 
   /** @see nsIFrame::AppendFrames, InsertFrames, RemoveFrame
     */
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   /** remove the column aChild from the column group, if requested renumber
     * the subsequent columns in this column group and all following column
     * groups. see also ResetColIndices for this
     * @param aChild       - the column frame that needs to be removed
     * @param aResetSubsequentColIndices - if true the columns that follow
     *                                     after aChild will be reenumerated
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -17,17 +17,17 @@
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Pierre Phaneuf <pp@ludusdesign.com>
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -308,28 +308,28 @@ nsTableFrame::PageBreakAfter(nsIFrame* a
     }
   }
   return PR_FALSE;
 }
 
 // XXX this needs to be cleaned up so that the frame constructor breaks out col group
 // frames into a separate child list, bug 343048.
 NS_IMETHODIMP
-nsTableFrame::SetInitialChildList(nsIAtom*        aListName,
+nsTableFrame::SetInitialChildList(ChildListID     aListID,
                                   nsFrameList&    aChildList)
 {
 
   if (!mFrames.IsEmpty() || !mColGroups.IsEmpty()) {
     // We already have child frames which means we've already been
     // initialized
     NS_NOTREACHED("unexpected second call to SetInitialChildList");
     return NS_ERROR_UNEXPECTED;
   }
-  if (aListName) {
-    // All we know about is the unnamed principal child list
+  if (aListID != kPrincipalList) {
+    // All we know about is the principal child list.
     NS_NOTREACHED("unknown frame list");
     return NS_ERROR_INVALID_ARG;
   }
 
   // XXXbz the below code is an icky cesspit that's only needed in its current
   // form for two reasons:
   // 1) Both rowgroups and column groups come in on the principal child list.
   while (aChildList.NotEmpty()) {
@@ -530,17 +530,17 @@ void nsTableFrame::ResetRowIndices(const
   while (!excludeRowGroupsEnumerator.AtEnd()) {
     excludeRowGroups.PutEntry(static_cast<nsTableRowGroupFrame*>(excludeRowGroupsEnumerator.get()));
     excludeRowGroupsEnumerator.Next();
   }
 
   for (PRUint32 rgX = 0; rgX < rowGroups.Length(); rgX++) {
     nsTableRowGroupFrame* rgFrame = rowGroups[rgX];
     if (!excludeRowGroups.GetEntry(rgFrame)) {
-      const nsFrameList& rowFrames = rgFrame->GetChildList(nsnull);
+      const nsFrameList& rowFrames = rgFrame->PrincipalChildList();
       for (nsFrameList::Enumerator rows(rowFrames); !rows.AtEnd(); rows.Next()) {
         if (NS_STYLE_DISPLAY_TABLE_ROW==rows.get()->GetStyleDisplay()->mDisplay) {
           ((nsTableRowFrame *)rows.get())->SetRowIndex(rowIndex);
           rowIndex++;
         }
       }
     }
   }
@@ -559,17 +559,17 @@ void nsTableFrame::InsertColGroups(PRInt
     // why the old code used pointer-to-last-frame as opposed to
     // pointer-to-frame-after-last....
 
     // How about dealing with this by storing a const reference to the
     // mNextSibling of the framelist's last frame, instead of storing a pointer
     // to the first-after-next frame?  Will involve making nsFrameList friend
     // of nsIFrame, but it's time for that anyway.
     cgFrame->AddColsToTable(colIndex, PR_FALSE,
-                              colGroups.get()->GetChildList(nsnull));
+                              colGroups.get()->PrincipalChildList());
     PRInt32 numCols = cgFrame->GetColCount();
     colIndex += numCols;
   }
 
   nsFrameList::Enumerator remainingColgroups = colGroups.GetUnlimitedEnumerator();
   if (!remainingColgroups.AtEnd()) {
     nsTableColGroupFrame::ResetColIndices(
       static_cast<nsTableColGroupFrame*>(remainingColgroups.get()), colIndex);
@@ -985,17 +985,17 @@ void nsTableFrame::RemoveRows(nsTableRow
 
 // collect the rows ancestors of aFrame
 PRInt32
 nsTableFrame::CollectRows(nsIFrame*                   aFrame,
                           nsTArray<nsTableRowFrame*>& aCollection)
 {
   NS_PRECONDITION(aFrame, "null frame");
   PRInt32 numRows = 0;
-  nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
   while (childFrame) {
     aCollection.AppendElement(static_cast<nsTableRowFrame*>(childFrame));
     numRows++;
     childFrame = childFrame->GetNextSibling();
   }
   return numRows;
 }
 
@@ -1167,17 +1167,17 @@ nsTableFrame::GenericTraversal(nsDisplay
   // This is similar to what nsContainerFrame::BuildDisplayListForNonBlockChildren
   // does, except that we allow the children's background and borders to go
   // in our BorderBackground list. This doesn't really affect background
   // painting --- the children won't actually draw their own backgrounds
   // because the nsTableFrame already drew them, unless a child has its own
   // stacking context, in which case the child won't use its passed-in
   // BorderBackground list anyway. It does affect cell borders though; this
   // lets us get cell borders into the nsTableFrame's BorderBackground list.
-  nsIFrame* kid = aFrame->GetFirstChild(nsnull);
+  nsIFrame* kid = aFrame->GetFirstPrincipalChild();
   while (kid) {
     nsresult rv = aFrame->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
     kid = kid->GetNextSibling();
   }
   return NS_OK;
 }
 
@@ -1273,17 +1273,17 @@ AnyTablePartHasBorderOrBackground(nsIFra
          f->GetStyleDisplay()->mAppearance ||
          f->HasBorder()))
       return PR_TRUE;
 
     nsTableCellFrame *cellFrame = do_QueryFrame(f);
     if (cellFrame)
       continue;
 
-    if (AnyTablePartHasBorderOrBackground(f->GetChildList(nsnull).FirstChild(), nsnull))
+    if (AnyTablePartHasBorderOrBackground(f->PrincipalChildList().FirstChild(), nsnull))
       return PR_TRUE;
   }
 
   return PR_FALSE;
 }
 
 // table paint code is concerned primarily with borders and bg color
 // SEC: TODO: adjust the rect for captions
@@ -1438,17 +1438,17 @@ nsTableFrame::ProcessRowInserted(nscoord
 {
   SetRowInserted(PR_FALSE); // reset the bit that got us here
   nsTableFrame::RowGroupArray rowGroups;
   OrderRowGroups(rowGroups);
   // find the row group containing the inserted row
   for (PRUint32 rgX = 0; rgX < rowGroups.Length(); rgX++) {
     nsTableRowGroupFrame* rgFrame = rowGroups[rgX];
     NS_ASSERTION(rgFrame, "Must have rgFrame here");
-    nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull);
+    nsIFrame* childFrame = rgFrame->GetFirstPrincipalChild();
     // find the row that was inserted first
     while (childFrame) {
       nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
       if (rowFrame) {
         if (rowFrame->IsFirstInserted()) {
           rowFrame->SetFirstInserted(PR_FALSE);
           // damage the table from the 1st row inserted to the end of the table
           nscoord damageY = rgFrame->GetPosition().y + rowFrame->GetPosition().y;
@@ -1823,17 +1823,17 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
       }
       haveDesiredHeight = PR_TRUE;
 
       mutable_rs.mFlags.mSpecialHeightReflow = PR_FALSE;
     }
   }
   else {
     // Calculate the overflow area contribution from our children.
-    for (nsIFrame* kid = GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) {
+    for (nsIFrame* kid = GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
       ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kid);
     }
   }
 
   aDesiredSize.width = aReflowState.ComputedWidth() +
                        aReflowState.mComputedBorderPadding.LeftRight();
   if (!haveDesiredHeight) {
     CalcDesiredHeight(aReflowState, aDesiredSize);
@@ -2078,20 +2078,20 @@ nsTableFrame::DidSetStyleContext(nsStyle
        mTableLayoutStrategy = temp;
      }
   }
 }
 
 
 
 NS_IMETHODIMP
-nsTableFrame::AppendFrames(nsIAtom*        aListName,
+nsTableFrame::AppendFrames(ChildListID     aListID,
                            nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName || aListName == nsGkAtoms::colGroupList,
+  NS_ASSERTION(aListID == kPrincipalList || aListID == kColGroupList,
                "unexpected child list");
 
   // Because we actually have two child lists, one for col group frames and one
   // for everything else, we need to look at each frame individually
   // XXX The frame construction code should be separating out child frames
   // based on the type, bug 343048.
   while (!aFrameList.IsEmpty()) {
     nsIFrame* f = aFrameList.FirstChild();
@@ -2129,33 +2129,33 @@ nsTableFrame::AppendFrames(nsIAtom*     
   PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                                                NS_FRAME_HAS_DIRTY_CHILDREN);
   SetGeometryDirty();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableFrame::InsertFrames(nsIAtom*        aListName,
+nsTableFrame::InsertFrames(ChildListID     aListID,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList)
 {
   // Asssume there's only one frame being inserted. The problem is that
   // row group frames and col group frames go in separate child lists and
   // so if there's more than one type of frames this gets messy...
   // XXX The frame construction code should be separating out child frames
   // based on the type, bug 343048.
 
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
   if ((aPrevFrame && !aPrevFrame->GetNextSibling()) ||
-      (!aPrevFrame && GetChildList(aListName).IsEmpty())) {
+      (!aPrevFrame && GetChildList(aListID).IsEmpty())) {
     // Treat this like an append; still a workaround for bug 343048.
-    return AppendFrames(aListName, aFrameList);
+    return AppendFrames(aListID, aFrameList);
   }
 
   // See what kind of frame we have
   const nsStyleDisplay* display = aFrameList.FirstChild()->GetStyleDisplay();
 #ifdef DEBUG
   // verify that all sibling have the same type, if they do not, expect cellmap issues
   for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
     const nsStyleDisplay* nextDisplay = e.get()->GetStyleDisplay();
@@ -2173,17 +2173,17 @@ nsTableFrame::InsertFrames(nsIAtom*     
       // XXXbz Using content indices here means XBL will get screwed
       // over...  Oh, well.
       nsIFrame* pseudoFrame = aFrameList.FirstChild();
       nsIContent* parentContent = GetContent();
       nsIContent* content;
       aPrevFrame = nsnull;
       while (pseudoFrame  && (parentContent ==
                               (content = pseudoFrame->GetContent()))) {
-        pseudoFrame = pseudoFrame->GetFirstChild(nsnull);
+        pseudoFrame = pseudoFrame->GetFirstPrincipalChild();
       }
       nsCOMPtr<nsIContent> container = content->GetParent();
       if (NS_LIKELY(container)) { // XXX need this null-check, see bug 411823.
         PRInt32 newIndex = container->IndexOf(content);
         nsIFrame* kidFrame;
         PRBool isColGroup = (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP ==
                              display->mDisplay);
         nsTableColGroupFrame* lastColGroup;
@@ -2201,54 +2201,54 @@ nsTableFrame::InsertFrames(nsIAtom*     
             if (kidFrame == lastColGroup) {
               aPrevFrame = kidFrame; // there is no real colgroup after this one
               break;
             }
           }
           pseudoFrame = kidFrame;
           while (pseudoFrame  && (parentContent ==
                                   (content = pseudoFrame->GetContent()))) {
-            pseudoFrame = pseudoFrame->GetFirstChild(nsnull);
+            pseudoFrame = pseudoFrame->GetFirstPrincipalChild();
           }
           PRInt32 index = container->IndexOf(content);
           if (index > lastIndex && index < newIndex) {
             lastIndex = index;
             aPrevFrame = kidFrame;
           }
           kidFrame = kidFrame->GetNextSibling();
         }
       }
     }
   }
   if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay) {
-    NS_ASSERTION(!aListName || aListName == nsGkAtoms::colGroupList,
+    NS_ASSERTION(aListID == kPrincipalList || aListID == kColGroupList,
                  "unexpected child list");
     // Insert the column group frames
     const nsFrameList::Slice& newColgroups =
       mColGroups.InsertFrames(nsnull, aPrevFrame, aFrameList);
     // find the starting col index for the first new col group
     PRInt32 startColIndex = 0;
     if (aPrevFrame) {
       nsTableColGroupFrame* prevColGroup =
         (nsTableColGroupFrame*)GetFrameAtOrBefore(this, aPrevFrame,
                                                   nsGkAtoms::tableColGroupFrame);
       if (prevColGroup) {
         startColIndex = prevColGroup->GetStartColumnIndex() + prevColGroup->GetColCount();
       }
     }
     InsertColGroups(startColIndex, newColgroups);
   } else if (IsRowGroup(display->mDisplay)) {
-    NS_ASSERTION(!aListName, "unexpected child list");
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
     // Insert the frames in the sibling chain
     const nsFrameList::Slice& newRowGroups =
       mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
 
     InsertRowGroups(newRowGroups);
   } else {
-    NS_ASSERTION(!aListName, "unexpected child list");
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
     NS_NOTREACHED("How did we even get here?");
     // Just insert the frame and don't worry about reflowing it
     mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
     return NS_OK;
   }
 
   PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                                                NS_FRAME_HAS_DIRTY_CHILDREN);
@@ -2256,24 +2256,24 @@ nsTableFrame::InsertFrames(nsIAtom*     
 #ifdef DEBUG_TABLE_CELLMAP
   printf("=== TableFrame::InsertFrames\n");
   Dump(PR_TRUE, PR_TRUE, PR_TRUE);
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableFrame::RemoveFrame(nsIAtom*        aListName,
+nsTableFrame::RemoveFrame(ChildListID     aListID,
                           nsIFrame*       aOldFrame)
 {
-  NS_ASSERTION(aListName == nsGkAtoms::colGroupList ||
+  NS_ASSERTION(aListID == kColGroupList ||
                NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP !=
                  aOldFrame->GetStyleDisplay()->mDisplay,
-               "Wrong list name; use nsGkAtoms::colGroupList iff colgroup");
-  if (aListName == nsGkAtoms::colGroupList) {
+               "Wrong list name; use kColGroupList iff colgroup");
+  if (aListID == kColGroupList) {
     nsIFrame* nextColGroupFrame = aOldFrame->GetNextSibling();
     nsTableColGroupFrame* colGroup = (nsTableColGroupFrame*)aOldFrame;
     PRInt32 firstColIndex = colGroup->GetStartColumnIndex();
     PRInt32 lastColIndex  = firstColIndex + colGroup->GetColCount() - 1;
     mColGroups.DestroyFrame(aOldFrame);
     nsTableColGroupFrame::ResetColIndices(nextColGroupFrame, firstColIndex);
     // remove the cols from the table
     PRInt32 colX;
@@ -2286,17 +2286,17 @@ nsTableFrame::RemoveFrame(nsIAtom*      
 
     PRInt32 numAnonymousColsToAdd = GetColCount() - mColFrames.Length();
     if (numAnonymousColsToAdd > 0) {
       // this sets the child list, updates the col cache and cell map
       AppendAnonymousColFrames(numAnonymousColsToAdd);
     }
 
   } else {
-    NS_ASSERTION(!aListName, "unexpected child list");
+    NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
     nsTableRowGroupFrame* rgFrame =
       static_cast<nsTableRowGroupFrame*>(aOldFrame);
     // remove the row group from the cell map
     nsTableCellMap* cellMap = GetCellMap();
     if (cellMap) {
       cellMap->RemoveGroupCellMap(rgFrame);
     }
 
@@ -3439,40 +3439,40 @@ nsTableFrame::GetFrameAtOrBefore(nsIFram
   }
   if (aChildType == aPriorChildFrame->GetType()) {
     return aPriorChildFrame;
   }
 
   // aPriorChildFrame is not of type aChildType, so we need start from
   // the beginnng and find the closest one
   nsIFrame* lastMatchingFrame = nsnull;
-  nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = aParentFrame->GetFirstPrincipalChild();
   while (childFrame && (childFrame != aPriorChildFrame)) {
     if (aChildType == childFrame->GetType()) {
       lastMatchingFrame = childFrame;
     }
     childFrame = childFrame->GetNextSibling();
   }
   return lastMatchingFrame;
 }
 
 #ifdef DEBUG
 void
 nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
 {
   if (!aKidFrame)
     return;
 
-  nsIFrame* cFrame = aKidFrame->GetFirstChild(nsnull);
+  nsIFrame* cFrame = aKidFrame->GetFirstPrincipalChild();
   while (cFrame) {
     nsTableRowFrame *rowFrame = do_QueryFrame(cFrame);
     if (rowFrame) {
       printf("row(%d)=%p ", rowFrame->GetRowIndex(),
              static_cast<void*>(rowFrame));
-      nsIFrame* childFrame = cFrame->GetFirstChild(nsnull);
+      nsIFrame* childFrame = cFrame->GetFirstPrincipalChild();
       while (childFrame) {
         nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
         if (cellFrame) {
           PRInt32 colIndex;
           cellFrame->GetColIndex(colIndex);
           printf("cell(%d)=%p ", colIndex, static_cast<void*>(childFrame));
         }
         childFrame = childFrame->GetNextSibling();
@@ -3554,17 +3554,17 @@ nsTableFrame::Dump(PRBool          aDump
   }
   printf(" ***END TABLE DUMP*** \n");
 }
 #endif
 
 // nsTableIterator
 nsTableIterator::nsTableIterator(nsIFrame& aSource)
 {
-  nsIFrame* firstChild = aSource.GetFirstChild(nsnull);
+  nsIFrame* firstChild = aSource.GetFirstPrincipalChild();
   Init(firstChild);
 }
 
 nsTableIterator::nsTableIterator(nsFrameList& aSource)
 {
   nsIFrame* firstChild = aSource.FirstChild();
   Init(firstChild);
 }
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -54,24 +54,16 @@ class nsTableRowGroupFrame;
 class nsTableRowFrame;
 class nsTableColGroupFrame;
 class nsITableLayoutStrategy;
 class nsStyleContext;
 
 struct nsTableReflowState;
 struct nsStylePosition;
 
-/**
- * Child list name indices
- * @see #GetAdditionalChildListName()
- */
-#define NS_TABLE_FRAME_COLGROUP_LIST_INDEX 0
-#define NS_TABLE_FRAME_OVERFLOW_LIST_INDEX 1
-#define NS_TABLE_FRAME_LAST_LIST_INDEX    NS_TABLE_FRAME_OVERFLOW_LIST_INDEX
-
 static inline PRBool IS_TABLE_CELL(nsIAtom* frameType) {
   return nsGkAtoms::tableCellFrame == frameType ||
     nsGkAtoms::bcTableCellFrame == frameType;
 }
 
 class nsDisplayTableItem : public nsDisplayItem
 {
 public:
@@ -122,25 +114,23 @@ private:
   nsDisplayTableItem*   mOldCurrentItem;
 #ifdef DEBUG
   nsDisplayTableItem*   mPushedItem;
 #endif
 };
 
 /* ============================================================================ */
 
-/** nsTableFrame maps the inner portion of a table (everything except captions.)
+/**
+  * nsTableFrame maps the inner portion of a table (everything except captions.)
   * Used as a pseudo-frame within nsTableOuterFrame, it may also be used
   * stand-alone as the top-level frame.
   *
-  * The flowed child list contains row group frames. There is also an additional
-  * named child list:
-  * - "ColGroup-list" which contains the col group frames
-  *
-  * @see nsGkAtoms::colGroupList
+  * The principal child list contains row group frames. There is also an
+  * additional child list, kColGroupList, which contains the col group frames.
   */
 class nsTableFrame : public nsHTMLContainerFrame, public nsITableLayout
 {
 public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   /** nsTableOuterFrame has intimate knowledge of the inner table frame */
@@ -190,22 +180,22 @@ public:
                            nsIAtom*        aAttribute); 
 
   /** @see nsIFrame::DestroyFrom */
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   
   /** @see nsIFrame::DidSetStyleContext */
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
 
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsMargin GetUsedBorder() const;
   virtual nsMargin GetUsedPadding() const;
 
   // Get the offset from the border box to the area where the row groups fit
   nsMargin GetChildAreaOffset(const nsHTMLReflowState* aReflowState) const;
 
@@ -246,23 +236,21 @@ public:
   /** @return PR_TRUE if aDisplayType represents a rowgroup of any sort
     * (header, footer, or body)
     */
   PRBool IsRowGroup(PRInt32 aDisplayType) const;
 
   /** Initialize the table frame with a set of children.
     * @see nsIFrame::SetInitialChildList 
     */
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
 
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
-
-  /** @see nsIFrame::GetAdditionalChildListName */
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
+  virtual nsFrameList GetChildList(ChildListID aListID) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   /**
    * Paint the background of the table and its parts (column groups,
    * columns, row groups, rows, and cells), and the table border, and all
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -124,17 +124,17 @@ nsTableCaptionFrame::GetParentStyleConte
 {
   NS_PRECONDITION(mContent->GetParent(),
                   "How could we not have a parent here?");
     
   // The caption's style context parent is the inner frame, unless
   // it's anonymous.
   nsIFrame* outerFrame = GetParent();
   if (outerFrame && outerFrame->GetType() == nsGkAtoms::tableOuterFrame) {
-    nsIFrame* innerFrame = outerFrame->GetFirstChild(nsnull);
+    nsIFrame* innerFrame = outerFrame->GetFirstPrincipalChild();
     if (innerFrame) {
       *aProviderFrame =
         nsFrame::CorrectStyleParentFrame(innerFrame,
                                          GetStyleContext()->GetPseudo());
       *aIsChild = PR_FALSE;
       return NS_OK;
     }
   }
@@ -234,26 +234,26 @@ nsTableOuterFrame::GetChildList(ChildLis
 void
 nsTableOuterFrame::GetChildLists(nsTArray<ChildList>* aLists) const
 {
   mFrames.AppendIfNonempty(aLists, kPrincipalList);
   mCaptionFrames.AppendIfNonempty(aLists, kCaptionList);
 }
 
 NS_IMETHODIMP 
-nsTableOuterFrame::SetInitialChildList(nsIAtom*        aListName,
+nsTableOuterFrame::SetInitialChildList(ChildListID     aListID,
                                        nsFrameList&    aChildList)
 {
-  if (nsGkAtoms::captionList == aListName) {
+  if (kCaptionList == aListID) {
     // the frame constructor already checked for table-caption display type
     mCaptionFrames.SetFrames(aChildList);
     mCaptionFrame = mCaptionFrames.FirstChild();
   }
   else {
-    NS_ASSERTION(!aListName, "wrong childlist");
+    NS_ASSERTION(aListID == kPrincipalList, "wrong childlist");
     NS_ASSERTION(mFrames.IsEmpty(), "Frame leak!");
     mInnerTableFrame = nsnull;
     if (aChildList.NotEmpty()) {
       if (nsGkAtoms::tableFrame == aChildList.FirstChild()->GetType()) {
         mInnerTableFrame = (nsTableFrame*)aChildList.FirstChild();
         mFrames.SetFrames(aChildList);
       }
       else {
@@ -262,24 +262,24 @@ nsTableOuterFrame::SetInitialChildList(n
       }
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableOuterFrame::AppendFrames(nsIAtom*        aListName,
+nsTableOuterFrame::AppendFrames(ChildListID     aListID,
                                 nsFrameList&    aFrameList)
 {
   nsresult rv;
 
   // We only have two child frames: the inner table and a caption frame.
   // The inner frame is provided when we're initialized, and it cannot change
-  if (nsGkAtoms::captionList == aListName) {
+  if (kCaptionList == aListID) {
     NS_ASSERTION(aFrameList.IsEmpty() ||
                  aFrameList.FirstChild()->GetType() == nsGkAtoms::tableCaptionFrame,
                  "appending non-caption frame to captionList");
     mCaptionFrames.AppendFrames(this, aFrameList);
     mCaptionFrame = mCaptionFrames.FirstChild();
     rv = NS_OK;
 
     // Reflow the new caption frame. It's already marked dirty, so
@@ -292,21 +292,21 @@ nsTableOuterFrame::AppendFrames(nsIAtom*
     NS_PRECONDITION(PR_FALSE, "unexpected child list");
     rv = NS_ERROR_UNEXPECTED;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsTableOuterFrame::InsertFrames(nsIAtom*        aListName,
+nsTableOuterFrame::InsertFrames(ChildListID     aListID,
                                 nsIFrame*       aPrevFrame,
                                 nsFrameList&    aFrameList)
 {
-  if (nsGkAtoms::captionList == aListName) {
+  if (kCaptionList == aListID) {
     NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                  "inserting after sibling frame with different parent");
     NS_ASSERTION(aFrameList.IsEmpty() ||
                  aFrameList.FirstChild()->GetType() == nsGkAtoms::tableCaptionFrame,
                  "inserting non-caption frame into captionList");
     mCaptionFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
     mCaptionFrame = mCaptionFrames.FirstChild();
 
@@ -314,27 +314,27 @@ nsTableOuterFrame::InsertFrames(nsIAtom*
     // just tell the pres shell.
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN);
     return NS_OK;
   }
   else {
     NS_PRECONDITION(!aPrevFrame, "invalid previous frame");
-    return AppendFrames(aListName, aFrameList);
+    return AppendFrames(aListID, aFrameList);
   }
 }
 
 NS_IMETHODIMP
-nsTableOuterFrame::RemoveFrame(nsIAtom*        aListName,
+nsTableOuterFrame::RemoveFrame(ChildListID     aListID,
                                nsIFrame*       aOldFrame)
 {
   // We only have two child frames: the inner table and one caption frame.
   // The inner frame can't be removed so this should be the caption
-  NS_PRECONDITION(nsGkAtoms::captionList == aListName, "can't remove inner frame");
+  NS_PRECONDITION(kCaptionList == aListID, "can't remove inner frame");
 
   if (HasSideCaption()) {
     // The old caption width had an effect on the inner table width so
     // we're going to need to reflow it. Mark it dirty
     mInnerTableFrame->AddStateBits(NS_FRAME_IS_DIRTY);
   }
 
   // Remove the frame and destroy it
--- a/layout/tables/nsTableOuterFrame.h
+++ b/layout/tables/nsTableOuterFrame.h
@@ -99,35 +99,34 @@ public:
   friend nsIFrame* NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
   
   // nsIFrame overrides - see there for a description
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   
   virtual PRBool IsContainingBlock() const;
 
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
  
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
+  virtual nsFrameList GetChildList(ChildListID aListID) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
 
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
-
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsIFrame* GetContentInsertionFrame() {
-    return GetFirstChild(nsnull)->GetContentInsertionFrame();
+    return GetFirstPrincipalChild()->GetContentInsertionFrame();
   }
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -196,20 +196,20 @@ nsTableRowFrame::DidSetStyleContext(nsSt
       tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
     nsRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
     tableFrame->SetBCDamageArea(damageArea);
   }
   return;
 }
 
 NS_IMETHODIMP
-nsTableRowFrame::AppendFrames(nsIAtom*        aListName,
+nsTableRowFrame::AppendFrames(ChildListID     aListID,
                               nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   // Append the frames
   // XXXbz why do we append here first, then append to table, while
   // for InsertFrames we do it in the other order?  Bug 507419 covers this.
   const nsFrameList::Slice& newCells = mFrames.AppendFrames(nsnull, aFrameList);
 
   // Add the new cell frames to the table
   nsTableFrame *tableFrame =  nsTableFrame::GetTableFrame(this);
@@ -226,21 +226,21 @@ nsTableRowFrame::AppendFrames(nsIAtom*  
                                                NS_FRAME_HAS_DIRTY_CHILDREN);
   tableFrame->SetGeometryDirty();
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsTableRowFrame::InsertFrames(nsIAtom*        aListName,
+nsTableRowFrame::InsertFrames(ChildListID     aListID,
                               nsIFrame*       aPrevFrame,
                               nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
   // Get the table frame
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   
   // gather the new frames (only those which are cells) into an array
   // XXXbz there shouldn't be any other ones here... can we just put
@@ -268,20 +268,20 @@ nsTableRowFrame::InsertFrames(nsIAtom*  
   PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                                                NS_FRAME_HAS_DIRTY_CHILDREN);
   tableFrame->SetGeometryDirty();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableRowFrame::RemoveFrame(nsIAtom*        aListName,
+nsTableRowFrame::RemoveFrame(ChildListID     aListID,
                              nsIFrame*       aOldFrame)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (tableFrame) {
     nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
     if (cellFrame) {
       PRInt32 colIndex;
       cellFrame->GetColIndex(colIndex);
       // remove the cell from the cell map
@@ -444,17 +444,17 @@ nscoord nsTableRowFrame::GetRowBaseline(
   // bppppppppppppppppb
   // bbbbbbbbbbbbbbbbbb
 
   nsTableIterator iter(*this);
   nsIFrame* childFrame = iter.First();
   nscoord ascent = 0;
    while (childFrame) {
     if (IS_TABLE_CELL(childFrame->GetType())) {
-      nsIFrame* firstKid = childFrame->GetFirstChild(nsnull);
+      nsIFrame* firstKid = childFrame->GetFirstPrincipalChild();
       ascent = NS_MAX(ascent, firstKid->GetRect().YMost());
     }
     // Get the next child
     childFrame = iter.Next();
   }
   return ascent;
 }
 nscoord
@@ -554,17 +554,17 @@ nsTableRowFrame::CalcHeight(const nsHTML
     nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
     if (cellFrame) {
       nsSize desSize = cellFrame->GetDesiredSize();
       if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !GetPrevInFlow()) {
         CalculateCellActualHeight(cellFrame, desSize.height);
       }
       // height may have changed, adjust descent to absorb any excess difference
       nscoord ascent;
-       if (!kidFrame->GetFirstChild(nsnull)->GetFirstChild(nsnull))
+       if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
          ascent = desSize.height;
        else
          ascent = cellFrame->GetCellBaseline();
       nscoord descent = desSize.height - ascent;
       UpdateHeight(desSize.height, ascent, descent, tableFrame, cellFrame);
     }
   }
   return GetHeight();
@@ -941,17 +941,17 @@ nsTableRowFrame::ReflowChildren(nsPresCo
       if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
         if (!GetPrevInFlow()) {
           // Calculate the cell's actual height given its pass2 height. This
           // function takes into account the specified height (in the style)
           CalculateCellActualHeight(cellFrame, desiredSize.height);
         }
         // height may have changed, adjust descent to absorb any excess difference
         nscoord ascent;
-        if (!kidFrame->GetFirstChild(nsnull)->GetFirstChild(nsnull))
+        if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
           ascent = desiredSize.height;
         else
           ascent = ((nsTableCellFrame *)kidFrame)->GetCellBaseline();
         nscoord descent = desiredSize.height - ascent;
         UpdateHeight(desiredSize.height, ascent, descent, &aTableFrame, cellFrame);
       }
       else {
         cellMaxHeight = NS_MAX(cellMaxHeight, desiredSize.height);
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -74,22 +74,22 @@ public:
   virtual ~nsTableRowFrame();
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
   /** @see nsIFrame::DidSetStyleContext */
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
   
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   /** instantiate a new instance of nsTableRowFrame.
     * @param aPresShell the pres shell for this frame
     *
     * @return           the frame that was created
     */
   friend nsIFrame* NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -15,17 +15,17 @@
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Mats Palmgren <mats.palmgren@bredband.net>
+ *   Mats Palmgren <matspal@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -108,17 +108,17 @@ PRInt32 nsTableRowGroupFrame::GetStartRo
   }
       
   return result;
 }
 
 void  nsTableRowGroupFrame::AdjustRowIndices(PRInt32 aRowIndex,
                                              PRInt32 anAdjustment)
 {
-  nsIFrame* rowFrame = GetFirstChild(nsnull);
+  nsIFrame* rowFrame = GetFirstPrincipalChild();
   for ( ; rowFrame; rowFrame = rowFrame->GetNextSibling()) {
     if (NS_STYLE_DISPLAY_TABLE_ROW==rowFrame->GetStyleDisplay()->mDisplay) {
       PRInt32 index = ((nsTableRowFrame*)rowFrame)->GetRowIndex();
       if (index >= aRowIndex)
         ((nsTableRowFrame *)rowFrame)->SetRowIndex(index+anAdjustment);
     }
   }
 }
@@ -222,17 +222,17 @@ DisplayRows(nsDisplayListBuilder* aBuild
       NS_ENSURE_SUCCESS(rv, rv);
       kid = kid->GetNextSibling();
     }
     return NS_OK;
   }
   
   // No cursor. Traverse children the hard way and build a cursor while we're at it
   nsTableRowGroupFrame::FrameCursorData* cursor = f->SetupRowCursor();
-  kid = f->GetFirstChild(nsnull);
+  kid = f->GetFirstPrincipalChild();
   while (kid) {
     nsresult rv = f->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
     if (NS_FAILED(rv)) {
       f->ClearRowCursor();
       return rv;
     }
     
     if (cursor) {
@@ -1378,20 +1378,20 @@ nsTableRowGroupFrame::DidSetStyleContext
     nsRect damageArea(0, GetStartRowIndex(), tableFrame->GetColCount(),
                       GetRowCount());
     tableFrame->SetBCDamageArea(damageArea);
   }
   return;
 }
 
 NS_IMETHODIMP
-nsTableRowGroupFrame::AppendFrames(nsIAtom*        aListName,
+nsTableRowGroupFrame::AppendFrames(ChildListID     aListID,
                                    nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   ClearRowCursor();
 
   // collect the new row frames in an array
   // XXXbz why are we doing the QI stuff?  There shouldn't be any non-rows here.
   nsAutoTArray<nsTableRowFrame*, 8> rows;
   for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
     nsTableRowFrame *rowFrame = do_QueryFrame(e.get());
@@ -1418,21 +1418,21 @@ nsTableRowGroupFrame::AppendFrames(nsIAt
       tableFrame->SetGeometryDirty();
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableRowGroupFrame::InsertFrames(nsIAtom*        aListName,
+nsTableRowGroupFrame::InsertFrames(ChildListID     aListID,
                                    nsIFrame*       aPrevFrame,
                                    nsFrameList&    aFrameList)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
 
   ClearRowCursor();
 
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (!tableFrame)
     return NS_ERROR_NULL_POINTER;
@@ -1471,20 +1471,20 @@ nsTableRowGroupFrame::InsertFrames(nsIAt
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN);
     tableFrame->SetGeometryDirty();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTableRowGroupFrame::RemoveFrame(nsIAtom*        aListName,
+nsTableRowGroupFrame::RemoveFrame(ChildListID     aListID,
                                   nsIFrame*       aOldFrame)
 {
-  NS_ASSERTION(!aListName, "unexpected child list");
+  NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   ClearRowCursor();
 
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (tableFrame) {
     nsTableRowFrame *rowFrame = do_QueryFrame(aOldFrame);
     if (rowFrame) {
       // remove the rows from the table (and flag a rebalance)
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -105,24 +105,24 @@ public:
     *
     * @return           the frame that was created
     */
   friend nsIFrame* NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
   virtual ~nsTableRowGroupFrame();
   /** @see nsIFrame::DidSetStyleContext */
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
   
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
   
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
-  NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame);
 
   virtual nsMargin GetUsedMargin() const;
   virtual nsMargin GetUsedBorder() const;
   virtual nsMargin GetUsedPadding() const;
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -158,20 +158,20 @@ nsBoxFrame::nsBoxFrame(nsIPresShell* aPr
   SetLayoutManager(layout);
 }
 
 nsBoxFrame::~nsBoxFrame()
 {
 }
 
 NS_IMETHODIMP
-nsBoxFrame::SetInitialChildList(nsIAtom*        aListName,
+nsBoxFrame::SetInitialChildList(ChildListID     aListID,
                                 nsFrameList&    aChildList)
 {
-  nsresult r = nsContainerFrame::SetInitialChildList(aListName, aChildList);
+  nsresult r = nsContainerFrame::SetInitialChildList(aListID, aChildList);
   if (r == NS_OK) {
     // initialize our list of infos.
     nsBoxLayoutState state(PresContext());
     CheckBoxOrder(state);
     if (mLayoutManager)
       mLayoutManager->ChildrenSet(this, state, mFrames.FirstChild());
   } else {
     NS_WARNING("Warning add child failed!!\n");
@@ -990,20 +990,20 @@ nsBoxFrame::MarkIntrinsicWidthsDirty()
     mLayoutManager->IntrinsicWidthsDirty(this, state);
   }
 
   // Don't call base class method, since everything it does is within an
   // IsBoxWrapped check.
 }
 
 NS_IMETHODIMP
-nsBoxFrame::RemoveFrame(nsIAtom*        aListName,
+nsBoxFrame::RemoveFrame(ChildListID     aListID,
                         nsIFrame*       aOldFrame)
 {
-  NS_PRECONDITION(!aListName, "We don't support out-of-flow kids");
+  NS_PRECONDITION(aListID == kPrincipalList, "We don't support out-of-flow kids");
   nsPresContext* presContext = PresContext();
   nsBoxLayoutState state(presContext);
 
   // remove the child frame
   mFrames.RemoveFrame(aOldFrame);
 
   // notify the layout manager
   if (mLayoutManager)
@@ -1015,25 +1015,25 @@ nsBoxFrame::RemoveFrame(nsIAtom*        
   // mark us dirty and generate a reflow command
   PresContext()->PresShell()->
     FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                      NS_FRAME_HAS_DIRTY_CHILDREN);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBoxFrame::InsertFrames(nsIAtom*        aListName,
+nsBoxFrame::InsertFrames(ChildListID     aListID,
                          nsIFrame*       aPrevFrame,
                          nsFrameList&    aFrameList)
 {
    NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                 "inserting after sibling frame with different parent");
    NS_ASSERTION(!aPrevFrame || mFrames.ContainsFrame(aPrevFrame),
                 "inserting after sibling frame not in our child list");
-   NS_PRECONDITION(!aListName, "We don't support out-of-flow kids");
+   NS_PRECONDITION(aListID == kPrincipalList, "We don't support out-of-flow kids");
    nsBoxLayoutState state(PresContext());
 
    // insert the child frames
    const nsFrameList::Slice& newFrames =
      mFrames.InsertFrames(this, aPrevFrame, aFrameList);
 
    // notify the layout manager
    if (mLayoutManager)
@@ -1054,20 +1054,20 @@ nsBoxFrame::InsertFrames(nsIAtom*       
    PresContext()->PresShell()->
      FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                       NS_FRAME_HAS_DIRTY_CHILDREN);
    return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsBoxFrame::AppendFrames(nsIAtom*        aListName,
+nsBoxFrame::AppendFrames(ChildListID     aListID,
                          nsFrameList&    aFrameList)
 {
-   NS_PRECONDITION(!aListName, "We don't support out-of-flow kids");
+   NS_PRECONDITION(aListID == kPrincipalList, "We don't support out-of-flow kids");
    nsBoxLayoutState state(PresContext());
 
    // append the new frames
    const nsFrameList::Slice& newFrames = mFrames.AppendFrames(this, aFrameList);
 
    // notify the layout manager
    if (mLayoutManager)
      mLayoutManager->ChildrenAppended(this, state, newFrames);
@@ -1092,17 +1092,17 @@ nsBoxFrame::AppendFrames(nsIAtom*       
    }
    return NS_OK;
 }
 
 /* virtual */ nsIFrame*
 nsBoxFrame::GetContentInsertionFrame()
 {
   if (GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK)
-    return GetFirstChild(nsnull)->GetContentInsertionFrame();
+    return GetFirstPrincipalChild()->GetContentInsertionFrame();
   return nsContainerFrame::GetContentInsertionFrame();
 }
 
 NS_IMETHODIMP
 nsBoxFrame::AttributeChanged(PRInt32 aNameSpaceID,
                              nsIAtom* aAttribute,
                              PRInt32 aModType)
 {
@@ -1219,17 +1219,17 @@ nsBoxFrame::AttributeChanged(PRInt32 aNa
       FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
   }
   else if (aAttribute == nsGkAtoms::ordinal) {
     nsBoxLayoutState state(PresContext());
     nsIBox* parent = GetParentBox();
     // If our parent is not a box, there's not much we can do... but in that
     // case our ordinal doesn't matter anyway, so that's ok.
     // Also don't bother with popup frames since they are kept on the 
-    // nsGkAtoms::popupList and RelayoutChildAtOrdinal() only handles
+    // kPopupList and RelayoutChildAtOrdinal() only handles
     // principal children.
     if (parent && !(GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
         GetStyleDisplay()->mDisplay != NS_STYLE_DISPLAY_POPUP) {
       parent->RelayoutChildAtOrdinal(state, this);
       // XXXldb Should this instead be a tree change on the child or parent?
       PresContext()->PresShell()->
         FrameNeedsReflow(parent, nsIPresShell::eStyleChange,
                          NS_FRAME_IS_DIRTY);
--- a/layout/xul/base/src/nsBoxFrame.h
+++ b/layout/xul/base/src/nsBoxFrame.h
@@ -128,29 +128,29 @@ public:
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
-  NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD  AppendFrames(ChildListID     aListID,
                            nsFrameList&    aFrameList);
 
-  NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD  InsertFrames(ChildListID     aListID,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList);
 
-  NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD  RemoveFrame(ChildListID     aListID,
                           nsIFrame*       aOldFrame);
 
   virtual nsIFrame* GetContentInsertionFrame();
 
-  NS_IMETHOD  SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD  SetInitialChildList(ChildListID     aListID,
                                   nsFrameList&    aChildList);
 
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
 
   virtual nsIAtom* GetType() const;
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
--- a/layout/xul/base/src/nsBoxObject.cpp
+++ b/layout/xul/base/src/nsBoxObject.cpp
@@ -424,17 +424,17 @@ nsBoxObject::GetParentBox(nsIDOMElement 
 }
 
 NS_IMETHODIMP 
 nsBoxObject::GetFirstChild(nsIDOMElement * *aFirstVisibleChild)
 {
   *aFirstVisibleChild = nsnull;
   nsIFrame* frame = GetFrame(PR_FALSE);
   if (!frame) return NS_OK;
-  nsIFrame* firstFrame = frame->GetFirstChild(nsnull);
+  nsIFrame* firstFrame = frame->GetFirstPrincipalChild();
   if (!firstFrame) return NS_OK;
   // get the content for the box and query to a dom element
   nsCOMPtr<nsIDOMElement> el = do_QueryInterface(firstFrame->GetContent());
   el.swap(*aFirstVisibleChild);
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -471,17 +471,17 @@ nsBoxObject::GetPreviousSibling(nsIDOMEl
   return GetPreviousSibling(parentFrame, frame, aPreviousOrdinalSibling);
 }
 
 nsresult
 nsBoxObject::GetPreviousSibling(nsIFrame* aParentFrame, nsIFrame* aFrame,
                                 nsIDOMElement** aResult)
 {
   *aResult = nsnull;
-  nsIFrame* nextFrame = aParentFrame->GetFirstChild(nsnull);
+  nsIFrame* nextFrame = aParentFrame->GetFirstPrincipalChild();
   nsIFrame* prevFrame = nsnull;
   while (nextFrame) {
     if (nextFrame == aFrame)
       break;
     prevFrame = nextFrame;
     nextFrame = nextFrame->GetNextSibling();
   }
    
--- a/layout/xul/base/src/nsDeckFrame.cpp
+++ b/layout/xul/base/src/nsDeckFrame.cpp
@@ -114,38 +114,38 @@ static void
 CreateViewsForFrames(const nsFrameList& aFrames)
 {
   for (nsFrameList::Enumerator f(aFrames); !f.AtEnd(); f.Next()) {
     nsContainerFrame::CreateViewForFrame(f.get(), PR_TRUE);
   }
 }
 
 NS_IMETHODIMP
-nsDeckFrame::SetInitialChildList(nsIAtom*        aListName,
+nsDeckFrame::SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList)
 {
   CreateViewsForFrames(aChildList);
-  return nsBoxFrame::SetInitialChildList(aListName, aChildList);
+  return nsBoxFrame::SetInitialChildList(aListID, aChildList);
 }
 
 NS_IMETHODIMP
-nsDeckFrame::AppendFrames(nsIAtom*        aListName,
+nsDeckFrame::AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList)
 {
   CreateViewsForFrames(aFrameList);
-  return nsBoxFrame::AppendFrames(aListName, aFrameList);
+  return nsBoxFrame::AppendFrames(aListID, aFrameList);
 }
 
 NS_IMETHODIMP
-nsDeckFrame::InsertFrames(nsIAtom*        aListName,
+nsDeckFrame::InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList)
 {
   CreateViewsForFrames(aFrameList);
-  return nsBoxFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+  return nsBoxFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
 }
 
 void
 nsDeckFrame::HideBox(nsPresContext* aPresContext, nsIBox* aBox)
 {
   nsIView* view = aBox->GetView();
 
   if (view) {
--- a/layout/xul/base/src/nsDeckFrame.h
+++ b/layout/xul/base/src/nsDeckFrame.h
@@ -71,21 +71,21 @@ public:
                                          const nsDisplayListSet& aLists);
                                          
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
   // Override SetInitialChildList/AppendFrames/InsertFrames to
   // create views for our child frames if necessary
-  NS_IMETHOD  SetInitialChildList(nsIAtom*        aListName,
+  NS_IMETHOD  SetInitialChildList(ChildListID     aListID,
                                   nsFrameList&    aChildList);
-  NS_IMETHOD AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList);
-  NS_IMETHOD InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
 
   virtual nsIAtom* GetType() const;
 
 #ifdef NS_DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
--- a/layout/xul/base/src/nsMenuBarFrame.cpp
+++ b/layout/xul/base/src/nsMenuBarFrame.cpp
@@ -229,17 +229,17 @@ nsMenuBarFrame::FindMenuWithShortcut(nsI
   nsIFrame* immediateParent = nsnull;
   GetInsertionPoint(PresContext()->PresShell(), this, nsnull, &immediateParent);
   if (!immediateParent)
     immediateParent = this;
 
   // Find a most preferred accesskey which should be returned.
   nsIFrame* foundMenu = nsnull;
   PRUint32 foundIndex = accessKeys.NoIndex;
-  nsIFrame* currFrame = immediateParent->GetFirstChild(nsnull);
+  nsIFrame* currFrame = immediateParent->GetFirstPrincipalChild();
 
   while (currFrame) {
     nsIContent* current = currFrame->GetContent();
 
     // See if it's a menu item.
     if (nsXULPopupManager::IsValidMenuItem(PresContext(), current, PR_FALSE)) {
       // Get the shortcut attribute.
       nsAutoString shortcutKey;
--- a/layout/xul/base/src/nsMenuFrame.cpp
+++ b/layout/xul/base/src/nsMenuFrame.cpp
@@ -327,23 +327,24 @@ nsMenuFrame::SetPopupFrame(nsFrameList& 
       mPopupFrame = (nsMenuPopupFrame *)e.get();
       aFrameList.RemoveFrame(e.get());
       break;
     }
   }
 }
 
 NS_IMETHODIMP
-nsMenuFrame::SetInitialChildList(nsIAtom*        aListName,
+nsMenuFrame::SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList)
 {
   NS_ASSERTION(!mPopupFrame, "already have a popup frame set");
-  if (!aListName || aListName == nsGkAtoms::popupList)
+  if (aListID == kPrincipalList || aListID == kPopupList) {
     SetPopupFrame(aChildList);
-  return nsBoxFrame::SetInitialChildList(aListName, aChildList);
+  }
+  return nsBoxFrame::SetInitialChildList(aListID, aChildList);
 }
 
 void
 nsMenuFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   // Kill our timer if one is active. This is not strictly necessary as
   // the pointer to this frame will be cleared from the mediator, but
   // this is done for added safety.
@@ -952,17 +953,17 @@ nsMenuFrame::UpdateMenuSpecialState(nsPr
    * selected item.  That, however, would be a lot more work, and I don't think
    * it's better at all.
    */
 
   /* walk siblings, looking for the other checked item with the same name */
   // get the first sibling in this menu popup. This frame may be it, and if we're
   // being called at creation time, this frame isn't yet in the parent's child list.
   // All I'm saying is that this may fail, but it's most likely alright.
-  nsIFrame* sib = GetParent()->GetFirstChild(nsnull);
+  nsIFrame* sib = GetParent()->GetFirstPrincipalChild();
 
   while (sib) {
     if (sib != this && sib->GetType() == nsGkAtoms::menuFrame) {
       nsMenuFrame* menu = static_cast<nsMenuFrame*>(sib);
       if (menu->GetMenuType() == eMenuType_Radio &&
           menu->IsChecked() &&
           (menu->GetRadioGroupName() == mGroupName)) {      
         /* uncheck the old item */
@@ -1248,42 +1249,42 @@ nsMenuFrame::PassMenuCommandEventToPopup
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm && mMenuParent && mDelayedMenuCommandEvent) {
     pm->ExecuteMenu(mContent, mDelayedMenuCommandEvent);
   }
   mDelayedMenuCommandEvent = nsnull;
 }
 
 NS_IMETHODIMP
-nsMenuFrame::RemoveFrame(nsIAtom*        aListName,
+nsMenuFrame::RemoveFrame(ChildListID     aListID,
                          nsIFrame*       aOldFrame)
 {
   nsresult rv =  NS_OK;
 
   if (mPopupFrame == aOldFrame) {
     // Go ahead and remove this frame.
     mPopupFrame->Destroy();
     mPopupFrame = nsnull;
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN);
     rv = NS_OK;
   } else {
-    rv = nsBoxFrame::RemoveFrame(aListName, aOldFrame);
+    rv = nsBoxFrame::RemoveFrame(aListID, aOldFrame);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsMenuFrame::InsertFrames(nsIAtom*        aListName,
+nsMenuFrame::InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList)
 {
-  if (!mPopupFrame && (!aListName || aListName == nsGkAtoms::popupList)) {
+  if (!mPopupFrame && (aListID == kPrincipalList || aListID == kPopupList)) {
     SetPopupFrame(aFrameList);
     if (mPopupFrame) {
 #ifdef DEBUG_LAYOUT
       nsBoxLayoutState state(PresContext());
       SetDebug(state, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
 #endif
 
       PresContext()->PresShell()->
@@ -1294,41 +1295,41 @@ nsMenuFrame::InsertFrames(nsIAtom*      
 
   if (aFrameList.IsEmpty())
     return NS_OK;
 
   if (NS_UNLIKELY(aPrevFrame == mPopupFrame)) {
     aPrevFrame = nsnull;
   }
 
-  return nsBoxFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
+  return nsBoxFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
 }
 
 NS_IMETHODIMP
-nsMenuFrame::AppendFrames(nsIAtom*        aListName,
+nsMenuFrame::AppendFrames(ChildListID     aListID,
                           nsFrameList&    aFrameList)
 {
-  if (!mPopupFrame && (!aListName || aListName == nsGkAtoms::popupList)) {
+  if (!mPopupFrame && (aListID == kPrincipalList || aListID == kPopupList)) {
     SetPopupFrame(aFrameList);
     if (mPopupFrame) {
 
 #ifdef DEBUG_LAYOUT
       nsBoxLayoutState state(PresContext());
       SetDebug(state, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
 #endif
       PresContext()->PresShell()->
         FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                          NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
 
   if (aFrameList.IsEmpty())
     return NS_OK;
 
-  return nsBoxFrame::AppendFrames(aListName, aFrameList); 
+  return nsBoxFrame::AppendFrames(aListID, aFrameList); 
 }
 
 PRBool
 nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
 {
   if (!IsCollapsed(aState)) {
     PRBool widthSet, heightSet;
     nsSize tmpSize(-1, 0);
@@ -1343,17 +1344,17 @@ nsMenuFrame::SizeToPopup(nsBoxLayoutStat
       //  (2) there's enough room in the menu for the content and its
       //      border-padding
       //  (3) there's enough room in the popup for the content and its
       //      scrollbar
       nsMargin borderPadding;
       GetBorderAndPadding(borderPadding);
 
       // if there is a scroll frame, add the desired width of the scrollbar as well
-      nsIScrollableFrame* scrollFrame = do_QueryFrame(mPopupFrame->GetFirstChild(nsnull));
+      nsIScrollableFrame* scrollFrame = do_QueryFrame(mPopupFrame->GetFirstPrincipalChild());
       nscoord scrollbarWidth = 0;
       if (scrollFrame) {
         scrollbarWidth =
           scrollFrame->GetDesiredScrollbarSizes(&aState).LeftRight();
       }
 
       aSize.width =
         tmpSize.width + NS_MAX(borderPadding.LeftRight(), scrollbarWidth);
@@ -1423,17 +1424,17 @@ nsMenuFrame::SetActiveChild(nsIDOMElemen
     mPopupFrame->ChangeMenuItem(static_cast<nsMenuFrame *>(kid), PR_FALSE);
   return NS_OK;
 }
 
 nsIScrollableFrame* nsMenuFrame::GetScrollTargetFrame()
 {
   if (!mPopupFrame)
     return nsnull;
-  nsIFrame* childFrame = mPopupFrame->GetFirstChild(nsnull);
+  nsIFrame* childFrame = mPopupFrame->GetFirstPrincipalChild();
   if (childFrame)
     return mPopupFrame->GetScrollFrame(childFrame);
   return nsnull;
 }
 
 // nsMenuTimerMediator implementation.
 NS_IMPL_ISUPPORTS1(nsMenuTimerMediator, nsITimerCallback)
 
--- a/layout/xul/base/src/nsMenuFrame.h
+++ b/layout/xul/base/src/nsMenuFrame.h
@@ -125,40 +125,40 @@ public:
 
 #ifdef DEBUG_LAYOUT
   NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug);
 #endif
 
   // The following methods are all overridden so that the menupopup
   // can be stored in a separate list, so that it doesn't impact reflow of the
   // actual menu item at all.
-  virtual nsFrameList GetChildList(nsIAtom* aListName) const;
-  NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
+  virtual nsFrameList GetChildList(ChildListID aList) const;
+  virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
+  NS_IMETHOD SetInitialChildList(ChildListID     aListID,
                                  nsFrameList&    aChildList);
-  virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
   // Overridden to prevent events from going to children of the menu.
   NS_IMETHOD BuildDisplayListForChildren(nsDisplayListBuilder*   aBuilder,
                                          const nsRect&           aDirtyRect,
                                          const nsDisplayListSet& aLists);
                                          
   // this method can destroy the frame
   NS_IMETHOD HandleEvent(nsPresContext* aPresContext, 
                          nsGUIEvent*     aEvent,
                          nsEventStatus*  aEventStatus);
 
-  NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
+  NS_IMETHOD  AppendFrames(ChildListID     aListID,
                            nsFrameList&    aFrameList);
 
-  NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
+  NS_IMETHOD  InsertFrames(ChildListID     aListID,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList);
 
-  NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
+  NS_IMETHOD  RemoveFrame(ChildListID     aListID,
                           nsIFrame*       aOldFrame);
 
   virtual nsIAtom* GetType() const { return nsGkAtoms::menuFrame; }
 
   NS_IMETHOD SelectMenu(PRBool aActivateFlag);
 
   virtual nsIScrollableFrame* GetScrollTargetFrame();
 
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -261,17 +261,17 @@ nsMenuPopupFrame::PopupLevel(PRBool aIsN
   return sDefaultLevelIsTop ? ePopupLevelTop : ePopupLevelParent;
 }
 
 void
 nsMenuPopupFrame::EnsureWidget()
 {
   nsIView* ourView = GetView();
   if (!ourView->HasWidget()) {
-    NS_ASSERTION(!mGeneratedChildren && !GetFirstChild(nsnull),
+    NS_ASSERTION(!mGeneratedChildren && !GetFirstPrincipalChild(),
                  "Creating widget for MenuPopupFrame with children");
     CreateWidgetForView(ourView);
   }
 }
 
 nsresult
 nsMenuPopupFrame::CreateWidgetForView(nsIView* aView)
 {
@@ -380,23 +380,23 @@ public:
   }
 
 private:
   nsCOMPtr<nsIContent> mPopup;
   nsRefPtr<nsPresContext> mPresContext;
 };
 
 NS_IMETHODIMP
-nsMenuPopupFrame::SetInitialChildList(nsIAtom* aListName,
+nsMenuPopupFrame::SetInitialChildList(ChildListID  aListID,
                                       nsFrameList& aChildList)
 {
   // unless the list is empty, indicate that children have been generated.
   if (aChildList.NotEmpty())
     mGeneratedChildren = PR_TRUE;
-  return nsBoxFrame::SetInitialChildList(aListName, aChildList);
+  return nsBoxFrame::SetInitialChildList(aListID, aChildList);
 }
 
 PRBool
 nsMenuPopupFrame::IsLeaf() const
 {
   if (mGeneratedChildren)
     return PR_FALSE;
 
@@ -1478,17 +1478,17 @@ nsIScrollableFrame* nsMenuPopupFrame::Ge
     if (sf)
       return sf;
     currFrame = currFrame->GetNextSibling();
   } while (currFrame);
 
   // try children
   currFrame = aStart;
   do {
-    nsIFrame* childFrame = currFrame->GetFirstChild(nsnull);
+    nsIFrame* childFrame = currFrame->GetFirstPrincipalChild();
     nsIScrollableFrame* sf = GetScrollFrame(childFrame);
     if (sf)
       return sf;
     currFrame = currFrame->GetNextSibling();
   } while (currFrame);
 
   return nsnull;
 }
@@ -1651,17 +1651,17 @@ nsMenuPopupFrame::FindMenuWithShortcut(n
   lastKeyTime = keyTime;
 
   nsIFrame* currFrame;
   // NOTE: If you crashed here due to a bogus |immediateParent| it is 
   //       possible that the menu whose shortcut is being looked up has 
   //       been destroyed already.  One strategy would be to 
   //       setTimeout(<func>,0) as detailed in:
   //       <http://bugzilla.mozilla.org/show_bug.cgi?id=126675#c32>
-  cu