本文整理汇总了C++中HTMLInputElement::canHaveSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLInputElement::canHaveSelection方法的具体用法?C++ HTMLInputElement::canHaveSelection怎么用?C++ HTMLInputElement::canHaveSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLInputElement
的用法示例。
在下文中一共展示了HTMLInputElement::canHaveSelection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelectionEnd
void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
throwTypeError(exec);
input->setSelectionEnd(value.toInt32(exec));
}
示例2: selectionDirection
JSValue JSHTMLInputElement::selectionDirection(ExecState* exec) const
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
return throwTypeError(exec);
return jsString(exec, input->selectionDirection());
}
示例3: selectionEnd
JSValue JSHTMLInputElement::selectionEnd(ExecState* exec) const
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
return throwError(exec, TypeError);
return jsNumber(exec, input->selectionEnd());
}
示例4: setSelectionDirection
void JSHTMLInputElement::setSelectionDirection(ExecState* exec, JSValue value)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection()) {
throwTypeError(exec);
return;
}
input->setSelectionDirection(ustringToString(value.toString(exec)));
}
示例5: throwTypeError
v8::Handle<v8::Value> V8HTMLInputElement::selectionDirectionAttrGetterCustom(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
v8::Handle<v8::Object> holder = info.Holder();
HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
if (!imp->canHaveSelection())
return throwTypeError("Accessing selectionDirection on an input element that cannot have a selection.", info.GetIsolate());
return v8String(imp->selectionDirection(), info.GetIsolate());
}
示例6: setSelectionRange
JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
return throwTypeError(exec);
int start = exec->argument(0).toInt32(exec);
int end = exec->argument(1).toInt32(exec);
input->setSelectionRange(start, end);
return jsUndefined();
}
示例7: setSelectionRange
JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec, const ArgList& args)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
return throwError(exec, TypeError);
int start = args.at(0).toInt32(exec);
int end = args.at(1).toInt32(exec);
input->setSelectionRange(start, end);
return jsUndefined();
}
示例8: throwError
v8::Handle<v8::Value> V8HTMLInputElement::setSelectionRangeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLInputElement.setSelectionRange");
v8::Handle<v8::Object> holder = args.Holder();
HTMLInputElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLInputElement>(holder);
if (!imp->canHaveSelection())
return throwError("Calling setSelectionRange on an input element that cannot have a selection.");
int start = args[0]->Int32Value();
int end = args[1]->Int32Value();
imp->setSelectionRange(start, end);
return v8::Undefined();
}