WebCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jun 2002 23:15:53 +0000 (23:15 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jun 2002 23:15:53 +0000 (23:15 +0000)
Add the new bridge class that connects us to WebCore in a nicer way.
Started to use it for some things. More to come.

* WebKit.pbproj/project.pbxproj:
* IFWebCoreBridge.h: Added.
* IFWebCoreBridge.mm: Added.

* Misc.subproj/IFDownloadHandler.mm:
(-[IFDownloadHandler initWithDataSource:]): Call [super init].
(-[IFDownloadHandler dealloc]): Call [super dealloc].
* Plugins.subproj/IFPluginNullEventSender.m:
(-[IFPluginNullEventSender initializeWithNPP:functionPointer:window:]): Call [super init].
(-[IFPluginNullEventSender dealloc]): Call [super dealloc].
* WebView.subproj/IFDOMNode.mm: (-[IFDOMNode dealloc]): Call [super dealloc].
* WebView.subproj/IFImageView.m: (-[IFImageView dealloc]): Call [super dealloc].
* WebView.subproj/IFRenderNode.mm: (-[IFRenderNode dealloc]): Call [super dealloc].

* WebView.subproj/IFHTMLRepresentation.h: Moved variables into a private structure so
this class can be made public.
* WebView.subproj/IFHTMLRepresentationPrivate.h: Added. Has _bridge method.
* WebView.subproj/IFHTMLRepresentation.mm:
(-[IFHTMLRepresentation init]): Call [super init]. Also use the new private structure,
and allocate the IFWebCoreBridge.
(-[IFHTMLRepresentation dealloc]): Release the private structure and the IFWebCoreBridge.
Also, call [super dealloc].
(-[IFHTMLRepresentation _bridge]): Private method to get to the bridge.
(-[IFHTMLRepresentation receivedData:withDataSource:]): Use IFWebCoreBridge.

* WebView.subproj/IFWebViewPrivate.h: Add _setMarginWidth and _setMarginHeight.

* WebView.subproj/IFWebDataSourcePrivate.h: Tweak.
* WebView.subproj/IFWebDataSource.mm: Tweak.
* History.subproj/IFWebHistoryPrivate.m: Tweak.

WebKit:

Worked on eliminating calls to WebKit. About 3/4 done.

* WebCore.exp: Export new WebCoreBridge class, fewer other things.

* WebCorePrefix.h: #include <ostream> in debug builds; we couldn't
before because of a PFE bug that has since been fixed (2920556).

* khtml/html/html_objectimpl.cpp: (HTMLObjectElementImpl::attach):
Add a comment explaining our latest change here.

* khtml/khtml_part.cpp: (KHTMLPart::~KHTMLPart): Fix storage leak
by deleting m_hostExtension.

* khtml/misc/loader.h: Set type properly on client member so we
don't have to do so much casting.

* kwq/KWQKHTMLPartImpl.h: Add getBridge and setBridge, remove setDataSource.
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPartImpl::KWQKHTMLPartImpl): Eliminate m_dataSource.
(KWQKHTMLPartImpl::openURLInFrame): Use WebCoreBridge.
(KWQKHTMLPartImpl::urlSelected): Use WebCoreBridge.
(KWQKHTMLPartImpl::requestFrame): Use WebCoreBridge.
(KWQKHTMLPartImpl::requestObject): Move WebCoreViewFactory code
here; we don't need an entire WCPluginWidget file just for this
function.
(KWQKHTMLPartImpl::submitForm): Use WebCoreBridge.
(KWQKHTMLPartImpl::frameExists): Use WebCoreBridge.
(KWQKHTMLPartImpl::frames): Use WebCoreBridge.
(KWQKHTMLPartImpl::setTitle): Use WebCoreBridge.
(KWQKHTMLPartImpl::getDataSource): Use WebCoreBridge.
(KWQKHTMLPartImpl::parentPart): Use WebCoreBridge.

* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Use WebCoreBridge.

* kwq/KWQKloader.mm: Move the part of external.h that we still use in
here, with the expectation of eliminating it soon. Also renamed
URLLoadClient to KWQURLLoadClient so we don't hog namespace.

* kwq/qt/qscrollview.h:
* kwq/KWQScrollView.mm: Used helper functions to do the "documentView"
selector thing more consistently.

* kwq/KWQWidget.mm: Get interface for changing the cursor from
WebCoreViewFactory.h instead of from external.h.

* kwq/WebCoreViewFactory.h:
* kwq/Makefile.am: Remove WCPluginWidget.mm, add WebCoreBridge.mm.
* kwq/WCPluginWidget.h: Removed.
* kwq/WCPluginWidget.mm: Removed.
* kwq/WebCoreBridge.h: Added.
* kwq/WebCoreBridge.mm: Added.

* kwq/qt/qarray.h: Use <ostream> instead of <iostream>.
* kwq/qt/qcstring.h: Remove <iostream> include since we include <qarray.h>.
* kwq/qt/qdatetime.h: Replace unconditional <iostream> include with a
conditional <ostream> include. Also made streaming operators conditional.
* kwq/qt/qlist.h: Use <ostream> instead of <iostream>.
* kwq/qt/qmap.h: Use <ostream> instead of <iostream>.
* kwq/qt/qpoint.h: Use <iosfwd> instead of <iostream>.
* kwq/qt/qsize.h: Use <iosfwd> instead of <iostream>.
* kwq/qt/qvaluelist.h: Use <ostream> instead of <iostream>.
* kwq/qt/qvector.h: Replace unconditional <iostream> include with a
conditional <ostream> include. Also made streaming operators conditional.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@1357 268f45cc-cd09-0410-ab3c-d52691b4dbfc

73 files changed:
WebCore/ChangeLog-2002-12-03
WebCore/ChangeLog-2003-10-25
WebCore/ChangeLog-2005-08-23
WebCore/WebCore.exp
WebCore/WebCorePrefix.h
WebCore/khtml/html/html_objectimpl.cpp
WebCore/khtml/khtml_part.cpp
WebCore/khtml/misc/loader.h
WebCore/kwq/KWQCString.h
WebCore/kwq/KWQDateTime.h
WebCore/kwq/KWQKHTMLPart.h
WebCore/kwq/KWQKHTMLPart.mm
WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
WebCore/kwq/KWQKHTMLPartImpl.h
WebCore/kwq/KWQKHTMLPartImpl.mm
WebCore/kwq/KWQKloader.mm
WebCore/kwq/KWQLoader.mm
WebCore/kwq/KWQLoaderImpl.mm
WebCore/kwq/KWQMap.h
WebCore/kwq/KWQMemArray.h
WebCore/kwq/KWQPointArray.h
WebCore/kwq/KWQPtrList.h
WebCore/kwq/KWQPtrVector.h
WebCore/kwq/KWQScrollView.h
WebCore/kwq/KWQScrollView.mm
WebCore/kwq/KWQSize.h
WebCore/kwq/KWQValueList.h
WebCore/kwq/KWQWidget.mm
WebCore/kwq/Makefile.am
WebCore/kwq/WebCoreBridge.h [moved from WebCore/kwq/WCPluginWidget.mm with 55% similarity]
WebCore/kwq/WebCoreBridge.mm [moved from WebCore/kwq/WCPluginWidget.h with 54% similarity]
WebCore/kwq/WebCoreViewFactory.h
WebCore/kwq/qt/qarray.h
WebCore/kwq/qt/qcstring.h
WebCore/kwq/qt/qdatetime.h
WebCore/kwq/qt/qlist.h
WebCore/kwq/qt/qmap.h
WebCore/kwq/qt/qpoint.h
WebCore/kwq/qt/qscrollview.h
WebCore/kwq/qt/qsize.h
WebCore/kwq/qt/qvaluelist.h
WebCore/kwq/qt/qvector.h
WebKit/ChangeLog
WebKit/ChangeLog-2002-12-03
WebKit/History.subproj/IFWebHistoryPrivate.m
WebKit/History.subproj/WebHistoryPrivate.m
WebKit/IFWebCoreBridge.h [new file with mode: 0644]
WebKit/IFWebCoreBridge.mm [new file with mode: 0644]
WebKit/Misc.subproj/IFDownloadHandler.mm
WebKit/Misc.subproj/WebDownloadHandler.m
WebKit/Plugins.subproj/IFPluginNullEventSender.m
WebKit/Plugins.subproj/WebPluginNullEventSender.m
WebKit/WebKit.pbproj/project.pbxproj
WebKit/WebView.subproj/IFDOMNode.mm
WebKit/WebView.subproj/IFHTMLRepresentation.h
WebKit/WebView.subproj/IFHTMLRepresentation.mm
WebKit/WebView.subproj/IFHTMLRepresentationPrivate.h [new file with mode: 0644]
WebKit/WebView.subproj/IFImageView.m
WebKit/WebView.subproj/IFRenderNode.mm
WebKit/WebView.subproj/IFWebDataSource.mm
WebKit/WebView.subproj/IFWebDataSourcePrivate.h
WebKit/WebView.subproj/IFWebViewPrivate.h
WebKit/WebView.subproj/WebDOMNode.m
WebKit/WebView.subproj/WebDataSource.m
WebKit/WebView.subproj/WebDataSourcePrivate.h
WebKit/WebView.subproj/WebDebugDOMNode.m
WebKit/WebView.subproj/WebFrameViewInternal.h
WebKit/WebView.subproj/WebFrameViewPrivate.h
WebKit/WebView.subproj/WebHTMLRepresentation.h
WebKit/WebView.subproj/WebHTMLRepresentation.m
WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h [new file with mode: 0644]
WebKit/WebView.subproj/WebImageView.m
WebKit/WebView.subproj/WebRenderNode.m

index a410d30..9b46775 100644 (file)
@@ -1,3 +1,70 @@
+2002-06-14  Darin Adler  <darin@apple.com>
+
+       Worked on eliminating calls to WebKit. About 3/4 done.
+
+       * WebCore.exp: Export new WebCoreBridge class, fewer other things.
+
+       * WebCorePrefix.h: #include <ostream> in debug builds; we couldn't
+       before because of a PFE bug that has since been fixed (2920556).
+
+       * khtml/html/html_objectimpl.cpp: (HTMLObjectElementImpl::attach):
+       Add a comment explaining our latest change here.
+
+       * khtml/khtml_part.cpp: (KHTMLPart::~KHTMLPart): Fix storage leak
+       by deleting m_hostExtension.
+
+       * khtml/misc/loader.h: Set type properly on client member so we
+       don't have to do so much casting.
+
+       * kwq/KWQKHTMLPartImpl.h: Add getBridge and setBridge, remove setDataSource.
+       * kwq/KWQKHTMLPart.mm:
+       (KWQKHTMLPartImpl::KWQKHTMLPartImpl): Eliminate m_dataSource.
+       (KWQKHTMLPartImpl::openURLInFrame): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::urlSelected): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::requestFrame): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::requestObject): Move WebCoreViewFactory code
+       here; we don't need an entire WCPluginWidget file just for this
+       function.
+       (KWQKHTMLPartImpl::submitForm): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::frameExists): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::frames): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::setTitle): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::getDataSource): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::parentPart): Use WebCoreBridge.
+
+       * kwq/KWQKHTMLPartBrowserExtension.mm:
+       (KHTMLPartBrowserExtension::createNewWindow): Use WebCoreBridge.
+
+       * kwq/KWQKloader.mm: Move the part of external.h that we still use in
+       here, with the expectation of eliminating it soon. Also renamed
+       URLLoadClient to KWQURLLoadClient so we don't hog namespace.
+
+       * kwq/qt/qscrollview.h:
+       * kwq/KWQScrollView.mm: Used helper functions to do the "documentView"
+       selector thing more consistently.
+
+       * kwq/KWQWidget.mm: Get interface for changing the cursor from
+       WebCoreViewFactory.h instead of from external.h.
+
+       * kwq/WebCoreViewFactory.h:
+       * kwq/Makefile.am: Remove WCPluginWidget.mm, add WebCoreBridge.mm.
+       * kwq/WCPluginWidget.h: Removed.
+       * kwq/WCPluginWidget.mm: Removed.
+       * kwq/WebCoreBridge.h: Added.
+       * kwq/WebCoreBridge.mm: Added.
+
+       * kwq/qt/qarray.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qcstring.h: Remove <iostream> include since we include <qarray.h>.
+       * kwq/qt/qdatetime.h: Replace unconditional <iostream> include with a
+       conditional <ostream> include. Also made streaming operators conditional.
+       * kwq/qt/qlist.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qmap.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qpoint.h: Use <iosfwd> instead of <iostream>.
+       * kwq/qt/qsize.h: Use <iosfwd> instead of <iostream>.
+       * kwq/qt/qvaluelist.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qvector.h: Replace unconditional <iostream> include with a
+       conditional <ostream> include. Also made streaming operators conditional.
+
 2002-06-14  Richard Williamson  <rjw@apple.com>
 
     Name change view -> webView.
index a410d30..9b46775 100644 (file)
@@ -1,3 +1,70 @@
+2002-06-14  Darin Adler  <darin@apple.com>
+
+       Worked on eliminating calls to WebKit. About 3/4 done.
+
+       * WebCore.exp: Export new WebCoreBridge class, fewer other things.
+
+       * WebCorePrefix.h: #include <ostream> in debug builds; we couldn't
+       before because of a PFE bug that has since been fixed (2920556).
+
+       * khtml/html/html_objectimpl.cpp: (HTMLObjectElementImpl::attach):
+       Add a comment explaining our latest change here.
+
+       * khtml/khtml_part.cpp: (KHTMLPart::~KHTMLPart): Fix storage leak
+       by deleting m_hostExtension.
+
+       * khtml/misc/loader.h: Set type properly on client member so we
+       don't have to do so much casting.
+
+       * kwq/KWQKHTMLPartImpl.h: Add getBridge and setBridge, remove setDataSource.
+       * kwq/KWQKHTMLPart.mm:
+       (KWQKHTMLPartImpl::KWQKHTMLPartImpl): Eliminate m_dataSource.
+       (KWQKHTMLPartImpl::openURLInFrame): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::urlSelected): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::requestFrame): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::requestObject): Move WebCoreViewFactory code
+       here; we don't need an entire WCPluginWidget file just for this
+       function.
+       (KWQKHTMLPartImpl::submitForm): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::frameExists): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::frames): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::setTitle): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::getDataSource): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::parentPart): Use WebCoreBridge.
+
+       * kwq/KWQKHTMLPartBrowserExtension.mm:
+       (KHTMLPartBrowserExtension::createNewWindow): Use WebCoreBridge.
+
+       * kwq/KWQKloader.mm: Move the part of external.h that we still use in
+       here, with the expectation of eliminating it soon. Also renamed
+       URLLoadClient to KWQURLLoadClient so we don't hog namespace.
+
+       * kwq/qt/qscrollview.h:
+       * kwq/KWQScrollView.mm: Used helper functions to do the "documentView"
+       selector thing more consistently.
+
+       * kwq/KWQWidget.mm: Get interface for changing the cursor from
+       WebCoreViewFactory.h instead of from external.h.
+
+       * kwq/WebCoreViewFactory.h:
+       * kwq/Makefile.am: Remove WCPluginWidget.mm, add WebCoreBridge.mm.
+       * kwq/WCPluginWidget.h: Removed.
+       * kwq/WCPluginWidget.mm: Removed.
+       * kwq/WebCoreBridge.h: Added.
+       * kwq/WebCoreBridge.mm: Added.
+
+       * kwq/qt/qarray.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qcstring.h: Remove <iostream> include since we include <qarray.h>.
+       * kwq/qt/qdatetime.h: Replace unconditional <iostream> include with a
+       conditional <ostream> include. Also made streaming operators conditional.
+       * kwq/qt/qlist.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qmap.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qpoint.h: Use <iosfwd> instead of <iostream>.
+       * kwq/qt/qsize.h: Use <iosfwd> instead of <iostream>.
+       * kwq/qt/qvaluelist.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qvector.h: Replace unconditional <iostream> include with a
+       conditional <ostream> include. Also made streaming operators conditional.
+
 2002-06-14  Richard Williamson  <rjw@apple.com>
 
     Name change view -> webView.
