Bug 947728 part 1 - Introduce a new 'number-input' value for -moz-appearance that behaves exactly as 'textfield' does. r=roc
authorJonathan Watt <jwatt@jwatt.org>
Sun, 08 Dec 2013 23:23:28 +0000
changeset 175109 3bfbc5e93d428d1550e9894ff096778ae8f868e4
parent 175108 6f6294b469f05364bce8d5f6de5bf27d8c406fad
child 175110 1682d636c3c566f89bc3eed963e9c7b4f037edc9
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs947728
milestone28.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 947728 part 1 - Introduce a new 'number-input' value for -moz-appearance that behaves exactly as 'textfield' does. r=roc
gfx/src/nsThemeConstants.h
layout/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
widget/cocoa/nsNativeThemeCocoa.mm
widget/gtk/nsNativeThemeGTK.cpp
widget/qt/nsNativeThemeQt.cpp
widget/windows/nsNativeThemeWin.cpp
widget/xpwidgets/nsNativeTheme.cpp
--- a/gfx/src/nsThemeConstants.h
+++ b/gfx/src/nsThemeConstants.h
@@ -132,16 +132,19 @@
 #define NS_THEME_SPINNER_UP_BUTTON                         73
 
 // The down button of a spin control
 #define NS_THEME_SPINNER_DOWN_BUTTON                       74
 
 // The textfield of a spin control
 #define NS_THEME_SPINNER_TEXTFIELD                         75
 
