本文整理汇总了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;
}
示例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);
}
示例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));
}
示例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());
}
示例5: jsHTMLDocumentConstructor
JSValue jsHTMLDocumentConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLDocument* domObject = static_cast<JSHTMLDocument*>(asObject(slotBase));
return JSHTMLDocument::getConstructor(exec, domObject->globalObject());
}