本文整理汇总了C++中TreeScope::applyAuthorStyles方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeScope::applyAuthorStyles方法的具体用法?C++ TreeScope::applyAuthorStyles怎么用?C++ TreeScope::applyAuthorStyles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeScope
的用法示例。
在下文中一共展示了TreeScope::applyAuthorStyles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectMatchingRules
void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
{
ASSERT(matchRequest.ruleSet);
ASSERT(m_state.element());
const StyleResolver::State& state = m_state;
Element* element = state.element();
const StyledElement* styledElement = state.styledElement();
const AtomicString& pseudoId = element->shadowPseudoId();
if (!pseudoId.isEmpty()) {
ASSERT(styledElement);
collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId.impl()), matchRequest, ruleRange);
}
#if ENABLE(VIDEO_TRACK)
if (element->isWebVTTElement())
collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), matchRequest, ruleRange);
#endif
// Check whether other types of rules are applicable in the current tree scope. Criteria for this:
// a) it's a UA rule
// b) the tree scope allows author rules
// c) the rules comes from a scoped style sheet within the same tree scope
TreeScope* treeScope = element->treeScope();
if (!MatchingUARulesScope::isMatchingUARules()
&& !treeScope->applyAuthorStyles()
&& (!matchRequest.scope || matchRequest.scope->treeScope() != treeScope)
&& m_behaviorAtBoundary == SelectorChecker::DoesNotCrossBoundary)
return;
// We need to collect the rules for id, class, tag, and everything else into a buffer and
// then sort the buffer.
if (element->hasID())
collectMatchingRulesForList(matchRequest.ruleSet->idRules(element->idForStyleResolution().impl()), matchRequest, ruleRange);
if (styledElement && styledElement->hasClass()) {
for (size_t i = 0; i < styledElement->classNames().size(); ++i)
collectMatchingRulesForList(matchRequest.ruleSet->classRules(styledElement->classNames()[i].impl()), matchRequest, ruleRange);
}
if (element->isLink())
collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), matchRequest, ruleRange);
if (SelectorChecker::matchesFocusPseudoClass(element))
collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), matchRequest, ruleRange);
collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element->localName().impl()), matchRequest, ruleRange);
collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), matchRequest, ruleRange);
}