From ff106a4844b931503b6430127557d27e3f400926 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Sat, 23 May 2015 12:50:44 +1000 Subject: [PATCH] Bug 1147766 - Part 2: Replace FixedStyleStructArray with mozilla::RangedArray. r=dbaron --- layout/style/nsRuleNode.h | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index 21bd9ca51a0a..1ec47bd347d8 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -11,6 +11,7 @@ #ifndef nsRuleNode_h___ #define nsRuleNode_h___ +#include "mozilla/RangedArray.h" #include "nsPresContext.h" #include "nsStyleStruct.h" @@ -24,29 +25,11 @@ class nsCSSValue; class nsStyleCoord; struct nsCSSValuePairList; -template -class FixedStyleStructArray -{ -private: - void* mArray[Count]; -public: - void*& operator[](nsStyleStructID aIndex) { - MOZ_ASSERT(MinIndex <= aIndex && aIndex < (MinIndex + Count), - "out of range"); - return mArray[aIndex - MinIndex]; - } - - const void* operator[](nsStyleStructID aIndex) const { - MOZ_ASSERT(MinIndex <= aIndex && aIndex < (MinIndex + Count), - "out of range"); - return mArray[aIndex - MinIndex]; - } -}; - struct nsInheritedStyleData { - FixedStyleStructArray mStyleStructs; + mozilla::RangedArray mStyleStructs; void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW { return aContext->PresShell()-> @@ -83,8 +66,9 @@ struct nsInheritedStyleData struct nsResetStyleData { - FixedStyleStructArray mStyleStructs; + mozilla::RangedArray mStyleStructs; nsResetStyleData() {