本文整理汇总了C++中StyleRule::properties方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleRule::properties方法的具体用法?C++ StyleRule::properties怎么用?C++ StyleRule::properties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleRule
的用法示例。
在下文中一共展示了StyleRule::properties方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectMatchingRulesForList
void ElementRuleCollector::collectMatchingRulesForList(const RuleSet::RuleDataVector* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
{
if (!rules)
return;
for (unsigned i = 0, size = rules->size(); i < size; ++i) {
const RuleData& ruleData = rules->data()[i];
if (!ruleData.canMatchPseudoElement() && m_pseudoStyleRequest.pseudoId != NOPSEUDO)
continue;
if (m_selectorFilter && m_selectorFilter->fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
continue;
StyleRule* rule = ruleData.rule();
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StyleProperties& properties = rule->properties();
if (properties.isEmpty() && !matchRequest.includeEmptyRules)
continue;
// FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
continue;
unsigned specificity;
if (ruleMatches(ruleData, specificity))
addMatchedRule(ruleData, specificity, matchRequest.treeContextOrdinal, ruleRange);
}
}
示例2: collectMatchingRulesForList
void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
{
if (!rules)
return;
for (unsigned i = 0, size = rules->size(); i < size; ++i) {
const RuleData& ruleData = rules->data()[i];
if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
continue;
StyleRule* rule = ruleData.rule();
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StyleProperties& properties = rule->properties();
if (properties.isEmpty() && !matchRequest.includeEmptyRules)
continue;
// FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
continue;
if (ruleMatches(ruleData)) {
// Update our first/last rule indices in the matched rules array.
++ruleRange.lastRuleIndex;
if (ruleRange.firstRuleIndex == -1)
ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData);
}
}
}
示例3: collectRuleIfMatches
void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
{
if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
return;
StyleRule* rule = ruleData.rule();
PseudoId dynamicPseudo = NOPSEUDO;
if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo, behaviorAtBoundary)) {
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StylePropertySet* properties = rule->properties();
if (!properties || (properties->isEmpty() && !matchRequest.includeEmptyRules))
return;
// FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
return;
// If we're matching normal rules, set a pseudo bit if
// we really just matched a pseudo-element.
if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO) {
if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == SelectorChecker::CollectingStyleRules)
return;
// FIXME: Matching should not modify the style directly.
if (m_style && dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
m_style->setHasPseudoStyle(dynamicPseudo);
} else {
// Update our first/last rule indices in the matched rules array.
++ruleRange.lastRuleIndex;
if (ruleRange.firstRuleIndex == -1)
ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData, cascadeScope, cascadeOrder);
return;
}
}
}
示例4: collectMatchingRulesForList
void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* rules, CascadeOrder cascadeOrder, const MatchRequest& matchRequest)
{
if (!rules)
return;
SelectorChecker::Init init;
init.mode = m_mode;
init.isUARule = m_matchingUARules;
init.elementStyle = m_style.get();
init.scrollbar = m_pseudoStyleRequest.scrollbar;
init.scrollbarPart = m_pseudoStyleRequest.scrollbarPart;
SelectorChecker checker(init);
SelectorChecker::SelectorCheckingContext context(m_context.element(), SelectorChecker::VisitedMatchEnabled);
context.scope = matchRequest.scope;
context.pseudoId = m_pseudoStyleRequest.pseudoId;
unsigned rejected = 0;
unsigned fastRejected = 0;
unsigned matched = 0;
for (const auto& ruleData : *rules) {
if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes())) {
fastRejected++;
continue;
}
// FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
continue;
StyleRule* rule = ruleData.rule();
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StylePropertySet& properties = rule->properties();
if (properties.isEmpty() && !m_includeEmptyRules)
continue;
SelectorChecker::MatchResult result;
context.selector = &ruleData.selector();
if (!checker.match(context, result)) {
rejected++;
continue;
}
if (m_pseudoStyleRequest.pseudoId != PseudoIdNone && m_pseudoStyleRequest.pseudoId != result.dynamicPseudo) {
rejected++;
continue;
}
matched++;
didMatchRule(ruleData, result, cascadeOrder, matchRequest);
}
StyleEngine& styleEngine = m_context.element()->document().styleEngine();
if (!styleEngine.stats())
return;
INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesRejected, rejected);
INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesFastRejected, fastRejected);
INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesMatched, matched);
}
示例5: doCollectMatchingRulesForList
void ElementRuleCollector::doCollectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
{
if (!rules)
return;
const StyleResolver::State& state = m_state;
unsigned size = rules->size();
for (unsigned i = 0; i < size; ++i) {
const RuleData& ruleData = rules->at(i);
if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
continue;
StyleRule* rule = ruleData.rule();
InspectorInstrumentationCookie cookie;
if (hasInspectorFrontends)
cookie = InspectorInstrumentation::willMatchRule(document(), rule, m_inspectorCSSOMWrappers, document()->styleSheetCollection());
PseudoId dynamicPseudo = NOPSEUDO;
if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo)) {
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StylePropertySet* properties = rule->properties();
if (!properties || (properties->isEmpty() && !matchRequest.includeEmptyRules)) {
if (hasInspectorFrontends)
InspectorInstrumentation::didMatchRule(cookie, false);
continue;
}
// FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin()) {
if (hasInspectorFrontends)
InspectorInstrumentation::didMatchRule(cookie, false);
continue;
}
// If we're matching normal rules, set a pseudo bit if
// we really just matched a pseudo-element.
if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO) {
if (m_mode == SelectorChecker::CollectingRules) {
if (hasInspectorFrontends)
InspectorInstrumentation::didMatchRule(cookie, false);
continue;
}
if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
state.style()->setHasPseudoStyle(dynamicPseudo);
} else {
// Update our first/last rule indices in the matched rules array.
++ruleRange.lastRuleIndex;
if (ruleRange.firstRuleIndex == -1)
ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData);
if (hasInspectorFrontends)
InspectorInstrumentation::didMatchRule(cookie, true);
continue;
}
}
if (hasInspectorFrontends)
InspectorInstrumentation::didMatchRule(cookie, false);
}
}
示例6: collectRuleIfMatches
void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, CascadeOrder cascadeOrder, const MatchRequest& matchRequest)
{
StyleRule* rule = ruleData.rule();
if (ruleMatches(ruleData)) {
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StylePropertySet& properties = rule->properties();
if (properties.isEmpty())
return;
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData, cascadeOrder, matchRequest.styleSheetIndex, matchRequest.styleSheet);
}
}
示例7: collectMatchingRulesForList
void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
{
if (!rules)
return;
for (unsigned i = 0, size = rules->size(); i < size; ++i) {
const RuleData& ruleData = rules->data()[i];
if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
continue;
StyleRule* rule = ruleData.rule();
PseudoId dynamicPseudo = NOPSEUDO;
if (ruleMatches(ruleData, dynamicPseudo)) {
// For SharingRules testing, any match is good enough, we don't care what is matched.
if (m_mode == SelectorChecker::SharingRules || m_mode == SelectorChecker::StyleInvalidation) {
addMatchedRule(&ruleData);
break;
}
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StyleProperties& properties = rule->properties();
if (properties.isEmpty() && !matchRequest.includeEmptyRules)
continue;
// FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
continue;
// If we're matching normal rules, set a pseudo bit if
// we really just matched a pseudo-element.
if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO) {
if (m_mode == SelectorChecker::CollectingRules)
continue;
if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID && m_style)
m_style->setHasPseudoStyle(dynamicPseudo);
} else {
// Update our first/last rule indices in the matched rules array.
++ruleRange.lastRuleIndex;
if (ruleRange.firstRuleIndex == -1)
ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData);
continue;
}
}
}
}
示例8: collectRuleIfMatches
void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, SelectorChecker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
{
StyleRule* rule = ruleData.rule();
if (ruleMatches(ruleData, matchRequest.scope, contextFlags)) {
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StylePropertySet& properties = rule->properties();
if (properties.isEmpty() && !matchRequest.includeEmptyRules)
return;
// Update our first/last rule indices in the matched rules array.
++ruleRange.lastRuleIndex;
if (ruleRange.firstRuleIndex == -1)
ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData, cascadeScope, cascadeOrder, matchRequest.styleSheetIndex, matchRequest.styleSheet);
}
}
示例9: StyleRuleBase
StyleRule::StyleRule(const StyleRule& o)
: StyleRuleBase(o),
m_selectorList(o.m_selectorList.copy()),
m_properties(o.properties().mutableCopy()),
m_shouldConsiderForMatchingRules(ConsiderIfNonEmpty) {}
示例10: retrieveResourcesForRule
void PageSerializer::retrieveResourcesForRule(StyleRule& rule, Document* document)
{
retrieveResourcesForProperties(&rule.properties(), document);
}
示例11: StyleRuleBase
StyleRule::StyleRule(const StyleRule& o)
: StyleRuleBase(o)
, m_properties(o.properties().mutableCopy())
, m_selectorList(o.m_selectorList)
{
}