コード例 #1
0
ファイル: kjs_events.cpp プロジェクト: jackiekaon/owb-mirror
JSValue* JSClipboard::getValueProperty(ExecState* exec, int token) const
{
    Clipboard* clipboard = impl();
    switch (token) {
        case DropEffect:
            ASSERT(clipboard->isForDragging() || clipboard->dropEffect().isNull());
            return jsStringOrUndefined(clipboard->dropEffect());
        case EffectAllowed:
            ASSERT(clipboard->isForDragging() || clipboard->effectAllowed().isNull());
            return jsStringOrUndefined(clipboard->effectAllowed());
        case Types:
        {
            HashSet<String> types = clipboard->types();
            if (types.isEmpty())
                return jsNull();
            else {
                List list;
                HashSet<String>::const_iterator end = types.end();
                for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it)
                    list.append(jsString(UString(*it)));
                return exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
            }
        }
        default:
            return 0;
    }
}
コード例 #2
0
JSValuePtr JSClipboard::types(ExecState* exec) const
{
    Clipboard* clipboard = impl();

    HashSet<String> types = clipboard->types();
    if (types.isEmpty())
        return jsNull();

    ArgList list;
    HashSet<String>::const_iterator end = types.end();
    for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it)
        list.append(jsString(exec, UString(*it)));
    return constructArray(exec, list);
}
コード例 #3
0
JSValue JSClipboard::types(ExecState* exec) const
{
    Clipboard* clipboard = impl();

    ListHashSet<String> types = clipboard->types();
    if (types.isEmpty())
        return jsNull();

    MarkedArgumentBuffer list;
    ListHashSet<String>::const_iterator end = types.end();
    for (ListHashSet<String>::const_iterator it = types.begin(); it != end; ++it)
        list.append(jsStringWithCache(exec, *it));
    return constructArray(exec, 0, globalObject(), list);
}
コード例 #4
0
v8::Handle<v8::Value> V8Clipboard::typesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.Clipboard.types()");
    Clipboard* clipboard = V8Clipboard::toNative(info.Holder());

    HashSet<String> types = clipboard->types();
    if (types.isEmpty())
        return v8::Null();

    v8::Local<v8::Array> result = v8::Array::New(types.size());
    HashSet<String>::const_iterator end = types.end();
    int index = 0;
    for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)
        result->Set(v8::Integer::New(index), v8String(*it));

    return result;
}
void V8Clipboard::typesAttrGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
    Clipboard* clipboard = V8Clipboard::toNative(info.Holder());

    ListHashSet<String> types = clipboard->types();
    if (types.isEmpty()) {
        v8SetReturnValueNull(info);
        return;
    }

    v8::Local<v8::Array> result = v8::Array::New(types.size());
    ListHashSet<String>::const_iterator end = types.end();
    int index = 0;
    for (ListHashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)
        result->Set(v8::Integer::New(index, info.GetIsolate()), v8String(*it, info.GetIsolate()));

    v8SetReturnValue(info, result);
}