Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: public/web/WebSurroundingText.h

Issue 294073005: Extend WebSurroundingText to accept a WebRange. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use websurroundingtext Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« public/web/WebRange.h ('K') | « public/web/WebRange.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« public/web/WebRange.h ('K') | « public/web/WebRange.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698