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

Unified Diff: Source/web/WebLocalFrameImpl.cpp

Issue 294073005: Extend WebSurroundingText to accept a WebRange. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase and use int 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
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index 0f7d09def92a947eb0c685d170f8c73e68a76815..f90b6c4a7fb96da3c289ddbba405f0da10f30c13 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -94,6 +94,7 @@
#include "core/editing/InputMethodController.h"
#include "core/editing/PlainTextRange.h"
#include "core/editing/SpellChecker.h"
+#include "core/editing/SurroundingText.h"
#include "core/editing/TextAffinity.h"
#include "core/editing/TextIterator.h"
#include "core/editing/htmlediting.h"
@@ -1300,6 +1301,16 @@ void WebLocalFrameImpl::setCaretVisible(bool visible)
frame()->selection().setCaretVisible(visible);
}
+WebString WebLocalFrameImpl::textSurroundingSelection(int maxLength, int* startOffset, int* endOffset) const
+{
+ ASSERT(maxLength > 0);
+
+ SurroundingText surroundingText(frame()->selection().start(), frame()->selection().end(), maxLength);
+ *startOffset = surroundingText.startOffsetInContent();
+ *endOffset = surroundingText.endOffsetInContent();
+ return surroundingText.content();
+}
+
VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
{
FloatPoint unscaledPoint(point);

Powered by Google App Engine
This is Rietveld 408576698