本文整理汇总了C++中LengthSize::setHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ LengthSize::setHeight方法的具体用法?C++ LengthSize::setHeight怎么用?C++ LengthSize::setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LengthSize
的用法示例。
在下文中一共展示了LengthSize::setHeight方法的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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}