本文整理汇总了C++中RenderStyle::counterDirectives方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::counterDirectives方法的具体用法?C++ RenderStyle::counterDirectives怎么用?C++ RenderStyle::counterDirectives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::counterDirectives方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: planCounter
static bool planCounter(RenderObject* object, const AtomicString& identifier, bool& isReset, int& value)
{
ASSERT(object);
// Real text nodes don't have their own style so they can't have counters.
// We can't even look at their styles or we'll see extra resets and increments!
if (object->isText() && !object->isBR())
return false;
RenderStyle* style = object->style();
ASSERT(style);
if (const CounterDirectiveMap* directivesMap = style->counterDirectives()) {
CounterDirectives directives = directivesMap->get(identifier.impl());
if (directives.m_reset) {
value = directives.m_resetValue;
if (directives.m_increment)
value += directives.m_incrementValue;
isReset = true;
return true;
}
if (directives.m_increment) {
value = directives.m_incrementValue;
isReset = false;
return true;
}
}
if (identifier == "list-item") {
if (object->isListItem()) {
if (toRenderListItem(object)->hasExplicitValue()) {
value = toRenderListItem(object)->explicitValue();
isReset = true;
return true;
}
value = 1;
isReset = false;
return true;
}
if (Node* e = object->node()) {
if (e->hasTagName(olTag)) {
value = static_cast<HTMLOListElement*>(e)->start();
isReset = true;
return true;
}
if (e->hasTagName(ulTag) || e->hasTagName(menuTag) || e->hasTagName(dirTag)) {
value = 0;
isReset = true;
return true;
}
}
}
return false;
}