KJS::JSValue* toJS(KJS::ExecState* exec, Event* event) { KJS::JSLock lock; if (!event) return KJS::jsNull(); KJS::ScriptInterpreter* interp = static_cast<KJS::ScriptInterpreter*>(exec->dynamicInterpreter()); KJS::DOMObject* ret = interp->getDOMObject(event); if (ret) return ret; if (event->isKeyboardEvent()) ret = new JSKeyboardEvent(exec, static_cast<KeyboardEvent*>(event)); else if (event->isTextEvent()) ret = new JSTextEvent(exec, static_cast<TextEvent*>(event)); else if (event->isMouseEvent()) ret = new JSMouseEvent(exec, static_cast<MouseEvent*>(event)); else if (event->isWheelEvent()) ret = new JSWheelEvent(exec, static_cast<WheelEvent*>(event)); else if (event->isUIEvent()) ret = new JSUIEvent(exec, static_cast<UIEvent*>(event)); else if (event->isMutationEvent()) ret = new JSMutationEvent(exec, static_cast<MutationEvent*>(event)); else if (event->isOverflowEvent()) ret = new JSOverflowEvent(exec, static_cast<OverflowEvent*>(event)); else ret = new JSEvent(exec, event); interp->putDOMObject(event, ret); return ret; }
KJS::JSValue* toJS(KJS::ExecState* exec, CSSValue* value) { if (!value) return KJS::jsNull(); KJS::ScriptInterpreter* interp = static_cast<KJS::ScriptInterpreter*>(exec->dynamicInterpreter()); KJS::DOMObject* ret = interp->getDOMObject(value); if (ret) return ret; if (value->isValueList()) ret = new JSCSSValueList(exec, static_cast<CSSValueList*>(value)); #if ENABLE(SVG) else if (value->isSVGColor()) ret = new JSSVGColor(exec, static_cast<SVGColor*>(value)); else if (value->isSVGPaint()) ret = new JSSVGPaint(exec, static_cast<SVGPaint*>(value)); #endif else if (value->isPrimitiveValue()) ret = new JSCSSPrimitiveValue(exec, static_cast<CSSPrimitiveValue*>(value)); else ret = new JSCSSValue(exec, value); interp->putDOMObject(value, ret); return ret; }
KJS::JSValue* toJS(KJS::ExecState* exec, StyleSheet* styleSheet) { if (!styleSheet) return KJS::jsNull(); KJS::ScriptInterpreter* interp = static_cast<KJS::ScriptInterpreter*>(exec->dynamicInterpreter()); KJS::DOMObject* ret = interp->getDOMObject(styleSheet); if (ret) return ret; if (styleSheet->isCSSStyleSheet()) ret = new JSCSSStyleSheet(exec, static_cast<CSSStyleSheet*>(styleSheet)); else ret = new JSStyleSheet(exec, styleSheet); interp->putDOMObject(styleSheet, ret); return ret; }