本文整理汇总了C++中AtomicString类的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString类的具体用法?C++ AtomicString怎么用?C++ AtomicString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AtomicString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseQualifiedNameInternal
static bool parseQualifiedNameInternal(const AtomicString& qualifiedName, const CharType* characters, unsigned length, AtomicString& prefix, AtomicString& localName, ExceptionState& exceptionState)
{
bool nameStart = true;
bool sawColon = false;
int colonPos = 0;
for (unsigned i = 0; i < length;) {
UChar32 c;
U16_NEXT(characters, i, length, c)
if (c == ':') {
if (sawColon) {
exceptionState.ThrowDOMException(NamespaceError, "The qualified name provided ('" + qualifiedName + "') contains multiple colons.");
return false; // multiple colons: not allowed
}
nameStart = true;
sawColon = true;
colonPos = i - 1;
} else if (nameStart) {
if (!isValidNameStart(c)) {
StringBuilder message;
message.appendLiteral("The qualified name provided ('");
message.append(qualifiedName);
message.appendLiteral("') contains the invalid name-start character '");
message.append(c);
message.appendLiteral("'.");
exceptionState.ThrowDOMException(InvalidCharacterError, message.toString());
return false;
}
nameStart = false;
} else {
if (!isValidNamePart(c)) {
StringBuilder message;
message.appendLiteral("The qualified name provided ('");
message.append(qualifiedName);
message.appendLiteral("') contains the invalid character '");
message.append(c);
message.appendLiteral("'.");
exceptionState.ThrowDOMException(InvalidCharacterError, message.toString());
return false;
}
}
}
if (!sawColon) {
prefix = nullAtom;
localName = qualifiedName;
} else {
prefix = AtomicString(characters, colonPos);
if (prefix.isEmpty()) {
exceptionState.ThrowDOMException(NamespaceError, "The qualified name provided ('" + qualifiedName + "') has an empty namespace prefix.");
return false;
}
int prefixStart = colonPos + 1;
localName = AtomicString(characters + prefixStart, length - prefixStart);
}
if (localName.isEmpty()) {
exceptionState.ThrowDOMException(NamespaceError, "The qualified name provided ('" + qualifiedName + "') has an empty local name.");
return false;
}
return true;
}
示例2: remove
void DOMTokenList::remove(const AtomicString& token, ExceptionState& es)
{
Vector<String> tokens;
tokens.append(token.string());
remove(tokens, es);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:6,代码来源:DOMTokenList.cpp
示例3:
String::String(const AtomicString &s) {
m_px = s.get();
}
示例4: isCSS
static bool isCSS(Element* element, const AtomicString& type)
{
return type.isEmpty() || (element->isHTMLElement() ? equalIgnoringCase(type, "text/css") : (type == "text/css"));
}
示例5:
PassRefPtr<HTMLFormControlElement> HTMLFormElement::elementForAlias(const AtomicString& alias)
{
if (alias.isEmpty() || !m_elementAliases)
return 0;
return m_elementAliases->get(alias.impl());
}
示例6:
void ArgumentCoder<AtomicString>::encode(ArgumentEncoder& encoder, const AtomicString& atomicString)
{
encoder << atomicString.string();
}
示例7: parseAttribute
void HTMLBodyElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == vlinkAttr || name == alinkAttr || name == linkAttr) {
if (value.isNull()) {
if (name == linkAttr)
document().textLinkColors().resetLinkColor();
else if (name == vlinkAttr)
document().textLinkColors().resetVisitedLinkColor();
else
document().textLinkColors().resetActiveLinkColor();
} else {
RGBA32 color;
if (BisonCSSParser::parseColor(color, value, !document().inQuirksMode())) {
if (name == linkAttr)
document().textLinkColors().setLinkColor(color);
else if (name == vlinkAttr)
document().textLinkColors().setVisitedLinkColor(color);
else
document().textLinkColors().setActiveLinkColor(color);
}
}
setNeedsStyleRecalc(SubtreeStyleChange);
} else if (name == onloadAttr)
document().setWindowAttributeEventListener(EventTypeNames::load, createAttributeEventListener(document().frame(), name, value));
else if (name == onbeforeunloadAttr)
document().setWindowAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(document().frame(), name, value));
else if (name == onunloadAttr)
document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value));
else if (name == onpagehideAttr)
document().setWindowAttributeEventListener(EventTypeNames::pagehide, createAttributeEventListener(document().frame(), name, value));
else if (name == onpageshowAttr)
document().setWindowAttributeEventListener(EventTypeNames::pageshow, createAttributeEventListener(document().frame(), name, value));
else if (name == onpopstateAttr)
document().setWindowAttributeEventListener(EventTypeNames::popstate, createAttributeEventListener(document().frame(), name, value));
else if (name == onblurAttr)
document().setWindowAttributeEventListener(EventTypeNames::blur, createAttributeEventListener(document().frame(), name, value));
else if (name == onerrorAttr)
document().setWindowAttributeEventListener(EventTypeNames::error, createAttributeEventListener(document().frame(), name, value));
else if (name == onfocusAttr)
document().setWindowAttributeEventListener(EventTypeNames::focus, createAttributeEventListener(document().frame(), name, value));
else if (RuntimeEnabledFeatures::orientationEventEnabled() && name == onorientationchangeAttr)
document().setWindowAttributeEventListener(EventTypeNames::orientationchange, createAttributeEventListener(document().frame(), name, value));
else if (name == onhashchangeAttr)
document().setWindowAttributeEventListener(EventTypeNames::hashchange, createAttributeEventListener(document().frame(), name, value));
else if (name == onmessageAttr)
document().setWindowAttributeEventListener(EventTypeNames::message, createAttributeEventListener(document().frame(), name, value));
else if (name == onresizeAttr)
document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value));
else if (name == onscrollAttr)
document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value));
else if (name == onselectionchangeAttr)
document().setAttributeEventListener(EventTypeNames::selectionchange, createAttributeEventListener(document().frame(), name, value));
else if (name == onstorageAttr)
document().setWindowAttributeEventListener(EventTypeNames::storage, createAttributeEventListener(document().frame(), name, value));
else if (name == ononlineAttr)
document().setWindowAttributeEventListener(EventTypeNames::online, createAttributeEventListener(document().frame(), name, value));
else if (name == onofflineAttr)
document().setWindowAttributeEventListener(EventTypeNames::offline, createAttributeEventListener(document().frame(), name, value));
else
HTMLElement::parseAttribute(name, value);
}
示例8: impl
JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args)
{
Frame* frame = impl()->frame();
if (!frame)
return jsUndefined();
Frame* lexicalFrame = toLexicalFrame(exec);
if (!lexicalFrame)
return jsUndefined();
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
Page* page = frame->page();
String urlString = valueToStringWithUndefinedOrNullCheck(exec, args.at(0));
AtomicString frameName = args.at(1).isUndefinedOrNull() ? "_blank" : AtomicString(args.at(1).toString(exec));
// Because FrameTree::find() returns true for empty strings, we must check for empty framenames.
// Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
if (!DOMWindow::allowPopUp(dynamicFrame) && (frameName.isEmpty() || !frame->tree()->find(frameName)))
return jsUndefined();
// Get the target frame for the special cases of _top and _parent. In those
// cases, we can schedule a location change right now and return early.
bool topOrParent = false;
if (frameName == "_top") {
frame = frame->tree()->top();
topOrParent = true;
} else if (frameName == "_parent") {
if (Frame* parent = frame->tree()->parent())
frame = parent;
topOrParent = true;
}
if (topOrParent) {
if (!shouldAllowNavigation(exec, frame))
return jsUndefined();
String completedURL;
if (!urlString.isEmpty())
completedURL = completeURL(exec, urlString).string();
const JSDOMWindow* targetedWindow = toJSDOMWindow(frame);
if (!completedURL.isEmpty() && (!protocolIsJavaScript(completedURL) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
bool userGesture = processingUserGesture(exec);
// For whatever reason, Firefox uses the dynamicGlobalObject to
// determine the outgoingReferrer. We replicate that behavior
// here.
String referrer = dynamicFrame->loader()->outgoingReferrer();
frame->loader()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
}
return toJS(exec, frame->domWindow());
}
// In the case of a named frame or a new window, we'll use the createWindow() helper
WindowFeatures windowFeatures(valueToStringWithUndefinedOrNullCheck(exec, args.at(2)));
FloatRect windowRect(windowFeatures.xSet ? windowFeatures.x : 0, windowFeatures.ySet ? windowFeatures.y : 0,
windowFeatures.widthSet ? windowFeatures.width : 0, windowFeatures.heightSet ? windowFeatures.height : 0);
DOMWindow::adjustWindowRect(screenAvailableRect(page ? page->mainFrame()->view() : 0), windowRect, windowRect);
windowFeatures.x = windowRect.x();
windowFeatures.y = windowRect.y();
windowFeatures.height = windowRect.height();
windowFeatures.width = windowRect.width();
frame = createWindow(exec, lexicalFrame, dynamicFrame, frame, urlString, frameName, windowFeatures, JSValue());
if (!frame)
return jsUndefined();
return toJS(exec, frame->domWindow());
}
示例9: parseTransformAttribute
bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const AtomicString& transform)
{
double x[] = {0, 0, 0, 0, 0, 0};
int nr = 0, required = 0, optional = 0;
const UChar* currTransform = transform.characters();
const UChar* end = currTransform + transform.length();
bool delimParsed = false;
while (currTransform < end) {
delimParsed = false;
unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
skipOptionalSpaces(currTransform, end);
if (currTransform >= end)
return false;
if (*currTransform == 's') {
if (skipString(currTransform, end, skewXDesc, sizeof(skewXDesc) / sizeof(UChar))) {
required = 1;
optional = 0;
type = SVGTransform::SVG_TRANSFORM_SKEWX;
} else if (skipString(currTransform, end, skewYDesc, sizeof(skewYDesc) / sizeof(UChar))) {
required = 1;
optional = 0;
type = SVGTransform::SVG_TRANSFORM_SKEWY;
} else if (skipString(currTransform, end, scaleDesc, sizeof(scaleDesc) / sizeof(UChar))) {
required = 1;
optional = 1;
type = SVGTransform::SVG_TRANSFORM_SCALE;
} else
return false;
} else if (skipString(currTransform, end, translateDesc, sizeof(translateDesc) / sizeof(UChar))) {
required = 1;
optional = 1;
type = SVGTransform::SVG_TRANSFORM_TRANSLATE;
} else if (skipString(currTransform, end, rotateDesc, sizeof(rotateDesc) / sizeof(UChar))) {
required = 1;
optional = 2;
type = SVGTransform::SVG_TRANSFORM_ROTATE;
} else if (skipString(currTransform, end, matrixDesc, sizeof(matrixDesc) / sizeof(UChar))) {
required = 6;
optional = 0;
type = SVGTransform::SVG_TRANSFORM_MATRIX;
} else
return false;
if ((nr = parseTransformParamList(currTransform, end, x, required, optional)) < 0)
return false;
SVGTransform t;
switch (type) {
case SVGTransform::SVG_TRANSFORM_SKEWX:
t.setSkewX(narrowPrecisionToFloat(x[0]));
break;
case SVGTransform::SVG_TRANSFORM_SKEWY:
t.setSkewY(narrowPrecisionToFloat(x[0]));
break;
case SVGTransform::SVG_TRANSFORM_SCALE:
if (nr == 1) // Spec: if only one param given, assume uniform scaling
t.setScale(narrowPrecisionToFloat(x[0]), narrowPrecisionToFloat(x[0]));
else
t.setScale(narrowPrecisionToFloat(x[0]), narrowPrecisionToFloat(x[1]));
break;
case SVGTransform::SVG_TRANSFORM_TRANSLATE:
if (nr == 1) // Spec: if only one param given, assume 2nd param to be 0
t.setTranslate(narrowPrecisionToFloat(x[0]), 0);
else
t.setTranslate(narrowPrecisionToFloat(x[0]), narrowPrecisionToFloat(x[1]));
break;
case SVGTransform::SVG_TRANSFORM_ROTATE:
if (nr == 1)
t.setRotate(narrowPrecisionToFloat(x[0]), 0, 0);
else
t.setRotate(narrowPrecisionToFloat(x[0]), narrowPrecisionToFloat(x[1]), narrowPrecisionToFloat(x[2]));
break;
case SVGTransform::SVG_TRANSFORM_MATRIX:
t.setMatrix(AffineTransform(x[0], x[1], x[2], x[3], x[4], x[5]));
break;
}
ExceptionCode ec = 0;
list->appendItem(t, ec);
skipOptionalSpaces(currTransform, end);
if (currTransform < end && *currTransform == ',') {
delimParsed = true;
currTransform++;
}
skipOptionalSpaces(currTransform, end);
}
return !delimParsed;
}
示例10: addItemToMap
void HTMLDocument::addItemToMap(HashCountedSet<AtomicStringImpl*>& map, const AtomicString& name)
{
if (name.isEmpty())
return;
map.add(name.impl());
}
示例11: addElementByName
void TreeScope::addElementByName(const AtomicString& name, Element* element)
{
if (!m_elementsByName)
m_elementsByName = adoptPtr(new DocumentOrderedMap);
m_elementsByName->add(name.impl(), element);
}
示例12: removeItemFromMap
void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicStringImpl*>& map, const AtomicString& name)
{
if (name.isEmpty())
return;
map.remove(name.impl());
}
示例13: removeElementByName
void TreeScope::removeElementByName(const AtomicString& name, Element* element)
{
if (!m_elementsByName)
return;
m_elementsByName->remove(name.impl(), element);
}
示例14: DEPRECATED_DEFINE_STATIC_LOCAL
void MediaSource::streamEndedWithError(const AtomicString& error, ExceptionCode& ec)
{
DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::ConstructFromLiteral));
DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::ConstructFromLiteral));
LOG(MediaSource, "MediaSource::streamEndedWithError(%p) : %s", this, error.string().ascii().data());
// 2.4.7 https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#end-of-stream-algorithm
// 3.
if (error.isEmpty()) {
// ↳ If error is not set, is null, or is an empty string
// 1. Run the duration change algorithm with new duration set to the highest end time reported by
// the buffered attribute across all SourceBuffer objects in sourceBuffers.
MediaTime maxEndTime;
for (auto& sourceBuffer : *m_sourceBuffers) {
if (auto length = sourceBuffer->buffered()->length())
maxEndTime = std::max(sourceBuffer->buffered()->ranges().end(length - 1), maxEndTime);
}
setDurationInternal(maxEndTime);
// 2. Notify the media element that it now has all of the media data.
m_private->markEndOfStream(MediaSourcePrivate::EosNoError);
}
// NOTE: Do steps 1 & 2 after step 3 (with an empty error) to avoid the MediaSource's readyState being re-opened by a
// remove() operation resulting from a duration change.
// FIXME: Re-number or update this section once <https://www.w3.org/Bugs/Public/show_bug.cgi?id=26316> is resolved.
// 1. Change the readyState attribute value to "ended".
// 2. Queue a task to fire a simple event named sourceended at the MediaSource.
setReadyState(endedKeyword());
if (error == network) {
// ↳ If error is set to "network"
ASSERT(m_mediaElement);
if (m_mediaElement->readyState() == HTMLMediaElement::HAVE_NOTHING) {
// ↳ If the HTMLMediaElement.readyState attribute equals HAVE_NOTHING
// Run the "If the media data cannot be fetched at all, due to network errors, causing
// the user agent to give up trying to fetch the resource" steps of the resource fetch algorithm.
// NOTE: This step is handled by HTMLMediaElement::mediaLoadingFailed().
m_mediaElement->mediaLoadingFailed(MediaPlayer::NetworkError);
} else {
// ↳ If the HTMLMediaElement.readyState attribute is greater than HAVE_NOTHING
// Run the "If the connection is interrupted after some media data has been received, causing the
// user agent to give up trying to fetch the resource" steps of the resource fetch algorithm.
// NOTE: This step is handled by HTMLMediaElement::mediaLoadingFailedFatally().
m_mediaElement->mediaLoadingFailedFatally(MediaPlayer::NetworkError);
}
} else if (error == decode) {
// ↳ If error is set to "decode"
ASSERT(m_mediaElement);
if (m_mediaElement->readyState() == HTMLMediaElement::HAVE_NOTHING) {
// ↳ If the HTMLMediaElement.readyState attribute equals HAVE_NOTHING
// Run the "If the media data can be fetched but is found by inspection to be in an unsupported
// format, or can otherwise not be rendered at all" steps of the resource fetch algorithm.
// NOTE: This step is handled by HTMLMediaElement::mediaLoadingFailed().
m_mediaElement->mediaLoadingFailed(MediaPlayer::FormatError);
} else {
// ↳ If the HTMLMediaElement.readyState attribute is greater than HAVE_NOTHING
// Run the media data is corrupted steps of the resource fetch algorithm.
// NOTE: This step is handled by HTMLMediaElement::mediaLoadingFailedFatally().
m_mediaElement->mediaLoadingFailedFatally(MediaPlayer::DecodeError);
}
} else if (!error.isEmpty()) {
// ↳ Otherwise
// Throw an INVALID_ACCESS_ERR exception.
ec = INVALID_ACCESS_ERR;
}
}
示例15: removeToken
String DOMTokenList::removeToken(const AtomicString& input, const AtomicString& token)
{
Vector<String> tokens;
tokens.append(token.string());
return removeTokens(input, tokens);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:6,代码来源:DOMTokenList.cpp