index a410d30..9b46775 100644 (file)
@@ -1,3 +1,70 @@
+2002-06-14  Darin Adler  <darin@apple.com>
+
+       Worked on eliminating calls to WebKit. About 3/4 done.
+
+       * WebCore.exp: Export new WebCoreBridge class, fewer other things.
+
+       * WebCorePrefix.h: #include <ostream> in debug builds; we couldn't
+       before because of a PFE bug that has since been fixed (2920556).
+
+       * khtml/html/html_objectimpl.cpp: (HTMLObjectElementImpl::attach):
+       Add a comment explaining our latest change here.
+
+       * khtml/khtml_part.cpp: (KHTMLPart::~KHTMLPart): Fix storage leak
+       by deleting m_hostExtension.
+
+       * khtml/misc/loader.h: Set type properly on client member so we
+       don't have to do so much casting.
+
+       * kwq/KWQKHTMLPartImpl.h: Add getBridge and setBridge, remove setDataSource.
+       * kwq/KWQKHTMLPart.mm:
+       (KWQKHTMLPartImpl::KWQKHTMLPartImpl): Eliminate m_dataSource.
+       (KWQKHTMLPartImpl::openURLInFrame): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::urlSelected): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::requestFrame): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::requestObject): Move WebCoreViewFactory code
+       here; we don't need an entire WCPluginWidget file just for this
+       function.
+       (KWQKHTMLPartImpl::submitForm): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::frameExists): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::frames): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::setTitle): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::getDataSource): Use WebCoreBridge.
+       (KWQKHTMLPartImpl::parentPart): Use WebCoreBridge.
+
+       * kwq/KWQKHTMLPartBrowserExtension.mm:
+       (KHTMLPartBrowserExtension::createNewWindow): Use WebCoreBridge.
+
+       * kwq/KWQKloader.mm: Move the part of external.h that we still use in
+       here, with the expectation of eliminating it soon. Also renamed
+       URLLoadClient to KWQURLLoadClient so we don't hog namespace.
+
+       * kwq/qt/qscrollview.h:
+       * kwq/KWQScrollView.mm: Used helper functions to do the "documentView"
+       selector thing more consistently.
+
+       * kwq/KWQWidget.mm: Get interface for changing the cursor from
+       WebCoreViewFactory.h instead of from external.h.
+
+       * kwq/WebCoreViewFactory.h:
+       * kwq/Makefile.am: Remove WCPluginWidget.mm, add WebCoreBridge.mm.
+       * kwq/WCPluginWidget.h: Removed.
+       * kwq/WCPluginWidget.mm: Removed.
+       * kwq/WebCoreBridge.h: Added.
+       * kwq/WebCoreBridge.mm: Added.
+
+       * kwq/qt/qarray.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qcstring.h: Remove <iostream> include since we include <qarray.h>.
+       * kwq/qt/qdatetime.h: Replace unconditional <iostream> include with a
+       conditional <ostream> include. Also made streaming operators conditional.
+       * kwq/qt/qlist.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qmap.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qpoint.h: Use <iosfwd> instead of <iostream>.
+       * kwq/qt/qsize.h: Use <iosfwd> instead of <iostream>.
+       * kwq/qt/qvaluelist.h: Use <ostream> instead of <iostream>.
+       * kwq/qt/qvector.h: Replace unconditional <iostream> include with a
+       conditional <ostream> include. Also made streaming operators conditional.
+
 2002-06-14  Richard Williamson  <rjw@apple.com>
 
     Name change view -> webView.
index 778bb3d..640c156 100644 (file)
@@ -1,11 +1,10 @@
+.objc_class_name_WebCoreBridge
+.objc_class_name_WebCoreImageRendererFactory
 .objc_class_name_WebCoreTextRendererFactory
 .objc_class_name_WebCoreViewFactory
-.objc_class_name_WebCoreImageRendererFactory
 __Z27WCSetIFLoadProgressMakeFuncPFP11objc_objectvE
-__Z28WCSetIFWebDataSourceMakeFuncPFP11objc_objectPvS1_jE
 __ZN11QMouseEventC1EN6QEvent4TypeERK6QPointii
 __ZN16KWQKHTMLPartImpl10setBaseURLERK4KURL
-__ZN16KWQKHTMLPartImpl13setDataSourceEP15IFWebDataSource
 __ZN16KWQKHTMLPartImpl14gotoBaseAnchorEv
 __ZN16KWQKHTMLPartImpl7setViewEP9KHTMLView
 __ZN16KWQKHTMLPartImpl8slotDataEP8NSStringPKcib
index d7567bc..a877611 100644 (file)
 #ifdef __cplusplus
 
 #include <cstddef>
-// FIXME: We really need to precompile iostream, but we can't until Radar 2920556 is fixed.
-//#include <iostream>
 #include <new>
 
+#ifndef NDEBUG
+#include <ostream>
+#endif
+
 #endif
 
 #include <sys/types.h>
index 2e6127c..24fd757 100644 (file)
@@ -334,14 +334,19 @@ void HTMLObjectElementImpl::attach()
 
     KHTMLView* w = getDocument()->view();
     bool loadplugin = w->part()->pluginsEnabled();
+#ifdef APPLE_CHANGES
+    // This check showed up during the KDE 3.0 -> 3.0.1 transition.
+    // We can't figure out exactly what it's supposed to do, but it prevents
+    // plugins from working properly for us, so we've rolled back to the way
+    // it was in KDE 3.0.1.
+#else
     KURL u = getDocument()->completeURL(url);
     for (KHTMLPart* part = w->part(); part; part = part->parentPart())
         if (part->url() == u) {
-#ifndef APPLE_CHANGES
             loadplugin = false;
-#endif
             break;
         }
+#endif
 
     if (loadplugin && parentNode()->renderer()) {
         needWidgetUpdate = false;
index b054bf3..af28138 100644 (file)
@@ -306,6 +306,8 @@ KHTMLPart::~KHTMLPart()
   
 #ifdef APPLE_CHANGES
   delete impl;
+
+  delete d->m_hostExtension;
 #endif
 
   delete d; d = 0;
index cf328cb..b900a23 100644 (file)
@@ -68,6 +68,11 @@ namespace DOM
 
 #ifdef APPLE_CHANGES
 class KWQLoaderImpl;
+#ifdef __OBJC__
+@class KWQURLLoadClient;
+#else
+class KWQURLLoadClient;
+#endif
 #endif
 
 namespace khtml
@@ -382,7 +387,7 @@ namespace khtml
        CachedObject *object;
         DocLoader* m_docLoader;
 #ifdef APPLE_CHANGES
-        void *client;
+        KWQURLLoadClient *client;
 #endif
      };
 
index 2a5cfa6..8fd0868 100644 (file)
 
 #include <qarray.h>
 #include <string.h>
-#include <KWQDef.h>
-
-#ifdef _KWQ_IOSTREAM_
-#include <iostream>
-#endif
 
 typedef QMemArray<char> QByteArray;
 
index 1c352f2..7676ec5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #ifndef QDATETIME_H_
 #define QDATETIME_H_
 
-#include <iostream>
+#include <KWQDef.h>
+
+#ifdef _KWQ_IOSTREAM_
+#include <iosfwd>
+#endif
 
 class QTime {
 public:
@@ -50,7 +54,9 @@ private:
     uint timeMS;  // time is stored in milliseconds 
     
     friend class QDateTime;
+#ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QTime & );
+#endif
     
 };
 
@@ -77,7 +83,9 @@ private:
     void setCurrentDate();
     
     friend class QDateTime;
+#ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QDate & );
+#endif
 
 };
 
@@ -97,7 +105,9 @@ private:
     QTime timeDT;
     QDate dateDT;
 
+#ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QDateTime & );
+#endif
 };
 
 #endif
index 647d139..3a7e883 100644 (file)
 
 #ifdef __OBJC__
 @class IFWebDataSource;
+@class WebCoreBridge;
 #else
 class IFWebDataSource;
+class WebCoreBridge;
 #endif
 
 class KWQKHTMLPartImpl : public QObject
@@ -37,6 +39,8 @@ public:
     KWQKHTMLPartImpl(KHTMLPart *);
     ~KWQKHTMLPartImpl();
     
+    void setBridge(WebCoreBridge *p) { bridge = p; }
+    WebCoreBridge *getBridge() const { return bridge; }
     void setView(KHTMLView *view);
 
     bool openURLInFrame(const KURL &, const KParts::URLArgs &);
@@ -59,7 +63,6 @@ public:
     
     QString documentSource() const;
 
-    void setDataSource(IFWebDataSource *);
     IFWebDataSource *getDataSource();
 
     bool frameExists(const QString &frameName);
@@ -76,13 +79,14 @@ public:
 private:
     KHTMLPart *part;
     KHTMLPartPrivate *d;
+    
+    WebCoreBridge *bridge;
 
     int m_redirectionTimer;
     
     KURL m_baseURL;
     QString m_documentSource;
     bool m_decodingStarted;
-    IFWebDataSource *m_dataSource;
     
     friend class KHTMLPart;
 };
index fb3beee..a4bad96 100644 (file)
 
 #import <khtmlpart_p.h>
 
-#import <WCPluginWidget.h>
+#import <WebCoreViewFactory.h>
+#import <WebCoreBridge.h>
 #import <WCWebDataSource.h>
-#import <external.h>
 
 #import <kwqdebug.h>
 
 #undef _KWQ_TIMING
 
-static WCIFWebDataSourceMakeFunc WCIFWebDataSourceMake;
-
-void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func)
-{
-    WCIFWebDataSourceMake = func;
-}
-
 static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 {
     DOM::Node cur_child = node.lastChild();
@@ -68,7 +61,6 @@ KWQKHTMLPartImpl::KWQKHTMLPartImpl(KHTMLPart *p)
     , d(part->d)
     , m_redirectionTimer(0)
     , m_decodingStarted(false)
-    , m_dataSource(0)
 {
 }
 
@@ -79,29 +71,20 @@ KWQKHTMLPartImpl::~KWQKHTMLPartImpl()
 
 bool KWQKHTMLPartImpl::openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs )
 {
-  IFWebDataSource *oldDataSource, *newDataSource;
-  IFWebFrame *frame;
-
+    WebCoreBridge *frame;
 
-  if (!urlArgs.frameName.isEmpty()) {
-    frame = [[getDataSource() controller] frameNamed: QSTRING_TO_NSSTRING(urlArgs.frameName)];
-    oldDataSource = [frame dataSource];
-  } else {
-      oldDataSource = getDataSource();
-      frame = [oldDataSource webFrame];
-  }
-
-  if (frame == nil) {
-    frame = [[getDataSource() controller] mainFrame];
-  }
-
-  newDataSource = WCIFWebDataSourceMake(url.getNSURL(), nil, 0);
-  [newDataSource _setParent: [oldDataSource parent]];
+    if (!urlArgs.frameName.isEmpty()) {
+        frame = [bridge frameNamed:urlArgs.frameName.getNSString()];
+        if (frame == nil) {
+            frame = [bridge mainFrame];
+        }
+    } else {
+        frame = bridge;
+    }
 
-  [frame setProvisionalDataSource: newDataSource];
-  [frame startLoading];
+    [frame loadURL:url.getNSURL()];
 
-  return true;
+    return true;
 }
 
 void KWQKHTMLPartImpl::openURL(const KURL &url)
