summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-10-13 06:57:15 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-13 06:57:15 -0700
commite228a64d32a6c1f9d88cf43529f69792207585dd (patch)
treeceb8c6235c29fdf3cd8b65cdf45611f6d64a2756 /WebKit
parent5cff132af1e80304bdcb267bb9ee7201a25656ad (diff)
parent390c2b5702d131f0875199fdca1c3ba5010d7659 (diff)
downloadexternal_webkit-e228a64d32a6c1f9d88cf43529f69792207585dd.zip
external_webkit-e228a64d32a6c1f9d88cf43529f69792207585dd.tar.gz
external_webkit-e228a64d32a6c1f9d88cf43529f69792207585dd.tar.bz2
Merge "Provide padding + border values for textfields." into gingerbread
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp4
-rw-r--r--WebKit/android/nav/CachedInput.cpp4
-rw-r--r--WebKit/android/nav/CachedInput.h16
-rw-r--r--WebKit/android/nav/WebView.cpp27
4 files changed, 44 insertions, 7 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 214058c..f69b23d 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -1232,6 +1232,10 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
|| style->textAlign() == WebCore::RIGHT
|| style->textAlign() == WebCore::WEBKIT_RIGHT);
}
+ cachedInput.setPaddingLeft(renderText->paddingLeft() + renderText->borderLeft());
+ cachedInput.setPaddingTop(renderText->paddingTop() + renderText->borderTop());
+ cachedInput.setPaddingRight(renderText->paddingRight() + renderText->borderRight());
+ cachedInput.setPaddingBottom(renderText->paddingBottom() + renderText->borderBottom());
}
takesFocus = true;
bounds = absBounds;
diff --git a/WebKit/android/nav/CachedInput.cpp b/WebKit/android/nav/CachedInput.cpp
index 924bbca..cba5820 100644
--- a/WebKit/android/nav/CachedInput.cpp
+++ b/WebKit/android/nav/CachedInput.cpp
@@ -59,6 +59,10 @@ void CachedInput::Debug::print() const
DUMP_NAV_LOGD("// int mMaxLength=%d;\n", b->mMaxLength);
DUMP_NAV_LOGD("// int mTextSize=%d;\n", b->mTextSize);
DUMP_NAV_LOGD("// int mInputType=%d;\n", b->mInputType);
+ DUMP_NAV_LOGD("// int mPaddingLeft=%d;\n", b->mPaddingLeft);
+ DUMP_NAV_LOGD("// int mPaddingTop=%d;\n", b->mPaddingTop);
+ DUMP_NAV_LOGD("// int mPaddingRight=%d;\n", b->mPaddingRight);
+ DUMP_NAV_LOGD("// int mPaddingBottom=%d;\n", b->mPaddingBottom);
DEBUG_PRINT_BOOL(mIsRtlText);
DEBUG_PRINT_BOOL(mIsTextField);
}
diff --git a/WebKit/android/nav/CachedInput.h b/WebKit/android/nav/CachedInput.h
index 42cadf1..01b40f9 100644
--- a/WebKit/android/nav/CachedInput.h
+++ b/WebKit/android/nav/CachedInput.h
@@ -48,20 +48,32 @@ public:
bool isTextField() const { return mIsTextField; }
int maxLength() const { return mMaxLength; };
const WebCore::String& name() const { return mName; }
+ int paddingBottom() const { return mPaddingBottom; }
+ int paddingLeft() const { return mPaddingLeft; }
+ int paddingRight() const { return mPaddingRight; }
+ int paddingTop() const { return mPaddingTop; }
void setFormPointer(void* form) { mForm = form; }
void setInputType(WebCore::HTMLInputElement::InputType type) { mInputType = type; }
void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; }
void setIsTextField(bool isTextField) { mIsTextField = isTextField; }
void setMaxLength(int maxLength) { mMaxLength = maxLength; }
void setName(const WebCore::String& name) { mName = name; }
+ void setPaddingBottom(int bottom) { mPaddingBottom = bottom; }
+ void setPaddingLeft(int left) { mPaddingLeft = left; }
+ void setPaddingRight(int right) { mPaddingRight = right; }
+ void setPaddingTop(int top) { mPaddingTop = top; }
void setTextSize(int textSize) { mTextSize = textSize; }
int textSize() const { return mTextSize; }
private:
void* mForm;
- WebCore::String mName;
+ WebCore::HTMLInputElement::InputType mInputType;
int mMaxLength;
+ WebCore::String mName;
+ int mPaddingBottom;
+ int mPaddingLeft;
+ int mPaddingRight;
+ int mPaddingTop;
int mTextSize;
- WebCore::HTMLInputElement::InputType mInputType;
bool mIsRtlText : 1;
bool mIsTextField : 1;
#if DUMP_NAV_CACHE
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 3dafaff..913c4ba 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -1501,17 +1501,32 @@ static jobject nativeFocusCandidateName(JNIEnv *env, jobject obj)
return env->NewString((jchar*)name.characters(), name.length());
}
+static jobject createJavaRect(JNIEnv* env, int x, int y, int right, int bottom)
+{
+ jclass rectClass = env->FindClass("android/graphics/Rect");
+ jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
+ jobject rect = env->NewObject(rectClass, init, x, y, right, bottom);
+ return rect;
+}
+
static jobject nativeFocusCandidateNodeBounds(JNIEnv *env, jobject obj)
{
const CachedFrame* frame;
const CachedNode* node = getFocusCandidate(env, obj, &frame);
WebCore::IntRect bounds = node ? node->bounds(frame)
: WebCore::IntRect(0, 0, 0, 0);
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject rect = env->NewObject(rectClass, init, bounds.x(),
- bounds.y(), bounds.right(), bounds.bottom());
- return rect;
+ return createJavaRect(env, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
+}
+
+static jobject nativeFocusCandidatePaddingRect(JNIEnv *env, jobject obj)
+{
+ const CachedInput* input = getInputCandidate(env, obj);
+ if (!input)
+ return 0;
+ // Note that the Java Rect is being used to pass four integers, rather than
+ // being used as an actual rectangle.
+ return createJavaRect(env, input->paddingLeft(), input->paddingTop(),
+ input->paddingRight(), input->paddingBottom());
}
static jint nativeFocusCandidatePointer(JNIEnv *env, jobject obj)
@@ -2064,6 +2079,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeFocusCandidateName },
{ "nativeFocusCandidateNodeBounds", "()Landroid/graphics/Rect;",
(void*) nativeFocusCandidateNodeBounds },
+ { "nativeFocusCandidatePaddingRect", "()Landroid/graphics/Rect;",
+ (void*) nativeFocusCandidatePaddingRect },
{ "nativeFocusCandidatePointer", "()I",
(void*) nativeFocusCandidatePointer },
{ "nativeFocusCandidateText", "()Ljava/lang/String;",