Bug 564991. Part 3: Create unique nsDisplayItem types for every single display item. r=tnikkel
authorMichael Ventnor <mventnor@mozilla.com>
Fri, 16 Jul 2010 09:07:49 +1200
changeset 47732 85bbe15e63bd253b52406f240c0ba14023c70e00
parent 47731 469c18b0c36d3f9d283f3b0ce10e43701fa9bc14
child 47733 ab624c68983ec8d3f9f65446572160978d362a2e
push idunknown
push userunknown
push dateunknown
reviewerstnikkel
bugs564991
milestone2.0b2pre
Bug 564991. Part 3: Create unique nsDisplayItem types for every single display item. r=tnikkel
layout/base/Makefile.in
layout/base/nsDisplayItemTypes.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsGfxCheckboxControlFrame.cpp
layout/forms/nsGfxRadioControlFrame.cpp
layout/forms/nsSelectsAreaFrame.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsHTMLContainerFrame.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsObjectFrame.h
layout/generic/nsPageFrame.cpp
layout/generic/nsPlaceholderFrame.cpp
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsTextFrameThebes.cpp
layout/generic/nsVideoFrame.cpp
layout/mathml/nsMathMLChar.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLFrame.cpp
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmfracFrame.cpp
layout/svg/base/src/nsSVGOuterSVGFrame.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsGroupBoxFrame.cpp
layout/xul/base/src/nsImageBoxFrame.cpp
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeColFrame.cpp
--- a/layout/base/Makefile.in
+++ b/layout/base/Makefile.in
@@ -64,16 +64,17 @@ EXPORTS		= \
 		FrameLayerBuilder.h \
 		FramePropertyTable.h \
 		nsBidi.h \
 		nsBidiPresUtils.h \
 		nsCaret.h \
 		nsCSSFrameConstructor.h \
 		nsChangeHint.h \
 		nsCompatibility.h \
+		nsDisplayItemTypes.h \
 		nsDisplayList.h \
 		nsFrameManager.h \
 		nsFrameManagerBase.h \
 		nsFrameTraversal.h \
 		nsIDocumentViewer.h \
 		nsIFrameTraversal.h \
 		nsIImageMap.h \
 		nsILayoutDebugger.h \
new file mode 100644
--- /dev/null
+++ b/layout/base/nsDisplayItemTypes.h
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: set ts=2 sw=2 et tw=78:
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *     Michael Ventnor <m.ventnor@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
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK *****
+ */
+
+/**
+ * It's useful to be able to dynamically check the type of certain items.
+ * Every subclass of nsDisplayItem must have a new type added here for the purposes
+ * of easy comparison and matching of items in different display lists.
+ * 
+ * This is #included inside nsDisplayItem.
+ */
+enum Type {
+  TYPE_ALT_FEEDBACK = 1,
+  TYPE_BACKGROUND,
+  TYPE_BORDER,
+  TYPE_BOX_SHADOW_OUTER,
+  TYPE_BOX_SHADOW_INNER,
+  TYPE_BULLET,
+  TYPE_BUTTON_BORDER_BACKGROUND,
+  TYPE_BUTTON_BOX_SHADOW_OUTER,
+  TYPE_BUTTON_FOREGROUND,
+  TYPE_CANVAS,
+  TYPE_CANVAS_BACKGROUND,
+  TYPE_CANVAS_FOCUS,
+  TYPE_CARET,
+  TYPE_CHECKED_CHECKBOX,
+  TYPE_CHECKED_RADIOBUTTON,
+  TYPE_CLIP,
+  TYPE_COLUMN_RULE,
+  TYPE_COMBOBOX_FOCUS,
+  TYPE_EVENT_RECEIVER,
+  TYPE_FIELDSET_BORDER_BACKGROUND,
+  TYPE_FRAMESET_BORDER,
+  TYPE_FRAMESET_BLANK,
+  TYPE_HEADER_FOOTER,
+  TYPE_IMAGE,
+  TYPE_LIST_FOCUS,
+  TYPE_OPACITY,
+  TYPE_OPTION_EVENT_GRABBER,
+  TYPE_OUTLINE,
+  TYPE_PAGE_CONTENT,
+  TYPE_PAGE_SEQUENCE,
+  TYPE_PLUGIN,
+  TYPE_PRINT_PREVIEW_BACKGROUND,
+  TYPE_PRINT_PLUGIN,
+  TYPE_SELECTION_OVERLAY,
+  TYPE_SOLID_COLOR,
+  TYPE_TABLE_CELL_BACKGROUND,
+  TYPE_TABLE_CELL_SELECTION,
+  TYPE_TABLE_ROW_BACKGROUND,
+  TYPE_TABLE_ROW_GROUP_BACKGROUND,
+  TYPE_TABLE_BORDER_BACKGROUND,
+  TYPE_TEXT,
+  TYPE_TEXT_DECORATION,
+  TYPE_TEXT_SHADOW,
+  TYPE_TRANSFORM,
+  TYPE_VIDEO,
+  TYPE_WRAP_LIST,
+
+#if defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF)
+  TYPE_REFLOW_COUNT,
+#endif
+
+#ifdef MOZ_SVG
+  TYPE_SVG_EFFECTS,
+  TYPE_SVG_EVENT_RECEIVER,
+#endif
+
+#ifdef MOZ_XUL
+  TYPE_XUL_EVENT_REDIRECTOR,
+  TYPE_XUL_GROUP_BACKGROUND,
+  TYPE_XUL_IMAGE,
+  TYPE_XUL_TEXT_BOX,
+  TYPE_XUL_TREE_BODY,
+  TYPE_XUL_TREE_COL_SPLITTER_TARGET,
+#ifdef DEBUG_LAYOUT
+  TYPE_XUL_DEBUG,
+#endif
+#endif
+
+#ifdef MOZ_MATHML
+  TYPE_MATHML_BAR,
+  TYPE_MATHML_CHAR_BACKGROUND,
+  TYPE_MATHML_CHAR_FOREGROUND,
+  TYPE_MATHML_ERROR,
+  TYPE_MATHML_MENCLOSE_NOTATION,
+  TYPE_MATHML_SELECTION_RECT,
+  TYPE_MATHML_SLASH,
+#ifdef NS_DEBUG
+  TYPE_MATHML_BOUNDING_METRICS,
+  TYPE_MATHML_CHAR_DEBUG,
+#endif
+#endif
+
+#ifdef NS_DEBUG
+  TYPE_DEBUG_BORDER,
+  TYPE_DEBUG_IMAGE_MAP,
+  TYPE_DEBUG_PLACEHOLDER,
+  TYPE_EVENT_TARGET_BORDER,
+#endif
+
+  TYPE_MAX
+};
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -289,17 +289,17 @@ void nsDisplayListSet::MoveTo(const nsDi
   aDestination.PositionedDescendants()->AppendToTop(PositionedDescendants());
   aDestination.Outlines()->AppendToTop(Outlines());
 }
 
 void
 nsDisplayList::FlattenTo(nsTArray<nsDisplayItem*>* aElements) {
   nsDisplayItem* item;
   while ((item = RemoveBottom()) != nsnull) {
-    if (item->GetType() == nsDisplayItem::TYPE_WRAPLIST) {
+    if (item->GetType() == nsDisplayItem::TYPE_WRAP_LIST) {
       item->GetList()->FlattenTo(aElements);
       item->~nsDisplayItem();
     } else {
       aElements->AppendElement(item);
     }
   }
 }
 
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -98,20 +98,24 @@ class nsDisplayItem;
  * inconsistent state (e.g., a frame's stored overflow-area may not include
  * the bounds of all its children). However, it should be fine to create
  * a display list while a reflow is pending, before it starts.
  * 
  * A display list covers the "extended" frame tree; the display list for a frame
  * tree containing FRAME/IFRAME elements can include frames from the subdocuments.
  */
 
+// All types are defined in nsDisplayItemTypes.h
 #ifdef NS_DEBUG
-#define NS_DISPLAY_DECL_NAME(n) virtual const char* Name() { return n; }
+#define NS_DISPLAY_DECL_NAME(n, e) \
+  virtual const char* Name() { return n; } \
+  virtual Type GetType() { return e; }
 #else
-#define NS_DISPLAY_DECL_NAME(n) 
+#define NS_DISPLAY_DECL_NAME(n, e) \
+  virtual Type GetType() { return e; }
 #endif
 
 /**
  * This manages a display list and is passed as a parameter to
  * nsIFrame::BuildDisplayList.
  * It contains the parameters that don't change from frame to frame and manages
  * the display list memory using a PLArena. It also establishes the reference
  * coordinate system for all display list items. Some of the parameters are
@@ -480,49 +484,33 @@ public:
   nsDisplayItem(nsIFrame* aFrame) : mFrame(aFrame) {}
   virtual ~nsDisplayItem() {}
   
   void* operator new(size_t aSize,
                      nsDisplayListBuilder* aBuilder) CPP_THROW_NEW {
     return aBuilder->Allocate(aSize);
   }
 
-  /**
-   * It's useful to be able to dynamically check the type of certain items.
-   * For items whose type never gets checked, TYPE_GENERIC will suffice.
-   */
-  enum Type {
-    TYPE_GENERIC,
-
-    TYPE_BORDER,
-    TYPE_CLIP,
-    TYPE_OPACITY,
-    TYPE_OUTLINE,
-    TYPE_PLUGIN,
-#ifdef MOZ_SVG
-    TYPE_SVG_EFFECTS,
-#endif
-    TYPE_TRANSFORM,
-    TYPE_WRAPLIST
-  };
+// Contains all the type integers for each display list item type
+#include "nsDisplayItemTypes.h"
 
   struct HitTestState {
     ~HitTestState() {
       NS_ASSERTION(mItemBuffer.Length() == 0,
                    "mItemBuffer should have been cleared");
     }
     nsAutoTArray<nsDisplayItem*, 100> mItemBuffer;
   };
 
   /**
    * Some consecutive items should be rendered together as a unit, e.g.,
    * outlines for the same element. For this, we need a way for items to
    * identify their type.
    */
-  virtual Type GetType() { return TYPE_GENERIC; }
+  virtual Type GetType() = 0;
   /**
    * This is called after we've constructed a display list for event handling.
    * When this is called, we've already ensured that aRect intersects the
    * item's bounds.
    * 
    * @param aState must point to a HitTestState. If you don't have one,
    * just create one with the default constructor and pass it in.
    * @param aOutFrames each item appends the frame(s) in this display item that
@@ -1049,39 +1037,41 @@ private:
  * custom display item class could be, and fractionally slower. However it does
  * save code size. We use this for infrequently-used item types.
  */
 class nsDisplayGeneric : public nsDisplayItem {
 public:
   typedef void (* PaintCallback)(nsIFrame* aFrame, nsIRenderingContext* aCtx,
                                  const nsRect& aDirtyRect, nsPoint aFramePt);
 
-  nsDisplayGeneric(nsIFrame* aFrame, PaintCallback aPaint, const char* aName)
+  nsDisplayGeneric(nsIFrame* aFrame, PaintCallback aPaint, const char* aName, Type aType)
     : nsDisplayItem(aFrame), mPaint(aPaint)
 #ifdef DEBUG
       , mName(aName)
 #endif
+      , mType(aType)
   {
     MOZ_COUNT_CTOR(nsDisplayGeneric);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayGeneric() {
     MOZ_COUNT_DTOR(nsDisplayGeneric);
   }
 #endif
   
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx) {
     mPaint(mFrame, aCtx, mVisibleRect, aBuilder->ToReferenceFrame(mFrame));
   }
-  NS_DISPLAY_DECL_NAME(mName)
+  NS_DISPLAY_DECL_NAME(mName, mType)
 protected:
   PaintCallback mPaint;
 #ifdef DEBUG
   const char*   mName;
 #endif
+  Type mType;
 };
 
 #if defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF)
 /**
  * This class implements painting of reflow counts.  Ideally, we would simply
  * make all the frame names be those returned by nsFrame::GetFrameName
  * (except that tosses in the content tag name!)  and support only one color
  * and eliminate this class altogether in favor of nsDisplayGeneric, but for
@@ -1110,17 +1100,17 @@ public:
   
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx) {
     nsPoint pt = aBuilder->ToReferenceFrame(mFrame);
     nsIRenderingContext::AutoPushTranslation translate(aCtx, pt.x, pt.y);
     mFrame->PresContext()->PresShell()->PaintCount(mFrameName, aCtx,
                                                       mFrame->PresContext(),
                                                       mFrame, mColor);
   }
-  NS_DISPLAY_DECL_NAME("nsDisplayReflowCount")
+  NS_DISPLAY_DECL_NAME("nsDisplayReflowCount", TYPE_REFLOW_COUNT)
 protected:
   const char* mFrameName;
   nscolor mColor;
 };
 
 #define DO_GLOBAL_REFLOW_COUNT_DSP(_name)                                     \
   PR_BEGIN_MACRO                                                              \
     if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery() &&   \
@@ -1175,17 +1165,17 @@ public:
   }
 #endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
     // The caret returns a rect in the coordinates of mFrame.
     return mCaret->GetCaretRect() + aBuilder->ToReferenceFrame(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("Caret")
+  NS_DISPLAY_DECL_NAME("Caret", TYPE_CARET)
 protected:
   nsRefPtr<nsCaret> mCaret;
 };
 
 /**
  * The standard display item to paint the CSS borders of a frame.
  */
 class nsDisplayBorder : public nsDisplayItem {
@@ -1194,22 +1184,21 @@ public:
     MOZ_COUNT_CTOR(nsDisplayBorder);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayBorder() {
     MOZ_COUNT_DTOR(nsDisplayBorder);
   }
 #endif
 
-  virtual Type GetType() { return TYPE_BORDER; }
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
-  NS_DISPLAY_DECL_NAME("Border")
+  NS_DISPLAY_DECL_NAME("Border", TYPE_BORDER)
 };
 
 /**
  * A simple display item that just renders a solid color across the
  * specified bounds. For canvas frames (in the CSS sense) we split off the
  * drawing of the background color into this class (from nsDisplayBackground
  * via nsDisplayCanvasBackground). This is done so that we can always draw a
  * background color to avoid ugly flashes of white when we can't draw a full
@@ -1239,17 +1228,18 @@ public:
   virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor)
   {
     *aColor = mColor;
     return PR_TRUE;
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
 
-  NS_DISPLAY_DECL_NAME("SolidColor")
+  NS_DISPLAY_DECL_NAME("SolidColor", TYPE_SOLID_COLOR)
+
 private:
   nsRect  mBounds;
   nscolor mColor;
 };
 
 /**
  * The standard display item to paint the CSS background of a frame.
  */
@@ -1270,17 +1260,17 @@ public:
   {
     aOutFrames->AppendElement(mFrame);
   }
   virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
   virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder);
   virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("Background")
