OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 package org.chromium.content.browser.input; | 5 package org.chromium.content.browser.input; |
6 | 6 |
7 import android.content.ClipboardManager; | 7 import android.content.ClipboardManager; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.res.TypedArray; | 9 import android.content.res.TypedArray; |
10 import android.graphics.drawable.Drawable; | 10 import android.graphics.drawable.Drawable; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (mIsShowing) { | 71 if (mIsShowing) { |
72 mHandle.showPastePopupWindow(); | 72 mHandle.showPastePopupWindow(); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 public void showHandleWithPastePopup() { | 76 public void showHandleWithPastePopup() { |
77 showHandle(); | 77 showHandle(); |
78 showPastePopup(); | 78 showPastePopup(); |
79 } | 79 } |
80 | 80 |
| 81 /** |
| 82 * @return whether the handle is being dragged. |
| 83 */ |
| 84 public boolean isDragging() { |
| 85 return mHandle != null && mHandle.isDragging(); |
| 86 } |
| 87 |
81 /** Shows the handle at the given coordinates, as long as automatic showing
is allowed */ | 88 /** Shows the handle at the given coordinates, as long as automatic showing
is allowed */ |
82 public void onCursorPositionChanged() { | 89 public void onCursorPositionChanged() { |
83 if (mAllowAutomaticShowing) { | 90 if (mAllowAutomaticShowing) { |
84 showHandle(); | 91 showHandle(); |
85 } | 92 } |
86 } | 93 } |
87 | 94 |
88 /** | 95 /** |
89 * Moves the handle so that it points at the given coordinates. | 96 * Moves the handle so that it points at the given coordinates. |
90 * @param x Handle x in physical pixels. | 97 * @param x Handle x in physical pixels. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } else { | 323 } else { |
317 // Horizontal clipping | 324 // Horizontal clipping |
318 coords[0] = Math.max(0, coords[0]); | 325 coords[0] = Math.max(0, coords[0]); |
319 coords[0] = Math.min(screenWidth - width, coords[0]); | 326 coords[0] = Math.min(screenWidth - width, coords[0]); |
320 } | 327 } |
321 | 328 |
322 mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, coords[0], co
ords[1]); | 329 mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, coords[0], co
ords[1]); |
323 } | 330 } |
324 } | 331 } |
325 } | 332 } |
OLD | NEW |