本文整理汇总了C++中JSNodeList类的典型用法代码示例。如果您正苦于以下问题:C++ JSNodeList类的具体用法?C++ JSNodeList怎么用?C++ JSNodeList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSNodeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finalize
void JSNodeListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.get().asCell());
DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsNodeList->impl(), jsNodeList);
jsNodeList->releaseImpl();
}
示例2: getOwnPropertyNames
void JSNodeList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSNodeList* thisObject = jsCast<JSNodeList*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
for (unsigned i = 0, count = thisObject->impl().length(); i < count; ++i)
propertyNames.add(Identifier::from(exec, i));
Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
示例3: isReachableFromOpaqueRoots
bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.get().asCell());
if (!jsNodeList->hasCustomProperties())
return false;
if (!jsNodeList->impl()->isDynamicNodeList())
return false;
return visitor.containsOpaqueRoot(root(static_cast<DynamicNodeList*>(jsNodeList->impl())->node()));
}
示例4: jsNodeListConstructor
EncodedJSValue jsNodeListConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
JSNodeList* domObject = jsDynamicCast<JSNodeList*>(JSValue::decode(thisValue));
if (!domObject)
return throwVMTypeError(exec);
if (!domObject)
return throwVMTypeError(exec);
return JSValue::encode(JSNodeList::getConstructor(exec->vm(), domObject->globalObject()));
}
示例5: jsNodeListLength
EncodedJSValue jsNodeListLength(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
JSNodeList* castedThis = jsDynamicCast<JSNodeList*>(JSValue::decode(thisValue));
UNUSED_PARAM(slotBase);
if (!castedThis)
return throwVMTypeError(exec);
UNUSED_PARAM(exec);
NodeList& impl = castedThis->impl();
JSValue result = jsNumber(impl.length());
return JSValue::encode(result);
}
示例6: getOwnPropertySlotByIndex
bool JSNodeList::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)
{
JSNodeList* thisObject = jsCast<JSNodeList*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
if (index < thisObject->impl().length()) {
unsigned attributes = DontDelete | ReadOnly;
slot.setCustomIndex(thisObject, attributes, index, thisObject->indexGetter);
return true;
}
PropertyName propertyName = Identifier::from(exec, index);
if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
return true;
}
return Base::getOwnPropertySlotByIndex(thisObject, exec, index, slot);
}
示例7: jsNodeListPrototypeFunctionItem
JSValue* jsNodeListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSNodeList::s_info))
return throwError(exec, TypeError);
JSNodeList* castedThisObj = static_cast<JSNodeList*>(thisValue);
NodeList* imp = static_cast<NodeList*>(castedThisObj->impl());
int index = args[0]->toInt32(exec);
if (index < 0) {
setDOMException(exec, INDEX_SIZE_ERR);
return jsUndefined();
}
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->item(index)));
return result;
}
示例8: jsNodeListPrototypeFunctionItem
EncodedJSValue JSC_HOST_CALL jsNodeListPrototypeFunctionItem(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSNodeList* castedThis = jsDynamicCast<JSNodeList*>(thisValue);
if (!castedThis)
return throwVMTypeError(exec);
ASSERT_GC_OBJECT_INHERITS(castedThis, JSNodeList::info());
NodeList& impl = castedThis->impl();
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
unsigned index(toUInt32(exec, exec->argument(0), NormalConversion));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.item(index)));
return JSValue::encode(result);
}
示例9: isReachableFromOpaqueRoots
bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.slot()->asCell());
if (!jsNodeList->hasCustomProperties())
return false;
if (jsNodeList->impl().isLiveNodeList())
return visitor.containsOpaqueRoot(root(static_cast<LiveNodeList&>(jsNodeList->impl()).ownerNode()));
if (jsNodeList->impl().isChildNodeList())
return visitor.containsOpaqueRoot(root(static_cast<ChildNodeList&>(jsNodeList->impl()).ownerNode()));
if (jsNodeList->impl().isEmptyNodeList())
return visitor.containsOpaqueRoot(root(static_cast<EmptyNodeList&>(jsNodeList->impl()).ownerNode()));
return false;
}
示例10: ASSERT_GC_OBJECT_INHERITS
bool JSNodeList::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
JSNodeList* thisObject = jsCast<JSNodeList*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
const HashEntry* entry = getStaticValueSlotEntryWithoutCaching<JSNodeList>(exec, propertyName);
if (entry) {
slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter());
return true;
}
unsigned index = propertyName.asIndex();
if (index != PropertyName::NotAnIndex && index < thisObject->impl().length()) {
unsigned attributes = DontDelete | ReadOnly;
slot.setCustomIndex(thisObject, attributes, index, indexGetter);
return true;
}
if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
return true;
}
return getStaticValueSlot<JSNodeList, Base>(exec, JSNodeListTable, thisObject, propertyName, slot);
}
示例11: nameGetter
JSValue JSNodeList::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
JSNodeList* thisObj = static_cast<JSNodeList*>(asObject(slotBase));
return toJS(exec, thisObj->impl()->itemWithName(identifierToAtomicString(propertyName)));
}
示例12: nameGetter
KJS::JSValue* JSNodeList::nameGetter(KJS::ExecState* exec, KJS::JSObject* originalObject, const KJS::Identifier& propertyName, const KJS::PropertySlot& slot)
{
JSNodeList* thisObj = static_cast<JSNodeList*>(slot.slotBase());
return toJS(exec, thisObj->impl()->itemWithName(propertyName));
}
示例13: nameGetter
JSValue JSNodeList::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
JSNodeList* thisObj = static_cast<JSNodeList*>(asObject(slot.slotBase()));
return toJS(exec, thisObj->impl()->itemWithName(propertyName));
}
示例14: nameGetter
JSValue JSNodeList::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSNodeList* thisObj = jsCast<JSNodeList*>(asObject(slotBase));
return toJS(exec, thisObj->globalObject(), thisObj->impl()->itemWithName(propertyNameToAtomicString(propertyName)));
}
示例15: indexGetter
EncodedJSValue JSNodeList::indexGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned index)
{
JSNodeList* thisObj = jsCast<JSNodeList*>(JSValue::decode(slotBase));
ASSERT_GC_OBJECT_INHERITS(thisObj, info());
return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().item(index)));
}