Index: public/web/WebSurroundingText.h |
diff --git a/public/web/WebSurroundingText.h b/public/web/WebSurroundingText.h |
index aa6e268faa55b6a637c2972d5f3bd50b081054b1..5a6fa4954b539d2c3762f747370cfbdbea55e933 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. |
tkent
2014/06/13 01:15:37
Nit: I recommend to wrap code comments in 80 colum
mlamouri (slow - plz ping)
2014/06/13 10:34:04
Done. I've also changed the rest of the comments i
|
+// It allows caller to know the text surrounding a point or a range. |
class WebSurroundingText { |
public: |
WebSurroundingText() { } |
@@ -52,12 +55,24 @@ public: |
// 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). |
+ // This should only be called when WebSurroundingText has been initialized with a WebPoint. |
+ // DEPRECATED: use startOffsetInTextContent() or endOffsetInTextContent(). |
BLINK_EXPORT size_t hitOffsetInTextContent() const; |
+ // 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); |