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()); }
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()); }
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(); }
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; }
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; }
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; }
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; }
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())); }
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); }
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); }
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); }
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()); }
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); }
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); }
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()); }
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); }
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()); }
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()); }
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); }
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()); }
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); }
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); }
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); }
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()); }
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()); }