void setJSHTMLObjectElementType(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLObjectElement* castedThis = static_cast<JSHTMLObjectElement*>(thisObject); HTMLObjectElement* imp = static_cast<HTMLObjectElement*>(castedThis->impl()); imp->setAttribute(WebCore::HTMLNames::typeAttr, valueToStringWithNullCheck(exec, value)); }
void setJSHTMLTitleElementText(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLTitleElement* castedThis = static_cast<JSHTMLTitleElement*>(thisObject); HTMLTitleElement* imp = static_cast<HTMLTitleElement*>(castedThis->impl()); imp->setText(valueToStringWithNullCheck(exec, value)); }
JSValue* JSDocumentPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSDocument::info)) return throwError(exec, TypeError); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObj)->impl()); switch (id) { case JSDocument::CreateElementFuncNum: { ExceptionCode ec = 0; String tagName = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createElement(tagName, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateDocumentFragmentFuncNum: { KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createDocumentFragment())); return result; } case JSDocument::CreateTextNodeFuncNum: { String data = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createTextNode(data))); return result; } case JSDocument::CreateCommentFuncNum: { String data = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createComment(data))); return result; } case JSDocument::CreateCDATASectionFuncNum: { ExceptionCode ec = 0; String data = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createCDATASection(data, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateProcessingInstructionFuncNum: { ExceptionCode ec = 0; String target = args[0]->toString(exec); String data = args[1]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createProcessingInstruction(target, data, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateAttributeFuncNum: { ExceptionCode ec = 0; String name = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createAttribute(name, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateEntityReferenceFuncNum: { ExceptionCode ec = 0; String name = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createEntityReference(name, ec))); setDOMException(exec, ec); return result; } case JSDocument::GetElementsByTagNameFuncNum: { String tagname = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getElementsByTagName(tagname))); return result; } case JSDocument::ImportNodeFuncNum: { ExceptionCode ec = 0; Node* importedNode = toNode(args[0]); bool deep = args[1]->toBoolean(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->importNode(importedNode, deep, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateElementNSFuncNum: { ExceptionCode ec = 0; String namespaceURI = valueToStringWithNullCheck(exec, args[0]); String qualifiedName = args[1]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createElementNS(namespaceURI, qualifiedName, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateAttributeNSFuncNum: { ExceptionCode ec = 0; String namespaceURI = valueToStringWithNullCheck(exec, args[0]); String qualifiedName = args[1]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createAttributeNS(namespaceURI, qualifiedName, ec))); setDOMException(exec, ec); return result; } case JSDocument::GetElementsByTagNameNSFuncNum: { String namespaceURI = valueToStringWithNullCheck(exec, args[0]); String localName = args[1]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getElementsByTagNameNS(namespaceURI, localName))); return result; } case JSDocument::GetElementByIdFuncNum: { String elementId = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getElementById(elementId))); return result; } case JSDocument::AdoptNodeFuncNum: { ExceptionCode ec = 0; Node* source = toNode(args[0]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->adoptNode(source, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateEventFuncNum: { ExceptionCode ec = 0; String eventType = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createEvent(eventType, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateRangeFuncNum: { KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createRange())); return result; } case JSDocument::CreateNodeIteratorFuncNum: { ExceptionCode ec = 0; Node* root = toNode(args[0]); bool whatToShowOk; unsigned whatToShow = args[1]->toInt32(exec, whatToShowOk); if (!whatToShowOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } NodeFilter* filter = toNodeFilter(args[2]); bool entityReferenceExpansion = args[3]->toBoolean(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createNodeIterator(root, whatToShow, filter, entityReferenceExpansion, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateTreeWalkerFuncNum: { ExceptionCode ec = 0; Node* root = toNode(args[0]); bool whatToShowOk; unsigned whatToShow = args[1]->toInt32(exec, whatToShowOk); if (!whatToShowOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } NodeFilter* filter = toNodeFilter(args[2]); bool entityReferenceExpansion = args[3]->toBoolean(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createTreeWalker(root, whatToShow, filter, entityReferenceExpansion, ec))); setDOMException(exec, ec); return result; } case JSDocument::GetOverrideStyleFuncNum: { Element* element = toElement(args[0]); String pseudoElement = args[1]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getOverrideStyle(element, pseudoElement))); return result; } case JSDocument::CreateExpressionFuncNum: { ExceptionCode ec = 0; String expression = args[0]->toString(exec); RefPtr<XPathNSResolver> customResolver; XPathNSResolver* resolver = toXPathNSResolver(args[1]); if (!resolver) { customResolver = JSCustomXPathNSResolver::create(exec, args[1]); if (exec->hadException()) return jsUndefined(); resolver = customResolver.get(); } KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createExpression(expression, resolver, ec))); setDOMException(exec, ec); return result; } case JSDocument::CreateNSResolverFuncNum: { Node* nodeResolver = toNode(args[0]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createNSResolver(nodeResolver))); return result; } case JSDocument::EvaluateFuncNum: { ExceptionCode ec = 0; String expression = args[0]->toString(exec); Node* contextNode = toNode(args[1]); RefPtr<XPathNSResolver> customResolver; XPathNSResolver* resolver = toXPathNSResolver(args[2]); if (!resolver) { customResolver = JSCustomXPathNSResolver::create(exec, args[2]); if (exec->hadException()) return jsUndefined(); resolver = customResolver.get(); } unsigned short type = args[3]->toInt32(exec); XPathResult* inResult = toXPathResult(args[4]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->evaluate(expression, contextNode, resolver, type, inResult, ec))); setDOMException(exec, ec); return result; } case JSDocument::ExecCommandFuncNum: { String command = args[0]->toString(exec); bool userInterface = args[1]->toBoolean(exec); String value = valueToStringWithUndefinedOrNullCheck(exec, args[2]); KJS::JSValue* result = jsBoolean(imp->execCommand(command, userInterface, value)); return result; } case JSDocument::QueryCommandEnabledFuncNum: { String command = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->queryCommandEnabled(command)); return result; } case JSDocument::QueryCommandIndetermFuncNum: { String command = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->queryCommandIndeterm(command)); return result; } case JSDocument::QueryCommandStateFuncNum: { String command = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->queryCommandState(command)); return result; } case JSDocument::QueryCommandSupportedFuncNum: { String command = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->queryCommandSupported(command)); return result; } case JSDocument::QueryCommandValueFuncNum: { String command = args[0]->toString(exec); KJS::JSValue* result = jsStringOrFalse(imp->queryCommandValue(command)); return result; } case JSDocument::ElementFromPointFuncNum: { bool xOk; int x = args[0]->toInt32(exec, xOk); if (!xOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } bool yOk; int y = args[1]->toInt32(exec, yOk); if (!yOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->elementFromPoint(x, y))); return result; } } return 0; }
void setJSHTMLDocumentVlinkColor(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLDocument* castedThis = static_cast<JSHTMLDocument*>(thisObject); HTMLDocument* imp = static_cast<HTMLDocument*>(castedThis->impl()); imp->setVlinkColor(valueToStringWithNullCheck(exec, value)); }