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

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

Issue 1066053002: [Android] Allow custom ActionMode creation via ContentViewClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null check Created 5 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/touch_selection/touch_handle.h ('k') | ui/touch_selection/touch_selection_controller.h » ('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/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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 SetAlpha(is_visible_ ? u : 1.f - u); 221 SetAlpha(is_visible_ ? u : 1.f - u);
222 222
223 if (u >= 1.f) { 223 if (u >= 1.f) {
224 EndFade(); 224 EndFade();
225 return false; 225 return false;
226 } 226 }
227 227
228 return true; 228 return true;
229 } 229 }
230 230
231 gfx::RectF TouchHandle::GetVisibleBounds() const {
232 if (!is_visible_ || !enabled_)
233 return gfx::RectF();
234
235 return drawable_->GetVisibleBounds();
236 }
237
231 void TouchHandle::BeginDrag() { 238 void TouchHandle::BeginDrag() {
232 DCHECK(enabled_); 239 DCHECK(enabled_);
233 if (is_dragging_) 240 if (is_dragging_)
234 return; 241 return;
235 EndFade(); 242 EndFade();
236 is_dragging_ = true; 243 is_dragging_ = true;
237 is_drag_within_tap_region_ = true; 244 is_drag_within_tap_region_ = true;
238 client_->OnHandleDragBegin(*this); 245 client_->OnHandleDragBegin(*this);
239 } 246 }
240 247
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 295
289 void TouchHandle::SetAlpha(float alpha) { 296 void TouchHandle::SetAlpha(float alpha) {
290 alpha = std::max(0.f, std::min(1.f, alpha)); 297 alpha = std::max(0.f, std::min(1.f, alpha));
291 if (alpha_ == alpha) 298 if (alpha_ == alpha)
292 return; 299 return;
293 alpha_ = alpha; 300 alpha_ = alpha;
294 drawable_->SetAlpha(alpha); 301 drawable_->SetAlpha(alpha);
295 } 302 }
296 303
297 } // namespace ui 304 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_handle.h ('k') | ui/touch_selection/touch_selection_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698