+  NS_DISPLAY_DECL_NAME("Background", TYPE_BACKGROUND)
 private:
   /* Used to cache mFrame->IsThemed() since it isn't a cheap call */
   PRPackedBool mIsThemed;
   nsITheme::Transparency mThemeTransparency;
 };
 
 /**
  * The standard display item to paint the outer CSS box-shadows of a frame.
@@ -1296,17 +1286,17 @@ public:
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
-  NS_DISPLAY_DECL_NAME("BoxShadowOuter")
+  NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER)
 
 private:
   nsRegion mVisibleRegion;
 };
 
 /**
  * The standard display item to paint the inner CSS box-shadows of a frame.
  */
@@ -1320,17 +1310,17 @@ public:
     MOZ_COUNT_DTOR(nsDisplayBoxShadowInner);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
-  NS_DISPLAY_DECL_NAME("BoxShadowInner")
+  NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER)
 
 private:
   nsRegion mVisibleRegion;
 };
 
 /**
  * The standard display item to paint the CSS outline of a frame.
  */
@@ -1340,23 +1330,22 @@ public:
     MOZ_COUNT_CTOR(nsDisplayOutline);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayOutline() {
     MOZ_COUNT_DTOR(nsDisplayOutline);
   }
 #endif
 
-  virtual Type GetType() { return TYPE_OUTLINE; }
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
-  NS_DISPLAY_DECL_NAME("Outline")
+  NS_DISPLAY_DECL_NAME("Outline", TYPE_OUTLINE)
 };
 
 /**
  * A class that lets you receive events within the frame bounds but never paints.
  */
 class nsDisplayEventReceiver : public nsDisplayItem {
 public:
   nsDisplayEventReceiver(nsIFrame* aFrame) : nsDisplayItem(aFrame) {
@@ -1368,17 +1357,17 @@ public:
   }
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
   {
     aOutFrames->AppendElement(mFrame);
   }
-  NS_DISPLAY_DECL_NAME("EventReceiver")
+  NS_DISPLAY_DECL_NAME("EventReceiver", TYPE_EVENT_RECEIVER)
 };
 
 /**
  * A class that lets you wrap a display list as a display item.
  * 
  * GetUnderlyingFrame() is troublesome for wrapped lists because if the wrapped
  * list has many items, it's not clear which one has the 'underlying frame'.
  * Thus we force the creator to specify what the underlying frame is. The
@@ -1396,32 +1385,31 @@ class nsDisplayWrapList : public nsDispl
 
 public:
   /**
    * Takes all the items from aList and puts them in our list.
    */
   nsDisplayWrapList(nsIFrame* aFrame, nsDisplayList* aList);
   nsDisplayWrapList(nsIFrame* aFrame, nsDisplayItem* aItem);
   virtual ~nsDisplayWrapList();
