本文整理汇总了C++中AtomicString函数的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString函数的具体用法?C++ AtomicString怎么用?C++ AtomicString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AtomicString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AtomicString
void FrameTree::clearName()
{
m_name = AtomicString();
}
示例2: setHTTPHeaderField
void ResourceRequest::setHTTPHeaderField(const char* name, const AtomicString& value)
{
setHTTPHeaderField(AtomicString(name), value);
}
示例3: v8NonStringValueToAtomicWebCoreString
AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value> object)
{
ASSERT(!object->IsString());
return AtomicString(v8NonStringValueToWebCoreString(object));
}
示例4: 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());
}
示例5: targetElement
inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition)
{
Element* eventBase = condition.baseID().isEmpty() ? targetElement() : treeScope().getElementById(AtomicString(condition.baseID()));
if (eventBase && eventBase->isSVGElement())
return toSVGElement(eventBase);
return nullptr;
}
示例6: TRACE_EVENT0
bool SVGImage::dataChanged(bool allDataReceived)
{
TRACE_EVENT0("blink", "SVGImage::dataChanged");
// Don't do anything if is an empty image.
if (!data()->size())
return true;
if (allDataReceived) {
// SVGImage will fire events (and the default C++ handlers run) but doesn't
// actually allow script to run so it's fine to call into it. We allow this
// since it means an SVG data url can synchronously load like other image
// types.
EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents;
DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFrameLoaderClient, (EmptyFrameLoaderClient::create()));
if (m_page) {
toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString::ConstructFromLiteral),
AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), ForceSynchronousLoad)));
return true;
}
Page::PageClients pageClients;
fillWithEmptyClients(pageClients);
m_chromeClient = SVGImageChromeClient::create(this);
pageClients.chromeClient = m_chromeClient.get();
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The Cache code does not know about ImageResources holding Frames and
// won't know to break the cycle.
// This will become an issue when SVGImage will be able to load other
// SVGImage objects, but we're safe now, because SVGImage can only be
// loaded by a top-level document.
OwnPtrWillBeRawPtr<Page> page;
{
TRACE_EVENT0("blink", "SVGImage::dataChanged::createPage");
page = adoptPtrWillBeNoop(new Page(pageClients));
page->settings().setScriptEnabled(false);
page->settings().setPluginsEnabled(false);
page->settings().setAcceleratedCompositingEnabled(false);
// Because this page is detached, it can't get default font settings
// from the embedder. Copy over font settings so we have sensible
// defaults. These settings are fixed and will not update if changed.
if (!Page::ordinaryPages().isEmpty()) {
Settings& defaultSettings = (*Page::ordinaryPages().begin())->settings();
page->settings().genericFontFamilySettings() = defaultSettings.genericFontFamilySettings();
page->settings().setMinimumFontSize(defaultSettings.minimumFontSize());
page->settings().setMinimumLogicalFontSize(defaultSettings.minimumLogicalFontSize());
page->settings().setDefaultFontSize(defaultSettings.defaultFontSize());
page->settings().setDefaultFixedFontSize(defaultSettings.defaultFixedFontSize());
}
}
RefPtrWillBeRawPtr<LocalFrame> frame = nullptr;
{
TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame");
frame = LocalFrame::create(dummyFrameLoaderClient.get(), &page->frameHost(), 0);
frame->setView(FrameView::create(frame.get()));
frame->init();
}
FrameLoader& loader = frame->loader();
loader.forceSandboxFlags(SandboxAll);
frame->view()->setScrollbarsSuppressed(true);
frame->view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars.
frame->view()->setTransparent(true); // SVG Images are transparent.
m_page = page.release();
TRACE_EVENT0("blink", "SVGImage::dataChanged::load");
loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString::ConstructFromLiteral),
AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), ForceSynchronousLoad)));
// Set the intrinsic size before a container size is available.
m_intrinsicSize = containerSize();
}
return m_page;
}
示例7: ASSERT
FilterOperations FilterOperationResolver::createFilterOperations(StyleResolverState& state, const CSSValue& inValue)
{
FilterOperations operations;
if (inValue.isPrimitiveValue()) {
ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone);
return operations;
}
const CSSToLengthConversionData& conversionData = state.cssToLengthConversionData();
for (auto& currValue : toCSSValueList(inValue)) {
CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get());
FilterOperation::OperationType operationType = filterOperationForType(filterValue->functionType());
countFilterUse(operationType, state.document());
ASSERT(filterValue->length() <= 1);
if (operationType == FilterOperation::REFERENCE) {
CSSSVGDocumentValue* svgDocumentValue = toCSSSVGDocumentValue(filterValue->item(0));
KURL url = state.document().completeURL(svgDocumentValue->url());
RawPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), AtomicString(url.fragmentIdentifier()));
if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), state.document())) {
if (!svgDocumentValue->loadRequested())
state.elementStyleResources().addPendingSVGDocument(operation.get(), svgDocumentValue);
else if (svgDocumentValue->cachedSVGDocument())
ReferenceFilterBuilder::setDocumentResourceReference(operation.get(), adoptPtr(new DocumentResourceReference(svgDocumentValue->cachedSVGDocument())));
}
operations.operations().append(operation);
continue;
}
CSSPrimitiveValue* firstValue = filterValue->length() && filterValue->item(0)->isPrimitiveValue() ? toCSSPrimitiveValue(filterValue->item(0)) : nullptr;
switch (filterValue->functionType()) {
case CSSValueGrayscale:
case CSSValueSepia:
case CSSValueSaturate: {
double amount = 1;
if (filterValue->length() == 1) {
amount = firstValue->getDoubleValue();
if (firstValue->isPercentage())
amount /= 100;
}
operations.operations().append(BasicColorMatrixFilterOperation::create(amount, operationType));
break;
}
case CSSValueHueRotate: {
double angle = 0;
if (filterValue->length() == 1)
angle = firstValue->computeDegrees();
operations.operations().append(BasicColorMatrixFilterOperation::create(angle, operationType));
break;
}
case CSSValueInvert:
case CSSValueBrightness:
case CSSValueContrast:
case CSSValueOpacity: {
double amount = (filterValue->functionType() == CSSValueBrightness) ? 0 : 1;
if (filterValue->length() == 1) {
amount = firstValue->getDoubleValue();
if (firstValue->isPercentage())
amount /= 100;
}
operations.operations().append(BasicComponentTransferFilterOperation::create(amount, operationType));
break;
}
case CSSValueBlur: {
Length stdDeviation = Length(0, Fixed);
if (filterValue->length() >= 1)
stdDeviation = firstValue->convertToLength(conversionData);
operations.operations().append(BlurFilterOperation::create(stdDeviation));
break;
}
case CSSValueDropShadow: {
CSSShadowValue* item = toCSSShadowValue(filterValue->item(0));
IntPoint location(item->x->computeLength<int>(conversionData), item->y->computeLength<int>(conversionData));
int blur = item->blur ? item->blur->computeLength<int>(conversionData) : 0;
Color shadowColor = Color::black;
if (item->color)
shadowColor = state.document().textLinkColors().colorFromCSSValue(*item->color, state.style()->color());
operations.operations().append(DropShadowFilterOperation::create(location, blur, shadowColor));
break;
}
default:
ASSERT_NOT_REACHED();
break;
}
}
return operations;
}
示例8: U16_LEAD
// Given the desired base font, this will create a SimpleFontData for a specific
// font that can be used to render the given range of characters.
PassRefPtr<SimpleFontData> FontCache::platformFallbackForCharacter(const FontDescription& fontDescription, UChar32 c, const SimpleFontData*, bool)
{
// FIXME: We should fix getFallbackFamily to take a UChar32
// and remove this split-to-UChar16 code.
UChar codeUnits[2];
int codeUnitsLength;
if (inputC <= 0xFFFF) {
codeUnits[0] = inputC;
codeUnitsLength = 1;
} else {
codeUnits[0] = U16_LEAD(inputC);
codeUnits[1] = U16_TRAIL(inputC);
codeUnitsLength = 2;
}
// FIXME: Consider passing fontDescription.dominantScript()
// to GetFallbackFamily here.
FontDescription fontDescription = fontDescription;
UChar32 c;
UScriptCode script;
const wchar_t* family = getFallbackFamily(codeUnits, codeUnitsLength, fontDescription.genericFamily(), &c, &script);
FontPlatformData* data = 0;
if (family)
data = getFontPlatformData(fontDescription, AtomicString(family, wcslen(family)));
// Last resort font list : PanUnicode. CJK fonts have a pretty
// large repertoire. Eventually, we need to scan all the fonts
// on the system to have a Firefox-like coverage.
// Make sure that all of them are lowercased.
const static wchar_t* const cjkFonts[] = {
L"arial unicode ms",
L"ms pgothic",
L"simsun",
L"gulim",
L"pmingliu",
L"wenquanyi zen hei", // partial CJK Ext. A coverage but more
// widely known to Chinese users.
L"ar pl shanheisun uni",
L"ar pl zenkai uni",
L"han nom a", // Complete CJK Ext. A coverage
L"code2000", // Complete CJK Ext. A coverage
// CJK Ext. B fonts are not listed here because it's of no use
// with our current non-BMP character handling because we use
// Uniscribe for it and that code path does not go through here.
};
const static wchar_t* const commonFonts[] = {
L"tahoma",
L"arial unicode ms",
L"lucida sans unicode",
L"microsoft sans serif",
L"palatino linotype",
// Six fonts below (and code2000 at the end) are not from MS, but
// once installed, cover a very wide range of characters.
L"dejavu serif",
L"dejavu sasns",
L"freeserif",
L"freesans",
L"gentium",
L"gentiumalt",
L"ms pgothic",
L"simsun",
L"gulim",
L"pmingliu",
L"code2000",
};
const wchar_t* const* panUniFonts = 0;
int numFonts = 0;
if (script == USCRIPT_HAN) {
panUniFonts = cjkFonts;
numFonts = WTF_ARRAY_LENGTH(cjkFonts);
} else {
panUniFonts = commonFonts;
numFonts = WTF_ARRAY_LENGTH(commonFonts);
}
// Font returned from GetFallbackFamily may not cover |characters|
// because it's based on script to font mapping. This problem is
// critical enough for non-Latin scripts (especially Han) to
// warrant an additional (real coverage) check with fontCotainsCharacter.
int i;
for (i = 0; (!data || !fontContainsCharacter(data, family, c)) && i < numFonts; ++i) {
family = panUniFonts[i];
data = getFontPlatformData(fontDescription, AtomicString(family, wcslen(family)));
}
// When i-th font (0-base) in |panUniFonts| contains a character and
// we get out of the loop, |i| will be |i + 1|. That is, if only the
// last font in the array covers the character, |i| will be numFonts.
// So, we have to use '<=" rather than '<' to see if we found a font
// covering the character.
if (i <= numFonts)
return fontDataFromPlatformData(data, DoNotRetain);
return 0;
}
示例9: FontPlatformDataCacheKey
FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, bool bold = false, bool italic = false)
:m_family(family), m_size(size), m_bold(bold), m_italic(italic)
{}
示例10: setAttribute
void HTMLSourceElement::setSrc(const String& url)
{
setAttribute(srcAttr, AtomicString(url));
}
示例11: WheelEvent
WheelEvent::WheelEvent()
: WheelEvent(AtomicString(), WheelEventInit())
{
}
示例12: TEST
TEST(ResourceRequestTest, CrossThreadResourceRequestData)
{
ResourceRequest original;
original.setURL(KURL(ParsedURLString, "http://www.example.com/test.htm"));
original.setCachePolicy(UseProtocolCachePolicy);
original.setTimeoutInterval(10);
original.setFirstPartyForCookies(KURL(ParsedURLString, "http://www.example.com/first_party.htm"));
original.setRequestorOrigin(SecurityOrigin::create(KURL(ParsedURLString, "http://www.example.com/first_party.htm")));
original.setHTTPMethod(HTTPNames::GET);
original.setHTTPHeaderField(AtomicString("Foo"), AtomicString("Bar"));
original.setHTTPHeaderField(AtomicString("Piyo"), AtomicString("Fuga"));
original.setPriority(ResourceLoadPriorityLow, 20);
RefPtr<EncodedFormData> originalBody(EncodedFormData::create("Test Body"));
original.setHTTPBody(originalBody);
original.setAllowStoredCredentials(false);
original.setReportUploadProgress(false);
original.setHasUserGesture(false);
original.setDownloadToFile(false);
original.setSkipServiceWorker(false);
original.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS);
original.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeSameOrigin);
original.setRequestorID(30);
original.setRequestorProcessID(40);
original.setAppCacheHostID(50);
original.setRequestContext(WebURLRequest::RequestContextAudio);
original.setFrameType(WebURLRequest::FrameTypeNested);
original.setHTTPReferrer(Referrer("http://www.example.com/referrer.htm", ReferrerPolicyDefault));
EXPECT_STREQ("http://www.example.com/test.htm", original.url().getString().utf8().data());
EXPECT_EQ(UseProtocolCachePolicy, original.getCachePolicy());
EXPECT_EQ(10, original.timeoutInterval());
EXPECT_STREQ("http://www.example.com/first_party.htm", original.firstPartyForCookies().getString().utf8().data());
EXPECT_STREQ("www.example.com", original.requestorOrigin()->host().utf8().data());
EXPECT_STREQ("GET", original.httpMethod().utf8().data());
EXPECT_STREQ("Bar", original.httpHeaderFields().get("Foo").utf8().data());
EXPECT_STREQ("Fuga", original.httpHeaderFields().get("Piyo").utf8().data());
EXPECT_EQ(ResourceLoadPriorityLow, original.priority());
EXPECT_STREQ("Test Body", original.httpBody()->flattenToString().utf8().data());
EXPECT_FALSE(original.allowStoredCredentials());
EXPECT_FALSE(original.reportUploadProgress());
EXPECT_FALSE(original.hasUserGesture());
EXPECT_FALSE(original.downloadToFile());
EXPECT_FALSE(original.skipServiceWorker());
EXPECT_EQ(WebURLRequest::FetchRequestModeCORS, original.fetchRequestMode());
EXPECT_EQ(WebURLRequest::FetchCredentialsModeSameOrigin, original.fetchCredentialsMode());
EXPECT_EQ(30, original.requestorID());
EXPECT_EQ(40, original.requestorProcessID());
EXPECT_EQ(50, original.appCacheHostID());
EXPECT_EQ(WebURLRequest::RequestContextAudio, original.requestContext());
EXPECT_EQ(WebURLRequest::FrameTypeNested, original.frameType());
EXPECT_STREQ("http://www.example.com/referrer.htm", original.httpReferrer().utf8().data());
EXPECT_EQ(ReferrerPolicyDefault, original.getReferrerPolicy());
OwnPtr<CrossThreadResourceRequestData> data1(original.copyData());
ResourceRequest copy1(data1.get());
EXPECT_STREQ("http://www.example.com/test.htm", copy1.url().getString().utf8().data());
EXPECT_EQ(UseProtocolCachePolicy, copy1.getCachePolicy());
EXPECT_EQ(10, copy1.timeoutInterval());
EXPECT_STREQ("http://www.example.com/first_party.htm", copy1.firstPartyForCookies().getString().utf8().data());
EXPECT_STREQ("www.example.com", copy1.requestorOrigin()->host().utf8().data());
EXPECT_STREQ("GET", copy1.httpMethod().utf8().data());
EXPECT_STREQ("Bar", copy1.httpHeaderFields().get("Foo").utf8().data());
EXPECT_EQ(ResourceLoadPriorityLow, copy1.priority());
EXPECT_STREQ("Test Body", copy1.httpBody()->flattenToString().utf8().data());
EXPECT_FALSE(copy1.allowStoredCredentials());
EXPECT_FALSE(copy1.reportUploadProgress());
EXPECT_FALSE(copy1.hasUserGesture());
EXPECT_FALSE(copy1.downloadToFile());
EXPECT_FALSE(copy1.skipServiceWorker());
EXPECT_EQ(WebURLRequest::FetchRequestModeCORS, copy1.fetchRequestMode());
EXPECT_EQ(WebURLRequest::FetchCredentialsModeSameOrigin, copy1.fetchCredentialsMode());
EXPECT_EQ(30, copy1.requestorID());
EXPECT_EQ(40, copy1.requestorProcessID());
EXPECT_EQ(50, copy1.appCacheHostID());
EXPECT_EQ(WebURLRequest::RequestContextAudio, copy1.requestContext());
EXPECT_EQ(WebURLRequest::FrameTypeNested, copy1.frameType());
EXPECT_STREQ("http://www.example.com/referrer.htm", copy1.httpReferrer().utf8().data());
EXPECT_EQ(ReferrerPolicyDefault, copy1.getReferrerPolicy());
copy1.setAllowStoredCredentials(true);
copy1.setReportUploadProgress(true);
copy1.setHasUserGesture(true);
copy1.setDownloadToFile(true);
copy1.setSkipServiceWorker(true);
copy1.setFetchRequestMode(WebURLRequest::FetchRequestModeNoCORS);
copy1.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeInclude);
OwnPtr<CrossThreadResourceRequestData> data2(copy1.copyData());
ResourceRequest copy2(data2.get());
EXPECT_TRUE(copy2.allowStoredCredentials());
EXPECT_TRUE(copy2.reportUploadProgress());
EXPECT_TRUE(copy2.hasUserGesture());
EXPECT_TRUE(copy2.downloadToFile());
EXPECT_TRUE(copy2.skipServiceWorker());
EXPECT_EQ(WebURLRequest::FetchRequestModeNoCORS, copy1.fetchRequestMode());
EXPECT_EQ(WebURLRequest::FetchCredentialsModeInclude, copy1.fetchCredentialsMode());
}
示例13: AtomicString
const AtomicString DOMSettableTokenList::item(unsigned index) const
{
if (index >= length())
return AtomicString();
return m_tokens[index];
}
示例14: createQualifiedName
void createQualifiedName(void* targetAddress, StringImpl* name)
{
new (NotNull, reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nullAtom);
}
示例15: remove
void DOMSettableTokenList::remove(const Vector<String>& tokens, ExceptionState& exceptionState)
{
DOMTokenList::remove(tokens, exceptionState);
for (size_t i = 0; i < tokens.size(); ++i)
m_tokens.remove(AtomicString(tokens[i]));
}