本文整理汇总了C++中StyleRule::selectorList方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleRule::selectorList方法的具体用法?C++ StyleRule::selectorList怎么用?C++ StyleRule::selectorList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleRule
的用法示例。
在下文中一共展示了StyleRule::selectorList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeStyleSheet
void StyleInvalidationAnalysis::analyzeStyleSheet(StyleSheetContents* styleSheetContents)
{
ASSERT(!styleSheetContents->isLoading());
// See if all rules on the sheet are scoped to some specific ids or classes.
// Then test if we actually have any of those in the tree at the moment.
const Vector<RefPtr<StyleRuleImport> >& importRules = styleSheetContents->importRules();
for (unsigned i = 0; i < importRules.size(); ++i) {
if (!importRules[i]->styleSheet())
continue;
analyzeStyleSheet(importRules[i]->styleSheet());
if (m_dirtiesAllStyle)
return;
}
const Vector<RefPtr<StyleRuleBase> >& rules = styleSheetContents->childRules();
for (unsigned i = 0; i < rules.size(); i++) {
StyleRuleBase* rule = rules[i].get();
if (!rule->isStyleRule()) {
// FIXME: Media rules and maybe some others could be allowed.
m_dirtiesAllStyle = true;
return;
}
StyleRule* styleRule = static_cast<StyleRule*>(rule);
if (!determineSelectorScopes(styleRule->selectorList(), m_idScopes, m_classScopes)) {
m_dirtiesAllStyle = true;
return;
}
}
}
示例2: addChildRules
void RuleSet::addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& rules, const MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags)
{
for (unsigned i = 0; i < rules.size(); ++i) {
StyleRuleBase* rule = rules[i].get();
if (rule->isStyleRule()) {
StyleRule* styleRule = toStyleRule(rule);
const CSSSelectorList& selectorList = styleRule->selectorList();
for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
if (selectorList.selectorCrossesTreeScopes(selectorIndex)) {
m_treeBoundaryCrossingRules.append(MinimalRuleData(styleRule, selectorIndex, addRuleFlags));
} else if (selectorList.hasShadowDistributedAt(selectorIndex)) {
m_shadowDistributedRules.append(MinimalRuleData(styleRule, selectorIndex, addRuleFlags));
} else {
addRule(styleRule, selectorIndex, addRuleFlags);
}
}
} else if (rule->isPageRule()) {
addPageRule(toStyleRulePage(rule));
} else if (rule->isMediaRule()) {
StyleRuleMedia* mediaRule = toStyleRuleMedia(rule);
if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), &m_viewportDependentMediaQueryResults)))
addChildRules(mediaRule->childRules(), medium, addRuleFlags);
} else if (rule->isFontFaceRule()) {
addFontFaceRule(toStyleRuleFontFace(rule));
} else if (rule->isKeyframesRule()) {
addKeyframesRule(toStyleRuleKeyframes(rule));
} else if (rule->isViewportRule()) {
addViewportRule(toStyleRuleViewport(rule));
} else if (rule->isSupportsRule() && toStyleRuleSupports(rule)->conditionIsSupported()) {
addChildRules(toStyleRuleSupports(rule)->childRules(), medium, addRuleFlags);
}
}
}
示例3: addChildRules
void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase> >& rules, const MediaQueryEvaluator& medium, StyleResolver* resolver, const ContainerNode* scope, bool hasDocumentSecurityOrigin, AddRuleFlags addRuleFlags)
{
for (unsigned i = 0; i < rules.size(); ++i) {
StyleRuleBase* rule = rules[i].get();
if (rule->isStyleRule()) {
StyleRule* styleRule = static_cast<StyleRule*>(rule);
const CSSSelectorList& selectorList = styleRule->selectorList();
for (size_t selectorIndex = 0; selectorIndex != notFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
if (selectorList.hasShadowDistributedAt(selectorIndex)) {
if (isDocumentScope(scope))
continue;
resolver->ruleSets().shadowDistributedRules().addRule(styleRule, selectorIndex, const_cast<ContainerNode*>(scope), addRuleFlags);
} else
addRule(styleRule, selectorIndex, addRuleFlags);
}
} else if (rule->isPageRule())
addPageRule(static_cast<StyleRulePage*>(rule));
else if (rule->isMediaRule()) {
StyleRuleMedia* mediaRule = static_cast<StyleRuleMedia*>(rule);
if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), resolver)))
addChildRules(mediaRule->childRules(), medium, resolver, scope, hasDocumentSecurityOrigin, addRuleFlags);
} else if (rule->isFontFaceRule() && resolver) {
// Add this font face to our set.
// FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment.
if (!isDocumentScope(scope))
continue;
const StyleRuleFontFace* fontFaceRule = static_cast<StyleRuleFontFace*>(rule);
resolver->fontSelector()->addFontFaceRule(fontFaceRule);
resolver->invalidateMatchedPropertiesCache();
} else if (rule->isKeyframesRule() && resolver) {
// FIXME (BUG 72462): We don't add @keyframe rules of scoped style sheets for the moment.
if (!isDocumentScope(scope))
continue;
resolver->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(rule));
}
else if (rule->isRegionRule() && resolver) {
// FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment.
addRegionRule(static_cast<StyleRuleRegion*>(rule), hasDocumentSecurityOrigin);
}
else if (rule->isHostRule())
resolver->ensureScopedStyleResolver(scope->shadowHost())->addHostRule(static_cast<StyleRuleHost*>(rule), hasDocumentSecurityOrigin, scope);
#if ENABLE(CSS_DEVICE_ADAPTATION)
else if (rule->isViewportRule() && resolver) {
// @viewport should not be scoped.
if (!isDocumentScope(scope))
continue;
resolver->viewportStyleResolver()->addViewportRule(static_cast<StyleRuleViewport*>(rule));
}
#endif
else if (rule->isSupportsRule() && static_cast<StyleRuleSupports*>(rule)->conditionIsSupported())
addChildRules(static_cast<StyleRuleSupports*>(rule)->childRules(), medium, resolver, scope, hasDocumentSecurityOrigin, addRuleFlags);
}
}
示例4: createStyleRule
StyleRuleBase* BisonCSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector>>* selectors)
{
StyleRule* result = 0;
if (selectors) {
m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create();
rule->parserAdoptSelectorVector(*selectors);
rule->setProperties(createStylePropertySet());
result = rule.get();
m_parsedRules.append(rule.release());
CSSSelectorParser::recordSelectorStats(m_context, result->selectorList());
}
clearProperties();
return result;
}
示例5: analyzeStyleSheet
void StyleSheetInvalidationAnalysis::analyzeStyleSheet(StyleSheetContents* styleSheetContents)
{
// Updating the style on the shadow DOM for image fallback content can bring us here when imports
// are still getting loaded in the main document. Just need to exit early as we will return here
// when the imports finish loading.
if (styleSheetContents->isLoading())
return;
// See if all rules on the sheet are scoped to some specific ids or classes.
// Then test if we actually have any of those in the tree at the moment.
const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>>& importRules = styleSheetContents->importRules();
for (unsigned i = 0; i < importRules.size(); ++i) {
if (!importRules[i]->styleSheet())
continue;
analyzeStyleSheet(importRules[i]->styleSheet());
if (m_dirtiesAllStyle)
return;
}
if (m_treeScope->rootNode().isShadowRoot())
return;
const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& rules = styleSheetContents->childRules();
for (unsigned i = 0; i < rules.size(); i++) {
StyleRuleBase* rule = rules[i].get();
if (!rule->isStyleRule()) {
if (ruleAdditionMightRequireDocumentStyleRecalc(rule)) {
m_dirtiesAllStyle = true;
return;
}
continue;
}
StyleRule* styleRule = toStyleRule(rule);
if (!determineSelectorScopes(styleRule->selectorList(), m_idScopes, m_classScopes)) {
m_dirtiesAllStyle = true;
return;
}
}
}
示例6: analyzeStyleSheet
void StyleInvalidationAnalysis::analyzeStyleSheet(StyleSheetContents* styleSheetContents)
{
ASSERT(!styleSheetContents->isLoading());
// See if all rules on the sheet are scoped to some specific ids or classes.
// Then test if we actually have any of those in the tree at the moment.
const Vector<RefPtr<StyleRuleImport> >& importRules = styleSheetContents->importRules();
for (unsigned i = 0; i < importRules.size(); ++i) {
if (!importRules[i]->styleSheet())
continue;
analyzeStyleSheet(importRules[i]->styleSheet());
if (m_dirtiesAllStyle)
return;
}
if (styleSheetContents->hasSingleOwnerNode()) {
Node* ownerNode = styleSheetContents->singleOwnerNode();
if (ownerNode && ownerNode->hasTagName(HTMLNames::styleTag) && toHTMLStyleElement(ownerNode)->isRegisteredAsScoped()) {
m_scopingNodes.append(determineScopingNodeForStyleScoped(toHTMLStyleElement(ownerNode), styleSheetContents));
return;
}
}
const Vector<RefPtr<StyleRuleBase> >& rules = styleSheetContents->childRules();
for (unsigned i = 0; i < rules.size(); i++) {
StyleRuleBase* rule = rules[i].get();
if (!rule->isStyleRule()) {
if (ruleAdditionMightRequireDocumentStyleRecalc(rule)) {
m_dirtiesAllStyle = true;
return;
}
continue;
}
StyleRule* styleRule = toStyleRule(rule);
if (!determineSelectorScopes(styleRule->selectorList(), m_idScopes, m_classScopes)) {
m_dirtiesAllStyle = true;
return;
}
}
}
示例7: addChildRules
void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase> >& rules, const MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags)
{
for (unsigned i = 0; i < rules.size(); ++i) {
StyleRuleBase* rule = rules[i].get();
if (rule->isStyleRule()) {
StyleRule* styleRule = toStyleRule(rule);
const CSSSelectorList& selectorList = styleRule->selectorList();
for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex))
addRule(styleRule, selectorIndex, addRuleFlags);
} else if (rule->isMediaRule()) {
StyleRuleMedia* mediaRule = toStyleRuleMedia(rule);
if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), &m_viewportDependentMediaQueryResults)))
addChildRules(mediaRule->childRules(), medium, addRuleFlags);
} else if (rule->isFontFaceRule()) {
addFontFaceRule(toStyleRuleFontFace(rule));
} else if (rule->isKeyframesRule()) {
addKeyframesRule(toStyleRuleKeyframes(rule));
} else if (rule->isSupportsRule() && toStyleRuleSupports(rule)->conditionIsSupported()) {
addChildRules(toStyleRuleSupports(rule)->childRules(), medium, addRuleFlags);
}
}
}