Bug 669028 part.11 layout/style should use mozilla;LookAndFeel rather than nsILookAndFeel r=dbaron
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 09 Sep 2011 11:27:12 +0900
changeset 76817 b81bce473c10154f0d2fb97852c9ebc1ed481512
parent 76816 4442c70c63b869699a1167da1f7cd26963989c93
child 76818 36da7ff7039c54ecc28c3968f02166c5bf5978ab
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersdbaron
bugs669028
milestone9.0a1
Bug 669028 part.11 layout/style should use mozilla;LookAndFeel rather than nsILookAndFeel r=dbaron
layout/style/StyleRule.cpp
layout/style/nsCSSParser.cpp
layout/style/nsCSSProps.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsMediaFeatures.cpp
layout/style/nsRuleNode.cpp
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -57,17 +57,16 @@
 #include "nsStyleConsts.h"
 #include "nsStyleUtil.h"
 #include "nsIDOMCSSStyleSheet.h"
 #include "nsICSSStyleRuleDOMWrapper.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsINameSpaceManager.h"
 #include "nsXMLNameSpaceMap.h"
-#include "nsILookAndFeel.h"
 #include "nsRuleNode.h"
 #include "nsUnicharUtils.h"
 #include "nsCSSPseudoElements.h"
 #include "nsIPrincipal.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCSSPseudoClasses.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsTArray.h"
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -70,31 +70,31 @@
 #include "nsCSSPseudoClasses.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsINameSpaceManager.h"
 #include "nsXMLNameSpaceMap.h"
 #include "nsThemeConstants.h"
 #include "nsContentErrors.h"
 #include "nsIMediaList.h"
-#include "nsILookAndFeel.h"
+#include "mozilla/LookAndFeel.h"
 #include "nsStyleUtil.h"
 #include "nsIPrincipal.h"
 #include "prprf.h"
 #include "math.h"
 #include "nsContentUtils.h"
 #include "nsDOMError.h"
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
 #include "prlog.h"
 #include "CSSCalc.h"
 #include "nsMediaFeatures.h"
 #include "nsLayoutUtils.h"
 
-namespace css = mozilla::css;
+using namespace mozilla;
 
 // Flags for ParseVariant method
 #define VARIANT_KEYWORD         0x000001  // K
 #define VARIANT_LENGTH          0x000002  // L
 #define VARIANT_PERCENT         0x000004  // P
 #define VARIANT_COLOR           0x000008  // C eCSSUnit_Color, eCSSUnit_Ident (e.g.  "red")
 #define VARIANT_URL             0x000010  // U
 #define VARIANT_NUMBER          0x000020  // N
@@ -1217,23 +1217,21 @@ CSSParserImpl::ParseColorString(const ns
       rv = NS_OK;
     }
   } else if (value.GetUnit() == eCSSUnit_Color) {
     (*aColor) = value.GetColorValue();
     rv = NS_OK;
   } else if (value.GetUnit() == eCSSUnit_EnumColor) {
     PRInt32 intValue = value.GetIntValue();
     if (intValue >= 0) {
-      nsCOMPtr<nsILookAndFeel> lfSvc = do_GetService("@mozilla.org/widget/lookandfeel;1");
-      if (lfSvc) {
-        nscolor rgba;
-        rv = lfSvc->GetColor((nsILookAndFeel::nsColorID) value.GetIntValue(), rgba);
-        if (NS_SUCCEEDED(rv))
-          (*aColor) = rgba;
-      }
+      nscolor rgba;
+      rv = LookAndFeel::GetColor((LookAndFeel::ColorID) value.GetIntValue(),
+                                 &rgba);
+      if (NS_SUCCEEDED(rv))
+        (*aColor) = rgba;
     } else {
       // XXX - this is NS_COLOR_CURRENTCOLOR, NS_COLOR_MOZ_HYPERLINKTEXT, etc.
       // which we don't handle as per the ParseColorString definition.  Should
       // remove this limitation at some point.
       rv = NS_ERROR_FAILURE;
     }
   }
 
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -43,17 +43,17 @@
  */
 
 #include "nsCSSProps.h"
 #include "nsCSSKeywords.h"
 #include "nsStyleConsts.h"
 #include "nsIWidget.h"
 #include "nsThemeConstants.h"  // For system widget appearance types
 
