本文整理汇总了C++中AtomicString::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString::isEmpty方法的具体用法?C++ AtomicString::isEmpty怎么用?C++ AtomicString::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomicString
的用法示例。
在下文中一共展示了AtomicString::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
void SVGFilterBuilder::add(const AtomicString& id, RefPtr<FilterEffect> effect)
{
if (id.isEmpty()) {
m_lastEffect = effect;
return;
}
if (m_builtinEffects.contains(id))
return;
m_lastEffect = effect;
m_namedEffects.set(id, m_lastEffect);
}
示例2: getURLForImageElement
static URL getURLForImageElement(Element& element)
{
// FIXME: Later this code should be shared with Chromium somehow. Chances are all platforms want it.
AtomicString urlString;
if (isHTMLImageElement(element) || isHTMLInputElement(element))
urlString = element.getAttribute(HTMLNames::srcAttr);
else if (element.hasTagName(SVGNames::imageTag))
urlString = element.getAttribute(XLinkNames::hrefAttr);
else if (element.hasTagName(HTMLNames::embedTag) || isHTMLObjectElement(element))
urlString = element.imageSourceURL();
return urlString.isEmpty() ? URL() : element.document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
}
示例3: updateFromElement
void ImageLoader::updateFromElement()
{
// If we're not making renderers for the page, then don't load images. We don't want to slow
// down the raw HTML parsing case by loading images we don't intend to display.
Element* elem = element();
Document* doc = elem->document();
if (!doc->renderer())
return;
AtomicString attr = elem->getAttribute(elem->imageSourceAttributeName());
if (attr == m_failedLoadURL)
return;
// Do not load any image if the 'src' attribute is missing or if it is
// an empty string referring to a local file. The latter condition is
// a quirk that preserves old behavior that Dashboard widgets
// need (<rdar://problem/5994621>).
CachedImage* newImage = 0;
if (!(attr.isNull() || attr.isEmpty() && doc->baseURI().isLocalFile())) {
if (m_loadManually) {
doc->docLoader()->setAutoLoadImages(false);
newImage = new CachedImage(sourceURI(attr));
newImage->setLoading(true);
newImage->setDocLoader(doc->docLoader());
doc->docLoader()->m_documentResources.set(newImage->url(), newImage);
} else
newImage = doc->docLoader()->requestImage(sourceURI(attr));
// If we do not have an image here, it means that a cross-site
// violation occurred.
m_failedLoadURL = !newImage ? attr : AtomicString();
}
CachedImage* oldImage = m_image.get();
if (newImage != oldImage) {
setLoadingImage(newImage);
if (newImage)
newImage->addClient(this);
if (oldImage)
oldImage->removeClient(this);
}
if (RenderObject* renderer = elem->renderer()) {
if (!renderer->isImage())
return;
static_cast<RenderImage*>(renderer)->resetAnimation();
}
}
示例4: readHTTPHeaders
const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* end)
{
m_response.clearHeaderFields();
AtomicString name;
AtomicString value;
bool sawSecWebSocketAcceptHeaderField = false;
bool sawSecWebSocketProtocolHeaderField = false;
const char* p = start;
for (; p < end; p++) {
size_t consumedLength = parseHTTPHeader(p, end - p, m_failureReason, name, value);
if (!consumedLength)
return 0;
p += consumedLength;
// Stop once we consumed an empty line.
if (name.isEmpty())
break;
// Sec-WebSocket-Extensions may be split. We parse and check the
// header value every time the header appears.
if (equalIgnoringCase("Sec-WebSocket-Extensions", name)) {
if (!m_extensionDispatcher.processHeaderValue(value)) {
m_failureReason = formatHandshakeFailureReason(m_extensionDispatcher.failureReason());
return 0;
}
} else if (equalIgnoringCase("Sec-WebSocket-Accept", name)) {
if (sawSecWebSocketAcceptHeaderField) {
m_failureReason = formatHandshakeFailureReason("'Sec-WebSocket-Accept' header must not appear more than once in a response");
return 0;
}
m_response.addHeaderField(name, value);
sawSecWebSocketAcceptHeaderField = true;
} else if (equalIgnoringCase("Sec-WebSocket-Protocol", name)) {
if (sawSecWebSocketProtocolHeaderField) {
m_failureReason = formatHandshakeFailureReason("'Sec-WebSocket-Protocol' header must not appear more than once in a response");
return 0;
}
m_response.addHeaderField(name, value);
sawSecWebSocketProtocolHeaderField = true;
} else {
m_response.addHeaderField(name, value);
}
}
String extensions = m_extensionDispatcher.acceptedExtensions();
if (!extensions.isEmpty())
m_response.addHeaderField("Sec-WebSocket-Extensions", AtomicString(extensions));
return p;
}
示例5: addPendingResource
void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element* element)
{
ASSERT(element);
if (id.isEmpty())
return;
HashMap<AtomicString, OwnPtr<SVGPendingElements> >::AddResult result = m_pendingResources.add(id, nullptr);
if (result.isNewEntry)
result.iterator->value = adoptPtr(new SVGPendingElements);
result.iterator->value->add(element);
element->setHasPendingResources();
}
示例6: appendNamespace
static void appendNamespace(Vector<UChar>& result, const AtomicString& prefix, const AtomicString& ns, HashMap<AtomicStringImpl*, AtomicStringImpl*>& namespaces)
{
if (ns.isEmpty())
return;
// Use emptyAtoms's impl() for both null and empty strings since the HashMap can't handle 0 as a key
AtomicStringImpl* pre = prefix.isEmpty() ? emptyAtom.impl() : prefix.impl();
AtomicStringImpl* foundNS = namespaces.get(pre);
if (foundNS != ns.impl()) {
namespaces.set(pre, ns.impl());
DEFINE_STATIC_LOCAL(const String, xmlns, ("xmlns"));
result.append(' ');
append(result, xmlns);
if (!prefix.isEmpty()) {
result.append(':');
append(result, prefix);
}
result.append('=');
result.append('"');
appendAttributeValue(result, ns, false);
result.append('"');
}
示例7: collectStyleForPresentationAttribute
void HTMLBRElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
{
if (name == clearAttr) {
// If the string is empty, then don't add the clear property.
// <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh
if (!value.isEmpty()) {
if (equalIgnoringCase(value, "all"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyClear, CSSValueBoth);
else
addPropertyToPresentationAttributeStyle(style, CSSPropertyClear, value);
}
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例8: collectStyleForPresentationAttribute
void HTMLFontElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* 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 && !value.isEmpty()) {
if (RefPtrWillBeRawPtr<CSSValueList> fontFaceValue = cssValuePool().createFontFaceValue(value))
style->setProperty(CSSProperty(CSSPropertyFontFamily, fontFaceValue.release()));
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
示例9: appendNamespace
void MarkupAccumulator::appendNamespace(StringBuilder& result, const AtomicString& prefix, const AtomicString& namespaceURI, Namespaces& namespaces, bool allowEmptyDefaultNS)
{
namespaces.checkConsistency();
if (namespaceURI.isEmpty()) {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-serialization-algorithm
if (allowEmptyDefaultNS && namespaces.get(emptyAtom.impl())) {
result.append(' ');
result.append(xmlnsAtom.string());
result.appendLiteral("=\"\"");
}
return;
}
// Use emptyAtoms's impl() for both null and empty strings since the HashMap can't handle 0 as a key
AtomicStringImpl* pre = prefix.isEmpty() ? emptyAtom.impl() : prefix.impl();
AtomicStringImpl* foundNS = namespaces.get(pre);
if (foundNS != namespaceURI.impl()) {
namespaces.set(pre, namespaceURI.impl());
// Add namespace to prefix pair so we can do constraint checking later.
if (inXMLFragmentSerialization() && !prefix.isEmpty())
namespaces.set(namespaceURI.impl(), pre);
// Make sure xml prefix and namespace are always known to uphold the constraints listed at http://www.w3.org/TR/xml-names11/#xmlReserved.
if (namespaceURI.impl() == XMLNames::xmlNamespaceURI.impl())
return;
result.append(' ');
result.append(xmlnsAtom.string());
if (!prefix.isEmpty()) {
result.append(':');
result.append(prefix);
}
result.append('=');
result.append('"');
appendAttributeValue(result, namespaceURI, false);
result.append('"');
}
}
示例10: checkPseudoClass
bool SelectorChecker::checkPseudoClass(const CSSSelector& selector)
{
switch (selector.pseudoType()) {
case CSSSelector::PseudoFocus:
m_matchedFocusSelector = true;
return matchesFocusPseudoClass(m_element);
case CSSSelector::PseudoHover:
m_matchedHoverSelector = true;
return m_element.hovered();
case CSSSelector::PseudoActive:
m_matchedActiveSelector = true;
return m_element.active();
case CSSSelector::PseudoLang:
{
AtomicString value = m_element.computeInheritedLanguage();
const AtomicString& argument = selector.argument();
if (value.isEmpty() || !value.startsWith(argument, false))
break;
if (value.length() != argument.length() && value[argument.length()] != '-')
break;
return true;
}
case CSSSelector::PseudoHost:
{
// We can only get here if the selector was defined in the right
// scope so we don't need to check it.
// For empty parameter case, i.e. just :host or :host().
if (!selector.selectorList())
return true;
for (const CSSSelector* current = selector.selectorList()->first(); current; current = CSSSelectorList::next(*current)) {
if (match(*current))
return true;
}
return false;
}
case CSSSelector::PseudoUnknown:
case CSSSelector::PseudoNotParsed:
case CSSSelector::PseudoUserAgentCustomElement:
return false;
}
ASSERT_NOT_REACHED();
return false;
}
示例11: saveRecentSearches
void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
{
String fileName = String("PROGDIR:Searches");
if (!name.isEmpty())
fileName = fileName + "_" + name;
FILE *file = fopen(fileName.latin1().data(), "w");
if (file) {
Vector<String>::iterator end = (Vector<String>::iterator)searchItems.end();
for (Vector<String>::iterator it = (Vector<String>::iterator)searchItems.begin(); it < end; it++)
fprintf(file, "%s\n", (*it).utf8().data());
fclose(file);
}
}
示例12: appendNamespace
void MarkupAccumulator::appendNamespace(StringBuilder& result, const AtomicString& prefix, const AtomicString& namespaceURI, Namespaces& namespaces)
{
namespaces.checkConsistency();
if (namespaceURI.isEmpty())
return;
// Use emptyAtoms's impl() for both null and empty strings since the HashMap can't handle 0 as a key
AtomicStringImpl* pre = prefix.isEmpty() ? emptyAtom.impl() : prefix.impl();
AtomicStringImpl* foundNS = namespaces.get(pre);
if (foundNS != namespaceURI.impl()) {
namespaces.set(pre, namespaceURI.impl());
result.append(' ');
result.append(xmlnsAtom.string());
if (!prefix.isEmpty()) {
result.append(':');
result.append(prefix);
}
result.append('=');
result.append('"');
appendAttributeValue(result, namespaceURI, false);
result.append('"');
}
}
示例13: setPrefix
void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec)
{
ec = 0;
checkSetPrefix(prefix, ec);
if (ec)
return;
if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI)
|| static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
ec = NAMESPACE_ERR;
return;
}
m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix);
}
示例14: addPendingResource
void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element* element)
{
ASSERT(element);
ASSERT(element->inDocument());
if (id.isEmpty())
return;
WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<SVGPendingElements>>::AddResult result = m_pendingResources.add(id, nullptr);
if (result.isNewEntry)
result.storedValue->value = adoptPtrWillBeNoop(new SVGPendingElements);
result.storedValue->value->add(element);
element->setHasPendingResources();
}
示例15: uniqueChildName
AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const
{
if (!requestedName.isEmpty() && !child(requestedName) && requestedName != "_blank")
return requestedName;
// Create a repeatable name for a child about to be added to us. The name must be
// unique within the frame tree. The string we generate includes a "path" of names
// from the root frame down to us. For this path to be unique, each set of siblings must
// contribute a unique name to the path, which can't collide with any HTML-assigned names.
// We generate this path component by index in the child list along with an unlikely
// frame name that can't be set in HTML because it collides with comment syntax.
const char framePathPrefix[] = "<!--framePath ";
const int framePathPrefixLength = 14;
const int framePathSuffixLength = 3;
// Find the nearest parent that has a frame with a path in it.
Vector<Frame*, 16> chain;
Frame* frame;
for (frame = m_thisFrame; frame; frame = frame->tree()->parent()) {
if (frame->tree()->name().startsWith(framePathPrefix))
break;
chain.append(frame);
}
String name;
name += framePathPrefix;
if (frame)
name += frame->tree()->name().domString().substring(framePathPrefixLength,
frame->tree()->name().length() - framePathPrefixLength - framePathSuffixLength);
for (int i = chain.size() - 1; i >= 0; --i) {
frame = chain[i];
name += "/";
name += frame->tree()->name();
}
// Suffix buffer has more than enough space for:
// 10 characters before the number
// a number (3 digits for the highest this gets in practice, 20 digits for the largest 64-bit integer)
// 6 characters after the number
// trailing null byte
// But we still use snprintf just to be extra-safe.
char suffix[40];
snprintf(suffix, sizeof(suffix), "/<!--frame%u-->-->", childCount());
name += suffix;
return AtomicString(name);
}