Bug 1449039 part 11 - Remove some unused functions in nsCSSProps. r?emilio
MozReview-Commit-ID: 6ielCRb3p1U
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -295,73 +295,23 @@ nsCSSProps::ReleaseTable(void)
gCounterDescTable = nullptr;
delete gPropertyIDLNameTable;
gPropertyIDLNameTable = nullptr;
}
}
/* static */ bool
-nsCSSProps::IsInherited(nsCSSPropertyID aProperty)
-{
- MOZ_ASSERT(!IsShorthand(aProperty));
-
- nsStyleStructID sid = kSIDTable[aProperty];
- return ComputedStyle::IsInherited(sid);
-}
-
-/* static */ bool
-nsCSSProps::IsCustomPropertyName(const nsACString& aProperty)
-{
- // Custom properties don't need to have a character after the "--" prefix.
- return aProperty.Length() >= CSS_CUSTOM_NAME_PREFIX_LENGTH &&
- StringBeginsWith(aProperty, NS_LITERAL_CSTRING("--"));
-}
-
-/* static */ bool
nsCSSProps::IsCustomPropertyName(const nsAString& aProperty)
{
return aProperty.Length() >= CSS_CUSTOM_NAME_PREFIX_LENGTH &&
StringBeginsWith(aProperty, NS_LITERAL_STRING("--"));
}
nsCSSPropertyID
-nsCSSProps::LookupProperty(const nsACString& aProperty,
- EnabledState aEnabled)
-{
- MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
-
- if (IsCustomPropertyName(aProperty)) {
- return eCSSPropertyExtra_variable;
- }
-
- nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty));
- if (MOZ_LIKELY(res < eCSSProperty_COUNT)) {
- if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
- res = eCSSProperty_UNKNOWN;
- }
- return res;
- }
- MOZ_ASSERT(eCSSAliasCount != 0,
- "'res' must be an alias at this point so we better have some!");
- // We intentionally don't support CSSEnabledState::eInUASheets or
- // CSSEnabledState::eInChrome for aliases yet because it's unlikely
- // there will be a need for it.
- if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
- res = gAliases[res - eCSSProperty_COUNT];
- MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
- "aliases must not point to other aliases");
- if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
- return res;
- }
- }
- return eCSSProperty_UNKNOWN;
-}
-
-nsCSSPropertyID
nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
{
if (IsCustomPropertyName(aProperty)) {
return eCSSPropertyExtra_variable;
}
// This is faster than converting and calling
// LookupProperty(nsACString&). The table will do its own
@@ -410,53 +360,27 @@ nsCSSProps::LookupPropertyByIDLName(cons
EnabledState aEnabled)
{
MOZ_ASSERT(gPropertyIDLNameTable, "no lookup table, needs addref");
return LookupPropertyByIDLName(NS_ConvertUTF16toUTF8(aPropertyIDLName),
aEnabled);
}
nsCSSFontDesc
-nsCSSProps::LookupFontDesc(const nsACString& aFontDesc)
-{
- MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref");
- nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
-
- if (which == eCSSFontDesc_Display && !StylePrefs::sFontDisplayEnabled) {
- which = eCSSFontDesc_UNKNOWN;
- }
- return which;
-}
-
-nsCSSFontDesc
nsCSSProps::LookupFontDesc(const nsAString& aFontDesc)
{
MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref");
nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
if (which == eCSSFontDesc_Display && !StylePrefs::sFontDisplayEnabled) {
which = eCSSFontDesc_UNKNOWN;
}
return which;
}
-nsCSSCounterDesc
-nsCSSProps::LookupCounterDesc(const nsAString& aProperty)
-{
- MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref");
- return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty));
-}
-
-nsCSSCounterDesc
-nsCSSProps::LookupCounterDesc(const nsACString& aProperty)
-{
- MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref");
- return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty));
-}
-
const nsCString&
nsCSSProps::GetStringValue(nsCSSPropertyID aProperty)
{
MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) {
return gPropertyTable->GetStringValue(int32_t(aProperty));
} else {
static nsDependentCString sNullStr("");
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -263,48 +263,37 @@ public:
static void AddRefTable(void);
static void ReleaseTable(void);
// Looks up the property with name aProperty and returns its corresponding
// nsCSSPropertyID value. If aProperty is the name of a custom property,
// then eCSSPropertyExtra_variable will be returned.
static nsCSSPropertyID LookupProperty(const nsAString& aProperty,
EnabledState aEnabled);
- static nsCSSPropertyID LookupProperty(const nsACString& aProperty,
- EnabledState aEnabled);
// As above, but looked up using a property's IDL name.
// eCSSPropertyExtra_variable won't be returned from these methods.
static nsCSSPropertyID LookupPropertyByIDLName(
const nsAString& aPropertyIDLName,
EnabledState aEnabled);
static nsCSSPropertyID LookupPropertyByIDLName(
const nsACString& aPropertyIDLName,
EnabledState aEnabled);
// Returns whether aProperty is a custom property name, i.e. begins with
// "--". This assumes that the CSS Variables pref has been enabled.
static bool IsCustomPropertyName(const nsAString& aProperty);
- static bool IsCustomPropertyName(const nsACString& aProperty);
static inline bool IsShorthand(nsCSSPropertyID aProperty) {
MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT,
"out of range");
return (aProperty >= eCSSProperty_COUNT_no_shorthands);
}
- // Must be given a longhand property.
- static bool IsInherited(nsCSSPropertyID aProperty);
-
// Same but for @font-face descriptors
static nsCSSFontDesc LookupFontDesc(const nsAString& aProperty);
- static nsCSSFontDesc LookupFontDesc(const nsACString& aProperty);
-
- // For @counter-style descriptors
- static nsCSSCounterDesc LookupCounterDesc(const nsAString& aProperty);
- static nsCSSCounterDesc LookupCounterDesc(const nsACString& 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