Backed out changeset a6fa096f9853 and ec1c41143ff6 (bug 1147766) since I messed up the warning fix.

This commit is contained in:
Cameron McCormack 2015-05-23 15:51:14 +10:00
parent 58e208a670
commit f3b784c38e
3 changed files with 23 additions and 52 deletions

View File

@ -11,7 +11,6 @@
#ifndef nsRuleNode_h___
#define nsRuleNode_h___
#include "mozilla/RangedArray.h"
#include "nsPresContext.h"
#include "nsStyleStruct.h"
@ -25,11 +24,29 @@ 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
{
mozilla::RangedArray<void*,
nsStyleStructID_Inherited_Start,
nsStyleStructID_Inherited_Count> mStyleStructs;
FixedStyleStructArray<nsStyleStructID_Inherited_Start,
nsStyleStructID_Inherited_Count> mStyleStructs;
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->PresShell()->
@ -66,9 +83,8 @@ struct nsInheritedStyleData
struct nsResetStyleData
{
mozilla::RangedArray<void*,
nsStyleStructID_Reset_Start,
nsStyleStructID_Reset_Count> mStyleStructs;
FixedStyleStructArray<nsStyleStructID_Reset_Start,
nsStyleStructID_Reset_Count> mStyleStructs;
nsResetStyleData()
{

View File

@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* A compile-time constant-length array, with bounds-checking assertions -- but
* unlike mozilla::Array, with indexes biased by a constant.
*
* Thus where mozilla::Array<int, 3> is a three-element array indexed by [0, 3),
* mozilla::RangedArray<int, 8, 3> is a three-element array indexed by [8, 11).
*/
#ifndef mozilla_RangedArray_h
#define mozilla_RangedArray_h
#include "mozilla/Array.h"
namespace mozilla {
template<typename T, size_t MinIndex, size_t Length>
class RangedArray
{
public:
T& operator[](size_t aIndex)
{
MOZ_ASSERT(MinIndex == 0 || aIndex > MinIndex);
return mArr[aIndex - MinIndex];
}
const T& operator[](size_t aIndex) const
{
MOZ_ASSERT(MinIndex == 0 || aIndex > MinIndex);
return mArr[aIndex - MinIndex];
}
private:
Array<T, Length> mArr;
};
} // namespace mozilla
#endif // mozilla_RangedArray_h

View File

@ -59,7 +59,6 @@ EXPORTS.mozilla = [
'PodOperations.h',
'Poison.h',
'Range.h',
'RangedArray.h',
'RangedPtr.h',
'RefCountType.h',
'ReentrancyGuard.h',