This checkin adds a capability to CurrentPage2 to get the result of the

find command.

Next step will be to add more tests.

M classes_spec/org/mozilla/webclient/CurrentPage2.java

- add find and findNext methods which return boolean.

M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java

- implement these methods

M src_moz/CurrentPageImpl.cpp

- change native methods to accomodate

M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java

- minimal test of new content.


git-svn-id: svn://10.0.0.236/trunk@169076 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2005-02-10 04:20:50 +00:00
parent 3a41cbe53b
commit 8e87528e03
4 changed files with 50 additions and 24 deletions

View File

@@ -131,10 +131,10 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPa
/*
* Class: org_mozilla_webclient_impl_wrapper_0005fnative_CurrentPageImpl
* Method: nativeFindInPage
* Method: nativeFind
* Signature: (Ljava/lang/String;ZZ)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPageImpl_nativeFindInPage
JNIEXPORT jboolean JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPageImpl_nativeFind
(JNIEnv *env, jobject obj, jint nativeBCPtr, jstring searchString, jboolean forward, jboolean matchCase)
{
@@ -144,7 +144,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPa
jstring searchStringGlobalRef = (jstring) ::util_NewGlobalRef(env, searchString);
if (!searchStringGlobalRef) {
::util_ThrowExceptionToJava(env, "Exception: Can't create global ref for search string");
return;
return JNI_FALSE;
}
nsresult rv = NS_ERROR_NULL_POINTER;
@@ -160,7 +160,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPa
if (NS_FAILED(rv) || nsnull == findComponent) {
::util_ThrowExceptionToJava(env, "Exception: Can't get find component");
return;
return JNI_FALSE;
}
PRUnichar * srchString = nsnull;
@@ -171,13 +171,13 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPa
if (nsnull == srchString) {
::util_DeleteGlobalRef(env, searchStringGlobalRef);
return;
return JNI_FALSE;
}
rv = findComponent->SetSearchString(srchString);
if (NS_FAILED(rv)) {
::util_ThrowExceptionToJava(env, "Exception: Can't set search string.");
return;
return JNI_FALSE;
}
findComponent->SetFindBackwards((PRBool) forward == JNI_FALSE);
findComponent->SetMatchCase((PRBool) matchCase == JNI_TRUE);
@@ -186,15 +186,17 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPa
::util_ReleaseStringChars(env, searchStringGlobalRef, srchString);
::util_DeleteGlobalRef(env, searchStringGlobalRef);
return found ? JNI_TRUE : JNI_FALSE;
}
/*
* Class: org_mozilla_webclient_impl_wrapper_0005fnative_CurrentPageImpl
* Method: nativeFindNextInPage
* Method: nativeFindNext
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPageImpl_nativeFindNextInPage
JNIEXPORT jboolean JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPageImpl_nativeFindNext
(JNIEnv *env, jobject obj, jint nativeBCPtr)
{
@@ -213,12 +215,13 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CurrentPa
if (NS_FAILED(rv) || nsnull == findComponent) {
::util_ThrowExceptionToJava(env, "Exception: Can't get find component");
return;
return JNI_FALSE;
}
PRBool found = PR_TRUE;
rv = findComponent->FindNext(&found);
return found ? JNI_TRUE : JNI_FALSE;
}
/*