本文整理汇总了C++中nsAttrValue::GetEnumValue方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAttrValue::GetEnumValue方法的具体用法?C++ nsAttrValue::GetEnumValue怎么用?C++ nsAttrValue::GetEnumValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAttrValue
的用法示例。
在下文中一共展示了nsAttrValue::GetEnumValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseAttribute
bool
nsHTMLMenuItemElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {
bool success = aResult.ParseEnumValue(aValue, kMenuItemTypeTable,
false);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kMenuItemDefaultType->value;
}
return success;
}
if (aAttribute == nsGkAtoms::radiogroup) {
aResult.ParseAtom(aValue);
return true;
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例2: ParseAttribute
bool
HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {
// XXX ARG!! This is major evilness. ParseAttribute
// shouldn't set members. Override SetAttr instead
bool success = aResult.ParseEnumValue(aValue, kButtonTypeTable, false);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kButtonDefaultType->value;
}
return success;
}
if (aAttribute == nsGkAtoms::formmethod) {
return aResult.ParseEnumValue(aValue, kFormMethodTable, false);
}
if (aAttribute == nsGkAtoms::formenctype) {
return aResult.ParseEnumValue(aValue, kFormEnctypeTable, false);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例3: ParseAttribute
bool
nsHTMLMenuElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
bool success = aResult.ParseEnumValue(aValue, kMenuTypeTable,
false);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kMenuDefaultType->value;
}
return success;
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例4: CheckPreloadAttrs
bool HTMLLinkElement::CheckPreloadAttrs(const nsAttrValue& aAs,
const nsAString& aType,
const nsAString& aMedia,
Document* aDocument) {
nsContentPolicyType policyType = Link::AsValueToContentPolicy(aAs);
if (policyType == nsIContentPolicy::TYPE_INVALID) {
return false;
}
// Check if media attribute is valid.
if (!aMedia.IsEmpty()) {
RefPtr<MediaList> mediaList = MediaList::Create(aMedia);
if (!mediaList->Matches(*aDocument)) {
return false;
}
}
if (aType.IsEmpty()) {
return true;
}
nsString type = nsString(aType);
ToLowerCase(type);
if (policyType == nsIContentPolicy::TYPE_OTHER) {
return true;
} else if (policyType == nsIContentPolicy::TYPE_MEDIA) {
if (aAs.GetEnumValue() == DESTINATION_TRACK) {
if (type.EqualsASCII("text/vtt")) {
return true;
} else {
return false;
}
}
Maybe<MediaContainerType> mimeType = MakeMediaContainerType(aType);
if (!mimeType) {
return false;
}
DecoderDoctorDiagnostics diagnostics;
CanPlayStatus status =
DecoderTraits::CanHandleContainerType(*mimeType, &diagnostics);
// Preload if this return CANPLAY_YES and CANPLAY_MAYBE.
if (status == CANPLAY_NO) {
return false;
} else {
return true;
}
} else if (policyType == nsIContentPolicy::TYPE_FONT) {
if (IsFontMimeType(type)) {
return true;
} else {
return false;
}
} else if (policyType == nsIContentPolicy::TYPE_IMAGE) {
if (imgLoader::SupportImageWithMimeType(
NS_ConvertUTF16toUTF8(type).get(),
AcceptedMimeTypes::IMAGES_AND_DOCUMENTS)) {
return true;
} else {
return false;
}
} else if (policyType == nsIContentPolicy::TYPE_SCRIPT) {
if (nsContentUtils::IsJavascriptMIMEType(type)) {
return true;
} else {
return false;
}
} else if (policyType == nsIContentPolicy::TYPE_STYLESHEET) {
if (type.EqualsASCII("text/css")) {
return true;
} else {
return false;
}
}
return false;
}