本文整理汇总了C++中Quad::top方法的典型用法代码示例。如果您正苦于以下问题:C++ Quad::top方法的具体用法?C++ Quad::top怎么用?C++ Quad::top使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quad
的用法示例。
在下文中一共展示了Quad::top方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapNinePieceImageSlice
void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, CSSValue* value, NinePieceImage& image)
{
if (!value || !value->isBorderImageSliceValue())
return;
// Retrieve the border image value.
CSSBorderImageSliceValue* borderImageSlice = toCSSBorderImageSliceValue(value);
// Set up a length box to represent our image slices.
LengthBox box;
Quad* slices = borderImageSlice->slices();
if (slices->top()->isPercentage())
box.m_top = Length(slices->top()->getDoubleValue(), Percent);
else
box.m_top = Length(slices->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->bottom()->isPercentage())
box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent);
else
box.m_bottom = Length((int)slices->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->left()->isPercentage())
box.m_left = Length(slices->left()->getDoubleValue(), Percent);
else
box.m_left = Length(slices->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->right()->isPercentage())
box.m_right = Length(slices->right()->getDoubleValue(), Percent);
else
box.m_right = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
image.setImageSlices(box);
// Set our fill mode.
image.setFill(borderImageSlice->m_fill);
}
示例2: mapNinePieceImageSlice
void CSSToStyleMap::mapNinePieceImageSlice(CSSValue& value, NinePieceImage& image)
{
if (!is<CSSBorderImageSliceValue>(value))
return;
// Retrieve the border image value.
auto& borderImageSlice = downcast<CSSBorderImageSliceValue>(value);
// Set up a length box to represent our image slices.
LengthBox box;
Quad* slices = borderImageSlice.slices();
if (slices->top()->isPercentage())
box.top() = Length(slices->top()->getDoubleValue(), Percent);
else
box.top() = Length(slices->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->bottom()->isPercentage())
box.bottom() = Length(slices->bottom()->getDoubleValue(), Percent);
else
box.bottom() = Length((int)slices->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->left()->isPercentage())
box.left() = Length(slices->left()->getDoubleValue(), Percent);
else
box.left() = Length(slices->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->right()->isPercentage())
box.right() = Length(slices->right()->getDoubleValue(), Percent);
else
box.right() = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
image.setImageSlices(box);
// Set our fill mode.
image.setFill(borderImageSlice.m_fill);
}
示例3: mapNinePieceImageQuad
BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(StyleResolverState& state, CSSValue* value)
{
if (!value || !value->isPrimitiveValue())
return BorderImageLengthBox(Length(Auto));
Quad* slices = toCSSPrimitiveValue(value)->getQuadValue();
// Set up a border image length box to represent our image slices.
return BorderImageLengthBox(
toBorderImageLength(*slices->top(), state.cssToLengthConversionData()),
toBorderImageLength(*slices->right(), state.cssToLengthConversionData()),
toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData()),
toBorderImageLength(*slices->left(), state.cssToLengthConversionData()));
}
示例4: mapNinePieceImageQuad
BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) const
{
if (!value || !value->isPrimitiveValue())
return BorderImageLengthBox(Length(Auto));
float zoom = useSVGZoomRules() ? 1.0f : cssToLengthConversionData().zoom();
Quad* slices = toCSSPrimitiveValue(value)->getQuadValue();
// Set up a border image length box to represent our image slices.
const CSSToLengthConversionData& conversionData = cssToLengthConversionData().copyWithAdjustedZoom(zoom);
return BorderImageLengthBox(
toBorderImageLength(*slices->top(), conversionData),
toBorderImageLength(*slices->right(), conversionData),
toBorderImageLength(*slices->bottom(), conversionData),
toBorderImageLength(*slices->left(), conversionData));
}
示例5: mapNinePieceImageQuad
LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value)
{
if (!is<CSSPrimitiveValue>(value))
return LengthBox();
// Get our zoom value.
CSSToLengthConversionData conversionData = useSVGZoomRules() ? m_resolver->state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f) : m_resolver->state().cssToLengthConversionData();
// Retrieve the primitive value.
CSSPrimitiveValue& borderWidths = downcast<CSSPrimitiveValue>(*value);
// Set up a length box to represent our image slices.
LengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below.
Quad* slices = borderWidths.getQuadValue();
if (slices->top()->isNumber())
box.m_top = Length(slices->top()->getIntValue(), Relative);
else if (slices->top()->isPercentage())
box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->top()->getValueID() != CSSValueAuto)
box.m_top = slices->top()->computeLength<Length>(conversionData);
if (slices->right()->isNumber())
box.m_right = Length(slices->right()->getIntValue(), Relative);
else if (slices->right()->isPercentage())
box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->right()->getValueID() != CSSValueAuto)
box.m_right = slices->right()->computeLength<Length>(conversionData);
if (slices->bottom()->isNumber())
box.m_bottom = Length(slices->bottom()->getIntValue(), Relative);
else if (slices->bottom()->isPercentage())
box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->bottom()->getValueID() != CSSValueAuto)
box.m_bottom = slices->bottom()->computeLength<Length>(conversionData);
if (slices->left()->isNumber())
box.m_left = Length(slices->left()->getIntValue(), Relative);
else if (slices->left()->isPercentage())
box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->left()->getValueID() != CSSValueAuto)
box.m_left = slices->left()->computeLength<Length>(conversionData);
return box;
}
示例6: mapNinePieceImageQuad
LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value)
{
if (!value || !value->isPrimitiveValue())
return LengthBox();
// Get our zoom value.
float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom();
// Retrieve the primitive value.
CSSPrimitiveValue* borderWidths = static_cast<CSSPrimitiveValue*>(value);
// Set up a length box to represent our image slices.
LengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below.
Quad* slices = borderWidths->getQuadValue();
if (slices->top()->isNumber())
box.m_top = Length(slices->top()->getIntValue(), Relative);
else if (slices->top()->isPercentage())
box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->top()->getValueID() != CSSValueAuto)
box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom);
if (slices->right()->isNumber())
box.m_right = Length(slices->right()->getIntValue(), Relative);
else if (slices->right()->isPercentage())
box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->right()->getValueID() != CSSValueAuto)
box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom);
if (slices->bottom()->isNumber())
box.m_bottom = Length(slices->bottom()->getIntValue(), Relative);
else if (slices->bottom()->isPercentage())
box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->bottom()->getValueID() != CSSValueAuto)
box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom);
if (slices->left()->isNumber())
box.m_left = Length(slices->left()->getIntValue(), Relative);
else if (slices->left()->isPercentage())
box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else if (slices->left()->getValueID() != CSSValueAuto)
box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom);
return box;
}
示例7: customCssText
//.........这里部分代码省略.........
break;
case CSS_COUNTER: {
DEFINE_STATIC_LOCAL(const String, counterParen, ("counter("));
DEFINE_STATIC_LOCAL(const String, countersParen, ("counters("));
DEFINE_STATIC_LOCAL(const String, commaSpace, (", "));
StringBuilder result;
String separator = m_value.counter->separator();
result.append(separator.isEmpty() ? counterParen : countersParen);
result.append(m_value.counter->identifier());
if (!separator.isEmpty()) {
result.append(commaSpace);
result.append(quoteCSSStringIfNeeded(separator));
}
String listStyle = m_value.counter->listStyle();
if (!listStyle.isEmpty()) {
result.append(commaSpace);
result.append(listStyle);
}
result.append(')');
text = result.toString();
break;
}
case CSS_RECT: {
DEFINE_STATIC_LOCAL(const String, rectParen, ("rect("));
Rect* rectVal = getRectValue();
StringBuilder result;
result.reserveCapacity(32);
result.append(rectParen);
result.append(rectVal->top()->cssText());
result.append(' ');
result.append(rectVal->right()->cssText());
result.append(' ');
result.append(rectVal->bottom()->cssText());
result.append(' ');
result.append(rectVal->left()->cssText());
result.append(')');
text = result.toString();
break;
}
case CSS_QUAD: {
Quad* quadVal = getQuadValue();
Vector<UChar> result;
result.reserveInitialCapacity(32);
append(result, quadVal->top()->cssText());
if (quadVal->right() != quadVal->top() || quadVal->bottom() != quadVal->top() || quadVal->left() != quadVal->top()) {
result.append(' ');
append(result, quadVal->right()->cssText());
if (quadVal->bottom() != quadVal->top() || quadVal->right() != quadVal->left()) {
result.append(' ');
append(result, quadVal->bottom()->cssText());
if (quadVal->left() != quadVal->right()) {
result.append(' ');
append(result, quadVal->left()->cssText());
}
}
}
text = String::adopt(result);