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

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: Moar cleanup. 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
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..b09fe155a7bbd940f0f9ee70d2d71a7293a904a2 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -1158,10 +1158,31 @@ 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());
+
+ 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());
+
+ if (Range* range = webRange.createRange(frame()))
esprehn 2016/08/10 04:12:06 making a live Range like this is pretty expensive,
dglazkov 2016/08/10 05:12:13 Agreed, will change in the next CL.
+ return range->text();
+
+ return WebString();
+}
+
void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
{
TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent");

Powered by Google App Engine
This is Rietveld 408576698