@@ -398,10 +381,9 @@ void KWQKHTMLPartImpl::redirectURL()
 
 void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, const QString &_target, KParts::URLArgs )
 {
-    IFWebDataSource *oldDataSource, *newDataSource;
     KURL clickedURL(part->completeURL( url));
-    IFWebFrame *frame, *currentFrame;
     KURL refLess(clickedURL);
+    WebCoreBridge *frame;
        
     if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
     {
@@ -411,7 +393,7 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
 
     // Open new window on command-click
     if (state & MetaButton) {
-        [[getDataSource() controller] openNewWindowWithURL:clickedURL.getNSURL()];
+        [bridge openNewWindowWithURL:clickedURL.getNSURL()];
         return;
     }
 
@@ -423,86 +405,52 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
         return;
     }
     
-    oldDataSource = getDataSource();
-    currentFrame = [oldDataSource webFrame];
-    if (_target.isEmpty()){
-        // If we're the only frame in a frameset then pop
-        // the frame.
-        if ([[[oldDataSource parent] children] count] == 1){
-            frame = [[oldDataSource parent] webFrame];
+    if (_target.isEmpty()) {
+        // If we're the only frame in a frameset then pop the frame.
+        if ([[[bridge parent] children] count] == 1) {
+            frame = [bridge parent];
+        } else {
+            frame = bridge;
         }
-        else
-            frame = currentFrame;
     }
     else {
-        frame = [currentFrame frameNamed: QSTRING_TO_NSSTRING(_target)];
-        if (frame == nil){
-            // FIXME:  What is the correct behavior here?
-            NSLog (@"ERROR:  unable to find frame named %@\n",
-                        QSTRING_TO_NSSTRING(_target));
+        frame = [bridge frameNamed:_target.getNSString()];
+        if (frame == nil) {
+            // FIXME: What is the correct behavior here? Other browsers seem to open new windows.
+            NSLog (@"ERROR: unable to find frame named %@\n", _target.getNSString());
             return;
         }
-        oldDataSource = [frame dataSource];
     }
     
-    newDataSource = WCIFWebDataSourceMake(clickedURL.getNSURL(), nil, 0);
-    [newDataSource _setParent: [oldDataSource parent]];
-    
-    [frame setProvisionalDataSource: newDataSource];
-    [frame startLoading];
+    [frame loadURL:clickedURL.getNSURL()];
 }
 
 bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
                                      const QStringList &params, bool isIFrame )
 {
-    NSString *nsframeName = QSTRING_TO_NSSTRING(frameName);
-    IFWebFrame *aFrame;
-    IFWebDataSource *dataSource;
-    
-    dataSource = getDataSource();
-
-    KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "name %s\n", [nsframeName cString]);
-    aFrame =[dataSource frameNamed: nsframeName];
-    if (aFrame){
-        KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "found %s\n", [nsframeName cString]);
-        QWidget *khtmlview = [[[aFrame webView] documentView] _provisionalWidget];
-        if (khtmlview)
-            frame->setWidget (khtmlview);
-        else
-            frame->setWidget ([[[aFrame webView] documentView] _widget]);
+    NSString *name = frameName.getNSString();
+
+    KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "name %s\n", DEBUG_OBJECT(name));
+    WebCoreBridge *framePart = [bridge frameNamed:name];
+    if (framePart) {
+        KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "found %s\n", DEBUG_OBJECT(name));
+        frame->setWidget([framePart widget]);
     }
     else {        
-        KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "creating %s\n", [nsframeName cString]);
-        IFWebDataSource *oldDataSource, *newDataSource;
-        NSURL *childURL;
-        IFWebFrame *newFrame;
-        IFWebController *controller;
-        HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(frame->element());
-                
-        childURL = part->completeURL(url).getNSURL();
+        KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "creating %s\n", DEBUG_OBJECT(name));
+        
+        NSURL *childURL = part->completeURL(url).getNSURL();
         if (childURL == nil || [childURL path] == nil) {
             NSLog (@"ERROR (probably need to fix CFURL): unable to create URL with path");
             return false;
         }
         
-        oldDataSource = getDataSource();
-        controller = [oldDataSource controller];
-        newFrame = [controller createFrameNamed: nsframeName for: nil inParent: oldDataSource inScrollView: o->scrollingMode() != QScrollView::AlwaysOff];
-        if (newFrame == nil) {
-            // Controller return NO to location change, now what?
+        HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(frame->element());
+        if (![bridge createNewFrameNamed:name withURL:childURL
+                renderPart:frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
+                marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()]) {
             return false;
         }
-        [newFrame _setRenderFramePart: frame];
-        
-        newDataSource = WCIFWebDataSourceMake(childURL, nil, 0);
-        [newDataSource _setParent: oldDataSource];
-        [newFrame setProvisionalDataSource: newDataSource];
-    
-        
-        [[newFrame webView] _setMarginWidth: o->getMarginWidth()];
-        [[newFrame webView] _setMarginHeight: o->getMarginHeight()];
-
-        [newFrame startLoading];
     }
 
 #ifdef _SUPPORT_JAVASCRIPT_URL_    
@@ -527,16 +475,29 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     return true;
 }
 
-bool KWQKHTMLPartImpl::requestObject( khtml::RenderPart *frame, const QString &url, const QString &serviceType,
-                                     const QStringList &args )
+bool KWQKHTMLPartImpl::requestObject(khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
 {
-  if (url.isEmpty()) {
-    return false;
-  }
-  if (!frame->widget()) {
-    frame->setWidget(IFPluginWidgetCreate(part->completeURL(url).url(), serviceType, args, m_baseURL.url()));
-  }
-  return true;
+    if (url.isEmpty()) {
+        return false;
+    }
+    if (frame->widget()) {
+        return true;
+    }
+    
+    NSMutableArray *argsArray = [NSMutableArray arrayWithCapacity:args.count()];
+    for (uint i = 0; i < args.count(); i++) {
+        [argsArray addObject:args[i].getNSString()];
+    }
+    
+    QWidget *widget = new QWidget();
+    widget->setView([[WebCoreViewFactory sharedFactory]
+        viewForPluginWithURL:part->completeURL(url).url().getNSString()
+                    serviceType:serviceType.getNSString()
+                    arguments:argsArray
+                        baseURL:m_baseURL.url().getNSString()]);
+    frame->setWidget(widget);
+    
+    return true;
 }
 
 void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary )
@@ -569,9 +530,6 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
     return;
 #endif
 
-  NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
-  unsigned loadFlags = 0;
-
 #ifdef NEED_THIS
   KParts::URLArgs args;
 
@@ -588,7 +546,7 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
   if ( strcmp( action, "get" ) == 0 )
   {
     u.setQuery( QString( formData.data(), formData.size() ) );
-    [attributes setObject:@"GET" forKey:IFHTTPURLHandleRequestMethod];
+    [bridge loadURL:u.getNSURL()];
 
 #ifdef NEED_THIS
     args.frameName = target;
@@ -608,14 +566,8 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
     else // contentType must be "multipart/form-data"
       args.setContentType( "Content-Type: " + contentType + "; boundary=" + boundary );
 #endif
-      NSData *postData = [NSData dataWithBytes:formData.data() length:formData.size()];
-      [attributes setObject:postData forKey:IFHTTPURLHandleRequestData];
-      [attributes setObject:@"POST" forKey:IFHTTPURLHandleRequestMethod];
-      // When posting, use the IFURLHandleFlagLoadFromOrigin load flag. 
-      // This prevents a potential bug which may cause a page
-      // with a form that uses itself as an action to be returned 
-      // from the cache without submitting.
-      loadFlags = IFURLHandleFlagLoadFromOrigin;
+    NSData *postData = [NSData dataWithBytes:formData.data() length:formData.size()];
+    [bridge postWithURL:u.getNSURL() data:postData];
   }
 
 #ifdef NEED_THIS
@@ -635,35 +587,23 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
   else
     emit d->m_extension->openURLRequest( u, args );
 #endif
-    IFWebDataSource *oldDataSource, *newDataSource;
-    IFWebFrame *frame;
-    
-    oldDataSource = getDataSource();
-    frame = [oldDataSource webFrame];
-
-    newDataSource = WCIFWebDataSourceMake(u.getNSURL(), attributes, loadFlags);
-    [newDataSource _setParent: [oldDataSource parent]];
-    
-    [frame setProvisionalDataSource: newDataSource];
-    [frame startLoading];
 }
 
 bool KWQKHTMLPartImpl::frameExists( const QString &frameName )
 {
-    return [getDataSource() frameExists: (NSString *)frameName.getCFMutableString()];
+    return [bridge frameNamed:frameName.getNSString()];
 }
 
 QPtrList<KParts::ReadOnlyPart> KWQKHTMLPartImpl::frames() const
 {
     QPtrList<KParts::ReadOnlyPart> res;
-    IFWebDataSource *thisDataSource = ((KWQKHTMLPartImpl *)this)->getDataSource();
-    NSArray *children = [thisDataSource children];
-    IFWebFrame *aFrame;
+    NSArray *children = [bridge children];
+    WebCoreBridge *childPart;
     unsigned int i;
     
     for (i = 0; i < [children count]; i++){
-        aFrame = [children objectAtIndex: i];
-        res.append( [[[aFrame dataSource] representation] part] );
+        childPart = [children objectAtIndex: i];
+        res.append([childPart part]);
     }
     return res;
 }
@@ -692,24 +632,15 @@ void KWQKHTMLPartImpl::setView(KHTMLView *view)
 
 void KWQKHTMLPartImpl::setTitle(const DOMString &title)
 {
-    [getDataSource() _setTitle:title.string().getNSString()];
-}
-
-void KWQKHTMLPartImpl::setDataSource(IFWebDataSource *dataSource)
-{
-    m_dataSource = dataSource; // not retained
+    [bridge setTitle:title.string().getNSString()];
 }
 
 IFWebDataSource *KWQKHTMLPartImpl::getDataSource()
 {
-    return m_dataSource;
+    return [bridge dataSource];
 }
 
-
 KHTMLPart *KWQKHTMLPartImpl::parentPart()
 {
-    IFWebDataSource *parent, *dataSource = getDataSource();
-    
-    parent = [dataSource parent];
-    return [[parent representation] part];
+    return [[bridge parent] part];
 }
index 59a4dc6..cba08e3 100644 (file)
@@ -25,7 +25,7 @@
 
 #import <khtml/khtml_ext.h>
 #import <khtml_part.h>
-#import <external.h>
+#import <WebCoreBridge.h>
 #import <KWQKHTMLPartImpl.h>
 
 KHTMLPartBrowserExtension::KHTMLPartBrowserExtension(KHTMLPart *part)
@@ -56,10 +56,14 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
 void KHTMLPartBrowserExtension::createNewWindow(const KURL &url, 
                                                const KParts::URLArgs &urlArgs, 
                                                const KParts::WindowArgs &winArgs, 
-                                               KParts::ReadOnlyPart **part)
+                                               KParts::ReadOnlyPart **partResult)
 { 
-    IFWebController *newController = [[m_part->impl->getDataSource() controller] openNewWindowWithURL:url.getNSURL()];
-    if (part != NULL) {
-       *part = [[[[newController mainFrame] provisionalDataSource] representation] part];
+    [m_part->impl->getBridge() openNewWindowWithURL:url.getNSURL()];
+    
+    // We can't return a KHTMLPart in all cases, because the new window might not even
+    // have HTML in it. And we don't create the KHTMLPart until we become "committed".
+    // So it's better not to try to return the KHTMLPart, and no callers currently need it.
+    if (partResult) {
+       *partResult = 0;
     }
 }
index 647d139..3a7e883 100644 (file)
 
 #ifdef __OBJC__
 @class IFWebDataSource;
+@class WebCoreBridge;
 #else
 class IFWebDataSource;
+class WebCoreBridge;
 #endif
 
 class KWQKHTMLPartImpl : public QObject
@@ -37,6 +39,8 @@ public:
     KWQKHTMLPartImpl(KHTMLPart *);
     ~KWQKHTMLPartImpl();
     
+    void setBridge(WebCoreBridge *p) { bridge = p; }
+    WebCoreBridge *getBridge() const { return bridge; }
     void setView(KHTMLView *view);
 
     bool openURLInFrame(const KURL &, const KParts::URLArgs &);
@@ -59,7 +63,6 @@ public:
     
     QString documentSource() const;
 
-    void setDataSource(IFWebDataSource *);
     IFWebDataSource *getDataSource();
 
     bool frameExists(const QString &frameName);
@@ -76,13 +79,14 @@ public:
 private:
     KHTMLPart *part;
     KHTMLPartPrivate *d;
+    
+    WebCoreBridge *bridge;
 
     int m_redirectionTimer;
     
     KURL m_baseURL;
     QString m_documentSource;
     bool m_decodingStarted;
-    IFWebDataSource *m_dataSource;
     
     friend class KHTMLPart;
 };
index fb3beee..a4bad96 100644 (file)
 
 #import <khtmlpart_p.h>
 
-#import <WCPluginWidget.h>
+#import <WebCoreViewFactory.h>
+#import <WebCoreBridge.h>
 #import <WCWebDataSource.h>
-#import <external.h>
 
 #import <kwqdebug.h>
 
 #undef _KWQ_TIMING
 
-static WCIFWebDataSourceMakeFunc WCIFWebDataSourceMake;
-
-void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func)
-{
-    WCIFWebDataSourceMake = func;
-}
-
 static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 {
     DOM::Node cur_child = node.lastChild();
@@ -68,7 +61,6 @@ KWQKHTMLPartImpl::KWQKHTMLPartImpl(KHTMLPart *p)
     , d(part->d)
     , m_redirectionTimer(0)
     , m_decodingStarted(false)
-    , m_dataSource(0)
 {
 }
 
@@ -79,29 +71,20 @@ KWQKHTMLPartImpl::~KWQKHTMLPartImpl()
 
 bool KWQKHTMLPartImpl::openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs )
 {
-  IFWebDataSource *oldDataSource, *newDataSource;
-  IFWebFrame *frame;
-
+    WebCoreBridge *frame;
 
-  if (!urlArgs.frameName.isEmpty()) {
-    frame = [[getDataSource() controller] frameNamed: QSTRING_TO_NSSTRING(urlArgs.frameName)];
-    oldDataSource = [frame dataSource];
-  } else {
-      oldDataSource = getDataSource();
-      frame = [oldDataSource webFrame];
-  }
-
-  if (frame == nil) {
-    frame = [[getDataSource() controller] mainFrame];
-  }
-
-  newDataSource = WCIFWebDataSourceMake(url.getNSURL(), nil, 0);
-  [newDataSource _setParent: [oldDataSource parent]];
+    if (!urlArgs.frameName.isEmpty()) {
+        frame = [bridge frameNamed:urlArgs.frameName.getNSString()];
+        if (frame == nil) {
+            frame = [bridge mainFrame];
+        }
+    } else {
+        frame = bridge;
+    }
 
-  [frame setProvisionalDataSource: newDataSource];
-  [frame startLoading];
+    [frame loadURL:url.getNSURL()];
 
-  return true;
+    return true;
 }
 
 void KWQKHTMLPartImpl::openURL(const KURL &url)
