本文整理汇总了C++中StyleSheetContents::baseURL方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleSheetContents::baseURL方法的具体用法?C++ StyleSheetContents::baseURL怎么用?C++ StyleSheetContents::baseURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleSheetContents
的用法示例。
在下文中一共展示了StyleSheetContents::baseURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRulesFromSheet
void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
{
m_authorStyleSheets.append(cssSheet);
StyleSheetContents* sheet = cssSheet->contents();
AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canRequest(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState;
const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags);
resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults());
resolver->processScopedRules(ruleSet, sheet->baseURL(), &m_scopingNode);
}
示例2: appendCSSStyleSheet
void ScopedStyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet, const MediaQueryEvaluator& medium)
{
unsigned index = m_authorStyleSheets.size();
m_authorStyleSheets.append(&cssSheet);
StyleSheetContents* sheet = cssSheet.contents();
AddRuleFlags addRuleFlags = treeScope().document().securityOrigin()->canRequest(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState;
const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags);
addKeyframeRules(ruleSet);
addFontFaceRules(ruleSet);
addTreeBoundaryCrossingRules(ruleSet, &cssSheet, index);
treeScope().document().styleResolver()->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults());
}
示例3: requestStyleSheet
void StyleRuleImport::requestStyleSheet()
{
if (!m_parentStyleSheet)
return;
Document* document = m_parentStyleSheet->singleOwnerDocument();
if (!document)
return;
CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader();
if (!cachedResourceLoader)
return;
URL absURL;
if (!m_parentStyleSheet->baseURL().isNull())
// use parent styleheet's URL as the base URL
absURL = URL(m_parentStyleSheet->baseURL(), m_strHref);
else
absURL = document->completeURL(m_strHref);
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
StyleSheetContents* rootSheet = m_parentStyleSheet;
for (StyleSheetContents* sheet = m_parentStyleSheet; sheet; sheet = sheet->parentStyleSheet()) {
if (equalIgnoringFragmentIdentifier(absURL, sheet->baseURL())
|| equalIgnoringFragmentIdentifier(absURL, document->completeURL(sheet->originalURL())))
return;
rootSheet = sheet;
}
CachedResourceRequest request(ResourceRequest(absURL), m_parentStyleSheet->charset());
request.setInitiator(cachedResourceRequestInitiators().css);
if (m_cachedSheet)
m_cachedSheet->removeClient(&m_styleSheetClient);
if (m_parentStyleSheet->isUserStyleSheet())
m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request);
else
m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request);
if (m_cachedSheet) {
// if the import rule is issued dynamically, the sheet may be
// removed from the pending sheet count, so let the doc know
// the sheet being imported is pending.
if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootSheet == m_parentStyleSheet)
m_parentStyleSheet->startLoadingDynamicSheet();
m_loading = true;
m_cachedSheet->addClient(&m_styleSheetClient);
}
}
示例4: requestStyleSheet
void StyleRuleImport::requestStyleSheet() {
if (!m_parentStyleSheet)
return;
Document* document = m_parentStyleSheet->singleOwnerDocument();
if (!document)
return;
ResourceFetcher* fetcher = document->fetcher();
if (!fetcher)
return;
KURL absURL;
if (!m_parentStyleSheet->baseURL().isNull()) {
// use parent styleheet's URL as the base URL
absURL = KURL(m_parentStyleSheet->baseURL(), m_strHref);
} else {
absURL = document->completeURL(m_strHref);
}
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
StyleSheetContents* rootSheet = m_parentStyleSheet;
for (StyleSheetContents* sheet = m_parentStyleSheet; sheet;
sheet = sheet->parentStyleSheet()) {
if (equalIgnoringFragmentIdentifier(absURL, sheet->baseURL()) ||
equalIgnoringFragmentIdentifier(
absURL, document->completeURL(sheet->originalURL())))
return;
rootSheet = sheet;
}
FetchRequest request(ResourceRequest(absURL), FetchInitiatorTypeNames::css,
m_parentStyleSheet->charset());
m_resource = CSSStyleSheetResource::fetch(request, fetcher);
if (m_resource) {
// if the import rule is issued dynamically, the sheet may be
// removed from the pending sheet count, so let the doc know
// the sheet being imported is pending.
if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() &&
rootSheet == m_parentStyleSheet)
m_parentStyleSheet->startLoadingDynamicSheet();
m_loading = true;
m_resource->addClient(m_styleSheetClient);
}
}
示例5: addRulesFromSheet
void RuleSet::addRulesFromSheet(StyleSheetContents& sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
{
for (auto& rule : sheet.importRules()) {
if (rule->styleSheet() && (!rule->mediaQueries() || medium.eval(rule->mediaQueries(), resolver)))
addRulesFromSheet(*rule->styleSheet(), medium, resolver);
}
bool hasDocumentSecurityOrigin = resolver && resolver->document().securityOrigin()->canRequest(sheet.baseURL());
AddRuleFlags addRuleFlags = static_cast<AddRuleFlags>((hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : 0));
// FIXME: Skip Content Security Policy check when stylesheet is in a user agent shadow tree.
// See <https://bugs.webkit.org/show_bug.cgi?id=146663>.
bool isInitiatingElementInUserAgentShadowTree = false;
addChildRules(sheet.childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);
if (m_autoShrinkToFitEnabled)
shrinkToFit();
}