| 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 package org.chromium.content.browser.input; | 5 package org.chromium.content.browser.input; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.res.TypedArray; | 8 import android.content.res.TypedArray; |
| 9 import android.util.TypedValue; | 9 import android.util.TypedValue; |
| 10 import android.view.Gravity; | 10 import android.view.Gravity; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 coords[0] += handleHalfWidth + width / 2; | 164 coords[0] += handleHalfWidth + width / 2; |
| 165 } else { | 165 } else { |
| 166 coords[0] -= handleHalfWidth + width / 2; | 166 coords[0] -= handleHalfWidth + width / 2; |
| 167 } | 167 } |
| 168 } else { | 168 } else { |
| 169 // Horizontal clipping | 169 // Horizontal clipping |
| 170 coords[0] = Math.max(0, coords[0]); | 170 coords[0] = Math.max(0, coords[0]); |
| 171 coords[0] = Math.min(screenWidth - width, coords[0]); | 171 coords[0] = Math.min(screenWidth - width, coords[0]); |
| 172 } | 172 } |
| 173 | 173 |
| 174 mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, coords[0], coords
[1]); | 174 if (!isShowing()) { |
| 175 mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, coords[0], co
ords[1]); |
| 176 } else { |
| 177 mContainer.update(coords[0], coords[1], -1, -1); |
| 178 } |
| 175 } | 179 } |
| 176 | 180 |
| 177 private int viewIndex(boolean onTop) { | 181 private int viewIndex(boolean onTop) { |
| 178 return (onTop ? 0 : 1 << 1) + (canPaste() ? 0 : 1 << 0); | 182 return (onTop ? 0 : 1 << 1) + (canPaste() ? 0 : 1 << 0); |
| 179 } | 183 } |
| 180 | 184 |
| 181 private void updateContent(boolean onTop) { | 185 private void updateContent(boolean onTop) { |
| 182 final int viewIndex = viewIndex(onTop); | 186 final int viewIndex = viewIndex(onTop); |
| 183 View view = mPasteViews[viewIndex]; | 187 View view = mPasteViews[viewIndex]; |
| 184 | 188 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 208 } | 212 } |
| 209 | 213 |
| 210 private boolean canPaste() { | 214 private boolean canPaste() { |
| 211 return mDelegate.canPaste(); | 215 return mDelegate.canPaste(); |
| 212 } | 216 } |
| 213 | 217 |
| 214 private void paste() { | 218 private void paste() { |
| 215 mDelegate.paste(); | 219 mDelegate.paste(); |
| 216 } | 220 } |
| 217 } | 221 } |
| OLD | NEW |