Index: Source/core/dom/Range.cpp |
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp |
index 241c62f3c20656a65b4b824ff15af8159d15036e..cca3a7e97968612ffccc367270f1b4deb4d3a01c 100644 |
--- a/Source/core/dom/Range.cpp |
+++ b/Source/core/dom/Range.cpp |
@@ -57,6 +57,10 @@ namespace WebCore { |
DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, rangeCounter, ("Range")); |
+#if ENABLE(OILPAN) |
+unsigned TempRangeScope::s_nesting = 0; |
+#endif |
+ |
inline Range::Range(Document& ownerDocument) |
: m_ownerDocument(&ownerDocument) |
, m_start(m_ownerDocument) |
@@ -65,9 +69,9 @@ inline Range::Range(Document& ownerDocument) |
#ifndef NDEBUG |
rangeCounter.increment(); |
#endif |
- |
ScriptWrappable::init(this); |
- m_ownerDocument->attachRange(this); |
+ if (!TempRangeScope::active()) |
+ m_ownerDocument->attachRange(this); |
} |
PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument) |
@@ -83,9 +87,9 @@ inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs |
#ifndef NDEBUG |
rangeCounter.increment(); |
#endif |
- |
ScriptWrappable::init(this); |
- m_ownerDocument->attachRange(this); |
+ if (!TempRangeScope::active()) |
+ m_ownerDocument->attachRange(this); |
// Simply setting the containers and offsets directly would not do any of the checking |
// that setStart and setEnd do, so we call those functions. |