本文整理汇总了C++中GetParsedAttr函数的典型用法代码示例。如果您正苦于以下问题:C++ GetParsedAttr函数的具体用法?C++ GetParsedAttr怎么用?C++ GetParsedAttr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetParsedAttr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParsedAttr
uint32_t
HTMLIFrameElement::GetSandboxFlags()
{
const nsAttrValue* sandboxAttr = GetParsedAttr(nsGkAtoms::sandbox);
// No sandbox attribute, no sandbox flags.
if (!sandboxAttr) {
return 0;
}
// Start off by setting all the restriction flags.
uint32_t out = SANDBOX_ALL_FLAGS;
// Macro for updating the flag according to the keywords
#define SANDBOX_KEYWORD(string, atom, flags) \
if (sandboxAttr->Contains(nsGkAtoms::atom, eIgnoreCase)) { out &= ~(flags); }
#include "IframeSandboxKeywordList.h"
#undef SANDBOX_KEYWORD
if (GetParsedAttr(nsGkAtoms::allowfullscreen) ||
GetParsedAttr(nsGkAtoms::mozallowfullscreen)) {
out &= ~SANDBOXED_FULLSCREEN;
}
return out;
}
示例2: NS_PRECONDITION
nsresult
HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
*aNumValues = 0;
*aSpecs = nullptr;
if (!mRowSpecs) {
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::rows);
if (value && value->Type() == nsAttrValue::eString) {
nsresult rv = ParseRowCol(value->GetStringValue(), mNumRows,
getter_Transfers(mRowSpecs));
NS_ENSURE_SUCCESS(rv, rv);
}
if (!mRowSpecs) { // we may not have had an attr or had an empty attr
mRowSpecs = new nsFramesetSpec[1];
if (!mRowSpecs) {
mNumRows = 0;
return NS_ERROR_OUT_OF_MEMORY;
}
mNumRows = 1;
mRowSpecs[0].mUnit = eFramesetUnit_Relative;
mRowSpecs[0].mValue = 1;
}
}
*aSpecs = mRowSpecs;
*aNumValues = mNumRows;
return NS_OK;
}
示例3: NS_PRECONDITION
nsresult
HTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
*aNumValues = 0;
*aSpecs = nullptr;
if (!mColSpecs) {
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::cols);
if (value && value->Type() == nsAttrValue::eString) {
nsresult rv = ParseRowCol(value->GetStringValue(), mNumCols,
&mColSpecs);
NS_ENSURE_SUCCESS(rv, rv);
}
if (!mColSpecs) { // we may not have had an attr or had an empty attr
mColSpecs = MakeUnique<nsFramesetSpec[]>(1);
mNumCols = 1;
mColSpecs[0].mUnit = eFramesetUnit_Relative;
mColSpecs[0].mValue = 1;
}
}
*aSpecs = mColSpecs.get();
*aNumValues = mNumCols;
return NS_OK;
}
示例4: Nothing
Maybe<nsStyleLinkElement::SheetInfo> SVGStyleElement::GetStyleSheetInfo() {
if (!IsCSSMimeTypeAttribute(*this)) {
return Nothing();
}
nsAutoString title;
nsAutoString media;
GetTitleAndMediaForElement(*this, title, media);
return Some(SheetInfo{
*OwnerDoc(),
this,
nullptr,
// FIXME(bug 1459822): Why doesn't this need a principal, but
// HTMLStyleElement does?
nullptr,
net::ReferrerPolicy::RP_Unset,
// FIXME(bug 1459822): Why does this need a crossorigin attribute, but
// HTMLStyleElement doesn't?
AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)),
title,
media,
HasAlternateRel::No,
IsInline::Yes,
});
}
示例5: GetSrclang
void
HTMLTrackElement::CreateTextTrack()
{
nsString label, srcLang;
GetSrclang(srcLang);
GetLabel(label);
TextTrackKind kind;
if (const nsAttrValue* value = GetParsedAttr(nsGkAtoms::kind)) {
kind = static_cast<TextTrackKind>(value->GetEnumValue());
} else {
kind = TextTrackKind::Subtitles;
}
bool hasHadScriptObject = true;
nsIScriptGlobalObject* scriptObject =
OwnerDoc()->GetScriptHandlingObject(hasHadScriptObject);
NS_ENSURE_TRUE_VOID(scriptObject || !hasHadScriptObject);
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(scriptObject);
mTrack = new TextTrack(window, kind, label, srcLang,
TextTrackMode::Disabled,
TextTrackReadyState::NotLoaded,
TextTrackSource::Track);
mTrack->SetTrackElement(this);
if (mMediaParent) {
mMediaParent->AddTextTrack(mTrack);
}
}
示例6: GetParsedAttr
HTMLTextAreaElement::GetRows() {
const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::rows);
if (attr && attr->Type() == nsAttrValue::eInteger) {
int32_t rows = attr->GetIntegerValue();
return (rows <= 0) ? DEFAULT_ROWS_TEXTAREA : rows;
}
return DEFAULT_ROWS_TEXTAREA;
}
示例7: GetParsedAttr
TextTrackKind
HTMLTrackElement::Kind() const
{
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::kind);
if (!value) {
return TextTrackKind::Subtitles;
}
return static_cast<TextTrackKind>(value->GetEnumValue());
}
示例8: GetParsedAttr
uint32_t
HTMLIFrameElement::GetSandboxFlags()
{
const nsAttrValue* sandboxAttr = GetParsedAttr(nsGkAtoms::sandbox);
// No sandbox attribute, no sandbox flags.
if (!sandboxAttr) {
return SANDBOXED_NONE;
}
return nsContentUtils::ParseSandboxAttributeToFlags(sandboxAttr);
}
示例9: GetParsedAttr
HTMLTextAreaElement::GetCols()
{
const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::cols);
if (attr) {
int32_t cols = attr->Type() == nsAttrValue::eInteger ?
attr->GetIntegerValue() : 0;
// XXX why a default of 1 char, why hide it
return (cols <= 0) ? 1 : cols;
}
return DEFAULT_COLS;
}
示例10: GetParsedAttr
NS_IMETHODIMP
nsDOMTokenList::Item(PRUint32 aIndex, nsAString& aResult)
{
const nsAttrValue* attr = GetParsedAttr();
if (!attr || aIndex >= static_cast<PRUint32>(attr->GetAtomCount())) {
SetDOMStringToNull(aResult);
return NS_OK;
}
attr->AtomAt(aIndex)->ToString(aResult);
return NS_OK;
}
示例11: CheckToken
NS_IMETHODIMP
nsDOMTokenList::Add(const nsAString& aToken)
{
nsresult rv = CheckToken(aToken);
NS_ENSURE_SUCCESS(rv, rv);
const nsAttrValue* attr = GetParsedAttr();
if (attr && attr->Contains(aToken)) {
return NS_OK;
}
AddInternal(attr, aToken);
return NS_OK;
}
示例12: GetSrclang
void
HTMLTrackElement::CreateTextTrack()
{
nsString label, srcLang;
GetSrclang(srcLang);
GetLabel(label);
TextTrackKind kind;
if (const nsAttrValue* value = GetParsedAttr(nsGkAtoms::kind)) {
kind = static_cast<TextTrackKind>(value->GetEnumValue());
} else {
kind = TextTrackKind::Subtitles;
}
mTrack = new TextTrack(OwnerDoc()->GetParentObject(), kind, label, srcLang);
if (mMediaParent) {
mMediaParent->AddTextTrack(mTrack);
}
}
示例13: GetParsedAttr
uint32_t
SVGIFrameElement::GetSandboxFlags()
{
const nsAttrValue* sandboxAttr = GetParsedAttr(nsGkAtoms::sandbox);
return nsContentUtils::ParseSandboxAttributeToFlags(sandboxAttr);
}
示例14: AttrValueToCORSMode
CORSMode
SVGStyleElement::GetCORSMode() const
{
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
}
示例15: AttrValueToCORSMode
CORSMode
HTMLImageElement::GetCORSMode()
{
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
}