-  virtual Type GetType() { return TYPE_WRAPLIST; }
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
   virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor);
   virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder);
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
     NS_WARNING("This list should already have been flattened!!!");
     return PR_FALSE;
   }
-  NS_DISPLAY_DECL_NAME("WrapList")
+  NS_DISPLAY_DECL_NAME("WrapList", TYPE_WRAP_LIST)
                                     
   virtual nsDisplayList* GetList() { return &mList; }
   
   /**
    * This creates a copy of this item, but wrapping aItem instead of
    * our existing list. Only gets called if this item returned nsnull
    * for GetUnderlyingFrame(). aItem is guaranteed to return non-null from
    * GetUnderlyingFrame().
@@ -1470,25 +1458,24 @@ protected:
  */
 class nsDisplayOpacity : public nsDisplayWrapList {
 public:
   nsDisplayOpacity(nsIFrame* aFrame, nsDisplayList* aList);
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayOpacity();
 #endif
   
-  virtual Type GetType() { return TYPE_OPACITY; }
   virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
   virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
                                              LayerManager* aManager);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);  
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
-  NS_DISPLAY_DECL_NAME("Opacity")
+  NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
 };
 
 /**
  * nsDisplayClip can clip a list of items, but we take a single item
  * initially and then later merge other items into it when we merge
  * adjacent matching nsDisplayClips
  */
 class nsDisplayClip : public nsDisplayWrapList {
@@ -1501,24 +1488,23 @@ public:
   nsDisplayClip(nsIFrame* aFrame, nsIFrame* aClippingFrame, 
                 nsDisplayItem* aItem, const nsRect& aRect);
   nsDisplayClip(nsIFrame* aFrame, nsIFrame* aClippingFrame,
                 nsDisplayList* aList, const nsRect& aRect);
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayClip();
 #endif
   
-  virtual Type GetType() { return TYPE_CLIP; }
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
-  NS_DISPLAY_DECL_NAME("Clip")
+  NS_DISPLAY_DECL_NAME("Clip", TYPE_CLIP)
   
   nsRect GetClipRect() { return mClip; }
   void SetClipRect(const nsRect& aRect) { mClip = aRect; }
   nsIFrame* GetClippingFrame() { return mClippingFrame; }
 
   virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder,
                                            nsDisplayItem* aItem);
 
@@ -1538,29 +1524,28 @@ private:
  */
 class nsDisplaySVGEffects : public nsDisplayWrapList {
 public:
   nsDisplaySVGEffects(nsIFrame* aFrame, nsDisplayList* aList);
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplaySVGEffects();
 #endif
   
-  virtual Type GetType() { return TYPE_SVG_EFFECTS; }
   virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
     return mBounds + aBuilder->ToReferenceFrame(mEffectsFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);  
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
-  NS_DISPLAY_DECL_NAME("SVGEffects")
+  NS_DISPLAY_DECL_NAME("SVGEffects", TYPE_SVG_EFFECTS)
 
   nsIFrame* GetEffectsFrame() { return mEffectsFrame; }
 
 private:
   nsIFrame* mEffectsFrame;
   // relative to mEffectsFrame
   nsRect    mBounds;
 };
@@ -1586,22 +1571,17 @@ public:
 
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayTransform()
   {
     MOZ_COUNT_DTOR(nsDisplayTransform);
   }
 #endif
 
-  NS_DISPLAY_DECL_NAME("nsDisplayTransform");
-
-  virtual Type GetType() 
-  {
-    return TYPE_TRANSFORM;
-  }
+  NS_DISPLAY_DECL_NAME("nsDisplayTransform", TYPE_TRANSFORM);
 
 #ifdef NS_DEBUG
   nsDisplayWrapList* GetStoredList() { return &mStoredList; }
 #endif
 
   virtual void HitTest(nsDisplayListBuilder *aBuilder, const nsRect& aRect,
                        HitTestState *aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual nsRect GetBounds(nsDisplayListBuilder *aBuilder);
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -101,17 +101,17 @@ public:
   virtual ~nsDisplayButtonBoxShadowOuter() {
     MOZ_COUNT_DTOR(nsDisplayButtonBoxShadowOuter);
   }
 #endif  
   
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  NS_DISPLAY_DECL_NAME("ButtonBoxShadowOuter")
+  NS_DISPLAY_DECL_NAME("ButtonBoxShadowOuter", TYPE_BUTTON_BOX_SHADOW_OUTER)
 private:
   nsButtonFrameRenderer* mBFR;
 };
 
 nsRect
 nsDisplayButtonBoxShadowOuter::GetBounds(nsDisplayListBuilder* aBuilder) {
   return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
 }
@@ -141,17 +141,17 @@ public:
 #endif  
   
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("ButtonBorderBackground")
+  NS_DISPLAY_DECL_NAME("ButtonBorderBackground", TYPE_BUTTON_BORDER_BACKGROUND)
 private:
   nsButtonFrameRenderer* mBFR;
 };
 
 class nsDisplayButtonForeground : public nsDisplayItem {
 public:
   nsDisplayButtonForeground(nsButtonFrameRenderer* aRenderer)
     : nsDisplayItem(aRenderer->GetFrame()), mBFR(aRenderer) {
@@ -160,17 +160,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayButtonForeground() {
     MOZ_COUNT_DTOR(nsDisplayButtonForeground);
   }
 #endif  
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("ButtonForeground")
+  NS_DISPLAY_DECL_NAME("ButtonForeground", TYPE_BUTTON_FOREGROUND)
 private:
   nsButtonFrameRenderer* mBFR;
 };
 
 void nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
                                             nsIRenderingContext* aCtx)
 {
   NS_ASSERTION(mFrame, "No frame?");
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1319,17 +1319,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayComboboxFocus() {
     MOZ_COUNT_DTOR(nsDisplayComboboxFocus);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("ComboboxFocus")
+  NS_DISPLAY_DECL_NAME("ComboboxFocus", TYPE_COMBOBOX_FOCUS)
 };
 
 void nsDisplayComboboxFocus::Paint(nsDisplayListBuilder* aBuilder,
                                    nsIRenderingContext* aCtx)
 {
   static_cast<nsComboboxControlFrame*>(mFrame)
     ->PaintFocus(*aCtx, aBuilder->ToReferenceFrame(mFrame));
 }
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -185,17 +185,17 @@ public:
     MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
   }
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("FieldSetBorderBackground")
+  NS_DISPLAY_DECL_NAME("FieldSetBorderBackground", TYPE_FIELDSET_BORDER_BACKGROUND)
 };
 
 void nsDisplayFieldSetBorderBackground::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                                                 HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
 {
   // aPt is guaranteed to be in this item's bounds. We do the hit test based on the
   // frame bounds even though our background doesn't cover the whole frame.
   // It's not clear whether this is correct.
--- a/layout/forms/nsGfxCheckboxControlFrame.cpp
+++ b/layout/forms/nsGfxCheckboxControlFrame.cpp
@@ -151,17 +151,18 @@ nsGfxCheckboxControlFrame::BuildDisplayL
     
   if (IsThemed())
     return NS_OK; // No need to paint the checkmark. The theme will do it.
 
   return aLists.Content()->AppendNewToTop(new (aBuilder)
     nsDisplayGeneric(this,
                      IsIndeterminate()
                      ? PaintIndeterminateMark : PaintCheckMark,
-                     "CheckedCheckbox"));
+                     "CheckedCheckbox",
+                     nsDisplayItem::TYPE_CHECKED_CHECKBOX));
 }
 
 //------------------------------------------------------------
 PRBool
 nsGfxCheckboxControlFrame::IsChecked()
 {
   nsCOMPtr<nsIDOMHTMLInputElement> elem(do_QueryInterface(mContent));
   PRBool retval = PR_FALSE;
--- a/layout/forms/nsGfxRadioControlFrame.cpp
+++ b/layout/forms/nsGfxRadioControlFrame.cpp
@@ -115,10 +115,11 @@ nsGfxRadioControlFrame::BuildDisplayList
     return NS_OK; // The theme will paint the check, if any.
 
   PRBool checked = PR_TRUE;
   GetCurrentCheckState(&checked); // Get check state from the content model
   if (!checked)
     return NS_OK;
     
   return aLists.Content()->AppendNewToTop(new (aBuilder)
-    nsDisplayGeneric(this, PaintCheckedRadioButton, "CheckedRadioButton"));
+    nsDisplayGeneric(this, PaintCheckedRadioButton, "CheckedRadioButton",
+                     nsDisplayItem::TYPE_CHECKED_RADIOBUTTON));
 }
