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


C++ LengthSize::setWidth方法代码示例

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


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

示例1: convertToLengthSize

static inline bool convertToLengthSize(const CSSPrimitiveValue& primitiveValue, CSSToLengthConversionData conversionData, LengthSize& size)
{
    if (auto* pair = primitiveValue.getPairValue()) {
        size.setWidth(pair->first()->convertToLength<AnyConversion>(conversionData));
        size.setHeight(pair->second()->convertToLength<AnyConversion>(conversionData));
    } else
        size.setWidth(primitiveValue.convertToLength<AnyConversion>(conversionData));

    return !size.width().isUndefined() && !size.height().isUndefined();
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:10,代码来源:CSSToStyleMap.cpp

示例2: mapFillSize

void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
    if (!value->isPrimitiveValue()) {
        layer->setSizeType(SizeNone);
        return;
    }

    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
    if (primitiveValue->getValueID() == CSSValueContain)
        layer->setSizeType(Contain);
    else if (primitiveValue->getValueID() == CSSValueCover)
        layer->setSizeType(Cover);
    else
        layer->setSizeType(SizeLength);

    LengthSize b = FillLayer::initialFillSizeLength(layer->type());

    if (value->isInitialValue() || primitiveValue->getValueID() == CSSValueContain || primitiveValue->getValueID() == CSSValueCover) {
        layer->setSizeLength(b);
        return;
    }

    float zoomFactor = style()->effectiveZoom();

    Length firstLength;
    Length secondLength;

    if (Pair* pair = primitiveValue->getPairValue()) {
        CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first());
        CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second());
        firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
        secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
    } else {
        firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
        secondLength = Length();
    }

    if (firstLength.isUndefined() || secondLength.isUndefined())
        return;

    b.setWidth(firstLength);
    b.setHeight(secondLength);
    layer->setSizeLength(b);
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:44,代码来源:CSSToStyleMap.cpp

示例3: mapFillSize

void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
    if (!is<CSSPrimitiveValue>(*value)) {
        layer->setSizeType(SizeNone);
        return;
    }

    CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
    if (primitiveValue.getValueID() == CSSValueContain)
        layer->setSizeType(Contain);
    else if (primitiveValue.getValueID() == CSSValueCover)
        layer->setSizeType(Cover);
    else
        layer->setSizeType(SizeLength);

    LengthSize b = FillLayer::initialFillSizeLength(layer->type());

    if (value->isInitialValue() || primitiveValue.getValueID() == CSSValueContain || primitiveValue.getValueID() == CSSValueCover) {
        layer->setSizeLength(b);
        return;
    }

    Length firstLength;
    Length secondLength;

    if (Pair* pair = primitiveValue.getPairValue()) {
        CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first());
        CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second());
        firstLength = first->convertToLength<AnyConversion>(m_resolver->state().cssToLengthConversionData());
        secondLength = second->convertToLength<AnyConversion>(m_resolver->state().cssToLengthConversionData());
    } else {
        firstLength = primitiveValue.convertToLength<AnyConversion>(m_resolver->state().cssToLengthConversionData());
        secondLength = Length();
    }

    if (firstLength.isUndefined() || secondLength.isUndefined())
        return;

    b.setWidth(firstLength);
    b.setHeight(secondLength);
    layer->setSizeLength(b);
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:42,代码来源:CSSToStyleMap.cpp

示例4: mapFillSize

void CSSToStyleMap::mapFillSize(StyleResolverState& state, FillLayer* layer, const CSSValue& value)
{
    if (value.isInitialValue()) {
        layer->setSizeType(FillLayer::initialFillSizeType(layer->type()));
        layer->setSizeLength(FillLayer::initialFillSizeLength(layer->type()));
        return;
    }

    if (!value.isPrimitiveValue() && !value.isValuePair())
        return;

    if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueContain)
        layer->setSizeType(Contain);
    else if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueCover)
        layer->setSizeType(Cover);
    else
        layer->setSizeType(SizeLength);

    LengthSize b = FillLayer::initialFillSizeLength(layer->type());

    if (value.isPrimitiveValue() && (toCSSPrimitiveValue(value).getValueID() == CSSValueContain || toCSSPrimitiveValue(value).getValueID() == CSSValueCover)) {
        layer->setSizeLength(b);
        return;
    }

    Length firstLength;
    Length secondLength;

    if (value.isValuePair()) {
        const CSSValuePair& pair = toCSSValuePair(value);
        firstLength = StyleBuilderConverter::convertLengthOrAuto(state, pair.first());
        secondLength = StyleBuilderConverter::convertLengthOrAuto(state, pair.second());
    } else {
        ASSERT(value.isPrimitiveValue());
        firstLength = StyleBuilderConverter::convertLengthOrAuto(state, value);
        secondLength = Length();
    }

    b.setWidth(firstLength);
    b.setHeight(secondLength);
    layer->setSizeLength(b);
}
开发者ID:techtonik,项目名称:chromium,代码行数:42,代码来源:CSSToStyleMap.cpp

示例5: mapFillSize

void CSSToStyleMap::mapFillSize(StyleResolverState& state, FillLayer* layer, CSSValue* value)
{
    if (value->isInitialValue()) {
        layer->setSizeType(FillLayer::initialFillSizeType(layer->type()));
        layer->setSizeLength(FillLayer::initialFillSizeLength(layer->type()));
        return;
    }

    if (!value->isPrimitiveValue())
        return;

    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
    if (primitiveValue->getValueID() == CSSValueContain)
        layer->setSizeType(Contain);
    else if (primitiveValue->getValueID() == CSSValueCover)
        layer->setSizeType(Cover);
    else
        layer->setSizeType(SizeLength);

    LengthSize b = FillLayer::initialFillSizeLength(layer->type());

    if (primitiveValue->getValueID() == CSSValueContain || primitiveValue->getValueID() == CSSValueCover) {
        layer->setSizeLength(b);
        return;
    }

    Length firstLength;
    Length secondLength;

    if (Pair* pair = primitiveValue->getPairValue()) {
        firstLength = pair->first()->convertToLength<AnyConversion>(state.cssToLengthConversionData());
        secondLength = pair->second()->convertToLength<AnyConversion>(state.cssToLengthConversionData());
    } else {
        firstLength = primitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData());
        secondLength = Length();
    }

    b.setWidth(firstLength);
    b.setHeight(secondLength);
    layer->setSizeLength(b);
}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:41,代码来源:CSSToStyleMap.cpp


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