Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport) | 1153 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport) |
| 1154 { | 1154 { |
| 1155 moveRangeSelection(baseInViewport, extentInViewport); | 1155 moveRangeSelection(baseInViewport, extentInViewport); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 void WebLocalFrameImpl::selectRange(const WebRange& webRange) | 1158 void WebLocalFrameImpl::selectRange(const WebRange& webRange) |
| 1159 { | 1159 { |
| 1160 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange"); | 1160 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange"); |
| 1161 if (Range* range = static_cast<Range*>(webRange)) | 1161 |
| 1162 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited. | |
| 1163 // see http://crbug.com/590369 for more details. | |
| 1164 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | |
| 1165 | |
| 1166 DocumentLifecycle::DisallowTransitionScope(frame()->document()->lifecycle()) ; | |
| 1167 | |
| 1168 if (Range* range = webRange.createRange(frame())) | |
| 1162 frame()->selection().setSelectedRange(range, VP_DEFAULT_AFFINITY, Select ionDirectionalMode::NonDirectional, NotUserTriggered); | 1169 frame()->selection().setSelectedRange(range, VP_DEFAULT_AFFINITY, Select ionDirectionalMode::NonDirectional, NotUserTriggered); |
| 1163 } | 1170 } |
| 1164 | 1171 |
| 1172 WebString WebLocalFrameImpl::rangeAsText(const WebRange& webRange) | |
| 1173 { | |
| 1174 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited. | |
| 1175 // see http://crbug.com/590369 for more details. | |
| 1176 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | |
| 1177 | |
| 1178 DocumentLifecycle::DisallowTransitionScope(frame()->document()->lifecycle()) ; | |
| 1179 | |
| 1180 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.
| |
| 1181 return range->text(); | |
| 1182 | |
| 1183 return WebString(); | |
| 1184 } | |
| 1185 | |
| 1165 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) | 1186 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) |
| 1166 { | 1187 { |
| 1167 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent"); | 1188 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent"); |
| 1168 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point)); | 1189 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point)); |
| 1169 } | 1190 } |
| 1170 | 1191 |
| 1171 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) | 1192 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) |
| 1172 { | 1193 { |
| 1173 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelection"); | 1194 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelection"); |
| 1174 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; | 1195 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2182 { | 2203 { |
| 2183 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2204 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2184 } | 2205 } |
| 2185 | 2206 |
| 2186 void WebLocalFrameImpl::clearActiveFindMatch() | 2207 void WebLocalFrameImpl::clearActiveFindMatch() |
| 2187 { | 2208 { |
| 2188 ensureTextFinder().clearActiveFindMatch(); | 2209 ensureTextFinder().clearActiveFindMatch(); |
| 2189 } | 2210 } |
| 2190 | 2211 |
| 2191 } // namespace blink | 2212 } // namespace blink |
| OLD | NEW |