Bug 1963845 - Use Span for EnumTable. r=emilio,smaug

This patch makes the usage of `EnumTable`s safer
by using `Span`s instead of relying on an empty
element at the end.
Also the name has been changed from `EnumTable`
to `EnumTableEntry` to be more precise.

Differential Revision: https://phabricator.services.mozilla.com/D247453
This commit is contained in:
Jan-Niklas Jaeschke
2025-05-06 07:59:38 +00:00
committed by jjaschke@mozilla.com
parent 6db653dc92
commit b3debf824d
28 changed files with 252 additions and 255 deletions

View File

@@ -4947,12 +4947,12 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) {
// Mappings from 'preload' attribute strings to an enumeration.
static const nsAttrValue::EnumTable kPreloadTable[] = {
static const nsAttrValue::EnumTableEntry kPreloadTable[] = {
{"", HTMLMediaElement::PRELOAD_ATTR_EMPTY},
{"none", HTMLMediaElement::PRELOAD_ATTR_NONE},
{"metadata", HTMLMediaElement::PRELOAD_ATTR_METADATA},
{"auto", HTMLMediaElement::PRELOAD_ATTR_AUTO},
{nullptr, 0}};
};
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::crossorigin) {