コード例 #1
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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);
}
コード例 #2
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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();
}
コード例 #3
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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();
}
コード例 #4
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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;
}
コード例 #5
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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;
}
コード例 #6
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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;
}
コード例 #7
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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;
}
コード例 #8
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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();
}
コード例 #9
0
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()));
}
コード例 #10
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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;
}
コード例 #11
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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;
}
コード例 #12
0
ファイル: JSElement.cpp プロジェクト: Gin-Rye/duibrowser
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();
}