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


C++ JSHTMLDocument::globalObject方法代码示例

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


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

示例1: jsHTMLDocumentActiveElement

JSValue jsHTMLDocumentActiveElement(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSHTMLDocument* castedThis = static_cast<JSHTMLDocument*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    HTMLDocument* imp = static_cast<HTMLDocument*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->activeElement()));
    return result;
}
开发者ID:dmitris,项目名称:tpjs,代码行数:8,代码来源:JSHTMLDocument.cpp

示例2: nameGetter

JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
    JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(asObject(slotBase));
    HTMLDocument* document = toHTMLDocument(thisObj->impl());

    AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
    if (!atomicPropertyName || !document->documentNamedItemMap().contains(atomicPropertyName))
        return jsUndefined();

    if (UNLIKELY(!document->documentNamedItemMap().containsSingle(atomicPropertyName))) {
        RefPtr<HTMLCollection> collection = document->documentNamedItems(atomicPropertyName);
        ASSERT(!collection->isEmpty());
        ASSERT(!collection->hasExactlyOneItem());
        return toJS(exec, thisObj->globalObject(), WTF::getPtr(collection));
    }

    Node* node = document->documentNamedItemMap().getElementByDocumentNamedItem(atomicPropertyName, document);
    Frame* frame;
    if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
        return toJS(exec, frame);

    return toJS(exec, thisObj->globalObject(), node);
}
开发者ID:Zangalot,项目名称:phantomjs-webkit,代码行数:23,代码来源:JSHTMLDocumentCustom.cpp

示例3: nameGetter

EncodedJSValue JSHTMLDocument::nameGetter(ExecState* exec, JSObject* slotBase, EncodedJSValue, PropertyName propertyName)
{
    JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(slotBase);
    HTMLDocument& document = thisObj->impl();

    AtomicStringImpl* atomicPropertyName = propertyName.publicName();
    if (!atomicPropertyName || !document.hasDocumentNamedItem(*atomicPropertyName))
        return JSValue::encode(jsUndefined());

    if (UNLIKELY(document.documentNamedItemContainsMultipleElements(*atomicPropertyName))) {
        RefPtr<HTMLCollection> collection = document.documentNamedItems(atomicPropertyName);
        ASSERT(collection->length() > 1);
        return JSValue::encode(toJS(exec, thisObj->globalObject(), WTF::getPtr(collection)));
    }

    Element* element = document.documentNamedItem(*atomicPropertyName);
    if (UNLIKELY(is<HTMLIFrameElement>(*element))) {
        if (Frame* frame = downcast<HTMLIFrameElement>(*element).contentFrame())
            return JSValue::encode(toJS(exec, frame));
    }

    return JSValue::encode(toJS(exec, thisObj->globalObject(), element));
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:23,代码来源:JSHTMLDocumentCustom.cpp

示例4: nameGetter

JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
    JSHTMLDocument* thisObj = static_cast<JSHTMLDocument*>(asObject(slotBase));
    HTMLDocument* document = static_cast<HTMLDocument*>(thisObj->impl());

    String name = identifierToString(propertyName);
    RefPtr<HTMLCollection> collection = document->documentNamedItems(name);

    unsigned length = collection->length();
    if (!length)
        return jsUndefined();

    if (length == 1) {
        Node* node = collection->firstItem();

        Frame* frame;
        if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
            return toJS(exec, frame);

        return toJS(exec, thisObj->globalObject(), node);
    } 

    return toJS(exec, thisObj->globalObject(), collection.get());
}
开发者ID:dpnishant,项目名称:tpjs,代码行数:24,代码来源:JSHTMLDocumentCustom.cpp

示例5: jsHTMLDocumentConstructor

JSValue jsHTMLDocumentConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSHTMLDocument* domObject = static_cast<JSHTMLDocument*>(asObject(slotBase));
    return JSHTMLDocument::getConstructor(exec, domObject->globalObject());
}
开发者ID:dmitris,项目名称:tpjs,代码行数:5,代码来源:JSHTMLDocument.cpp


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