本文整理汇总了C++中StyleBase::isFontFaceRule方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleBase::isFontFaceRule方法的具体用法?C++ StyleBase::isFontFaceRule怎么用?C++ StyleBase::isFontFaceRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleBase
的用法示例。
在下文中一共展示了StyleBase::isFontFaceRule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serializeCSSStyleSheet
void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KURL& url)
{
StringBuilder cssText;
for (unsigned i = 0; i < styleSheet->length(); ++i) {
StyleBase* item = styleSheet->item(i);
String itemText = item->cssText();
if (!itemText.isEmpty()) {
cssText.append(itemText);
if (i < styleSheet->length() - 1)
cssText.append("\n\n");
}
// Some rules have resources associated with them that we need to retrieve.
if (item->isImportRule()) {
CSSImportRule* importRule = static_cast<CSSImportRule*>(item);
KURL importURL = styleSheet->document()->completeURL(importRule->href());
if (m_resourceURLs.contains(importURL))
continue;
serializeCSSStyleSheet(importRule->styleSheet(), importURL);
} else if (item->isFontFaceRule()) {
// FIXME: Add support for font face rule. It is not clear to me at this point if the actual otf/eot file can
// be retrieved from the CSSFontFaceRule object.
} else if (item->isStyleRule())
retrieveResourcesForCSSRule(static_cast<CSSStyleRule*>(item));
}
if (url.isValid() && !m_resourceURLs.contains(url)) {
// FIXME: We should check whether a charset has been specified and if none was found add one.
TextEncoding textEncoding(styleSheet->charset());
ASSERT(textEncoding.isValid());
String textString = cssText.toString();
CString text = textEncoding.encode(textString.characters(), textString.length(), EntitiesForUnencodables);
m_resources->append(Resource(url, String("text/css"), SharedBuffer::create(text.data(), text.length())));
m_resourceURLs.add(url);
}
}