Bug 938123 - Build layout/style in unified mode; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 14 Nov 2013 21:42:57 -0500
changeset 155400 8693b3e2c50ef66e86af33eda61f77ab6961fa75
parent 155399 6da0e9da2b1ad3bebdafff123dacfb17d3fdb1ad
child 155401 415eba0ead602d7eda180668e22dd0981990c3d0
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersroc
bugs938123
milestone28.0a1
Bug 938123 - Build layout/style in unified mode; r=roc
layout/style/GroupRule.h
layout/style/StyleRule.cpp
layout/style/moz.build
layout/style/nsCSSDataBlock.cpp
layout/style/nsCSSKeywords.cpp
layout/style/nsCSSProps.cpp
layout/style/nsCSSPseudoClasses.cpp
layout/style/nsCSSPseudoElements.cpp
layout/style/nsCSSRules.cpp
layout/style/nsCSSStyleSheet.cpp
layout/style/nsCSSValue.cpp
layout/style/nsHTMLCSSStyleSheet.cpp
layout/style/nsStyleTransformMatrix.cpp
--- a/layout/style/GroupRule.h
+++ b/layout/style/GroupRule.h
@@ -68,16 +68,24 @@ public:
 
   virtual bool UseForPresentation(nsPresContext* aPresContext,
                                     nsMediaQueryResultCacheKey& aKey) = 0;
 
   // non-virtual -- it is only called by subclasses
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
 
