Пример #1
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionSetBaseAndExtent(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    ExceptionCode ec = 0;
    Node* baseNode(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    int baseOffset(toInt32(exec, exec->argument(1), NormalConversion));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    Node* extentNode(toNode(exec->argument(2)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    int extentOffset(toInt32(exec, exec->argument(3), NormalConversion));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    impl.setBaseAndExtent(baseNode, baseOffset, extentNode, extentOffset, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
Пример #2
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionSetBaseAndExtent(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    ExceptionCode ec = 0;
    Node* baseNode(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    int baseOffset(exec->argument(1).toInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    Node* extentNode(toNode(exec->argument(2)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    int extentOffset(exec->argument(3).toInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->setBaseAndExtent(baseNode, baseOffset, extentNode, extentOffset, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
Пример #3
0
void JSDOMSelectionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSDOMSelection* jsDOMSelection = jsCast<JSDOMSelection*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsDOMSelection->impl(), jsDOMSelection);
    jsDOMSelection->releaseImpl();
}
Пример #4
0
JSValue jsDOMSelectionType(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    JSValue result = jsString(exec, imp->type());
    return result;
}
Пример #5
0
JSValue jsDOMSelectionExtentOffset(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    JSValue result = jsNumber(imp->extentOffset());
    return result;
}
Пример #6
0
JSValue jsDOMSelectionIsCollapsed(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    JSValue result = jsBoolean(imp->isCollapsed());
    return result;
}
Пример #7
0
JSValue jsDOMSelectionExtentNode(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->extentNode()));
    return result;
}
Пример #8
0
EncodedJSValue jsDOMSelectionConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSDOMSelection* domObject = jsDynamicCast<JSDOMSelection*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSDOMSelection::getConstructor(exec->vm(), domObject->globalObject()));
}
Пример #9
0
bool JSDOMSelectionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSDOMSelection* jsDOMSelection = jsCast<JSDOMSelection*>(handle.get().asCell());
    if (!isObservable(jsDOMSelection))
        return false;
    Frame* root = jsDOMSelection->impl().frame();
    if (!root)
        return false;
    return visitor.containsOpaqueRoot(root);
}
Пример #10
0
EncodedJSValue jsDOMSelectionType(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    DOMSelection& impl = castedThis->impl();
    JSValue result = jsStringWithCache(exec, impl.type());
    return JSValue::encode(result);
}
Пример #11
0
EncodedJSValue jsDOMSelectionBaseNode(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    DOMSelection& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.baseNode()));
    return JSValue::encode(result);
}
Пример #12
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionEmpty(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    impl.empty();
    return JSValue::encode(jsUndefined());
}
Пример #13
0
EncodedJSValue jsDOMSelectionExtentOffset(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    DOMSelection& impl = castedThis->impl();
    JSValue result = jsNumber(impl.extentOffset());
    return JSValue::encode(result);
}
Пример #14
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionToString(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();

    JSC::JSValue result = jsStringWithCache(exec, impl.toString());
    return JSValue::encode(result);
}
Пример #15
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionEmpty(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());

    imp->empty();
    return JSValue::encode(jsUndefined());
}
Пример #16
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionToString(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());


    JSC::JSValue result = jsString(exec, imp->toString());
    return JSValue::encode(result);
}
Пример #17
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionAddRange(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    Range* range(toRange(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    impl.addRange(range);
    return JSValue::encode(jsUndefined());
}
Пример #18
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionSelectAllChildren(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    ExceptionCode ec = 0;
    Node* node(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    impl.selectAllChildren(node, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
Пример #19
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionGetRangeAt(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    ExceptionCode ec = 0;
    int index(toInt32(exec, exec->argument(0), NormalConversion));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.getRangeAt(index, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
Пример #20
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionSelectAllChildren(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    ExceptionCode ec = 0;
    Node* node(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->selectAllChildren(node, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
Пример #21
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionContainsNode(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    Node* node(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    bool allowPartial(exec->argument(1).toBoolean(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    JSC::JSValue result = jsBoolean(impl.containsNode(node, allowPartial));
    return JSValue::encode(result);
}
Пример #22
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionGetRangeAt(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    ExceptionCode ec = 0;
    int index(exec->argument(0).toInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getRangeAt(index, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
Пример #23
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionContainsNode(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    Node* node(toNode(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    bool allowPartial(exec->argument(1).toBoolean(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsBoolean(imp->containsNode(node, allowPartial));
    return JSValue::encode(result);
}
Пример #24
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionModify(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSDOMSelection* castedThis = jsDynamicCast<JSDOMSelection*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMSelection::info());
    DOMSelection& impl = castedThis->impl();
    const String& alter(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& direction(exec->argument(1).isEmpty() ? String() : exec->argument(1).toString(exec)->value(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& granularity(exec->argument(2).isEmpty() ? String() : exec->argument(2).toString(exec)->value(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    impl.modify(alter, direction, granularity);
    return JSValue::encode(jsUndefined());
}
Пример #25
0
EncodedJSValue JSC_HOST_CALL jsDOMSelectionPrototypeFunctionModify(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDOMSelection::s_info))
        return throwVMTypeError(exec);
    JSDOMSelection* castedThis = static_cast<JSDOMSelection*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMSelection::s_info);
    DOMSelection* imp = static_cast<DOMSelection*>(castedThis->impl());
    const String& alter(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& direction(ustringToString(exec->argument(1).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& granularity(ustringToString(exec->argument(2).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->modify(alter, direction, granularity);
    return JSValue::encode(jsUndefined());
}