| 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 "ash/ime/candidate_view.h" | 5 #include "ash/ime/candidate_view.h" |
| 6 | 6 |
| 7 #include "ash/ime/candidate_window_constants.h" | 7 #include "ash/ime/candidate_window_constants.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "ui/base/ime/candidate_window.h" | 9 #include "ui/base/ime/candidate_window.h" |
| 10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 SchedulePaint(); | 219 SchedulePaint(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void CandidateView::StateChanged() { | 222 void CandidateView::StateChanged() { |
| 223 shortcut_label_->SetEnabled(state() != STATE_DISABLED); | 223 shortcut_label_->SetEnabled(state() != STATE_DISABLED); |
| 224 if (state() == STATE_PRESSED) | 224 if (state() == STATE_PRESSED) |
| 225 SetHighlighted(true); | 225 SetHighlighted(true); |
| 226 } | 226 } |
| 227 | 227 |
| 228 bool CandidateView::OnMouseDragged(const ui::MouseEvent& event) { | 228 bool CandidateView::OnMouseDragged(const ui::MouseEvent& event) { |
| 229 if (!HitTestPoint(event.location())) { | 229 if (!HitTestPoint(gfx::ToFlooredPoint(event.location()))) { |
| 230 // Moves the drag target to the sibling view. | 230 // Moves the drag target to the sibling view. |
| 231 gfx::Point location_in_widget(event.location()); | 231 gfx::Point location_in_widget(gfx::ToFlooredPoint(event.location())); |
| 232 ConvertPointToWidget(this, &location_in_widget); | 232 ConvertPointToWidget(this, &location_in_widget); |
| 233 for (int i = 0; i < parent()->child_count(); ++i) { | 233 for (int i = 0; i < parent()->child_count(); ++i) { |
| 234 CandidateView* sibling = | 234 CandidateView* sibling = |
| 235 static_cast<CandidateView*>(parent()->child_at(i)); | 235 static_cast<CandidateView*>(parent()->child_at(i)); |
| 236 if (sibling == this) | 236 if (sibling == this) |
| 237 continue; | 237 continue; |
| 238 gfx::Point location_in_sibling(location_in_widget); | 238 gfx::Point location_in_sibling(location_in_widget); |
| 239 ConvertPointFromWidget(sibling, &location_in_sibling); | 239 ConvertPointFromWidget(sibling, &location_in_sibling); |
| 240 if (sibling->HitTestPoint(location_in_sibling)) { | 240 if (sibling->HitTestPoint(location_in_sibling)) { |
| 241 GetWidget()->GetRootView()->SetMouseHandler(sibling); | 241 GetWidget()->GetRootView()->SetMouseHandler(sibling); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 // Reserves the margin for infolist_icon even if it's not visible. | 294 // Reserves the margin for infolist_icon even if it's not visible. |
| 295 size.Enlarge( | 295 size.Enlarge( |
| 296 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); | 296 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); |
| 297 return size; | 297 return size; |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace ime | 300 } // namespace ime |
| 301 } // namespace ash | 301 } // namespace ash |
| OLD | NEW |