| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/tools/test_shell/text_input_controller.h" | 5 #include "webkit/tools/test_shell/text_input_controller.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "webkit/api/public/WebFrame.h" | 8 #include "webkit/api/public/WebFrame.h" |
| 9 #include "webkit/api/public/WebRange.h" | 9 #include "webkit/api/public/WebRange.h" |
| 10 #include "webkit/api/public/WebString.h" | 10 #include "webkit/api/public/WebString.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 void TextInputController::insertText( | 47 void TextInputController::insertText( |
| 48 const CppArgumentList& args, CppVariant* result) { | 48 const CppArgumentList& args, CppVariant* result) { |
| 49 result->SetNull(); | 49 result->SetNull(); |
| 50 | 50 |
| 51 WebFrame* main_frame = GetMainFrame(); | 51 WebFrame* main_frame = GetMainFrame(); |
| 52 if (!main_frame) | 52 if (!main_frame) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 if (args.size() >= 1 && args[0].isString()) | 55 if (args.size() >= 1 && args[0].isString()) { |
| 56 if (main_frame->hasMarkedText()) { |
| 57 main_frame->unmarkText(); |
| 58 main_frame->replaceSelection(WebString()); |
| 59 } |
| 56 main_frame->insertText(WebString::fromUTF8(args[0].ToString())); | 60 main_frame->insertText(WebString::fromUTF8(args[0].ToString())); |
| 61 } |
| 57 } | 62 } |
| 58 | 63 |
| 59 void TextInputController::doCommand( | 64 void TextInputController::doCommand( |
| 60 const CppArgumentList& args, CppVariant* result) { | 65 const CppArgumentList& args, CppVariant* result) { |
| 61 result->SetNull(); | 66 result->SetNull(); |
| 62 | 67 |
| 63 WebFrame* main_frame = GetMainFrame(); | 68 WebFrame* main_frame = GetMainFrame(); |
| 64 if (!main_frame) | 69 if (!main_frame) |
| 65 return; | 70 return; |
| 66 | 71 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 181 |
| 177 result->Set("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment," | 182 result->Set("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment," |
| 178 "NSTextInputReplacementRangeAttributeName"); | 183 "NSTextInputReplacementRangeAttributeName"); |
| 179 } | 184 } |
| 180 | 185 |
| 181 void TextInputController::makeAttributedString( | 186 void TextInputController::makeAttributedString( |
| 182 const CppArgumentList& args, CppVariant* result) { | 187 const CppArgumentList& args, CppVariant* result) { |
| 183 NOTIMPLEMENTED(); | 188 NOTIMPLEMENTED(); |
| 184 result->SetNull(); | 189 result->SetNull(); |
| 185 } | 190 } |
| OLD | NEW |