--- a/layout/forms/nsSelectsAreaFrame.cpp
+++ b/layout/forms/nsSelectsAreaFrame.cpp
@@ -93,17 +93,17 @@ nsSelectsAreaFrame::IsOptionElementFrame
 class nsDisplayOptionEventGrabber : public nsDisplayWrapList {
 public:
   nsDisplayOptionEventGrabber(nsIFrame* aFrame, nsDisplayItem* aItem)
     : nsDisplayWrapList(aFrame, aItem) {}
   nsDisplayOptionEventGrabber(nsIFrame* aFrame, nsDisplayList* aList)
     : nsDisplayWrapList(aFrame, aList) {}
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
-  NS_DISPLAY_DECL_NAME("OptionEventGrabber")
+  NS_DISPLAY_DECL_NAME("OptionEventGrabber", TYPE_OPTION_EVENT_GRABBER)
 
   virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder,
                                            nsDisplayItem* aItem);
 };
 
 void nsDisplayOptionEventGrabber::HitTest(nsDisplayListBuilder* aBuilder,
     const nsRect& aRect, HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
 {
@@ -176,17 +176,17 @@ public:
     return listFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(listFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx) {
     nsListControlFrame* listFrame = GetEnclosingListFrame(GetUnderlyingFrame());
     // listFrame must be non-null or we wouldn't get called.
     listFrame->PaintFocus(*aCtx, aBuilder->ToReferenceFrame(listFrame));
   }
-  NS_DISPLAY_DECL_NAME("ListFocus")
+  NS_DISPLAY_DECL_NAME("ListFocus", TYPE_LIST_FOCUS)
 };
 
 NS_IMETHODIMP
 nsSelectsAreaFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                      const nsRect&           aDirtyRect,
                                      const nsDisplayListSet& aLists)
 {
   if (!aBuilder->IsForEventDelivery())
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -194,17 +194,17 @@ public:
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("Bullet")
+  NS_DISPLAY_DECL_NAME("Bullet", TYPE_BULLET)
 };
 
 void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder,
                             nsIRenderingContext* aCtx)
 {
   static_cast<nsBulletFrame*>(mFrame)->
     PaintBullet(*aCtx, aBuilder->ToReferenceFrame(mFrame), mVisibleRect);
 }
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -274,17 +274,17 @@ public:
     nsRect bgClipRect = frame->CanvasArea() + offset;
     nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
                                     mVisibleRect,
                                     nsRect(offset, mFrame->GetSize()),
                                     aBuilder->GetBackgroundPaintFlags(),
                                     &bgClipRect);
   }
 
-  NS_DISPLAY_DECL_NAME("CanvasBackground")
+  NS_DISPLAY_DECL_NAME("CanvasBackground", TYPE_CANVAS_BACKGROUND)
 };
 
 /**
  * A display item to paint the focus ring for the document.
  *
  * The only reason this can't use nsDisplayGeneric is overriding GetBounds.
  */
 class nsDisplayCanvasFocus : public nsDisplayItem {
@@ -307,17 +307,17 @@ public:
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx)
   {
     nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
     frame->PaintFocus(*aCtx, aBuilder->ToReferenceFrame(mFrame));
   }
 
-  NS_DISPLAY_DECL_NAME("CanvasFocus")
+  NS_DISPLAY_DECL_NAME("CanvasFocus", TYPE_CANVAS_FOCUS)
 };
 
 NS_IMETHODIMP
 nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
                                 const nsDisplayListSet& aLists)
 {
   nsresult rv;
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -1081,17 +1081,18 @@ nsColumnSetFrame::Reflow(nsPresContext* 
 NS_IMETHODIMP
 nsColumnSetFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                    const nsRect&           aDirtyRect,
                                    const nsDisplayListSet& aLists) {
   nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
-      nsDisplayGeneric(this, ::PaintColumnRule, "ColumnRule"));
+      nsDisplayGeneric(this, ::PaintColumnRule, "ColumnRule",
+                       nsDisplayItem::TYPE_COLUMN_RULE));
   
   nsIFrame* kid = mFrames.FirstChild();
   // Our children won't have backgrounds so it doesn't matter where we put them.
   while (kid) {
     nsresult rv = BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
     kid = kid->GetNextSibling();
   }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -831,17 +831,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplaySelectionOverlay() {
     MOZ_COUNT_DTOR(nsDisplaySelectionOverlay);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("SelectionOverlay")
+  NS_DISPLAY_DECL_NAME("SelectionOverlay", TYPE_SELECTION_OVERLAY)
 private:
   PRInt16 mSelectionValue;
 };
 
 void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
                                       nsIRenderingContext* aCtx)
 {
   nscolor color = NS_RGB(255, 255, 255);
@@ -1227,23 +1227,25 @@ static void PaintEventTargetBorder(nsIFr
 
 static void
 DisplayDebugBorders(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                     const nsDisplayListSet& aLists) {
   // Draw a border around the child
   // REVIEW: From nsContainerFrame::PaintChild
   if (nsFrame::GetShowFrameBorders() && !aFrame->GetRect().IsEmpty()) {
     aLists.Outlines()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(aFrame, PaintDebugBorder, "DebugBorder"));
+        nsDisplayGeneric(aFrame, PaintDebugBorder, "DebugBorder",
+                         nsDisplayItem::TYPE_DEBUG_BORDER));
   }
   // Draw a border around the current event target
   if (nsFrame::GetShowEventTargetFrameBorder() &&
       aFrame->PresContext()->PresShell()->GetDrawEventTargetFrame() == aFrame) {
     aLists.Outlines()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(aFrame, PaintEventTargetBorder, "EventTargetBorder"));
+        nsDisplayGeneric(aFrame, PaintEventTargetBorder, "EventTargetBorder",
+                         nsDisplayItem::TYPE_EVENT_TARGET_BORDER));
   }
 }
 #endif
 
 nsresult
 nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
                                              const nsRect&         aDirtyRect,
                                              nsDisplayList*        aList) {
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1633,17 +1633,17 @@ public:
   // REVIEW: see old GetFrameForPoint
   // Receives events in its bounds
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("FramesetBorder")
+  NS_DISPLAY_DECL_NAME("FramesetBorder", TYPE_FRAMESET_BORDER)
 };
 
 void nsDisplayFramesetBorder::Paint(nsDisplayListBuilder* aBuilder,
                                     nsIRenderingContext* aCtx)
 {
   static_cast<nsHTMLFramesetBorderFrame*>(mFrame)->
     PaintBorder(*aCtx, aBuilder->ToReferenceFrame(mFrame));
 }
@@ -1834,17 +1834,17 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayFramesetBlank() {
     MOZ_COUNT_DTOR(nsDisplayFramesetBlank);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("FramesetBlank")
+  NS_DISPLAY_DECL_NAME("FramesetBlank", TYPE_FRAMESET_BLANK)
 };
 void nsDisplayFramesetBlank::Paint(nsDisplayListBuilder* aBuilder,
                                    nsIRenderingContext* aCtx)
 {
   nscolor white = NS_RGB(255,255,255);
   aCtx->SetColor(white);
   aCtx->FillRect(mVisibleRect);
 }
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -70,17 +70,17 @@ public:
     MOZ_COUNT_CTOR(nsDisplayCanvas);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayCanvas() {
     MOZ_COUNT_DTOR(nsDisplayCanvas);
   }
 #endif
 
