Bug 1617472 - Remove kTextDecorationStyleKTable. r=heycam

In a somewhat easy way. There are better ways to do this (moving
text-decoration-style to be a proper cbindgen enum class or such), but this
does the job for now.

Depends on D63794

Differential Revision: https://phabricator.services.mozilla.com/D63795

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-02-24 13:30:46 +00:00
parent 1ff4460ea3
commit 8d0f4ce3ca
3 changed files with 19 additions and 16 deletions

View File

@ -71,7 +71,23 @@ void StyleInfo::FormatColor(const nscolor& aValue, nsString& aFormattedValue) {
void StyleInfo::FormatTextDecorationStyle(uint8_t aValue,
nsAString& aFormattedValue) {
nsCSSKeyword keyword = nsCSSProps::ValueToKeywordEnum(
aValue, nsCSSProps::kTextDecorationStyleKTable);
AppendUTF8toUTF16(nsCSSKeywords::GetStringValue(keyword), aFormattedValue);
// TODO: When these are enum classes that rust also understands we should just
// make an FFI call here.
switch (aValue) {
case NS_STYLE_TEXT_DECORATION_STYLE_NONE:
return aFormattedValue.AssignASCII("-moz-none");
case NS_STYLE_TEXT_DECORATION_STYLE_SOLID:
return aFormattedValue.AssignASCII("solid");
case NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE:
return aFormattedValue.AssignASCII("double");
case NS_STYLE_TEXT_DECORATION_STYLE_DOTTED:
return aFormattedValue.AssignASCII("dotted");
case NS_STYLE_TEXT_DECORATION_STYLE_DASHED:
return aFormattedValue.AssignASCII("dashed");
case NS_STYLE_TEXT_DECORATION_STYLE_WAVY:
return aFormattedValue.AssignASCII("wavy");
default:
MOZ_ASSERT_UNREACHABLE("Unknown decoration style");
break;
}
}

View File

@ -166,16 +166,6 @@ const nsCString& nsCSSProps::GetStringValue(nsCSSCounterDesc aCounterDesc) {
/***************************************************************************/
const KTableEntry nsCSSProps::kTextDecorationStyleKTable[] = {
{eCSSKeyword__moz_none, NS_STYLE_TEXT_DECORATION_STYLE_NONE},
{eCSSKeyword_solid, NS_STYLE_TEXT_DECORATION_STYLE_SOLID},
{eCSSKeyword_double, NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE},
{eCSSKeyword_dotted, NS_STYLE_TEXT_DECORATION_STYLE_DOTTED},
{eCSSKeyword_dashed, NS_STYLE_TEXT_DECORATION_STYLE_DASHED},
{eCSSKeyword_wavy, NS_STYLE_TEXT_DECORATION_STYLE_WAVY},
{eCSSKeyword_UNKNOWN, nsCSSKTableEntry::SENTINEL_VALUE},
};
int32_t nsCSSProps::FindIndexOfKeyword(nsCSSKeyword aKeyword,
const KTableEntry aTable[]) {
if (eCSSKeyword_UNKNOWN == aKeyword) {

View File

@ -276,9 +276,6 @@ class nsCSSProps {
es_ = (nsCSSPropertyID)((enabledstate_) | CSSEnabledState(0)); \
*it_ != eCSSProperty_UNKNOWN; ++it_) \
if (nsCSSProps::IsEnabled(*it_, (mozilla::CSSEnabledState)es_))
// Keyword/Enum value tables
static const KTableEntry kTextDecorationStyleKTable[];
};
// MOZ_DBG support for nsCSSPropertyID