本文整理汇总了C++中JSValue::toInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ JSValue::toInt32方法的具体用法?C++ JSValue::toInt32怎么用?C++ JSValue::toInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSValue
的用法示例。
在下文中一共展示了JSValue::toInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setJSHTMLInputElementMaxLength
void setJSHTMLInputElementMaxLength(ExecState* exec, JSObject* thisObject, JSValue value)
{
HTMLInputElement* imp = static_cast<HTMLInputElement*>(static_cast<JSHTMLInputElement*>(thisObject)->impl());
ExceptionCode ec = 0;
imp->setMaxLength(value.toInt32(exec), ec);
setDOMException(exec, ec);
}
示例2: setJSSVGAnimatedIntegerBaseVal
void setJSSVGAnimatedIntegerBaseVal(ExecState* exec, JSObject* thisObject, JSValue value)
{
SVGAnimatedInteger* imp = static_cast<SVGAnimatedInteger*>(static_cast<JSSVGAnimatedInteger*>(thisObject)->impl());
imp->setBaseVal(value.toInt32(exec));
if (static_cast<JSSVGAnimatedInteger*>(thisObject)->context())
static_cast<JSSVGAnimatedInteger*>(thisObject)->context()->svgAttributeChanged(static_cast<JSSVGAnimatedInteger*>(thisObject)->impl()->associatedAttributeName());
}
示例3: acceptNode
short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode) const
{
JSLock lock(SilenceAssertionsOnly);
CallData callData;
CallType callType = m_filter.getCallData(callData);
if (callType == CallTypeNone)
return NodeFilter::FILTER_ACCEPT;
// The exec argument here should only be null if this was called from a
// non-JavaScript language, and this is a JavaScript filter, and the document
// in question is not associated with the frame. In that case, we're going to
// behave incorrectly, and just reject nodes instead of calling the filter function.
// To fix that we'd need to come up with a way to find a suitable JavaScript
// execution context for the filter function to run in.
if (!exec)
return NodeFilter::FILTER_REJECT;
MarkedArgumentBuffer args;
// FIXME: The node should have the prototype chain that came from its document, not
// whatever prototype chain might be on the window this filter came from. Bug 27662
args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), filterNode));
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
JSValue result = call(exec, m_filter, callType, callData, m_filter, args);
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
int intResult = result.toInt32(exec);
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
return intResult;
}
示例4: setJSSVGAnimatedEnumerationBaseVal
void setJSSVGAnimatedEnumerationBaseVal(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSSVGAnimatedEnumeration* castedThisObj = static_cast<JSSVGAnimatedEnumeration*>(thisObject);
SVGAnimatedEnumeration* imp = static_cast<SVGAnimatedEnumeration*>(castedThisObj->impl());
imp->setBaseVal(value.toInt32(exec));
JSSVGContextCache::propagateSVGDOMChange(castedThisObj, imp->associatedAttributeName());
}
示例5: acceptNode
short JSNodeFilterCondition::acceptNode(Node* filterNode, JSValue*& exception) const
{
// FIXME: It makes no sense for this to depend on the document being in a frame!
Frame* frame = filterNode->document()->frame();
if (!frame)
return NodeFilter::FILTER_REJECT;
JSLock lock;
CallData callData;
CallType callType = m_filter->getCallData(callData);
if (callType == CallTypeNone)
return NodeFilter::FILTER_ACCEPT;
ExecState* exec = frame->script()->globalObject()->globalExec();
ArgList args;
args.append(toJS(exec, filterNode));
if (exec->hadException()) {
exception = takeException(exec);
return NodeFilter::FILTER_REJECT;
}
JSValue* result = call(exec, m_filter, callType, callData, m_filter, args);
if (exec->hadException()) {
exception = takeException(exec);
return NodeFilter::FILTER_REJECT;
}
int intResult = result->toInt32(exec);
if (exec->hadException()) {
exception = takeException(exec);
return NodeFilter::FILTER_REJECT;
}
return intResult;
}
示例6: setSelectionEnd
void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value)
{
HTMLInputElement& input = impl();
if (!input.canHaveSelection())
throwTypeError(exec);
input.setSelectionEnd(value.toInt32(exec));
}
示例7: setSelectionEnd
void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
throwTypeError(exec);
input->setSelectionEnd(value.toInt32(exec));
}
示例8: setJSHTMLMarqueeElementScrollDelay
void setJSHTMLMarqueeElementScrollDelay(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLMarqueeElement* castedThis = static_cast<JSHTMLMarqueeElement*>(thisObject);
HTMLMarqueeElement* imp = static_cast<HTMLMarqueeElement*>(castedThis->impl());
ExceptionCode ec = 0;
imp->setScrollDelay(value.toInt32(exec), ec);
setDOMException(exec, ec);
}
示例9: setSelectionEnd
void JSHTMLInputElement::setSelectionEnd(ExecState& state, JSValue value)
{
HTMLInputElement& input = wrapped();
if (!input.canHaveSelection())
throwTypeError(&state);
input.setSelectionEnd(value.toInt32(&state));
}
示例10: acceptNode
short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode) const
{
JSLock lock(SilenceAssertionsOnly);
if (!m_filter)
return NodeFilter::FILTER_ACCEPT;
// Exec is null if we've been called from a non-JavaScript language and the document
// is no longer able to run JavaScript (e.g., it's disconnected from its frame).
if (!exec)
return NodeFilter::FILTER_REJECT;
JSValue filter = m_filter.get();
CallData callData;
CallType callType = getCallData(filter, callData);
if (callType == CallTypeNone) {
filter = filter.get(exec, Identifier(exec, "acceptNode"));
callType = getCallData(filter, callData);
if (callType == CallTypeNone) {
throwError(exec, createTypeError(exec, "NodeFilter object does not have an acceptNode function"));
return NodeFilter::FILTER_REJECT;
}
}
MarkedArgumentBuffer args;
// FIXME: The node should have the prototype chain that came from its document, not
// whatever prototype chain might be on the window this filter came from. Bug 27662
args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), filterNode));
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
JSValue result = JSMainThreadExecState::call(exec, filter, callType, callData, m_filter.get(), args);
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
int intResult = result.toInt32(exec);
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
return intResult;
}
示例11: setJSDataGridColumnSortDirection
void setJSDataGridColumnSortDirection(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSDataGridColumn* castedThisObj = static_cast<JSDataGridColumn*>(thisObject);
DataGridColumn* imp = static_cast<DataGridColumn*>(castedThisObj->impl());
imp->setSortDirection(value.toInt32(exec));
}
示例12: showContextMenu
JSValue JSInspectorFrontendHost::showContextMenu(ExecState* exec)
{
if (exec->argumentCount() < 2)
return jsUndefined();
#if ENABLE(CONTEXT_MENUS)
Event* event = toEvent(exec->argument(0));
JSArray* array = asArray(exec->argument(1));
Vector<ContextMenuItem*> items;
for (size_t i = 0; i < array->length(); ++i) {
JSObject* item = asObject(array->getIndex(i));
JSValue label = item->get(exec, Identifier(exec, "label"));
JSValue type = item->get(exec, Identifier(exec, "type"));
JSValue id = item->get(exec, Identifier(exec, "id"));
JSValue enabled = item->get(exec, Identifier(exec, "enabled"));
JSValue checked = item->get(exec, Identifier(exec, "checked"));
if (!type.isString())
continue;
String typeString = ustringToString(type.toString(exec)->value(exec));
if (typeString == "separator") {
items.append(new ContextMenuItem(SeparatorType,
ContextMenuItemCustomTagNoAction,
String()));
} else {
ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec));
ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)->value(exec)));
if (!enabled.isUndefined())
menuItem->setEnabled(enabled.toBoolean(exec));
if (!checked.isUndefined())
menuItem->setChecked(checked.toBoolean(exec));
items.append(menuItem);
}
}
impl()->showContextMenu(event, items);
#endif
return jsUndefined();
}
示例13: setJSHTMLTableCellElementRowSpan
void setJSHTMLTableCellElementRowSpan(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLTableCellElement* castedThisObj = static_cast<JSHTMLTableCellElement*>(thisObject);
HTMLTableCellElement* imp = static_cast<HTMLTableCellElement*>(castedThisObj->impl());
imp->setRowSpan(value.toInt32(exec));
}
示例14: setJSHTMLElementTabIndex
void setJSHTMLElementTabIndex(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLElement* castedThis = static_cast<JSHTMLElement*>(thisObject);
HTMLElement* imp = static_cast<HTMLElement*>(castedThis->impl());
imp->setTabIndex(value.toInt32(exec));
}
示例15: setJSHTMLDataGridColElementSortDirection
void setJSHTMLDataGridColElementSortDirection(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLDataGridColElement* castedThisObj = static_cast<JSHTMLDataGridColElement*>(thisObject);
HTMLDataGridColElement* imp = static_cast<HTMLDataGridColElement*>(castedThisObj->impl());
imp->setSortDirection(value.toInt32(exec));
}