Merge "Center box text vertically"

This commit is contained in:
Russell Brenner
2011-10-03 11:29:16 -07:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 2 deletions

View File

@@ -1092,4 +1092,11 @@ import junit.framework.Assert;
return url != null ? url.getProtocol() + "://" + url.getHost() + url.getPath() : null; return url != null ? url.getProtocol() + "://" + url.getHost() + url.getPath() : null;
} }
public void setGravityForRtl(boolean rtl) {
int gravity = rtl ? Gravity.RIGHT : Gravity.LEFT;
gravity |= mSingle ? Gravity.CENTER_VERTICAL : Gravity.TOP;
setGravity(gravity);
}
} }

View File

@@ -4760,12 +4760,12 @@ public class WebView extends AbsoluteLayout
} }
String text = nativeFocusCandidateText(); String text = nativeFocusCandidateText();
int nodePointer = nativeFocusCandidatePointer(); int nodePointer = nativeFocusCandidatePointer();
mWebTextView.setGravity(nativeFocusCandidateIsRtlText() ?
Gravity.RIGHT : Gravity.NO_GRAVITY);
// This needs to be called before setType, which may call // This needs to be called before setType, which may call
// requestFormData, and it needs to have the correct nodePointer. // requestFormData, and it needs to have the correct nodePointer.
mWebTextView.setNodePointer(nodePointer); mWebTextView.setNodePointer(nodePointer);
mWebTextView.setType(nativeFocusCandidateType()); mWebTextView.setType(nativeFocusCandidateType());
// Gravity needs to be set after setType
mWebTextView.setGravityForRtl(nativeFocusCandidateIsRtlText());
updateWebTextViewPadding(); updateWebTextViewPadding();
if (null == text) { if (null == text) {
if (DebugFlags.WEB_VIEW) { if (DebugFlags.WEB_VIEW) {