-#include "nsILookAndFeel.h" // for system colors
+#include "mozilla/LookAndFeel.h" // for system colors
 
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsStaticNameTable.h"
 #include "prlog.h" // for PR_STATIC_ASSERT
 
 // required to make the symbol external, so that TestCSSPropertyLookup.cpp can link with it
 extern const char* const kCSSRawProperties[];
@@ -65,16 +65,17 @@ const char* const kCSSRawProperties[] = 
   #name_,
 #include "nsCSSPropList.h"
 #undef CSS_PROP
 #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_) #name_,
 #include "nsCSSPropList.h"
 #undef CSS_PROP_SHORTHAND
 };
 
+using namespace mozilla;
 
 static PRInt32 gTableRefCount;
 static nsStaticCaseInsensitiveNameTable* gPropertyTable;
 static nsStaticCaseInsensitiveNameTable* gFontDescTable;
 
 /* static */ nsCSSProperty *
   nsCSSProps::gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands];
 /* static */ nsCSSProperty* nsCSSProps::gShorthandsContainingPool = nsnull;
@@ -723,83 +724,83 @@ const PRInt32 nsCSSProps::kClearKTable[]
   eCSSKeyword_none, NS_STYLE_CLEAR_NONE,
   eCSSKeyword_left, NS_STYLE_CLEAR_LEFT,
   eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT,
   eCSSKeyword_both, NS_STYLE_CLEAR_LEFT_AND_RIGHT,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const PRInt32 nsCSSProps::kColorKTable[] = {
-  eCSSKeyword_activeborder, nsILookAndFeel::eColor_activeborder,
-  eCSSKeyword_activecaption, nsILookAndFeel::eColor_activecaption,
-  eCSSKeyword_appworkspace, nsILookAndFeel::eColor_appworkspace,
-  eCSSKeyword_background, nsILookAndFeel::eColor_background,
-  eCSSKeyword_buttonface, nsILookAndFeel::eColor_buttonface,
-  eCSSKeyword_buttonhighlight, nsILookAndFeel::eColor_buttonhighlight,
-  eCSSKeyword_buttonshadow, nsILookAndFeel::eColor_buttonshadow,
-  eCSSKeyword_buttontext, nsILookAndFeel::eColor_buttontext,
-  eCSSKeyword_captiontext, nsILookAndFeel::eColor_captiontext,
-  eCSSKeyword_graytext, nsILookAndFeel::eColor_graytext,
-  eCSSKeyword_highlight, nsILookAndFeel::eColor_highlight,
-  eCSSKeyword_highlighttext, nsILookAndFeel::eColor_highlighttext,
-  eCSSKeyword_inactiveborder, nsILookAndFeel::eColor_inactiveborder,
-  eCSSKeyword_inactivecaption, nsILookAndFeel::eColor_inactivecaption,
-  eCSSKeyword_inactivecaptiontext, nsILookAndFeel::eColor_inactivecaptiontext,
-  eCSSKeyword_infobackground, nsILookAndFeel::eColor_infobackground,
-  eCSSKeyword_infotext, nsILookAndFeel::eColor_infotext,
-  eCSSKeyword_menu, nsILookAndFeel::eColor_menu,
-  eCSSKeyword_menutext, nsILookAndFeel::eColor_menutext,
-  eCSSKeyword_scrollbar, nsILookAndFeel::eColor_scrollbar,
-  eCSSKeyword_threeddarkshadow, nsILookAndFeel::eColor_threeddarkshadow,
-  eCSSKeyword_threedface, nsILookAndFeel::eColor_threedface,
-  eCSSKeyword_threedhighlight, nsILookAndFeel::eColor_threedhighlight,
-  eCSSKeyword_threedlightshadow, nsILookAndFeel::eColor_threedlightshadow,
-  eCSSKeyword_threedshadow, nsILookAndFeel::eColor_threedshadow,
-  eCSSKeyword_window, nsILookAndFeel::eColor_window,
-  eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe,
-  eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext,
+  eCSSKeyword_activeborder, LookAndFeel::eColorID_activeborder,
+  eCSSKeyword_activecaption, LookAndFeel::eColorID_activecaption,
+  eCSSKeyword_appworkspace, LookAndFeel::eColorID_appworkspace,
+  eCSSKeyword_background, LookAndFeel::eColorID_background,
+  eCSSKeyword_buttonface, LookAndFeel::eColorID_buttonface,
+  eCSSKeyword_buttonhighlight, LookAndFeel::eColorID_buttonhighlight,
+  eCSSKeyword_buttonshadow, LookAndFeel::eColorID_buttonshadow,
+  eCSSKeyword_buttontext, LookAndFeel::eColorID_buttontext,
+  eCSSKeyword_captiontext, LookAndFeel::eColorID_captiontext,
+  eCSSKeyword_graytext, LookAndFeel::eColorID_graytext,
+  eCSSKeyword_highlight, LookAndFeel::eColorID_highlight,
+  eCSSKeyword_highlighttext, LookAndFeel::eColorID_highlighttext,
+  eCSSKeyword_inactiveborder, LookAndFeel::eColorID_inactiveborder,
+  eCSSKeyword_inactivecaption, LookAndFeel::eColorID_inactivecaption,
+  eCSSKeyword_inactivecaptiontext, LookAndFeel::eColorID_inactivecaptiontext,
+  eCSSKeyword_infobackground, LookAndFeel::eColorID_infobackground,
+  eCSSKeyword_infotext, LookAndFeel::eColorID_infotext,
+  eCSSKeyword_menu, LookAndFeel::eColorID_menu,
+  eCSSKeyword_menutext, LookAndFeel::eColorID_menutext,
+  eCSSKeyword_scrollbar, LookAndFeel::eColorID_scrollbar,
+  eCSSKeyword_threeddarkshadow, LookAndFeel::eColorID_threeddarkshadow,
+  eCSSKeyword_threedface, LookAndFeel::eColorID_threedface,
+  eCSSKeyword_threedhighlight, LookAndFeel::eColorID_threedhighlight,
+  eCSSKeyword_threedlightshadow, LookAndFeel::eColorID_threedlightshadow,
+  eCSSKeyword_threedshadow, LookAndFeel::eColorID_threedshadow,
+  eCSSKeyword_window, LookAndFeel::eColorID_window,
+  eCSSKeyword_windowframe, LookAndFeel::eColorID_windowframe,
+  eCSSKeyword_windowtext, LookAndFeel::eColorID_windowtext,
   eCSSKeyword__moz_activehyperlinktext, NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT,
-  eCSSKeyword__moz_buttondefault, nsILookAndFeel::eColor__moz_buttondefault,
-  eCSSKeyword__moz_buttonhoverface, nsILookAndFeel::eColor__moz_buttonhoverface,
-  eCSSKeyword__moz_buttonhovertext, nsILookAndFeel::eColor__moz_buttonhovertext,
-  eCSSKeyword__moz_cellhighlight, nsILookAndFeel::eColor__moz_cellhighlight,
-  eCSSKeyword__moz_cellhighlighttext, nsILookAndFeel::eColor__moz_cellhighlighttext,
-  eCSSKeyword__moz_eventreerow, nsILookAndFeel::eColor__moz_eventreerow,
-  eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field,
-  eCSSKeyword__moz_fieldtext, nsILookAndFeel::eColor__moz_fieldtext,
+  eCSSKeyword__moz_buttondefault, LookAndFeel::eColorID__moz_buttondefault,
+  eCSSKeyword__moz_buttonhoverface, LookAndFeel::eColorID__moz_buttonhoverface,
+  eCSSKeyword__moz_buttonhovertext, LookAndFeel::eColorID__moz_buttonhovertext,
+  eCSSKeyword__moz_cellhighlight, LookAndFeel::eColorID__moz_cellhighlight,
+  eCSSKeyword__moz_cellhighlighttext, LookAndFeel::eColorID__moz_cellhighlighttext,
+  eCSSKeyword__moz_eventreerow, LookAndFeel::eColorID__moz_eventreerow,
+  eCSSKeyword__moz_field, LookAndFeel::eColorID__moz_field,
+  eCSSKeyword__moz_fieldtext, LookAndFeel::eColorID__moz_fieldtext,
   eCSSKeyword__moz_default_background_color, NS_COLOR_MOZ_DEFAULT_BACKGROUND_COLOR,
   eCSSKeyword__moz_default_color, NS_COLOR_MOZ_DEFAULT_COLOR,
-  eCSSKeyword__moz_dialog, nsILookAndFeel::eColor__moz_dialog,
-  eCSSKeyword__moz_dialogtext, nsILookAndFeel::eColor__moz_dialogtext,
-  eCSSKeyword__moz_dragtargetzone, nsILookAndFeel::eColor__moz_dragtargetzone,
+  eCSSKeyword__moz_dialog, LookAndFeel::eColorID__moz_dialog,
+  eCSSKeyword__moz_dialogtext, LookAndFeel::eColorID__moz_dialogtext,
+  eCSSKeyword__moz_dragtargetzone, LookAndFeel::eColorID__moz_dragtargetzone,
   eCSSKeyword__moz_hyperlinktext, NS_COLOR_MOZ_HYPERLINKTEXT,
-  eCSSKeyword__moz_html_cellhighlight, nsILookAndFeel::eColor__moz_html_cellhighlight,
-  eCSSKeyword__moz_html_cellhighlighttext, nsILookAndFeel::eColor__moz_html_cellhighlighttext,
-  eCSSKeyword__moz_mac_chrome_active, nsILookAndFeel::eColor__moz_mac_chrome_active,
-  eCSSKeyword__moz_mac_chrome_inactive, nsILookAndFeel::eColor__moz_mac_chrome_inactive,
-  eCSSKeyword__moz_mac_focusring, nsILookAndFeel::eColor__moz_mac_focusring,
-  eCSSKeyword__moz_mac_menuselect, nsILookAndFeel::eColor__moz_mac_menuselect,
-  eCSSKeyword__moz_mac_menushadow, nsILookAndFeel::eColor__moz_mac_menushadow,
-  eCSSKeyword__moz_mac_menutextdisable, nsILookAndFeel::eColor__moz_mac_menutextdisable,
-  eCSSKeyword__moz_mac_menutextselect, nsILookAndFeel::eColor__moz_mac_menutextselect,
-  eCSSKeyword__moz_mac_disabledtoolbartext, nsILookAndFeel::eColor__moz_mac_disabledtoolbartext,
-  eCSSKeyword__moz_mac_alternateprimaryhighlight, nsILookAndFeel::eColor__moz_mac_alternateprimaryhighlight,
-  eCSSKeyword__moz_mac_secondaryhighlight, nsILookAndFeel::eColor__moz_mac_secondaryhighlight,
-  eCSSKeyword__moz_menuhover, nsILookAndFeel::eColor__moz_menuhover,
-  eCSSKeyword__moz_menuhovertext, nsILookAndFeel::eColor__moz_menuhovertext,
-  eCSSKeyword__moz_menubartext, nsILookAndFeel::eColor__moz_menubartext,
-  eCSSKeyword__moz_menubarhovertext, nsILookAndFeel::eColor__moz_menubarhovertext,
-  eCSSKeyword__moz_oddtreerow, nsILookAndFeel::eColor__moz_oddtreerow,
+  eCSSKeyword__moz_html_cellhighlight, LookAndFeel::eColorID__moz_html_cellhighlight,
+  eCSSKeyword__moz_html_cellhighlighttext, LookAndFeel::eColorID__moz_html_cellhighlighttext,
+  eCSSKeyword__moz_mac_chrome_active, LookAndFeel::eColorID__moz_mac_chrome_active,
+  eCSSKeyword__moz_mac_chrome_inactive, LookAndFeel::eColorID__moz_mac_chrome_inactive,
+  eCSSKeyword__moz_mac_focusring, LookAndFeel::eColorID__moz_mac_focusring,
+  eCSSKeyword__moz_mac_menuselect, LookAndFeel::eColorID__moz_mac_menuselect,
+  eCSSKeyword__moz_mac_menushadow, LookAndFeel::eColorID__moz_mac_menushadow,
+  eCSSKeyword__moz_mac_menutextdisable, LookAndFeel::eColorID__moz_mac_menutextdisable,
+  eCSSKeyword__moz_mac_menutextselect, LookAndFeel::eColorID__moz_mac_menutextselect,
+  eCSSKeyword__moz_mac_disabledtoolbartext, LookAndFeel::eColorID__moz_mac_disabledtoolbartext,
+  eCSSKeyword__moz_mac_alternateprimaryhighlight, LookAndFeel::eColorID__moz_mac_alternateprimaryhighlight,
+  eCSSKeyword__moz_mac_secondaryhighlight, LookAndFeel::eColorID__moz_mac_secondaryhighlight,
+  eCSSKeyword__moz_menuhover, LookAndFeel::eColorID__moz_menuhover,
+  eCSSKeyword__moz_menuhovertext, LookAndFeel::eColorID__moz_menuhovertext,
+  eCSSKeyword__moz_menubartext, LookAndFeel::eColorID__moz_menubartext,
+  eCSSKeyword__moz_menubarhovertext, LookAndFeel::eColorID__moz_menubarhovertext,
+  eCSSKeyword__moz_oddtreerow, LookAndFeel::eColorID__moz_oddtreerow,
   eCSSKeyword__moz_visitedhyperlinktext, NS_COLOR_MOZ_VISITEDHYPERLINKTEXT,
   eCSSKeyword_currentcolor, NS_COLOR_CURRENTCOLOR,
-  eCSSKeyword__moz_win_mediatext, nsILookAndFeel::eColor__moz_win_mediatext,
-  eCSSKeyword__moz_win_communicationstext, nsILookAndFeel::eColor__moz_win_communicationstext,
-  eCSSKeyword__moz_nativehyperlinktext, nsILookAndFeel::eColor__moz_nativehyperlinktext,
-  eCSSKeyword__moz_comboboxtext, nsILookAndFeel::eColor__moz_comboboxtext,
-  eCSSKeyword__moz_combobox, nsILookAndFeel::eColor__moz_combobox,
+  eCSSKeyword__moz_win_mediatext, LookAndFeel::eColorID__moz_win_mediatext,
+  eCSSKeyword__moz_win_communicationstext, LookAndFeel::eColorID__moz_win_communicationstext,
+  eCSSKeyword__moz_nativehyperlinktext, LookAndFeel::eColorID__moz_nativehyperlinktext,
+  eCSSKeyword__moz_comboboxtext, LookAndFeel::eColorID__moz_comboboxtext,
+  eCSSKeyword__moz_combobox, LookAndFeel::eColorID__moz_combobox,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const PRInt32 nsCSSProps::kContentKTable[] = {
   eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE,
   eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE,
   eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE,
   eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE,
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -72,47 +72,45 @@
 #include "nsCSSPseudoElements.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
 #include "nsHashKeys.h"
 #include "nsStyleUtil.h"
 #include "nsQuickSort.h"
 #include "nsAttrValue.h"
 #include "nsAttrName.h"
-#include "nsILookAndFeel.h"
-#include "nsWidgetsCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsTArray.h"
 #include "nsContentUtils.h"
 #include "nsIMediaList.h"
 #include "nsCSSRules.h"
 #include "nsIPrincipal.h"
 #include "nsStyleSet.h"
 #include "prlog.h"
 #include "nsIObserverService.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsNetCID.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/Element.h"
 #include "nsGenericElement.h"
 #include "nsNthIndexCache.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/LookAndFeel.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
 
 static PRBool gSupportVisitedPseudo = PR_TRUE;
 
-static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
 static nsTArray< nsCOMPtr<nsIAtom> >* sSystemMetrics = 0;
 
 #ifdef XP_WIN
-PRUint8 nsCSSRuleProcessor::sWinThemeId = nsILookAndFeel::eWindowsTheme_Generic;
+PRUint8 nsCSSRuleProcessor::sWinThemeId = LookAndFeel::eWindowsTheme_Generic;
 #endif
 
 /**
  * A struct representing a given CSS rule and a particular selector
  * from that rule's selector list.
  */
 struct RuleSelectorPair {
   RuleSelectorPair(css::StyleRule* aRule, nsCSSSelector* aSelector)
@@ -1049,119 +1047,121 @@ nsCSSRuleProcessor::Startup()
 static PRBool
 InitSystemMetrics()
 {
   NS_ASSERTION(!sSystemMetrics, "already initialized");
 
   sSystemMetrics = new nsTArray< nsCOMPtr<nsIAtom> >;
   NS_ENSURE_TRUE(sSystemMetrics, PR_FALSE);
 
-  nsresult rv;
-  nsCOMPtr<nsILookAndFeel> lookAndFeel(do_GetService(kLookAndFeelCID, &rv));
-  NS_ENSURE_SUCCESS(rv, PR_FALSE);
-
   /***************************************************************************
    * ANY METRICS ADDED HERE SHOULD ALSO BE ADDED AS MEDIA QUERIES IN         *
    * nsMediaFeatures.cpp                                                     *
    ***************************************************************************/
 
-  PRInt32 metricResult;
-  lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollArrowStyle, metricResult);
-  if (metricResult & nsILookAndFeel::eMetric_ScrollArrowStartBackward) {
+  PRInt32 metricResult =
+    LookAndFeel::GetInt(LookAndFeel::eIntID_ScrollArrowStyle);
+  if (metricResult & LookAndFeel::eScrollArrow_StartBackward) {
     sSystemMetrics->AppendElement(nsGkAtoms::scrollbar_start_backward);
   }
-  if (metricResult & nsILookAndFeel::eMetric_ScrollArrowStartForward) {
+  if (metricResult & LookAndFeel::eScrollArrow_StartForward) {
     sSystemMetrics->AppendElement(nsGkAtoms::scrollbar_start_forward);
   }
-  if (metricResult & nsILookAndFeel::eMetric_ScrollArrowEndBackward) {
+  if (metricResult & LookAndFeel::eScrollArrow_EndBackward) {
     sSystemMetrics->AppendElement(nsGkAtoms::scrollbar_end_backward);
   }
-  if (metricResult & nsILookAndFeel::eMetric_ScrollArrowEndForward) {
+  if (metricResult & LookAndFeel::eScrollArrow_EndForward) {
     sSystemMetrics->AppendElement(nsGkAtoms::scrollbar_end_forward);
   }
 
-  lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollSliderStyle, metricResult);
-  if (metricResult != nsILookAndFeel::eMetric_ScrollThumbStyleNormal) {
+  metricResult =
+    LookAndFeel::GetInt(LookAndFeel::eIntID_ScrollSliderStyle);
+  if (metricResult != LookAndFeel::eScrollThumbStyle_Normal) {
     sSystemMetrics->AppendElement(nsGkAtoms::scrollbar_thumb_proportional);
   }
 
-  lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ImagesInMenus, metricResult);
+  metricResult =
+    LookAndFeel::GetInt(LookAndFeel::eIntID_ImagesInMenus);
   if (metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::images_in_menus);
   }
 
-  lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ImagesInButtons, metricResult);
+  metricResult =
+    LookAndFeel::GetInt(LookAndFeel::eIntID_ImagesInButtons);
   if (metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::images_in_buttons);
   }
 
-  lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenuBarDrag, metricResult);
+  metricResult =
+    LookAndFeel::GetInt(LookAndFeel::eIntID_MenuBarDrag);
   if (metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::menubar_drag);
   }
 
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_WindowsDefaultTheme, metricResult);
+  nsresult rv =
+    LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsDefaultTheme, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::windows_default_theme);
   }
 
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MacGraphiteTheme, metricResult);
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_MacGraphiteTheme, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::mac_graphite_theme);
   }
 
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MacLionTheme, metricResult);
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_MacLionTheme, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::mac_lion_theme);
   }
 
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_DWMCompositor, metricResult);
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_DWMCompositor, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::windows_compositor);
   }
 
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_WindowsClassic, metricResult);
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsClassic, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::windows_classic);
   }
 
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TouchEnabled, metricResult);
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_TouchEnabled, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::touch_enabled);
   }
  
