bug 40330

a=edburns
r=drapeau

This checkin creates a dependency on the mozilla java dom module.

Please see mozilla\java\dom\README to build the java dom.
Note that you can just run make in mozilla\java and everything
should be built correctly.

A webclient/classes_spec/org/mozilla/webclient/test/DOMAccessPanel.java
A webclient/classes_spec/org/mozilla/webclient/test/DOMCellRenderer.java
A webclient/classes_spec/org/mozilla/webclient/test/DOMTreeDumper.java
A webclient/classes_spec/org/mozilla/webclient/test/DOMTreeModel.java
A webclient/classes_spec/org/mozilla/webclient/test/DOMTreeNotifier.java
A webclient/classes_spec/org/mozilla/webclient/test/DOMViewerFrame.java

M Makefile.win
M README
M webclient/classes_spec/Makefile.unix
M webclient/classes_spec/Makefile.win
M webclient/classes_spec/org/mozilla/webclient/CurrentPage.java
M webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java
M webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java
M webclient/src_moz/CurrentPageImpl.cpp
M webclient/src_moz/DocumentLoaderObserverImpl.cpp
M webclient/src_moz/Makefile.win
M webclient/src_moz/WindowControlImpl.cpp
M webclient/src_moz/jni_util.h


git-svn-id: svn://10.0.0.236/trunk@71490 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2000-06-04 22:16:36 +00:00
parent 5915539504
commit 1442832df2
18 changed files with 1603 additions and 549 deletions

View File

@@ -35,7 +35,7 @@
#include "jni_util_export.h"
#include "rdf_util.h"
#include "nsActions.h"
#include "nsLayoutCID.h"
#include "nsCRT.h"
#include "nsIPresShell.h"
@@ -43,21 +43,21 @@
#include "nsISupports.h"
#include "nsIFindComponent.h"
#include "nsISearchContext.h"
#include "nsIDocShell.h"
#include "nsIDOMSelection.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMRange.h"
#include "nsIDocShell.h"
#include "nsIDOMSelection.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMRange.h"
#include "nsIContentViewer.h"
#include "nsIServiceManager.h"
static NS_DEFINE_CID(kCDOMRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kIDOMHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
static NS_DEFINE_CID(kCDOMRangeCID, NS_RANGE_CID);
static NS_DEFINE_IID(kIDOMHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeCopyCurrentSelectionToSystemClipboard
(JNIEnv *env, jobject obj, jint webShellPtr)
@@ -230,6 +230,40 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPage
return urlString;
}
JNIEXPORT jobject JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeGetDOM
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
jobject result = nsnull;
jlong documentLong = nsnull;
jclass clazz = nsnull;
jmethodID mid = nsnull;
if (initContext == nsnull) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellGetDOM");
return nsnull;
}
if (nsnull == initContext->currentDocument ||
nsnull == (documentLong = (jlong) initContext->currentDocument.get())){
return nsnull;
}
if (nsnull == (clazz = ::util_FindClass(env,
"org/mozilla/dom/DOMAccessor"))) {
::util_ThrowExceptionToJava(env, "Exception: Can't get DOMAccessor class");
return nsnull;
}
if (nsnull == (mid = env->GetStaticMethodID(clazz, "getNodeByHandle",
"(J)Lorg/w3c/dom/Node;"))) {
::util_ThrowExceptionToJava(env, "Exception: Can't get DOM Node.");
return nsnull;
}
result = env->CallStaticObjectMethod(clazz, mid, documentLong);
return result;
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeGetSource
@@ -285,82 +319,82 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeSelectAll
(JNIEnv * env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
nsCOMPtr<nsIPresShell> presShell;
nsresult rv;
rv = initContext->docShell->GetPresShell(getter_AddRefs(presShell));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get PresShell");
return;
}
nsCOMPtr<nsIDOMSelection> selection;
rv = presShell->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMSelection");
return;
}
nsCOMPtr<nsIContentViewer> contentViewer;
rv = initContext->docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get contentViewer");
return;
}
nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
nsCOMPtr<nsIDocument> doc;
rv = docViewer->GetDocument(*getter_AddRefs(doc));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get Document object");
return;
}
nsCOMPtr<nsIDOMHTMLDocument> htmldoc;
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, getter_AddRefs(htmldoc));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMHTMLDocument");
return;
}
nsCOMPtr<nsIDOMHTMLElement>bodyElement;
rv = htmldoc->GetBody(getter_AddRefs(bodyElement));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMHTMLElement");
return;
}
nsCOMPtr<nsIDOMNode>bodyNode = do_QueryInterface(bodyElement);
if (!bodyNode) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMNode");
return;
}
rv = selection->ClearSelection();
nsCOMPtr<nsIDOMRange> range;
rv = nsComponentManager::CreateInstance(kCDOMRangeCID, nsnull,
NS_GET_IID(nsIDOMRange),
getter_AddRefs(range));
rv = range->SelectNodeContents(bodyNode);
rv = selection->AddRange(range);
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get final Select working");
return;
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
nsCOMPtr<nsIPresShell> presShell;
nsresult rv;
rv = initContext->docShell->GetPresShell(getter_AddRefs(presShell));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get PresShell");
return;
}
nsCOMPtr<nsIDOMSelection> selection;
rv = presShell->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMSelection");
return;
}
nsCOMPtr<nsIContentViewer> contentViewer;
rv = initContext->docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get contentViewer");
return;
}
nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
nsCOMPtr<nsIDocument> doc;
rv = docViewer->GetDocument(*getter_AddRefs(doc));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get Document object");
return;
}
nsCOMPtr<nsIDOMHTMLDocument> htmldoc;
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, getter_AddRefs(htmldoc));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMHTMLDocument");
return;
}
nsCOMPtr<nsIDOMHTMLElement>bodyElement;
rv = htmldoc->GetBody(getter_AddRefs(bodyElement));
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMHTMLElement");
return;
}
nsCOMPtr<nsIDOMNode>bodyNode = do_QueryInterface(bodyElement);
if (!bodyNode) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get DOMNode");
return;
}
rv = selection->ClearSelection();
nsCOMPtr<nsIDOMRange> range;
rv = nsComponentManager::CreateInstance(kCDOMRangeCID, nsnull,
NS_GET_IID(nsIDOMRange),
getter_AddRefs(range));
rv = range->SelectNodeContents(bodyNode);
rv = selection->AddRange(range);
if (NS_FAILED(rv)) {
initContext->initFailCode = kSelectAllError;
::util_ThrowExceptionToJava(env, "Exception: can't get final Select working");
return;
}
}