зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1147766 - Part 2: Replace FixedStyleStructArray with mozilla::RangedArray. r=dbaron
This commit is contained in:
Родитель
8f0b97017a
Коммит
ff106a4844
|
@ -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 <nsStyleStructID MinIndex, nsStyleStructID Count>
|
||||
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<nsStyleStructID_Inherited_Start,
|
||||
nsStyleStructID_Inherited_Count> mStyleStructs;
|
||||
mozilla::RangedArray<void*,
|
||||
nsStyleStructID_Inherited_Start,
|
||||
nsStyleStructID_Inherited_Count> mStyleStructs;
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->PresShell()->
|
||||
|
@ -83,8 +66,9 @@ struct nsInheritedStyleData
|
|||
|
||||
struct nsResetStyleData
|
||||
{
|
||||
FixedStyleStructArray<nsStyleStructID_Reset_Start,
|
||||
nsStyleStructID_Reset_Count> mStyleStructs;
|
||||
mozilla::RangedArray<void*,
|
||||
nsStyleStructID_Reset_Start,
|
||||
nsStyleStructID_Reset_Count> mStyleStructs;
|
||||
|
||||
nsResetStyleData()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче