当前位置: 首页>>代码示例>>C++>>正文


C++ JSCSSStyleDeclaration类代码示例

本文整理汇总了C++中JSCSSStyleDeclaration的典型用法代码示例。如果您正苦于以下问题:C++ JSCSSStyleDeclaration类的具体用法?C++ JSCSSStyleDeclaration怎么用?C++ JSCSSStyleDeclaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JSCSSStyleDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nameGetter

// FIXME: You can get these properties, and set them (see customPut below),
// but you should also be able to enumerate them.
JSValue JSCSSStyleDeclaration::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
    JSCSSStyleDeclaration* thisObj = static_cast<JSCSSStyleDeclaration*>(asObject(slot.slotBase()));

    // Set up pixelOrPos boolean to handle the fact that
    // pixelTop returns "CSS Top" as number value in unit pixels
    // posTop returns "CSS top" as number value in unit pixels _if_ its a
    // positioned element. if it is not a positioned element, return 0
    // from MSIE documentation FIXME: IMPLEMENT THAT (Dirk)
    bool pixelOrPos;
    String prop = cssPropertyName(propertyName, &pixelOrPos);
    RefPtr<CSSValue> v = thisObj->impl()->getPropertyCSSValue(prop);
    if (v) {
        if (pixelOrPos && v->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE)
            return jsNumber(exec, static_pointer_cast<CSSPrimitiveValue>(v)->getFloatValue(CSSPrimitiveValue::CSS_PX));
        return jsStringOrNull(exec, v->cssText());
    }

    // If the property is a shorthand property (such as "padding"), 
    // it can only be accessed using getPropertyValue.

    // Make the SVG 'filter' attribute undetectable, to avoid confusion with the IE 'filter' attribute.
    if (propertyName == "filter")
        return StringObjectThatMasqueradesAsUndefined::create(exec, thisObj->impl()->getPropertyValue(prop));

    return jsString(exec, thisObj->impl()->getPropertyValue(prop));
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:29,代码来源:JSCSSStyleDeclarationCustom.cpp

示例2: getOwnPropertyNames

void JSCSSStyleDeclaration::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
    JSCSSStyleDeclaration* thisObject = jsCast<JSCSSStyleDeclaration*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());

    unsigned length = thisObject->impl()->length();
    for (unsigned i = 0; i < length; ++i)
        propertyNames.add(Identifier::from(exec, i));

    static Identifier* propertyIdentifiers = 0;
    if (!propertyIdentifiers) {
        Vector<String, numCSSProperties> jsPropertyNames;
        for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id)
            jsPropertyNames.append(getJSPropertyName(static_cast<CSSPropertyID>(id)));
        sort(jsPropertyNames.begin(), jsPropertyNames.end(), WTF::codePointCompareLessThan);

        propertyIdentifiers = new Identifier[numCSSProperties];
        for (int i = 0; i < numCSSProperties; ++i)
            propertyIdentifiers[i] = Identifier(exec, jsPropertyNames[i].impl());
    }

    for (int i = 0; i < numCSSProperties; ++i)
        propertyNames.add(propertyIdentifiers[i]);

    Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:26,代码来源:JSCSSStyleDeclarationCustom.cpp

示例3: jsCSSStyleDeclarationParentRule

JSValue jsCSSStyleDeclarationParentRule(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentRule()));
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSCSSStyleDeclaration.cpp

示例4: jsCSSStyleDeclarationCssText

JSValue jsCSSStyleDeclarationCssText(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl());
    JSValue result = jsStringOrNull(exec, imp->cssText());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSCSSStyleDeclaration.cpp

示例5: jsCSSStyleDeclarationLength

JSValue jsCSSStyleDeclarationLength(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl());
    JSValue result = jsNumber(imp->length());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSCSSStyleDeclaration.cpp

示例6: isReachableFromOpaqueRoots

bool JSCSSStyleDeclarationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSCSSStyleDeclaration* jsCSSStyleDeclaration = static_cast<JSCSSStyleDeclaration*>(handle.get().asCell());
    if (!isObservable(jsCSSStyleDeclaration))
        return false;
    void* root = WebCore::root(jsCSSStyleDeclaration->impl());
    return visitor.containsOpaqueRoot(root);
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSCSSStyleDeclaration.cpp

示例7: jsCSSStyleDeclarationPrototypeFunctionGetPropertyCSSValue

EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionGetPropertyCSSValue(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info))
        return throwVMTypeError(exec);
    JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue));
    return JSValue::encode(castedThis->getPropertyCSSValue(exec));
}
开发者ID:13W,项目名称:phantomjs,代码行数:8,代码来源:JSCSSStyleDeclaration.cpp

示例8: setJSCSSStyleDeclarationCssText

void setJSCSSStyleDeclarationCssText(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(thisObject);
    CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl());
    ExceptionCode ec = 0;
    imp->setCssText(valueToStringWithNullCheck(exec, value), ec);
    setDOMException(exec, ec);
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSCSSStyleDeclaration.cpp

示例9: visitChildren

void JSCSSStyleDeclaration::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSCSSStyleDeclaration* thisObject = jsCast<JSCSSStyleDeclaration*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(thisObject, visitor);
    visitor.addOpaqueRoot(root(thisObject->impl()));
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:9,代码来源:JSCSSStyleDeclarationCustom.cpp

示例10: jsCSSStyleDeclarationPrototypeFunctionIsPropertyImplicit

EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionIsPropertyImplicit(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());
    const String& propertyName(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsBoolean(imp->isPropertyImplicit(propertyName));
    return JSValue::encode(result);
}
开发者ID:13W,项目名称:phantomjs,代码行数:15,代码来源:JSCSSStyleDeclaration.cpp

示例11: jsCSSStyleDeclarationPrototypeFunctionItem

EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionItem(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());
    unsigned index(exec->argument(0).toUInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsString(exec, imp->item(index));
    return JSValue::encode(result);
}
开发者ID:13W,项目名称:phantomjs,代码行数:15,代码来源:JSCSSStyleDeclaration.cpp

示例12: jsCSSStyleDeclarationPrototypeFunctionGetPropertyShorthand

EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionGetPropertyShorthand(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info))
        return throwVMTypeError(exec);
    JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSCSSStyleDeclaration::s_info);
    CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl());
    const String& propertyName(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsStringOrNull(exec, imp->getPropertyShorthand(propertyName));
    return JSValue::encode(result);
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:16,代码来源:JSCSSStyleDeclaration.cpp

示例13: jsCSSStyleDeclarationPrototypeFunctionSetProperty

EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionSetProperty(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());
    const String& value(valueToStringWithNullCheck(exec, exec->argument(1)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& priority(ustringToString(exec->argument(2).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->setProperty(propertyName, value, priority, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
开发者ID:13W,项目名称:phantomjs,代码行数:22,代码来源:JSCSSStyleDeclaration.cpp

示例14: nameGetter

JSValue JSCSSStyleDeclaration::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
    JSCSSStyleDeclaration* thisObj = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase));

    // Set up pixelOrPos boolean to handle the fact that
    // pixelTop returns "CSS Top" as number value in unit pixels
    // posTop returns "CSS top" as number value in unit pixels _if_ its a
    // positioned element. if it is not a positioned element, return 0
    // from MSIE documentation FIXME: IMPLEMENT THAT (Dirk)
    bool pixelOrPos;
    String prop = cssPropertyName(propertyName, &pixelOrPos);
    RefPtr<CSSValue> v = thisObj->impl()->getPropertyCSSValue(prop);
    if (v) {
        if (pixelOrPos && v->isPrimitiveValue())
            return jsNumber(static_pointer_cast<CSSPrimitiveValue>(v)->getFloatValue(CSSPrimitiveValue::CSS_PX));
        return jsStringOrNull(exec, v->cssText());
    }

    // If the property is a shorthand property (such as "padding"), 
    // it can only be accessed using getPropertyValue.

    return jsString(exec, thisObj->impl()->getPropertyValue(prop));
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:23,代码来源:JSCSSStyleDeclarationCustom.cpp

示例15: jsCSSStyleDeclarationConstructor

JSValue jsCSSStyleDeclarationConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSCSSStyleDeclaration* domObject = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase));
    return JSCSSStyleDeclaration::getConstructor(exec, domObject->globalObject());
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:5,代码来源:JSCSSStyleDeclaration.cpp


注:本文中的JSCSSStyleDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。