本文整理汇总了C++中ASCIILiteral函数的典型用法代码示例。如果您正苦于以下问题:C++ ASCIILiteral函数的具体用法?C++ ASCIILiteral怎么用?C++ ASCIILiteral使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASCIILiteral函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: document
void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!nearestViewportElement()) {
// For these events, the outermost <svg> element works like a <body> element does,
// setting certain event handlers directly on the window object.
if (name == HTMLNames::onunloadAttr) {
document().setWindowAttributeEventListener(eventNames().unloadEvent, name, value);
return;
}
if (name == HTMLNames::onresizeAttr) {
document().setWindowAttributeEventListener(eventNames().resizeEvent, name, value);
return;
}
if (name == HTMLNames::onscrollAttr) {
document().setWindowAttributeEventListener(eventNames().scrollEvent, name, value);
return;
}
if (name == SVGNames::onzoomAttr) {
document().setWindowAttributeEventListener(eventNames().zoomEvent, name, value);
return;
}
}
// For these events, any <svg> element works like a <body> element does,
// setting certain event handlers directly on the window object.
// FIXME: Why different from the events above that work only on the outermost <svg> element?
if (name == HTMLNames::onabortAttr) {
document().setWindowAttributeEventListener(eventNames().abortEvent, name, value);
return;
}
if (name == HTMLNames::onerrorAttr) {
document().setWindowAttributeEventListener(eventNames().errorEvent, name, value);
return;
}
SVGParsingError parseError = NoError;
if (name == SVGNames::xAttr)
setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
else if (name == SVGNames::yAttr)
setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
else if (name == SVGNames::widthAttr) {
SVGLength length = SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths);
if (parseError != NoError || value.isEmpty()) {
// FIXME: This is definitely the correct behavior for a missing/removed attribute.
// Not sure it's correct for the empty string or for something that can't be parsed.
length = SVGLength(LengthModeWidth, ASCIILiteral("100%"));
}
setWidthBaseValue(length);
} else if (name == SVGNames::heightAttr) {
SVGLength length = SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths);
if (parseError != NoError || value.isEmpty()) {
// FIXME: This is definitely the correct behavior for a removed attribute.
// Not sure it's correct for the empty string or for something that can't be parsed.
length = SVGLength(LengthModeHeight, ASCIILiteral("100%"));
}
setHeightBaseValue(length);
}
reportAttributeParsingError(parseError, name, value);
SVGExternalResourcesRequired::parseAttribute(name, value);
SVGFitToViewBox::parseAttribute(this, name, value);
SVGZoomAndPan::parseAttribute(*this, name, value);
SVGGraphicsElement::parseAttribute(name, value);
}
示例2:
InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* state, InspectorPageAgent* pageAgent)
: InspectorBaseAgent<InspectorApplicationCacheAgent>(ASCIILiteral("ApplicationCache"), instrumentingAgents, state)
, m_pageAgent(pageAgent)
, m_frontend(0)
{
}
示例3: LOG
void WebSocket::send(const String& message, ExceptionCode& ec)
{
LOG(Network, "WebSocket %p send() Sending String '%s'", this, message.utf8().data());
if (m_state == CONNECTING) {
ec = INVALID_STATE_ERR;
return;
}
// No exception is raised if the connection was once established but has subsequently been closed.
if (m_state == CLOSING || m_state == CLOSED) {
size_t payloadSize = message.utf8().length();
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
return;
}
ASSERT(m_channel);
ThreadableWebSocketChannel::SendResult result = m_channel->send(message);
if (result == ThreadableWebSocketChannel::InvalidMessage) {
scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, ASCIILiteral("Websocket message contains invalid character(s)."));
ec = SYNTAX_ERR;
return;
}
}
示例4: LOG
RefPtr<IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, JSC::JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck, ExceptionCodeWithMessage& ec)
{
LOG(IndexedDB, "IDBObjectStore::putOrAdd");
if (!m_transaction->isActive()) {
ec.code = IDBDatabaseException::TransactionInactiveError;
ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is inactive or finished.");
return nullptr;
}
if (m_transaction->isReadOnly()) {
ec.code = IDBDatabaseException::ReadOnlyError;
ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is read-only.");
return nullptr;
}
if (m_deleted) {
ec.code = IDBDatabaseException::InvalidStateError;
return nullptr;
}
RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr);
if (state.hadException()) {
ec.code = IDBDatabaseException::DataCloneError;
ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: An object could not be cloned.");
return nullptr;
}
if (serializedValue->hasBlobURLs()) {
// FIXME: Add Blob/File/FileList support
ec.code = IDBDatabaseException::DataCloneError;
ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.");
return nullptr;
}
if (key && key->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
return nullptr;
}
bool usesInlineKeys = !m_info.keyPath().isNull();
bool usesKeyGenerator = autoIncrement();
if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
if (key) {
ec.code = IDBDatabaseException::DataError;
return nullptr;
}
RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, m_info.keyPath());
if (keyPathKey && !keyPathKey->isValid()) {
ec.code = IDBDatabaseException::DataError;
return nullptr;
}
if (!keyPathKey) {
if (usesKeyGenerator) {
if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath())) {
ec.code = IDBDatabaseException::DataError;
return nullptr;
}
} else {
ec.code = IDBDatabaseException::DataError;
return nullptr;
}
}
if (keyPathKey) {
ASSERT(!key);
key = keyPathKey;
}
} else if (!usesKeyGenerator && !key) {
ec.code = IDBDatabaseException::DataError;
return nullptr;
}
auto context = scriptExecutionContextFromExecState(&state);
if (!context) {
ec.code = IDBDatabaseException::UnknownError;
return nullptr;
}
Ref<IDBRequest> request = m_transaction->requestPutOrAdd(*context, *this, key.get(), *serializedValue, overwriteMode);
return adoptRef(request.leakRef());
}
示例5: toPropertyDescriptor
// ES5 8.10.5 ToPropertyDescriptor
static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc)
{
if (!in.isObject()) {
exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Property description must be an object.")));
return false;
}
JSObject* description = asObject(in);
PropertySlot enumerableSlot(description);
if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) {
desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec));
if (exec->hadException())
return false;
}
PropertySlot configurableSlot(description);
if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) {
desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec));
if (exec->hadException())
return false;
}
JSValue value;
PropertySlot valueSlot(description);
if (description->getPropertySlot(exec, exec->propertyNames().value, valueSlot)) {
desc.setValue(valueSlot.getValue(exec, exec->propertyNames().value));
if (exec->hadException())
return false;
}
PropertySlot writableSlot(description);
if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) {
desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec));
if (exec->hadException())
return false;
}
PropertySlot getSlot(description);
if (description->getPropertySlot(exec, exec->propertyNames().get, getSlot)) {
JSValue get = getSlot.getValue(exec, exec->propertyNames().get);
if (exec->hadException())
return false;
if (!get.isUndefined()) {
CallData callData;
if (getCallData(get, callData) == CallTypeNone) {
exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Getter must be a function.")));
return false;
}
}
desc.setGetter(get);
}
PropertySlot setSlot(description);
if (description->getPropertySlot(exec, exec->propertyNames().set, setSlot)) {
JSValue set = setSlot.getValue(exec, exec->propertyNames().set);
if (exec->hadException())
return false;
if (!set.isUndefined()) {
CallData callData;
if (getCallData(set, callData) == CallTypeNone) {
exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Setter must be a function.")));
return false;
}
}
desc.setSetter(set);
}
if (!desc.isAccessorDescriptor())
return true;
if (desc.value()) {
exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Invalid property. 'value' present on property with getter or setter.")));
return false;
}
if (desc.writablePresent()) {
exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Invalid property. 'writable' present on property with getter or setter.")));
return false;
}
return true;
}
示例6: WebViewDidEndEditingNotification
void WebEditorClient::didEndEditing()
{
static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification"));
m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.get().impl());
notImplemented();
}
示例7: constructJSReadableStreamController
EncodedJSValue JSC_HOST_CALL constructJSReadableStreamController(ExecState* exec)
{
return throwVMError(exec, createTypeError(exec, ASCIILiteral("ReadableStreamController constructor should not be called directly")));
}
示例8: showMainResourceForFrame
void WebInspectorUI::showMainResourceForFrame(const String& frameIdentifier)
{
m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("showMainResourceForFrame"), frameIdentifier);
}
示例9: stopPageProfiling
void WebInspectorUI::stopPageProfiling()
{
m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("setTimelineProfilingEnabled"), false);
}
示例10: showConsole
void WebInspectorUI::showConsole()
{
m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("showConsole"));
}
示例11: showResources
void WebInspectorUI::showResources()
{
m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("showResources"));
}
示例12: setDockingUnavailable
void WebInspectorUI::setDockingUnavailable(bool unavailable)
{
m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("setDockingUnavailable"), unavailable);
m_dockingUnavailable = unavailable;
}
示例13: canonicalizeLocaleList
void IntlCollator::initializeCollator(ExecState& state, JSValue locales, JSValue optionsValue)
{
// 10.1.1 InitializeCollator (collator, locales, options) (ECMA-402 2.0)
// 1. If collator has an [[initializedIntlObject]] internal slot with value true, throw a TypeError exception.
// 2. Set collator.[[initializedIntlObject]] to true.
// 3. Let requestedLocales be CanonicalizeLocaleList(locales).
auto requestedLocales = canonicalizeLocaleList(state, locales);
// 4. ReturnIfAbrupt(requestedLocales).
if (state.hadException())
return;
// 5. If options is undefined, then
JSObject* options;
if (optionsValue.isUndefined()) {
// a. Let options be ObjectCreate(%ObjectPrototype%).
options = constructEmptyObject(&state);
} else { // 6. Else
// a. Let options be ToObject(options).
options = optionsValue.toObject(&state);
// b. ReturnIfAbrupt(options).
if (state.hadException())
return;
}
// 7. Let u be GetOption(options, "usage", "string", «"sort", "search"», "sort").
String usageString = intlStringOption(state, options, state.vm().propertyNames->usage, { "sort", "search" }, "usage must be either \"sort\" or \"search\"", "sort");
// 8. ReturnIfAbrupt(u).
if (state.hadException())
return;
// 9. Set collator.[[usage]] to u.
if (usageString == "sort")
m_usage = Usage::Sort;
else if (usageString == "search")
m_usage = Usage::Search;
else
ASSERT_NOT_REACHED();
// 10. If u is "sort", then
// a. Let localeData be the value of %Collator%.[[sortLocaleData]];
// 11. Else
// a. Let localeData be the value of %Collator%.[[searchLocaleData]].
Vector<String> (*localeData)(const String&, size_t);
if (m_usage == Usage::Sort)
localeData = sortLocaleData;
else
localeData = searchLocaleData;
// 12. Let opt be a new Record.
HashMap<String, String> opt;
// 13. Let matcher be GetOption(options, "localeMatcher", "string", «"lookup", "best fit"», "best fit").
String matcher = intlStringOption(state, options, state.vm().propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit");
// 14. ReturnIfAbrupt(matcher).
if (state.hadException())
return;
// 15. Set opt.[[localeMatcher]] to matcher.
opt.add(ASCIILiteral("localeMatcher"), matcher);
// 16. For each row in Table 1, except the header row, do:
// a. Let key be the name given in the Key column of the row.
// b. Let prop be the name given in the Property column of the row.
// c. Let type be the string given in the Type column of the row.
// d. Let list be a List containing the Strings given in the Values column of the row, or undefined if no strings are given.
// e. Let value be GetOption(options, prop, type, list, undefined).
// f. ReturnIfAbrupt(value).
// g. If the string given in the Type column of the row is "boolean" and value is not undefined, then
// i. Let value be ToString(value).
// ii. ReturnIfAbrupt(value).
// h. Set opt.[[<key>]] to value.
{
String numericString;
bool usesFallback;
bool numeric = intlBooleanOption(state, options, state.vm().propertyNames->numeric, usesFallback);
if (state.hadException())
return;
if (!usesFallback)
numericString = ASCIILiteral(numeric ? "true" : "false");
opt.add(ASCIILiteral("kn"), numericString);
}
{
String caseFirst = intlStringOption(state, options, state.vm().propertyNames->caseFirst, { "upper", "lower", "false" }, "caseFirst must be either \"upper\", \"lower\", or \"false\"", nullptr);
if (state.hadException())
return;
opt.add(ASCIILiteral("kf"), caseFirst);
}
// 17. Let relevantExtensionKeys be the value of %Collator%.[[relevantExtensionKeys]].
// 18. Let r be ResolveLocale(%Collator%.[[availableLocales]], requestedLocales, opt, relevantExtensionKeys, localeData).
auto& availableLocales = state.callee()->globalObject()->intlCollatorAvailableLocales();
auto result = resolveLocale(state, availableLocales, requestedLocales, opt, relevantExtensionKeys, WTF_ARRAY_LENGTH(relevantExtensionKeys), localeData);
// 19. Set collator.[[locale]] to the value of r.[[locale]].
m_locale = result.get(ASCIILiteral("locale"));
// 20. Let k be 0.
// 21. Let lenValue be Get(relevantExtensionKeys, "length").
// 22. Let len be ToLength(lenValue).
// 23. Repeat while k < len:
// a. Let Pk be ToString(k).
//.........这里部分代码省略.........
示例14: timestamp
void InspectorTimelineAgent::didCompleteRecordEntry(const TimelineRecordEntry& entry) {
entry.record->setObject(ASCIILiteral("data"), entry.data);
entry.record->setArray(ASCIILiteral("children"), entry.children);
entry.record->setDouble(ASCIILiteral("endTime"), timestamp());
addRecordToTimeline(entry.record.copyRef(), entry.type);
}
示例15: stopElementSelection
void WebInspectorUI::stopElementSelection()
{
m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("setElementSelectionEnabled"), false);
}