本文整理汇总了C++中HTMLDocument::frame方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLDocument::frame方法的具体用法?C++ HTMLDocument::frame怎么用?C++ HTMLDocument::frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLDocument
的用法示例。
在下文中一共展示了HTMLDocument::frame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throwTypeError
void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
if (args.Length() > 2) {
if (RefPtr<Frame> frame = htmlDocument->frame()) {
// Fetch the global object for the frame.
v8::Local<v8::Context> context = frame->script()->currentWorldContext();
// Bail out if we cannot get the context.
if (context.IsEmpty())
return;
v8::Local<v8::Object> global = context->Global();
// Get the open property of the global object.
v8::Local<v8::Value> function = global->Get(v8::String::NewSymbol("open"));
// If the open property is not a function throw a type error.
if (!function->IsFunction()) {
throwTypeError("open is not a function", args.GetIsolate());
return;
}
// Wrap up the arguments and call the function.
OwnArrayPtr<v8::Local<v8::Value> > params = adoptArrayPtr(new v8::Local<v8::Value>[args.Length()]);
for (int i = 0; i < args.Length(); i++)
params[i] = args[i];
v8SetReturnValue(args, frame->script()->callFunction(v8::Local<v8::Function>::Cast(function), global, args.Length(), params.get()));
return;
}
}
htmlDocument->open(activeDOMWindow()->document());
v8SetReturnValue(args, args.Holder());
}
示例2: exceptionState
void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
if (info.Length() > 2) {
if (RefPtr<LocalFrame> frame = htmlDocument->frame()) {
// Fetch the global object for the frame.
v8::Local<v8::Context> context = toV8Context(info.GetIsolate(), frame.get(), DOMWrapperWorld::current(info.GetIsolate()));
// Bail out if we cannot get the context.
if (context.IsEmpty())
return;
v8::Local<v8::Object> global = context->Global();
// Get the open property of the global object.
v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetIsolate(), "open"));
// Failed; return without throwing (new) exception.
if (function.IsEmpty())
return;
// If the open property is not a function throw a type error.
if (!function->IsFunction()) {
throwTypeError("open is not a function", info.GetIsolate());
return;
}
// Wrap up the arguments and call the function.
OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]);
for (int i = 0; i < info.Length(); i++)
params[i] = info[i];
v8SetReturnValue(info, frame->script().callFunction(v8::Local<v8::Function>::Cast(function), global, info.Length(), params.get()));
return;
}
}
ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Document", info.Holder(), info.GetIsolate());
htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptionState);
if (exceptionState.throwIfNeeded())
return;
v8SetReturnValue(info, info.Holder());
}
示例3: testBoundary
void testBoundary(HTMLDocument& document, HTMLTextFormControlElement& textControl)
{
for (unsigned i = 0; i < textControl.innerEditorValue().length(); i++) {
textControl.setSelectionRange(i, i);
Position position = document.frame()->selection().start();
SCOPED_TRACE(::testing::Message() << "offset " << position.computeEditingOffset() << " of " << nodePositionAsStringForTesting(position.anchorNode()).ascii().data());
{
SCOPED_TRACE("HTMLTextFormControlElement::startOfWord");
testFunctionEquivalence(position, HTMLTextFormControlElement::startOfWord, startOfWord);
}
{
SCOPED_TRACE("HTMLTextFormControlElement::endOfWord");
testFunctionEquivalence(position, HTMLTextFormControlElement::endOfWord, endOfWord);
}
{
SCOPED_TRACE("HTMLTextFormControlElement::startOfSentence");
testFunctionEquivalence(position, HTMLTextFormControlElement::startOfSentence, startOfSentence);
}
{
SCOPED_TRACE("HTMLTextFormControlElement::endOfSentence");
testFunctionEquivalence(position, HTMLTextFormControlElement::endOfSentence, endOfSentence);
}
}
}