本文整理汇总了C++中CounterNode::isReset方法的典型用法代码示例。如果您正苦于以下问题:C++ CounterNode::isReset方法的具体用法?C++ CounterNode::isReset怎么用?C++ CounterNode::isReset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CounterNode
的用法示例。
在下文中一共展示了CounterNode::isReset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: counter
PassRefPtr<StringImpl> RenderCounter::originalText() const
{
if (!parent())
return 0;
if (!m_counterNode)
m_counterNode = counter(parent(), m_counter.identifier(), true);
CounterNode* child = m_counterNode;
int value = child->isReset() ? child->value() : child->countInParent();
String text = listMarkerText(m_counter.listStyle(), value);
if (!m_counter.separator().isNull()) {
if (!child->isReset())
child = child->parent();
while (CounterNode* parent = child->parent()) {
text = listMarkerText(m_counter.listStyle(), child->countInParent())
+ m_counter.separator() + text;
child = parent;
}
}
return text.impl();
}
示例2: findPlaceForCounter
static bool findPlaceForCounter(RenderObject* object, const AtomicString& counterName,
bool isReset, CounterNode*& parent, CounterNode*& previousSibling)
{
// Find the appropriate previous sibling for insertion into the parent node
// by searching in render tree order for a child of the counter.
parent = 0;
previousSibling = 0;
RenderObject* resetCandidate = isReset ? object->parent() : previousSiblingOrParent(object);
RenderObject* prevCounterCandidate = object;
CounterNode* candidateCounter = 0;
// When a reset counter is chosen as candidateCounter, we'll
// decide the new node should be a child of the reset node or a
// sibling or the reset node. This flag controls it.
bool createChildForReset = true;
while ((prevCounterCandidate = prevCounterCandidate->previousInPreOrder())) {
CounterNode* c = counter(prevCounterCandidate, counterName, false);
if (prevCounterCandidate == resetCandidate) {
if (!candidateCounter) {
candidateCounter = c;
createChildForReset = true;
}
if (candidateCounter) {
if (createChildForReset && candidateCounter->isReset()) {
parent = candidateCounter;
previousSibling = 0;
} else {
parent = candidateCounter->parent();
previousSibling = candidateCounter;
}
return true;
}
resetCandidate = previousSiblingOrParent(resetCandidate);
} else if (c) {
if (c->isReset()) {
if (c->parent()) {
// The new node may be the next sibling of this reset node.
createChildForReset = false;
candidateCounter = c;
} else {
createChildForReset = true;
candidateCounter = 0;
}
} else if (!candidateCounter) {
createChildForReset = true;
candidateCounter = c;
}
}
}
return false;
}
示例3: generateContent
void RenderCounter::generateContent()
{
bool counters;
counters = !m_counter->separator().isNull();
if(!m_counterNode)
m_counterNode = getCounter(m_counter->identifier().string(), true, counters);
int value = m_counterNode->count();
if(m_counterNode->isReset())
value = m_counterNode->value();
int total = value;
if(m_counterNode->parent())
total = m_counterNode->parent()->total();
m_item = toListStyleType(value, total, (EListStyleType)m_counter->listStyle());
if(counters)
{
CounterNode *counter = m_counterNode->parent();
// we deliberately do not render the root counter-node
while(counter->parent() && !(counter->isReset() && counter->parent()->isRoot()))
{
value = counter->count();
total = counter->parent()->total();
m_item = toListStyleType(value, total, (EListStyleType)m_counter->listStyle()) + m_counter->separator().string() + m_item;
counter = counter->parent();
};
}
}