Bug 1269712 - <track kind=invalid> should behave like metadata, not subtitles; r=bz
This follows a spec change <https://github.com/whatwg/html/issues/293>, which AFAIK no other browser has implemented, so it has some regression potential. The web-platform tests changed are out-of-date and match the old spec, so I'm changing them here to match the new spec.
This commit is contained in:
@@ -69,8 +69,9 @@ static MOZ_CONSTEXPR nsAttrValue::EnumTable kKindTable[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
// The default value for kKindTable is "subtitles"
|
||||
static MOZ_CONSTEXPR const char* kKindTableDefaultString = kKindTable[0].tag;
|
||||
// Invalid values are treated as "metadata" in ParseAttribute, but if no value
|
||||
// at all is specified, it's treated as "subtitles" in GetKind
|
||||
static MOZ_CONSTEXPR const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4];
|
||||
|
||||
/** HTMLTrackElement */
|
||||
HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
@@ -96,7 +97,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
|
||||
void
|
||||
HTMLTrackElement::GetKind(DOMString& aKind) const
|
||||
{
|
||||
GetEnumAttr(nsGkAtoms::kind, kKindTableDefaultString, aKind);
|
||||
GetEnumAttr(nsGkAtoms::kind, kKindTable[0].tag, aKind);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -170,7 +171,8 @@ HTMLTrackElement::ParseAttribute(int32_t aNamespaceID,
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::kind) {
|
||||
// Case-insensitive lookup, with the first element as the default.
|
||||
return aResult.ParseEnumValue(aValue, kKindTable, false, kKindTable);
|
||||
return aResult.ParseEnumValue(aValue, kKindTable, false,
|
||||
kKindTableInvalidValueDefault);
|
||||
}
|
||||
|
||||
// Otherwise call the generic implementation.
|
||||
|
||||
Reference in New Issue
Block a user