summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-10-12 13:40:23 -0400
committerCary Clark <cary@android.com>2010-10-13 10:08:59 -0400
commitdfc07279fc6205c38f5f39cb5ba4f0aef6b593a4 (patch)
treec94a99d9abb9735177fd01c42e6cdf7c60f96d36
parentc792c2e9edb3c785208560b6961ac6ed5b07eb4e (diff)
downloadframeworks_base-dfc07279fc6205c38f5f39cb5ba4f0aef6b593a4.zip
frameworks_base-dfc07279fc6205c38f5f39cb5ba4f0aef6b593a4.tar.gz
frameworks_base-dfc07279fc6205c38f5f39cb5ba4f0aef6b593a4.tar.bz2
Line up WebTextView text with the page.
Bug:3085564 Requires a change to external/webkit: https://android-git.corp.google.com/g/#change,73568 Change-Id: I4c3fa1314bdac39cc071f583a418c433ea897de8
-rw-r--r--core/java/android/webkit/WebView.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 84aca60..8ee84dc 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3947,6 +3947,16 @@ public class WebView extends AbsoluteLayout
// requestFormData, and it needs to have the correct nodePointer.
mWebTextView.setNodePointer(nodePointer);
mWebTextView.setType(nativeFocusCandidateType());
+ Rect paddingRect = nativeFocusCandidatePaddingRect();
+ if (paddingRect != null) {
+ // Use contentToViewDimension since these are the dimensions of
+ // the padding.
+ mWebTextView.setPadding(
+ contentToViewDimension(paddingRect.left),
+ contentToViewDimension(paddingRect.top),
+ contentToViewDimension(paddingRect.right),
+ contentToViewDimension(paddingRect.bottom));
+ }
if (null == text) {
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "rebuildWebTextView null == text");
@@ -7841,6 +7851,13 @@ public class WebView extends AbsoluteLayout
/* package */ native int nativeFocusCandidateMaxLength();
/* package */ native String nativeFocusCandidateName();
private native Rect nativeFocusCandidateNodeBounds();
+ /**
+ * @return A Rect with left, top, right, bottom set to the corresponding
+ * padding values in the focus candidate, if it is a textfield/textarea with
+ * a style. Otherwise return null. This is not actually a rectangle; Rect
+ * is being used to pass four integers.
+ */
+ private native Rect nativeFocusCandidatePaddingRect();
/* package */ native int nativeFocusCandidatePointer();
private native String nativeFocusCandidateText();
private native int nativeFocusCandidateTextSize();