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 "ui/chromeos/ime/candidate_window_view.h" | 5 #include "ui/chromeos/ime/candidate_window_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const gfx::Size& content_size) const override { | 48 const gfx::Size& content_size) const override { |
49 gfx::Rect bounds(content_size); | 49 gfx::Rect bounds(content_size); |
50 bounds.set_origin(gfx::Point( | 50 bounds.set_origin(gfx::Point( |
51 anchor_rect.x() - offset_, | 51 anchor_rect.x() - offset_, |
52 is_arrow_on_top(arrow()) ? | 52 is_arrow_on_top(arrow()) ? |
53 anchor_rect.bottom() : anchor_rect.y() - content_size.height())); | 53 anchor_rect.bottom() : anchor_rect.y() - content_size.height())); |
54 | 54 |
55 // It cannot use the normal logic of arrow offset for horizontal offscreen, | 55 // It cannot use the normal logic of arrow offset for horizontal offscreen, |
56 // because the arrow must be in the content's edge. But CandidateWindow has | 56 // because the arrow must be in the content's edge. But CandidateWindow has |
57 // to be visible even when |anchor_rect| is out of the screen. | 57 // to be visible even when |anchor_rect| is out of the screen. |
58 gfx::Rect work_area = gfx::Screen::GetNativeScreen()-> | 58 gfx::Rect work_area = |
59 GetDisplayNearestWindow(parent_).work_area(); | 59 gfx::Screen::GetScreen()->GetDisplayNearestWindow(parent_).work_area(); |
60 if (bounds.right() > work_area.right()) | 60 if (bounds.right() > work_area.right()) |
61 bounds.set_x(work_area.right() - bounds.width()); | 61 bounds.set_x(work_area.right() - bounds.width()); |
62 if (bounds.x() < work_area.x()) | 62 if (bounds.x() < work_area.x()) |
63 bounds.set_x(work_area.x()); | 63 bounds.set_x(work_area.x()); |
64 | 64 |
65 return bounds; | 65 return bounds; |
66 } | 66 } |
67 | 67 |
68 gfx::Insets GetInsets() const override { return gfx::Insets(); } | 68 gfx::Insets GetInsets() const override { return gfx::Insets(); } |
69 | 69 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 for (size_t i = 0; i < candidate_views_.size(); ++i) { | 404 for (size_t i = 0; i < candidate_views_.size(); ++i) { |
405 if (sender == candidate_views_[i]) { | 405 if (sender == candidate_views_[i]) { |
406 FOR_EACH_OBSERVER(Observer, observers_, OnCandidateCommitted(i)); | 406 FOR_EACH_OBSERVER(Observer, observers_, OnCandidateCommitted(i)); |
407 return; | 407 return; |
408 } | 408 } |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 } // namespace ime | 412 } // namespace ime |
413 } // namespace ui | 413 } // namespace ui |
OLD | NEW |