| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 WebPluginContainerImpl* WebFrameImpl::pluginContainerFromFrame(Frame* frame) | 302 WebPluginContainerImpl* WebFrameImpl::pluginContainerFromFrame(Frame* frame) |
| 303 { | 303 { |
| 304 if (!frame) | 304 if (!frame) |
| 305 return 0; | 305 return 0; |
| 306 if (!frame->document() || !frame->document()->isPluginDocument()) | 306 if (!frame->document() || !frame->document()->isPluginDocument()) |
| 307 return 0; | 307 return 0; |
| 308 PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->documen
t()); | 308 PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->documen
t()); |
| 309 return static_cast<WebPluginContainerImpl *>(pluginDocument->pluginWidget())
; | 309 return static_cast<WebPluginContainerImpl *>(pluginDocument->pluginWidget())
; |
| 310 } | 310 } |
| 311 | 311 |
| 312 WebPluginContainerImpl* WebFrameImpl::pluginContainerFromNode(WebCore::Frame* fr
ame, const WebNode& node) |
| 313 { |
| 314 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame); |
| 315 if (pluginContainer) |
| 316 return pluginContainer; |
| 317 return static_cast<WebPluginContainerImpl*>(node.pluginContainer()); |
| 318 } |
| 319 |
| 312 // Simple class to override some of PrintContext behavior. Some of the methods | 320 // Simple class to override some of PrintContext behavior. Some of the methods |
| 313 // made virtual so that they can be overridden by ChromePluginPrintContext. | 321 // made virtual so that they can be overridden by ChromePluginPrintContext. |
| 314 class ChromePrintContext : public PrintContext { | 322 class ChromePrintContext : public PrintContext { |
| 315 WTF_MAKE_NONCOPYABLE(ChromePrintContext); | 323 WTF_MAKE_NONCOPYABLE(ChromePrintContext); |
| 316 public: | 324 public: |
| 317 ChromePrintContext(Frame* frame) | 325 ChromePrintContext(Frame* frame) |
| 318 : PrintContext(frame) | 326 : PrintContext(frame) |
| 319 , m_printedPageWidth(0) | 327 , m_printedPageWidth(0) |
| 320 { | 328 { |
| 321 } | 329 } |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 // string and call the function on Editor directly. | 1203 // string and call the function on Editor directly. |
| 1196 String command = name; | 1204 String command = name; |
| 1197 | 1205 |
| 1198 // Make sure the first letter is upper case. | 1206 // Make sure the first letter is upper case. |
| 1199 command.replace(0, 1, command.substring(0, 1).upper()); | 1207 command.replace(0, 1, command.substring(0, 1).upper()); |
| 1200 | 1208 |
| 1201 // Remove the trailing ':' if existing. | 1209 // Remove the trailing ':' if existing. |
| 1202 if (command[command.length() - 1] == UChar(':')) | 1210 if (command[command.length() - 1] == UChar(':')) |
| 1203 command = command.substring(0, command.length() - 1); | 1211 command = command.substring(0, command.length() - 1); |
| 1204 | 1212 |
| 1205 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); | 1213 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), n
ode); |
| 1206 if (!pluginContainer) | |
| 1207 pluginContainer = static_cast<WebPluginContainerImpl*>(node.pluginContai
ner()); | |
| 1208 if (pluginContainer && pluginContainer->executeEditCommand(name)) | 1214 if (pluginContainer && pluginContainer->executeEditCommand(name)) |
| 1209 return true; | 1215 return true; |
| 1210 | 1216 |
| 1211 bool result = true; | 1217 bool result = true; |
| 1212 | 1218 |
| 1213 // Specially handling commands that Editor::execCommand does not directly | 1219 // Specially handling commands that Editor::execCommand does not directly |
| 1214 // support. | 1220 // support. |
| 1215 if (command == "DeleteToEndOfParagraph") { | 1221 if (command == "DeleteToEndOfParagraph") { |
| 1216 if (!frame()->editor()->deleteWithDirection(DirectionForward, ParagraphB
oundary, true, false)) | 1222 if (!frame()->editor()->deleteWithDirection(DirectionForward, ParagraphB
oundary, true, false)) |
| 1217 frame()->editor()->deleteWithDirection(DirectionForward, CharacterGr
anularity, true, false); | 1223 frame()->editor()->deleteWithDirection(DirectionForward, CharacterGr
anularity, true, false); |
| 1218 } else if (command == "Indent") | 1224 } else if (command == "Indent") |
| 1219 frame()->editor()->indent(); | 1225 frame()->editor()->indent(); |
| 1220 else if (command == "Outdent") | 1226 else if (command == "Outdent") |
| 1221 frame()->editor()->outdent(); | 1227 frame()->editor()->outdent(); |
| 1222 else if (command == "DeleteBackward") | 1228 else if (command == "DeleteBackward") |
| 1223 result = frame()->editor()->command(AtomicString("BackwardDelete")).exec
ute(); | 1229 result = frame()->editor()->command(AtomicString("BackwardDelete")).exec
ute(); |
| 1224 else if (command == "DeleteForward") | 1230 else if (command == "DeleteForward") |
| 1225 result = frame()->editor()->command(AtomicString("ForwardDelete")).execu
te(); | 1231 result = frame()->editor()->command(AtomicString("ForwardDelete")).execu
te(); |
| 1226 else if (command == "AdvanceToNextMisspelling") { | 1232 else if (command == "AdvanceToNextMisspelling") { |
| 1227 // Wee need to pass false here or else the currently selected word will
never be skipped. | 1233 // Wee need to pass false here or else the currently selected word will
never be skipped. |
| 1228 frame()->editor()->advanceToNextMisspelling(false); | 1234 frame()->editor()->advanceToNextMisspelling(false); |
| 1229 } else if (command == "ToggleSpellPanel") | 1235 } else if (command == "ToggleSpellPanel") |
| 1230 frame()->editor()->showSpellingGuessPanel(); | 1236 frame()->editor()->showSpellingGuessPanel(); |
| 1231 else | 1237 else |
| 1232 result = frame()->editor()->command(command).execute(); | 1238 result = frame()->editor()->command(command).execute(); |
| 1233 return result; | 1239 return result; |
| 1234 } | 1240 } |
| 1235 | 1241 |
| 1236 bool WebFrameImpl::executeCommand(const WebString& name, const WebString& value) | 1242 bool WebFrameImpl::executeCommand(const WebString& name, const WebString& value,
const WebNode& node) |
| 1237 { | 1243 { |
| 1238 ASSERT(frame()); | 1244 ASSERT(frame()); |
| 1239 String webName = name; | 1245 String webName = name; |
| 1240 | 1246 |
| 1247 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), n
ode); |
| 1248 if (pluginContainer && pluginContainer->executeEditCommand(name, value)) |
| 1249 return true; |
| 1250 |
| 1241 // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebK
it for editable nodes. | 1251 // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebK
it for editable nodes. |
| 1242 if (!frame()->editor()->canEdit() && webName == "moveToBeginningOfDocument") | 1252 if (!frame()->editor()->canEdit() && webName == "moveToBeginningOfDocument") |
| 1243 return viewImpl()->propagateScroll(ScrollUp, ScrollByDocument); | 1253 return viewImpl()->propagateScroll(ScrollUp, ScrollByDocument); |
| 1244 | 1254 |
| 1245 if (!frame()->editor()->canEdit() && webName == "moveToEndOfDocument") | 1255 if (!frame()->editor()->canEdit() && webName == "moveToEndOfDocument") |
| 1246 return viewImpl()->propagateScroll(ScrollDown, ScrollByDocument); | 1256 return viewImpl()->propagateScroll(ScrollDown, ScrollByDocument); |
| 1247 | 1257 |
| 1248 return frame()->editor()->command(webName).execute(value); | 1258 return frame()->editor()->command(webName).execute(value); |
| 1249 } | 1259 } |
| 1250 | 1260 |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 | 2519 |
| 2510 // There is a possibility that the frame being detached was the only | 2520 // There is a possibility that the frame being detached was the only |
| 2511 // pending one. We need to make sure final replies can be sent. | 2521 // pending one. We need to make sure final replies can be sent. |
| 2512 flushCurrentScopingEffort(m_findRequestIdentifier); | 2522 flushCurrentScopingEffort(m_findRequestIdentifier); |
| 2513 | 2523 |
| 2514 cancelPendingScopingEffort(); | 2524 cancelPendingScopingEffort(); |
| 2515 } | 2525 } |
| 2516 } | 2526 } |
| 2517 | 2527 |
| 2518 } // namespace WebKit | 2528 } // namespace WebKit |
| OLD | NEW |