本文整理汇总了C++中AtomicString::endsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString::endsWith方法的具体用法?C++ AtomicString::endsWith怎么用?C++ AtomicString::endsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomicString
的用法示例。
在下文中一共展示了AtomicString::endsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elementPatternIndicatesHexadecimal
bool elementPatternIndicatesHexadecimal(const HTMLInputElement* inputElement)
{
if (!inputElement)
return false;
if (inputElement->fastHasAttribute(HTMLNames::patternAttr)) {
AtomicString patternAttribute = inputElement->fastGetAttribute(HTMLNames::patternAttr);
if (patternAttribute.startsWith("[0-9a-fA-F]")) {
// The pattern is for hexadecimal, make sure nothing else is permitted.
// Check if it was an exact match.
if (patternAttribute.length() == 11)
return true;
// Is the regex specifying a character count?
if (patternAttribute[11] != '{' || !patternAttribute.endsWith("}"))
return false;
int count = 0;
// Make sure the number in the regex is actually a number.
if ((sscanf(patternAttribute.string().latin1().data(), "[0-9a-fA-F]{%d}\0", &count) == 1) && count > 0)
return true;
}
}
return false;
}
示例2: parseAttribute
void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!isSupportedAttribute(name)) {
SVGElement::parseAttribute(name, value);
return;
}
if (name == SVGNames::offsetAttr) {
if (value.endsWith('%'))
setOffsetBaseValue(value.string().left(value.length() - 1).toFloat() / 100.0f);
else
setOffsetBaseValue(value.toFloat());
return;
}
ASSERT_NOT_REACHED();
}
示例3: typefacesHasStretchSuffix
static bool typefacesHasStretchSuffix(const AtomicString& family,
AtomicString& adjustedName, FontStretch& variantStretch)
{
struct FamilyStretchSuffix {
const wchar_t* suffix;
size_t length;
FontStretch stretch;
};
// Mapping from suffix to stretch value from the DirectWrite documentation.
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd368078.aspx
// Also includes Narrow as a synonym for Condensed to to support Arial
// Narrow and other fonts following the same naming scheme.
const static FamilyStretchSuffix variantForSuffix[] = {
{ L" ultracondensed", 15, FontStretchUltraCondensed },
{ L" extracondensed", 15, FontStretchExtraCondensed },
{ L" condensed", 10, FontStretchCondensed },
{ L" narrow", 7, FontStretchCondensed },
{ L" semicondensed", 14, FontStretchSemiCondensed },
{ L" semiexpanded", 13, FontStretchSemiExpanded },
{ L" expanded", 9, FontStretchExpanded },
{ L" extraexpanded", 14, FontStretchExtraExpanded },
{ L" ultraexpanded", 14, FontStretchUltraExpanded }
};
size_t numVariants = WTF_ARRAY_LENGTH(variantForSuffix);
bool caseSensitive = false;
for (size_t i = 0; i < numVariants; i++) {
const FamilyStretchSuffix& entry = variantForSuffix[i];
if (family.endsWith(entry.suffix, caseSensitive)) {
String familyName = family.string();
familyName.truncate(family.length() - entry.length);
adjustedName = AtomicString(familyName);
variantStretch = entry.stretch;
return true;
}
}
return false;
}
示例4: sourceURI
String HTMLImageLoader::sourceURI(const AtomicString& attr) const
{
#if ENABLE(DASHBOARD_SUPPORT)
Settings* settings = client()->sourceElement()->document()->settings();
if (settings && settings->usesDashboardBackwardCompatibilityMode() && attr.length() > 7 && attr.startsWith("url(\"") && attr.endsWith("\")"))
return attr.string().substring(5, attr.length() - 7);
#endif
return stripLeadingAndTrailingHTMLSpaces(attr);
}