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

Unified Diff: third_party/WebKit/Source/web/WebSurroundingText.cpp

Issue 2199523002: Convert WebRange to be a simple pair of numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot the exports. Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/web/WebRange.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebSurroundingText.cpp
diff --git a/third_party/WebKit/Source/web/WebSurroundingText.cpp b/third_party/WebKit/Source/web/WebSurroundingText.cpp
index 1584e7c32a52731609e9da487dfc91fba4c482ec..cdd758ef53c6bfbda039d7bd194a1c21bdae44d2 100644
--- a/third_party/WebKit/Source/web/WebSurroundingText.cpp
+++ b/third_party/WebKit/Source/web/WebSurroundingText.cpp
@@ -28,11 +28,13 @@
#include "core/dom/Node.h"
#include "core/dom/Range.h"
#include "core/dom/Text.h"
+#include "core/editing/FrameSelection.h"
#include "core/editing/SurroundingText.h"
#include "core/editing/VisiblePosition.h"
#include "core/layout/LayoutObject.h"
#include "public/platform/WebPoint.h"
#include "public/web/WebHitTestResult.h"
+#include "web/WebLocalFrameImpl.h"
namespace blink {
@@ -53,9 +55,10 @@ void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node
m_private.reset(new SurroundingText(createVisiblePosition(node->layoutObject()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentAnchoredEquivalent(), maxLength));
}
-void WebSurroundingText::initialize(const WebRange& webRange, size_t maxLength)
+void WebSurroundingText::initializeFromCurrentSelection(WebLocalFrame* frame, size_t maxLength)
{
- if (Range* range = static_cast<Range*>(webRange))
+ LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame();
+ if (Range* range = createRange(webFrame->selection().selection().toNormalizedEphemeralRange()))
m_private.reset(new SurroundingText(*range, maxLength));
}
« no previous file with comments | « third_party/WebKit/Source/web/WebRange.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698