Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: ui/chromeos/ime/candidate_window_view.cc

Issue 1913613002: Add place holder to move gfx::Display/Screen to ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/chromeos/DEPS ('k') | ui/chromeos/ime/mode_indicator_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "ui/chromeos/ime/candidate_view.h" 13 #include "ui/chromeos/ime/candidate_view.h"
14 #include "ui/chromeos/ime/candidate_window_constants.h" 14 #include "ui/chromeos/ime/candidate_window_constants.h"
15 #include "ui/display/screen.h"
15 #include "ui/gfx/color_utils.h" 16 #include "ui/gfx/color_utils.h"
16 #include "ui/gfx/screen.h"
17 #include "ui/native_theme/native_theme.h" 17 #include "ui/native_theme/native_theme.h"
18 #include "ui/views/background.h" 18 #include "ui/views/background.h"
19 #include "ui/views/border.h" 19 #include "ui/views/border.h"
20 #include "ui/views/bubble/bubble_frame_view.h" 20 #include "ui/views/bubble/bubble_frame_view.h"
21 #include "ui/views/controls/label.h" 21 #include "ui/views/controls/label.h"
22 #include "ui/views/layout/box_layout.h" 22 #include "ui/views/layout/box_layout.h"
23 #include "ui/views/layout/fill_layout.h" 23 #include "ui/views/layout/fill_layout.h"
24 #include "ui/wm/core/window_animations.h" 24 #include "ui/wm/core/window_animations.h"
25 25
26 namespace ui { 26 namespace ui {
(...skipping 21 matching lines...) Expand all
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 = 58 gfx::Rect work_area = display::Screen::GetScreen()
59 gfx::Screen::GetScreen()->GetDisplayNearestWindow(parent_).work_area(); 59 ->GetDisplayNearestWindow(parent_)
60 .work_area();
60 if (bounds.right() > work_area.right()) 61 if (bounds.right() > work_area.right())
61 bounds.set_x(work_area.right() - bounds.width()); 62 bounds.set_x(work_area.right() - bounds.width());
62 if (bounds.x() < work_area.x()) 63 if (bounds.x() < work_area.x())
63 bounds.set_x(work_area.x()); 64 bounds.set_x(work_area.x());
64 65
65 return bounds; 66 return bounds;
66 } 67 }
67 68
68 gfx::Insets GetInsets() const override { return gfx::Insets(); } 69 gfx::Insets GetInsets() const override { return gfx::Insets(); }
69 70
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 for (size_t i = 0; i < candidate_views_.size(); ++i) { 409 for (size_t i = 0; i < candidate_views_.size(); ++i) {
409 if (sender == candidate_views_[i]) { 410 if (sender == candidate_views_[i]) {
410 FOR_EACH_OBSERVER(Observer, observers_, OnCandidateCommitted(i)); 411 FOR_EACH_OBSERVER(Observer, observers_, OnCandidateCommitted(i));
411 return; 412 return;
412 } 413 }
413 } 414 }
414 } 415 }
415 416
416 } // namespace ime 417 } // namespace ime
417 } // namespace ui 418 } // namespace ui
OLDNEW
« no previous file with comments | « ui/chromeos/DEPS ('k') | ui/chromeos/ime/mode_indicator_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698