本文整理汇总了C++中StyleBase::isImportRule方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleBase::isImportRule方法的具体用法?C++ StyleBase::isImportRule怎么用?C++ StyleBase::isImportRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleBase
的用法示例。
在下文中一共展示了StyleBase::isImportRule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: isLoading
bool CSSStyleSheet::isLoading()
{
unsigned len = length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* rule = item(i);
if (rule->isImportRule() && static_cast<CSSImportRule*>(rule)->isLoading())
return true;
}
return false;
}
示例3: isLoading
bool XSLStyleSheet::isLoading()
{
unsigned len = length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* rule = item(i);
if (rule->isImportRule()) {
XSLImportRule* import = static_cast<XSLImportRule*>(rule);
if (import->isLoading())
return true;
}
}
return false;
}
示例4: clearDocuments
void XSLStyleSheet::clearDocuments()
{
m_stylesheetDoc = 0;
unsigned len = length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* rule = item(i);
if (rule->isImportRule()) {
XSLImportRule* import = static_cast<XSLImportRule*>(rule);
if (import->styleSheet())
import->styleSheet()->clearDocuments();
}
}
}
示例5: locateStylesheetSubResource
xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri)
{
bool matchedParent = (parentDoc == document());
unsigned len = length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* rule = item(i);
if (rule->isImportRule()) {
XSLImportRule* import = static_cast<XSLImportRule*>(rule);
XSLStyleSheet* child = import->styleSheet();
if (!child)
continue;
if (matchedParent) {
if (child->processed())
continue; // libxslt has been given this sheet already.
// Check the URI of the child stylesheet against the doc URI.
// In order to ensure that libxml canonicalized both URLs, we get the original href
// string from the import rule and canonicalize it using libxml before comparing it
// with the URI argument.
CString importHref = import->href().utf8();
xmlChar* base = xmlNodeGetBase(parentDoc, (xmlNodePtr)parentDoc);
xmlChar* childURI = xmlBuildURI((const xmlChar*)importHref.data(), base);
bool equalURIs = xmlStrEqual(uri, childURI);
xmlFree(base);
xmlFree(childURI);
if (equalURIs) {
child->markAsProcessed();
return child->document();
}
} else {
xmlDocPtr result = import->styleSheet()->locateStylesheetSubResource(parentDoc, uri);
if (result)
return result;
}
}
}
return 0;
}