Chromium Code Reviews| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 int height = contentView.getMeasuredHeight(); | 124 int height = contentView.getMeasuredHeight(); |
| 125 | 125 |
| 126 mPositionX = (int) (x - width / 2.0f); | 126 mPositionX = (int) (x - width / 2.0f); |
| 127 mPositionY = y - height - mLineOffsetY; | 127 mPositionY = y - height - mLineOffsetY; |
| 128 | 128 |
| 129 final int[] coords = new int[2]; | 129 final int[] coords = new int[2]; |
| 130 mParent.getLocationInWindow(coords); | 130 mParent.getLocationInWindow(coords); |
| 131 coords[0] += mPositionX; | 131 coords[0] += mPositionX; |
| 132 coords[1] += mPositionY; | 132 coords[1] += mPositionY; |
| 133 | 133 |
| 134 int statusBarHeight = 0; | |
| 135 int resourceId = mContext.getResources().getIdentifier("status_bar_heigh t", "dimen", "android"); | |
|
jdduke (slow)
2014/07/28 15:46:03
What guarantees do we have that the status bar wil
kingshuk.j
2014/07/29 11:09:27
ok, I will put a check for the status bar visibili
| |
| 136 if (resourceId > 0) { | |
| 137 statusBarHeight = mContext.getResources().getDimensionPixelSize(reso urceId); | |
| 138 } | |
| 134 final int screenWidth = mContext.getResources().getDisplayMetrics().widt hPixels; | 139 final int screenWidth = mContext.getResources().getDisplayMetrics().widt hPixels; |
| 135 if (coords[1] < 0) { | 140 if (coords[1] < statusBarHeight) { |
| 136 updateContent(false); | 141 updateContent(false); |
| 137 // Update dimensions from new view | 142 // Update dimensions from new view |
| 138 contentView = mContainer.getContentView(); | 143 contentView = mContainer.getContentView(); |
| 139 width = contentView.getMeasuredWidth(); | 144 width = contentView.getMeasuredWidth(); |
| 140 height = contentView.getMeasuredHeight(); | 145 height = contentView.getMeasuredHeight(); |
| 141 | 146 |
| 142 // Vertical clipping, move under edited line and to the side of inse rtion cursor | 147 // Vertical clipping, move under edited line and to the side of inse rtion cursor |
| 143 // TODO bottom clipping in case there is no system bar | 148 // TODO bottom clipping in case there is no system bar |
| 144 coords[1] += height; | 149 coords[1] += height; |
| 145 coords[1] += mLineOffsetY; | 150 coords[1] += mLineOffsetY; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 } | 200 } |
| 196 | 201 |
| 197 private boolean canPaste() { | 202 private boolean canPaste() { |
| 198 return mDelegate.canPaste(); | 203 return mDelegate.canPaste(); |
| 199 } | 204 } |
| 200 | 205 |
| 201 private void paste() { | 206 private void paste() { |
| 202 mDelegate.paste(); | 207 mDelegate.paste(); |
| 203 } | 208 } |
| 204 } | 209 } |
| OLD | NEW |