Chromium Code Reviews| 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"); |