Index: Source/core/dom/NodeWithIndex.h |
diff --git a/Source/core/dom/NodeWithIndex.h b/Source/core/dom/NodeWithIndex.h |
index 02b6d33c15acdadcd3abdffe27003c6f37e2500e..7efddfc8aff82e84c90d1e7dbbbbabccfa616f8a 100644 |
--- a/Source/core/dom/NodeWithIndex.h |
+++ b/Source/core/dom/NodeWithIndex.h |
@@ -36,7 +36,7 @@ class NodeWithIndex { |
public: |
explicit NodeWithIndex(Node& node) |
: m_node(node) |
- , m_haveIndex(false) |
+ , m_index(-1) |
{ |
} |
@@ -44,17 +44,17 @@ public: |
int index() const |
{ |
- if (!m_haveIndex) { |
+ if (!hasIndex()) |
m_index = m_node.nodeIndex(); |
- m_haveIndex = true; |
- } |
+ ASSERT(hasIndex()); |
ASSERT(m_index == static_cast<int>(m_node.nodeIndex())); |
return m_index; |
} |
private: |
+ bool hasIndex() const { return m_index >= 0; } |
+ |
Node& m_node; |
- mutable bool m_haveIndex; |
mutable int m_index; |
}; |