XUL:XUL Frame Mapping

From MozillaWiki
Jump to: navigation, search

XUL Frame Mapping

The mapping between XUL tag and frame type is done by the CSSFrameConstructor. There are twenty or so XUL frame types. If the tag of the element matches the name of one of these frame types, that type of frame is created. If the XBL binding attached to the element, if any, specifies a display attribute on the <binding> tag, it may specify a different frame type. If neither match a frame type, the CSS display property is checked for one of the XUL display types. There are various types: box, stack, deck, grid, groupgroup, gridline, groupbox, and popup, plus inline versions of box, stack and grid.

The frame types used for XUL are:

  • autorepeatbutton - AutoRepeatBoxFrame
  • browser - SubDocumentFrame
  • button - ButtonFrame
  • checkbox - ButtonFrame
  • description - TextBoxFrame
  • editor - SubDocumentFrame
  • grippy - GrippyFrame
  • iframe - SubDocumentFrame
  • image - ImageBoxFrame
  • label - TextBoxFrame
  • menu - MenuFrame
  • menuitem - MenuFrame
  • menubutton - MenuFrame
  • menubar - MenuBarFrame
  • nativescrollbar - NativeScrollbarFrame
  • popupgroup - PopupSetFrame
  • progressmeter - ProgressMeterFrame
  • radio - ButtonFrame
  • resizer - ResizerFrame
  • scrollbar - ScrollbarFrame
  • scrollbarbutton - ScrollbarButtonFrame
  • slider - SliderFrame
  • spacer - LeafBoxFrame
  • splitter - SplitterFrame
  • spring - LeafBoxFrame (spring is obsolete)
  • text - TextBoxFrame (text is obsolete)
  • titlebar - TitleBarFrame
  • treechildren - TreeBodyFrame
  • treecol - TreeColFrame


  • for label and description, a TextBoxFrame is created is the element has a value attribute, whereas an AreaFrame is created if a value attribute is not present. An AreaFrame is a subclass of BlockFrame which adds accesskey support. Convention is to use label for single line elements (TextBoxFrame) and description for block labels (AreaFrame).
  • for a display of gridgroup, a ListBoxBodyFrame is created if the tag is listboxbody. For a display of gridline, a ListItemFrame is created if the tag is listitem.
  • on Mac, native menubars are used instead for chrome and no frame is created for them. Widget code implements the Mac menubar instead.

CSS Display Types

There are several values for the CSS display property that will translate into XUL frame types.

  • -moz-box - BoxFrame
  • -moz-deck - DeckFrame
  • -moz-grid - BoxFrame
  • -moz-grid-group - GridRowGroupFrame
  • -moz-grid-line - GridRowLeafFrame
  • -moz-groupbox - GroupBoxFrame
  • -moz-inline-box - BoxFrame
  • -moz-inline-grid - GridFrame
  • -moz-inline-stack - StackFrame
  • -moz-popup - MenuPopupFrame
  • -moz-stack - StackFrame

Note that -moz-grid uses a BoxFrame, but it uses a different layout object (GridLayout2 instead of SprocketLayout)