-  NS_DISPLAY_DECL_NAME("nsDisplayCanvas")
+  NS_DISPLAY_DECL_NAME("nsDisplayCanvas", TYPE_CANVAS)
 
   virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder) {
     nsIFrame* f = GetUnderlyingFrame();
     nsHTMLCanvasElement *canvas = CanvasElementFromContent(f->GetContent());
     return canvas->GetIsOpaque();
   }
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -83,17 +83,17 @@ public:
   virtual ~nsDisplayTextDecoration() {
     MOZ_COUNT_DTOR(nsDisplayTextDecoration);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  NS_DISPLAY_DECL_NAME("TextDecoration")
+  NS_DISPLAY_DECL_NAME("TextDecoration", TYPE_TEXT_DECORATION)
 private:
   nsLineBox*            mLine;
   nscolor               mColor;
   PRUint8               mDecoration;
 };
 
 void
 nsDisplayTextDecoration::Paint(nsDisplayListBuilder* aBuilder,
@@ -146,81 +146,71 @@ nsDisplayTextDecoration::Paint(nsDisplay
 nsRect
 nsDisplayTextDecoration::GetBounds(nsDisplayListBuilder* aBuilder)
 {
   return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
 }
 
 class nsDisplayTextShadow : public nsDisplayItem {
 public:
-  nsDisplayTextShadow(nsHTMLContainerFrame* aFrame, const PRUint8 aDecoration,
-                      const nscolor& aColor, nsLineBox* aLine,
-                      const nscoord& aBlurRadius, const nsPoint& aOffset)
-    : nsDisplayItem(aFrame), mLine(aLine), mColor(aColor),
-      mDecorationFlags(aDecoration),
-      mBlurRadius(aBlurRadius), mOffset(aOffset) {
+  nsDisplayTextShadow(nsHTMLContainerFrame* aFrame,
+                      const PRUint8 aDecoration,
+                      nsLineBox* aLine)
+    : nsDisplayItem(aFrame), mLine(aLine),
+      mDecorationFlags(aDecoration) {
     MOZ_COUNT_CTOR(nsDisplayTextShadow);
   }
   virtual ~nsDisplayTextShadow() {
     MOZ_COUNT_DTOR(nsDisplayTextShadow);
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  NS_DISPLAY_DECL_NAME("TextShadow")
+  NS_DISPLAY_DECL_NAME("TextShadowContainer", TYPE_TEXT_SHADOW)
 private:
   nsLineBox*    mLine;
-  nscolor       mColor;
   PRUint8       mDecorationFlags;
-  nscoord       mBlurRadius;
-  nsPoint       mOffset;
 };
 
 void
 nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
                            nsIRenderingContext* aCtx)
 {
-  mBlurRadius = NS_MAX(mBlurRadius, 0);
-
   nsCOMPtr<nsIFontMetrics> fm;
   nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));
   nsIThebesFontMetrics* tfm = static_cast<nsIThebesFontMetrics*>(fm.get());
   gfxFontGroup* fontGroup = tfm->GetThebesFontGroup();
   gfxFont* firstFont = fontGroup->GetFontAt(0);
   if (!firstFont)
     return; // OOM
 
   const gfxFont::Metrics& metrics = firstFont->GetMetrics();
   gfxFloat underlineOffset = fontGroup->GetUnderlineOffset();
 
   nsHTMLContainerFrame* f = static_cast<nsHTMLContainerFrame*>(mFrame);
-  nsPoint pt = aBuilder->ToReferenceFrame(mFrame) + mOffset;
   nsPresContext* presContext = mFrame->PresContext();
+  gfxContext* thebesCtx = aCtx->ThebesContext();
 
+  gfxFloat ascent;
   gfxFloat lineWidth;
-  nsPoint linePt;
-  gfxFloat ascent;
+  nscoord start;
   if (mLine) {
     // Block frames give us an nsLineBox, so we must use that
-    nscoord start = mLine->mBounds.x;
     nscoord width = mLine->mBounds.width;
+    start = mLine->mBounds.x;
     f->AdjustForTextIndent(mLine, start, width);
     if (width <= 0)
       return;
 
     lineWidth = presContext->AppUnitsToGfxUnits(width);
-    linePt = nsPoint(start + pt.x, mLine->mBounds.y + pt.y);
     ascent = presContext->AppUnitsToGfxUnits(mLine->GetAscent());
   } else {
     // For inline frames, we must use the frame's geometry
-    nsRect contentRect = mFrame->GetContentRect() - mFrame->GetPosition() + pt;
-
-    lineWidth = presContext->AppUnitsToGfxUnits(contentRect.width);
-    linePt = contentRect.TopLeft();
+    lineWidth = presContext->AppUnitsToGfxUnits(mFrame->GetContentRect().width);
 
     // The ascent of :first-letter frame's text may not be the same as the ascent
     // of the font metrics, because it may use the tight box of the actual
     // glyph.
     if (mFrame->GetType() == nsGkAtoms::letterFrame) {
       // Note that nsFirstLetterFrame::GetFirstLetterBaseline() returns
       // |border-top + padding-top + ascent|. But we only need the ascent value,
       // because those will be added in PaintTextDecorationLine.
@@ -228,73 +218,104 @@ nsDisplayTextShadow::Paint(nsDisplayList
       nscoord tmp = letterFrame->GetFirstLetterBaseline();
       tmp -= letterFrame->GetUsedBorderAndPadding().top;
       ascent = presContext->AppUnitsToGfxUnits(tmp);
     } else {
       ascent = metrics.maxAscent;
     }
   }
 
-  gfxContext* thebesCtx = aCtx->ThebesContext();
-  nsRect shadowRect(0, 0, 0, 0);
+  nsCSSShadowArray* shadowList = mFrame->GetStyleText()->mTextShadow;
+  NS_ABORT_IF_FALSE(shadowList,
+                    "Why did we make a display list item if we have no shadows?");
 
-  // Get the rects for each text decoration line, and union them together so we
-  // know the minimum size we can make our shadow-painting surface.
+  // Get the rects for each text decoration line, so we know how big we
+  // can make each shadow's surface
+  nsRect underlineRect;
+  nsRect overlineRect;
+  nsRect lineThroughRect;
   if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
     gfxSize size(lineWidth, metrics.underlineSize);
-    nsRect rect = nsCSSRendering::GetTextDecorationRect(presContext, size,
-                     ascent, underlineOffset, NS_STYLE_TEXT_DECORATION_UNDERLINE,
-                     nsCSSRendering::DECORATION_STYLE_SOLID);
-    shadowRect.UnionRect(shadowRect, rect + linePt);
+    underlineRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
+                       ascent, underlineOffset,
+                       NS_STYLE_TEXT_DECORATION_UNDERLINE,
+                       nsCSSRendering::DECORATION_STYLE_SOLID);
   }
   if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
     gfxSize size(lineWidth, metrics.underlineSize);
-    nsRect rect = nsCSSRendering::GetTextDecorationRect(presContext, size,
-                     ascent, metrics.maxAscent, NS_STYLE_TEXT_DECORATION_OVERLINE,
-                     nsCSSRendering::DECORATION_STYLE_SOLID);
-    shadowRect.UnionRect(shadowRect, rect + linePt);
+    overlineRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
+                       ascent, metrics.maxAscent,
+                       NS_STYLE_TEXT_DECORATION_OVERLINE,
+                       nsCSSRendering::DECORATION_STYLE_SOLID);
   }
   if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
     gfxSize size(lineWidth, metrics.strikeoutSize);
-    nsRect rect = nsCSSRendering::GetTextDecorationRect(presContext, size,
-                     ascent, metrics.strikeoutOffset, NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
-                     nsCSSRendering::DECORATION_STYLE_SOLID);
-    shadowRect.UnionRect(shadowRect, rect + linePt);
+    lineThroughRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
+                       ascent, metrics.strikeoutOffset,
+                       NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
+                       nsCSSRendering::DECORATION_STYLE_SOLID);
   }
 
-  // Create our shadow surface, then paint the text decorations onto it
-  nsContextBoxBlur contextBoxBlur;
-  gfxContext* shadowCtx = contextBoxBlur.Init(shadowRect, mBlurRadius,
-                                              presContext->AppUnitsPerDevPixel(),
-                                              thebesCtx, mVisibleRect, nsnull);
-  if (!shadowCtx)
-    return;
+  for (PRUint32 i = shadowList->Length(); i > 0; --i) {
+    nsCSSShadowItem* shadow = shadowList->ShadowAt(i - 1);
+
+    nscolor shadowColor =
+      shadow->mHasColor ? shadow->mColor : mFrame->GetStyleColor()->mColor;
 
-  thebesCtx->Save();
-  thebesCtx->NewPath();
-  thebesCtx->SetColor(gfxRGBA(mColor));
+    nsPoint pt = aBuilder->ToReferenceFrame(mFrame) +
+      nsPoint(shadow->mXOffset, shadow->mYOffset);
+    nsPoint linePt;
+    if (mLine) {
+      linePt = nsPoint(start + pt.x, mLine->mBounds.y + pt.y);
+    } else {
+      linePt = mFrame->GetContentRect().TopLeft() - mFrame->GetPosition() + pt;
+    }
+
+    nsRect shadowRect(0, 0, 0, 0);
+    if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
+      shadowRect.UnionRect(shadowRect, underlineRect + linePt);
+    }
+    if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
+      shadowRect.UnionRect(shadowRect, overlineRect + linePt);
+    }
+    if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
+      shadowRect.UnionRect(shadowRect, lineThroughRect + linePt);
+    }
 