-  rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MaemoClassic, metricResult);
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_MaemoClassic, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::maemo_classic);
   }
 
 #ifdef XP_WIN
-  if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetric_WindowsThemeIdentifier,
-                                          metricResult))) {
+  if (NS_SUCCEEDED(
+        LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsThemeIdentifier,
+                            &metricResult))) {
     nsCSSRuleProcessor::SetWindowsThemeIdentifier(static_cast<PRUint8>(metricResult));
     switch(metricResult) {
-      case nsILookAndFeel::eWindowsTheme_Aero:
+      case LookAndFeel::eWindowsTheme_Aero:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_aero);
         break;
-      case nsILookAndFeel::eWindowsTheme_LunaBlue:
+      case LookAndFeel::eWindowsTheme_LunaBlue:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_luna_blue);
         break;
-      case nsILookAndFeel::eWindowsTheme_LunaOlive:
+      case LookAndFeel::eWindowsTheme_LunaOlive:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_luna_olive);
         break;
-      case nsILookAndFeel::eWindowsTheme_LunaSilver:
+      case LookAndFeel::eWindowsTheme_LunaSilver:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_luna_silver);
         break;
-      case nsILookAndFeel::eWindowsTheme_Royale:
+      case LookAndFeel::eWindowsTheme_Royale:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_royale);
         break;
