本文整理汇总了C++中TransformOperations::dependsOnBoxSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformOperations::dependsOnBoxSize方法的具体用法?C++ TransformOperations::dependsOnBoxSize怎么用?C++ TransformOperations::dependsOnBoxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformOperations
的用法示例。
在下文中一共展示了TransformOperations::dependsOnBoxSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMatrixValue
void CSSMatrix::setMatrixValue(const String& string,
ExceptionState& exceptionState) {
if (string.isEmpty())
return;
if (const CSSValue* value =
CSSParser::parseSingleValue(CSSPropertyTransform, string)) {
// Check for a "none" transform. In these cases we can use the default
// identity matrix.
if (value->isIdentifierValue() &&
(toCSSIdentifierValue(value))->getValueID() == CSSValueNone)
return;
DEFINE_STATIC_REF(ComputedStyle, initialStyle, createInitialStyle());
TransformOperations operations =
TransformBuilder::createTransformOperations(
*value, CSSToLengthConversionData(initialStyle, initialStyle,
LayoutViewItem(nullptr), 1.0f));
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
if (operations.dependsOnBoxSize())
exceptionState.throwDOMException(SyntaxError,
"The transformation depends on the box "
"size, which is not supported.");
m_matrix = TransformationMatrix::create();
operations.apply(FloatSize(0, 0), *m_matrix);
} else { // There is something there but parsing failed.
exceptionState.throwDOMException(SyntaxError,
"Failed to parse '" + string + "'.");
}
}
示例2: setMatrixValue
void CSSMatrix::setMatrixValue(const String& string, ExceptionState& exceptionState)
{
if (string.isEmpty())
return;
RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::create();
if (BisonCSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, HTMLStandardMode, 0)) {
// Convert to TransformOperations. This can fail if a property
// requires style (i.e., param uses 'ems' or 'exs')
RefPtrWillBeRawPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSPropertyWebkitTransform);
// Check for a "none" or empty transform. In these cases we can use the default identity matrix.
if (!value || (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.get()))->getValueID() == CSSValueNone))
return;
DEFINE_STATIC_REF(RenderStyle, defaultStyle, RenderStyle::createDefaultStyle());
TransformOperations operations;
if (!TransformBuilder::createTransformOperations(value.get(), CSSToLengthConversionData(defaultStyle, defaultStyle, 0, 0, 1.0f), operations)) {
exceptionState.throwDOMException(SyntaxError, "Failed to interpret '" + string + "' as a transformation operation.");
return;
}
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
if (operations.dependsOnBoxSize())
exceptionState.throwDOMException(SyntaxError, "The transformation depends on the box size, which is not supported.");
TransformationMatrix t;
operations.apply(FloatSize(0, 0), t);
// set the matrix
m_matrix = t;
} else { // There is something there but parsing failed.
exceptionState.throwDOMException(SyntaxError, "Failed to parse '" + string + "'.");
}
}
示例3: setMatrixValue
void CSSMatrix::setMatrixValue(const String& string, ExceptionState& exceptionState)
{
if (string.isEmpty())
return;
// FIXME: crbug.com/154772 - should this continue to use legacy style parsing?
if (RefPtrWillBeRawPtr<CSSValue> value = CSSParser::parseSingleValue(CSSPropertyWebkitTransform, string)) {
// Check for a "none" transform. In these cases we can use the default identity matrix.
if (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.get()))->getValueID() == CSSValueNone)
return;
// FIXME: This has a null pointer crash if we use ex units (crbug.com/414145)
DEFINE_STATIC_REF(RenderStyle, defaultStyle, RenderStyle::createDefaultStyle());
TransformOperations operations;
if (!TransformBuilder::createTransformOperations(value.get(), CSSToLengthConversionData(defaultStyle, defaultStyle, 0, 0, 1.0f), operations)) {
exceptionState.throwDOMException(SyntaxError, "Failed to interpret '" + string + "' as a transformation operation.");
return;
}
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
if (operations.dependsOnBoxSize())
exceptionState.throwDOMException(SyntaxError, "The transformation depends on the box size, which is not supported.");
TransformationMatrix t;
operations.apply(FloatSize(0, 0), t);
// set the matrix
m_matrix = t;
} else { // There is something there but parsing failed.
exceptionState.throwDOMException(SyntaxError, "Failed to parse '" + string + "'.");
}
}