@@ -398,10 +381,9 @@ void KWQKHTMLPartImpl::redirectURL()
 
 void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, const QString &_target, KParts::URLArgs )
 {
-    IFWebDataSource *oldDataSource, *newDataSource;
     KURL clickedURL(part->completeURL( url));
-    IFWebFrame *frame, *currentFrame;
     KURL refLess(clickedURL);
+    WebCoreBridge *frame;
        
     if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
     {
@@ -411,7 +393,7 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
 
     // Open new window on command-click
     if (state & MetaButton) {
-        [[getDataSource() controller] openNewWindowWithURL:clickedURL.getNSURL()];
+        [bridge openNewWindowWithURL:clickedURL.getNSURL()];
         return;
     }
 
@@ -423,86 +405,52 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
         return;
     }
     
-    oldDataSource = getDataSource();
-    currentFrame = [oldDataSource webFrame];
-    if (_target.isEmpty()){
-        // If we're the only frame in a frameset then pop
-        // the frame.
-        if ([[[oldDataSource parent] children] count] == 1){
-            frame = [[oldDataSource parent] webFrame];
+    if (_target.isEmpty()) {
+        // If we're the only frame in a frameset then pop the frame.
+        if ([[[bridge parent] children] count] == 1) {
+            frame = [bridge parent];
+        } else {
+            frame = bridge;
         }
-        else
-            frame = currentFrame;
     }
     else {
-        frame = [currentFrame frameNamed: QSTRING_TO_NSSTRING(_target)];
-        if (frame == nil){
-            // FIXME:  What is the correct behavior here?
-            NSLog (@"ERROR:  unable to find frame named %@\n",
-                        QSTRING_TO_NSSTRING(_target));
+        frame = [bridge frameNamed:_target.getNSString()];
+        if (frame == nil) {
+            // FIXME: What is the correct behavior here? Other browsers seem to open new windows.
+            NSLog (@"ERROR: unable to find frame named %@\n", _target.getNSString());
             return;
         }
-        oldDataSource = [frame dataSource];
     }
     
-    newDataSource = WCIFWebDataSourceMake(clickedURL.getNSURL(), nil, 0);
-    [newDataSource _setParent: [oldDataSource parent]];
-    
-    [frame setProvisionalDataSource: newDataSource];
-    [frame startLoading];
+    [frame loadURL:clickedURL.getNSURL()];
 }
 
 bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
                                      const QStringList &params, bool isIFrame )
 {
-    NSString *nsframeName = QSTRING_TO_NSSTRING(frameName);
-    IFWebFrame *aFrame;
-    IFWebDataSource *dataSource;
-    
-    dataSource = getDataSource();
-
-    KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "name %s\n", [nsframeName cString]);
-    aFrame =[dataSource frameNamed: nsframeName];
-    if (aFrame){
-        KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "found %s\n", [nsframeName cString]);
-        QWidget *khtmlview = [[[aFrame webView] documentView] _provisionalWidget];
-        if (khtmlview)
-            frame->setWidget (khtmlview);
-        else
-            frame->setWidget ([[[aFrame webView] documentView] _widget]);
+    NSString *name = frameName.getNSString();
+
+    KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "name %s\n", DEBUG_OBJECT(name));
+    WebCoreBridge *framePart = [bridge frameNamed:name];
+    if (framePart) {
+        KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "found %s\n", DEBUG_OBJECT(name));
+        frame->setWidget([framePart widget]);
     }
     else {        
-        KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "creating %s\n", [nsframeName cString]);
-        IFWebDataSource *oldDataSource, *newDataSource;
-        NSURL *childURL;
-        IFWebFrame *newFrame;
-        IFWebController *controller;
-        HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(frame->element());
-                
-        childURL = part->completeURL(url).getNSURL();
+        KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "creating %s\n", DEBUG_OBJECT(name));
+        
+        NSURL *childURL = part->completeURL(url).getNSURL();
         if (childURL == nil || [childURL path] == nil) {
             NSLog (@"ERROR (probably need to fix CFURL): unable to create URL with path");
             return false;
         }
         
-        oldDataSource = getDataSource();
-        controller = [oldDataSource controller];
-        newFrame = [controller createFrameNamed: nsframeName for: nil inParent: oldDataSource inScrollView: o->scrollingMode() != QScrollView::AlwaysOff];
-        if (newFrame == nil) {
-            // Controller return NO to location change, now what?
+        HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(frame->element());
+        if (![bridge createNewFrameNamed:name withURL:childURL
+                renderPart:frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
+                marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()]) {
             return false;
         }
-        [newFrame _setRenderFramePart: frame];
-        
-        newDataSource = WCIFWebDataSourceMake(childURL, nil, 0);
-        [newDataSource _setParent: oldDataSource];
-        [newFrame setProvisionalDataSource: newDataSource];
-    
-        
-        [[newFrame webView] _setMarginWidth: o->getMarginWidth()];
-        [[newFrame webView] _setMarginHeight: o->getMarginHeight()];
-
-        [newFrame startLoading];
     }
 
 #ifdef _SUPPORT_JAVASCRIPT_URL_    
@@ -527,16 +475,29 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     return true;
 }
 
-bool KWQKHTMLPartImpl::requestObject( khtml::RenderPart *frame, const QString &url, const QString &serviceType,
-                                     const QStringList &args )
+bool KWQKHTMLPartImpl::requestObject(khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
 {
-  if (url.isEmpty()) {
-    return false;
-  }
-  if (!frame->widget()) {
-    frame->setWidget(IFPluginWidgetCreate(part->completeURL(url).url(), serviceType, args, m_baseURL.url()));
-  }
-  return true;
+    if (url.isEmpty()) {
+        return false;
+    }
+    if (frame->widget()) {
+        return true;
+    }
+    
+    NSMutableArray *argsArray = [NSMutableArray arrayWithCapacity:args.count()];
+    for (uint i = 0; i < args.count(); i++) {
+        [argsArray addObject:args[i].getNSString()];
+    }
+    
+    QWidget *widget = new QWidget();
+    widget->setView([[WebCoreViewFactory sharedFactory]
+        viewForPluginWithURL:part->completeURL(url).url().getNSString()
+                    serviceType:serviceType.getNSString()
+                    arguments:argsArray
+                        baseURL:m_baseURL.url().getNSString()]);
+    frame->setWidget(widget);
+    
+    return true;
 }
 
 void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary )
@@ -569,9 +530,6 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
     return;
 #endif
 
-  NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
-  unsigned loadFlags = 0;
-
 #ifdef NEED_THIS
   KParts::URLArgs args;
 
@@ -588,7 +546,7 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
   if ( strcmp( action, "get" ) == 0 )
   {
     u.setQuery( QString( formData.data(), formData.size() ) );
-    [attributes setObject:@"GET" forKey:IFHTTPURLHandleRequestMethod];
+    [bridge loadURL:u.getNSURL()];
 
 #ifdef NEED_THIS
     args.frameName = target;
@@ -608,14 +566,8 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
     else // contentType must be "multipart/form-data"
       args.setContentType( "Content-Type: " + contentType + "; boundary=" + boundary );
 #endif
-      NSData *postData = [NSData dataWithBytes:formData.data() length:formData.size()];
-      [attributes setObject:postData forKey:IFHTTPURLHandleRequestData];
-      [attributes setObject:@"POST" forKey:IFHTTPURLHandleRequestMethod];
-      // When posting, use the IFURLHandleFlagLoadFromOrigin load flag. 
-      // This prevents a potential bug which may cause a page
-      // with a form that uses itself as an action to be returned 
-      // from the cache without submitting.
-      loadFlags = IFURLHandleFlagLoadFromOrigin;
+    NSData *postData = [NSData dataWithBytes:formData.data() length:formData.size()];
+    [bridge postWithURL:u.getNSURL() data:postData];
   }
 
 #ifdef NEED_THIS
@@ -635,35 +587,23 @@ void KWQKHTMLPartImpl::submitForm( const char *action, const QString &url, const
   else
     emit d->m_extension->openURLRequest( u, args );
 #endif
-    IFWebDataSource *oldDataSource, *newDataSource;
-    IFWebFrame *frame;
-    
-    oldDataSource = getDataSource();
-    frame = [oldDataSource webFrame];
-
-    newDataSource = WCIFWebDataSourceMake(u.getNSURL(), attributes, loadFlags);
-    [newDataSource _setParent: [oldDataSource parent]];
-    
-    [frame setProvisionalDataSource: newDataSource];
-    [frame startLoading];
 }
 
 bool KWQKHTMLPartImpl::frameExists( const QString &frameName )
 {
-    return [getDataSource() frameExists: (NSString *)frameName.getCFMutableString()];
+    return [bridge frameNamed:frameName.getNSString()];
 }
 
 QPtrList<KParts::ReadOnlyPart> KWQKHTMLPartImpl::frames() const
 {
     QPtrList<KParts::ReadOnlyPart> res;
-    IFWebDataSource *thisDataSource = ((KWQKHTMLPartImpl *)this)->getDataSource();
-    NSArray *children = [thisDataSource children];
-    IFWebFrame *aFrame;
+    NSArray *children = [bridge children];
+    WebCoreBridge *childPart;
     unsigned int i;
     
     for (i = 0; i < [children count]; i++){
-        aFrame = [children objectAtIndex: i];
-        res.append( [[[aFrame dataSource] representation] part] );
+        childPart = [children objectAtIndex: i];
+        res.append([childPart part]);
     }
     return res;
 }
@@ -692,24 +632,15 @@ void KWQKHTMLPartImpl::setView(KHTMLView *view)
 
 void KWQKHTMLPartImpl::setTitle(const DOMString &title)
 {
-    [getDataSource() _setTitle:title.string().getNSString()];
-}
-
-void KWQKHTMLPartImpl::setDataSource(IFWebDataSource *dataSource)
-{
-    m_dataSource = dataSource; // not retained
+    [bridge setTitle:title.string().getNSString()];
 }
 
 IFWebDataSource *KWQKHTMLPartImpl::getDataSource()
 {
-    return m_dataSource;
+    return [bridge dataSource];
 }
 
-
 KHTMLPart *KWQKHTMLPartImpl::parentPart()
 {
-    IFWebDataSource *parent, *dataSource = getDataSource();
-    
-    parent = [dataSource parent];
-    return [[parent representation] part];
+    return [[bridge parent] part];
 }
index bdfe7a4..c5a59ad 100644 (file)
 #include <misc/loader.h>
 #include <KWQKHTMLPartImpl.h>
 
-#include <external.h>
 #include <WCLoadProgress.h>
 
 #include <kwqdebug.h>
 
+// ==== start of temporary section, formerly from external.h, to be killed ====
+
+@class IFWebDataSource;
+@class IFLoadProgress;
+
+typedef enum {
+    IF_LOAD_TYPE_CSS    = 1,
+    IF_LOAD_TYPE_IMAGE  = 2,
+    IF_LOAD_TYPE_SCRIPT = 3,
+    IF_LOAD_TYPE_HTML   = 4
+} IF_LOAD_TYPE;
+
+@interface IFLoadProgress : NSObject
+{
+    int bytesSoFar;    // 0 if this is the start of load
+    int totalToLoad;   // -1 if this is not known.
+                        // bytesSoFar == totalLoaded when complete
+    IF_LOAD_TYPE type; // load types, either image, css, or jscript
+}
+- init;
+@end
+
+@protocol IFLocationChangeHandler
+- (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
+@end
+
+@interface IFWebController <IFLocationChangeHandler>
+- (void)_receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_mainReceivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_mainReceivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_didStartLoading: (NSURL *)url;
+- (void)_didStopLoading: (NSURL *)url;
+@end
+
+@interface IFWebDataSource : NSObject
+- (IFWebController *)controller;
+- (void)_addURLHandle: (IFURLHandle *)handle;
+- (void)_removeURLHandle: (IFURLHandle *)handle;
+- (void)_setFinalURL: (NSURL *)url;
+- representation;
+@end
+
+@interface IFHTMLRepresentation : NSObject
+- (KHTMLPart *)part;
+@end
+
+@protocol IFLoadHandler
+- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+@end
+
+// ==== end of temporary section, formerly from external.h, to be killed ====
+
 using khtml::DocLoader;
 using khtml::Loader;
 using khtml::Request;
@@ -45,9 +98,19 @@ void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
     WCIFLoadProgressMake = func;
 }
 
-@implementation URLLoadClient
+@interface KWQURLLoadClient : NSObject <IFURLHandleClient>
+{
+    khtml::Loader *m_loader;
+    IFWebDataSource *m_dataSource;
+}
 
