JSValue* jsElementPrototypeFunctionSetAttributeNodeNS(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); return castedThisObj->setAttributeNodeNS(exec, args); }
JSValue* jsElementPrototypeFunctionBlur(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); imp->blur(); return jsUndefined(); }
JSValue* jsElementPrototypeFunctionScrollByPages(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); int pages = args[0]->toInt32(exec); imp->scrollByPages(pages); return jsUndefined(); }
JSValue* jsElementPrototypeFunctionGetElementsByClassName(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); const UString& name = args[0]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getElementsByClassName(name))); return result; }
JSValue* jsElementPrototypeFunctionContains(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); Element* element = toElement(args[0]); KJS::JSValue* result = jsBoolean(imp->contains(element)); return result; }
JSValue* jsElementPrototypeFunctionHasAttribute(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); const UString& name = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->hasAttribute(name)); return result; }
JSValue* jsElementPrototypeFunctionGetAttributeNodeNS(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); const UString& namespaceURI = valueToStringWithNullCheck(exec, args[0]); const UString& localName = args[1]->toString(exec); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getAttributeNodeNS(namespaceURI, localName))); return result; }
JSValue* jsElementPrototypeFunctionRemoveAttribute(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); ExceptionCode ec = 0; const UString& name = args[0]->toString(exec); imp->removeAttribute(name, ec); setDOMException(exec, ec); return jsUndefined(); }
JSValueRef DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) { JSLock lock(SilenceAssertionsOnly); ExecState* exec = toJS(context); if (!value) return JSValueMakeUndefined(context); JSValue jsValue = toJS(exec, value); if (!jsValue.inherits(&JSElement::s_info)) return JSValueMakeUndefined(context); JSElement* jsElement = static_cast<JSElement*>(asObject(jsValue)); Element* element = jsElement->impl(); RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(element, true); return toRef(exec, toJS(exec, jsElement->globalObject(), style.get())); }
JSValue* jsElementPrototypeFunctionQuerySelectorAll(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); ExceptionCode ec = 0; const UString& selectors = valueToStringWithUndefinedOrNullCheck(exec, args[0]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->querySelectorAll(selectors, ec))); setDOMException(exec, ec); return result; }
JSValue* jsElementPrototypeFunctionRemoveAttributeNode(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); ExceptionCode ec = 0; Attr* oldAttr = toAttr(args[0]); KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->removeAttributeNode(oldAttr, ec))); setDOMException(exec, ec); return result; }
JSValue* jsElementPrototypeFunctionScrollIntoViewIfNeeded(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSElement::s_info)) return throwError(exec, TypeError); JSElement* castedThisObj = static_cast<JSElement*>(thisValue); Element* imp = static_cast<Element*>(castedThisObj->impl()); int argsCount = args.size(); if (argsCount < 1) { imp->scrollIntoViewIfNeeded(); return jsUndefined(); } bool centerIfNeeded = args[0]->toBoolean(exec); imp->scrollIntoViewIfNeeded(centerIfNeeded); return jsUndefined(); }