Bug 1325771 - layout:style: Make sure nsCSSValue has at least 4 bytes alignment. r?heycam draft
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Thu, 22 Dec 2016 22:25:33 +0100
changeset 458872 e2fa1647bd3a602661a908c386c9178ba696d923
parent 458871 6bbe86126168479a54c4c50fc6801a6c93d4277e
child 458873 85ba7f2cf2b5890681c5cf14c010a6b023e8c2c4
push id41085
push userbmo:mh+mozilla@glandium.org
push dateWed, 11 Jan 2017 07:28:36 +0000
reviewersheycam
bugs1325771
milestone53.0a1
Bug 1325771 - layout:style: Make sure nsCSSValue has at least 4 bytes alignment. r?heycam
layout/style/nsCSSValue.h
--- 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);
   }