-  if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
-    f->PaintTextDecorationLine(shadowCtx, pt, mLine, mColor,
-                               underlineOffset, ascent,
-                               metrics.underlineSize, NS_STYLE_TEXT_DECORATION_UNDERLINE);
+    gfxContextAutoSaveRestore save(thebesCtx);
+    thebesCtx->NewPath();
+    thebesCtx->SetColor(gfxRGBA(shadowColor));
+
+    // Create our shadow surface, then paint the text decorations onto it
+    nsContextBoxBlur contextBoxBlur;
+    gfxContext* shadowCtx = contextBoxBlur.Init(shadowRect, shadow->mRadius,
+                                                presContext->AppUnitsPerDevPixel(),
+                                                thebesCtx, mVisibleRect, nsnull);
+    if (!shadowCtx) {
+      continue;
+    }
+
+    if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
+      f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
+                                 underlineOffset, ascent,
+                                 metrics.underlineSize, NS_STYLE_TEXT_DECORATION_UNDERLINE);
+    }
+    if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
+      f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
+                                 metrics.maxAscent, ascent,
+                                 metrics.underlineSize, NS_STYLE_TEXT_DECORATION_OVERLINE);
+    }
+    if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
+      f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
+                                 metrics.strikeoutOffset, ascent,
+                                 metrics.strikeoutSize, NS_STYLE_TEXT_DECORATION_LINE_THROUGH);
+    }
+
+    contextBoxBlur.DoPaint();
   }
-  if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
-    f->PaintTextDecorationLine(shadowCtx, pt, mLine, mColor,
-                               metrics.maxAscent, ascent,
-                               metrics.underlineSize, NS_STYLE_TEXT_DECORATION_OVERLINE);
-  }
-  if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
-    f->PaintTextDecorationLine(shadowCtx, pt, mLine, mColor,
-                               metrics.strikeoutOffset, ascent,
-                               metrics.strikeoutSize, NS_STYLE_TEXT_DECORATION_LINE_THROUGH);
-  }
-
-  contextBoxBlur.DoPaint();
-  thebesCtx->Restore();
 }
 
 nsRect
 nsDisplayTextShadow::GetBounds(nsDisplayListBuilder* aBuilder)
 {
   // Shadows are always painted in the overflow rect
   return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
 }
@@ -316,53 +337,41 @@ nsHTMLContainerFrame::DisplayTextDecorat
   nscolor underColor, overColor, strikeColor;
   PRUint8 decorations = NS_STYLE_TEXT_DECORATION_NONE;
   GetTextDecorations(PresContext(), aLine != nsnull, decorations, underColor, 
                      overColor, strikeColor);
 
   if (decorations == NS_STYLE_TEXT_DECORATION_NONE)
     return NS_OK;
 
-  // The text-shadow spec says that any text decorations must also have a shadow applied to
-  // it. So draw the shadows as part of the display list.
-  const nsStyleText* textStyle = GetStyleText();
-
-  if (textStyle->mTextShadow) {
-    for (PRUint32 i = textStyle->mTextShadow->Length(); i > 0; --i) {
-      nsCSSShadowItem* shadow = textStyle->mTextShadow->ShadowAt(i - 1);
-      nscoord blurRadius = shadow->mRadius;
-      nscolor shadowColor;
-
-      if (shadow->mHasColor)
-        shadowColor = shadow->mColor;
-      else
-        shadowColor = GetStyleColor()->mColor;
-
-      nsPoint offset(shadow->mXOffset, shadow->mYOffset);
-
-      // Add it to the display list so it is painted underneath the text and all decorations
-      nsresult rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
-        nsDisplayTextShadow(this, decorations, shadowColor, aLine, blurRadius, offset));
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
+  // The text-shadow spec says that any text decorations must also have a
+  // shadow applied to them. So draw the shadows as part of the display
+  // list, underneath the text and all decorations.
+  if (GetStyleText()->mTextShadow) {
+    nsresult rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
+      nsDisplayTextShadow(this, decorations, aLine));
+    NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (decorations & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
     nsresult rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
-      nsDisplayTextDecoration(this, NS_STYLE_TEXT_DECORATION_UNDERLINE, underColor, aLine));
+      nsDisplayTextDecoration(this, NS_STYLE_TEXT_DECORATION_UNDERLINE,
+                              underColor, aLine));
     NS_ENSURE_SUCCESS(rv, rv);
   }
   if (decorations & NS_STYLE_TEXT_DECORATION_OVERLINE) {
     nsresult rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
-      nsDisplayTextDecoration(this, NS_STYLE_TEXT_DECORATION_OVERLINE, overColor, aLine));
+      nsDisplayTextDecoration(this, NS_STYLE_TEXT_DECORATION_OVERLINE,
+                              overColor, aLine));
     NS_ENSURE_SUCCESS(rv, rv);
   }
   if (decorations & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
     nsresult rv = aAboveTextDecorations->AppendNewToTop(new (aBuilder)
-      nsDisplayTextDecoration(this, NS_STYLE_TEXT_DECORATION_LINE_THROUGH, strikeColor, aLine));
+      nsDisplayTextDecoration(this, NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
+                              strikeColor, aLine));
     NS_ENSURE_SUCCESS(rv, rv);
   }
   return NS_OK;
 }
 
 nsresult
 nsHTMLContainerFrame::DisplayTextDecorationsAndChildren(
     nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect,
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1136,17 +1136,17 @@ public:
     : nsDisplayItem(aFrame), mImage(aImage) {
     MOZ_COUNT_CTOR(nsDisplayImage);
   }
   virtual ~nsDisplayImage() {
     MOZ_COUNT_DTOR(nsDisplayImage);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("Image")
+  NS_DISPLAY_DECL_NAME("Image", TYPE_IMAGE)
 private:
   nsCOMPtr<imgIContainer> mImage;
 };
 
 void
 nsDisplayImage::Paint(nsDisplayListBuilder* aBuilder,
                       nsIRenderingContext* aCtx) {
   static_cast<nsImageFrame*>(mFrame)->
@@ -1230,17 +1230,18 @@ nsImageFrame::BuildDisplayList(nsDisplay
 
     // We should never have the size and not have an image container
     NS_ABORT_IF_FALSE(!haveSize || imgCon, "Have size but not container?");
 
     if (!imageOK || !haveSize) {
       // No image yet, or image load failed. Draw the alt-text and an icon
       // indicating the status
       rv = aLists.Content()->AppendNewToTop(new (aBuilder)
-          nsDisplayGeneric(this, PaintAltFeedback, "AltFeedback"));
+          nsDisplayGeneric(this, PaintAltFeedback, "AltFeedback",
+                           nsDisplayItem::TYPE_ALT_FEEDBACK));
       NS_ENSURE_SUCCESS(rv, rv);
     }
     else {
       rv = aLists.Content()->AppendNewToTop(new (aBuilder)
           nsDisplayImage(this, imgCon));
       NS_ENSURE_SUCCESS(rv, rv);
 
       // If we were previously displaying an icon, we're not anymore
@@ -1248,17 +1249,18 @@ nsImageFrame::BuildDisplayList(nsDisplay
         gIconLoad->RemoveIconObserver(this);
         mDisplayingIcon = PR_FALSE;
       }
 
         
 #ifdef DEBUG
       if (GetShowFrameBorders() && GetImageMap(PresContext())) {
         rv = aLists.Outlines()->AppendNewToTop(new (aBuilder)
-            nsDisplayGeneric(this, PaintDebugImageMap, "DebugImageMap"));
+            nsDisplayGeneric(this, PaintDebugImageMap, "DebugImageMap",
+                             nsDisplayItem::TYPE_DEBUG_IMAGE_MAP));
         NS_ENSURE_SUCCESS(rv, rv);
       }
 #endif
     }
   }
 
   // XXX what on EARTH is this code for?
   nsresult result;
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -1348,17 +1348,18 @@ nsObjectFrame::BuildDisplayList(nsDispla
     // Windowed plugins should not be rendered inside a transform.
     return NS_OK;
   }
 #endif
 
   // determine if we are printing
   if (type == nsPresContext::eContext_Print)
     return aLists.Content()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(this, PaintPrintPlugin, "PrintPlugin"));
+        nsDisplayGeneric(this, PaintPrintPlugin, "PrintPlugin",
+                         nsDisplayItem::TYPE_PRINT_PLUGIN));
 
   return aLists.Content()->AppendNewToTop(new (aBuilder)
       nsDisplayPlugin(this));
 }
 
 void
 nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
                            const nsRect& aDirtyRect)
--- a/layout/generic/nsObjectFrame.h
+++ b/layout/generic/nsObjectFrame.h
@@ -270,26 +270,25 @@ public:
     MOZ_COUNT_CTOR(nsDisplayPlugin);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayPlugin() {
     MOZ_COUNT_DTOR(nsDisplayPlugin);
   }
 #endif
 
-  virtual Type GetType() { return TYPE_PLUGIN; }
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    nsRegion* aVisibleRegionBeforeMove);
 
