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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.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/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebRange.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index b63751118caf9add9186f4eea739d914af8eee9d..7d1e61452e45adff8ca773f1d52dcd6985a82c87 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -1158,10 +1158,35 @@ void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi
void WebLocalFrameImpl::selectRange(const WebRange& webRange)
{
TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange");
- if (Range* range = static_cast<Range*>(webRange))
+
+ // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets needs to be audited.
+ // see http://crbug.com/590369 for more details.
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ DocumentLifecycle::DisallowTransitionScope(frame()->document()->lifecycle());
+
+ // TODO(dglazkov): Use EphemeralRange here.
+ // See http://crbug.com/636216 for more details.
+ if (Range* range = webRange.createRange(frame()))
frame()->selection().setSelectedRange(range, VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, NotUserTriggered);
}
+WebString WebLocalFrameImpl::rangeAsText(const WebRange& webRange)
+{
+ // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets needs to be audited.
+ // see http://crbug.com/590369 for more details.
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ DocumentLifecycle::DisallowTransitionScope(frame()->document()->lifecycle());
+
+ // TODO(dglazkov): Use EphemeralRange here.
+ // See http://crbug.com/636216 for more details.
+ if (Range* range = webRange.createRange(frame()))
+ return range->text();
+
+ return WebString();
+}
+
void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
{
TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent");
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698