-      case nsILookAndFeel::eWindowsTheme_Zune:
+      case LookAndFeel::eWindowsTheme_Zune:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_zune);
         break;
-      case nsILookAndFeel::eWindowsTheme_Generic:
+      case LookAndFeel::eWindowsTheme_Generic:
         sSystemMetrics->AppendElement(nsGkAtoms::windows_theme_generic);
         break;
     }
   }
 #endif
 
   return PR_TRUE;
 }
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -40,46 +40,48 @@
 #include "nsMediaFeatures.h"
 #include "nsGkAtoms.h"
 #include "nsCSSKeywords.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsCSSValue.h"
 #include "nsIDocShell.h"
 #include "nsLayoutUtils.h"
-#include "nsILookAndFeel.h"
+#include "mozilla/LookAndFeel.h"
 #include "nsCSSRuleProcessor.h"
 
+using namespace mozilla;
+
 static const PRInt32 kOrientationKeywords[] = {
   eCSSKeyword_portrait,                 NS_STYLE_ORIENTATION_PORTRAIT,
   eCSSKeyword_landscape,                NS_STYLE_ORIENTATION_LANDSCAPE,
   eCSSKeyword_UNKNOWN,                  -1
 };
 
 static const PRInt32 kScanKeywords[] = {
   eCSSKeyword_progressive,              NS_STYLE_SCAN_PROGRESSIVE,
   eCSSKeyword_interlace,                NS_STYLE_SCAN_INTERLACE,
   eCSSKeyword_UNKNOWN,                  -1
 };
 
 #ifdef XP_WIN
 struct WindowsThemeName {
-    nsILookAndFeel::WindowsThemeIdentifier id;
+    LookAndFeel::WindowsTheme id;
     const wchar_t* name;
 };
 
 // Windows theme identities used in the -moz-windows-theme media query.
 const WindowsThemeName themeStrings[] = {
-    { nsILookAndFeel::eWindowsTheme_Aero,       L"aero" },
-    { nsILookAndFeel::eWindowsTheme_LunaBlue,   L"luna-blue" },
-    { nsILookAndFeel::eWindowsTheme_LunaOlive,  L"luna-olive" },
-    { nsILookAndFeel::eWindowsTheme_LunaSilver, L"luna-silver" },
-    { nsILookAndFeel::eWindowsTheme_Royale,     L"royale" },
-    { nsILookAndFeel::eWindowsTheme_Zune,       L"zune" },
-    { nsILookAndFeel::eWindowsTheme_Generic,    L"generic" }
+    { LookAndFeel::eWindowsTheme_Aero,       L"aero" },
+    { LookAndFeel::eWindowsTheme_LunaBlue,   L"luna-blue" },
+    { LookAndFeel::eWindowsTheme_LunaOlive,  L"luna-olive" },
+    { LookAndFeel::eWindowsTheme_LunaSilver, L"luna-silver" },
+    { LookAndFeel::eWindowsTheme_Royale,     L"royale" },
+    { LookAndFeel::eWindowsTheme_Zune,       L"zune" },
+    { LookAndFeel::eWindowsTheme_Generic,    L"generic" }
 };
 #endif
 
 // A helper for four features below
 static nsSize
 GetSize(nsPresContext* aPresContext)
 {
     nsSize size;
@@ -320,17 +322,17 @@ GetWindowsTheme(nsPresContext* aPresCont
                 nsCSSValue& aResult)
 {
     aResult.Reset();
 #ifdef XP_WIN
     PRUint8 windowsThemeId =
         nsCSSRuleProcessor::GetWindowsThemeIdentifier();
 
     // Classic mode should fail to match.
-    if (windowsThemeId == nsILookAndFeel::eWindowsTheme_Classic)
+    if (windowsThemeId == LookAndFeel::eWindowsTheme_Classic)
         return NS_OK;
 
     // Look up the appropriate theme string
     for (size_t i = 0; i < NS_ARRAY_LENGTH(themeStrings); ++i) {
         if (windowsThemeId == themeStrings[i].id) {
             aResult.SetStringValue(nsDependentString(themeStrings[i].name),
                                    eCSSUnit_Ident);
             break;
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -48,17 +48,17 @@
  * a node in the lexicographic tree of rules that match an element,
  * responsible for converting the rules' information into computed style
  */
 
 #include "nsRuleNode.h"
 #include "nscore.h"
 #include "nsIServiceManager.h"
 #include "nsIWidget.h"
-#include "nsILookAndFeel.h"
+#include "mozilla/LookAndFeel.h"
 #include "nsIPresShell.h"
 #include "nsFontMetrics.h"
 #include "gfxFont.h"
 #include "nsStyleUtil.h"
 #include "nsCSSPseudoElements.h"
 #include "nsThemeConstants.h"
 #include "nsITheme.h"
 #include "pldhash.h"
@@ -86,18 +86,18 @@
 #ifdef _MSC_VER
 #define alloca _alloca
 #endif
 #endif
 #ifdef SOLARIS
 #include <alloca.h>
 #endif
 
+using namespace mozilla;
 using namespace mozilla::dom;
-namespace css = mozilla::css;
 
 #define NS_SET_IMAGE_REQUEST(method_, context_, request_)                   \
   if ((context_)->PresContext()->IsDynamic()) {                               \
     method_(request_);                                                      \
   } else {                                                                  \
     nsCOMPtr<imgIRequest> req = nsContentUtils::GetStaticRequest(request_); \
     method_(req);                                                           \
   }
@@ -760,19 +760,18 @@ static PRBool SetColor(const nsCSSValue&
     if (NS_ColorNameToRGB(value, &rgba)) {
       aResult = rgba;
       result = PR_TRUE;
     }
   }
   else if (eCSSUnit_EnumColor == unit) {
     PRInt32 intValue = aValue.GetIntValue();
     if (0 <= intValue) {
-      nsILookAndFeel* look = aPresContext->LookAndFeel();
-      nsILookAndFeel::nsColorID colorID = (nsILookAndFeel::nsColorID) intValue;
-      if (NS_SUCCEEDED(look->GetColor(colorID, aResult))) {
+      LookAndFeel::ColorID colorID = (LookAndFeel::ColorID) intValue;
+      if (NS_SUCCEEDED(LookAndFeel::GetColor(colorID, &aResult))) {
         result = PR_TRUE;
       }
     }
     else {
       switch (intValue) {
         case NS_COLOR_MOZ_HYPERLINKTEXT:
           aResult = aPresContext->DefaultLinkColor();
           break;