本文整理汇总了C++中AtomicString::characters方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString::characters方法的具体用法?C++ AtomicString::characters怎么用?C++ AtomicString::characters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomicString
的用法示例。
在下文中一共展示了AtomicString::characters方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: SysAllocStringLen
BString::BString(const AtomicString& s)
{
if (s.isNull())
m_bstr = 0;
else
m_bstr = SysAllocStringLen(s.characters(), s.length());
}
示例3: visitedLinkHash
LinkHash ChromiumBridge::visitedLinkHash(const KURL& base,
const AtomicString& attributeURL)
{
// Resolve the relative URL using googleurl and pass the absolute URL up to
// the embedder. We could create a GURL object from the base and resolve
// the relative URL that way, but calling the lower-level functions
// directly saves us the string allocation in most cases.
url_canon::RawCanonOutput<2048> buffer;
url_parse::Parsed parsed;
#if USE(GOOGLEURL)
const CString& cstr = base.utf8String();
const char* data = cstr.data();
int length = cstr.length();
const url_parse::Parsed& srcParsed = base.parsed();
#else
// When we're not using GoogleURL, first canonicalize it so we can resolve it
// below.
url_canon::RawCanonOutput<2048> srcCanon;
url_parse::Parsed srcParsed;
String str = base.string();
if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed))
return 0;
const char* data = srcCanon.data();
int length = srcCanon.length();
#endif
if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(),
attributeURL.length(), 0, &buffer, &parsed))
return 0; // Invalid resolved URL.
return webKitClient()->visitedLinkHash(buffer.data(), buffer.length());
}
示例4: adoptRef
PassRefPtr<FixedSizeFontData> FixedSizeFontData::create(const AtomicString& family, unsigned weight, bool italic)
{
FixedSizeFontData* fontData = new FixedSizeFontData();
fontData->m_weight = weight;
fontData->m_italic = italic;
LOGFONT& winFont = fontData->m_font;
// The size here looks unusual. The negative number is intentional.
winFont.lfHeight = -72;
winFont.lfWidth = 0;
winFont.lfEscapement = 0;
winFont.lfOrientation = 0;
winFont.lfUnderline = false;
winFont.lfStrikeOut = false;
winFont.lfCharSet = DEFAULT_CHARSET;
winFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
winFont.lfQuality = CLEARTYPE_QUALITY; //DEFAULT_QUALITY;
winFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
winFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
winFont.lfItalic = italic;
winFont.lfWeight = FontPlatformData::adjustedGDIFontWeight(weight, family);
int len = std::min(family.length(), (unsigned int)LF_FACESIZE - 1);
wmemcpy(winFont.lfFaceName, family.characters(), len);
winFont.lfFaceName[len] = L'\0';
fontData->m_hfont.set(CreateFontIndirect(&winFont));
HGDIOBJ oldFont = SelectObject(g_screenDC, fontData->m_hfont.get());
GetTextMetrics(g_screenDC, &fontData->m_metrics);
#if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
if (IMLangFontLink2* langFontLink = fontCache()->getFontLinkInterface()) {
#else
if (IMLangFontLink* langFontLink = fontCache()->getFontLinkInterface()) {
#endif
langFontLink->GetFontCodePages(g_screenDC, fontData->m_hfont.get(), &fontData->m_codePages);
fontData->m_codePages |= FontPlatformData::getKnownFontCodePages(winFont.lfFaceName);
}
SelectObject(g_screenDC, oldFont);
return adoptRef(fontData);
}
static PassRefPtr<FixedSizeFontData> createFixedSizeFontData(const AtomicString& family, unsigned weight, bool italic)
{
FixedSizeFontDataKey key(family, weight, italic);
pair<FixedSizeFontCache::iterator, bool> result = g_fixedSizeFontCache.add(key, RefPtr<FixedSizeFontData>());
if (result.second)
result.first->second = FixedSizeFontData::create(family, weight, italic);
return result.first->second;
}
示例5: createGDIFont
static HFONT createGDIFont(const AtomicString& family, LONG desiredWeight, bool desiredItalic, int size, bool synthesizeItalic)
{
HDC hdc = GetDC(0);
LOGFONT logFont;
logFont.lfCharSet = DEFAULT_CHARSET;
unsigned familyLength = min(family.length(), static_cast<unsigned>(LF_FACESIZE - 1));
memcpy(logFont.lfFaceName, family.characters(), familyLength * sizeof(UChar));
logFont.lfFaceName[familyLength] = 0;
logFont.lfPitchAndFamily = 0;
MatchImprovingProcData matchData(desiredWeight, desiredItalic);
EnumFontFamiliesEx(hdc, &logFont, matchImprovingEnumProc, reinterpret_cast<LPARAM>(&matchData), 0);
ReleaseDC(0, hdc);
if (!matchData.m_hasMatched)
return 0;
matchData.m_chosen.lfHeight = -size;
matchData.m_chosen.lfWidth = 0;
matchData.m_chosen.lfEscapement = 0;
matchData.m_chosen.lfOrientation = 0;
matchData.m_chosen.lfUnderline = false;
matchData.m_chosen.lfStrikeOut = false;
matchData.m_chosen.lfCharSet = DEFAULT_CHARSET;
#if PLATFORM(CG) || PLATFORM(CAIRO)
matchData.m_chosen.lfOutPrecision = OUT_TT_ONLY_PRECIS;
#else
matchData.m_chosen.lfOutPrecision = OUT_TT_PRECIS;
#endif
matchData.m_chosen.lfQuality = DEFAULT_QUALITY;
matchData.m_chosen.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
if (desiredItalic && !matchData.m_chosen.lfItalic && synthesizeItalic)
matchData.m_chosen.lfItalic = 1;
HFONT result = CreateFontIndirect(&matchData.m_chosen);
if (!result)
return 0;
HDC dc = GetDC(0);
SaveDC(dc);
SelectObject(dc, result);
WCHAR actualName[LF_FACESIZE];
GetTextFace(dc, LF_FACESIZE, actualName);
RestoreDC(dc, -1);
ReleaseDC(0, dc);
if (wcsicmp(matchData.m_chosen.lfFaceName, actualName)) {
DeleteObject(result);
result = 0;
}
return result;
}
示例6: getTraitsInFamily
void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
{
LOGFONT logFont;
logFont.lfCharSet = DEFAULT_CHARSET;
unsigned familyLength = std::min(familyName.length(), static_cast<unsigned>(LF_FACESIZE - 1));
memcpy(logFont.lfFaceName, familyName.characters(), familyLength * sizeof(UChar));
logFont.lfFaceName[familyLength] = 0;
logFont.lfPitchAndFamily = 0;
TraitsInFamilyProcData procData(familyName);
EnumFontFamiliesEx(g_screenDC, &logFont, traitsInFamilyEnumProc, reinterpret_cast<LPARAM>(&procData), 0);
copyToVector(procData.m_traitsMasks, traitsMasks);
}
示例7: classAttributeChanged
void StyledElement::classAttributeChanged(const AtomicString& newClassString)
{
const UChar* characters = newClassString.characters();
unsigned length = newClassString.length();
unsigned i;
for (i = 0; i < length; ++i) {
if (!isClassWhitespace(characters[i]))
break;
}
setHasClass(i < length);
if (namedAttrMap) {
if (i < length)
mappedAttributes()->setClass(newClassString);
else
mappedAttributes()->clearClass();
}
setNeedsStyleRecalc();
dispatchSubtreeModifiedEvent();
}
示例8: classAttributeChanged
void StyledElement::classAttributeChanged(const AtomicString& newClassString)
{
const UChar* characters = newClassString.characters();
unsigned length = newClassString.length();
unsigned i;
for (i = 0; i < length; ++i) {
if (isNotHTMLSpace(characters[i]))
break;
}
bool hasClass = i < length;
setHasClass(hasClass);
if (hasClass) {
attributes()->setClass(newClassString);
if (DOMTokenList* classList = optionalClassList())
static_cast<ClassList*>(classList)->reset(newClassString);
} else if (attributeMap())
attributeMap()->clearClass();
setNeedsStyleRecalc();
}
示例9: parseAttribute
void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
const UChar* startPtr = value.characters();
const UChar* endPtr = startPtr + value.length();
// FIXME: We need some error handling here.
if (name == SVGNames::xAttr)
parseNumber(startPtr, endPtr, m_x);
else if (name == SVGNames::yAttr)
parseNumber(startPtr, endPtr, m_y);
else if (name == SVGNames::dxAttr)
parseNumber(startPtr, endPtr, m_dx);
else if (name == SVGNames::dyAttr)
parseNumber(startPtr, endPtr, m_dy);
else {
if (SVGURIReference::parseAttribute(name, value))
return;
SVGStyledElement::parseAttribute(name, value);
}
}
示例10: font
HRESULT STDMETHODCALLTYPE DOMElement::font(WebFontDescription* webFontDescription)
{
if (!webFontDescription) {
ASSERT_NOT_REACHED();
return E_POINTER;
}
ASSERT(m_element);
WebCore::RenderElement* renderer = m_element->renderer();
if (!renderer)
return E_FAIL;
FontDescription fontDescription = renderer->style().font().fontDescription();
AtomicString family = fontDescription.firstFamily();
webFontDescription->family = family.characters();
webFontDescription->familyLength = family.length();
webFontDescription->size = fontDescription.computedSize();
webFontDescription->bold = fontDescription.weight() >= WebCore::FontWeight600;
webFontDescription->italic = fontDescription.italic();
return S_OK;
}
示例11: parseTransformAttribute
bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const AtomicString& transform)
{
const UChar* start = transform.characters();
const UChar* end = start + transform.length();
return parseTransformAttribute(list, start, end);
}
示例12: 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;
}