+  static bool
+  CloneRuleInto(Rule* aRule, void* aArray)
+  {
+    nsRefPtr<Rule> clone = aRule->Clone();
+    static_cast<nsCOMArray<Rule>*>(aArray)->AppendObject(clone);
+    return true;
+  }
+
 protected:
   // to help implement nsIDOMCSSRule
   void AppendRulesToCssText(nsAString& aCssText);
 
   // to implement common methods on nsIDOMCSSMediaRule and
   // nsIDOMCSSMozDocumentRule
   nsresult GetCssRules(nsIDOMCSSRuleList* *aRuleList);
   nsresult InsertRule(const nsAString & aRule, uint32_t aIndex,
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -30,17 +30,17 @@
 #include "nsDOMClassInfoID.h"
 #include "nsContentUtils.h"
 #include "nsError.h"
 #include "mozAutoDocUpdate.h"
 
 class nsIDOMCSSStyleDeclaration;
 class nsIDOMCSSStyleSheet;
 
-namespace css = mozilla::css;
+using namespace mozilla;
 
 #define NS_IF_CLONE(member_)                                                  \
   PR_BEGIN_MACRO                                                              \
     if (member_) {                                                            \
       result->member_ = member_->Clone();                                     \
       if (!result->member_) {                                                 \
         delete result;                                                        \
         return nullptr;                                                        \
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -71,33 +71,32 @@ EXPORTS.mozilla.css += [
     'ImageLoader.h',
     'ImportRule.h',
     'Loader.h',
     'NameSpaceRule.h',
     'Rule.h',
     'StyleRule.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'AnimationCommon.cpp',
     'CSS.cpp',
     'Declaration.cpp',
     'ErrorReporter.cpp',
     'ImageLoader.cpp',
     'Loader.cpp',
     'nsAnimationManager.cpp',
     'nsComputedDOMStyle.cpp',
     'nsCSSAnonBoxes.cpp',
     'nsCSSDataBlock.cpp',
     'nsCSSKeywords.cpp',
     'nsCSSParser.cpp',
     'nsCSSProps.cpp',
     'nsCSSPseudoClasses.cpp',
     'nsCSSPseudoElements.cpp',
-    'nsCSSRuleProcessor.cpp',
     'nsCSSRules.cpp',
     'nsCSSScanner.cpp',
     'nsCSSStyleSheet.cpp',
     'nsCSSValue.cpp',
     'nsDOMCSSAttrDeclaration.cpp',
     'nsDOMCSSDeclaration.cpp',
     'nsDOMCSSRect.cpp',
     'nsDOMCSSRGBColor.cpp',
@@ -118,16 +117,21 @@ SOURCES += [
     'nsStyleSet.cpp',
     'nsStyleStruct.cpp',
     'nsStyleTransformMatrix.cpp',
     'nsStyleUtil.cpp',
     'nsTransitionManager.cpp',
     'StyleRule.cpp',
 ]
 
+# nsCSSRuleProcessor.cpp needs to be built separately because it uses plarena.h.
+SOURCES += [
+    'nsCSSRuleProcessor.cpp',
+]
+
 FAIL_ON_WARNINGS = True
 
 LIBXUL_LIBRARY = True
 
 MSVC_ENABLE_PGO = True
 
 LIBRARY_NAME = 'gkstyle_s'
 
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -12,17 +12,17 @@
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/css/Declaration.h"
 #include "mozilla/css/ImageLoader.h"
 #include "nsRuleData.h"
 #include "nsStyleSet.h"
 #include "nsStyleContext.h"
 #include "nsIDocument.h"
 
-namespace css = mozilla::css;
+using namespace mozilla;
 
 /**
  * Does a fast move of aSource to aDest.  The previous value in
  * aDest is cleanly destroyed, and aSource is cleared.  Returns
  * true if, before the copy, the value at aSource compared unequal
  * to the value at aDest; false otherwise.
  */
 static bool
--- a/layout/style/nsCSSKeywords.cpp
+++ b/layout/style/nsCSSKeywords.cpp
@@ -14,23 +14,23 @@ extern const char* const kCSSRawKeywords
 
 // define an array of all CSS keywords
 #define CSS_KEY(_name,_id) #_name,
 const char* const kCSSRawKeywords[] = {
 #include "nsCSSKeywordList.h"
 };
 #undef CSS_KEY
 
-static int32_t gTableRefCount;
+static int32_t gKeywordTableRefCount;
 static nsStaticCaseInsensitiveNameTable* gKeywordTable;
 
 void
 nsCSSKeywords::AddRefTable(void) 
 {
-  if (0 == gTableRefCount++) {
+  if (0 == gKeywordTableRefCount++) {
     NS_ASSERTION(!gKeywordTable, "pre existing array!");
     gKeywordTable = new nsStaticCaseInsensitiveNameTable();
     if (gKeywordTable) {
 #ifdef DEBUG
     {
       // let's verify the table...
       int32_t index = 0;
       for (; index < eCSSKeyword_COUNT && kCSSRawKeywords[index]; ++index) {
@@ -46,17 +46,17 @@ nsCSSKeywords::AddRefTable(void)
       gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT); 
     }
   }
 }
 
 void
 nsCSSKeywords::ReleaseTable(void) 
 {
-  if (0 == --gTableRefCount) {
+  if (0 == --gKeywordTableRefCount) {
     if (gKeywordTable) {
       delete gKeywordTable;
       gKeywordTable = nullptr;
     }
   }
 }
 
 nsCSSKeyword 
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -43,17 +43,17 @@ const char* const kCSSRawProperties[eCSS
 #undef CSS_PROP_SHORTHAND
 #define CSS_PROP_ALIAS(aliasname_, id_, method_, pref_) #aliasname_,
 #include "nsCSSPropAliasList.h"
 #undef CSS_PROP_ALIAS
 };
 
 using namespace mozilla;
 
-static int32_t gTableRefCount;
+static int32_t gPropertyTableRefCount;
 static nsStaticCaseInsensitiveNameTable* gPropertyTable;
 static nsStaticCaseInsensitiveNameTable* gFontDescTable;
 
 /* static */ nsCSSProperty *
   nsCSSProps::gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands];
 /* static */ nsCSSProperty* nsCSSProps::gShorthandsContainingPool = nullptr;
 
 static const char* const kCSSRawFontDescs[] = {
@@ -91,17 +91,17 @@ static nsCSSProperty gAliases[eCSSAliasC
   eCSSProperty_##propid_ ,
 #include "nsCSSPropAliasList.h"
 #undef CSS_PROP_ALIAS
 };
 
 void
 nsCSSProps::AddRefTable(void)
 {
-  if (0 == gTableRefCount++) {
+  if (0 == gPropertyTableRefCount++) {
     NS_ABORT_IF_FALSE(!gPropertyTable, "pre existing array!");
     NS_ABORT_IF_FALSE(!gFontDescTable, "pre existing array!");
 
     gPropertyTable = new nsStaticCaseInsensitiveNameTable();
     if (gPropertyTable) {
 #ifdef DEBUG
     {
       // let's verify the table...
@@ -331,17 +331,17 @@ nsCSSProps::BuildShorthandsContainingTab
 #endif
 
   return true;
 }
 
 void
 nsCSSProps::ReleaseTable(void)
 {
-  if (0 == --gTableRefCount) {
+  if (0 == --gPropertyTableRefCount) {
     delete gPropertyTable;
     gPropertyTable = nullptr;
 
     delete gFontDescTable;
     gFontDescTable = nullptr;
 
     delete [] gShorthandsContainingPool;
     gShorthandsContainingPool = nullptr;
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ b/layout/style/nsCSSPseudoClasses.cpp
@@ -16,23 +16,23 @@ using namespace mozilla;
 
 // define storage for all atoms
 #define CSS_PSEUDO_CLASS(_name, _value, _pref) \
   static nsIAtom* sPseudoClass_##_name;
 #include "nsCSSPseudoClassList.h"
 #undef CSS_PSEUDO_CLASS
 
 #define CSS_PSEUDO_CLASS(name_, value_, pref_)  \
-  NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
+  NS_STATIC_ATOM_BUFFER(name_##_pseudo_class_buffer, value_)
 #include "nsCSSPseudoClassList.h"
 #undef CSS_PSEUDO_CLASS
 
 static const nsStaticAtom CSSPseudoClasses_info[] = {
 #define CSS_PSEUDO_CLASS(name_, value_, pref_)            \
-  NS_STATIC_ATOM(name_##_buffer, &sPseudoClass_##name_),
+  NS_STATIC_ATOM(name_##_pseudo_class_buffer, &sPseudoClass_##name_),
 #include "nsCSSPseudoClassList.h"
 #undef CSS_PSEUDO_CLASS
 };
 
 static bool sPseudoClassEnabled[] = {
 #define CSS_PSEUDO_CLASS(name_, value_, pref_)            \
   true,
 #include "nsCSSPseudoClassList.h"
--- a/layout/style/nsCSSPseudoElements.cpp
+++ b/layout/style/nsCSSPseudoElements.cpp
@@ -16,23 +16,23 @@ using namespace mozilla;
 
 // define storage for all atoms
 #define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
   nsICSSPseudoElement* nsCSSPseudoElements::name_;
 #include "nsCSSPseudoElementList.h"
 #undef CSS_PSEUDO_ELEMENT
 
 #define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
-  NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
+  NS_STATIC_ATOM_BUFFER(name_##_pseudo_element_buffer, value_)
 #include "nsCSSPseudoElementList.h"
 #undef CSS_PSEUDO_ELEMENT
 
 static const nsStaticAtom CSSPseudoElements_info[] = {
 #define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
-  NS_STATIC_ATOM(name_##_buffer, (nsIAtom**)&nsCSSPseudoElements::name_),
+  NS_STATIC_ATOM(name_##_pseudo_element_buffer, (nsIAtom**)&nsCSSPseudoElements::name_),
 #include "nsCSSPseudoElementList.h"
 #undef CSS_PSEUDO_ELEMENT
 };
 
 // Separate from the array above so that we can have an array of
 // nsStaticAtom (to pass to NS_RegisterStaticAtoms and
 // nsAtomListUtils::IsMember), but with corresponding indices (so the
 // i-th element of this array is the flags for the i-th pseudo-element
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -500,24 +500,16 @@ ImportRule::SizeOfIncludingThis(MallocSi
 }
 
 } // namespace css
 } // namespace mozilla
 
 // must be outside the namespace
 DOMCI_DATA(CSSImportRule, css::ImportRule)
 
-static bool
-CloneRuleInto(css::Rule* aRule, void* aArray)
-{
-  nsRefPtr<css::Rule> clone = aRule->Clone();
-  static_cast<nsCOMArray<css::Rule>*>(aArray)->AppendObject(clone);
-  return true;
-}
-
 namespace mozilla {
 namespace css {
 
 GroupRule::GroupRule()
   : Rule()
 {
 }
 
@@ -527,17 +519,17 @@ SetParentRuleReference(Rule* aRule, void
   GroupRule* parentRule = static_cast<GroupRule*>(aParentRule);
   aRule->SetParentRule(parentRule);
   return true;
 }
 
 GroupRule::GroupRule(const GroupRule& aCopy)
   : Rule(aCopy)
 {
-  const_cast<GroupRule&>(aCopy).mRules.EnumerateForwards(CloneRuleInto, &mRules);
+  const_cast<GroupRule&>(aCopy).mRules.EnumerateForwards(GroupRule::CloneRuleInto, &mRules);
   mRules.EnumerateForwards(SetParentRuleReference, this);
 }
 
 GroupRule::~GroupRule()
 {
   NS_ABORT_IF_FALSE(!mSheet, "SetStyleSheet should have been called");
   mRules.EnumerateForwards(SetParentRuleReference, nullptr);
   if (mRuleCollection) {
--- a/layout/style/nsCSSStyleSheet.cpp
+++ b/layout/style/nsCSSStyleSheet.cpp
@@ -744,24 +744,16 @@ nsCSSStyleSheetInner::nsCSSStyleSheetInn
 static bool SetStyleSheetReference(css::Rule* aRule, void* aSheet)
 {
   if (aRule) {
     aRule->SetStyleSheet(static_cast<nsCSSStyleSheet*>(aSheet));
   }
   return true;
 }
 
-static bool
-CloneRuleInto(css::Rule* aRule, void* aArray)
-{
-  nsRefPtr<css::Rule> clone = aRule->Clone();
-  static_cast<nsCOMArray<css::Rule>*>(aArray)->AppendObject(clone);
-  return true;
-}
-
 struct ChildSheetListBuilder {
   nsRefPtr<nsCSSStyleSheet>* sheetSlot;
   nsCSSStyleSheet* parent;
 
   void SetParentLinks(nsCSSStyleSheet* aSheet) {
     aSheet->mParent = parent;
     aSheet->SetOwningDocument(parent->mDocument);
   }
@@ -857,17 +849,17 @@ nsCSSStyleSheetInner::nsCSSStyleSheetInn
     mCORSMode(aCopy.mCORSMode),
     mComplete(aCopy.mComplete)
 #ifdef DEBUG
     , mPrincipalSet(aCopy.mPrincipalSet)
 #endif
 {
   MOZ_COUNT_CTOR(nsCSSStyleSheetInner);
   AddSheet(aPrimarySheet);
-  aCopy.mOrderedRules.EnumerateForwards(CloneRuleInto, &mOrderedRules);
+  aCopy.mOrderedRules.EnumerateForwards(css::GroupRule::CloneRuleInto, &mOrderedRules);
   mOrderedRules.EnumerateForwards(SetStyleSheetReference, aPrimarySheet);
 
   ChildSheetListBuilder builder = { &mFirstChild, aPrimarySheet };
   mOrderedRules.EnumerateForwards(nsCSSStyleSheet::RebuildChildList, &builder);
 
   RebuildNameSpaces();
 }
 
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -18,17 +18,17 @@
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/Likely.h"
 #include "gfxFontConstants.h"
 #include "nsPresContext.h"
 #include "imgRequestProxy.h"
 #include "nsDeviceContext.h"
 
-namespace css = mozilla::css;
+using namespace mozilla;
 
 nsCSSValue::nsCSSValue(int32_t aValue, nsCSSUnit aUnit)
   : mUnit(aUnit)
 {
   NS_ABORT_IF_FALSE(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
                     aUnit == eCSSUnit_EnumColor, "not an int value");
   if (aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
       aUnit == eCSSUnit_EnumColor) {
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -13,18 +13,18 @@
 #include "nsIStyleRuleProcessor.h"
 #include "nsPresContext.h"
 #include "nsRuleWalker.h"
 #include "nsRuleProcessorData.h"
 #include "mozilla/dom/Element.h"
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
-namespace css = mozilla::css;
 
 namespace {
 
 PLDHashOperator
 ClearAttrCache(const nsAString& aKey, MiscContainer*& aValue, void*)
 {
   // Ideally we'd just call MiscContainer::Evict, but we can't do that since
   // we're iterating the hashtable.
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -10,17 +10,17 @@
 #include "nsStyleTransformMatrix.h"
 #include "nsCSSValue.h"
 #include "nsPresContext.h"
 #include "nsRuleNode.h"
 #include "nsCSSKeywords.h"
 #include "nsStyleAnimation.h"
 #include "gfxMatrix.h"
 
-namespace css = mozilla::css;
+using namespace mozilla;
 
 namespace nsStyleTransformMatrix {
 
 /* Note on floating point precision: The transform matrix is an array
  * of single precision 'float's, and so are most of the input values
  * we get from the style system, but intermediate calculations
  * involving angles need to be done in 'double'.
  */