Index: Source/web/WebSurroundingText.cpp |
diff --git a/Source/web/WebSurroundingText.cpp b/Source/web/WebSurroundingText.cpp |
index 58383dcdf89ddcb3c6455ad813fe0d1384c26c1e..95ebf743d9e53d369205f684d4c786893f727f9f 100644 |
--- a/Source/web/WebSurroundingText.cpp |
+++ b/Source/web/WebSurroundingText.cpp |
@@ -48,6 +48,15 @@ void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node |
m_private.reset(new SurroundingText(VisiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentAnchoredEquivalent(), maxLength)); |
} |
+void WebSurroundingText::initialize(const WebRange& webRange, size_t maxLength) |
+{ |
+ const Range* range = webRange.constUnwrap<Range>(); |
tkent
2014/06/13 01:15:37
nit: You can simplify the code like:
if (RefPtrWi
mlamouri (slow - plz ping)
2014/06/13 10:34:03
Done.
|
+ if (!range) |
+ return; |
+ |
+ m_private.reset(new SurroundingText(*range, maxLength)); |
+} |
+ |
WebString WebSurroundingText::textContent() const |
{ |
return m_private->content(); |
@@ -59,6 +68,16 @@ size_t WebSurroundingText::hitOffsetInTextContent() const |
return m_private->startOffsetInContent(); |
} |
+size_t WebSurroundingText::startOffsetInTextContent() const |
+{ |
+ return m_private->startOffsetInContent(); |
+} |
+ |
+size_t WebSurroundingText::endOffsetInTextContent() const |
+{ |
+ return m_private->endOffsetInContent(); |
+} |
+ |
WebRange WebSurroundingText::rangeFromContentOffsets(size_t startOffsetInContent, size_t endOffsetInContent) |
{ |
return m_private->rangeFromContentOffsets(startOffsetInContent, endOffsetInContent); |