JSValue* jsCSSStyleDeclarationPrototypeFunctionRemoveProperty(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSCSSStyleDeclaration::s_info)) return throwError(exec, TypeError); JSCSSStyleDeclaration* castedThisObj = static_cast<JSCSSStyleDeclaration*>(thisValue); CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThisObj->impl()); ExceptionCode ec = 0; const UString& propertyName = args[0]->toString(exec); KJS::JSValue* result = jsStringOrNull(exec, imp->removeProperty(propertyName, ec)); setDOMException(exec, ec); return result; }
JSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionRemoveProperty(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.isObject(&JSCSSStyleDeclaration::s_info)) return throwError(exec, TypeError); JSCSSStyleDeclaration* castedThisObj = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThisObj->impl()); ExceptionCode ec = 0; const UString& propertyName = args.at(0).toString(exec); JSC::JSValue result = jsStringOrNull(exec, imp->removeProperty(propertyName, ec)); setDOMException(exec, ec); return result; }
EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionRemoveProperty(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) return throwVMTypeError(exec); JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); ExceptionCode ec = 0; const String& propertyName(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsStringOrNull(exec, imp->removeProperty(propertyName, ec)); setDOMException(exec, ec); return JSValue::encode(result); }
JSValue* JSCSSStyleDeclarationPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSCSSStyleDeclaration::info)) return throwError(exec, TypeError); CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(static_cast<JSCSSStyleDeclaration*>(thisObj)->impl()); switch (id) { case JSCSSStyleDeclaration::GetPropertyValueFuncNum: { String propertyName = args[0]->toString(exec); KJS::JSValue* result = jsStringOrNull(imp->getPropertyValue(propertyName)); return result; } case JSCSSStyleDeclaration::GetPropertyCSSValueFuncNum: { String propertyName = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getPropertyCSSValue(propertyName))); return result; } case JSCSSStyleDeclaration::RemovePropertyFuncNum: { ExceptionCode ec = 0; String propertyName = args[0]->toString(exec); KJS::JSValue* result = jsStringOrNull(imp->removeProperty(propertyName, ec)); setDOMException(exec, ec); return result; } case JSCSSStyleDeclaration::GetPropertyPriorityFuncNum: { String propertyName = args[0]->toString(exec); KJS::JSValue* result = jsStringOrNull(imp->getPropertyPriority(propertyName)); return result; } case JSCSSStyleDeclaration::SetPropertyFuncNum: { ExceptionCode ec = 0; String propertyName = args[0]->toString(exec); String value = valueToStringWithNullCheck(exec, args[1]); String priority = args[2]->toString(exec); imp->setProperty(propertyName, value, priority, ec); setDOMException(exec, ec); return jsUndefined(); } case JSCSSStyleDeclaration::ItemFuncNum: { bool indexOk; unsigned index = args[0]->toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = jsStringOrNull(imp->item(index)); return result; } case JSCSSStyleDeclaration::GetPropertyShorthandFuncNum: { String propertyName = args[0]->toString(exec); KJS::JSValue* result = jsStringOrNull(imp->getPropertyShorthand(propertyName)); return result; } case JSCSSStyleDeclaration::IsPropertyImplicitFuncNum: { String propertyName = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->isPropertyImplicit(propertyName)); return result; } } return 0; }