当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLImageElement::alt方法代码示例

本文整理汇总了C++中HTMLImageElement::alt方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLImageElement::alt方法的具体用法?C++ HTMLImageElement::alt怎么用?C++ HTMLImageElement::alt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLImageElement的用法示例。


在下文中一共展示了HTMLImageElement::alt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: altDisplayString

String HitTestResult::altDisplayString() const
{
    if (!m_innerNonSharedNode)
        return String();
    
    if (m_innerNonSharedNode->hasTagName(imgTag)) {
        HTMLImageElement* image = static_cast<HTMLImageElement*>(m_innerNonSharedNode.get());
        return displayString(image->alt(), m_innerNonSharedNode.get());
    }
    
    if (m_innerNonSharedNode->hasTagName(inputTag)) {
        HTMLInputElement* input = static_cast<HTMLInputElement*>(m_innerNonSharedNode.get());
        return displayString(input->alt(), m_innerNonSharedNode.get());
    }

#if ENABLE(WML)
    if (m_innerNonSharedNode->hasTagName(WMLNames::imgTag)) {
        WMLImageElement* image = static_cast<WMLImageElement*>(m_innerNonSharedNode.get());
        return displayString(image->altText(), m_innerNonSharedNode.get());
    }
#endif

    return String();
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:24,代码来源:HitTestResult.cpp

示例2: getValueProperty

JSValue* JSHTMLImageElement::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case NameAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->name());
    }
    case AlignAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->align());
    }
    case AltAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->alt());
    }
    case BorderAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->border());
    }
    case HeightAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->height());
    }
    case HspaceAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->hspace());
    }
    case IsMapAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsBoolean(imp->isMap());
    }
    case LongDescAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->longDesc());
    }
    case SrcAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->src());
    }
    case UseMapAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->useMap());
    }
    case VspaceAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->vspace());
    }
    case WidthAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->width());
    }
    case CompleteAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsBoolean(imp->complete());
    }
    case LowsrcAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsString(exec, imp->lowsrc());
    }
    case NaturalHeightAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->naturalHeight());
    }
    case NaturalWidthAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->naturalWidth());
    }
    case XAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->x());
    }
    case YAttrNum: {
        HTMLImageElement* imp = static_cast<HTMLImageElement*>(impl());
        return jsNumber(exec, imp->y());
    }
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:80,代码来源:JSHTMLImageElement.cpp


注:本文中的HTMLImageElement::alt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。