--(id)initWithLoader:(Loader *)loader dataSource: dataSource
+-(id)initWithLoader:(khtml::Loader *)loader dataSource:(IFWebDataSource *)dataSource;
+
+@end
+
+@implementation KWQURLLoadClient
+
+-(id)initWithLoader:(Loader *)loader dataSource:(IFWebDataSource *)dataSource
 {
     if ((self = [super init])) {
         m_loader = loader;
@@ -67,8 +130,8 @@ void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     id controller;
-       int contentLength = [sender contentLength];
-       int contentLengthReceived = [sender contentLengthReceived];
+    int contentLength = [sender contentLength];
+    int contentLengthReceived = [sender contentLengthReceived];
     void *userData;
 
     userData = [[sender attributeForKey:IFURLHandleUserData] pointerValue];
@@ -226,7 +289,7 @@ KWQLoaderImpl::~KWQLoaderImpl()
 void KWQLoaderImpl::setClient(Request *req)
 {
     IFWebDataSource *dataSource = ((KHTMLPart *)((DocLoader *)req->object->loader())->part())->impl->getDataSource();
-    req->client = [[[URLLoadClient alloc] initWithLoader:loader dataSource: dataSource] autorelease];
+    req->client = [[[KWQURLLoadClient alloc] initWithLoader:loader dataSource: dataSource] autorelease];
 }
 
 void KWQLoaderImpl::serveRequest(Request *req, KIO::TransferJob *job)
@@ -235,17 +298,17 @@ void KWQLoaderImpl::serveRequest(Request *req, KIO::TransferJob *job)
           req->m_docLoader->part()->baseURL().url().latin1(), req->object->url().string().latin1());
     //job->begin(d->m_recv, job);
     
-    job->begin((URLLoadClient *)req->client, job);
-    if (job->handle() == nil){
+    job->begin(req->client, job);
+    if (job->handle() == nil) {
         // Must be a malformed URL.
         NSString *urlString = QSTRING_TO_NSSTRING(req->object->url().string());
         IFError *error = [IFError errorWithCode:IFURLHandleResultBadURLError inDomain:IFErrorCodeDomainWebFoundation isTerminal:YES];
 
-        id <IFLoadHandler> controller = [((URLLoadClient *)req->client)->m_dataSource controller];
-        [(IFWebController *)controller _receivedError: error forResource: urlString partialProgress: nil fromDataSource: ((URLLoadClient *)req->client)->m_dataSource];
+        id <IFLoadHandler> controller = [(req->client)->m_dataSource controller];
+        [(IFWebController *)controller _receivedError: error forResource: urlString partialProgress: nil fromDataSource: req->client->m_dataSource];
     }
     else {
-        [((URLLoadClient *)req->client)->m_dataSource _addURLHandle: job->handle()];
+        [req->client->m_dataSource _addURLHandle: job->handle()];
     }
 }
 
index bdfe7a4..c5a59ad 100644 (file)
 #include <misc/loader.h>
 #include <KWQKHTMLPartImpl.h>
 
-#include <external.h>
 #include <WCLoadProgress.h>
 
 #include <kwqdebug.h>
 
+// ==== start of temporary section, formerly from external.h, to be killed ====
+
+@class IFWebDataSource;
+@class IFLoadProgress;
+
+typedef enum {
+    IF_LOAD_TYPE_CSS    = 1,
+    IF_LOAD_TYPE_IMAGE  = 2,
+    IF_LOAD_TYPE_SCRIPT = 3,
+    IF_LOAD_TYPE_HTML   = 4
+} IF_LOAD_TYPE;
+
+@interface IFLoadProgress : NSObject
+{
+    int bytesSoFar;    // 0 if this is the start of load
+    int totalToLoad;   // -1 if this is not known.
+                        // bytesSoFar == totalLoaded when complete
+    IF_LOAD_TYPE type; // load types, either image, css, or jscript
+}
+- init;
+@end
+
+@protocol IFLocationChangeHandler
+- (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
+@end
+
+@interface IFWebController <IFLocationChangeHandler>
+- (void)_receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_mainReceivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_mainReceivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_didStartLoading: (NSURL *)url;
+- (void)_didStopLoading: (NSURL *)url;
+@end
+
+@interface IFWebDataSource : NSObject
+- (IFWebController *)controller;
+- (void)_addURLHandle: (IFURLHandle *)handle;
+- (void)_removeURLHandle: (IFURLHandle *)handle;
+- (void)_setFinalURL: (NSURL *)url;
+- representation;
+@end
+
+@interface IFHTMLRepresentation : NSObject
+- (KHTMLPart *)part;
+@end
+
+@protocol IFLoadHandler
+- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+@end
+
+// ==== end of temporary section, formerly from external.h, to be killed ====
+
 using khtml::DocLoader;
 using khtml::Loader;
 using khtml::Request;
@@ -45,9 +98,19 @@ void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
     WCIFLoadProgressMake = func;
 }
 
-@implementation URLLoadClient
+@interface KWQURLLoadClient : NSObject <IFURLHandleClient>
+{
+    khtml::Loader *m_loader;
+    IFWebDataSource *m_dataSource;
+}
 
--(id)initWithLoader:(Loader *)loader dataSource: dataSource
+-(id)initWithLoader:(khtml::Loader *)loader dataSource:(IFWebDataSource *)dataSource;
+
+@end
+
+@implementation KWQURLLoadClient
+
+-(id)initWithLoader:(Loader *)loader dataSource:(IFWebDataSource *)dataSource
 {
     if ((self = [super init])) {
         m_loader = loader;
@@ -67,8 +130,8 @@ void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     id controller;
-       int contentLength = [sender contentLength];
-       int contentLengthReceived = [sender contentLengthReceived];
+    int contentLength = [sender contentLength];
+    int contentLengthReceived = [sender contentLengthReceived];
     void *userData;
 
     userData = [[sender attributeForKey:IFURLHandleUserData] pointerValue];
@@ -226,7 +289,7 @@ KWQLoaderImpl::~KWQLoaderImpl()
 void KWQLoaderImpl::setClient(Request *req)
 {
     IFWebDataSource *dataSource = ((KHTMLPart *)((DocLoader *)req->object->loader())->part())->impl->getDataSource();
-    req->client = [[[URLLoadClient alloc] initWithLoader:loader dataSource: dataSource] autorelease];
+    req->client = [[[KWQURLLoadClient alloc] initWithLoader:loader dataSource: dataSource] autorelease];
 }
 
 void KWQLoaderImpl::serveRequest(Request *req, KIO::TransferJob *job)
@@ -235,17 +298,17 @@ void KWQLoaderImpl::serveRequest(Request *req, KIO::TransferJob *job)
           req->m_docLoader->part()->baseURL().url().latin1(), req->object->url().string().latin1());
     //job->begin(d->m_recv, job);
     
-    job->begin((URLLoadClient *)req->client, job);
-    if (job->handle() == nil){
+    job->begin(req->client, job);
+    if (job->handle() == nil) {
         // Must be a malformed URL.
         NSString *urlString = QSTRING_TO_NSSTRING(req->object->url().string());
         IFError *error = [IFError errorWithCode:IFURLHandleResultBadURLError inDomain:IFErrorCodeDomainWebFoundation isTerminal:YES];
 
-        id <IFLoadHandler> controller = [((URLLoadClient *)req->client)->m_dataSource controller];
-        [(IFWebController *)controller _receivedError: error forResource: urlString partialProgress: nil fromDataSource: ((URLLoadClient *)req->client)->m_dataSource];
+        id <IFLoadHandler> controller = [(req->client)->m_dataSource controller];
+        [(IFWebController *)controller _receivedError: error forResource: urlString partialProgress: nil fromDataSource: req->client->m_dataSource];
     }
     else {
-        [((URLLoadClient *)req->client)->m_dataSource _addURLHandle: job->handle()];
+        [req->client->m_dataSource _addURLHandle: job->handle()];
     }
 }
 
index bdfe7a4..c5a59ad 100644 (file)
 #include <misc/loader.h>
 #include <KWQKHTMLPartImpl.h>
 
-#include <external.h>
 #include <WCLoadProgress.h>
 
 #include <kwqdebug.h>
 
+// ==== start of temporary section, formerly from external.h, to be killed ====
+
+@class IFWebDataSource;
+@class IFLoadProgress;
+
+typedef enum {
+    IF_LOAD_TYPE_CSS    = 1,
+    IF_LOAD_TYPE_IMAGE  = 2,
+    IF_LOAD_TYPE_SCRIPT = 3,
+    IF_LOAD_TYPE_HTML   = 4
+} IF_LOAD_TYPE;
+
+@interface IFLoadProgress : NSObject
+{
+    int bytesSoFar;    // 0 if this is the start of load
+    int totalToLoad;   // -1 if this is not known.
+                        // bytesSoFar == totalLoaded when complete
+    IF_LOAD_TYPE type; // load types, either image, css, or jscript
+}
+- init;
+@end
+
+@protocol IFLocationChangeHandler
+- (void)serverRedirectTo: (NSURL *)url forDataSource: (IFWebDataSource *)dataSource;
+@end
+
+@interface IFWebController <IFLocationChangeHandler>
+- (void)_receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_mainReceivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_mainReceivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+- (void)_didStartLoading: (NSURL *)url;
+- (void)_didStopLoading: (NSURL *)url;
+@end
+
+@interface IFWebDataSource : NSObject
+- (IFWebController *)controller;
+- (void)_addURLHandle: (IFURLHandle *)handle;
+- (void)_removeURLHandle: (IFURLHandle *)handle;
+- (void)_setFinalURL: (NSURL *)url;
+- representation;
+@end
+
+@interface IFHTMLRepresentation : NSObject
+- (KHTMLPart *)part;
+@end
+
+@protocol IFLoadHandler
+- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
+- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
+@end
+
+// ==== end of temporary section, formerly from external.h, to be killed ====
+
 using khtml::DocLoader;
 using khtml::Loader;
 using khtml::Request;
@@ -45,9 +98,19 @@ void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
     WCIFLoadProgressMake = func;
 }
 
-@implementation URLLoadClient
+@interface KWQURLLoadClient : NSObject <IFURLHandleClient>
+{
+    khtml::Loader *m_loader;
+    IFWebDataSource *m_dataSource;
+}
 
--(id)initWithLoader:(Loader *)loader dataSource: dataSource
+-(id)initWithLoader:(khtml::Loader *)loader dataSource:(IFWebDataSource *)dataSource;
+
+@end
+
+@implementation KWQURLLoadClient
+
+-(id)initWithLoader:(Loader *)loader dataSource:(IFWebDataSource *)dataSource
 {
     if ((self = [super init])) {
         m_loader = loader;
@@ -67,8 +130,8 @@ void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func)
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     id controller;
-       int contentLength = [sender contentLength];
-       int contentLengthReceived = [sender contentLengthReceived];
+    int contentLength = [sender contentLength];
+    int contentLengthReceived = [sender contentLengthReceived];
     void *userData;
 
     userData = [[sender attributeForKey:IFURLHandleUserData] pointerValue];
@@ -226,7 +289,7 @@ KWQLoaderImpl::~KWQLoaderImpl()
 void KWQLoaderImpl::setClient(Request *req)
 {
     IFWebDataSource *dataSource = ((KHTMLPart *)((DocLoader *)req->object->loader())->part())->impl->getDataSource();
-    req->client = [[[URLLoadClient alloc] initWithLoader:loader dataSource: dataSource] autorelease];
+    req->client = [[[KWQURLLoadClient alloc] initWithLoader:loader dataSource: dataSource] autorelease];
 }
 
 void KWQLoaderImpl::serveRequest(Request *req, KIO::TransferJob *job)
@@ -235,17 +298,17 @@ void KWQLoaderImpl::serveRequest(Request *req, KIO::TransferJob *job)
           req->m_docLoader->part()->baseURL().url().latin1(), req->object->url().string().latin1());
     //job->begin(d->m_recv, job);
     
-    job->begin((URLLoadClient *)req->client, job);
-    if (job->handle() == nil){
+    job->begin(req->client, job);
+    if (job->handle() == nil) {
         // Must be a malformed URL.
         NSString *urlString = QSTRING_TO_NSSTRING(req->object->url().string());
         IFError *error = [IFError errorWithCode:IFURLHandleResultBadURLError inDomain:IFErrorCodeDomainWebFoundation isTerminal:YES];
 
-        id <IFLoadHandler> controller = [((URLLoadClient *)req->client)->m_dataSource controller];
-        [(IFWebController *)controller _receivedError: error forResource: urlString partialProgress: nil fromDataSource: ((URLLoadClient *)req->client)->m_dataSource];
+        id <IFLoadHandler> controller = [(req->client)->m_dataSource controller];
+        [(IFWebController *)controller _receivedError: error forResource: urlString partialProgress: nil fromDataSource: req->client->m_dataSource];
     }
     else {
-        [((URLLoadClient *)req->client)->m_dataSource _addURLHandle: job->handle()];
+        [req->client->m_dataSource _addURLHandle: job->handle()];
     }
 }
 
index ed4720c..43a442f 100644 (file)
@@ -31,7 +31,7 @@
 #include <KWQMapImpl.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <ostream>
 #endif
 
 template <class K, class V> class QMap;
index 76c2d45..88fa79b 100644 (file)
 #include <KWQDef.h>
 #include <KWQArrayImpl.h>
 
+#ifdef _KWQ_IOSTREAM_
+#include <ostream>
+#endif
+
 template <class T> class QMemArray {
 public:
     QMemArray() : impl(sizeof(T)) {}
@@ -56,8 +60,6 @@ public:
 
 #ifdef _KWQ_IOSTREAM_
 
-#include <iostream>
-
 template<class T>
 inline std::ostream &operator<<(std::ostream &stream, const QMemArray<T>&a)
 {
index 6864a8d..38c96d7 100644 (file)
@@ -29,7 +29,7 @@
 #include <KWQDef.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <iosfwd>
 #endif
 
 #include "qarray.h"
index 6a22a92..7b3457c 100644 (file)
@@ -31,7 +31,7 @@
 #include <KWQListImpl.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <ostream>
 #endif
 
 template <class T> class QPtrListIterator;
index 5d713de..ba42067 100644 (file)
 #ifndef QVECTOR_H_
 #define QVECTOR_H_
 
-#include <iostream>
-
 #include <KWQDef.h>
 #include <qcollection.h>
 
 #include <KWQVectorImpl.h>
 
+#ifdef _KWQ_IOSTREAM_
+#include <ostream>
+#endif
+
 class QGVector : public QPtrCollection
 {
 public:
@@ -68,6 +70,8 @@ public:
     KWQVectorImpl impl;
 };
 
+#ifdef _KWQ_IOSTREAM_
+
 template<class T>
 inline std::ostream &operator<<(std::ostream &stream, const QPtrVector<T> &v)
 {
@@ -85,3 +89,5 @@ inline std::ostream &operator<<(std::ostream &stream, const QPtrVector<T> &v)
 }
 
 #endif
+
+#endif
index 1391020..ce1ebc6 100644 (file)
 
 #include <qframe.h>
 
+#ifdef __OBJC__
+@class NSView;
+#else
+class NSView;
+#endif
+
 class QScrollView : public QFrame {
 public:
     enum ScrollBarMode { AlwaysOff, AlwaysOn, Auto };
@@ -72,6 +78,8 @@ public:
 
     void ensureVisible(int,int);
     void ensureVisible(int,int,int,int);
+    
+    NSView *getDocumentView() const;
 };
 
 #endif
index 1ae3434..417205a 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <kwqdebug.h>
 
-#include <external.h>
-
 /*
     This class implementation does NOT actually emulate the Qt QScrollView.
     Instead our WebPageView, like any other NSView can be set as the document
@@ -43,6 +41,25 @@ QScrollView::QScrollView(QWidget *parent, const char *name, int f)
 {
 }
 
+static NSView *getDocumentView(NSView *view)
+{
+    if ([view respondsToSelector:@selector(documentView)]) {
+        id untypedView = view;
+        view = [untypedView documentView];
+    }
+    return view;
+}
+
+static NSView *getDocumentView(const QWidget *widget)
+{
+    return getDocumentView(widget->getView());
+}
+
+NSView *QScrollView::getDocumentView() const
+{
+    return ::getDocumentView(this);
+}
+
 QWidget* QScrollView::viewport() const
 {
     return const_cast<QScrollView *>(this);
@@ -63,7 +80,7 @@ int QScrollView::visibleWidth() const
 #else
     NSScrollView *view = (NSScrollView *)getView();
     int visibleWidth;
-    if (view != nil && [view isKindOfClass: [NSScrollView class]]){
+    if (view != nil && [view isKindOfClass:[NSScrollView class]]){
         visibleWidth = (int)[view documentVisibleRect].size.width;
     }
     else
@@ -92,7 +109,7 @@ int QScrollView::visibleHeight() const
     NSScrollView *view = (NSScrollView *)getView();
     int visibleHeight;
     
-    if (view != nil && [view isKindOfClass: [NSScrollView class]]){
+    if (view != nil && [view isKindOfClass:[NSScrollView class]]){
         visibleHeight = (int)[view documentVisibleRect].size.height;
     }
     else
@@ -107,25 +124,19 @@ int QScrollView::visibleHeight() const
 
 int QScrollView::contentsWidth() const
 {
-    NSScrollView *view = (NSScrollView *)getView();
-    if ([view respondsToSelector: @selector(documentView)])
-        return (int)[[view documentView] bounds].size.width;
-    return (int)[view bounds].size.width;
+    return (int)[getDocumentView() bounds].size.width;
 }
 
 
 int QScrollView::contentsHeight() const
 {
-    NSScrollView *view = (NSScrollView *)getView();
-    if ([view respondsToSelector: @selector(documentView)])
-        return (int)[[view documentView] bounds].size.height;
-    return (int)[view bounds].size.height;
+    return (int)[getDocumentView() bounds].size.height;
 }
 
 int QScrollView::contentsX() const
 {
     NSScrollView *view = (NSScrollView *)getView();
-    if ([view respondsToSelector: @selector(documentView)])
+    if ([view respondsToSelector:@selector(documentView)])
         return (int)[[view documentView] bounds].origin.x;
     return 0;
 }
@@ -133,7 +144,7 @@ int QScrollView::contentsX() const
 int QScrollView::contentsY() const
 {
     NSScrollView *view = (NSScrollView *)getView();
-    if ([view respondsToSelector: @selector(documentView)])
+    if ([view respondsToSelector:@selector(documentView)])
         return (int)[[view documentView] bounds].origin.y;
     return 0;
 }
@@ -155,17 +166,11 @@ void QScrollView::scrollBy(int dx, int dy)
 
 void QScrollView::setContentsPos(int x, int y)
 {
-    NSView *view = getView();    
-    if ([view isKindOfClass: [NSScrollView class]]) {
-        NSScrollView *scrollView = (NSScrollView *)view;
-        view = [scrollView documentView];
-    }
-
     if (x < 0)
         x = 0;
     if (y < 0)
         y = 0;
-    [view scrollPoint: NSMakePoint(x,y)];
+    [getDocumentView() scrollPoint: NSMakePoint(x,y)];
 }
 
 void QScrollView::setVScrollBarMode(ScrollBarMode)
@@ -185,16 +190,8 @@ void QScrollView::addChild(QWidget* child, int x, int y)
     if (child->x() != x || child->y() != y)
         child->move(x, y);
         
-    thisView = getView();
-    if ([thisView isKindOfClass: [NSScrollView class]]) {
-        NSScrollView *scrollView = thisView;
-        thisView = [scrollView documentView];
-    }
-
-    subView = child->getView();
-    if ([subView isKindOfClass: [NSScrollView class]]) {
-        subView = [subView superview];
-    }
+    thisView = getDocumentView();
+    subView = ::getDocumentView(child);
 
     if ([subView superview] == thisView) {
         return;
@@ -214,21 +211,20 @@ void QScrollView::removeChild(QWidget* child)
 void QScrollView::resizeContents(int w, int h)
 {
     KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "%p %s at w %d h %d\n", getView(), [[[getView() class] className] cString], w, h);
-    if ([getView() isKindOfClass: [NSScrollView class]]){
-        NSScrollView *scrollView = (NSScrollView *)getView();
-        IFWebView *wview = [scrollView documentView];
+    if ([getView() isKindOfClass:[NSScrollView class]]){
+        NSView *wview = getDocumentView();
         
         KWQDEBUGLEVEL (KWQ_LOG_FRAMES, "%p %s at w %d h %d\n", wview, [[[wview class] className] cString], w, h);
         //w -= (int)[NSScroller scrollerWidth];
         //w -= 1;
         if (w < 0)
             w = 0;
-        // Why isn't there a scollerHeight?
+        // Why isn't there a scrollerHeight?
         //h -= (int)[NSScroller scrollerWidth];
         //h -= 1;
         if (h < 0)
             h = 0;
-        [wview setFrameSize: NSMakeSize (w,h)];
+        [wview setFrameSize:NSMakeSize(w,h)];
     }
     else {
         resize (w, h);
@@ -260,13 +256,7 @@ QPoint QScrollView::contentsToViewport(const QPoint &p)
 
 void QScrollView::contentsToViewport(int x, int y, int& vx, int& vy)
 {
-    NSView *view = getView();    
-    if ([view isKindOfClass: [NSScrollView class]]) {
-        NSScrollView *scrollView = (NSScrollView *)view;
-        view = [scrollView documentView];
-    }
-        
-    NSPoint np = [view convertPoint: NSMakePoint (x, y) toView: nil];
+    NSPoint np = [getDocumentView() convertPoint: NSMakePoint (x, y) toView: nil];
     
     vx = (int)np.x;
     vy = (int)np.y;
@@ -274,13 +264,7 @@ void QScrollView::contentsToViewport(int x, int y, int& vx, int& vy)
 
 void QScrollView::viewportToContents(int vx, int vy, int& x, int& y)
 {
-    NSView *view = getView();    
-    if ([view isKindOfClass: [NSScrollView class]]) {
-        NSScrollView *scrollView = (NSScrollView *)view;
-        view = [scrollView documentView];
-    }
-        
-    NSPoint np = [view convertPoint: NSMakePoint (vx, vy) fromView: nil];
+    NSPoint np = [getDocumentView() convertPoint: NSMakePoint (vx, vy) fromView: nil];
     
     x = (int)np.x;
     y = (int)np.y;
index 6d6ae53..ac050f7 100644 (file)
@@ -29,7 +29,7 @@
 #include <KWQDef.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <iosfwd>
 #endif
 
 class QSize {
index 3f910e5..244edf6 100644 (file)
@@ -30,7 +30,7 @@
 #include <KWQValueListImpl.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <ostream>
 #endif
 
 template <class T> class QValueList;
index 56e4bee..eb0dc51 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <qwidget.h>
+#import <qwidget.h>
 
-#include <external.h>
+#import <WebCoreViewFactory.h>
 
-#include <kwqdebug.h>
+#import <kwqdebug.h>
 
 #import <KWQView.h>
 
@@ -250,7 +250,7 @@ QSize QWidget::minimumSizeHint() const
 {
     NSView *view = getView();
     
-    if ([view isKindOfClass: [NSControl class]]) {
+    if ([view isKindOfClass:[NSControl class]]) {
         NSControl *control = (NSControl *)view;
         [control sizeToFit];
         NSRect frame = [view frame];
index ffc8a65..eb08f10 100644 (file)
@@ -110,7 +110,7 @@ libkwq_o_SOURCES = \
        KWQtextstream.mm \
        KWQxml.mm \
        kwqdebug.mm \
-       WCPluginWidget.mm \
+       WebCoreBridge.mm \
        WebCoreImageRendererFactory.m \
        WebCoreTextRendererFactory.m \
        WebCoreViewFactory.m \
similarity index 55%
rename from WebCore/kwq/WCPluginWidget.mm
rename to WebCore/kwq/WebCoreBridge.h
index 3715ee4..982dc73 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
-#import "WCPluginWidget.h"
-#import <qwidget.h>
-#import <WebCoreViewFactory.h>
 
-QWidget *IFPluginWidgetCreate(const QString &url, const QString &serviceType, const QStringList &args, const QString &baseURL)
+#import <Foundation/Foundation.h>
+
+class KHTMLPart;
+class KHTMLView;
+
+namespace khtml {
+    class RenderPart;
+}
+
+@class IFWebDataSource; // temporary -- here only until I finish KWQKloader.mm
+
+@interface WebCoreBridge : NSObject
 {
-    NSMutableArray *argsArray = [NSMutableArray arrayWithCapacity:args.count()];
-    for (uint i = 0; i < args.count(); i++) {
-        [argsArray addObject:args[i].getNSString()];
-    }
-    QWidget *widget = new QWidget();
-    widget->setView([[WebCoreViewFactory sharedFactory]
-        viewForPluginWithURL:url.getNSString()
-                    serviceType:serviceType.getNSString()
-                    arguments:argsArray
-                        baseURL:baseURL.getNSString()]);
-    return widget;
+    KHTMLPart *part;
 }
+
+- (KHTMLPart *)part;
+
+- (WebCoreBridge *)parent;
+- (NSArray *)children; // WebCoreBridge objects
+
+- (WebCoreBridge *)mainFrame;
+- (WebCoreBridge *)frameNamed:(NSString *)name; // always searches entire hierarchy starting with mainFrame
+
+- (void)setTitle:(NSString *)title;
+
+- (void)loadURL:(NSURL *)URL;
+- (void)postWithURL:(NSURL *)URL data:(NSData *)data;
+
+- (BOOL)createNewFrameNamed:(NSString *)frameName
+    withURL:(NSURL *)URL renderPart:(khtml::RenderPart *)renderPart
+    allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
+
+- (void)openNewWindowWithURL:(NSURL *)URL;
+
+- (KHTMLView *)widget;
+
+- (IFWebDataSource *)dataSource; // temporary -- here only until I finish KWQKloader.mm
+
+@end
similarity index 54%
rename from WebCore/kwq/WCPluginWidget.h
rename to WebCore/kwq/WebCoreBridge.mm
index d041430..b54afcf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef WCPluginWidget_H_
-#define WCPluginWidget_H_
+#import <WebCoreBridge.h>
 
-class QString;
-class QStringList;
-class QWidget;
+#import <KWQKHTMLPartImpl.h>
 
-QWidget *IFPluginWidgetCreate(const QString &url, const QString &serviceType, const QStringList &args, const QString &baseURL);    
+@implementation WebCoreBridge
 
-#endif
+- init
+{
+    [super init];
+    
+    part = new KHTMLPart;
+    part->impl->setBridge(self);
+    
+    return self;
+}
+
+- (void)dealloc
+{
+    part->deref();
+    
+    [super dealloc];
+}
+
+- (KHTMLPart *)part
+{
+    return part;
+}
+
+- (WebCoreBridge *)parent
+{
+    return nil;
+}
+
+- (NSArray *)children
+{
+    return nil;
+}
+
+- (void)loadURL:(NSURL *)URL
+{
+}
+
+- (void)postWithURL:(NSURL *)URL data:(NSData *)data
+{
+}
+
+- (BOOL)createNewFrameNamed:(NSString *)frameName
+    withURL:(NSURL *)URL renderPart:(khtml::RenderPart *)renderPart
+    allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height
+{
+    return NO;
+}
+
+- (void)openNewWindowWithURL:(NSURL *)URL
+{
+}
+
+- (void)setTitle:(NSString *)title
+{
+}
+
+- (WebCoreBridge *)mainFrame
+{
+    return nil;
+}
+
+- (WebCoreBridge *)frameNamed:(NSString *)name
+{
+    return nil;
+}
+
+- (KHTMLView *)widget
+{
+    return 0;
+}
+
+- (IFWebDataSource *)dataSource
+{
+    return nil;
+}
+
+@end
index 8157faf..eb07f27 100644 (file)
@@ -29,9 +29,6 @@
 @class NSString;
 @class NSView;
 
-typedef NSView *(*IFPluginViewCreationFunction)();
-void IFSetPluginViewCreationFunction(IFPluginViewCreationFunction);
-
 @interface WebCoreViewFactory : NSObject
 {
 }
@@ -54,3 +51,7 @@ void IFSetPluginViewCreationFunction(IFPluginViewCreationFunction);
 - (NSArray *)mimeTypes; // array of NSArrays with 3 parts of MIME type in each
 
 @end
+
+@protocol WebCoreCursorSetting
+- (void)setCursor:(NSCursor *)cursor;
+@end
index 76c2d45..88fa79b 100644 (file)
 #include <KWQDef.h>
 #include <KWQArrayImpl.h>
 
+#ifdef _KWQ_IOSTREAM_
+#include <ostream>
+#endif
+
 template <class T> class QMemArray {
 public:
     QMemArray() : impl(sizeof(T)) {}
@@ -56,8 +60,6 @@ public:
 
 #ifdef _KWQ_IOSTREAM_
 
-#include <iostream>
-
 template<class T>
 inline std::ostream &operator<<(std::ostream &stream, const QMemArray<T>&a)
 {
index 2a5cfa6..8fd0868 100644 (file)
 
 #include <qarray.h>
 #include <string.h>
-#include <KWQDef.h>
-
-#ifdef _KWQ_IOSTREAM_
-#include <iostream>
-#endif
 
 typedef QMemArray<char> QByteArray;
 
index 1c352f2..7676ec5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #ifndef QDATETIME_H_
 #define QDATETIME_H_
 
-#include <iostream>
+#include <KWQDef.h>
+
+#ifdef _KWQ_IOSTREAM_
+#include <iosfwd>
+#endif
 
 class QTime {
 public:
@@ -50,7 +54,9 @@ private:
     uint timeMS;  // time is stored in milliseconds 
     
     friend class QDateTime;
+#ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QTime & );
+#endif
     
 };
 
@@ -77,7 +83,9 @@ private:
     void setCurrentDate();
     
     friend class QDateTime;
+#ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QDate & );
+#endif
 
 };
 
@@ -97,7 +105,9 @@ private:
     QTime timeDT;
     QDate dateDT;
 
+#ifdef _KWQ_IOSTREAM_
     friend std::ostream &operator<<( std::ostream &, const QDateTime & );
+#endif
 };
 
 #endif
index 6a22a92..7b3457c 100644 (file)
@@ -31,7 +31,7 @@
 #include <KWQListImpl.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <ostream>
 #endif
 
 template <class T> class QPtrListIterator;
index ed4720c..43a442f 100644 (file)
@@ -31,7 +31,7 @@
 #include <KWQMapImpl.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <ostream>
 #endif
 
 template <class K, class V> class QMap;
index 6864a8d..38c96d7 100644 (file)
@@ -29,7 +29,7 @@
 #include <KWQDef.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <iosfwd>
 #endif
 
 #include "qarray.h"
index 1391020..ce1ebc6 100644 (file)
 
 #include <qframe.h>
 
+#ifdef __OBJC__
+@class NSView;
+#else
+class NSView;
+#endif
+
 class QScrollView : public QFrame {
 public:
     enum ScrollBarMode { AlwaysOff, AlwaysOn, Auto };
@@ -72,6 +78,8 @@ public:
 
     void ensureVisible(int,int);
     void ensureVisible(int,int,int,int);
+    
+    NSView *getDocumentView() const;
 };
 
 #endif
index 6d6ae53..ac050f7 100644 (file)
@@ -29,7 +29,7 @@
 #include <KWQDef.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <iosfwd>
 #endif
 
 class QSize {
index 3f910e5..244edf6 100644 (file)
@@ -30,7 +30,7 @@
 #include <KWQValueListImpl.h>
 
 #ifdef _KWQ_IOSTREAM_
-#include <iostream>
+#include <ostream>
 #endif
 
 template <class T> class QValueList;
index 5d713de..ba42067 100644 (file)
 #ifndef QVECTOR_H_
 #define QVECTOR_H_
 
-#include <iostream>
-
 #include <KWQDef.h>
 #include <qcollection.h>
 
 #include <KWQVectorImpl.h>
 
+#ifdef _KWQ_IOSTREAM_
+#include <ostream>
+#endif
+
 class QGVector : public QPtrCollection
 {
 public:
@@ -68,6 +70,8 @@ public:
     KWQVectorImpl impl;
 };
 
+#ifdef _KWQ_IOSTREAM_
+
 template<class T>
 inline std::ostream &operator<<(std::ostream &stream, const QPtrVector<T> &v)
 {
@@ -85,3 +89,5 @@ inline std::ostream &operator<<(std::ostream &stream, const QPtrVector<T> &v)
 }
 
 #endif
+
+#endif
index 12adf17..fd078e6 100644 (file)
@@ -1,3 +1,39 @@
+2002-06-14  Darin Adler  <darin@apple.com>
+
+       Add the new bridge class that connects us to WebCore in a nicer way.
+       Started to use it for some things. More to come.
+
+       * WebKit.pbproj/project.pbxproj:
+       * IFWebCoreBridge.h: Added.
+       * IFWebCoreBridge.mm: Added.
+
+       * Misc.subproj/IFDownloadHandler.mm:
+       (-[IFDownloadHandler initWithDataSource:]): Call [super init].
+       (-[IFDownloadHandler dealloc]): Call [super dealloc].
+       * Plugins.subproj/IFPluginNullEventSender.m:
+       (-[IFPluginNullEventSender initializeWithNPP:functionPointer:window:]): Call [super init].
+       (-[IFPluginNullEventSender dealloc]): Call [super dealloc].
+       * WebView.subproj/IFDOMNode.mm: (-[IFDOMNode dealloc]): Call [super dealloc].
+       * WebView.subproj/IFImageView.m: (-[IFImageView dealloc]): Call [super dealloc].
+       * WebView.subproj/IFRenderNode.mm: (-[IFRenderNode dealloc]): Call [super dealloc].
+
+       * WebView.subproj/IFHTMLRepresentation.h: Moved variables into a private structure so
+       this class can be made public.
+       * WebView.subproj/IFHTMLRepresentationPrivate.h: Added. Has _bridge method.
+       * WebView.subproj/IFHTMLRepresentation.mm:
+       (-[IFHTMLRepresentation init]): Call [super init]. Also use the new private structure,
+       and allocate the IFWebCoreBridge.
+       (-[IFHTMLRepresentation dealloc]): Release the private structure and the IFWebCoreBridge.
+       Also, call [super dealloc].
+       (-[IFHTMLRepresentation _bridge]): Private method to get to the bridge.
+       (-[IFHTMLRepresentation receivedData:withDataSource:]): Use IFWebCoreBridge.
+
+       * WebView.subproj/IFWebViewPrivate.h: Add _setMarginWidth and _setMarginHeight.
+
+       * WebView.subproj/IFWebDataSourcePrivate.h: Tweak.
+       * WebView.subproj/IFWebDataSource.mm: Tweak.
+       * History.subproj/IFWebHistoryPrivate.m: Tweak.
+
 2002-06-14  Richard Williamson  <rjw@apple.com>
 
     Lots of frame related cleanup.  Added attempt to get
index 12adf17..fd078e6 100644 (file)
@@ -1,3 +1,39 @@
+2002-06-14  Darin Adler  <darin@apple.com>
+
+       Add the new bridge class that connects us to WebCore in a nicer way.
+       Started to use it for some things. More to come.
+
+       * WebKit.pbproj/project.pbxproj:
+       * IFWebCoreBridge.h: Added.
+       * IFWebCoreBridge.mm: Added.
+
+       * Misc.subproj/IFDownloadHandler.mm:
+       (-[IFDownloadHandler initWithDataSource:]): Call [super init].
+       (-[IFDownloadHandler dealloc]): Call [super dealloc].
+       * Plugins.subproj/IFPluginNullEventSender.m:
+       (-[IFPluginNullEventSender initializeWithNPP:functionPointer:window:]): Call [super init].
+       (-[IFPluginNullEventSender dealloc]): Call [super dealloc].
+       * WebView.subproj/IFDOMNode.mm: (-[IFDOMNode dealloc]): Call [super dealloc].
+       * WebView.subproj/IFImageView.m: (-[IFImageView dealloc]): Call [super dealloc].
+       * WebView.subproj/IFRenderNode.mm: (-[IFRenderNode dealloc]): Call [super dealloc].
+
+       * WebView.subproj/IFHTMLRepresentation.h: Moved variables into a private structure so
+       this class can be made public.
+       * WebView.subproj/IFHTMLRepresentationPrivate.h: Added. Has _bridge method.
+       * WebView.subproj/IFHTMLRepresentation.mm:
+       (-[IFHTMLRepresentation init]): Call [super init]. Also use the new private structure,
+       and allocate the IFWebCoreBridge.
+       (-[IFHTMLRepresentation dealloc]): Release the private structure and the IFWebCoreBridge.
+       Also, call [super dealloc].
+       (-[IFHTMLRepresentation _bridge]): Private method to get to the bridge.
+       (-[IFHTMLRepresentation receivedData:withDataSource:]): Use IFWebCoreBridge.
+
+       * WebView.subproj/IFWebViewPrivate.h: Add _setMarginWidth and _setMarginHeight.
+
+       * WebView.subproj/IFWebDataSourcePrivate.h: Tweak.
+       * WebView.subproj/IFWebDataSource.mm: Tweak.
+       * History.subproj/IFWebHistoryPrivate.m: Tweak.
+
 2002-06-14  Richard Williamson  <rjw@apple.com>
 
     Lots of frame related cleanup.  Added attempt to get
index c752aec..1498e14 100644 (file)
     start = CFAbsoluteTimeGetCurrent();
     result = [self _loadHistoryGuts: &numberOfItems];
 
-    if (result == YES) {
+    if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "loading %d history entries from %s took %f seconds\n",
                            numberOfItems, DEBUG_OBJECT([self file]), duration);
     start = CFAbsoluteTimeGetCurrent();
     result = [self _saveHistoryGuts: &numberOfItems];
 
-    if (result == YES) {
+    if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "saving %d history entries to %s took %f seconds\n",
                            numberOfItems, DEBUG_OBJECT([self file]), duration);
index c752aec..1498e14 100644 (file)
     start = CFAbsoluteTimeGetCurrent();
     result = [self _loadHistoryGuts: &numberOfItems];
 
-    if (result == YES) {
+    if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "loading %d history entries from %s took %f seconds\n",
                            numberOfItems, DEBUG_OBJECT([self file]), duration);
     start = CFAbsoluteTimeGetCurrent();
     result = [self _saveHistoryGuts: &numberOfItems];
 
-    if (result == YES) {
+    if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "saving %d history entries to %s took %f seconds\n",
                            numberOfItems, DEBUG_OBJECT([self file]), duration);
diff --git a/WebKit/IFWebCoreBridge.h b/WebKit/IFWebCoreBridge.h
new file mode 100644 (file)
index 0000000..983412e
--- /dev/null
@@ -0,0 +1,20 @@
+//
+//  IFWebCoreBridge.h
+//  WebKit
+//
+//  Created by Darin Adler on Thu Jun 13 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <WebCoreBridge.h>
+
+@class IFWebDataSource;
+
+@interface IFWebCoreBridge : WebCoreBridge
+{
+    IFWebDataSource *dataSource;
+}
+
+- (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource;
+
+@end
diff --git a/WebKit/IFWebCoreBridge.mm b/WebKit/IFWebCoreBridge.mm
new file mode 100644 (file)
index 0000000..df2bbde
--- /dev/null
@@ -0,0 +1,181 @@
+//
+//  IFWebCoreBridge.mm
+//  WebKit
+//
+//  Created by Darin Adler on Thu Jun 13 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <WebKit/IFWebCoreBridge.h>
+
+#import <WebKit/IFWebController.h>
+#import <WebKit/IFWebFramePrivate.h>
+#import <WebKit/IFWebDataSourcePrivate.h>
+#import <WebKit/IFWebViewPrivate.h>
+#import <WebKit/IFHTMLRepresentation.h>
+#import <WebKit/IFHTMLViewPrivate.h>
+#import <WebFoundation/IFURLCacheLoaderConstants.h>
+#import <KWQKHTMLPartImpl.h>
+
+#import <WebKit/WebKitDebug.h>
+
+@interface IFWebDataSource (IFWebCoreBridge)
+- (IFWebCoreBridge *)_bridge;
+@end
+
+@interface IFWebFrame (IFWebCoreBridge)
+- (IFWebCoreBridge *)_bridge;
+@end
+
+@implementation IFWebDataSource (IFWebCoreBridge)
+
+- (IFWebCoreBridge *)_bridge
+{
+    return [[self representation] _bridge];
+}
+
+@end
+
+@implementation IFWebFrame (IFWebCoreBridge)
+
+- (IFWebCoreBridge *)_bridge
+{
+    return [[self dataSource] _bridge];
+}
+
+@end
+
+@implementation IFWebCoreBridge
+
+- (IFWebFrame *)frame
+{
+    return [dataSource webFrame];
+}
+
+- (IFWebController *)controller
+{
+    return [[self frame] controller];
+}
+
+- (IFWebView *)view
+{
+    return [[self frame] webView];
+}
+
+- (IFHTMLView *)HTMLView
+{
+    return [[self view] documentView];
+}
+
+- (WebCoreBridge *)parent
+{
+    return [[dataSource parent] _bridge];
+}
+
+- (NSArray *)children
+{
+    NSArray *frames = [dataSource children];
+    NSEnumerator *e = [frames objectEnumerator];
+    NSMutableArray *children = [NSMutableArray arrayWithCapacity:[frames count]];
+    IFWebFrame *frame;
+    while ((frame = [e nextObject])) {
+        [children addObject:[frame _bridge]];
+    }
+    return children;
+}
+
+- (void)loadURL:(NSURL *)URL attributes:(NSDictionary *)attributes flags:(unsigned)flags inFrame:(IFWebFrame *)frame withParent:(WebCoreBridge *)parent
+{
+    IFWebDataSource *newDataSource = [[IFWebDataSource alloc] initWithURL:URL attributes:attributes flags:flags];
+    IFWebCoreBridge *parentPrivate = (IFWebCoreBridge *)parent;
+    [newDataSource _setParent:[parentPrivate dataSource]];
+    [frame setProvisionalDataSource:newDataSource];
+    [newDataSource release];
+    [frame startLoading];
+}
+
+- (void)loadURL:(NSURL *)URL
+{
+    [self loadURL:URL attributes:nil flags:0 inFrame:[self frame] withParent:[self parent]];
+}
+
+- (void)postWithURL:(NSURL *)URL data:(NSData *)data
+{
+    // When posting, use the IFURLHandleFlagLoadFromOrigin load flag. 
+    // This prevents a potential bug which may cause a page
+    // with a form that uses itself as an action to be returned 
+    // from the cache without submitting.
+    NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:
+        data, IFHTTPURLHandleRequestData,
+        @"POST", IFHTTPURLHandleRequestMethod,
+        nil];
+    [self loadURL:URL attributes:attributes flags:IFURLHandleFlagLoadFromOrigin inFrame:[self frame] withParent:[self parent]];
+    [attributes release];
+}
+
+- (BOOL)createNewFrameNamed:(NSString *)frameName
+    withURL:(NSURL *)URL renderPart:(khtml::RenderPart *)renderPart
+    allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height
+{
+    IFWebFrame *frame = [[self controller] createFrameNamed:frameName for:nil inParent:dataSource inScrollView:allowsScrolling];
+    if (frame == nil) {
+        return NO;
+    }
+    
+    [frame _setRenderFramePart:renderPart];
+    
+    [[frame webView] _setMarginWidth:width];
+    [[frame webView] _setMarginHeight:height];
+
+    [self loadURL:URL attributes:nil flags:0 inFrame:frame withParent:self];
+    
+    return YES;
+}
+
+- (void)openNewWindowWithURL:(NSURL *)url
+{
+    [[self controller] openNewWindowWithURL:url];
+}
+
+- (void)setTitle:(NSString *)title
+{
+    [dataSource _setTitle:title];
+}
+
+- (WebCoreBridge *)mainFrame
+{
+    return [[[self controller] mainFrame] _bridge];
+}
+
+- (WebCoreBridge *)frameNamed:(NSString *)name
+{
+    return [[[self controller] frameNamed:name] _bridge];
+}
+
+- (KHTMLView *)widget
+{
+    KHTMLView *widget = [[self HTMLView] _provisionalWidget];
+    if (widget) {
+        return widget;
+    }
+    return [[self HTMLView] _widget];
+}
+
+- (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)withDataSource
+{
+    if (dataSource == nil) {
+        dataSource = withDataSource;
+        [self part]->openURL([[[dataSource inputURL] absoluteString] cString]);
+    } else {
+        WEBKIT_ASSERT(dataSource == withDataSource);
+    }
+    
+    [self part]->impl->slotData([dataSource encoding], (const char *)[data bytes], [data length], NO);
+}
+
+- (IFWebDataSource *)dataSource
+{
+    return dataSource;
+}
+
+@end
index 72b51ac..28874a7 100644 (file)
@@ -14,6 +14,8 @@
 
 - initWithDataSource:(IFWebDataSource *)dSource
 {
+    [super init];
+    
     dataSource = [dSource retain];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download started for: %s", [[[dSource inputURL] absoluteString] cString]);
     return self;
@@ -23,6 +25,8 @@
 {
     [fileHandle release];
     [dataSource release];
+    
+    [super dealloc];
 }
 
 - (void)receivedData:(NSData *)data
index 72b51ac..28874a7 100644 (file)
@@ -14,6 +14,8 @@
 
 - initWithDataSource:(IFWebDataSource *)dSource
 {
+    [super init];
+    
     dataSource = [dSource retain];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download started for: %s", [[[dSource inputURL] absoluteString] cString]);
     return self;
@@ -23,6 +25,8 @@
 {
     [fileHandle release];
     [dataSource release];
+    
+    [super dealloc];
 }
 
 - (void)receivedData:(NSData *)data
index 591dbf1..016be20 100644 (file)
 
 -(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)handleEventFunction window:(NSWindow *)theWindow
 {
+    [super init];
+    
     instance = pluginInstance;
     NPP_HandleEvent = handleEventFunction;
     shouldStop = FALSE;
     window = [theWindow retain];
+    
     return self;
 }
 
 -(void) dealloc
 {
     [window release];
+    
+    [super dealloc];
 }
 
 -(void)sendNullEvents
index 591dbf1..016be20 100644 (file)
 
 -(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)handleEventFunction window:(NSWindow *)theWindow
 {
+    [super init];
+    
     instance = pluginInstance;
     NPP_HandleEvent = handleEventFunction;
     shouldStop = FALSE;
     window = [theWindow retain];
+    
     return self;
 }
 
 -(void) dealloc
 {
     [window release];
+    
+    [super dealloc];
 }
 
 -(void)sendNullEvents
index e30899f..4b57b25 100644 (file)
                                35081DAF02B6D4F50ACA2ACA,
                                F508946B02B71D59018A9CD4,
                                F5FBAB9102B88CBF01FF6074,
+                               F5AFB46002B94DC8018635CA,
                                F5E0A77002B8FEE401C1A525,
+                               F5A55DC802BAA2E8018635CC,
                        );
                        isa = PBXHeadersBuildPhase;
                };
                                35081DAD02B6D4E40ACA2ACA,
                                F508946C02B71D59018A9CD4,
                                F5FBAB9202B88CBF01FF6074,
+                               F5AFB46102B94DC8018635CA,
                                F5E0A77102B8FEE401C1A525,
                        );
                        isa = PBXSourcesBuildPhase;
                                F5143A370221DCCE01A80181,
                                9CF0E249021361B00ECA16EA,
                                9CF0E24A021361B00ECA16EA,
+                               F5A55DC702BAA2E8018635CC,
                        );
                        isa = PBXGroup;
                        name = WebView;
                        settings = {
                        };
                };
+               F5A55DC702BAA2E8018635CC = {
+                       isa = PBXFileReference;
+                       name = IFHTMLRepresentationPrivate.h;
+                       path = WebView.subproj/IFHTMLRepresentationPrivate.h;
+                       refType = 4;
+               };
+               F5A55DC802BAA2E8018635CC = {
+                       fileRef = F5A55DC702BAA2E8018635CC;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
                F5A672B70263866E01000102 = {
                        isa = PBXFileReference;
                        name = IFPluginNullEventSender.h;
                        settings = {
                        };
                };
+               F5AFB45E02B94DC8018635CA = {
+                       isa = PBXFileReference;
+                       path = IFWebCoreBridge.h;
+                       refType = 4;
+               };
+               F5AFB45F02B94DC8018635CA = {
+                       isa = PBXFileReference;
+                       path = IFWebCoreBridge.mm;
+                       refType = 4;
+               };
+               F5AFB46002B94DC8018635CA = {
+                       fileRef = F5AFB45E02B94DC8018635CA;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               F5AFB46102B94DC8018635CA = {
+                       fileRef = F5AFB45F02B94DC8018635CA;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
                F5B36B400281DE87018635CB = {
                        children = (
                                F5B36B450281DF9C018635CB,
                                9CE1F8A102A5C6F30ECA2ACD,
                                9CE1F8A202A5C6F30ECA2ACD,
                                9CE1F8A302A5C6F30ECA2ACD,
+                               F5AFB45E02B94DC8018635CA,
+                               F5AFB45F02B94DC8018635CA,
                        );
                        isa = PBXGroup;
                        name = "WebCore Support";
index 23ca798..8550602 100644 (file)
@@ -47,6 +47,8 @@
     [value release];
     [source release];
     [children release];
+    
+    [super dealloc];
 }
 
 - (NSArray *)children
index 76cf639..7dc0f38 100644 (file)
@@ -8,15 +8,17 @@
 
 @class IFError;
 @class IFWebDataSource;
+@class IFWebCoreBridge;
 
 class KHTMLPart;
 
 @protocol IFDocumentRepresentation;
 
+@class IFHTMLRepresentationPrivate;
+
 @interface IFHTMLRepresentation : NSObject <IFDocumentRepresentation>
 {
-    KHTMLPart *part;
-    BOOL isFirstChunk;
+    IFHTMLRepresentationPrivate *_private;
 }
 
 - (KHTMLPart *)part;
index 198c9b7..d1a193b 100644 (file)
@@ -5,40 +5,51 @@
 
 #import <WebKit/IFHTMLRepresentation.h>
 #import <WebKit/IFWebDataSource.h>
+#import <WebKit/IFWebCoreBridge.h>
 #import <KWQKHTMLPartImpl.h>
 
+@interface IFHTMLRepresentationPrivate : NSObject
+{
+    IFWebCoreBridge *bridge;
+}
+@end
+
+@implementation IFHTMLRepresentationPrivate
+@end
+
 @implementation IFHTMLRepresentation
 
 - init
 {
-    part = new KHTMLPart();
-    isFirstChunk = YES;
+    [super init];
+    
+    _private = [[IFHTMLRepresentationPrivate alloc] init];
+    _private->bridge = [[IFWebCoreBridge alloc] init];
     
     return self;
 }
 
 - (void)dealloc
 {
-    part->deref();
+    [_private->bridge release];
+    [_private release];
+
+    [super dealloc];
+}
+
+- (IFWebCoreBridge *)_bridge
+{
+    return _private->bridge;
 }
 
 - (KHTMLPart *)part
 {
-    return part;
+    return [_private->bridge KHTMLPart];
 }
 
 - (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource
 {
-    if(isFirstChunk){
-        // FIXME [rjw]:  Do any work need in the kde engine.  This should be removed.
-        // We should move any code needed out of KWQ.
-        part->openURL([[[dataSource inputURL] absoluteString] cString]);
-        part->impl->setDataSource(dataSource);
-    }
-    
-    part->impl->slotData([dataSource encoding], (const char *)[data bytes], [data length], NO);
-    
-    isFirstChunk = NO;
+    [_private->bridge receivedData:data withDataSource:dataSource];
 }
 
 - (void)receivedError:(IFError *)error withDataSource:(IFWebDataSource *)dataSource
diff --git a/WebKit/WebView.subproj/IFHTMLRepresentationPrivate.h b/WebKit/WebView.subproj/IFHTMLRepresentationPrivate.h
new file mode 100644 (file)
index 0000000..4242361
--- /dev/null
@@ -0,0 +1,10 @@
+/*     
+    IFHTMLRepresentationPrivate.h
+       Copyright 2002, Apple, Inc. All rights reserved.
+*/
+
+#import <WebKit/IFHTMLRepresentation.h>
+
+@interface IFHTMLRepresentation <IFPrivate>
+- (IFWebCoreBridge *)_bridge;
+@end
index 050e5d7..d6dc566 100644 (file)
@@ -26,6 +26,8 @@
 {
     [[representation image] stopAnimation];
     [representation release];
+    
+    [super dealloc];
 }
 
 - (BOOL)isFlipped 
index b239f10..0edde02 100644 (file)
@@ -62,6 +62,8 @@
 {
     [name release];
     [children release];
+    
+    [super dealloc];
 }
 
 - (NSArray *)children
index 171bbae..523dd04 100644 (file)
 
 @implementation IFWebDataSource
 
-static id IFWebDataSourceMake(void *url, void *attributes, unsigned flags) 
-{
-    return [[[IFWebDataSource alloc] initWithURL:(NSURL *)url attributes:(NSDictionary *)attributes flags:flags] autorelease];
-}
-
-+ (void)load
-{
-    WCSetIFWebDataSourceMakeFunc(IFWebDataSourceMake);
-}
-
 - (void)_commonInitialization
 {
     _private = [[IFWebDataSourcePrivate alloc] init];
@@ -161,9 +151,9 @@ static id IFWebDataSourceMake(void *url, void *attributes, unsigned flags)
 
 - (IFWebController *)controller
 {
-    // All data sources used in a document share the same
-    // controller.  A single document may have many datasource corresponding to
-    // frame or iframes.
+    // All data sources used in a document share the same controller.
+    // A single document may have many data sources corresponding to
+    // frames or iframes.
     if (_private->parent != nil)
         return [_private->parent controller];
     return _private->controller;
index 397bb6b..53efdb0 100644 (file)
@@ -69,9 +69,6 @@
     BOOL loading; // self and controller are retained while loading
 }
 
-- init;
-- (void)dealloc;
-
 @end
 
 @interface IFWebDataSource (IFPrivate)
index d3f06f6..0431b51 100644 (file)
@@ -30,9 +30,11 @@ class QWidget;
 
 @interface IFWebView (IFPrivate)
 - (void)_setDocumentView:(id <IFDocumentLoading>)view;
-- (void)_setController: (IFWebController *)controller;
+- (void)_setController:(IFWebController *)controller;
 - (int)_marginWidth;
 - (int)_marginHeight;
+- (void)_setMarginWidth:(int)w;
+- (void)_setMarginHeight:(int)h;
 + (NSMutableDictionary *)_viewTypes;
 + (BOOL)_canShowMIMEType:(NSString *)MIMEType;
 @end
index 23ca798..8550602 100644 (file)
@@ -47,6 +47,8 @@
     [value release];
     [source release];
     [children release];
+    
+    [super dealloc];
 }
 
 - (NSArray *)children
index 171bbae..523dd04 100644 (file)
 
 @implementation IFWebDataSource
 
-static id IFWebDataSourceMake(void *url, void *attributes, unsigned flags) 
-{
-    return [[[IFWebDataSource alloc] initWithURL:(NSURL *)url attributes:(NSDictionary *)attributes flags:flags] autorelease];
-}
-
-+ (void)load
-{
-    WCSetIFWebDataSourceMakeFunc(IFWebDataSourceMake);
-}
-
 - (void)_commonInitialization
 {
     _private = [[IFWebDataSourcePrivate alloc] init];
@@ -161,9 +151,9 @@ static id IFWebDataSourceMake(void *url, void *attributes, unsigned flags)
 
 - (IFWebController *)controller
 {
-    // All data sources used in a document share the same
-    // controller.  A single document may have many datasource corresponding to
-    // frame or iframes.
+    // All data sources used in a document share the same controller.
+    // A single document may have many data sources corresponding to
+    // frames or iframes.
     if (_private->parent != nil)
         return [_private->parent controller];
     return _private->controller;
index 397bb6b..53efdb0 100644 (file)
@@ -69,9 +69,6 @@
     BOOL loading; // self and controller are retained while loading
 }
 
-- init;
-- (void)dealloc;
-
 @end
 
 @interface IFWebDataSource (IFPrivate)
index 23ca798..8550602 100644 (file)
@@ -47,6 +47,8 @@
     [value release];
     [source release];
     [children release];
+    
+    [super dealloc];
 }
 
 - (NSArray *)children
index d3f06f6..0431b51 100644 (file)
@@ -30,9 +30,11 @@ class QWidget;
 
 @interface IFWebView (IFPrivate)
 - (void)_setDocumentView:(id <IFDocumentLoading>)view;
-- (void)_setController: (IFWebController *)controller;
+- (void)_setController:(IFWebController *)controller;
 - (int)_marginWidth;
 - (int)_marginHeight;
+- (void)_setMarginWidth:(int)w;
+- (void)_setMarginHeight:(int)h;
 + (NSMutableDictionary *)_viewTypes;
 + (BOOL)_canShowMIMEType:(NSString *)MIMEType;
 @end
index d3f06f6..0431b51 100644 (file)
@@ -30,9 +30,11 @@ class QWidget;
 
 @interface IFWebView (IFPrivate)
 - (void)_setDocumentView:(id <IFDocumentLoading>)view;
-- (void)_setController: (IFWebController *)controller;
+- (void)_setController:(IFWebController *)controller;
 - (int)_marginWidth;
 - (int)_marginHeight;
+- (void)_setMarginWidth:(int)w;
+- (void)_setMarginHeight:(int)h;
 + (NSMutableDictionary *)_viewTypes;
 + (BOOL)_canShowMIMEType:(NSString *)MIMEType;
 @end
index 76cf639..7dc0f38 100644 (file)
@@ -8,15 +8,17 @@
 
 @class IFError;
 @class IFWebDataSource;
+@class IFWebCoreBridge;
 
 class KHTMLPart;
 
 @protocol IFDocumentRepresentation;
 
+@class IFHTMLRepresentationPrivate;
+
 @interface IFHTMLRepresentation : NSObject <IFDocumentRepresentation>
 {
-    KHTMLPart *part;
-    BOOL isFirstChunk;
+    IFHTMLRepresentationPrivate *_private;
 }
 
 - (KHTMLPart *)part;
index 198c9b7..d1a193b 100644 (file)
@@ -5,40 +5,51 @@
 
 #import <WebKit/IFHTMLRepresentation.h>
 #import <WebKit/IFWebDataSource.h>
+#import <WebKit/IFWebCoreBridge.h>
 #import <KWQKHTMLPartImpl.h>
 
+@interface IFHTMLRepresentationPrivate : NSObject
+{
+    IFWebCoreBridge *bridge;
+}
+@end
+
+@implementation IFHTMLRepresentationPrivate
+@end
+
 @implementation IFHTMLRepresentation
 
 - init
 {
-    part = new KHTMLPart();
-    isFirstChunk = YES;
+    [super init];
+    
+    _private = [[IFHTMLRepresentationPrivate alloc] init];
+    _private->bridge = [[IFWebCoreBridge alloc] init];
     
     return self;
 }
 
 - (void)dealloc
 {
-    part->deref();
+    [_private->bridge release];
+    [_private release];
+
+    [super dealloc];
+}
+
+- (IFWebCoreBridge *)_bridge
+{
+    return _private->bridge;
 }
 
 - (KHTMLPart *)part
 {
-    return part;
+    return [_private->bridge KHTMLPart];
 }
 
 - (void)receivedData:(NSData *)data withDataSource:(IFWebDataSource *)dataSource
 {
-    if(isFirstChunk){
-        // FIXME [rjw]:  Do any work need in the kde engine.  This should be removed.
-        // We should move any code needed out of KWQ.
-        part->openURL([[[dataSource inputURL] absoluteString] cString]);
-        part->impl->setDataSource(dataSource);
-    }
-    
-    part->impl->slotData([dataSource encoding], (const char *)[data bytes], [data length], NO);
-    
-    isFirstChunk = NO;
+    [_private->bridge receivedData:data withDataSource:dataSource];
 }
 
 - (void)receivedError:(IFError *)error withDataSource:(IFWebDataSource *)dataSource
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h b/WebKit/WebView.subproj/WebHTMLRepresentationPrivate.h
new file mode 100644 (file)
index 0000000..4242361
--- /dev/null
@@ -0,0 +1,10 @@
+/*     
+    IFHTMLRepresentationPrivate.h
+       Copyright 2002, Apple, Inc. All rights reserved.
+*/
+
+#import <WebKit/IFHTMLRepresentation.h>
+
+@interface IFHTMLRepresentation <IFPrivate>
+- (IFWebCoreBridge *)_bridge;
+@end
index 050e5d7..d6dc566 100644 (file)
@@ -26,6 +26,8 @@
 {
     [[representation image] stopAnimation];
     [representation release];
+    
+    [super dealloc];
 }
 
 - (BOOL)isFlipped 
index b239f10..0edde02 100644 (file)
@@ -62,6 +62,8 @@
 {
     [name release];
     [children release];
+    
+    [super dealloc];
 }
 
 - (NSArray *)children