本文整理汇总了C++中AtomicString::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString::isNull方法的具体用法?C++ AtomicString::isNull怎么用?C++ AtomicString::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomicString
的用法示例。
在下文中一共展示了AtomicString::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseAttribute
void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == hrefAttr) {
bool wasLink = isLink();
setIsLink(!value.isNull());
if (wasLink != isLink())
didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | AffectedSelectorEnabled);
if (isLink()) {
String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
if (document()->isDNSPrefetchEnabled()) {
if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//"))
prefetchDNS(document()->completeURL(parsedURL).host());
}
if (wasLink)
prefetchEventHandler()->didChangeHREF();
}
invalidateCachedVisitedLinkHash();
} else if (name == nameAttr || name == titleAttr) {
// Do nothing.
} else if (name == relAttr)
setRel(value);
else
HTMLElement::parseAttribute(name, value);
}
示例2: parseAttribute
void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (isIdAttributeName(name) || name == classAttr || name == styleAttr)
return Element::parseAttribute(name, value);
if (name == dirAttr)
dirAttributeChanged(value);
else if (name == tabindexAttr) {
int tabindex = 0;
if (value.isEmpty()) {
clearTabIndexExplicitlyIfNeeded();
if (treeScope().adjustedFocusedElement() == this) {
// We might want to call blur(), but it's dangerous to dispatch
// events here.
document().setNeedsFocusedElementCheck();
}
} else if (parseHTMLInteger(value, tabindex)) {
// Clamp tabindex to the range of 'short' to match Firefox's behavior.
setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));
}
} else {
AtomicString eventName = eventNameForAttributeName(name);
if (!eventName.isNull())
setAttributeEventListener(eventName, createAttributeEventListener(this, name, value));
}
}
示例3: loadLink
bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const AtomicString& crossOriginMode, const String& type, const KURL& href, Document& document)
{
if (relAttribute.isDNSPrefetch()) {
Settings* settings = document.settings();
// FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt
// to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>.
if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty())
prefetchDNS(href.host());
}
// FIXME(crbug.com/323096): Should take care of import.
if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && href.isValid() && document.frame()) {
if (!m_client->shouldLoadLink())
return false;
Resource::Type type = relAttribute.isLinkSubresource() ? Resource::LinkSubresource : Resource::LinkPrefetch;
FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), FetchInitiatorTypeNames::link);
if (!crossOriginMode.isNull())
linkRequest.setCrossOriginAccessControl(document.securityOrigin(), crossOriginMode);
setResource(document.fetcher()->fetchLinkResource(type, linkRequest));
}
if (const unsigned prerenderRelTypes = prerenderRelTypesFromRelAttribute(relAttribute)) {
if (!m_prerender) {
m_prerender = PrerenderHandle::create(document, this, href, prerenderRelTypes);
} else if (m_prerender->url() != href) {
m_prerender->cancel();
m_prerender = PrerenderHandle::create(document, this, href, prerenderRelTypes);
}
// TODO(gavinp): Handle changes to rel types of existing prerenders.
} else if (m_prerender) {
m_prerender->cancel();
m_prerender.clear();
}
return true;
}
示例4: ASSERT
AtomicString XMLTreeBuilder::NodeStackItem::namespaceURI(AtomicString prefix)
{
ASSERT(!prefix.isNull());
if (m_scopedNamespaces.contains(prefix))
return m_scopedNamespaces.get(prefix);
return nullAtom;
}
示例5: parseAttribute
void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == openAttr) {
bool oldValue = m_isOpen;
m_isOpen = !value.isNull();
if (m_isOpen == oldValue)
return;
// Dispatch toggle event asynchronously.
detailsToggleEventSender().cancelEvent(this);
detailsToggleEventSender().dispatchEventSoon(this);
Element* content = ensureUserAgentShadowRoot().getElementById(ShadowElementNames::detailsContent());
ASSERT(content);
if (m_isOpen)
content->removeInlineStyleProperty(CSSPropertyDisplay);
else
content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
Element* summary = ensureUserAgentShadowRoot().getElementById(ShadowElementNames::detailsSummary());
ASSERT(summary);
// FIXME: DetailsMarkerControl's RenderDetailsMarker has no concept of being updated
// without recreating it causing a repaint. Instead we should change it so we can tell
// it to toggle the open/closed triangle state and avoid reattaching the entire summary.
summary->lazyReattachIfAttached();
return;
}
HTMLElement::parseAttribute(name, value);
}
示例6: parseAttribute
void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == openAttr) {
bool oldValue = m_isOpen;
m_isOpen = !value.isNull();
if (m_isOpen == oldValue)
return;
// Dispatch toggle event asynchronously.
detailsToggleEventSender().cancelEvent(this);
detailsToggleEventSender().dispatchEventSoon(this);
Element* content = ensureClosedShadowRoot().getElementById(ShadowElementNames::detailsContent());
ASSERT(content);
if (m_isOpen)
content->removeInlineStyleProperty(CSSPropertyDisplay);
else
content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
// Invalidate the LayoutDetailsMarker in order to turn the arrow signifying if the
// details element is open or closed.
Element* summary = findMainSummary();
ASSERT(summary);
Element* control = toHTMLSummaryElement(summary)->markerControl();
if (control && control->layoutObject())
control->layoutObject()->setShouldDoFullPaintInvalidation();
return;
}
HTMLElement::parseAttribute(name, value);
}
示例7: loadLink
bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const AtomicString& crossOriginMode, const String& type, const String& as, const KURL& href, Document& document)
{
// TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAttributeValue. crbug.com/486689
// FIXME(crbug.com/463266): We're ignoring type here. Maybe we shouldn't.
dnsPrefetchIfNeeded(relAttribute, href, document);
preconnectIfNeeded(relAttribute, href, document, crossOriginAttributeValue(crossOriginMode));
preloadIfNeeded(relAttribute, href, document, as);
// FIXME(crbug.com/323096): Should take care of import.
if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource() || relAttribute.isTransitionExitingStylesheet()) && href.isValid() && document.frame()) {
if (!m_client->shouldLoadLink())
return false;
Resource::Type type = relAttribute.isLinkSubresource() ? Resource::LinkSubresource : Resource::LinkPrefetch;
FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), FetchInitiatorTypeNames::link);
if (!crossOriginMode.isNull())
linkRequest.setCrossOriginAccessControl(document.securityOrigin(), crossOriginMode);
setResource(document.fetcher()->fetchLinkResource(type, linkRequest));
}
if (const unsigned prerenderRelTypes = prerenderRelTypesFromRelAttribute(relAttribute)) {
if (!m_prerender) {
m_prerender = PrerenderHandle::create(document, this, href, prerenderRelTypes);
} else if (m_prerender->url() != href) {
m_prerender->cancel();
m_prerender = PrerenderHandle::create(document, this, href, prerenderRelTypes);
}
// TODO(gavinp): Handle changes to rel types of existing prerenders.
} else if (m_prerender) {
m_prerender->cancel();
m_prerender.clear();
}
return true;
}
示例8: fetchScript
bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOption defer)
{
ASSERT(m_element);
RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
if (!m_element->inDocument() || m_element->document() != elementDocument)
return false;
ASSERT(!m_resource);
if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
FetchRequest request(ResourceRequest(elementDocument->completeURL(sourceUrl)), m_element->localName());
AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
if (!crossOriginMode.isNull())
request.setCrossOriginAccessControl(elementDocument->securityOrigin(), crossOriginMode);
request.setCharset(scriptCharset());
bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowScriptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
if (scriptPassesCSP)
request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
request.setDefer(defer);
m_resource = elementDocument->fetcher()->fetchScript(request);
m_isExternalScript = true;
}
if (m_resource)
return true;
dispatchErrorEvent();
return false;
}
示例9: parseAttribute
void HTMLTrackElement::parseAttribute(const QualifiedName& name,
const AtomicString& oldValue,
const AtomicString& value) {
if (name == srcAttr) {
if (!value.isEmpty())
scheduleLoad();
else if (m_track)
m_track->removeAllCues();
// 4.8.10.12.3 Sourcing out-of-band text tracks
// As the kind, label, and srclang attributes are set, changed, or removed,
// the text track must update accordingly...
} else if (name == kindAttr) {
AtomicString lowerCaseValue = value.lower();
// 'missing value default' ("subtitles")
if (lowerCaseValue.isNull())
lowerCaseValue = TextTrack::subtitlesKeyword();
// 'invalid value default' ("metadata")
else if (!TextTrack::isValidKindKeyword(lowerCaseValue))
lowerCaseValue = TextTrack::metadataKeyword();
track()->setKind(lowerCaseValue);
} else if (name == labelAttr) {
track()->setLabel(value);
} else if (name == srclangAttr) {
track()->setLanguage(value);
} else if (name == idAttr) {
track()->setId(value);
}
HTMLElement::parseAttribute(name, oldValue, value);
}
示例10: SysAllocStringLen
BString::BString(const AtomicString& s)
{
if (s.isNull())
m_bstr = 0;
else
m_bstr = SysAllocStringLen(s.characters(), s.length());
}
示例11: setAttributeInternal
ALWAYS_INLINE void Element::setAttributeInternal(size_t index, const QualifiedName& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute)
{
if (newValue.isNull()) {
if (index != kNotFound)
removeAttributeInternal(index, inSynchronizationOfLazyAttribute);
return;
}
if (index == kNotFound) {
appendAttributeInternal(name, newValue, inSynchronizationOfLazyAttribute);
return;
}
const Attribute& existingAttribute = elementData()->attributes().at(index);
QualifiedName existingAttributeName = existingAttribute.name();
if (newValue == existingAttribute.value())
return;
if (!inSynchronizationOfLazyAttribute)
willModifyAttribute(existingAttributeName, existingAttribute.value(), newValue);
ensureUniqueElementData().attributes().at(index).setValue(newValue);
if (!inSynchronizationOfLazyAttribute)
attributeChanged(existingAttributeName, newValue);
}
示例12: visitedURLInline
static ALWAYS_INLINE void visitedURLInline(const KURL& base, const AtomicString& attributeURL, Vector<UChar, 512>& buffer)
{
if (attributeURL.isNull())
return;
const UChar* characters = attributeURL.characters();
unsigned length = attributeURL.length();
// This is a poor man's completeURL. Faster with less memory allocation.
// FIXME: It's missing a lot of what completeURL does and a lot of what KURL does.
// For example, it does not handle international domain names properly.
// FIXME: It is wrong that we do not do further processing on strings that have "://" in them:
// 1) The "://" could be in the query or anchor.
// 2) The URL's path could have a "/./" or a "/../" or a "//" sequence in it.
// FIXME: needsTrailingSlash does not properly return true for a URL that has no path, but does
// have a query or anchor.
bool hasColonSlashSlash = containsColonSlashSlash(characters, length);
if (hasColonSlashSlash && !needsTrailingSlash(characters, length)) {
buffer.append(attributeURL.characters(), attributeURL.length());
return;
}
if (hasColonSlashSlash) {
// FIXME: This is incorrect for URLs that have a query or anchor; the "/" needs to go at the
// end of the path, *before* the query or anchor.
buffer.append(characters, length);
buffer.append('/');
return;
}
if (!length)
buffer.append(base.string().characters(), base.string().length());
else {
switch (characters[0]) {
case '/':
buffer.append(base.string().characters(), base.pathStart());
break;
case '#':
buffer.append(base.string().characters(), base.pathEnd());
break;
default:
buffer.append(base.string().characters(), base.pathAfterLastSlash());
break;
}
}
buffer.append(characters, length);
cleanPath(buffer);
if (needsTrailingSlash(buffer.data(), buffer.size())) {
// FIXME: This is incorrect for URLs that have a query or anchor; the "/" needs to go at the
// end of the path, *before* the query or anchor.
buffer.append('/');
}
return;
}
示例13: parseAttribute
void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == hrefAttr) {
bool wasLink = isLink();
setIsLink(!value.isNull() && !shouldProhibitLinks(this));
if (wasLink != isLink())
setNeedsStyleRecalc();
if (isLink()) {
String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
if (document().isDNSPrefetchEnabled()) {
if (protocolIsInHTTPFamily(parsedURL) || parsedURL.startsWith("//"))
prefetchDNS(document().completeURL(parsedURL).host());
}
}
invalidateCachedVisitedLinkHash();
} else if (name == nameAttr || name == titleAttr) {
// Do nothing.
} else if (name == relAttr) {
if (SpaceSplitString::spaceSplitStringContainsValue(value, "noreferrer", true))
m_linkRelations |= RelationNoReferrer;
if (m_relList)
m_relList->updateRelAttribute(value);
}
else
HTMLElement::parseAttribute(name, value);
}
示例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: parseAttribute
void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == hrefAttr) {
bool wasLink = isLink();
setIsLink(!value.isNull());
if (wasLink || isLink()) {
pseudoStateChanged(CSSSelector::PseudoLink);
pseudoStateChanged(CSSSelector::PseudoVisited);
}
if (wasLink && !isLink() && treeScope().adjustedFocusedElement() == this) {
// We might want to call blur(), but it's dangerous to dispatch
// events here.
document().setNeedsFocusedElementCheck();
}
if (isLink()) {
String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
if (document().isDNSPrefetchEnabled()) {
if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//"))
prefetchDNS(document().completeURL(parsedURL).host());
}
}
invalidateCachedVisitedLinkHash();
} else if (name == nameAttr || name == titleAttr) {
// Do nothing.
} else if (name == relAttr)
setRel(value);
else
HTMLElement::parseAttribute(name, value);
}