| 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 { | 1234 { |
| 1235 return createRange(frame()->selection().selection().toNormalizedEphemeralRan
ge()); | 1235 return createRange(frame()->selection().selection().toNormalizedEphemeralRan
ge()); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 WebString WebLocalFrameImpl::selectionAsText() const | 1238 WebString WebLocalFrameImpl::selectionAsText() const |
| 1239 { | 1239 { |
| 1240 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); | 1240 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); |
| 1241 if (pluginContainer) | 1241 if (pluginContainer) |
| 1242 return pluginContainer->plugin()->selectionAsText(); | 1242 return pluginContainer->plugin()->selectionAsText(); |
| 1243 | 1243 |
| 1244 String text = frame()->selection().selectedText(TextIteratorEmitsObjectRepla
cementCharacter); | 1244 const EphemeralRange range = frame()->selection().selection().toNormalizedEp
hemeralRange(); |
| 1245 if (range.isNull()) |
| 1246 return WebString(); |
| 1247 |
| 1248 String text = plainText(range, TextIteratorEmitsObjectReplacementCharacter); |
| 1245 #if OS(WIN) | 1249 #if OS(WIN) |
| 1246 replaceNewlinesWithWindowsStyleNewlines(text); | 1250 replaceNewlinesWithWindowsStyleNewlines(text); |
| 1247 #endif | 1251 #endif |
| 1248 replaceNBSPWithSpace(text); | 1252 replaceNBSPWithSpace(text); |
| 1249 return text; | 1253 return text; |
| 1250 } | 1254 } |
| 1251 | 1255 |
| 1252 WebString WebLocalFrameImpl::selectionAsMarkup() const | 1256 WebString WebLocalFrameImpl::selectionAsMarkup() const |
| 1253 { | 1257 { |
| 1254 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); | 1258 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); |
| 1255 if (pluginContainer) | 1259 if (pluginContainer) |
| 1256 return pluginContainer->plugin()->selectionAsMarkup(); | 1260 return pluginContainer->plugin()->selectionAsMarkup(); |
| 1257 | 1261 |
| 1258 return frame()->selection().selectedHTMLForClipboard(); | 1262 const EphemeralRange range = frame()->selection().selection().toNormalizedEp
hemeralRange(); |
| 1263 if (range.isNull()) |
| 1264 return WebString(); |
| 1265 |
| 1266 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI
nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 1259 } | 1267 } |
| 1260 | 1268 |
| 1261 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit
ion position) | 1269 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit
ion position) |
| 1262 { | 1270 { |
| 1263 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectWordAroundPosition"); | 1271 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectWordAroundPosition"); |
| 1264 frame->selection().selectWordAroundPosition(position); | 1272 frame->selection().selectWordAroundPosition(position); |
| 1265 } | 1273 } |
| 1266 | 1274 |
| 1267 bool WebLocalFrameImpl::selectWordAroundCaret() | 1275 bool WebLocalFrameImpl::selectWordAroundCaret() |
| 1268 { | 1276 { |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 } | 2198 } |
| 2191 | 2199 |
| 2192 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2200 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
| 2193 { | 2201 { |
| 2194 if (!frame()) | 2202 if (!frame()) |
| 2195 return WebSandboxFlags::None; | 2203 return WebSandboxFlags::None; |
| 2196 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2204 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2197 } | 2205 } |
| 2198 | 2206 |
| 2199 } // namespace blink | 2207 } // namespace blink |
| OLD | NEW |