Bug 1325771 - layout:style: Make sure nsCSSValue has at least 4 bytes alignment. r?heycam
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -28,16 +28,20 @@
#include "nsRefPtrHashtable.h"
#include "nsString.h"
#include "nsStringBuffer.h"
#include "nsTArray.h"
#include "nsStyleConsts.h"
#include "nsStyleCoord.h"
#include "gfxFontFamilyList.h"
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
+
class imgRequestProxy;
class nsIContent;
class nsIDocument;
class nsIPrincipal;
class nsIURI;
class nsPresContext;
template <class T>
class nsPtrHashKey;
@@ -1017,17 +1021,18 @@ protected:
nsCSSValueList* mListDependent;
nsCSSValueSharedList* MOZ_OWNING_REF mSharedList;
nsCSSValuePairList_heap* MOZ_OWNING_REF mPairList;
nsCSSValuePairList* mPairListDependent;
nsCSSValueFloatColor* MOZ_OWNING_REF mFloatColor;
mozilla::css::FontFamilyListRefCnt* MOZ_OWNING_REF mFontFamilyList;
mozilla::css::ComplexColorValue* MOZ_OWNING_REF mComplexColor;
} mValue;
-};
+
+} __attribute__ ((aligned(4))); /* ensure alignment is at least 4 bytes */
struct nsCSSValue::Array final {
// return |Array| with reference count of zero
static Array* Create(size_t aItemCount) {
return new (aItemCount) Array(aItemCount);
}