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

Side by Side Diff: ui/touch_selection/touch_handle.cc

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patchset Created 5 years, 9 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
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/touch_selection/touch_handle.h" 5 #include "ui/touch_selection/touch_handle.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 namespace ui { 9 namespace ui {
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // TODO(AviD): Remove this once logging(DCHECK) supports enum class. 47 // TODO(AviD): Remove this once logging(DCHECK) supports enum class.
48 static std::ostream& operator<<(std::ostream& os, 48 static std::ostream& operator<<(std::ostream& os,
49 const TouchHandleOrientation& orientation) { 49 const TouchHandleOrientation& orientation) {
50 switch (orientation) { 50 switch (orientation) {
51 case TouchHandleOrientation::LEFT: 51 case TouchHandleOrientation::LEFT:
52 return os << "LEFT"; 52 return os << "LEFT";
53 case TouchHandleOrientation::RIGHT: 53 case TouchHandleOrientation::RIGHT:
54 return os << "RIGHT"; 54 return os << "RIGHT";
55 case TouchHandleOrientation::CENTER: 55 case TouchHandleOrientation::CENTER:
56 return os << "CENTER"; 56 return os << "CENTER";
57 case TouchHandleOrientation::LEFT_INVERTED:
58 return os << "LEFT_INVERTED";
59 case TouchHandleOrientation::RIGHT_INVERTED:
60 return os << "RIGHT_INVERTED";
61 case TouchHandleOrientation::LEFT_FLIPPED:
62 return os << "LEFT_FLIPPED";
63 case TouchHandleOrientation::RIGHT_FLIPPED:
64 return os << "RIGHT_FLIPPED";
65 case TouchHandleOrientation::LEFT_FLIPPED_INVERTED:
66 return os << "LEFT_FLIPPED_INVERTED";
67 case TouchHandleOrientation::RIGHT_FLIPPED_INVERTED:
68 return os << "RIGHT_FLIPPED_INVERTED";
69 case TouchHandleOrientation::CENTER_INVERTED:
70 return os << "CENTER_INVERTED";
57 case TouchHandleOrientation::UNDEFINED: 71 case TouchHandleOrientation::UNDEFINED:
58 return os << "UNDEFINED"; 72 return os << "UNDEFINED";
59 default: 73 default:
60 return os << "INVALID: " << static_cast<int>(orientation); 74 return os << "INVALID: " << static_cast<int>(orientation);
61 } 75 }
62 } 76 }
63 77
64 // Responsible for rendering a selection or insertion handle for text editing. 78 // Responsible for rendering a selection or insertion handle for text editing.
65 TouchHandle::TouchHandle(TouchHandleClient* client, 79 TouchHandle::TouchHandle(TouchHandleClient* client,
66 TouchHandleOrientation orientation) 80 TouchHandleOrientation orientation)
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 301 }
288 302
289 void TouchHandle::SetAlpha(float alpha) { 303 void TouchHandle::SetAlpha(float alpha) {
290 alpha = std::max(0.f, std::min(1.f, alpha)); 304 alpha = std::max(0.f, std::min(1.f, alpha));
291 if (alpha_ == alpha) 305 if (alpha_ == alpha)
292 return; 306 return;
293 alpha_ = alpha; 307 alpha_ = alpha;
294 drawable_->SetAlpha(alpha); 308 drawable_->SetAlpha(alpha);
295 } 309 }
296 310
311 gfx::RectF TouchHandle::GetHandleBounds() {
312 return drawable_->GetVisibleBounds();
313 }
314
297 } // namespace ui 315 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698