本文整理汇总了C++中StylePropertyShorthand::length方法的典型用法代码示例。如果您正苦于以下问题:C++ StylePropertyShorthand::length方法的具体用法?C++ StylePropertyShorthand::length怎么用?C++ StylePropertyShorthand::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StylePropertyShorthand
的用法示例。
在下文中一共展示了StylePropertyShorthand::length方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isPropertyShorthandAvailable
bool StylePropertySerializer::isPropertyShorthandAvailable(const StylePropertyShorthand& shorthand) const
{
ASSERT(shorthand.length() > 0);
for (unsigned i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value || (value->isInitialValue() && !value->isImplicitInitialValue()) || value->isInheritedValue())
return false;
}
return true;
}
示例2: shorthandIsImportant
bool StylePropertySet::shorthandIsImportant(CSSPropertyID propertyID) const
{
StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
if (!shorthand.length())
return false;
for (unsigned i = 0; i < shorthand.length(); ++i) {
if (!propertyIsImportant(shorthand.properties()[i]))
return false;
}
return true;
}
示例3: setProperty
void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> prpValue, bool important)
{
StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
if (!shorthand.length()) {
setProperty(CSSProperty(propertyID, prpValue, important));
return;
}
removePropertiesInSet(shorthand.properties(), shorthand.length());
RefPtrWillBeRawPtr<CSSValue> value = prpValue;
for (unsigned i = 0; i < shorthand.length(); ++i)
m_propertyVector.append(CSSProperty(shorthand.properties()[i], value, important));
}
示例4: removeShorthandProperty
bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
{
StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
if (!shorthand.length())
return false;
bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length());
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID);
if (prefixingVariant == propertyID)
return ret;
StylePropertyShorthand shorthandPrefixingVariant = shorthandForProperty(prefixingVariant);
return removePropertiesInSet(shorthandPrefixingVariant.properties(), shorthandPrefixingVariant.length());
}
示例5: shorthandHasOnlyInitialOrInheritedValue
bool StylePropertySerializer::shorthandHasOnlyInitialOrInheritedValue(const StylePropertyShorthand& shorthand) const
{
ASSERT(shorthand.length() > 0);
bool isInitialValue = true;
bool isInheritedValue = true;
for (unsigned i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
if (!value)
return false;
if (!value->isInitialValue())
isInitialValue = false;
if (!value->isInheritedValue())
isInheritedValue = false;
}
return isInitialValue || isInheritedValue;
}
示例6: resolveAndApplyVariableReferences
void CSSVariableResolver::resolveAndApplyVariableReferences(StyleResolverState& state, CSSPropertyID id, const CSSVariableReferenceValue& value)
{
CSSVariableResolver resolver(state.style()->variables());
Vector<CSSParserToken> tokens;
if (resolver.resolveTokenRange(value.variableDataValue()->tokens(), tokens)) {
CSSParserContext context(HTMLStandardMode, 0);
HeapVector<CSSProperty, 256> parsedProperties;
// TODO: Non-shorthands should just call CSSPropertyParser::parseSingleValue
if (CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens), context, parsedProperties, StyleRule::RuleType::Style)) {
unsigned parsedPropertiesCount = parsedProperties.size();
for (unsigned i = 0; i < parsedPropertiesCount; ++i)
StyleBuilder::applyProperty(parsedProperties[i].id(), state, parsedProperties[i].value());
return;
}
}
RawPtr<CSSUnsetValue> unset = cssValuePool().createUnsetValue();
if (isShorthandProperty(id)) {
StylePropertyShorthand shorthand = shorthandForProperty(id);
for (unsigned i = 0; i < shorthand.length(); i++)
StyleBuilder::applyProperty(shorthand.properties()[i], state, unset.get());
return;
}
StyleBuilder::applyProperty(id, state, unset.get());
}
示例7: getCommonValue
// only returns a non-null value if all properties have the same, non-null value
String StylePropertySerializer::getCommonValue(const StylePropertyShorthand& shorthand) const
{
String res;
for (unsigned i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.properties()[i]);
// FIXME: CSSInitialValue::cssText should generate the right value.
if (!value)
return String();
String text = value->cssText();
if (text.isNull())
return String();
if (res.isNull())
res = text;
else if (res != text)
return String();
}
return res;
}