Bug 1448759 part 3 - Remove kKeywordTableTable and LookupPropertyValue. r?heycam
MozReview-Commit-ID: F2EbL0hSgPX
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -2172,45 +2172,16 @@ nsCSSProps::ValueToKeyword(int32_t aValu
if (keyword == eCSSKeyword_UNKNOWN) {
static nsDependentCString sNullStr("");
return sNullStr;
} else {
return nsCSSKeywords::GetStringValue(keyword);
}
}
-/* static */ const KTableEntry* const
-nsCSSProps::kKeywordTableTable[eCSSProperty_COUNT_no_shorthands] = {
- #define CSS_PROP(name_, id_, method_, pref_, parsevariant_, \
- kwtable_) kwtable_,
- #include "nsCSSPropList.h"
- #undef CSS_PROP
-};
-
-const nsCString&
-nsCSSProps::LookupPropertyValue(nsCSSPropertyID aProp, int32_t aValue)
-{
- MOZ_ASSERT(aProp >= 0 && aProp < eCSSProperty_COUNT,
- "property out of range");
-#ifdef DEBUG
- typedef decltype(KTableEntry::mValue) table_value_type;
- NS_ASSERTION(table_value_type(aValue) == aValue, "Value out of range");
-#endif
-
- const KTableEntry* kwtable = nullptr;
- if (aProp < eCSSProperty_COUNT_no_shorthands)
- kwtable = kKeywordTableTable[aProp];
-
- if (kwtable)
- return ValueToKeyword(aValue, kwtable);
-
- static nsDependentCString sNullStr("");
- return sNullStr;
-}
-
bool nsCSSProps::GetColorName(int32_t aPropValue, nsCString &aStr)
{
bool rv = false;
// first get the keyword corresponding to the property Value from the color table
nsCSSKeyword keyword = ValueToKeywordEnum(aPropValue, kColorKTable);
// next get the name as a string from the keywords table
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -95,21 +95,16 @@ public:
// Same but for @font-face descriptors
static nsCSSFontDesc LookupFontDesc(const nsAString& aProperty);
// Given a property enum, get the string value
static const nsCString& GetStringValue(nsCSSPropertyID aProperty);
static const nsCString& GetStringValue(nsCSSFontDesc aFontDesc);
static const nsCString& GetStringValue(nsCSSCounterDesc aCounterDesc);
- // Given a CSS Property and a Property Enum Value
- // Return back a const nsString& representation of the
- // value. Return back nullstr if no value is found
- static const nsCString& LookupPropertyValue(nsCSSPropertyID aProperty, int32_t aValue);
-
// Get a color name for a predefined color value like buttonhighlight or activeborder
// Sets the aStr param to the name of the propertyID
static bool GetColorName(int32_t aPropID, nsCString &aStr);
// Returns the index of |aKeyword| in |aTable|, if it exists there;
// otherwise, returns -1.
// NOTE: Generally, clients should call FindKeyword() instead of this method.
static int32_t FindIndexOfKeyword(nsCSSKeyword aKeyword,
@@ -139,18 +134,16 @@ public:
typename = typename std::enable_if<std::is_enum<T>::value>::type>
static const nsCString& ValueToKeyword(T aValue, const KTableEntry aTable[])
{
static_assert(mozilla::EnumTypeFitsWithin<T, int16_t>::value,
"aValue must be an enum that fits within KTableEntry::mValue");
return ValueToKeyword(static_cast<int16_t>(aValue), aTable);
}
- static const KTableEntry* const kKeywordTableTable[eCSSProperty_COUNT_no_shorthands];
-
private:
static const Flags kFlagsTable[eCSSProperty_COUNT];
public:
static inline bool PropHasFlags(nsCSSPropertyID aProperty, Flags aFlags)
{
MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT,
"out of range");