本文整理汇总了C++中StylePropertyShorthand类的典型用法代码示例。如果您正苦于以下问题:C++ StylePropertyShorthand类的具体用法?C++ StylePropertyShorthand怎么用?C++ StylePropertyShorthand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StylePropertyShorthand类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resolver
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());
}
示例2: 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;
}
示例3: shorthandForProperty
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;
}
示例4: 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;
}
示例5: 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;
}
示例6: shorthandForProperty
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());
}
示例7: resolveToPhysicalProperty
static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& shorthand)
{
if (direction == LTR) {
if (writingMode == TopToBottomWritingMode) {
// The common case. The logical and physical box sides match.
// Left = Start, Right = End, Before = Top, After = Bottom
return shorthand.properties()[logicalSide];
}
if (writingMode == BottomToTopWritingMode) {
// Start = Left, End = Right, Before = Bottom, After = Top.
switch (logicalSide) {
case StartSide:
return shorthand.properties()[LeftSide];
case EndSide:
return shorthand.properties()[RightSide];
case BeforeSide:
return shorthand.properties()[BottomSide];
default:
return shorthand.properties()[TopSide];
}
}
if (writingMode == LeftToRightWritingMode) {
// Start = Top, End = Bottom, Before = Left, After = Right.
switch (logicalSide) {
case StartSide:
return shorthand.properties()[TopSide];
case EndSide:
return shorthand.properties()[BottomSide];
case BeforeSide:
return shorthand.properties()[LeftSide];
default:
return shorthand.properties()[RightSide];
}
}
// Start = Top, End = Bottom, Before = Right, After = Left
switch (logicalSide) {
case StartSide:
return shorthand.properties()[TopSide];
case EndSide:
return shorthand.properties()[BottomSide];
case BeforeSide:
return shorthand.properties()[RightSide];
default:
return shorthand.properties()[LeftSide];
}
}
if (writingMode == TopToBottomWritingMode) {
// Start = Right, End = Left, Before = Top, After = Bottom
switch (logicalSide) {
case StartSide:
return shorthand.properties()[RightSide];
case EndSide:
return shorthand.properties()[LeftSide];
case BeforeSide:
return shorthand.properties()[TopSide];
default:
return shorthand.properties()[BottomSide];
}
}
if (writingMode == BottomToTopWritingMode) {
// Start = Right, End = Left, Before = Bottom, After = Top
switch (logicalSide) {
case StartSide:
return shorthand.properties()[RightSide];
case EndSide:
return shorthand.properties()[LeftSide];
case BeforeSide:
return shorthand.properties()[BottomSide];
default:
return shorthand.properties()[TopSide];
}
}
if (writingMode == LeftToRightWritingMode) {
// Start = Bottom, End = Top, Before = Left, After = Right
switch (logicalSide) {
case StartSide:
return shorthand.properties()[BottomSide];
case EndSide:
return shorthand.properties()[TopSide];
case BeforeSide:
return shorthand.properties()[LeftSide];
default:
return shorthand.properties()[RightSide];
}
}
// Start = Bottom, End = Top, Before = Right, After = Left
switch (logicalSide) {
case StartSide:
return shorthand.properties()[BottomSide];
case EndSide:
return shorthand.properties()[TopSide];
case BeforeSide:
return shorthand.properties()[RightSide];
//.........这里部分代码省略.........