本文整理汇总了C++中PropertySlot类的典型用法代码示例。如果您正苦于以下问题:C++ PropertySlot类的具体用法?C++ PropertySlot怎么用?C++ PropertySlot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertySlot类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: impl
bool JSLocation::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
Frame* frame = impl()->frame();
if (!frame) {
descriptor.setUndefined();
return true;
}
// throw out all cross domain access
if (!shouldAllowAccessToFrame(exec, frame))
return true;
// Check for the few functions that we allow, even when called cross-domain.
const HashEntry* entry = JSLocationPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
PropertySlot slot;
if (entry && (entry->attributes() & JSC::Function)) {
if (entry->function() == jsLocationPrototypeFunctionReplace) {
slot.setCustom(this, nonCachingStaticReplaceFunctionGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
return true;
} else if (entry->function() == jsLocationPrototypeFunctionReload) {
slot.setCustom(this, nonCachingStaticReloadFunctionGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
return true;
} else if (entry->function() == jsLocationPrototypeFunctionAssign) {
slot.setCustom(this, nonCachingStaticAssignFunctionGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
return true;
}
}
// FIXME: Other implementers of the Window cross-domain scheme (Window, History) allow toString,
// but for now we have decided not to, partly because it seems silly to return "[Object Location]" in
// such cases when normally the string form of Location would be the URL.
descriptor.setUndefined();
return true;
}
示例2: getOwnPropertyDescriptor
bool JSDOMTokenList::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
const HashEntry* entry = JSDOMTokenListTable.entry(exec, propertyName);
if (entry) {
PropertySlot slot;
slot.setCustom(this, entry->propertyGetter());
descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
return true;
}
bool ok;
unsigned index = propertyName.toUInt32(ok);
if (ok && index < static_cast<DOMTokenList*>(impl())->length()) {
PropertySlot slot;
slot.setCustomIndex(this, index, indexGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
return true;
}
return getStaticValueDescriptor<JSDOMTokenList, Base>(exec, &JSDOMTokenListTable, this, propertyName, descriptor);
}
示例3: ASSERT
bool RuntimeArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
RuntimeArray* thisObject = jsCast<RuntimeArray*>(object);
if (propertyName == exec->propertyNames().length) {
PropertySlot slot;
slot.setCustom(thisObject, lengthGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
return true;
}
unsigned index = propertyName.asIndex();
if (index < thisObject->getLength()) {
ASSERT(index != PropertyName::NotAnIndex);
PropertySlot slot;
slot.setCustomIndex(thisObject, index, indexGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | DontEnum);
return true;
}
return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
}
示例4: getOwnPropertyDescriptor
bool RuntimeArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
if (propertyName == exec->propertyNames().length) {
PropertySlot slot;
slot.setCustom(this, lengthGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
return true;
}
bool ok;
unsigned index = propertyName.toArrayIndex(ok);
if (ok) {
if (index < getLength()) {
PropertySlot slot;
slot.setCustomIndex(this, index, indexGetter);
descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | DontEnum);
return true;
}
}
return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
}
示例5: nameGetter
JSValuePtr JSHTMLFormElement::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLFormElement* form = static_cast<HTMLFormElement*>(static_cast<JSHTMLElement*>(asObject(slot.slotBase()))->impl());
Vector<RefPtr<Node> > namedItems;
form->getNamedElements(propertyName, namedItems);
if (namedItems.size() == 1)
return toJS(exec, namedItems[0].get());
if (namedItems.size() > 1)
return new (exec) JSNamedNodesCollection(exec, namedItems);
return jsUndefined();
}
示例6: regExpConstructorLastParen
JSValuePtr regExpConstructorLastParen(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
return asRegExpConstructor(slot.slotBase())->getLastParen(exec);
}
示例7: regExpConstructorMultiline
JSValuePtr regExpConstructorMultiline(ExecState*, const Identifier&, const PropertySlot& slot)
{
return jsBoolean(asRegExpConstructor(slot.slotBase())->multiline());
}
示例8: jsSVGFEFloodElementConstructor
JSValue jsSVGFEFloodElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSSVGFEFloodElement* domObject = static_cast<JSSVGFEFloodElement*>(asObject(slot.slotBase()));
return JSSVGFEFloodElement::getConstructor(exec, domObject->globalObject());
}
示例9: lengthGetter
JSValue JSNamedNodesCollection::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSNamedNodesCollection* thisObj = static_cast<JSNamedNodesCollection*>(asObject(slot.slotBase()));
return jsNumber(exec, thisObj->m_nodes->size());
}
示例10: indexGetter
JSValue JSNamedNodesCollection::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSNamedNodesCollection *thisObj = static_cast<JSNamedNodesCollection*>(asObject(slot.slotBase()));
return toJS(exec, (*thisObj->m_nodes)[slot.index()].get());
}
示例11: regExpConstructorInput
JSValuePtr regExpConstructorInput(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
return jsString(exec, asRegExpConstructor(slot.slotBase())->input());
}
示例12: regExpConstructorLastMatch
JSValuePtr regExpConstructorLastMatch(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
return asRegExpConstructor(slot.slotBase())->getBackref(exec, 0);
}
示例13: regExpConstructorRightContext
JSValuePtr regExpConstructorRightContext(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
return asRegExpConstructor(slot.slotBase())->getRightContext(exec);
}
示例14: jsDocumentTypeConstructor
JSValue jsDocumentTypeConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSDocumentType* domObject = static_cast<JSDocumentType*>(asObject(slot.slotBase()));
return JSDocumentType::getConstructor(exec, domObject->globalObject());
}