本文整理汇总了C++中AtomicString::string方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString::string方法的具体用法?C++ AtomicString::string怎么用?C++ AtomicString::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomicString
的用法示例。
在下文中一共展示了AtomicString::string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TextBreakIteratorICU
static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBackingIterator(StringView string, TextBreakIterator::Mode mode, const AtomicString& locale)
{
switch (mode) {
case TextBreakIterator::Mode::Line:
return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data());
case TextBreakIterator::Mode::Caret:
return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
case TextBreakIterator::Mode::Delete:
return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
default:
ASSERT_NOT_REACHED();
return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
}
}
示例2: tokenizeRelAttribute
void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& relStr, bool& styleSheet, bool& alternate, bool& icon)
{
styleSheet = false;
icon = false;
alternate = false;
String rel = relStr.string().lower();
if (rel == "stylesheet")
styleSheet = true;
else if (rel == "icon" || rel == "shortcut icon")
icon = true;
else if (rel == "alternate stylesheet" || rel == "stylesheet alternate") {
styleSheet = true;
alternate = true;
} else {
// Tokenize the rel attribute and set bits based on specific keywords that we find.
rel.replace('\n', ' ');
Vector<String> list;
rel.split(' ', list);
Vector<String>::const_iterator end = list.end();
for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) {
if (*it == "stylesheet")
styleSheet = true;
else if (*it == "alternate")
alternate = true;
else if (*it == "icon")
icon = true;
}
}
}
示例3: parseAttribute
void SVGAnimationElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!isSupportedAttribute(name)) {
SVGSMILElement::parseAttribute(name, value);
return;
}
if (name == SVGNames::valuesAttr) {
// Per the SMIL specification, leading and trailing white space,
// and white space before and after semicolon separators, is allowed and will be ignored.
// http://www.w3.org/TR/SVG11/animate.html#ValuesAttribute
value.string().split(';', m_values);
for (unsigned i = 0; i < m_values.size(); ++i)
m_values[i] = m_values[i].stripWhiteSpace();
updateAnimationMode();
return;
}
if (name == SVGNames::keyTimesAttr) {
parseKeyTimes(value, m_keyTimes, true);
return;
}
if (name == SVGNames::keyPointsAttr) {
if (hasTagName(SVGNames::animateMotionTag)) {
// This is specified to be an animateMotion attribute only but it is simpler to put it here
// where the other timing calculatations are.
parseKeyTimes(value, m_keyPoints, false);
}
return;
}
if (name == SVGNames::keySplinesAttr) {
parseKeySplines(value, m_keySplines);
return;
}
if (name == SVGNames::attributeTypeAttr) {
setAttributeType(value);
return;
}
if (name == SVGNames::calcModeAttr) {
setCalcMode(value);
return;
}
if (name == SVGNames::fromAttr || name == SVGNames::toAttr || name == SVGNames::byAttr) {
updateAnimationMode();
return;
}
if (SVGTests::parseAttribute(name, value))
return;
if (SVGExternalResourcesRequired::parseAttribute(name, value))
return;
ASSERT_NOT_REACHED();
}
示例4: parseAttribute
void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == relAttr) {
m_relAttribute = LinkRelAttribute(value);
process();
} else if (name == hrefAttr) {
String url = stripLeadingAndTrailingHTMLSpaces(value);
m_url = url.isEmpty() ? KURL() : document()->completeURL(url);
process();
} else if (name == typeAttr) {
m_type = value;
process();
} else if (name == sizesAttr) {
setSizes(value);
process();
} else if (name == mediaAttr) {
m_media = value.string().lower();
process();
} else if (name == disabledAttr)
setDisabledState(!value.isNull());
else if (name == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
else if (name == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, name, value));
else if (name == onerrorAttr)
setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, name, value));
else {
if (name == titleAttr && m_sheet)
m_sheet->setTitle(value);
HTMLElement::parseAttribute(name, value);
}
}
示例5: parseAttribute
void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
bool invalidateRenderer = false;
if (name == formAttr)
formAttributeChanged();
else if (name == typeAttr) {
m_serviceType = value.string().left(value.find(';')).convertToASCIILowercase();
invalidateRenderer = !fastHasAttribute(classidAttr);
setNeedsWidgetUpdate(true);
} else if (name == dataAttr) {
m_url = stripLeadingAndTrailingHTMLSpaces(value);
document().updateStyleIfNeeded();
if (isImageType() && renderer()) {
if (!m_imageLoader)
m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
m_imageLoader->updateFromElementIgnoringPreviousError();
}
invalidateRenderer = !fastHasAttribute(classidAttr);
setNeedsWidgetUpdate(true);
} else if (name == classidAttr) {
invalidateRenderer = true;
setNeedsWidgetUpdate(true);
} else
HTMLPlugInImageElement::parseAttribute(name, value);
if (!invalidateRenderer || !inDocument() || !renderer())
return;
clearUseFallbackContent();
setNeedsStyleRecalc(ReconstructRenderTree);
}
示例6: parseAttribute
void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == relAttr) {
m_relAttribute = LinkRelAttribute(value);
process();
} else if (name == hrefAttr) {
process();
} else if (name == typeAttr) {
m_type = value;
process();
} else if (name == sizesAttr) {
setSizes(value);
process();
} else if (name == mediaAttr) {
m_media = value.string().lower();
process();
} else if (name == disabledAttr)
setDisabledState(!value.isNull());
else if (name == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
else {
if (name == titleAttr && m_sheet)
m_sheet->setTitle(value);
HTMLElement::parseAttribute(name, value);
}
}
示例7: parseAttribute
void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == relAttr) {
m_relAttribute = LinkRelAttribute(value);
process();
} else if (name == hrefAttr) {
process();
} else if (name == typeAttr) {
m_type = value;
process();
} else if (name == sizesAttr) {
m_sizes->setValue(value);
process();
} else if (name == mediaAttr) {
m_media = value.string().lower();
process();
} else if (name == disabledAttr) {
if (LinkStyle* link = linkStyle())
link->setDisabledState(!value.isNull());
} else if (name == onbeforeloadAttr)
setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
else {
if (name == titleAttr) {
if (LinkStyle* link = linkStyle())
link->setSheetTitle(value);
}
HTMLElement::parseAttribute(name, value);
}
}
示例8: setAttribute
void Element::setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode& ec)
{
if (!Document::isValidName(name)) {
ec = INVALID_CHARACTER_ERR;
return;
}
const AtomicString& localName = (shouldIgnoreAttributeCase(this) && !name.string().impl()->isLower()) ? AtomicString(name.string().lower()) : name;
// allocate attributemap if necessary
Attribute* old = attributes(false)->getAttributeItem(localName, false);
document()->incDOMTreeVersion();
if (localName == idAttr.localName())
updateId(old ? old->value() : nullAtom, value);
if (old && value.isNull())
namedAttrMap->removeAttribute(old->name());
else if (!old && !value.isNull())
namedAttrMap->addAttribute(createAttribute(QualifiedName(nullAtom, localName, nullAtom), value));
else if (old && !value.isNull()) {
old->setValue(value);
attributeChanged(old);
}
}
示例9: parseAttribute
void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == formAttr)
formAttributeChanged();
else if (name == typeAttr) {
m_serviceType = value.string().left(value.find(';')).lower();
setNeedsWidgetUpdate(true);
} else if (name == dataAttr) {
m_url = stripLeadingAndTrailingHTMLSpaces(value);
setNeedsWidgetUpdate(true);
document().updateStyleIfNeeded();
if (renderer()) {
if (isImageType()) {
if (!m_imageLoader)
m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
m_imageLoader->updateFromElementIgnoringPreviousError();
}
}
} else if (name == classidAttr)
setNeedsWidgetUpdate(true);
else if (name == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, name, value);
else
HTMLPlugInImageElement::parseAttribute(name, value);
}
示例10: font
HRESULT STDMETHODCALLTYPE DOMElement::font(WebFontDescription* webFontDescription)
{
if (!webFontDescription) {
ASSERT_NOT_REACHED();
return E_POINTER;
}
ASSERT(m_element);
WebCore::RenderElement* renderer = m_element->renderer();
if (!renderer)
return E_FAIL;
FontDescription fontDescription = renderer->style().fontCascade().fontDescription();
AtomicString family = fontDescription.firstFamily();
// FIXME: This leaks. Delete this whole function to get rid of the leak.
UChar* familyCharactersBuffer = new UChar[family.length()];
StringView(family.string()).getCharactersWithUpconvert(familyCharactersBuffer);
webFontDescription->family = familyCharactersBuffer;
webFontDescription->familyLength = family.length();
webFontDescription->size = fontDescription.computedSize();
webFontDescription->bold = fontDescription.weight() >= WebCore::FontWeight600;
webFontDescription->italic = fontDescription.italic();
return S_OK;
}
示例11: tokenizeRelAttribute
void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, bool& styleSheet, bool& alternate, bool& icon, bool& dnsPrefetch)
{
styleSheet = false;
icon = false;
alternate = false;
dnsPrefetch = false;
if (equalIgnoringCase(rel, "stylesheet"))
styleSheet = true;
else if (equalIgnoringCase(rel, "icon") || equalIgnoringCase(rel, "shortcut icon"))
icon = true;
else if (equalIgnoringCase(rel, "dns-prefetch"))
dnsPrefetch = true;
else if (equalIgnoringCase(rel, "alternate stylesheet") || equalIgnoringCase(rel, "stylesheet alternate")) {
styleSheet = true;
alternate = true;
} else {
// Tokenize the rel attribute and set bits based on specific keywords that we find.
String relString = rel.string();
relString.replace('\n', ' ');
Vector<String> list;
relString.split(' ', list);
Vector<String>::const_iterator end = list.end();
for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) {
if (equalIgnoringCase(*it, "stylesheet"))
styleSheet = true;
else if (equalIgnoringCase(*it, "alternate"))
alternate = true;
else if (equalIgnoringCase(*it, "icon"))
icon = true;
}
}
}
示例12: mapLanguageAttributeToLocale
void HTMLElement::mapLanguageAttributeToLocale(const AtomicString& value, MutableStylePropertySet* style)
{
if (!value.isEmpty()) {
// Have to quote so the locale id is treated as a string instead of as a CSS keyword.
addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitLocale, quoteCSSString(value));
// FIXME: Remove the following UseCounter code when we collect enough
// data.
UseCounter::count(document(), UseCounter::LangAttribute);
if (isHTMLHtmlElement(*this))
UseCounter::count(document(), UseCounter::LangAttributeOnHTML);
else if (isHTMLBodyElement(*this))
UseCounter::count(document(), UseCounter::LangAttributeOnBody);
String htmlLanguage = value.string();
size_t firstSeparator = htmlLanguage.find('-');
if (firstSeparator != kNotFound)
htmlLanguage = htmlLanguage.left(firstSeparator);
String uiLanguage = defaultLanguage();
firstSeparator = uiLanguage.find('-');
if (firstSeparator != kNotFound)
uiLanguage = uiLanguage.left(firstSeparator);
firstSeparator = uiLanguage.find('_');
if (firstSeparator != kNotFound)
uiLanguage = uiLanguage.left(firstSeparator);
if (!equalIgnoringCase(htmlLanguage, uiLanguage))
UseCounter::count(document(), UseCounter::LangAttributeDoesNotMatchToUILocale);
} else {
// The empty string means the language is explicitly unknown.
addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitLocale, CSSValueAuto);
}
}
示例13: 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;
}
示例14: parseAttribute
void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == relAttr) {
m_relAttribute = LinkRelAttribute(value);
process();
} else if (name == hrefAttr) {
process();
} else if (name == typeAttr) {
m_type = value;
process();
} else if (name == sizesAttr) {
m_sizes->setValue(value);
parseSizesAttribute(value, m_iconSizes);
process();
} else if (name == mediaAttr) {
m_media = value.string().lower();
process();
} else if (name == disabledAttr) {
if (LinkStyle* link = linkStyle())
link->setDisabledState(!value.isNull());
} else {
if (name == titleAttr) {
if (LinkStyle* link = linkStyle())
link->setSheetTitle(value);
}
HTMLElement::parseAttribute(name, value);
}
}
示例15: canHyphenate
bool canHyphenate(const AtomicString& localeIdentifier)
{
if (localeIdentifier.isNull())
return false;
if (availableLocales().contains(localeIdentifier))
return true;
return availableLocales().contains(AtomicString(localeIdentifier.string().convertToASCIILowercase()));
}