| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 4282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4293 TransformRectToViewsRootCoordSpace(params.focus_rect, views_[index])); | 4293 TransformRectToViewsRootCoordSpace(params.focus_rect, views_[index])); |
| 4294 anchor_bound.set_type(gfx::SelectionBound::LEFT); | 4294 anchor_bound.set_type(gfx::SelectionBound::LEFT); |
| 4295 focus_bound.set_type(gfx::SelectionBound::RIGHT); | 4295 focus_bound.set_type(gfx::SelectionBound::RIGHT); |
| 4296 gfx::Rect measured_rect = | 4296 gfx::Rect measured_rect = |
| 4297 gfx::RectBetweenSelectionBounds(anchor_bound, focus_bound); | 4297 gfx::RectBetweenSelectionBounds(anchor_bound, focus_bound); |
| 4298 | 4298 |
| 4299 EXPECT_EQ(measured_rect, text_input_client()->GetCaretBounds()); | 4299 EXPECT_EQ(measured_rect, text_input_client()->GetCaretBounds()); |
| 4300 } | 4300 } |
| 4301 } | 4301 } |
| 4302 | 4302 |
| 4303 // This test activates child frames in a specific sequence and changes their |
| 4304 // composition range. Then it verifies that the ui::TextInputClient returns the |
| 4305 // correct character bound at the given indices. |
| 4306 TEST_F(InputMethodStateAuraTest, GetCompositionCharacterBounds) { |
| 4307 gfx::Rect bound; |
| 4308 // Initially, there should be no bounds. |
| 4309 EXPECT_FALSE(text_input_client()->GetCompositionCharacterBounds(0, &bound)); |
| 4310 for (auto index : active_view_sequence_) { |
| 4311 ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); |
| 4312 // Simulate an IPC to set character bounds for the view. |
| 4313 views_[index]->ImeCompositionRangeChanged(gfx::Range(), |
| 4314 {gfx::Rect(1, 2, 3, 4 + index)}); |
| 4315 |
| 4316 // No bounds at index 1. |
| 4317 EXPECT_FALSE(text_input_client()->GetCompositionCharacterBounds(1, &bound)); |
| 4318 |
| 4319 // Valid bound at index 0. |
| 4320 EXPECT_TRUE(text_input_client()->GetCompositionCharacterBounds(0, &bound)); |
| 4321 EXPECT_EQ(4 + (int)index, bound.height()); |
| 4322 } |
| 4323 } |
| 4324 |
| 4303 } // namespace content | 4325 } // namespace content |
| OLD | NEW |