+// For HTML's <input type=number>
+#define NS_THEME_NUMBER_INPUT                              76
+
 // A scrollbar.
 #define NS_THEME_SCROLLBAR                                 80
 
 // A small scrollbar.
 #define NS_THEME_SCROLLBAR_SMALL                           81
 
 // A scrollbar button (up/down/left/right)
 #define NS_THEME_SCROLLBAR_BUTTON_UP                       82
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -605,16 +605,17 @@ CSS_KEY(button-arrow-previous, button_ar
 CSS_KEY(separator, separator)
 CSS_KEY(splitter, splitter)
 CSS_KEY(statusbar, statusbar)
 CSS_KEY(statusbarpanel, statusbarpanel)
 CSS_KEY(resizerpanel, resizerpanel)
 CSS_KEY(resizer, resizer)
 CSS_KEY(listbox, listbox)
 CSS_KEY(listitem, listitem)
+CSS_KEY(number-input, number_input)
 CSS_KEY(treeview, treeview)
 CSS_KEY(treeitem, treeitem)
 CSS_KEY(treetwisty, treetwisty)
 CSS_KEY(treetwistyopen, treetwistyopen)
 CSS_KEY(treeline, treeline)
 CSS_KEY(treeheader, treeheader)
 CSS_KEY(treeheadercell, treeheadercell)
 CSS_KEY(treeheadersortarrow, treeheadersortarrow)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -524,16 +524,17 @@ const int32_t nsCSSProps::kAppearanceKTa
   eCSSKeyword_dualbutton,             NS_THEME_TOOLBAR_DUAL_BUTTON,
   eCSSKeyword_toolbarbutton_dropdown, NS_THEME_TOOLBAR_BUTTON_DROPDOWN,
   eCSSKeyword_button_arrow_up,        NS_THEME_BUTTON_ARROW_UP,
   eCSSKeyword_button_arrow_down,      NS_THEME_BUTTON_ARROW_DOWN,
   eCSSKeyword_button_arrow_next,      NS_THEME_BUTTON_ARROW_NEXT,
   eCSSKeyword_button_arrow_previous,  NS_THEME_BUTTON_ARROW_PREVIOUS,
   eCSSKeyword_meterbar,               NS_THEME_METERBAR,
   eCSSKeyword_meterchunk,             NS_THEME_METERBAR_CHUNK,
+  eCSSKeyword_number_input,           NS_THEME_NUMBER_INPUT,
   eCSSKeyword_separator,              NS_THEME_TOOLBAR_SEPARATOR,
   eCSSKeyword_splitter,               NS_THEME_SPLITTER,
   eCSSKeyword_statusbar,              NS_THEME_STATUSBAR,
   eCSSKeyword_statusbarpanel,         NS_THEME_STATUSBAR_PANEL,
   eCSSKeyword_resizerpanel,           NS_THEME_STATUSBAR_RESIZER_PANEL,
   eCSSKeyword_resizer,                NS_THEME_RESIZER,
   eCSSKeyword_listbox,                NS_THEME_LISTBOX,
   eCSSKeyword_listitem,               NS_THEME_LISTBOX_LISTITEM,
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2312,16 +2312,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
 
     case NS_THEME_GROUPBOX: {
       HIThemeGroupBoxDrawInfo gdi = { 0, kThemeStateActive, kHIThemeGroupBoxKindPrimary };
       HIThemeDrawGroupBox(&macRect, &gdi, cgContext, HITHEME_ORIENTATION);
       break;
     }
 
     case NS_THEME_TEXTFIELD:
+    case NS_THEME_NUMBER_INPUT:
       // HIThemeSetFill is not available on 10.3
       CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
       CGContextFillRect(cgContext, macRect);
 
       // XUL textboxes set the native appearance on the containing box, while
       // concrete focus is set on the html:input element within it. We can
       // though, check the focused attribute of xul textboxes in this case.
       // On Mac, focus rings are always shown for textboxes, so we do not need
@@ -2657,16 +2658,17 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDe
     case NS_THEME_DROPDOWN_BUTTON:
       *aResult = RTLAwareMargin(kAquaDropdownBorder, aFrame);
       break;
 
     case NS_THEME_DROPDOWN_TEXTFIELD:
       *aResult = RTLAwareMargin(kAquaComboboxBorder, aFrame);
       break;
 
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     {
       SInt32 frameOutset = 0;
       ::GetThemeMetric(kThemeMetricEditTextFrameOutset, &frameOutset);
 
       SInt32 textPadding = 0;
       ::GetThemeMetric(kThemeMetricEditTextWhitespace, &textPadding);
 
@@ -2770,16 +2772,17 @@ nsNativeThemeCocoa::GetWidgetPadding(nsD
 bool
 nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
                                       uint8_t aWidgetType, nsRect* aOverflowRect)
 {
   int32_t p2a = aContext->AppUnitsPerDevPixel();
   switch (aWidgetType) {
     case NS_THEME_BUTTON:
     case NS_THEME_TOOLBAR_BUTTON:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_SEARCHFIELD:
     case NS_THEME_LISTBOX:
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_BUTTON:
     case NS_THEME_DROPDOWN_TEXTFIELD:
     case NS_THEME_CHECKBOX:
@@ -2866,17 +2869,18 @@ nsNativeThemeCocoa::GetMinimumWidgetSize
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_BUTTON:
     {
       SInt32 popupHeight = 0;
       ::GetThemeMetric(kThemeMetricPopupButtonHeight, &popupHeight);
       aResult->SizeTo(0, popupHeight);
       break;
     }
- 
+
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_SEARCHFIELD:
     {
       // at minimum, we should be tall enough for 9pt text.
       // I'm using hardcoded values here because the appearance manager
       // values for the frame size are incorrect.
       aResult->SizeTo(0, (2 + 2) /* top */ + 9 + (1 + 1) /* bottom */);
@@ -3207,16 +3211,17 @@ nsNativeThemeCocoa::ThemeSupportsWidget(
     case NS_THEME_BUTTON_BEVEL:
     case NS_THEME_TOOLBAR_BUTTON:
     case NS_THEME_SPINNER:
     case NS_THEME_SPINNER_UP_BUTTON:
     case NS_THEME_SPINNER_DOWN_BUTTON:
     case NS_THEME_TOOLBAR:
     case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR:
     case NS_THEME_STATUSBAR:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_SEARCHFIELD:
     //case NS_THEME_TOOLBOX:
     //case NS_THEME_TOOLBAR_BUTTON:
     case NS_THEME_PROGRESSBAR:
     case NS_THEME_PROGRESSBAR_VERTICAL:
     case NS_THEME_PROGRESSBAR_CHUNK:
@@ -3332,16 +3337,17 @@ nsNativeThemeCocoa::WidgetAppearanceDepe
     case NS_THEME_MENUITEM:
     case NS_THEME_MENUSEPARATOR:
     case NS_THEME_TOOLTIP:
     case NS_THEME_SPINNER:
     case NS_THEME_SPINNER_UP_BUTTON:
     case NS_THEME_SPINNER_DOWN_BUTTON:
     case NS_THEME_TOOLBAR_SEPARATOR:
     case NS_THEME_TOOLBOX:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TREEVIEW:
     case NS_THEME_TREEVIEW_LINE:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_LISTBOX:
     case NS_THEME_RESIZER:
       return false;
     default:
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -227,17 +227,18 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
       aState->isDefault = IsDefaultButton(aFrame);
       aState->canDefault = FALSE; // XXX fix me
       aState->depressed = FALSE;
 
       if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
         // For these widget types, some element (either a child or parent)
         // actually has element focus, so we check the focused attribute
         // to see whether to draw in the focused state.
-        if (aWidgetType == NS_THEME_TEXTFIELD ||
+        if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+            aWidgetType == NS_THEME_TEXTFIELD ||
             aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
             aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD ||
             aWidgetType == NS_THEME_SPINNER_TEXTFIELD ||
             aWidgetType == NS_THEME_RADIO_CONTAINER ||
             aWidgetType == NS_THEME_RADIO_LABEL) {
           aState->focused = IsFocused(aFrame);
         } else if (aWidgetType == NS_THEME_RADIO ||
                    aWidgetType == NS_THEME_CHECKBOX) {
@@ -436,16 +437,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
     aGtkWidgetType = MOZ_GTK_SCALE_THUMB_VERTICAL;
     break;
   case NS_THEME_TOOLBAR_GRIPPER:
     aGtkWidgetType = MOZ_GTK_GRIPPER;
     break;
   case NS_THEME_RESIZER:
     aGtkWidgetType = MOZ_GTK_RESIZER;
     break;
+  case NS_THEME_NUMBER_INPUT:
   case NS_THEME_TEXTFIELD:
   case NS_THEME_TEXTFIELD_MULTILINE:
     aGtkWidgetType = MOZ_GTK_ENTRY;
     break;
   case NS_THEME_LISTBOX:
   case NS_THEME_TREEVIEW:
     aGtkWidgetType = MOZ_GTK_TREEVIEW;
     break;
@@ -1379,16 +1381,17 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
   case NS_THEME_SCROLLBAR_BUTTON_UP:
   case NS_THEME_SCROLLBAR_BUTTON_DOWN:
   case NS_THEME_SCROLLBAR_BUTTON_LEFT:
   case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
   case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
   case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
   case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
   case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
+  case NS_THEME_NUMBER_INPUT:
   case NS_THEME_TEXTFIELD:
   case NS_THEME_TEXTFIELD_MULTILINE:
   case NS_THEME_DROPDOWN_TEXTFIELD:
   case NS_THEME_RANGE:
   case NS_THEME_RANGE_THUMB:
   case NS_THEME_SCALE_HORIZONTAL:
   case NS_THEME_SCALE_THUMB_HORIZONTAL:
   case NS_THEME_SCALE_VERTICAL:
--- a/widget/qt/nsNativeThemeQt.cpp
+++ b/widget/qt/nsNativeThemeQt.cpp
@@ -265,29 +265,32 @@ nsNativeThemeQt::DrawWidgetBackground(QP
         InitComboStyle(aWidgetType, aFrame, r, option);
 
         style->drawPrimitive(QStyle::PE_FrameDefaultButton, &option, qPainter);
         style->drawPrimitive(QStyle::PE_IndicatorSpinDown, &option, qPainter);
         break;
     }
     case NS_THEME_DROPDOWN_TEXT:
     case NS_THEME_DROPDOWN_TEXTFIELD:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_LISTBOX: {
         QStyleOptionFrameV2 frameOpt;
         nsEventStates eventState = GetContentState(aFrame, aWidgetType);
 
         if (!IsDisabled(aFrame, eventState))
             frameOpt.state |= QStyle::State_Enabled;
 
         frameOpt.rect = r;
         frameOpt.features = QStyleOptionFrameV2::Flat;
 
-        if (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
+        if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+            aWidgetType == NS_THEME_TEXTFIELD ||
+            aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
             QRect contentRect = style->subElementRect(QStyle::SE_LineEditContents, &frameOpt);
             contentRect.adjust(mFrameWidth, mFrameWidth, -mFrameWidth, -mFrameWidth);
             qPainter->fillRect(contentRect, QBrush(Qt::white));
         }
         
         frameOpt.palette = mNoBackgroundPalette;
         style->drawPrimitive(QStyle::PE_FrameLineEdit, &frameOpt, qPainter, nullptr);
         break;
@@ -330,17 +333,18 @@ nsNativeThemeQt::GetWidgetBorder(nsDevic
 }
 
 bool
 nsNativeThemeQt::GetWidgetPadding(nsDeviceContext* ,
                                   nsIFrame*, uint8_t aWidgetType,
                                   nsIntMargin* aResult)
 {
     // XXX: Where to get padding values, framewidth?
-    if (aWidgetType == NS_THEME_TEXTFIELD ||
+    if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+        aWidgetType == NS_THEME_TEXTFIELD ||
         aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
         aWidgetType == NS_THEME_DROPDOWN) {
         aResult->SizeTo(2, 2, 2, 2);
         return true;
     }
 
     return false;
 }
@@ -500,16 +504,17 @@ nsNativeThemeQt::GetMinimumWidgetSize(ns
         QRect subRect2 = s->subControlRect(QStyle::CC_ComboBox, &comboOpt,
                                            QStyle::SC_ComboBoxFrame, nullptr);
 
         (*aResult).width = subRect.width() + subRect2.width();
         (*aResult).height = std::max(subRect.height(), subRect2.height());
         //*aIsOverridable = false;
         break;
     }
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
         break;
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -550,16 +555,17 @@ nsNativeThemeQt::ThemeSupportsWidget(nsP
     case NS_THEME_RADIO:
     case NS_THEME_CHECKBOX:
     case NS_THEME_BUTTON_BEVEL:
     case NS_THEME_BUTTON:
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_BUTTON:
     case NS_THEME_DROPDOWN_TEXT:
     case NS_THEME_DROPDOWN_TEXTFIELD:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_LISTBOX:
     case NS_THEME_MENUPOPUP:
         return !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
     default:
         break;
     }
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -727,16 +727,17 @@ nsNativeThemeWin::GetTheme(uint8_t aWidg
   }
 
   switch (aWidgetType) {
     case NS_THEME_BUTTON:
     case NS_THEME_RADIO:
     case NS_THEME_CHECKBOX:
     case NS_THEME_GROUPBOX:
       return nsUXThemeData::GetTheme(eUXButton);
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
       return nsUXThemeData::GetTheme(eUXEdit);
     case NS_THEME_TOOLTIP:
       // XP/2K3 should force a classic treatment of tooltips
       return !IsVistaOrLater() ?
         nullptr : nsUXThemeData::GetTheme(eUXTooltip);
     case NS_THEME_TOOLBOX:
@@ -933,16 +934,17 @@ nsNativeThemeWin::GetThemePartAndState(n
     }
     case NS_THEME_GROUPBOX: {
       aPart = BP_GROUPBOX;
       aState = TS_NORMAL;
       // Since we don't support groupbox disabled and GBS_DISABLED looks the
       // same as GBS_NORMAL don't bother supporting GBS_DISABLED.
       return NS_OK;
     }
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE: {
       nsEventStates eventState = GetContentState(aFrame, aWidgetType);
 
       if (IsVistaOrLater()) {
         /* Note: the NOSCROLL type has a rounded corner in each
          * corner.  The more specific HSCROLL, VSCROLL, HVSCROLL types
          * have side and/or top/bottom edges rendered as straight
@@ -2009,17 +2011,19 @@ nsNativeThemeWin::GetWidgetBorder(nsDevi
     if (IsLeftToSelectedTab(aFrame))
       // Remove the right edge, since we won't be drawing it.
       aResult->right = 0;
     else if (IsRightToSelectedTab(aFrame))
       // Remove the left edge, since we won't be drawing it.
       aResult->left = 0;
   }
 
-  if (aFrame && (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
+  if (aFrame && (aWidgetType == NS_THEME_NUMBER_INPUT ||
+                 aWidgetType == NS_THEME_TEXTFIELD ||
+                 aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
     nsIContent* content = aFrame->GetContent();
     if (content && content->IsHTML()) {
       // We need to pad textfields by 1 pixel, since the caret will draw
       // flush against the edge by default if we don't.
       aResult->top++;
       aResult->left++;
       aResult->bottom++;
       aResult->right++;
@@ -2083,32 +2087,35 @@ nsNativeThemeWin::GetWidgetPadding(nsDev
     SIZE popupSize;
     GetThemePartSize(theme, nullptr, MENU_POPUPBORDERS, /* state */ 0, nullptr, TS_TRUE, &popupSize);
     aResult->top = aResult->bottom = popupSize.cy;
     aResult->left = aResult->right = popupSize.cx;
     return true;
   }
 
   if (IsVistaOrLater()) {
-    if (aWidgetType == NS_THEME_TEXTFIELD ||
+    if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+        aWidgetType == NS_THEME_TEXTFIELD ||
         aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
         aWidgetType == NS_THEME_DROPDOWN)
     {
       /* If we have author-specified padding for these elements, don't do the fixups below */
       if (aFrame->PresContext()->HasAuthorSpecifiedRules(aFrame, NS_AUTHOR_SPECIFIED_PADDING))
         return false;
     }
 
     /* textfields need extra pixels on all sides, otherwise they
      * wrap their content too tightly.  The actual border is drawn 1px
      * inside the specified rectangle, so Gecko will end up making the
      * contents look too small.  Instead, we add 2px padding for the
      * contents and fix this. (Used to be 1px added, see bug 430212)
      */
-    if (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
+    if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+        aWidgetType == NS_THEME_TEXTFIELD ||
+        aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
       aResult->top = aResult->bottom = 2;
       aResult->left = aResult->right = 2;
       return true;
     } else if (IsHTMLContent(aFrame) && aWidgetType == NS_THEME_DROPDOWN) {
       /* For content menulist controls, we need an extra pixel so
        * that we have room to draw our focus rectangle stuff.
        * Otherwise, the focus rect might overlap the control's
        * border.
@@ -2212,16 +2219,17 @@ nsNativeThemeWin::GetMinimumWidgetSize(n
   *aIsOverridable = true;
 
   HANDLE theme = GetTheme(aWidgetType);
   if (!theme)
     return ClassicGetMinimumWidgetSize(aContext, aFrame, aWidgetType, aResult, aIsOverridable);
 
   switch (aWidgetType) {
     case NS_THEME_GROUPBOX:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TOOLBOX:
     case NS_THEME_WIN_MEDIA_TOOLBOX:
     case NS_THEME_WIN_COMMUNICATIONS_TOOLBOX:
     case NS_THEME_WIN_BROWSER_TAB_BAR_TOOLBOX:
     case NS_THEME_TOOLBAR:
     case NS_THEME_STATUSBAR:
     case NS_THEME_PROGRESSBAR_CHUNK:
@@ -2678,16 +2686,17 @@ nsNativeThemeWin::ClassicThemeSupportsWi
       return (!parentFrame || parentFrame->GetType() != nsGkAtoms::scrollFrame);
     }
     case NS_THEME_MENUBAR:
     case NS_THEME_MENUPOPUP:
       // Classic non-flat menus are handled almost entirely through CSS.
       if (!nsUXThemeData::sFlatMenus)
         return false;
     case NS_THEME_BUTTON:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_CHECKBOX:
     case NS_THEME_RADIO:
     case NS_THEME_RANGE:
     case NS_THEME_RANGE_THUMB:
     case NS_THEME_GROUPBOX:
     case NS_THEME_SCROLLBAR_BUTTON_UP:
@@ -2760,16 +2769,17 @@ nsNativeThemeWin::ClassicGetWidgetBorder
       (*aResult).bottom = (*aResult).left = (*aResult).right = 0;
       (*aResult).top = 2;
       break;
     case NS_THEME_LISTBOX:
     case NS_THEME_TREEVIEW:
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_TEXTFIELD:
     case NS_THEME_TAB:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
       (*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
       break;
     case NS_THEME_STATUSBAR_PANEL:
     case NS_THEME_STATUSBAR_RESIZER_PANEL: {
       (*aResult).top = 1;      
       (*aResult).left = 1;
@@ -2905,16 +2915,17 @@ nsNativeThemeWin::ClassicGetMinimumWidge
     case NS_THEME_DROPDOWN_BUTTON:
       (*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
       break;
     case NS_THEME_DROPDOWN:
     case NS_THEME_BUTTON:
     case NS_THEME_GROUPBOX:
     case NS_THEME_LISTBOX:
     case NS_THEME_TREEVIEW:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_DROPDOWN_TEXTFIELD:      
     case NS_THEME_STATUSBAR:
     case NS_THEME_STATUSBAR_PANEL:      
     case NS_THEME_STATUSBAR_RESIZER_PANEL:
     case NS_THEME_PROGRESSBAR_CHUNK:
     case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
@@ -3145,16 +3156,17 @@ nsresult nsNativeThemeWin::ClassicGetThe
           aState |= DFCS_CHECKED;
       } else if (IsFrameRTL(aFrame)) {
           aState |= DFCS_RTL;
       }
       return NS_OK;
     }
     case NS_THEME_LISTBOX:
     case NS_THEME_TREEVIEW:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_TEXTFIELD:
     case NS_THEME_RANGE:
     case NS_THEME_RANGE_THUMB:
     case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
     case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:     
@@ -3578,16 +3590,17 @@ RENDER_AGAIN:
         oldColor = ::SetTextColor(hdc, 0);
         // draw focus rectangle
         ::DrawFocusRect(hdc, &widgetRect);
         ::SetTextColor(hdc, oldColor);
       }
       break;
     }
     // Draw controls with 2px 3D inset border
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     case NS_THEME_LISTBOX:
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_TEXTFIELD: {
       // Draw inset edge
       ::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
       nsEventStates eventState = GetContentState(aFrame, aWidgetType);
@@ -3944,16 +3957,17 @@ RENDER_AGAIN:
   return rv;
 }
 
 uint32_t
 nsNativeThemeWin::GetWidgetNativeDrawingFlags(uint8_t aWidgetType)
 {
   switch (aWidgetType) {
     case NS_THEME_BUTTON:
+    case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
 
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_TEXTFIELD:
       return
         gfxWindowsNativeDrawing::CANNOT_DRAW_TO_COLOR_ALPHA |
         gfxWindowsNativeDrawing::CAN_AXIS_ALIGNED_SCALE |
--- a/widget/xpwidgets/nsNativeTheme.cpp
+++ b/widget/xpwidgets/nsNativeTheme.cpp
@@ -73,17 +73,17 @@ nsNativeTheme::GetContentState(nsIFrame*
 
   nsIContent* frameContent = aFrame->GetContent();
   nsEventStates flags;
   if (frameContent->IsElement()) {
     flags = frameContent->AsElement()->State();
 
     // <input type=number> needs special handling since its nested native
     // anonymous <input type=text> takes focus for it.
-    if (aWidgetType == NS_THEME_TEXTFIELD &&
+    if (aWidgetType == NS_THEME_NUMBER_INPUT &&
         frameContent->IsHTML(nsGkAtoms::input)) {
       nsNumberControlFrame *numberControlFrame = do_QueryFrame(aFrame);
       if (numberControlFrame && numberControlFrame->IsFocused()) {
         flags |= NS_EVENT_STATE_FOCUS;
       }
     }
   }
   
@@ -92,17 +92,18 @@ nsNativeTheme::GetContentState(nsIFrame*
       flags |= NS_EVENT_STATE_FOCUS;
   }
 
   // On Windows and Mac, only draw focus rings if they should be shown. This
   // means that focus rings are only shown once the keyboard has been used to
   // focus something in the window.
 #if defined(XP_MACOSX)
   // Mac always draws focus rings for textboxes and lists.
-  if (aWidgetType == NS_THEME_TEXTFIELD ||
+  if (aWidgetType == NS_THEME_NUMBER_INPUT ||
+      aWidgetType == NS_THEME_TEXTFIELD ||
       aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
       aWidgetType == NS_THEME_SEARCHFIELD ||
       aWidgetType == NS_THEME_LISTBOX) {
     return flags;
   }
 #endif
 #if defined(XP_WIN)
   // On Windows, focused buttons are always drawn as such by the native theme.
@@ -328,17 +329,18 @@ nsNativeTheme::IsWidgetStyled(nsPresCont
       aWidgetType == NS_THEME_SPINNER_DOWN_BUTTON) {
     nsNumberControlFrame* numberControlFrame =
       nsNumberControlFrame::GetNumberControlFrameForSpinButton(aFrame);
     if (numberControlFrame) {
       return !numberControlFrame->ShouldUseNativeStyleForSpinner();
     }
   }
 
-  return (aWidgetType == NS_THEME_BUTTON ||
+  return (aWidgetType == NS_THEME_NUMBER_INPUT ||
+          aWidgetType == NS_THEME_BUTTON ||
           aWidgetType == NS_THEME_TEXTFIELD ||
           aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
           aWidgetType == NS_THEME_LISTBOX ||
           aWidgetType == NS_THEME_DROPDOWN) &&
          aFrame->GetContent()->IsHTML() &&
          aPresContext->HasAuthorSpecifiedRules(aFrame,
                                                NS_AUTHOR_SPECIFIED_BORDER |
                                                NS_AUTHOR_SPECIFIED_BACKGROUND);