Index: Source/core/css/RuntimeCSSEnabled.cpp |
diff --git a/Source/core/css/RuntimeCSSEnabled.cpp b/Source/core/css/RuntimeCSSEnabled.cpp |
index 4fc13b0f4b207a90177a6ee6771fdb4c31f8f832..f7bb8f0ca18a5f33ff188f21f202fc45bd8f6801 100644 |
--- a/Source/core/css/RuntimeCSSEnabled.cpp |
+++ b/Source/core/css/RuntimeCSSEnabled.cpp |
@@ -31,11 +31,11 @@ |
#include "core/css/RuntimeCSSEnabled.h" |
#include "RuntimeEnabledFeatures.h" |
+#include "wtf/BitArray.h" |
namespace WebCore { |
-// FIXME: We should use a real BitVector class instead! |
-typedef Vector<bool> BoolVector; |
+typedef BitArray<numCSSProperties> CSSPropertySwitches; |
static void setCSSPropertiesEnabled(CSSPropertyID* properties, size_t length, bool featureFlag) |
{ |
@@ -130,12 +130,11 @@ static void setPropertySwitchesFromRuntimeFeatures() |
RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyInternalCallback, false); |
} |
-static BoolVector& propertySwitches() |
+static CSSPropertySwitches& propertySwitches() |
{ |
- static BoolVector* switches = 0; |
+ static CSSPropertySwitches* switches = 0; |
if (!switches) { |
- switches = new BoolVector; |
- switches->fill(true, numCSSProperties); |
+ switches = new CSSPropertySwitches(true); // All bits sets to 1. |
setPropertySwitchesFromRuntimeFeatures(); |
} |
return *switches; |
@@ -144,7 +143,7 @@ static BoolVector& propertySwitches() |
size_t indexForProperty(CSSPropertyID propertyId) |
{ |
RELEASE_ASSERT(propertyId >= firstCSSProperty && propertyId <= lastCSSProperty); |
- // Values all start at 0. Vector RELEASE_ASSERTS will catch if we're ever wrong. |
+ // Values all start at 0. BitArray ASSERTS will catch if we're ever wrong. |
return static_cast<size_t>(propertyId - firstCSSProperty); |
} |
@@ -155,12 +154,16 @@ bool RuntimeCSSEnabled::isCSSPropertyEnabled(CSSPropertyID propertyId) |
if (isInternalProperty(propertyId)) |
return false; |
- return propertySwitches()[indexForProperty(propertyId)]; |
+ return propertySwitches().get(indexForProperty(propertyId)); |
} |
void RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyID propertyId, bool enable) |
{ |
- propertySwitches()[indexForProperty(propertyId)] = enable; |
+ size_t propertyIndex = indexForProperty(propertyId); |
+ if (enable) |
+ propertySwitches().set(propertyIndex); |
+ else |
+ propertySwitches().clear(propertyIndex); |
} |
void RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(const CSSPropertyID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector) |