本文整理汇总了C++中StyleRuleBase::isNamespaceRule方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleRuleBase::isNamespaceRule方法的具体用法?C++ StyleRuleBase::isNamespaceRule怎么用?C++ StyleRuleBase::isNamespaceRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleRuleBase
的用法示例。
在下文中一共展示了StyleRuleBase::isNamespaceRule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertRule
unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, ExceptionState& exceptionState)
{
ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == m_contents->ruleCount());
if (index > length()) {
exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is larger than the maximum index (" + String::number(length()) + ").");
return 0;
}
CSSParserContext context(m_contents->parserContext(), UseCounter::getFrom(this));
StyleRuleBase* rule = CSSParser::parseRule(context, m_contents.get(), ruleString);
if (!rule) {
exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule '" + ruleString + "'.");
return 0;
}
RuleMutationScope mutationScope(this);
bool success = m_contents->wrapperInsertRule(rule, index);
if (!success) {
if (rule->isNamespaceRule())
exceptionState.throwDOMException(InvalidStateError, "Failed to insert the rule");
else
exceptionState.throwDOMException(HierarchyRequestError, "Failed to insert the rule.");
return 0;
}
if (!m_childRuleCSSOMWrappers.isEmpty())
m_childRuleCSSOMWrappers.insert(index, Member<CSSRule>(nullptr));
return index;
}