本文整理汇总了C++中MutableStyleProperties类的典型用法代码示例。如果您正苦于以下问题:C++ MutableStyleProperties类的具体用法?C++ MutableStyleProperties怎么用?C++ MutableStyleProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MutableStyleProperties类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectStyleForPresentationAttribute
void HTMLPreElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
{
if (name == wrapAttr)
style.setProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例2: collectStyleForPresentationAttribute
void HTMLTableElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
{
if (name == widthAttr)
addHTMLLengthToStyle(style, CSSPropertyWidth, value);
else if (name == heightAttr)
addHTMLLengthToStyle(style, CSSPropertyHeight, value);
else if (name == borderAttr)
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(value), CSSPrimitiveValue::CSS_PX);
else if (name == bordercolorAttr) {
if (!value.isEmpty())
addHTMLColorToStyle(style, CSSPropertyBorderColor, value);
} else if (name == bgcolorAttr)
addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value);
else if (name == backgroundAttr) {
String url = stripLeadingAndTrailingHTMLSpaces(value);
if (!url.isEmpty())
style.setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageValue::create(document().completeURL(url).string())));
} else if (name == valignAttr) {
if (!value.isEmpty())
addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, value);
} else if (name == cellspacingAttr) {
if (!value.isEmpty())
addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, value);
} else if (name == vspaceAttr) {
addHTMLLengthToStyle(style, CSSPropertyMarginTop, value);
addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value);
} else if (name == hspaceAttr) {
addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value);
addHTMLLengthToStyle(style, CSSPropertyMarginRight, value);
} else if (name == alignAttr) {
if (!value.isEmpty()) {
if (equalIgnoringCase(value, "center")) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitMarginStart, CSSValueAuto);
addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitMarginEnd, CSSValueAuto);
} else
addPropertyToPresentationAttributeStyle(style, CSSPropertyFloat, value);
}
} else if (name == rulesAttr) {
// The presence of a valid rules attribute causes border collapsing to be enabled.
if (m_rulesAttr != UnsetRules)
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderCollapse, CSSValueCollapse);
} else if (name == frameAttr) {
bool borderTop;
bool borderRight;
bool borderBottom;
bool borderLeft;
if (getBordersFromFrameAttributeValue(value, borderTop, borderRight, borderBottom, borderLeft)) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, CSSValueThin);
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderTopStyle, borderTop ? CSSValueSolid : CSSValueHidden);
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomStyle, borderBottom ? CSSValueSolid : CSSValueHidden);
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderLeftStyle, borderLeft ? CSSValueSolid : CSSValueHidden);
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderRightStyle, borderRight ? CSSValueSolid : CSSValueHidden);
}
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例3: parseValue
CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties& declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
{
ASSERT(!string.isEmpty());
RefPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(propertyID, string, context.mode);
if (value)
return declaration.addParsedProperty(CSSProperty(propertyID, WTFMove(value), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged;
CSSParser parser(context);
return parser.parseValue(declaration, propertyID, string, important);
}
示例4: collectStyleForPresentationAttribute
void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
{
if (name == alignAttr) {
if (equalLettersIgnoringASCIICase(value, "left")) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSPrimitiveValue::CSS_PX);
addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
} else if (equalLettersIgnoringASCIICase(value, "right")) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, 0, CSSPrimitiveValue::CSS_PX);
} else {
addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
}
} else if (name == widthAttr) {
bool ok;
int v = value.toInt(&ok);
if (ok && !v)
addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 1, CSSPrimitiveValue::CSS_PX);
else
addHTMLLengthToStyle(style, CSSPropertyWidth, value);
} else if (name == colorAttr) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
addHTMLColorToStyle(style, CSSPropertyBorderColor, value);
addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value);
} else if (name == noshadeAttr) {
if (!hasAttributeWithoutSynchronization(colorAttr)) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
RefPtr<CSSPrimitiveValue> darkGrayValue = CSSValuePool::singleton().createColorValue(Color::darkGray);
style.setProperty(CSSPropertyBorderColor, darkGrayValue);
style.setProperty(CSSPropertyBackgroundColor, darkGrayValue);
}
} else if (name == sizeAttr) {
StringImpl* si = value.impl();
int size = si->toInt();
if (size <= 1)
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomWidth, 0, CSSPrimitiveValue::CSS_PX);
else
addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, size - 2, CSSPrimitiveValue::CSS_PX);
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例5: collectStyleForPresentationAttribute
void HTMLFontElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
{
if (name == sizeAttr) {
CSSValueID size = CSSValueInvalid;
if (cssValueFromFontSizeNumber(value, size))
addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, size);
} else if (name == colorAttr)
addHTMLColorToStyle(style, CSSPropertyColor, value);
else if (name == faceAttr) {
if (RefPtr<CSSValueList> fontFaceValue = cssValuePool().createFontFaceValue(value))
style.setProperty(CSSProperty(CSSPropertyFontFamily, fontFaceValue.release()));
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例6: computeFontTraitsMask
static Optional<FontTraitsMask> computeFontTraitsMask(MutableStyleProperties& style)
{
RefPtr<CSSValue> styleValue = style.getPropertyCSSValue(CSSPropertyFontStyle).get();
if (!styleValue)
styleValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
FontTraitsMask styleMask;
if (auto styleMaskOptional = CSSFontFace::calculateStyleMask(*styleValue))
styleMask = styleMaskOptional.value();
else
return Nullopt;
RefPtr<CSSValue> weightValue = style.getPropertyCSSValue(CSSPropertyFontWeight).get();
if (!weightValue)
weightValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
FontTraitsMask weightMask;
if (auto weightMaskOptional = CSSFontFace::calculateWeightMask(*weightValue))
weightMask = weightMaskOptional.value();
else
return Nullopt;
return static_cast<FontTraitsMask>(static_cast<unsigned>(styleMask) | static_cast<unsigned>(weightMask));
}
示例7: collectStyleForPresentationAttribute
void HTMLTablePartElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
{
if (name == bgcolorAttr)
addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value);
else if (name == backgroundAttr) {
String url = stripLeadingAndTrailingHTMLSpaces(value);
if (!url.isEmpty())
style.setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageValue::create(document().completeURL(url).string())));
} else if (name == valignAttr) {
if (equalIgnoringCase(value, "top"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueTop);
else if (equalIgnoringCase(value, "middle"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueMiddle);
else if (equalIgnoringCase(value, "bottom"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBottom);
else if (equalIgnoringCase(value, "baseline"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBaseline);
else
addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, value);
} else if (name == alignAttr) {
if (equalIgnoringCase(value, "middle") || equalIgnoringCase(value, "center"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
else if (equalIgnoringCase(value, "absmiddle"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter);
else if (equalIgnoringCase(value, "left"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
else if (equalIgnoringCase(value, "right"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
else
addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value);
} else if (name == heightAttr) {
if (!value.isEmpty())
addHTMLLengthToStyle(style, CSSPropertyHeight, value);
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例8: addPropertyToPresentationAttributeStyle
void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, const String& value)
{
style.setProperty(propertyID, value, false, &document().elementSheet().contents());
}
示例9: addPropertyToPresentationAttributeStyle
void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, const String& value)
{
style.setProperty(propertyID, value, false, CSSParserContext(document()));
}