本文整理汇总了C++中HTMLSourceElement::src方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLSourceElement::src方法的具体用法?C++ HTMLSourceElement::src怎么用?C++ HTMLSourceElement::src使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLSourceElement
的用法示例。
在下文中一共展示了HTMLSourceElement::src方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getValueProperty
JSValue* JSHTMLSourceElement::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case SrcAttrNum: {
HTMLSourceElement* imp = static_cast<HTMLSourceElement*>(impl());
return jsString(exec, imp->src());
}
case TypeAttrNum: {
HTMLSourceElement* imp = static_cast<HTMLSourceElement*>(impl());
return jsString(exec, imp->type());
}
case MediaAttrNum: {
HTMLSourceElement* imp = static_cast<HTMLSourceElement*>(impl());
return jsString(exec, imp->media());
}
case ConstructorAttrNum:
return getConstructor(exec);
}
return 0;
}
示例2: pickMedia
String HTMLMediaElement::pickMedia()
{
// 3.14.9.2. Location of the media resource
String mediaSrc = getAttribute(srcAttr);
if (mediaSrc.isEmpty()) {
for (Node* n = firstChild(); n; n = n->nextSibling()) {
if (n->hasTagName(sourceTag)) {
HTMLSourceElement* source = static_cast<HTMLSourceElement*>(n);
if (!source->hasAttribute(srcAttr))
continue;
if (source->hasAttribute(mediaAttr)) {
MediaQueryEvaluator screenEval("screen", document()->frame(), renderer() ? renderer()->style() : 0);
RefPtr<MediaList> media = MediaList::createAllowingDescriptionSyntax(source->media());
if (!screenEval.eval(media.get()))
continue;
}
if (source->hasAttribute(typeAttr)) {
String type = source->type().stripWhiteSpace();
// "type" can have parameters after a semi-colon, strip them before checking with the type registry
int semi = type.find(';');
if (semi != -1)
type = type.left(semi).stripWhiteSpace();
if (!MIMETypeRegistry::isSupportedMediaMIMEType(type))
continue;
}
mediaSrc = source->src().string();
break;
}
}
}
if (!mediaSrc.isEmpty())
mediaSrc = document()->completeURL(mediaSrc).string();
return mediaSrc;
}