| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/text_input_controller.h" | 5 #include "components/test_runner/text_input_controller.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "components/test_runner/web_test_proxy.h" | 8 #include "components/test_runner/web_test_proxy.h" |
| 9 #include "gin/arguments.h" | 9 #include "gin/arguments.h" |
| 10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 return int_array; | 214 return int_array; |
| 215 } | 215 } |
| 216 | 216 |
| 217 std::vector<int> TextInputController::SelectedRange() { | 217 std::vector<int> TextInputController::SelectedRange() { |
| 218 if (!view()->mainFrame()) | 218 if (!view()->mainFrame()) |
| 219 return std::vector<int>(); | 219 return std::vector<int>(); |
| 220 | 220 |
| 221 blink::WebRange range = view()->mainFrame()->selectionRange(); | 221 blink::WebRange range = view()->mainFrame()->selectionRange(); |
| 222 std::vector<int> int_array(2); | 222 std::vector<int> int_array(2); |
| 223 int_array[0] = range.startOffset(); | 223 if (!range.isNull()) { |
| 224 int_array[1] = range.endOffset(); | 224 // editing/selection/5825350-1.html |
| 225 | 225 int_array[0] = range.startOffset(); |
| 226 int_array[1] = range.endOffset(); |
| 227 } |
| 226 return int_array; | 228 return int_array; |
| 227 } | 229 } |
| 228 | 230 |
| 229 std::vector<int> TextInputController::FirstRectForCharacterRange( | 231 std::vector<int> TextInputController::FirstRectForCharacterRange( |
| 230 unsigned location, | 232 unsigned location, |
| 231 unsigned length) { | 233 unsigned length) { |
| 232 blink::WebRect rect; | 234 blink::WebRect rect; |
| 233 if (!view()->focusedFrame() || | 235 if (!view()->focusedFrame() || |
| 234 !view()->focusedFrame()->firstRectForCharacterRange(location, length, | 236 !view()->focusedFrame()->firstRectForCharacterRange(location, length, |
| 235 rect)) { | 237 rect)) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 263 blink::WebString::fromUTF8(text), | 265 blink::WebString::fromUTF8(text), |
| 264 blink::WebVector<blink::WebCompositionUnderline>(underlines), | 266 blink::WebVector<blink::WebCompositionUnderline>(underlines), |
| 265 text.length(), text.length()); | 267 text.length(), text.length()); |
| 266 } | 268 } |
| 267 | 269 |
| 268 blink::WebView* TextInputController::view() { | 270 blink::WebView* TextInputController::view() { |
| 269 return web_test_proxy_base_->web_view(); | 271 return web_test_proxy_base_->web_view(); |
| 270 } | 272 } |
| 271 | 273 |
| 272 } // namespace test_runner | 274 } // namespace test_runner |
| OLD | NEW |