-  NS_DISPLAY_DECL_NAME("Plugin")
+  NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN)
 
   // Compute the desired position and clip region of the plugin's widget.
   // This will only be called for plugins which have been registered
   // with the root pres context for geometry updates.
   // The widget, its new position, size and clip region are appended as
   // a Configuration record to aConfigurations.
   // If there is no widget associated with the plugin, this
   // simply does nothing.
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -419,27 +419,30 @@ nsPageFrame::BuildDisplayList(nsDisplayL
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists)
 {
   nsDisplayListCollection set;
   nsresult rv;
 
   if (PresContext()->IsScreen()) {
     rv = set.BorderBackground()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(this, ::PaintPrintPreviewBackground, "PrintPreviewBackground"));
+        nsDisplayGeneric(this, ::PaintPrintPreviewBackground, "PrintPreviewBackground",
+                         nsDisplayItem::TYPE_PRINT_PREVIEW_BACKGROUND));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   rv = set.BorderBackground()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(this, ::PaintPageContent, "PageContent"));
+        nsDisplayGeneric(this, ::PaintPageContent, "PageContent",
+                         nsDisplayItem::TYPE_PAGE_CONTENT));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (PresContext()->IsRootPaginatedDocument()) {
     rv = set.Content()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(this, ::PaintHeaderFooter, "HeaderFooter"));
+        nsDisplayGeneric(this, ::PaintHeaderFooter, "HeaderFooter",
+                         nsDisplayItem::TYPE_HEADER_FOOTER));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   set.MoveTo(aLists);
   return NS_OK;
 }
 
 //------------------------------------------------------------------------------
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -232,17 +232,18 @@ nsPlaceholderFrame::BuildDisplayList(nsD
 {
   DO_GLOBAL_REFLOW_COUNT_DSP("nsPlaceholderFrame");
   
 #ifdef DEBUG
   if (!GetShowFrameBorders())
     return NS_OK;
   
   return aLists.Outlines()->AppendNewToTop(new (aBuilder)
-      nsDisplayGeneric(this, PaintDebugPlaceholder, "DebugPlaceholder"));
+      nsDisplayGeneric(this, PaintDebugPlaceholder, "DebugPlaceholder",
+                       nsDisplayItem::TYPE_DEBUG_PLACEHOLDER));
 #else // DEBUG
   return NS_OK;
 #endif // DEBUG
 }
 #endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
 
 #ifdef DEBUG
 NS_IMETHODIMP
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -710,17 +710,18 @@ NS_IMETHODIMP
 nsSimplePageSequenceFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                             const nsRect&           aDirtyRect,
                                             const nsDisplayListSet& aLists)
 {
   nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = aLists.Content()->AppendNewToTop(new (aBuilder)
-        nsDisplayGeneric(this, ::PaintPageSequence, "PageSequence"));
+        nsDisplayGeneric(this, ::PaintPageSequence, "PageSequence",
+                         nsDisplayItem::TYPE_PAGE_SEQUENCE));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 nsIAtom*
 nsSimplePageSequenceFrame::GetType() const
 {
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -3883,17 +3883,17 @@ public:
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     if (nsRect(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize()).Intersects(aRect)) {
       aOutFrames->AppendElement(mFrame);
     }
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("Text")
+  NS_DISPLAY_DECL_NAME("Text", TYPE_TEXT)
 };
 
 void
 nsDisplayText::Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx) {
   // Add 1 pixel of dirty area around mVisibleRect to allow us to paint
   // antialiased pixels beyond the measured text extents.
   // This is temporary until we do this in the actual calculation of text extents.
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -349,17 +349,17 @@ public:
     MOZ_COUNT_CTOR(nsDisplayVideo);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayVideo() {
     MOZ_COUNT_DTOR(nsDisplayVideo);
   }
 #endif
   
-  NS_DISPLAY_DECL_NAME("Video")
+  NS_DISPLAY_DECL_NAME("Video", TYPE_VIDEO)
 
   // It would be great if we could override IsOpaque to return false here,
   // but it's probably not safe to do so in general. Video frames are
   // updated asynchronously from decoder threads, and it's possible that
   // we might have an opaque video frame when IsOpaque is called, but
   // when we come to paint, the video frame is transparent or has gone
   // away completely (e.g. because of a decoder error). The problem would
   // be especially acute if we have off-main-thread rendering.
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1874,17 +1874,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLSelectionRect() {
     MOZ_COUNT_DTOR(nsDisplayMathMLSelectionRect);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLSelectionRect")
+  NS_DISPLAY_DECL_NAME("MathMLSelectionRect", TYPE_MATHML_SELECTION_RECT)
 private:
   nsRect    mRect;
 };
 
 void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
                                          nsIRenderingContext* aCtx)
 {
   // get color to use for selection from the look&feel object
@@ -1905,17 +1905,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLCharBackground() {
     MOZ_COUNT_DTOR(nsDisplayMathMLCharBackground);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLCharBackground")
+  NS_DISPLAY_DECL_NAME("MathMLCharBackground", TYPE_MATHML_CHAR_BACKGROUND)
 private:
   nsStyleContext* mStyleContext;
   nsRect          mRect;
 };
 
 void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
                                           nsIRenderingContext* aCtx)
 {
@@ -1953,17 +1953,17 @@ public:
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx)
   {
     mChar->PaintForeground(mFrame->PresContext(), *aCtx,
                            aBuilder->ToReferenceFrame(mFrame), mIsSelected);
   }
 
