Index: Source/web/WebRange.cpp |
diff --git a/Source/web/WebRange.cpp b/Source/web/WebRange.cpp |
index e4fce81f6f93a11d22f234d51600caef9201c9e7..564ea5502a324952910685b6907f876d67b9e13d 100644 |
--- a/Source/web/WebRange.cpp |
+++ b/Source/web/WebRange.cpp |
@@ -52,20 +52,14 @@ using namespace WebCore; |
namespace blink { |
-class WebRangePrivate : public Range { |
-}; |
- |
void WebRange::reset() |
{ |
- assign(0); |
+ m_private.reset(); |
} |
void WebRange::assign(const WebRange& other) |
{ |
- WebRangePrivate* p = const_cast<WebRangePrivate*>(other.m_private); |
- if (p) |
- p->ref(); |
- assign(p); |
+ m_private = other.m_private; |
} |
int WebRange::startOffset() const |
@@ -143,28 +137,14 @@ WebVector<WebFloatQuad> WebRange::textQuads() const |
return quads; |
} |
-WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range) |
- : m_private(static_cast<WebRangePrivate*>(range.leakRef())) |
-{ |
-} |
- |
-WebRange& WebRange::operator=(const WTF::PassRefPtr<WebCore::Range>& range) |
-{ |
- assign(static_cast<WebRangePrivate*>(range.leakRef())); |
- return *this; |
-} |
- |
-WebRange::operator WTF::PassRefPtr<WebCore::Range>() const |
+WebRange::WebRange(const PassRefPtrWillBeRawPtr<WebCore::Range>& range) |
+ : m_private(range) |
{ |
- return PassRefPtr<Range>(const_cast<WebRangePrivate*>(m_private)); |
} |
-void WebRange::assign(WebRangePrivate* p) |
+WebRange::operator PassRefPtrWillBeRawPtr<WebCore::Range>() const |
{ |
- // p is already ref'd for us by the caller |
- if (m_private) |
- m_private->deref(); |
- m_private = p; |
+ return m_private.get(); |
} |
} // namespace blink |