Index: public/web/WebSurroundingText.h |
diff --git a/public/web/WebSurroundingText.h b/public/web/WebSurroundingText.h |
index aa6e268faa55b6a637c2972d5f3bd50b081054b1..b5abbc834620bc1be8f93886c81edfee707e1a2b 100644 |
--- a/public/web/WebSurroundingText.h |
+++ b/public/web/WebSurroundingText.h |
@@ -38,8 +38,11 @@ namespace blink { |
class WebHitTestResult; |
class WebNode; |
+class WebRange; |
struct WebPoint; |
+// WebSurroundingText is a Blink API that gives access to the SurroundingText |
+// API. It allows caller to know the text surrounding a point or a range. |
class WebSurroundingText { |
public: |
WebSurroundingText() { } |
@@ -48,17 +51,34 @@ public: |
BLINK_EXPORT bool isNull() const; |
BLINK_EXPORT void reset(); |
- // Initializes the object to get the surrounding text centered in the position relative to a provided node. |
+ // Initializes the object to get the surrounding text centered in the |
+ // position relative to a provided node. |
// The maximum length of the contents retrieved is defined by maxLength. |
BLINK_EXPORT void initialize(const WebNode&, const WebPoint&, size_t maxLength); |
+ // Initializes the object to get the text surrounding a given range. |
+ // The maximum length of the contents retrieved is defined by maxLength. |
+ // It does not include the text inside the range. |
+ BLINK_EXPORT void initialize(const WebRange&, size_t maxLength); |
+ |
// Surrounding text content retrieved. |
BLINK_EXPORT WebString textContent() const; |
- // Offset in the text content of the initial hit position (or provided offset in the node). |
+ // Offset in the text content of the initial hit position (or provided |
+ // offset in the node). |
+ // This should only be called when WebSurroundingText has been initialized |
+ // with a WebPoint. |
+ // DEPRECATED: use startOffsetInTextContent() or endOffsetInTextContent(). |
BLINK_EXPORT size_t hitOffsetInTextContent() const; |
- // Convert start/end positions in the content text string into a WebKit text range. |
+ // Start offset of the initial text in the text content. |
+ BLINK_EXPORT size_t startOffsetInTextContent() const; |
+ |
+ // End offset of the initial text in the text content. |
+ BLINK_EXPORT size_t endOffsetInTextContent() const; |
+ |
+ // Convert start/end positions in the content text string into a WebKit text |
+ // range. |
BLINK_EXPORT WebRange rangeFromContentOffsets(size_t startOffsetInContent, size_t endOffsetInContent); |
protected: |