本文整理汇总了C++中ContainerNode::setNeedsStyleRecalc方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerNode::setNeedsStyleRecalc方法的具体用法?C++ ContainerNode::setNeedsStyleRecalc怎么用?C++ ContainerNode::setNeedsStyleRecalc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerNode
的用法示例。
在下文中一共展示了ContainerNode::setNeedsStyleRecalc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerWithScopingNode
void HTMLStyleElement::registerWithScopingNode()
{
// Note: We cannot rely on the 'scoped' element already being present when this method is invoked.
// Therefore we cannot rely on scoped()!
ASSERT(!m_isRegisteredWithScopingNode);
ASSERT(inDocument());
if (m_isRegisteredWithScopingNode)
return;
if (!ContextEnabledFeatures::styleScopedEnabled(document()))
return;
ContainerNode* scope = parentNode();
if (!scope)
return;
if (!scope->isElementNode() && !scope->isShadowRoot()) {
// DocumentFragment nodes should never be inDocument,
// <style> should not be a child of Document, PI or some such.
ASSERT_NOT_REACHED();
return;
}
scope->registerScopedHTMLStyleChild();
scope->setNeedsStyleRecalc();
if (inDocument() && !document()->parsing() && document()->renderer())
document()->styleResolverChanged(DeferRecalcStyle);
m_isRegisteredWithScopingNode = true;
}
示例2: unregisterWithScopingNode
void HTMLStyleElement::unregisterWithScopingNode()
{
// Note: We cannot rely on the 'scoped' element still being present when this method is invoked.
// Therefore we cannot rely on scoped()!
ASSERT(m_isRegisteredWithScopingNode || !RuntimeEnabledFeatures::styleScopedEnabled());
if (!m_isRegisteredWithScopingNode)
return;
if (!RuntimeEnabledFeatures::styleScopedEnabled())
return;
ContainerNode* scope = parentNode();
ASSERT(scope);
if (scope) {
ASSERT(scope->hasScopedHTMLStyleChild());
scope->unregisterScopedHTMLStyleChild();
scope->setNeedsStyleRecalc();
}
if (inDocument() && !document()->parsing() && document()->renderer())
document()->styleResolverChanged(DeferRecalcStyle);
m_isRegisteredWithScopingNode = false;
}
示例3: invalidateStyle
void StyleSheetInvalidationAnalysis::invalidateStyle()
{
ASSERT(!m_dirtiesAllStyle);
if (m_treeScope->rootNode().isShadowRoot()) {
ContainerNode* shadowHost = toShadowRoot(m_treeScope->rootNode()).host();
shadowHost->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
return;
}
if (m_idScopes.isEmpty() && m_classScopes.isEmpty())
return;
Element* element = ElementTraversal::firstWithin(m_treeScope->document());
while (element) {
if (elementMatchesSelectorScopes(element, m_idScopes, m_classScopes)) {
element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
// The whole subtree is now invalidated, we can skip to the next sibling.
element = ElementTraversal::nextSkippingChildren(*element);
continue;
}
element = ElementTraversal::next(*element);
}
}