| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/stringprintf.h" |
| 8 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 9 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 12 #include "webkit/tools/test_shell/test_shell.h" | 13 #include "webkit/tools/test_shell/test_shell.h" |
| 13 | 14 |
| 14 using WebKit::WebFrame; | 15 using WebKit::WebFrame; |
| 15 using WebKit::WebRange; | 16 using WebKit::WebRange; |
| 16 using WebKit::WebString; | 17 using WebKit::WebString; |
| 17 | 18 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const CppArgumentList& args, CppVariant* result) { | 134 const CppArgumentList& args, CppVariant* result) { |
| 134 result->SetNull(); | 135 result->SetNull(); |
| 135 | 136 |
| 136 WebFrame* main_frame = GetMainFrame(); | 137 WebFrame* main_frame = GetMainFrame(); |
| 137 if (!main_frame) | 138 if (!main_frame) |
| 138 return; | 139 return; |
| 139 | 140 |
| 140 WebRange range = main_frame->markedRange(); | 141 WebRange range = main_frame->markedRange(); |
| 141 | 142 |
| 142 std::string range_str; | 143 std::string range_str; |
| 143 SStringPrintf(&range_str, "%d,%d", range.startOffset(), range.endOffset()); | 144 base::SStringPrintf(&range_str, "%d,%d", range.startOffset(), |
| 145 range.endOffset()); |
| 144 result->Set(range_str); | 146 result->Set(range_str); |
| 145 } | 147 } |
| 146 | 148 |
| 147 void TextInputController::selectedRange( | 149 void TextInputController::selectedRange( |
| 148 const CppArgumentList& args, CppVariant* result) { | 150 const CppArgumentList& args, CppVariant* result) { |
| 149 result->SetNull(); | 151 result->SetNull(); |
| 150 | 152 |
| 151 WebFrame* main_frame = GetMainFrame(); | 153 WebFrame* main_frame = GetMainFrame(); |
| 152 if (!main_frame) | 154 if (!main_frame) |
| 153 return; | 155 return; |
| 154 | 156 |
| 155 WebRange range = main_frame->selectionRange(); | 157 WebRange range = main_frame->selectionRange(); |
| 156 | 158 |
| 157 std::string range_str; | 159 std::string range_str; |
| 158 SStringPrintf(&range_str, "%d,%d", range.startOffset(), range.endOffset()); | 160 base::SStringPrintf(&range_str, "%d,%d", range.startOffset(), |
| 161 range.endOffset()); |
| 159 result->Set(range_str); | 162 result->Set(range_str); |
| 160 } | 163 } |
| 161 | 164 |
| 162 void TextInputController::firstRectForCharacterRange( | 165 void TextInputController::firstRectForCharacterRange( |
| 163 const CppArgumentList& args, CppVariant* result) { | 166 const CppArgumentList& args, CppVariant* result) { |
| 164 NOTIMPLEMENTED(); | 167 NOTIMPLEMENTED(); |
| 165 result->SetNull(); | 168 result->SetNull(); |
| 166 } | 169 } |
| 167 | 170 |
| 168 void TextInputController::characterIndexForPoint( | 171 void TextInputController::characterIndexForPoint( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 181 | 184 |
| 182 result->Set("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment," | 185 result->Set("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment," |
| 183 "NSTextInputReplacementRangeAttributeName"); | 186 "NSTextInputReplacementRangeAttributeName"); |
| 184 } | 187 } |
| 185 | 188 |
| 186 void TextInputController::makeAttributedString( | 189 void TextInputController::makeAttributedString( |
| 187 const CppArgumentList& args, CppVariant* result) { | 190 const CppArgumentList& args, CppVariant* result) { |
| 188 NOTIMPLEMENTED(); | 191 NOTIMPLEMENTED(); |
| 189 result->SetNull(); | 192 result->SetNull(); |
| 190 } | 193 } |
| OLD | NEW |