-  NS_DISPLAY_DECL_NAME("MathMLCharForeground")
+  NS_DISPLAY_DECL_NAME("MathMLCharForeground", TYPE_MATHML_CHAR_FOREGROUND)
 
 private:
   nsMathMLChar* mChar;
   PRPackedBool  mIsSelected;
 };
 
 #ifdef NS_DEBUG
 class nsDisplayMathMLCharDebug : public nsDisplayItem {
@@ -1975,17 +1975,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLCharDebug() {
     MOZ_COUNT_DTOR(nsDisplayMathMLCharDebug);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLCharDebug")
+  NS_DISPLAY_DECL_NAME("MathMLCharDebug", TYPE_MATHML_CHAR_DEBUG)
 private:
   nsRect    mRect;
 };
 
 void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
                                      nsIRenderingContext* aCtx)
 {
   // for visual debug
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -131,17 +131,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLError() {
     MOZ_COUNT_DTOR(nsDisplayMathMLError);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLError")
+  NS_DISPLAY_DECL_NAME("MathMLError", TYPE_MATHML_ERROR)
 };
 
 void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
                                  nsIRenderingContext* aCtx)
 {
   // Set color and font ...
   nsLayoutUtils::SetFontFromStyle(aCtx, mFrame->GetStyleContext());
 
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -459,17 +459,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLBoundingMetrics() {
     MOZ_COUNT_DTOR(nsDisplayMathMLBoundingMetrics);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLBoundingMetrics")
+  NS_DISPLAY_DECL_NAME("MathMLBoundingMetrics", TYPE_MATHML_BOUNDING_METRICS)
 private:
   nsRect    mRect;
 };
 
 void nsDisplayMathMLBoundingMetrics::Paint(nsDisplayListBuilder* aBuilder,
                                            nsIRenderingContext* aCtx)
 {
   aCtx->SetColor(NS_RGB(0,0,255));
@@ -503,17 +503,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLBar() {
     MOZ_COUNT_DTOR(nsDisplayMathMLBar);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLBar")
+  NS_DISPLAY_DECL_NAME("MathMLBar", TYPE_MATHML_BAR)
 private:
   nsRect    mRect;
 };
 
 void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder,
                                nsIRenderingContext* aCtx)
 {
   // paint the bar with the current text color
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -748,17 +748,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayNotation() {
     MOZ_COUNT_DTOR(nsDisplayNotation);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLMencloseNotation")
+  NS_DISPLAY_DECL_NAME("MathMLMencloseNotation", TYPE_MATHML_MENCLOSE_NOTATION)
 
 private:
   nsRect             mRect;
   nscoord            mThickness;
   nsMencloseNotation mType;
 };
 
 void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
--- a/layout/mathml/nsMathMLmfracFrame.cpp
+++ b/layout/mathml/nsMathMLmfracFrame.cpp
@@ -592,17 +592,18 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLSlash() {
     MOZ_COUNT_DTOR(nsDisplayMathMLSlash);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("MathMLSlash")
+  NS_DISPLAY_DECL_NAME("MathMLSlash", TYPE_MATHML_SLASH)
+
 private:
   nsRect    mRect;
   nscoord   mThickness;
 };
 
 void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
                                  nsIRenderingContext* aCtx)
 {
--- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
@@ -428,17 +428,17 @@ public:
     MOZ_COUNT_DTOR(nsDisplaySVG);
   }
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("SVGEventReceiver")
+  NS_DISPLAY_DECL_NAME("SVGEventReceiver", TYPE_SVG_EVENT_RECEIVER)
 };
 
 void
 nsDisplaySVG::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                       HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
 {
   nsSVGOuterSVGFrame *outerSVGFrame = static_cast<nsSVGOuterSVGFrame*>(mFrame);
   nsRect rectAtOrigin = aRect - aBuilder->ToReferenceFrame(mFrame);
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -397,17 +397,17 @@ public:
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
 
-  NS_DISPLAY_DECL_NAME("TableCellBackground")
+  NS_DISPLAY_DECL_NAME("TableCellBackground", TYPE_TABLE_CELL_BACKGROUND)
 };
 
 void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
                                          nsIRenderingContext* aCtx)
 {
   static_cast<nsTableCellFrame*>(mFrame)->
     PaintBackground(*aCtx, mVisibleRect, aBuilder->ToReferenceFrame(mFrame),
                     aBuilder->GetBackgroundPaintFlags());
@@ -491,17 +491,18 @@ nsTableCellFrame::BuildDisplayList(nsDis
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // and display the selection border if we need to
     PRBool isSelected =
       (GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
     if (isSelected) {
       nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
-          nsDisplayGeneric(this, ::PaintTableCellSelection, "TableCellSelection"));
+          nsDisplayGeneric(this, ::PaintTableCellSelection, "TableCellSelection",
+                           nsDisplayItem::TYPE_TABLE_CELL_SELECTION));
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   // the 'empty-cells' property has no effect on 'outline'
   nsresult rv = DisplayOutline(aBuilder, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1130,17 +1130,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayTableBorderBackground() {
     MOZ_COUNT_DTOR(nsDisplayTableBorderBackground);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("TableBorderBackground")
+  NS_DISPLAY_DECL_NAME("TableBorderBackground", TYPE_TABLE_BORDER_BACKGROUND)
 };
 
 void
 nsDisplayTableBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
                                       nsIRenderingContext* aCtx)
 {
   static_cast<nsTableFrame*>(mFrame)->
     PaintTableBorderBackground(*aCtx, mVisibleRect,
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -583,17 +583,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayTableRowBackground() {
     MOZ_COUNT_DTOR(nsDisplayTableRowBackground);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("TableRowBackground")
+  NS_DISPLAY_DECL_NAME("TableRowBackground", TYPE_TABLE_ROW_BACKGROUND)
 };
 
 void
 nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
                                    nsIRenderingContext* aCtx) {
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
 
   nsPoint pt = aBuilder->ToReferenceFrame(mFrame);
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -173,17 +173,17 @@ public:
   virtual ~nsDisplayTableRowGroupBackground() {
     MOZ_COUNT_DTOR(nsDisplayTableRowGroupBackground);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
 
-  NS_DISPLAY_DECL_NAME("TableRowGroupBackground")
+  NS_DISPLAY_DECL_NAME("TableRowGroupBackground", TYPE_TABLE_ROW_GROUP_BACKGROUND)
 };
 
 void
 nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
                                         nsIRenderingContext* aCtx) {
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
 
   nsPoint pt = aBuilder->ToReferenceFrame(mFrame);
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -1277,17 +1277,17 @@ public:
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     nsPoint rectCenter(aRect.x + aRect.width / 2, aRect.y + aRect.height / 2);
     static_cast<nsBoxFrame*>(mFrame)->
       DisplayDebugInfoFor(this, rectCenter - aBuilder->ToReferenceFrame(mFrame));
     aOutFrames->AppendElement(this);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("XULDebug")
+  NS_DISPLAY_DECL_NAME("XULDebug", TYPE_XUL_DEBUG)
 };
 
 void
 nsDisplayXULDebug::Paint(nsDisplayListBuilder* aBuilder,
                          nsIRenderingContext* aCtx)
 {
   static_cast<nsBoxFrame*>(mFrame)->
     PaintXULDebugOverlay(*aCtx, aBuilder->ToReferenceFrame(mFrame));
@@ -2143,17 +2143,17 @@ public:
   nsDisplayXULEventRedirector(nsIFrame* aFrame, nsDisplayItem* aItem,
                               nsIFrame* aTargetFrame)
     : nsDisplayWrapList(aFrame, aItem), mTargetFrame(aTargetFrame) {}
   nsDisplayXULEventRedirector(nsIFrame* aFrame, nsDisplayList* aList,
                               nsIFrame* aTargetFrame)
     : nsDisplayWrapList(aFrame, aList), mTargetFrame(aTargetFrame) {}
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
-  NS_DISPLAY_DECL_NAME("XULEventRedirector")
+  NS_DISPLAY_DECL_NAME("XULEventRedirector", TYPE_XUL_EVENT_REDIRECTOR)
 private:
   nsIFrame* mTargetFrame;
 };
 
 void nsDisplayXULEventRedirector::HitTest(nsDisplayListBuilder* aBuilder,
     const nsRect& aRect, HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
 {
   nsTArray<nsIFrame*> outFrames;
--- a/layout/xul/base/src/nsGroupBoxFrame.cpp
+++ b/layout/xul/base/src/nsGroupBoxFrame.cpp
@@ -117,17 +117,17 @@ public:
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("XULGroupBackground")
+  NS_DISPLAY_DECL_NAME("XULGroupBackground", TYPE_XUL_GROUP_BACKGROUND)
 };
 
 void
 nsDisplayXULGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
                                    nsIRenderingContext* aCtx)
 {
   static_cast<nsGroupBoxFrame*>(mFrame)->
     PaintBorderBackground(*aCtx, aBuilder->ToReferenceFrame(mFrame),
--- a/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -319,17 +319,17 @@ public:
     MOZ_COUNT_DTOR(nsDisplayXULImage);
   }
 #endif
 
   // Doesn't handle HitTest because nsLeafBoxFrame already creates an
   // event receiver for us
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
-  NS_DISPLAY_DECL_NAME("XULImage")
+  NS_DISPLAY_DECL_NAME("XULImage", TYPE_XUL_IMAGE)
 };
 
 void nsDisplayXULImage::Paint(nsDisplayListBuilder* aBuilder,
                               nsIRenderingContext* aCtx)
 {
   static_cast<nsImageBoxFrame*>(mFrame)->
     PaintImage(*aCtx, mVisibleRect, aBuilder->ToReferenceFrame(mFrame),
                aBuilder->ShouldSyncDecodeImages()
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -338,17 +338,17 @@ public:
   virtual ~nsDisplayXULTextBox() {
       MOZ_COUNT_DTOR(nsDisplayXULTextBox);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsIRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  NS_DISPLAY_DECL_NAME("XULTextBox")
+  NS_DISPLAY_DECL_NAME("XULTextBox", TYPE_XUL_TEXT_BOX)
 };
 
 void
 nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
                            nsIRenderingContext* aCtx)
 {
   static_cast<nsTextBoxFrame*>(mFrame)->
     PaintTitle(*aCtx, mVisibleRect, aBuilder->ToReferenceFrame(mFrame));
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -2818,17 +2818,18 @@ nsTreeBodyFrame::BuildDisplayList(nsDisp
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Bail out now if there's no view or we can't run script because the
   // document is a zombie
   if (!mView || !GetContent()->GetCurrentDoc()->GetScriptGlobalObject())
     return NS_OK;
 
   return aLists.Content()->AppendNewToTop(new (aBuilder)
-      nsDisplayGeneric(this, ::PaintTreeBody, "XULTreeBody"));
+      nsDisplayGeneric(this, ::PaintTreeBody, "XULTreeBody",
+                       nsDisplayItem::TYPE_XUL_TREE_BODY));
 }
 
 void
 nsTreeBodyFrame::PaintTreeBody(nsIRenderingContext& aRenderingContext,
                                const nsRect& aDirtyRect, nsPoint aPt)
 {
   // Update our available height and our page count.
   CalcInnerBox();
--- a/layout/xul/base/src/tree/src/nsTreeColFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeColFrame.cpp
@@ -96,17 +96,17 @@ public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayXULTreeColSplitterTarget() {
     MOZ_COUNT_DTOR(nsDisplayXULTreeColSplitterTarget);
   }
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
-  NS_DISPLAY_DECL_NAME("XULTreeColSplitterTarget")
+  NS_DISPLAY_DECL_NAME("XULTreeColSplitterTarget", TYPE_XUL_TREE_COL_SPLITTER_TARGET)
 };
 
 void
 nsDisplayXULTreeColSplitterTarget::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                                            HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
 {
   nsRect rect = aRect - aBuilder->ToReferenceFrame(mFrame);
   // If we are in either in the first 4 pixels or the last 4 pixels, we're going to