[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:24:13 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a03e8f33c718f9a30c9a9e50d99c33a15bd4a42f
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jul 13 05:33:39 2002 +0000

    JavaScriptCore:
    
            * kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had
    	to change the includes here to be compatible with that.
    
    WebFoundation:
    
            * WebFoundation.pbproj/project.pbxproj: Remove unused build phase.
    
    WebCore:
    
            * WebCore.pbproj/project.pbxproj: Add WebCoreFrame.mm, also export all
    	the WebCore headers as Private so WebKit can see them.
    
            * khtml/khtmlview.cpp: (KHTMLView::drawContents): Remove APPLE_CHANGES
    	since we don't use this function any more.
    
            * kwq/KWQDef.h: Since <sys/types.h> now includes ushort and uint, update
    	code here to take that into account.
    
            * kwq/KWQKHTMLPartImpl.h: Added getView().
            * kwq/KWQKHTMLPart.mm: (KWQKHTMLPartImpl::getView): Added. Used by bridge.
    
            * kwq/qt/qpainter.h:
            * kwq/KWQPainter.mm: Simplify a bit, and remove some unused stuff.
    
            * kwq/WebCoreBridge.h: Add reapplyStyles, forceLayout, drawRect:.
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge reapplyStyles]): Added.
            (-[WebCoreBridge forceLayout]): Added.
            (-[WebCoreBridge drawRect:]): Added.
    
            * kwq/WebCoreFrame.h: Make this a class as well as an interface.
            * kwq/WebCoreFrame.mm: Added.
    
            * WebCore.exp: Since WebCoreFrame is now a class as well as a protocol,
    	export it so we can subclass.
    
    WebKit:
    
    	About 1/3 of the remaining work to wean WebKit from its special relationship with WebCore
    	onto explicit interfaces.
    
            * Misc.subproj/IFCache.mm:
            * WebView.subproj/IFDOMNode.mm:
            * WebView.subproj/IFRenderNode.mm:
    	Mark imports from inside WebCore with #ifndef WEBKIT_INDEPENDENT_OF_WEBCORE.
    	Once these are all gone, the task is done.
    
            * Plugins.subproj/IFPlugin.h:
            * WebCoreSupport.subproj/IFCookieAdapter.h:
            * WebCoreSupport.subproj/IFImageRenderer.h:
            * WebCoreSupport.subproj/IFImageRendererFactory.h:
            * WebCoreSupport.subproj/IFResourceURLHandleClient.m:
            * WebCoreSupport.subproj/IFTextRenderer.h:
            * WebCoreSupport.subproj/IFTextRendererFactory.h:
            * WebCoreSupport.subproj/IFWebCoreBridge.h:
            * WebCoreSupport.subproj/IFWebCoreViewFactory.h:
    	Use #import <WebCore/> for getting at WebCore headers so we don't need to use -I.
    
            * WebCoreSupport.subproj/IFWebCoreBridge.mm:
            (-[IFWebCoreBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
    	Call setRenderPart on the WebCoreFrame rather than on the IFWebFrame.
    
            * WebCoreSupport.subproj/IFWebCoreFrame.h: Subclass from the WebCoreFrame class.
            * WebCoreSupport.subproj/IFWebCoreFrame.m:
            (-[IFWebCoreFrame HTMLView]): Add a cast.
            (-[IFWebCoreFrame widget]): Remove overzealous assert.
    
            * WebKit.pbproj/project.pbxproj: Rearranged things a bit. Removed unneeded build phase.
    
            * WebView.subproj/IFDocument.h:
            * WebView.subproj/IFDynamicScrollBarsView.h:
            * WebView.subproj/IFWebController.h:
            * WebView.subproj/IFWebControllerPolicyHandler.h:
    	Changed a few stray #include statements to #import statements.
    
            * WebView.subproj/IFHTMLView.mm:
            (-[IFHTMLView provisionalDataSourceCommitted:]): Move the logic for setting up the
    	renderPart in here from IFWebView.
            (-[IFHTMLView reapplyStyles]): Use the bridge.
            (-[IFHTMLView layout]): Use the bridge.
            (-[IFHTMLView drawRect:]): Use the bridge.
    
            * WebView.subproj/IFHTMLViewPrivate.h: Remove _takeOwnershipOfWidget which is no longer needed.
            * WebView.subproj/IFHTMLViewPrivate.mm:
            (-[NSView _IF_stopIfPluginView]): Added. Use to clean up _reset a bit.
            (-[IFHTMLView _reset]): Use makeObjectsPerformSelector: for simplicity.
    
            * WebView.subproj/IFImageView.h: Remove unneeded IFWebDataSource declaration.
            * WebView.subproj/IFImageView.m: Just formatting tweaks.
    
            * WebView.subproj/IFWebControllerPrivate.mm: Removed unneeded import.
            * WebView.subproj/IFWebDataSource.mm: Removed unneeded import.
            * WebView.subproj/IFWebDataSourcePrivate.mm: Removed unneeded import.
            * WebView.subproj/IFWebFrame.mm: Removed unneeded import.
    
            * WebView.subproj/IFWebFramePrivate.h: Remove renderPart field and related declarations.
            * WebView.subproj/IFWebFramePrivate.mm:
            (-[IFWebFramePrivate dealloc]): No need to let go of renderPart any more.
            (-[IFWebFrame _transitionProvisionalToCommitted]): Move logic into IFHTMLView.
    
            * WebView.subproj/IFWebView.h: Be a bit more specific about the type of documentView.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1549 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index ab6bd33..6d7c2d0 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-12  Darin Adler  <darin at apple.com>
+
+        * kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had
+	to change the includes here to be compatible with that.
+
 2002-07-11  Darin Adler  <darin at apple.com>
 
         * JavaScriptCore.pbproj/project.pbxproj: To make the build of
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index ab6bd33..6d7c2d0 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,8 @@
+2002-07-12  Darin Adler  <darin at apple.com>
+
+        * kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had
+	to change the includes here to be compatible with that.
+
 2002-07-11  Darin Adler  <darin at apple.com>
 
         * JavaScriptCore.pbproj/project.pbxproj: To make the build of
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index ab6bd33..6d7c2d0 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,8 @@
+2002-07-12  Darin Adler  <darin at apple.com>
+
+        * kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had
+	to change the includes here to be compatible with that.
+
 2002-07-11  Darin Adler  <darin at apple.com>
 
         * JavaScriptCore.pbproj/project.pbxproj: To make the build of
diff --git a/JavaScriptCore/kjs/ustring.h b/JavaScriptCore/kjs/ustring.h
index 0c8f5f5..402f0ea 100644
--- a/JavaScriptCore/kjs/ustring.h
+++ b/JavaScriptCore/kjs/ustring.h
@@ -24,11 +24,10 @@
 #define _KJS_USTRING_H_
 
 #ifdef APPLE_CHANGES
+#include <sys/types.h>
 #ifndef KWQ_UNSIGNED_TYPES_DEFINED
 #define KWQ_UNSIGNED_TYPES_DEFINED
 typedef unsigned char uchar;
-typedef unsigned short ushort;
-typedef unsigned uint;
 typedef unsigned long ulong;
 #endif
 #endif
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index fc60dcb..0006257 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,34 @@
 2002-07-12  Darin Adler  <darin at apple.com>
 
+        * WebCore.pbproj/project.pbxproj: Add WebCoreFrame.mm, also export all
+	the WebCore headers as Private so WebKit can see them.
+
+        * khtml/khtmlview.cpp: (KHTMLView::drawContents): Remove APPLE_CHANGES
+	since we don't use this function any more.
+
+        * kwq/KWQDef.h: Since <sys/types.h> now includes ushort and uint, update
+	code here to take that into account.
+
+        * kwq/KWQKHTMLPartImpl.h: Added getView().
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPartImpl::getView): Added. Used by bridge.
+
+        * kwq/qt/qpainter.h:
+        * kwq/KWQPainter.mm: Simplify a bit, and remove some unused stuff.
+
+        * kwq/WebCoreBridge.h: Add reapplyStyles, forceLayout, drawRect:.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge reapplyStyles]): Added.
+        (-[WebCoreBridge forceLayout]): Added.
+        (-[WebCoreBridge drawRect:]): Added.
+
+        * kwq/WebCoreFrame.h: Make this a class as well as an interface.
+        * kwq/WebCoreFrame.mm: Added.
+
+        * WebCore.exp: Since WebCoreFrame is now a class as well as a protocol,
+	export it so we can subclass.
+
+2002-07-12  Darin Adler  <darin at apple.com>
+
 	Build WebCore with Project Builder instead of make.
 	Also wean WebCore from peeking inside the WebKit bundle.
 
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index fc60dcb..0006257 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,34 @@
 2002-07-12  Darin Adler  <darin at apple.com>
 
+        * WebCore.pbproj/project.pbxproj: Add WebCoreFrame.mm, also export all
+	the WebCore headers as Private so WebKit can see them.
+
+        * khtml/khtmlview.cpp: (KHTMLView::drawContents): Remove APPLE_CHANGES
+	since we don't use this function any more.
+
+        * kwq/KWQDef.h: Since <sys/types.h> now includes ushort and uint, update
+	code here to take that into account.
+
+        * kwq/KWQKHTMLPartImpl.h: Added getView().
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPartImpl::getView): Added. Used by bridge.
+
+        * kwq/qt/qpainter.h:
+        * kwq/KWQPainter.mm: Simplify a bit, and remove some unused stuff.
+
+        * kwq/WebCoreBridge.h: Add reapplyStyles, forceLayout, drawRect:.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge reapplyStyles]): Added.
+        (-[WebCoreBridge forceLayout]): Added.
+        (-[WebCoreBridge drawRect:]): Added.
+
+        * kwq/WebCoreFrame.h: Make this a class as well as an interface.
+        * kwq/WebCoreFrame.mm: Added.
+
+        * WebCore.exp: Since WebCoreFrame is now a class as well as a protocol,
+	export it so we can subclass.
+
+2002-07-12  Darin Adler  <darin at apple.com>
+
 	Build WebCore with Project Builder instead of make.
 	Also wean WebCore from peeking inside the WebKit bundle.
 
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index fc60dcb..0006257 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,34 @@
 2002-07-12  Darin Adler  <darin at apple.com>
 
+        * WebCore.pbproj/project.pbxproj: Add WebCoreFrame.mm, also export all
+	the WebCore headers as Private so WebKit can see them.
+
+        * khtml/khtmlview.cpp: (KHTMLView::drawContents): Remove APPLE_CHANGES
+	since we don't use this function any more.
+
+        * kwq/KWQDef.h: Since <sys/types.h> now includes ushort and uint, update
+	code here to take that into account.
+
+        * kwq/KWQKHTMLPartImpl.h: Added getView().
+        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPartImpl::getView): Added. Used by bridge.
+
+        * kwq/qt/qpainter.h:
+        * kwq/KWQPainter.mm: Simplify a bit, and remove some unused stuff.
+
+        * kwq/WebCoreBridge.h: Add reapplyStyles, forceLayout, drawRect:.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge reapplyStyles]): Added.
+        (-[WebCoreBridge forceLayout]): Added.
+        (-[WebCoreBridge drawRect:]): Added.
+
+        * kwq/WebCoreFrame.h: Make this a class as well as an interface.
+        * kwq/WebCoreFrame.mm: Added.
+
+        * WebCore.exp: Since WebCoreFrame is now a class as well as a protocol,
+	export it so we can subclass.
+
+2002-07-12  Darin Adler  <darin at apple.com>
+
 	Build WebCore with Project Builder instead of make.
 	Also wean WebCore from peeking inside the WebKit bundle.
 
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index 321afb3..5490a9e 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -1,5 +1,6 @@
 .objc_class_name_WebCoreBridge
 .objc_class_name_WebCoreCookieAdapter
+.objc_class_name_WebCoreFrame
 .objc_class_name_WebCoreImageRendererFactory
 .objc_class_name_WebCoreTextRendererFactory
 .objc_class_name_WebCoreViewFactory
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index faf0193..37138f4 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -706,6 +706,7 @@
 				F523D31D02DE4476018635CA,
 				F523D31F02DE4476018635CA,
 				F523D32102DE4476018635CA,
+				F52CA71002DFACBD018635CA,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -925,12 +926,12 @@
 				F523D29C02DE43D9018635CA,
 				F523D2F302DE443B018635CA,
 				F523D32402DE4478018635CA,
-				F523D15102DE42AD018635CA,
 				F523D15202DE42AD018635CA,
-				F523D15302DE42AD018635CA,
+				F523D15102DE42AD018635CA,
 				F523D15402DE42AD018635CA,
-				F523D15502DE42AD018635CA,
 				F523D15602DE42AD018635CA,
+				F523D15302DE42AD018635CA,
+				F523D15502DE42AD018635CA,
 				F523D15702DE42AD018635CA,
 				F523D15802DE42AD018635CA,
 				F523D15902DE42AD018635CA,
@@ -3745,6 +3746,18 @@
 			name = xml;
 			refType = 4;
 		};
+		F52CA70F02DFACBD018635CA = {
+			isa = PBXFileReference;
+			name = WebCoreFrame.mm;
+			path = kwq/WebCoreFrame.mm;
+			refType = 4;
+		};
+		F52CA71002DFACBD018635CA = {
+			fileRef = F52CA70F02DFACBD018635CA;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		F58784C402DE375801EA4122 = {
 			isa = PBXFileReference;
 			name = KWQApplication.mm;
@@ -5375,6 +5388,9 @@
 			fileRef = F587854702DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785DA02DE375901EA4122 = {
@@ -5387,6 +5403,9 @@
 			fileRef = F587854902DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785DC02DE375901EA4122 = {
@@ -5399,24 +5418,36 @@
 			fileRef = F587854B02DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785DE02DE375901EA4122 = {
 			fileRef = F587854C02DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785DF02DE375901EA4122 = {
 			fileRef = F587854D02DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785E002DE375901EA4122 = {
 			fileRef = F587854E02DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785E102DE375901EA4122 = {
@@ -5429,18 +5460,27 @@
 			fileRef = F587855002DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785E302DE375901EA4122 = {
 			fileRef = F587855102DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785E402DE375901EA4122 = {
 			fileRef = F587855202DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785E502DE375901EA4122 = {
@@ -5453,6 +5493,9 @@
 			fileRef = F587855402DE375901EA4122;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F58785E702DE375901EA4122 = {
@@ -5484,6 +5527,7 @@
 				F587854902DE375901EA4122,
 				F587854A02DE375901EA4122,
 				F587854B02DE375901EA4122,
+				F52CA70F02DFACBD018635CA,
 				F587854C02DE375901EA4122,
 				F587854D02DE375901EA4122,
 				F587854E02DE375901EA4122,
@@ -5494,6 +5538,8 @@
 				F587855302DE375901EA4122,
 				F587855402DE375901EA4122,
 				F587855502DE375901EA4122,
+				F58EF58E02DFDFB7018635CA,
+				F58EF58D02DFDFB7018635CA,
 			);
 			isa = PBXGroup;
 			name = "WebCore SPI";
@@ -7596,6 +7642,16 @@
 			isa = PBXBuildStyle;
 			name = Mixed;
 		};
+		F58EF58D02DFDFB7018635CA = {
+			isa = PBXFileReference;
+			path = "WebCore-tests.exp";
+			refType = 4;
+		};
+		F58EF58E02DFDFB7018635CA = {
+			isa = PBXFileReference;
+			path = WebCore.exp;
+			refType = 4;
+		};
 		F5A1B04902DE8ABA018635CA = {
 			isa = PBXFileReference;
 			name = linkCursor.tiff;
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 7a55b1c..d42e918 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -336,24 +336,6 @@ void KHTMLView::drawContents( QPainter*)
 {
 }
 
-#ifdef APPLE_RENDER_TREE_DEBUG
-static void printLevel(int level){
-    while (level--)
-        printf ("    ");
-}
-
-static void printRenderTree(RenderObject *node, int level)
-{
-    printLevel (level);
-    printf ("node %s(%d) (%d,%d) w %d, h %d\n", node->renderName(), level, node->xPos(), node->yPos(), node->width(), node->height());
-    RenderObject *child = node->firstChild();
-    while(child != 0) {
-        printRenderTree(child, level+1);
-        child = child->nextSibling();
-    }
-}
-
-#endif /* APPLE_RENDER_TREE_DEBUG */
 void KHTMLView::drawContents( QPainter *p, int ex, int ey, int ew, int eh )
 {
     //kdDebug( 6000 ) << "drawContents x=" << ex << ",y=" << ey << ",w=" << ew << ",h=" << eh << endl;
@@ -361,22 +343,6 @@ void KHTMLView::drawContents( QPainter *p, int ex, int ey, int ew, int eh )
         p->fillRect(ex, ey, ew, eh, palette().normal().brush(QColorGroup::Base));
         return;
     }
-#ifdef APPLE_CHANGES
-    // FIXME!
-    RenderObject *ro;
-    DOM::DocumentImpl *doc;
-    
-    doc = m_part->xmlDocImpl();
-    if (doc){
-        ro = doc->renderer();
-        if (ro){
-#ifdef APPLE_RENDER_TREE_DEBUG
-                printRenderTree (ro, 0);
-#endif /* APPLE_RENDER_TREE_DEBUG */
-            ro->print(p, ex, ey, ew, eh, 0, 0);
-        }
-    }
-#else /* APPLE_CHANGES not defined */
     if ( d->paintBuffer->width() < visibleWidth() )
         d->paintBuffer->resize(visibleWidth(),PAINT_BUFFER_HEIGHT);
 
@@ -399,7 +365,6 @@ void KHTMLView::drawContents( QPainter *p, int ex, int ey, int ew, int eh )
         p->drawPixmap(ex, ey+py, *d->paintBuffer, 0, 0, ew, ph);
         py += PAINT_BUFFER_HEIGHT;
     }
-#endif /* APPLE_CHANGES not defined */
 
     khtml::DrawContentsEvent event( p, ex, ey, ew, eh );
     QApplication::sendEvent( m_part, &event );
diff --git a/WebCore/kwq/KWQDef.h b/WebCore/kwq/KWQDef.h
index 7a86b17..0ba48f1 100644
--- a/WebCore/kwq/KWQDef.h
+++ b/WebCore/kwq/KWQDef.h
@@ -26,11 +26,10 @@
 #ifndef KWQDEF_H_
 #define KWQDEF_H_
 
+#include <sys/types.h>
 #ifndef KWQ_UNSIGNED_TYPES_DEFINED
 #define KWQ_UNSIGNED_TYPES_DEFINED
 typedef unsigned char uchar;
-typedef unsigned short ushort;
-typedef unsigned uint;
 typedef unsigned long ulong;
 #endif
 
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index bcea51f..fe89157 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -40,6 +40,7 @@ public:
     void setBridge(WebCoreBridge *p) { bridge = p; }
     WebCoreBridge *getBridge() const { return bridge; }
     void setView(KHTMLView *view);
+    KHTMLView *getView() const;
 
     bool openURLInFrame(const KURL &, const KParts::URLArgs &);
     void openURL(const KURL &);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 3376bb6..1150271 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -67,7 +67,7 @@ KWQKHTMLPartImpl::~KWQKHTMLPartImpl()
 
 bool KWQKHTMLPartImpl::openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs )
 {
-    id <WebCoreFrame> frame;
+    WebCoreFrame *frame;
 
     if (!urlArgs.frameName.isEmpty()) {
         frame = [bridge frameNamed:urlArgs.frameName.getNSString()];
@@ -380,7 +380,7 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
 {
     KURL clickedURL(part->completeURL( url));
     KURL refLess(clickedURL);
-    id <WebCoreFrame> frame;
+    WebCoreFrame *frame;
 	
     if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
     {
@@ -427,12 +427,12 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     NSString *name = frameName.getNSString();
 
     KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "name %s\n", DEBUG_OBJECT(name));
-    id <WebCoreFrame> wcFrame = [bridge childFrameNamed:name];
+    WebCoreFrame *wcFrame = [bridge childFrameNamed:name];
     if (wcFrame) {
         KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "found %s\n", DEBUG_OBJECT(name));
         frame->setWidget([wcFrame widget]);
     }
-    else {        
+    else {
         KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "creating %s\n", DEBUG_OBJECT(name));
         
         NSURL *childURL = part->completeURL(url).getNSURL();
@@ -599,7 +599,7 @@ QPtrList<KParts::ReadOnlyPart> KWQKHTMLPartImpl::frames() const
 {
     QPtrList<KParts::ReadOnlyPart> parts;
     NSEnumerator *e = [[bridge childFrames] objectEnumerator];
-    id <WebCoreFrame> childFrame;
+    WebCoreFrame *childFrame;
     while ((childFrame = [e nextObject])) {
         KHTMLPart *childPart = [[childFrame bridge] part];
         if (childPart)
@@ -631,6 +631,11 @@ void KWQKHTMLPartImpl::setView(KHTMLView *view)
     part->setWidget(view);
 }
 
+KHTMLView *KWQKHTMLPartImpl::getView() const
+{
+    return d->m_view;
+}
+
 void KWQKHTMLPartImpl::setTitle(const DOMString &title)
 {
     [bridge setTitle:title.string().getNSString()];
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.h b/WebCore/kwq/KWQKHTMLPartImpl.h
index bcea51f..fe89157 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.h
+++ b/WebCore/kwq/KWQKHTMLPartImpl.h
@@ -40,6 +40,7 @@ public:
     void setBridge(WebCoreBridge *p) { bridge = p; }
     WebCoreBridge *getBridge() const { return bridge; }
     void setView(KHTMLView *view);
+    KHTMLView *getView() const;
 
     bool openURLInFrame(const KURL &, const KParts::URLArgs &);
     void openURL(const KURL &);
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 3376bb6..1150271 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -67,7 +67,7 @@ KWQKHTMLPartImpl::~KWQKHTMLPartImpl()
 
 bool KWQKHTMLPartImpl::openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs )
 {
-    id <WebCoreFrame> frame;
+    WebCoreFrame *frame;
 
     if (!urlArgs.frameName.isEmpty()) {
         frame = [bridge frameNamed:urlArgs.frameName.getNSString()];
@@ -380,7 +380,7 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
 {
     KURL clickedURL(part->completeURL( url));
     KURL refLess(clickedURL);
-    id <WebCoreFrame> frame;
+    WebCoreFrame *frame;
 	
     if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
     {
@@ -427,12 +427,12 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     NSString *name = frameName.getNSString();
 
     KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "name %s\n", DEBUG_OBJECT(name));
-    id <WebCoreFrame> wcFrame = [bridge childFrameNamed:name];
+    WebCoreFrame *wcFrame = [bridge childFrameNamed:name];
     if (wcFrame) {
         KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "found %s\n", DEBUG_OBJECT(name));
         frame->setWidget([wcFrame widget]);
     }
-    else {        
+    else {
         KWQDEBUGLEVEL(KWQ_LOG_FRAMES, "creating %s\n", DEBUG_OBJECT(name));
         
         NSURL *childURL = part->completeURL(url).getNSURL();
@@ -599,7 +599,7 @@ QPtrList<KParts::ReadOnlyPart> KWQKHTMLPartImpl::frames() const
 {
     QPtrList<KParts::ReadOnlyPart> parts;
     NSEnumerator *e = [[bridge childFrames] objectEnumerator];
-    id <WebCoreFrame> childFrame;
+    WebCoreFrame *childFrame;
     while ((childFrame = [e nextObject])) {
         KHTMLPart *childPart = [[childFrame bridge] part];
         if (childPart)
@@ -631,6 +631,11 @@ void KWQKHTMLPartImpl::setView(KHTMLView *view)
     part->setWidget(view);
 }
 
+KHTMLView *KWQKHTMLPartImpl::getView() const
+{
+    return d->m_view;
+}
+
 void KWQKHTMLPartImpl::setTitle(const DOMString &title)
 {
     [bridge setTitle:title.string().getNSString()];
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 76967b3..45e41a6 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -60,8 +60,7 @@ public:
     typedef enum { RTL, LTR } TextDirection;
 
     QPainter();
-    // We may be able to remove this constructor and remove QPaintDevice.
-    QPainter(const QPaintDevice *);
+    QPainter(QPixmap *);
     QPainter(QWidget *);
     ~QPainter();
     
@@ -98,7 +97,7 @@ public:
         QRect *br=0, char **internal=0);
     void drawText(int, int, const QString &, int, TextDirection);
     void drawText(int, int, const QString &, int, int, TextDirection);
-    void QPainter::drawText (int x, int y, const QString &qstring, int from, int to, QColor backgroundColor);
+    void drawText(int, int, const QString &, int, int, const QColor& backgroundColor);
 
     void fillRect(int, int, int, int, const QBrush &);
     void drawConvexPolygon(const QPointArray &);
@@ -115,10 +114,9 @@ public:
     void translate(double dx, double dy);
     void scale(double dx, double dy);
 
-    bool begin(const QPaintDevice *);
-    bool end();
-
-    QPaintDevice *device() const;
+    void begin(QPixmap *) { }
+    void end() { }
+    QPaintDevice *device() const { return 0; }
 
     void drawUnderlineForText(int x, int y, const QString &, int len=-1);
 
@@ -136,8 +134,7 @@ private:
     void _setColorFromBrush();
     void _setColorFromPen();
 
-    void _initialize(QWidget *widget);
-    void _drawPoints (const QPointArray &_points, bool winding, int index, int _npoints, bool fill);
+    void _drawPoints(const QPointArray &_points, bool winding, int index, int _npoints, bool fill);
 
     QPainterPrivate *data;
 };
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index e76f398..411b2a3 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -37,9 +37,10 @@
 #import <WebCoreImageRenderer.h>
 
 struct QPState {				// painter state
-    QFont	font;
-    QPen	pen;
-    QBrush	brush;
+    QPState() : compositingOperation(NSCompositeCopy) { }
+    QFont font;
+    QPen pen;
+    QBrush brush;
     NSCompositingOperation compositingOperation;
 };
 
@@ -47,42 +48,19 @@ typedef QPtrStack<QPState> QPStateStack;
 
 
 struct QPainterPrivate {
-friend class QPainter;
-public:
-    
-    QPainterPrivate(QWidget *widget) : 
-        widget(widget), 
-        qfont(), 
-        qbrush(),
-        qpen(), 
-        isFocusLocked(0), 
-        ps_stack(0),
-        compositingOperation(NSCompositeCopy), 
-        bufferDevice(0)
-    {
-    }
-    
-    ~QPainterPrivate() {}
-    
-private:
-    QWidget *widget;	// Has a reference to a KWQView.
-    QFont qfont;
-    QBrush qbrush;
-    QPen qpen;
-    uint isFocusLocked:1;
+    QPainterPrivate(QWidget *widget = 0) : ps_stack(0) { }
+    QPState state;
     QPStateStack *ps_stack;
-    NSCompositingOperation compositingOperation;
-    const QPaintDevice *bufferDevice;
 };
 
 
 QPainter::QPainter()
+    : data(new QPainterPrivate)
 {
-    _initialize(0);
 }
 
 
-QPainter::QPainter(const QPaintDevice *pdev)
+QPainter::QPainter(QPixmap *)
 {
     _logNeverImplemented();
 }
@@ -90,16 +68,10 @@ QPainter::QPainter(const QPaintDevice *pdev)
 
 //  How do we handle ownership of widget?
 QPainter::QPainter(QWidget *widget)
+    : data(new QPainterPrivate(widget))
 {
-    _initialize (widget);
 }
 
-void QPainter::_initialize(QWidget *widget)
-{
-    data = new QPainterPrivate(widget);
-}
-
-
 QPainter::~QPainter()
 {
     delete data;
@@ -107,55 +79,55 @@ QPainter::~QPainter()
     
 const QFont &QPainter::font() const
 {
-    return data->qfont;
+    return data->state.font;
 }
 
 
 void QPainter::setFont(const QFont &aFont)
 {
-    data->qfont = aFont;
+    data->state.font = aFont;
 }
 
 
 QFontMetrics QPainter::fontMetrics() const
 {
-    return QFontMetrics( data->qfont );
+    return QFontMetrics( data->state.font );
 }
 
 const QPen &QPainter::pen() const
 {
-    return data->qpen;
+    return data->state.pen;
 }
 
 
 void QPainter::setPen(const QPen &pen)
 {
-    data->qpen = pen;
+    data->state.pen = pen;
 }
 
 
 void QPainter::setPen(PenStyle style)
 {
-    data->qpen.setStyle(style);
-    data->qpen.setColor(Qt::black);
-    data->qpen.setWidth(0);
+    data->state.pen.setStyle(style);
+    data->state.pen.setColor(Qt::black);
+    data->state.pen.setWidth(0);
 }
 
 
 void QPainter::setBrush(const QBrush &brush)
 {
-    data->qbrush = brush;
+    data->state.brush = brush;
 }
 
 void QPainter::setBrush(BrushStyle style)
 {
-    data->qbrush.setStyle(style);
-    data->qbrush.setColor(Qt::black);
+    data->state.brush.setStyle(style);
+    data->state.brush.setColor(Qt::black);
 }
 
 const QBrush &QPainter::brush() const
 {
-    return data->qbrush;
+    return data->state.brush;
 }
 
 QRect QPainter::xForm(const QRect &) const
@@ -175,10 +147,7 @@ void QPainter::save()
     
     QPState *ps = new QPState;
 
-    ps->font  = data->qfont;
-    ps->pen   = data->qpen;
-    ps->brush = data->qbrush;
-    ps->compositingOperation = data->compositingOperation;
+    *ps = data->state;
     pss->push( ps );
 }
 
@@ -192,13 +161,13 @@ void QPainter::restore()
     }
     QPState *ps = pss->pop();
 
-    if ( ps->font != data->qfont )
+    if ( ps->font != data->state.font )
 	setFont( ps->font );
-    if ( ps->pen != data->qpen )
+    if ( ps->pen != data->state.pen )
 	setPen( ps->pen );
-    if ( ps->brush != data->qbrush )
+    if ( ps->brush != data->state.brush )
 	setBrush( ps->brush );
-    ps->compositingOperation = data->compositingOperation;
+    ps->compositingOperation = data->state.compositingOperation;
 
     delete ps;
 }
@@ -208,11 +177,11 @@ void QPainter::restore()
 void QPainter::drawRect(int x, int y, int w, int h)
 {
     _lockFocus();
-    if (data->qbrush.style() != NoBrush) {
+    if (data->state.brush.style() != NoBrush) {
         _setColorFromBrush();
         [NSBezierPath fillRect:NSMakeRect(x, y, w, h)];
     }
-    if (data->qpen.style() != NoPen) {
+    if (data->state.pen.style() != NoPen) {
         _setColorFromPen();
         [NSBezierPath strokeRect:NSMakeRect(x, y, w, h)];
     }
@@ -222,23 +191,23 @@ void QPainter::drawRect(int x, int y, int w, int h)
 
 void QPainter::_setColorFromBrush()
 {
-    [data->qbrush.color().getNSColor() set];
+    [data->state.brush.color().getNSColor() set];
 }
 
 
 void QPainter::_setColorFromPen()
 {
-    [data->qpen.color().getNSColor() set];
+    [data->state.pen.color().getNSColor() set];
 }
 
 
 // This is only used to draw borders around text, and lines over text.
 void QPainter::drawLine(int x1, int y1, int x2, int y2)
 {
-    PenStyle penStyle = data->qpen.style();
+    PenStyle penStyle = data->state.pen.style();
     if (penStyle == NoPen)
         return;
-    float width = data->qpen.width();
+    float width = data->state.pen.width();
     if (width < 1)
         width = 1;
     
@@ -292,11 +261,11 @@ void QPainter::drawEllipse(int x, int y, int w, int h)
     path = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect (x, y, w, h)];
     
     _lockFocus();
-    if (data->qbrush.style() != NoBrush) {
+    if (data->state.brush.style() != NoBrush) {
         _setColorFromBrush();
         [path fill];
     }
-    if (data->qpen.style() != NoPen) {
+    if (data->state.pen.style() != NoPen) {
         _setColorFromPen();
         [path stroke];
     }
@@ -307,7 +276,7 @@ void QPainter::drawEllipse(int x, int y, int w, int h)
 // Only supports arc on circles.  That's all khtml needs.
 void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)
 {
-    if (data->qpen.style() != NoPen){
+    if (data->state.pen.style() != NoPen){
 
         NSBezierPath *path;
         float fa, falen;
@@ -376,7 +345,7 @@ void QPainter::_drawPoints (const QPointArray &_points, bool winding, int index,
     
     _lockFocus();
 
-    if (fill == TRUE && data->qbrush.style() != NoBrush){
+    if (fill == TRUE && data->state.brush.style() != NoBrush){
         if (winding == TRUE)
             [path setWindingRule: NSNonZeroWindingRule];
         else
@@ -385,7 +354,7 @@ void QPainter::_drawPoints (const QPointArray &_points, bool winding, int index,
         [path fill];
     }
 
-    if (data->qpen.style() != NoPen){
+    if (data->state.pen.style() != NoPen){
         _setColorFromPen();
         [path stroke];
     }
@@ -441,25 +410,26 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
 }
 
 
-void QPainter::drawText (int x, int y, const QString &qstring, int len, TextDirection dir)
+void QPainter::drawText(int x, int y, const QString &qstring, int len, TextDirection dir)
 {
     drawText(x, y, qstring, 0, len, dir);
 }
 
-void QPainter::drawText (int x, int y, const QString &qstring, int from, int to, QColor backgroundColor)
+void QPainter::drawText(int x, int y, const QString &qstring, int from, int to, const QColor &backgroundColor)
 {
     _lockFocus();
 
-    id <WebCoreTextRenderer>renderer = [[WebCoreTextRendererFactory sharedFactory]
-        rendererWithFamily:data->qfont.getNSFamily() traits:data->qfont.getNSTraits() size:data->qfont.getNSSize()];
-        
-    [renderer drawCharacters:(const UniChar *)qstring.unicode() stringLength: qstring.length() fromCharacterPosition: from toCharacterPosition: to atPoint:NSMakePoint(x,y) withTextColor:data->qpen.color().getNSColor() backgroundColor: backgroundColor.isValid() ? backgroundColor.getNSColor() : nil];
+    [[[WebCoreTextRendererFactory sharedFactory]
+        rendererWithFamily:data->state.font.getNSFamily() traits:data->state.font.getNSTraits() size:data->state.font.getNSSize()]
+    	drawCharacters:(const UniChar *)qstring.unicode() stringLength:qstring.length()
+        fromCharacterPosition:from toCharacterPosition:to atPoint:NSMakePoint(x, y)
+        withTextColor:data->state.pen.color().getNSColor() backgroundColor:backgroundColor.isValid() ? backgroundColor.getNSColor() : nil];
 
     _unlockFocus();
 }
 
 
-void QPainter::drawText (int x, int y, const QString &qstring, int pos, int len, TextDirection dir)
+void QPainter::drawText(int x, int y, const QString &qstring, int pos, int len, TextDirection dir)
 {
     if (dir == RTL) {
         _logPartiallyImplemented();
@@ -484,8 +454,8 @@ void QPainter::drawUnderlineForText(int x, int y, const QString &qstring, int le
         string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
 
     [[[WebCoreTextRendererFactory sharedFactory]
-        rendererWithFamily:data->qfont.getNSFamily() traits:data->qfont.getNSTraits() size:data->qfont.getNSSize()]
-        drawUnderlineForString:string atPoint:NSMakePoint(x,y) withColor:data->qpen.color().getNSColor()];
+        rendererWithFamily:data->state.font.getNSFamily() traits:data->state.font.getNSTraits() size:data->state.font.getNSSize()]
+        drawUnderlineForString:string atPoint:NSMakePoint(x,y) withColor:data->state.pen.color().getNSColor()];
 
     _unlockFocus();
 }
@@ -520,8 +490,8 @@ void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &qs
     }
     
     [[[WebCoreTextRendererFactory sharedFactory]
-        rendererWithFamily:data->qfont.getNSFamily() traits:data->qfont.getNSTraits() size:data->qfont.getNSSize()]
-        drawString:string inRect:NSMakeRect(x, y, w, h) withColor:data->qpen.color().getNSColor() paragraphStyle:style];
+        rendererWithFamily:data->state.font.getNSFamily() traits:data->state.font.getNSTraits() size:data->state.font.getNSSize()]
+        drawString:string inRect:NSMakeRect(x, y, w, h) withColor:data->state.pen.color().getNSColor() paragraphStyle:style];
 
     _unlockFocus();
 }
@@ -585,9 +555,9 @@ void QPainter::setClipRect(int,int,int,int)
 Qt::RasterOp QPainter::rasterOp() const
 {
 #ifdef _SUPPORT_RASTER_OP
-    if (data->compositingOperation == NSCompositeSourceOver)
+    if (data->state.compositingOperation == NSCompositeSourceOver)
         rerturn OrROP;
-    else if (data->compositingOperation == NSCompositeXOR)
+    else if (data->state.compositingOperation == NSCompositeXOR)
         return XorROP;
     return CopyROP;
 #else
@@ -601,11 +571,11 @@ void QPainter::setRasterOp(RasterOp op)
 {
 #ifdef _SUPPORT_RASTER_OP
     if (op == OrROP)
-        data->compositingOperation = NSCompositeSourceOver;
+        data->state.compositingOperation = NSCompositeSourceOver;
     else if (op == XorROP)
-        data->compositingOperation = NSCompositeXOR;
+        data->state.compositingOperation = NSCompositeXOR;
     else
-        data->compositingOperation = NSCompositeCopy;
+        data->state.compositingOperation = NSCompositeCopy;
 #else
      _logNotYetImplemented();
 #endif
@@ -623,28 +593,6 @@ void QPainter::scale(double dx, double dy)
 }
 
 
-bool QPainter::begin(const QPaintDevice *bd)
-{
-    _logNeverImplemented();
-    data->bufferDevice = bd;
-    return true;
-}
-
-
-bool QPainter::end()
-{
-    _logNeverImplemented();
-    data->bufferDevice = 0L;
-    return true;
-}
-
-
-QPaintDevice *QPainter::device() const
-{
-    _logPartiallyImplemented();
-    return (QPaintDevice *)data->bufferDevice;
-}
-
 void QPainter::_lockFocus()
 {
 #if 0
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 5de9bc4..f0dbd39 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -47,9 +47,8 @@ typedef khtml::RenderPart KHTMLRenderPart;
 @class IFError;
 @class IFURLHandle;
 
- at class WebCoreBridge;
+ at class WebCoreFrame;
 
- at protocol WebCoreFrame;
 @protocol WebCoreResourceLoader;
 
 // WebCoreBridge objects are used by WebCore to abstract away operations that need
@@ -86,6 +85,10 @@ typedef khtml::RenderPart KHTMLRenderPart;
 - (NSString *)selectedText;
 - (void)selectAll;
 
+- (void)reapplyStyles;
+- (void)forceLayout;
+- (void)drawRect:(NSRect)rect;
+
 @end
 
 // The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
@@ -94,13 +97,13 @@ typedef khtml::RenderPart KHTMLRenderPart;
 
 - (WebCoreBridge *)parent;
 
-- (id <WebCoreFrame>)frame;
+- (WebCoreFrame *)frame;
 - (NSArray *)childFrames; // WebCoreFrame objects
-- (id <WebCoreFrame>)childFrameNamed:(NSString *)name;
-- (id <WebCoreFrame>)descendantFrameNamed:(NSString *)name;
+- (WebCoreFrame *)childFrameNamed:(NSString *)name;
+- (WebCoreFrame *)descendantFrameNamed:(NSString *)name;
 
-- (id <WebCoreFrame>)mainFrame;
-- (id <WebCoreFrame>)frameNamed:(NSString *)name; // searches entire hierarchy starting with mainFrame
+- (WebCoreFrame *)mainFrame;
+- (WebCoreFrame *)frameNamed:(NSString *)name; // searches entire hierarchy starting with mainFrame
 
 - (void)setTitle:(NSString *)title;
 - (void)setStatusText:(NSString *)status;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 03e1039..3fdf941 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -28,6 +28,7 @@
 #import <KWQKHTMLPartImpl.h>
 #import <khtmlview.h>
 #import <xml/dom_docimpl.h>
+#import <render_object.h>
 
 @implementation WebCoreBridge
 
@@ -99,11 +100,9 @@
 - (NSString *)documentTextFromDOM
 {
     NSString *string = nil;
-    if (part) {
-        DOM::DocumentImpl *doc = part->xmlDocImpl();
-        if (doc) {
-            string = [[doc->recursive_toHTML(1).getNSString() copy] autorelease];
-        }
+    DOM::DocumentImpl *doc = part->xmlDocImpl();
+    if (doc) {
+        string = [[doc->recursive_toHTML(1).getNSString() copy] autorelease];
     }
     if (string == nil) {
         string = @"";
@@ -127,4 +126,40 @@
     part->selectAll();
 }
 
+- (void)reapplyStyles
+{
+    DOM::DocumentImpl *doc = part->xmlDocImpl();
+    if (doc && doc->renderer()) {
+        return;
+    }
+    doc->updateStyleSelector();
+}
+
+- (void)forceLayout
+{
+    DOM::DocumentImpl *doc = part->xmlDocImpl();
+    if (doc) {
+        khtml::RenderObject *renderer = doc->renderer();
+        if (renderer) {
+            renderer->setLayouted(false);
+        }
+    }
+    KHTMLView *view = part->impl->getView();
+    if (view) {
+        view->layout();
+    }
+}
+
+- (void)drawRect:(NSRect)rect
+{
+    DOM::DocumentImpl *doc = part->xmlDocImpl();
+    if (doc) {
+        khtml::RenderObject *renderer = doc->renderer();
+        if (renderer) {
+            QPainter p;
+            renderer->print(&p, (int)rect.origin.x, (int)rect.origin.y, (int)rect.size.width, (int)rect.size.height, 0, 0);
+        }
+    }
+}
+
 @end
diff --git a/WebCore/kwq/WebCoreFrame.h b/WebCore/kwq/WebCoreFrame.h
index a66f5a6..3a2be44 100644
--- a/WebCore/kwq/WebCoreFrame.h
+++ b/WebCore/kwq/WebCoreFrame.h
@@ -23,21 +23,27 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import <Foundation/Foundation.h>
-
- at class WebCoreBridge;
-
-#ifdef __cplusplus
-class KHTMLView;
-#else
- at class KHTMLView;
-#endif
+#import <WebCore/WebCoreBridge.h>
 
 // The main difference between a WebCoreFrame and a WebCoreBridge
 // is that there's no guarantee a WebCoreFrame will have any HTML in
 // it, thus no guarantee that it will have a KHTMLPart.
 
- at protocol WebCoreFrame <NSObject>
+// The WebCoreFrame interface contains methods for use by the non-WebCore side of the bridge.
+
+ at interface WebCoreFrame : NSObject
+{
+    KHTMLRenderPart *renderPart;
+}
+
+- (void)setRenderPart:(KHTMLRenderPart *)renderPart;
+- (KHTMLRenderPart *)renderPart;
+
+ at end
+
+// The WebCoreFrame protocol contains methods for use by the WebCore side of the bridge.
+
+ at protocol WebCoreFrame
 
 - (void)loadURL:(NSURL *)URL;
 - (void)postWithURL:(NSURL *)URL data:(NSData *)data;
@@ -47,3 +53,10 @@ class KHTMLView;
 - (WebCoreBridge *)bridge; // always returns committed bridge, not provisional (avoid calling this for that reason)
 
 @end
+
+// This interface definition allows those who hold a WebCoreFrame * to call all the methods
+// in the WebCoreBridge protocol without requiring the base implementation to supply the methods.
+// This idiom is appropriate because WebCoreFrame is an abstract class.
+
+ at interface WebCoreFrame (SubclassResponsibility) <WebCoreFrame>
+ at end
diff --git a/WebCore/kwq/WebCoreFrame.mm b/WebCore/kwq/WebCoreFrame.mm
new file mode 100644
index 0000000..04fdf45
--- /dev/null
+++ b/WebCore/kwq/WebCoreFrame.mm
@@ -0,0 +1,35 @@
+//
+//  WebCoreFrame.m
+//  WebCore
+//
+//  Created by Darin Adler on Fri Jul 12 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "WebCoreFrame.h"
+
+#import <render_frames.h>
+
+ at implementation WebCoreFrame
+
+- (void)dealloc
+{
+    renderPart->deref();
+    [super dealloc];
+}
+
+- (void)setRenderPart:(KHTMLRenderPart *)newPart;
+{
+    newPart->ref();
+    if (renderPart) {
+        renderPart->deref();
+    }
+    renderPart = newPart;
+}
+
+- (KHTMLRenderPart *)renderPart
+{
+    return renderPart;
+}
+
+ at end
diff --git a/WebCore/kwq/WebCoreFrameBridge.h b/WebCore/kwq/WebCoreFrameBridge.h
index a66f5a6..3a2be44 100644
--- a/WebCore/kwq/WebCoreFrameBridge.h
+++ b/WebCore/kwq/WebCoreFrameBridge.h
@@ -23,21 +23,27 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import <Foundation/Foundation.h>
-
- at class WebCoreBridge;
-
-#ifdef __cplusplus
-class KHTMLView;
-#else
- at class KHTMLView;
-#endif
+#import <WebCore/WebCoreBridge.h>
 
 // The main difference between a WebCoreFrame and a WebCoreBridge
 // is that there's no guarantee a WebCoreFrame will have any HTML in
 // it, thus no guarantee that it will have a KHTMLPart.
 
- at protocol WebCoreFrame <NSObject>
+// The WebCoreFrame interface contains methods for use by the non-WebCore side of the bridge.
+
+ at interface WebCoreFrame : NSObject
+{
+    KHTMLRenderPart *renderPart;
+}
+
+- (void)setRenderPart:(KHTMLRenderPart *)renderPart;
+- (KHTMLRenderPart *)renderPart;
+
+ at end
+
+// The WebCoreFrame protocol contains methods for use by the WebCore side of the bridge.
+
+ at protocol WebCoreFrame
 
 - (void)loadURL:(NSURL *)URL;
 - (void)postWithURL:(NSURL *)URL data:(NSData *)data;
@@ -47,3 +53,10 @@ class KHTMLView;
 - (WebCoreBridge *)bridge; // always returns committed bridge, not provisional (avoid calling this for that reason)
 
 @end
+
+// This interface definition allows those who hold a WebCoreFrame * to call all the methods
+// in the WebCoreBridge protocol without requiring the base implementation to supply the methods.
+// This idiom is appropriate because WebCoreFrame is an abstract class.
+
+ at interface WebCoreFrame (SubclassResponsibility) <WebCoreFrame>
+ at end
diff --git a/WebCore/kwq/WebCoreFrameBridge.mm b/WebCore/kwq/WebCoreFrameBridge.mm
new file mode 100644
index 0000000..04fdf45
--- /dev/null
+++ b/WebCore/kwq/WebCoreFrameBridge.mm
@@ -0,0 +1,35 @@
+//
+//  WebCoreFrame.m
+//  WebCore
+//
+//  Created by Darin Adler on Fri Jul 12 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "WebCoreFrame.h"
+
+#import <render_frames.h>
+
+ at implementation WebCoreFrame
+
+- (void)dealloc
+{
+    renderPart->deref();
+    [super dealloc];
+}
+
+- (void)setRenderPart:(KHTMLRenderPart *)newPart;
+{
+    newPart->ref();
+    if (renderPart) {
+        renderPart->deref();
+    }
+    renderPart = newPart;
+}
+
+- (KHTMLRenderPart *)renderPart
+{
+    return renderPart;
+}
+
+ at end
diff --git a/WebCore/kwq/qt/qpainter.h b/WebCore/kwq/qt/qpainter.h
index 76967b3..45e41a6 100644
--- a/WebCore/kwq/qt/qpainter.h
+++ b/WebCore/kwq/qt/qpainter.h
@@ -60,8 +60,7 @@ public:
     typedef enum { RTL, LTR } TextDirection;
 
     QPainter();
-    // We may be able to remove this constructor and remove QPaintDevice.
-    QPainter(const QPaintDevice *);
+    QPainter(QPixmap *);
     QPainter(QWidget *);
     ~QPainter();
     
@@ -98,7 +97,7 @@ public:
         QRect *br=0, char **internal=0);
     void drawText(int, int, const QString &, int, TextDirection);
     void drawText(int, int, const QString &, int, int, TextDirection);
-    void QPainter::drawText (int x, int y, const QString &qstring, int from, int to, QColor backgroundColor);
+    void drawText(int, int, const QString &, int, int, const QColor& backgroundColor);
 
     void fillRect(int, int, int, int, const QBrush &);
     void drawConvexPolygon(const QPointArray &);
@@ -115,10 +114,9 @@ public:
     void translate(double dx, double dy);
     void scale(double dx, double dy);
 
-    bool begin(const QPaintDevice *);
-    bool end();
-
-    QPaintDevice *device() const;
+    void begin(QPixmap *) { }
+    void end() { }
+    QPaintDevice *device() const { return 0; }
 
     void drawUnderlineForText(int x, int y, const QString &, int len=-1);
 
@@ -136,8 +134,7 @@ private:
     void _setColorFromBrush();
     void _setColorFromPen();
 
-    void _initialize(QWidget *widget);
-    void _drawPoints (const QPointArray &_points, bool winding, int index, int _npoints, bool fill);
+    void _drawPoints(const QPointArray &_points, bool winding, int index, int _npoints, bool fill);
 
     QPainterPrivate *data;
 };
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 459bff1..00cbda3 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,69 @@
+2002-07-12  Darin Adler  <darin at apple.com>
+
+	About 1/3 of the remaining work to wean WebKit from its special relationship with WebCore
+	onto explicit interfaces.
+
+        * Misc.subproj/IFCache.mm:
+        * WebView.subproj/IFDOMNode.mm:
+        * WebView.subproj/IFRenderNode.mm:
+	Mark imports from inside WebCore with #ifndef WEBKIT_INDEPENDENT_OF_WEBCORE.
+	Once these are all gone, the task is done.
+
+        * Plugins.subproj/IFPlugin.h:
+        * WebCoreSupport.subproj/IFCookieAdapter.h:
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRendererFactory.h:
+        * WebCoreSupport.subproj/IFResourceURLHandleClient.m:
+        * WebCoreSupport.subproj/IFTextRenderer.h:
+        * WebCoreSupport.subproj/IFTextRendererFactory.h:
+        * WebCoreSupport.subproj/IFWebCoreBridge.h:
+        * WebCoreSupport.subproj/IFWebCoreViewFactory.h:
+	Use #import <WebCore/> for getting at WebCore headers so we don't need to use -I.
+
+        * WebCoreSupport.subproj/IFWebCoreBridge.mm:
+        (-[IFWebCoreBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+	Call setRenderPart on the WebCoreFrame rather than on the IFWebFrame.
+
+        * WebCoreSupport.subproj/IFWebCoreFrame.h: Subclass from the WebCoreFrame class.
+        * WebCoreSupport.subproj/IFWebCoreFrame.m:
+        (-[IFWebCoreFrame HTMLView]): Add a cast.
+        (-[IFWebCoreFrame widget]): Remove overzealous assert.
+
+        * WebKit.pbproj/project.pbxproj: Rearranged things a bit. Removed unneeded build phase.
+
+        * WebView.subproj/IFDocument.h:
+        * WebView.subproj/IFDynamicScrollBarsView.h:
+        * WebView.subproj/IFWebController.h:
+        * WebView.subproj/IFWebControllerPolicyHandler.h:
+	Changed a few stray #include statements to #import statements.
+
+        * WebView.subproj/IFHTMLView.mm:
+        (-[IFHTMLView provisionalDataSourceCommitted:]): Move the logic for setting up the
+	renderPart in here from IFWebView.
+        (-[IFHTMLView reapplyStyles]): Use the bridge.
+        (-[IFHTMLView layout]): Use the bridge.
+        (-[IFHTMLView drawRect:]): Use the bridge.
+
+        * WebView.subproj/IFHTMLViewPrivate.h: Remove _takeOwnershipOfWidget which is no longer needed.
+        * WebView.subproj/IFHTMLViewPrivate.mm:
+        (-[NSView _IF_stopIfPluginView]): Added. Use to clean up _reset a bit.
+        (-[IFHTMLView _reset]): Use makeObjectsPerformSelector: for simplicity.
+
+        * WebView.subproj/IFImageView.h: Remove unneeded IFWebDataSource declaration.
+        * WebView.subproj/IFImageView.m: Just formatting tweaks.
+
+        * WebView.subproj/IFWebControllerPrivate.mm: Removed unneeded import.
+        * WebView.subproj/IFWebDataSource.mm: Removed unneeded import.
+        * WebView.subproj/IFWebDataSourcePrivate.mm: Removed unneeded import.
+        * WebView.subproj/IFWebFrame.mm: Removed unneeded import.
+
+        * WebView.subproj/IFWebFramePrivate.h: Remove renderPart field and related declarations.
+        * WebView.subproj/IFWebFramePrivate.mm:
+        (-[IFWebFramePrivate dealloc]): No need to let go of renderPart any more.
+        (-[IFWebFrame _transitionProvisionalToCommitted]): Move logic into IFHTMLView.
+
+        * WebView.subproj/IFWebView.h: Be a bit more specific about the type of documentView.
+
 2002-07-12  Chris Blumenberg  <cblu at apple.com>
 
 	Only accept drags of 1 file.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 459bff1..00cbda3 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,69 @@
+2002-07-12  Darin Adler  <darin at apple.com>
+
+	About 1/3 of the remaining work to wean WebKit from its special relationship with WebCore
+	onto explicit interfaces.
+
+        * Misc.subproj/IFCache.mm:
+        * WebView.subproj/IFDOMNode.mm:
+        * WebView.subproj/IFRenderNode.mm:
+	Mark imports from inside WebCore with #ifndef WEBKIT_INDEPENDENT_OF_WEBCORE.
+	Once these are all gone, the task is done.
+
+        * Plugins.subproj/IFPlugin.h:
+        * WebCoreSupport.subproj/IFCookieAdapter.h:
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRendererFactory.h:
+        * WebCoreSupport.subproj/IFResourceURLHandleClient.m:
+        * WebCoreSupport.subproj/IFTextRenderer.h:
+        * WebCoreSupport.subproj/IFTextRendererFactory.h:
+        * WebCoreSupport.subproj/IFWebCoreBridge.h:
+        * WebCoreSupport.subproj/IFWebCoreViewFactory.h:
+	Use #import <WebCore/> for getting at WebCore headers so we don't need to use -I.
+
+        * WebCoreSupport.subproj/IFWebCoreBridge.mm:
+        (-[IFWebCoreBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+	Call setRenderPart on the WebCoreFrame rather than on the IFWebFrame.
+
+        * WebCoreSupport.subproj/IFWebCoreFrame.h: Subclass from the WebCoreFrame class.
+        * WebCoreSupport.subproj/IFWebCoreFrame.m:
+        (-[IFWebCoreFrame HTMLView]): Add a cast.
+        (-[IFWebCoreFrame widget]): Remove overzealous assert.
+
+        * WebKit.pbproj/project.pbxproj: Rearranged things a bit. Removed unneeded build phase.
+
+        * WebView.subproj/IFDocument.h:
+        * WebView.subproj/IFDynamicScrollBarsView.h:
+        * WebView.subproj/IFWebController.h:
+        * WebView.subproj/IFWebControllerPolicyHandler.h:
+	Changed a few stray #include statements to #import statements.
+
+        * WebView.subproj/IFHTMLView.mm:
+        (-[IFHTMLView provisionalDataSourceCommitted:]): Move the logic for setting up the
+	renderPart in here from IFWebView.
+        (-[IFHTMLView reapplyStyles]): Use the bridge.
+        (-[IFHTMLView layout]): Use the bridge.
+        (-[IFHTMLView drawRect:]): Use the bridge.
+
+        * WebView.subproj/IFHTMLViewPrivate.h: Remove _takeOwnershipOfWidget which is no longer needed.
+        * WebView.subproj/IFHTMLViewPrivate.mm:
+        (-[NSView _IF_stopIfPluginView]): Added. Use to clean up _reset a bit.
+        (-[IFHTMLView _reset]): Use makeObjectsPerformSelector: for simplicity.
+
+        * WebView.subproj/IFImageView.h: Remove unneeded IFWebDataSource declaration.
+        * WebView.subproj/IFImageView.m: Just formatting tweaks.
+
+        * WebView.subproj/IFWebControllerPrivate.mm: Removed unneeded import.
+        * WebView.subproj/IFWebDataSource.mm: Removed unneeded import.
+        * WebView.subproj/IFWebDataSourcePrivate.mm: Removed unneeded import.
+        * WebView.subproj/IFWebFrame.mm: Removed unneeded import.
+
+        * WebView.subproj/IFWebFramePrivate.h: Remove renderPart field and related declarations.
+        * WebView.subproj/IFWebFramePrivate.mm:
+        (-[IFWebFramePrivate dealloc]): No need to let go of renderPart any more.
+        (-[IFWebFrame _transitionProvisionalToCommitted]): Move logic into IFHTMLView.
+
+        * WebView.subproj/IFWebView.h: Be a bit more specific about the type of documentView.
+
 2002-07-12  Chris Blumenberg  <cblu at apple.com>
 
 	Only accept drags of 1 file.
diff --git a/WebKit/Misc.subproj/IFCache.mm b/WebKit/Misc.subproj/IFCache.mm
index 5a10067..432e1cb 100644
--- a/WebKit/Misc.subproj/IFCache.mm
+++ b/WebKit/Misc.subproj/IFCache.mm
@@ -8,8 +8,10 @@
 
 #import "IFCache.h"
 
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import "misc/loader.h"
 #import "kjs/collector.h"
+#endif
 
 @implementation IFCache
 
diff --git a/WebKit/Misc.subproj/WebCoreStatistics.m b/WebKit/Misc.subproj/WebCoreStatistics.m
index 5a10067..432e1cb 100644
--- a/WebKit/Misc.subproj/WebCoreStatistics.m
+++ b/WebKit/Misc.subproj/WebCoreStatistics.m
@@ -8,8 +8,10 @@
 
 #import "IFCache.h"
 
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import "misc/loader.h"
 #import "kjs/collector.h"
+#endif
 
 @implementation IFCache
 
diff --git a/WebKit/Plugins.subproj/IFPlugin.h b/WebKit/Plugins.subproj/IFPlugin.h
index 15d2ed0..db7d004 100644
--- a/WebKit/Plugins.subproj/IFPlugin.h
+++ b/WebKit/Plugins.subproj/IFPlugin.h
@@ -25,7 +25,7 @@
 
 #import <Foundation/Foundation.h>
 #import "npapi.h"
-#import <WebCoreViewFactory.h>
+#import <WebCore/WebCoreViewFactory.h>
 
 @interface IFPlugin : NSObject <WebCorePluginInfo>
 {
diff --git a/WebKit/Plugins.subproj/WebPlugin.h b/WebKit/Plugins.subproj/WebPlugin.h
index 15d2ed0..db7d004 100644
--- a/WebKit/Plugins.subproj/WebPlugin.h
+++ b/WebKit/Plugins.subproj/WebPlugin.h
@@ -25,7 +25,7 @@
 
 #import <Foundation/Foundation.h>
 #import "npapi.h"
-#import <WebCoreViewFactory.h>
+#import <WebCore/WebCoreViewFactory.h>
 
 @interface IFPlugin : NSObject <WebCorePluginInfo>
 {
diff --git a/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h b/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h
index fc3f050..ef4d8c3 100644
--- a/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h
+++ b/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h
@@ -7,7 +7,7 @@
 //
 
 #import <Foundation/Foundation.h>
-#import <WebCoreCookieAdapter.h>
+#import <WebCore/WebCoreCookieAdapter.h>
 
 @interface IFCookieAdapter : WebCoreCookieAdapter
 {
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
index 7779d23..4559b9d 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
@@ -3,7 +3,7 @@
 */
 
 #import <Cocoa/Cocoa.h>
-#import <WebCoreImageRenderer.h>
+#import <WebCore/WebCoreImageRenderer.h>
 
 @interface IFImageRenderer : NSImage <WebCoreImageRenderer>
 {
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.h b/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.h
index 8ff7e33..7a17213 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.h
+++ b/WebKit/WebCoreSupport.subproj/IFImageRendererFactory.h
@@ -5,7 +5,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreImageRendererFactory.h>
+#import <WebCore/WebCoreImageRendererFactory.h>
 
 @class IFImageRenderer;
 
diff --git a/WebKit/WebCoreSupport.subproj/IFResourceURLHandleClient.m b/WebKit/WebCoreSupport.subproj/IFResourceURLHandleClient.m
index 4202815..9645dcc 100644
--- a/WebKit/WebCoreSupport.subproj/IFResourceURLHandleClient.m
+++ b/WebKit/WebCoreSupport.subproj/IFResourceURLHandleClient.m
@@ -11,7 +11,7 @@
 #import <WebFoundation/IFError.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <WebCoreResourceLoader.h>
+#import <WebCore/WebCoreResourceLoader.h>
 
 #import <WebKit/IFLoadProgress.h>
 #import <WebKit/IFWebControllerPrivate.h>
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.h b/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
index e4409c6..72cfa40 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreTextRenderer.h>
+#import <WebCore/WebCoreTextRenderer.h>
 
 typedef struct WidthMap WidthMap;
 typedef struct GlyphMap GlyphMap;
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRendererFactory.h b/WebKit/WebCoreSupport.subproj/IFTextRendererFactory.h
index 5301976..ae5593b 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRendererFactory.h
+++ b/WebKit/WebCoreSupport.subproj/IFTextRendererFactory.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreTextRendererFactory.h>
+#import <WebCore/WebCoreTextRendererFactory.h>
 
 @class IFTextRenderer;
 
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h
index 09bbeb1..6b2935b 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreBridge.h>
+#import <WebCore/WebCoreBridge.h>
 
 #import <WebKit/IFWebDataSource.h>
 
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm
index 797f55e..1acc192 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreBridge.mm
@@ -34,7 +34,7 @@
 
 @implementation IFWebCoreBridge
 
-- (id <WebCoreFrame>)frame
+- (WebCoreFrame *)frame
 {
     return [[dataSource webFrame] _bridgeFrame];
 }
@@ -60,18 +60,18 @@
     return bridgeFrames;
 }
 
-- (id <WebCoreFrame>)childFrameNamed:(NSString *)name
+- (WebCoreFrame *)childFrameNamed:(NSString *)name
 {
     return [[dataSource frameNamed:name] _bridgeFrame];
 }
 
-- (id <WebCoreFrame>)descendantFrameNamed:(NSString *)name
+- (WebCoreFrame *)descendantFrameNamed:(NSString *)name
 {
     return [[[dataSource webFrame] frameNamed:name] _bridgeFrame];
 }
 
 - (BOOL)createChildFrameNamed:(NSString *)frameName
-    withURL:(NSURL *)URL renderPart:(khtml::RenderPart *)renderPart
+    withURL:(NSURL *)URL renderPart:(KHTMLRenderPart *)renderPart
     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height
 {
     WEBKIT_ASSERT(dataSource);
@@ -81,7 +81,7 @@
         return NO;
     }
     
-    [frame _setRenderFramePart:renderPart];
+    [[frame _bridgeFrame] setRenderPart:renderPart];
     
     [[frame webView] _setMarginWidth:width];
     [[frame webView] _setMarginHeight:height];
@@ -156,12 +156,12 @@
     [[[dataSource controller] windowContext] setStatusText:status];
 }
 
-- (id <WebCoreFrame>)mainFrame
+- (WebCoreFrame *)mainFrame
 {
     return [[[dataSource controller] mainFrame] _bridgeFrame];
 }
 
-- (id <WebCoreFrame>)frameNamed:(NSString *)name
+- (WebCoreFrame *)frameNamed:(NSString *)name
 {
     return [[[dataSource controller] frameNamed:name] _bridgeFrame];
 }
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.h b/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.h
index 0aef6e4..34ea61b 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.h
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.h
@@ -6,12 +6,12 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreFrame.h>
+#import <WebCore/WebCoreFrame.h>
 
 @class IFWebDataSource;
 @class IFWebFrame;
 
- at interface IFWebCoreFrame : NSObject <WebCoreFrame>
+ at interface IFWebCoreFrame : WebCoreFrame <WebCoreFrame>
 {
     IFWebFrame *frame;
 }
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.m b/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.m
index e786f9d..878b192 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.m
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreFrame.m
@@ -37,7 +37,7 @@
 
 - (IFHTMLView *)HTMLView
 {
-    return [[self view] documentView];
+    return (IFHTMLView *)[[self view] documentView];
 }
 
 - (WebCoreBridge *)bridge
@@ -47,7 +47,6 @@
 
 - (KHTMLView *)widget
 {
-    WEBKIT_ASSERT([self HTMLView]);
     KHTMLView *widget = [[self HTMLView] _provisionalWidget];
     if (widget) {
         return widget;
@@ -59,8 +58,9 @@
 {
     IFWebDataSource *newDataSource = [[IFWebDataSource alloc] initWithURL:URL attributes:attributes flags:flags];
     [newDataSource _setParent:parent];
-    if([frame setProvisionalDataSource:newDataSource])
+    if ([frame setProvisionalDataSource:newDataSource]) {
         [frame startLoading];
+    }
     [newDataSource release];
 }
 
diff --git a/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.h b/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.h
index 84f6a51..3d0f567 100644
--- a/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.h
+++ b/WebKit/WebCoreSupport.subproj/IFWebCoreViewFactory.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreViewFactory.h>
+#import <WebCore/WebCoreViewFactory.h>
 
 @interface IFWebCoreViewFactory : WebCoreViewFactory
 {
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.h b/WebKit/WebCoreSupport.subproj/WebBridge.h
index 09bbeb1..6b2935b 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreBridge.h>
+#import <WebCore/WebCoreBridge.h>
 
 #import <WebKit/IFWebDataSource.h>
 
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 797f55e..1acc192 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -34,7 +34,7 @@
 
 @implementation IFWebCoreBridge
 
-- (id <WebCoreFrame>)frame
+- (WebCoreFrame *)frame
 {
     return [[dataSource webFrame] _bridgeFrame];
 }
@@ -60,18 +60,18 @@
     return bridgeFrames;
 }
 
-- (id <WebCoreFrame>)childFrameNamed:(NSString *)name
+- (WebCoreFrame *)childFrameNamed:(NSString *)name
 {
     return [[dataSource frameNamed:name] _bridgeFrame];
 }
 
-- (id <WebCoreFrame>)descendantFrameNamed:(NSString *)name
+- (WebCoreFrame *)descendantFrameNamed:(NSString *)name
 {
     return [[[dataSource webFrame] frameNamed:name] _bridgeFrame];
 }
 
 - (BOOL)createChildFrameNamed:(NSString *)frameName
-    withURL:(NSURL *)URL renderPart:(khtml::RenderPart *)renderPart
+    withURL:(NSURL *)URL renderPart:(KHTMLRenderPart *)renderPart
     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height
 {
     WEBKIT_ASSERT(dataSource);
@@ -81,7 +81,7 @@
         return NO;
     }
     
-    [frame _setRenderFramePart:renderPart];
+    [[frame _bridgeFrame] setRenderPart:renderPart];
     
     [[frame webView] _setMarginWidth:width];
     [[frame webView] _setMarginHeight:height];
@@ -156,12 +156,12 @@
     [[[dataSource controller] windowContext] setStatusText:status];
 }
 
-- (id <WebCoreFrame>)mainFrame
+- (WebCoreFrame *)mainFrame
 {
     return [[[dataSource controller] mainFrame] _bridgeFrame];
 }
 
-- (id <WebCoreFrame>)frameNamed:(NSString *)name
+- (WebCoreFrame *)frameNamed:(NSString *)name
 {
     return [[[dataSource controller] frameNamed:name] _bridgeFrame];
 }
diff --git a/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h b/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h
index fc3f050..ef4d8c3 100644
--- a/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h
+++ b/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h
@@ -7,7 +7,7 @@
 //
 
 #import <Foundation/Foundation.h>
-#import <WebCoreCookieAdapter.h>
+#import <WebCore/WebCoreCookieAdapter.h>
 
 @interface IFCookieAdapter : WebCoreCookieAdapter
 {
diff --git a/WebKit/WebCoreSupport.subproj/WebFrameBridge.h b/WebKit/WebCoreSupport.subproj/WebFrameBridge.h
index 0aef6e4..34ea61b 100644
--- a/WebKit/WebCoreSupport.subproj/WebFrameBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebFrameBridge.h
@@ -6,12 +6,12 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreFrame.h>
+#import <WebCore/WebCoreFrame.h>
 
 @class IFWebDataSource;
 @class IFWebFrame;
 
- at interface IFWebCoreFrame : NSObject <WebCoreFrame>
+ at interface IFWebCoreFrame : WebCoreFrame <WebCoreFrame>
 {
     IFWebFrame *frame;
 }
diff --git a/WebKit/WebCoreSupport.subproj/WebFrameBridge.m b/WebKit/WebCoreSupport.subproj/WebFrameBridge.m
index e786f9d..878b192 100644
--- a/WebKit/WebCoreSupport.subproj/WebFrameBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebFrameBridge.m
@@ -37,7 +37,7 @@
 
 - (IFHTMLView *)HTMLView
 {
-    return [[self view] documentView];
+    return (IFHTMLView *)[[self view] documentView];
 }
 
 - (WebCoreBridge *)bridge
@@ -47,7 +47,6 @@
 
 - (KHTMLView *)widget
 {
-    WEBKIT_ASSERT([self HTMLView]);
     KHTMLView *widget = [[self HTMLView] _provisionalWidget];
     if (widget) {
         return widget;
@@ -59,8 +58,9 @@
 {
     IFWebDataSource *newDataSource = [[IFWebDataSource alloc] initWithURL:URL attributes:attributes flags:flags];
     [newDataSource _setParent:parent];
-    if([frame setProvisionalDataSource:newDataSource])
+    if ([frame setProvisionalDataSource:newDataSource]) {
         [frame startLoading];
+    }
     [newDataSource release];
 }
 
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
index 7779d23..4559b9d 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
@@ -3,7 +3,7 @@
 */
 
 #import <Cocoa/Cocoa.h>
-#import <WebCoreImageRenderer.h>
+#import <WebCore/WebCoreImageRenderer.h>
 
 @interface IFImageRenderer : NSImage <WebCoreImageRenderer>
 {
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.h b/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.h
index 8ff7e33..7a17213 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.h
+++ b/WebKit/WebCoreSupport.subproj/WebImageRendererFactory.h
@@ -5,7 +5,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreImageRendererFactory.h>
+#import <WebCore/WebCoreImageRendererFactory.h>
 
 @class IFImageRenderer;
 
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 4202815..9645dcc 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -11,7 +11,7 @@
 #import <WebFoundation/IFError.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <WebCoreResourceLoader.h>
+#import <WebCore/WebCoreResourceLoader.h>
 
 #import <WebKit/IFLoadProgress.h>
 #import <WebKit/IFWebControllerPrivate.h>
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 4202815..9645dcc 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -11,7 +11,7 @@
 #import <WebFoundation/IFError.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <WebCoreResourceLoader.h>
+#import <WebCore/WebCoreResourceLoader.h>
 
 #import <WebKit/IFLoadProgress.h>
 #import <WebKit/IFWebControllerPrivate.h>
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
index e4409c6..72cfa40 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreTextRenderer.h>
+#import <WebCore/WebCoreTextRenderer.h>
 
 typedef struct WidthMap WidthMap;
 typedef struct GlyphMap GlyphMap;
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h
index 5301976..ae5593b 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreTextRendererFactory.h>
+#import <WebCore/WebCoreTextRendererFactory.h>
 
 @class IFTextRenderer;
 
diff --git a/WebKit/WebCoreSupport.subproj/WebViewFactory.h b/WebKit/WebCoreSupport.subproj/WebViewFactory.h
index 84f6a51..3d0f567 100644
--- a/WebKit/WebCoreSupport.subproj/WebViewFactory.h
+++ b/WebKit/WebCoreSupport.subproj/WebViewFactory.h
@@ -6,7 +6,7 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
-#import <WebCoreViewFactory.h>
+#import <WebCore/WebCoreViewFactory.h>
 
 @interface IFWebCoreViewFactory : WebCoreViewFactory
 {
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index ee4162f..be13e2b 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -89,12 +89,13 @@
 		};
 		0867D691FE84028FC02AAC07 = {
 			children = (
-				F8CA15B4029A399401000122,
 				9C7CABBB0190A37C0ECA16EA,
+				F5B36B400281DE87018635CB,
+				F8CA15B4029A399401000122,
 				25A8176801B5474B0ECA149E,
 				F5065217027F555001C1A526,
-				F5B36B400281DE87018635CB,
 				F5EBC45202134BB601CA1520,
+				F52CA6C002DF9D78018635CA,
 				254DC334016E1D3F0ECA149E,
 				089C1665FE841158C02AAC07,
 				0867D69AFE84028FC02AAC07,
@@ -399,8 +400,6 @@
 //254
 		254DC334016E1D3F0ECA149E = {
 			children = (
-				F59EAE3E0253C7EE018635CA,
-				F59EAE410253C8DE018635CA,
 				F5FBAB8F02B88CBF01FF6074,
 				F5FBAB9002B88CBF01FF6074,
 				3944607A020F50ED0ECA1767,
@@ -1054,35 +1053,20 @@
 //9C4
 		9C7CABBB0190A37C0ECA16EA = {
 			children = (
+				F52CA6BD02DF9D0F018635CA,
+				F52CA6BE02DF9D49018635CA,
+				F52CA6BF02DF9D4D018635CA,
 				35081DAE02B6D4F50ACA2ACA,
-				F5F81C3502B67C0F018635CA,
-				F5F81C3602B67C0F018635CA,
 				3944606B020F50ED0ECA1767,
 				3944606C020F50ED0ECA1767,
-				35081D9202B6D4D80ACA2ACA,
-				35081D9302B6D4D80ACA2ACA,
-				35081D9402B6D4D80ACA2ACA,
-				35081D9502B6D4D80ACA2ACA,
-				35081D9602B6D4D80ACA2ACA,
-				35081D9702B6D4D80ACA2ACA,
-				35081D9802B6D4D80ACA2ACA,
-				35081D9902B6D4D80ACA2ACA,
-				35081D9A02B6D4D80ACA2ACA,
-				35081D9B02B6D4D80ACA2ACA,
 				F58BAB3A025036CA01C1A526,
 				F58BAB380250363E01C1A526,
 				F567433E026B5B7B01A80181,
 				F5D538E802441F2601A80181,
 				F5D538EC02441FDD01A80181,
 				3944606E020F50ED0ECA1767,
-				F5AEBB3D024A527601C1A526,
 				9CAE9D070252A4130ECA16EA,
-				F5F81C3902B67C26018635CA,
-				F5F81C3A02B67C26018635CA,
-				35081DA602B6D4E40ACA2ACA,
-				35081DA702B6D4E40ACA2ACA,
-				35081DA802B6D4E40ACA2ACA,
-				35081DA902B6D4E40ACA2ACA,
+				F5AEBB3D024A527601C1A526,
 				3944606F020F50ED0ECA1767,
 				39446064020F50ED0ECA1767,
 				F5927D4A02D253C401CA2DBB,
@@ -1100,7 +1084,6 @@
 				F5143A370221DCCE01A80181,
 				9CF0E249021361B00ECA16EA,
 				9CF0E24A021361B00ECA16EA,
-				F5A55DC702BAA2E8018635CC,
 			);
 			isa = PBXGroup;
 			name = WebView;
@@ -1416,6 +1399,56 @@
 			settings = {
 			};
 		};
+		F52CA6BD02DF9D0F018635CA = {
+			children = (
+				35081D9202B6D4D80ACA2ACA,
+				35081D9302B6D4D80ACA2ACA,
+				F5A55DC702BAA2E8018635CC,
+				35081D9402B6D4D80ACA2ACA,
+				35081D9502B6D4D80ACA2ACA,
+				35081D9602B6D4D80ACA2ACA,
+				35081D9702B6D4D80ACA2ACA,
+			);
+			isa = PBXGroup;
+			name = HTML;
+			refType = 4;
+		};
+		F52CA6BE02DF9D49018635CA = {
+			children = (
+				35081D9802B6D4D80ACA2ACA,
+				35081D9902B6D4D80ACA2ACA,
+				35081D9A02B6D4D80ACA2ACA,
+				35081D9B02B6D4D80ACA2ACA,
+			);
+			isa = PBXGroup;
+			name = Image;
+			refType = 4;
+		};
+		F52CA6BF02DF9D4D018635CA = {
+			children = (
+				35081DA602B6D4E40ACA2ACA,
+				35081DA702B6D4E40ACA2ACA,
+				35081DA802B6D4E40ACA2ACA,
+				35081DA902B6D4E40ACA2ACA,
+			);
+			isa = PBXGroup;
+			name = Text;
+			refType = 4;
+		};
+		F52CA6C002DF9D78018635CA = {
+			children = (
+				F59EAE3E0253C7EE018635CA,
+				F59EAE410253C8DE018635CA,
+				F5F81C3502B67C0F018635CA,
+				F5F81C3602B67C0F018635CA,
+				F5F81C3902B67C26018635CA,
+				F5F81C3A02B67C26018635CA,
+			);
+			isa = PBXGroup;
+			name = Debugging;
+			path = "";
+			refType = 4;
+		};
 		F5488CF402CB04EE01FF6274 = {
 			isa = PBXFileReference;
 			name = IFCookieAdapter.h;
@@ -2314,10 +2347,10 @@
 				F8CA15B6029A39D901000122,
 				F8CA15B7029A39D901000122,
 				F8CA15B8029A39D901000122,
-				F8CA15BD029A39DF01000122,
 				F8CA15C1029A3E0D01000122,
 				F83DCC71029D09F301000131,
 				F83DCC72029D09F301000131,
+				F8CA15BE029A39FC01000122,
 			);
 			isa = PBXGroup;
 			name = Panels;
@@ -2374,14 +2407,6 @@
 			settings = {
 			};
 		};
-		F8CA15BD029A39DF01000122 = {
-			children = (
-				F8CA15BE029A39FC01000122,
-			);
-			isa = PBXGroup;
-			name = Resources;
-			refType = 4;
-		};
 		F8CA15BE029A39FC01000122 = {
 			children = (
 				F8CA15BF029A39FC01000122,
diff --git a/WebKit/WebView.subproj/IFDOMNode.mm b/WebKit/WebView.subproj/IFDOMNode.mm
index 30dc4f9..a9cb8fb 100644
--- a/WebKit/WebView.subproj/IFDOMNode.mm
+++ b/WebKit/WebView.subproj/IFDOMNode.mm
@@ -10,9 +10,12 @@
 
 #import <WebKit/IFWebView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
+
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
 #import <khtml_part.h>
 #import <xml/dom_docimpl.h>
+#endif
 
 @implementation IFDOMNode
 
@@ -38,7 +41,7 @@
 
 - initWithWebView:(IFWebView *)view
 {
-    return [self initWithDOMNode:[[view documentView] _widget]->part()->xmlDocImpl()];
+    return [self initWithDOMNode:[(IFHTMLView *)[view documentView] _widget]->part()->xmlDocImpl()];
 }
 
 - (void)dealloc
diff --git a/WebKit/WebView.subproj/IFDocument.h b/WebKit/WebView.subproj/IFDocument.h
index f5c3223..5a2c3df 100644
--- a/WebKit/WebView.subproj/IFDocument.h
+++ b/WebKit/WebView.subproj/IFDocument.h
@@ -3,7 +3,7 @@
 	Copyright 2002, Apple, Inc. All rights reserved.
 */
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 @class IFWebDataSource;
 @class IFError;
diff --git a/WebKit/WebView.subproj/IFDynamicScrollBarsView.h b/WebKit/WebView.subproj/IFDynamicScrollBarsView.h
index ba9e4c0..7266e5a 100644
--- a/WebKit/WebView.subproj/IFDynamicScrollBarsView.h
+++ b/WebKit/WebView.subproj/IFDynamicScrollBarsView.h
@@ -8,7 +8,7 @@
 
 #import <Cocoa/Cocoa.h>
 
-#import <WebCoreFrameView.h>
+#import <WebCore/WebCoreFrameView.h>
 
 // FIXME 2980779: This has grown to be more than just a dynamic scroll bar view,
 // and it no longer works outside of WebKit.
diff --git a/WebKit/WebView.subproj/IFHTMLView.mm b/WebKit/WebView.subproj/IFHTMLView.mm
index 6ec8e5c..ac5e0c7 100644
--- a/WebKit/WebView.subproj/IFHTMLView.mm
+++ b/WebKit/WebView.subproj/IFHTMLView.mm
@@ -10,6 +10,7 @@
 #import <WebKit/IFNSViewExtras.h>
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFWebCoreBridge.h>
+#import <WebKit/IFWebCoreFrame.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFWebViewPrivate.h>
@@ -18,14 +19,10 @@
 // Needed for the mouse move notification.
 #import <AppKit/NSResponder_Private.h>
 
-// KDE related includes
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
-#import <qpainter.h>
-#import <qevent.h>
-#import <html/html_documentimpl.h>
-#import <rendering/render_object.h>
-
-#import <KWQKHTMLPartImpl.h>
+#import <rendering/render_frames.h>
+#endif
 
 @implementation IFHTMLView
 
@@ -128,57 +125,55 @@
 // the data source is changed.
 - (void)provisionalDataSourceChanged:(IFWebDataSource *)dataSource 
 {
-    IFWebCoreBridge *bridge = [dataSource _bridge];
-
-    IFHTMLView *provisionalView = [[[dataSource webFrame] webView] documentView];
-    
-    NSRect r = [self frame];
-    
-    _private->provisionalWidget = [bridge createKHTMLViewWithNSView:provisionalView
-	width:(int)r.size.width height:(int)r.size.height
+    _private->provisionalWidget = [[dataSource _bridge]
+        createKHTMLViewWithNSView:[[[dataSource webFrame] webView] documentView]
+	width:(int)[self frame].size.width height:(int)[self frame].size.height
         marginWidth:[[[dataSource webFrame] webView] _marginWidth]
         marginHeight:[[[dataSource webFrame] webView] _marginHeight]];
 }
 
-- (void)provisionalDataSourceCommitted: (IFWebDataSource *)dataSource 
+- (void)provisionalDataSourceCommitted:(IFWebDataSource *)dataSource 
 {
-    IFHTMLViewPrivate *data = _private;
-    IFWebView *webView = [self _IF_parentWebView];
-    id frameScrollView = [webView frameScrollView];
-    
-    data->provisionalWidget->setView (frameScrollView);
+    if (_private->widgetOwned) {
+        delete _private->widget;
+    }
+
+    _private->widget = _private->provisionalWidget;
+    _private->widgetOwned = YES;
+    _private->provisionalWidget = 0;
 
-    if (data->widgetOwned)
-        delete data->widget;
+    _private->widget->setView([[self _IF_parentWebView] frameScrollView]);
 
-    data->widget = data->provisionalWidget;
-    data->widgetOwned = YES;
-    data->provisionalWidget = 0;
+    KHTMLRenderPart *renderPart = [[[self _bridge] frame] renderPart];
+    if (renderPart) {
+        // Setting the widget will delete the previous KHTMLView associated with the frame.
+        _private->widgetOwned = NO;
+        renderPart->setWidget(_private->widget);
+    }
 }
 
-- (void)dataSourceUpdated: (IFWebDataSource *)dataSource
+- (void)dataSourceUpdated:(IFWebDataSource *)dataSource
 {
 }
 
 - (void)reapplyStyles
 {
-    KHTMLView *widget = _private->widget;
-
-    if (widget && widget->part()->xmlDocImpl() && 
-        widget->part()->xmlDocImpl()->renderer()) {
-        if (_private->needsToApplyStyles){
+    if (!_private->needsToApplyStyles) {
+        return;
+    }
+    
 #ifdef _KWQ_TIMING        
     double start = CFAbsoluteTimeGetCurrent();
 #endif
-            widget->part()->xmlDocImpl()->updateStyleSelector();
-            _private->needsToApplyStyles = NO;
+
+    [[self _bridge] reapplyStyles];
+    
 #ifdef _KWQ_TIMING        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s apply style seconds = %f\n", widget->part()->baseURL().url().latin1(), thisTime);
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_TIMING, "%s apply style seconds = %f\n", [self URL], thisTime);
 #endif
-        }
-    }
 
+    _private->needsToApplyStyles = NO;
 }
 
 
@@ -186,32 +181,26 @@
 // understood how IFWebView will be subclassed.
 - (void)layout
 {
-    KHTMLView *widget = _private->widget;
-
     // Ensure that we will receive mouse move events.  Is this the best place to put this?
     [[self window] setAcceptsMouseMovedEvents: YES];
     [[self window] _setShouldPostEventNotifications: YES];
 
-    if (widget && widget->part()->xmlDocImpl() && 
-        widget->part()->xmlDocImpl()->renderer() &&
-        _private->needsLayout){
- #ifdef _KWQ_TIMING        
+    if (!_private->needsLayout) {
+        return;
+    }
+
+#ifdef _KWQ_TIMING        
     double start = CFAbsoluteTimeGetCurrent();
- #endif
+#endif
 
-        widget->part()->xmlDocImpl()->renderer()->setLayouted(false);
-        WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "%s doing layout\n", DEBUG_OBJECT(self));
-        widget->layout();
-        _private->needsLayout = NO;
- #ifdef _KWQ_TIMING        
-    double thisTime = CFAbsoluteTimeGetCurrent() - start;
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s layout seconds = %f\n", widget->part()->baseURL().url().latin1(), thisTime);
- #endif
-    }
-    else {
-        WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "%s NOT doing layout\n", DEBUG_OBJECT(self));
-    }
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_VIEW, "%s doing layout\n", DEBUG_OBJECT(self));
+    [[self _bridge] forceLayout];
+    _private->needsLayout = NO;
 
+#ifdef _KWQ_TIMING        
+    double thisTime = CFAbsoluteTimeGetCurrent() - start;
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_TIMING, "%s layout seconds = %f\n", [self URL], thisTime);
+#endif
 }
 
 
@@ -317,21 +306,8 @@
 
 
 // This should eventually be removed.
-- (void)drawRect:(NSRect)rect {
-    KHTMLView *widget = _private->widget;
-    //IFWebViewPrivate *data = _private;
-
-    //if (data->provisionalWidget != 0){
-    //    WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "not drawing, frame in provisional state.\n");
-    //    return;
-    //}
-    
-    if (widget == 0) {
-        // This used to fill with white, but the window-with-no-content case is now handled
-        // by IFHTMLView.
-        return;
-    }
-
+- (void)drawRect:(NSRect)rect
+{
     WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "%s drawing\n", DEBUG_OBJECT(self));
 
     [self reapplyStyles];
@@ -341,15 +317,11 @@
 #ifdef _KWQ_TIMING
     double start = CFAbsoluteTimeGetCurrent();
 #endif
-    QPainter p(widget);
 
     [self lockFocus];
-
+    
     //double start = CFAbsoluteTimeGetCurrent();
-    widget->drawContents( &p, (int)rect.origin.x,
-                              (int)rect.origin.y,
-                              (int)rect.size.width,
-                               (int)rect.size.height );
+    [[self _bridge] drawRect:rect];
     //WebKitDebugAtLevel (WEBKIT_LOG_TIMING, "draw time %e\n", CFAbsoluteTimeGetCurrent() - start);
 
 #ifdef DEBUG_LAYOUT
diff --git a/WebKit/WebView.subproj/IFHTMLViewPrivate.h b/WebKit/WebView.subproj/IFHTMLViewPrivate.h
index 5f6ba07..53a9857 100644
--- a/WebKit/WebView.subproj/IFHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/IFHTMLViewPrivate.h
@@ -40,6 +40,5 @@ class KHTMLView;
 
 - (KHTMLView *)_widget;
 - (KHTMLView *)_provisionalWidget;
-- (void)_takeOwnershipOfWidget;
 - (IFWebCoreBridge *)_bridge;
 @end
diff --git a/WebKit/WebView.subproj/IFHTMLViewPrivate.mm b/WebKit/WebView.subproj/IFHTMLViewPrivate.mm
index bb18a2f..45d1aee 100644
--- a/WebKit/WebView.subproj/IFHTMLViewPrivate.mm
+++ b/WebKit/WebView.subproj/IFHTMLViewPrivate.mm
@@ -16,8 +16,22 @@
 #import <WebKit/IFWebFramePrivate.h>
 #import <WebKit/IFWebViewPrivate.h>
 
-// Includes from KDE
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
+#endif
+
+ at interface NSView (IFHTMLViewPrivate)
+- (void)_IF_stopIfPluginView;
+ at end
+
+ at implementation NSView (IFHTMLViewPrivate)
+- (void)_IF_stopIfPluginView
+{
+    if ([self isKindOfClass:[IFPluginView class]]) {
+        [(IFPluginView *)self stop];
+    }
+}
+ at end
 
 @implementation IFHTMLViewPrivate
 
@@ -35,19 +49,11 @@
 - (void)_reset
 {
     NSArray *subviews = [[self subviews] copy];
+    [subviews makeObjectsPerformSelector:@selector(_IF_stopIfPluginView)];
+    [subviews release];
 
     [IFImageRenderer stopAnimationsInView: self];
     
-    int count = [subviews count];
-    while (count--) {
-        id view = [subviews objectAtIndex:count];
-        if ([view isKindOfClass:[IFPluginView class]]) {
-            IFPluginView *pluginView = (IFPluginView *)view;
-            [pluginView stop];
-        }
-    }
-    [subviews release];
-
     delete _private->provisionalWidget;
     _private->provisionalWidget = 0;
     if (_private->widgetOwned)
@@ -72,11 +78,6 @@
     return _private->provisionalWidget;    
 }
 
-- (void)_takeOwnershipOfWidget
-{
-    _private->widgetOwned = NO;
-}
-
 // Required so view can access the part's selection.
 - (IFWebCoreBridge *)_bridge
 {
diff --git a/WebKit/WebView.subproj/IFImageView.h b/WebKit/WebView.subproj/IFImageView.h
index 3688cab..e1f78b7 100644
--- a/WebKit/WebView.subproj/IFImageView.h
+++ b/WebKit/WebView.subproj/IFImageView.h
@@ -5,7 +5,6 @@
 
 #import <Cocoa/Cocoa.h>
 
- at class IFWebDataSource;
 @class IFImageRepresentation;
 @protocol IFDocumentLoading;
 @protocol IFDocumentDragSettings;
diff --git a/WebKit/WebView.subproj/IFImageView.m b/WebKit/WebView.subproj/IFImageView.m
index 8f870e7..c0fefd8 100644
--- a/WebKit/WebView.subproj/IFImageView.m
+++ b/WebKit/WebView.subproj/IFImageView.m
@@ -30,49 +30,39 @@
     [super dealloc];
 }
 
-
 - (BOOL)isFlipped 
 {
     return YES;
 }
 
-
 - (void)drawRect:(NSRect)rect
 {
     [[representation image] beginAnimationInRect:[self frame] fromRect:[self frame]];
 }
 
-
 - (void)provisionalDataSourceChanged:(IFWebDataSource *)dataSource
 {
-
 }
 
-
 - (void)provisionalDataSourceCommitted:(IFWebDataSource *)dataSource
 {
     representation = [[dataSource representation] retain];
 }
 
-
 - (void)dataSourceUpdated:(IFWebDataSource *)dataSource
 {
-
 }
 
-
 - (void)layout
 {
     IFImageRenderer *image = [representation image];
-    
-    if(image){
+    if (image) {
         [self setFrameSize:[image size]];
         [image setFlipped:YES];
     }
 
 }
 
-
 - (void)setCanDragFrom: (BOOL)flag
 {
     canDragFrom = flag;
@@ -83,19 +73,16 @@
     return canDragFrom;
 }
 
-
 - (void)setCanDragTo: (BOOL)flag
 {
     canDragTo = flag;
 }
 
-
 - (BOOL)canDragTo
 {
     return canDragTo;
 }
 
-
 - (void)viewDidMoveToWindow
 {
     if (![self window])
@@ -103,5 +90,4 @@
     [super viewDidMoveToWindow];
 }
 
-
 @end
diff --git a/WebKit/WebView.subproj/IFRenderNode.mm b/WebKit/WebView.subproj/IFRenderNode.mm
index 376df90..1aa61ae 100644
--- a/WebKit/WebView.subproj/IFRenderNode.mm
+++ b/WebKit/WebView.subproj/IFRenderNode.mm
@@ -10,11 +10,16 @@
 
 #import <WebKit/IFWebView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
+
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
+
 #import <khtmlview.h>
 #import <khtml_part.h>
 #import <xml/dom_docimpl.h>
 #import <rendering/render_frames.h>
 
+#endif
+
 @implementation IFRenderNode
 
 - initWithRenderObject:(khtml::RenderObject *)node
@@ -55,7 +60,7 @@
 
 - initWithWebView:(IFWebView *)view
 {
-    return [self initWithRenderObject:[[view documentView] _widget]->part()->xmlDocImpl()->renderer()];
+    return [self initWithRenderObject:[(IFHTMLView *)[view documentView] _widget]->part()->xmlDocImpl()->renderer()];
 }
 
 - (void)dealloc
diff --git a/WebKit/WebView.subproj/IFWebController.h b/WebKit/WebView.subproj/IFWebController.h
index f99f90f..3740dd5 100644
--- a/WebKit/WebView.subproj/IFWebController.h
+++ b/WebKit/WebView.subproj/IFWebController.h
@@ -158,7 +158,7 @@
 
 // FIXME:  Should this method be private?
 // Called when a data source needs to create a frame.  This method encapsulates the
-// specifics of creating and initializaing a view of the appropriate class.
+// specifics of creating and initializing a view of the appropriate class.
 - (IFWebFrame *)createFrameNamed: (NSString *)fname for: (IFWebDataSource *)child inParent: (IFWebDataSource *)parent allowsScrolling: (BOOL)allowsScrolling;
 
 // Look for a frame named name, recursively.
diff --git a/WebKit/WebView.subproj/IFWebControllerPolicyHandler.h b/WebKit/WebView.subproj/IFWebControllerPolicyHandler.h
index 6cb393e..705276d 100644
--- a/WebKit/WebView.subproj/IFWebControllerPolicyHandler.h
+++ b/WebKit/WebView.subproj/IFWebControllerPolicyHandler.h
@@ -5,7 +5,7 @@
         Public header file.
 */
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 /*
    ============================================================================= 
diff --git a/WebKit/WebView.subproj/IFWebControllerPrivate.mm b/WebKit/WebView.subproj/IFWebControllerPrivate.mm
index c1ba2e4..08822ea 100644
--- a/WebKit/WebView.subproj/IFWebControllerPrivate.mm
+++ b/WebKit/WebView.subproj/IFWebControllerPrivate.mm
@@ -18,9 +18,6 @@
 #import <WebFoundation/IFURLCacheLoaderConstants.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <rendering/render_frames.h>
-
-
 @implementation IFWebControllerPrivate
 
 - init 
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index dc3a26a..7a259bd 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -18,8 +18,6 @@
 #import <WebFoundation/IFFileTypeMappings.h>
 #import <WebFoundation/IFNSDictionaryExtensions.h>
 
-#import <xml/dom_docimpl.h>
-
 @implementation IFWebDataSource
 
 -(id)initWithURL:(NSURL *)theURL
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
index aecc462..d937f2b 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
@@ -26,8 +26,6 @@
 #import <WebFoundation/IFNSURLExtensions.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <kurl.h>
-
 @implementation IFWebDataSourcePrivate 
 
 - init
diff --git a/WebKit/WebView.subproj/IFWebFrame.mm b/WebKit/WebView.subproj/IFWebFrame.mm
index 1a4ccc8..dbdd497 100644
--- a/WebKit/WebView.subproj/IFWebFrame.mm
+++ b/WebKit/WebView.subproj/IFWebFrame.mm
@@ -21,8 +21,6 @@
 
 #import <WebKit/WebKitDebug.h>
 
-#import <rendering/render_frames.h>
-
 @implementation IFWebFrame
 
 - init
@@ -208,7 +206,7 @@
 {
     [_private setDataSource: nil];
     if ([[self webView] isDocumentHTML])
-        [[[self webView] documentView] _reset];
+        [(IFHTMLView *)[[self webView] documentView] _reset];
     [_private setWebView: nil];
 }
 
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.h b/WebKit/WebView.subproj/IFWebFramePrivate.h
index 58b9b52..a4aff8e 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.h
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.h
@@ -12,10 +12,6 @@
 @class IFWebView;
 @protocol IFDocumentLoading;
 
-namespace khtml {
-    class RenderPart;
-}
-
 typedef enum {
     IFWEBFRAMESTATE_UNINITIALIZED = 1,
     IFWEBFRAMESTATE_PROVISIONAL = 2,
@@ -43,7 +39,6 @@ typedef enum {
     IFWebView *webView;
     IFWebDataSource *dataSource;
     IFWebDataSource *provisionalDataSource;
-    khtml::RenderPart *renderFramePart;
     IFWebController *controller;
     IFWebFrameState state;
     BOOL scheduledLayoutPending;
@@ -60,16 +55,12 @@ typedef enum {
 - (IFWebDataSource *)dataSource;
 - (void)setProvisionalDataSource: (IFWebDataSource *)d;
 - (IFWebDataSource *)provisionalDataSource;
-- (void)setRenderFramePart: (khtml::RenderPart *)p;
-- (khtml::RenderPart *)renderFramePart;
 
 @end
 
 @interface IFWebFrame (IFPrivate)
 - (void)_parentDataSourceWillBeDeallocated;
 - (void)_setController: (IFWebController *)controller;
-- (void)_setRenderFramePart: (khtml::RenderPart *)p;
-- (khtml::RenderPart *)_renderFramePart;
 - (void)_setDataSource: (IFWebDataSource *)d;
 - (void)_transitionProvisionalToCommitted;
 - (void)_transitionProvisionalToLayoutAcceptable;
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index 8097e22..746fafd 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -1,8 +1,12 @@
 /*	
     IFWebFramePrivate.mm
 	    
-    Copyright 2001, Apple, Inc. All rights reserved.
+    Copyright 2001, 2002, Apple Computer, Inc. All rights reserved.
 */
+
+#import <WebKit/IFWebFramePrivate.h>
+
+#import <WebKit/IFDocument.h>
 #import <WebKit/IFDynamicScrollBarsView.h>
 #import <WebKit/IFHTMLView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
@@ -14,17 +18,12 @@
 #import <WebKit/IFWebCoreFrame.h>
 #import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
-#import <WebKit/IFWebFramePrivate.h>
 #import <WebKit/IFWebKitErrors.h>
 #import <WebKit/IFWebViewPrivate.h>
 #import <WebKit/WebKitDebug.h>
 
 #import <WebFoundation/WebFoundation.h>
 
-// includes from kde
-#import <khtmlview.h>
-#import <rendering/render_frames.h>
-
 static const char * const stateNames[6] = {
     "zero state",
     "IFWEBFRAMESTATE_UNINITIALIZED",
@@ -48,8 +47,6 @@ static const char * const stateNames[6] = {
     [webView autorelease];
     [dataSource autorelease];
     [provisionalDataSource autorelease];
-    if (renderFramePart)
-        renderFramePart->deref();
     [bridgeFrame release];
     
     [super dealloc];
@@ -95,16 +92,6 @@ static const char * const stateNames[6] = {
     }
 }
 
-- (khtml::RenderPart *)renderFramePart { return renderFramePart; }
-- (void)setRenderFramePart: (khtml::RenderPart *)p 
-{
-    if (p)
-        p->ref();
-    if (renderFramePart)
-        renderFramePart->deref();
-    renderFramePart = p;
-}
-
 @end
 
 @implementation IFWebFrame (IFPrivate)
@@ -121,16 +108,6 @@ static const char * const stateNames[6] = {
     [_private setController: controller];
 }
 
-- (void)_setRenderFramePart: (khtml::RenderPart *)p
-{
-    [_private setRenderFramePart:p];
-}
-
-- (khtml::RenderPart *)_renderFramePart
-{
-    return [_private renderFramePart];
-}
-
 - (void)_setDataSource: (IFWebDataSource *)ds
 {
     [_private setDataSource: ds];
@@ -151,17 +128,17 @@ static const char * const stateNames[6] = {
     
     _private->scheduledLayoutPending = NO;
     if (_private->state == IFWEBFRAMESTATE_LAYOUT_ACCEPTABLE) {
-        id documentView = [[self webView] documentView];
+        NSView <IFDocumentView> *documentView = [[self webView] documentView];
         
         if ([self controller])
             WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s:  performing timed layout, %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
             
-        if([[self webView] isDocumentHTML]){
-            NSView *view = (NSView *)documentView;
+        if ([[self webView] isDocumentHTML]) {
+            IFHTMLView *htmlView = (IFHTMLView *)documentView;
             
-            [documentView setNeedsLayout: YES];
+            [htmlView setNeedsLayout: YES];
             
-            NSRect frame = [view frame];
+            NSRect frame = [htmlView frame];
             
             if (frame.size.width == 0 || frame.size.height == 0){
                 // We must do the layout now, rather than depend on
@@ -173,7 +150,7 @@ static const char * const stateNames[6] = {
                 // check to see if any CSS is pending and delay
                 // the layout further to avoid the flash of unstyled
                 // content.                    
-                [documentView layout];
+                [htmlView layout];
             }
         }
             
@@ -238,8 +215,7 @@ static const char * const stateNames[6] = {
 - (void)_transitionProvisionalToCommitted
 {
     WEBKIT_ASSERT ([self controller] != nil);
-    id documentView = [[self webView] documentView];
-    BOOL isDocumentHTML = [[self webView] isDocumentHTML];
+    NSView <IFDocumentView> *documentView = [[self webView] documentView];
     
     switch ([self _state]) {
     	case IFWEBFRAMESTATE_PROVISIONAL:
@@ -253,15 +229,6 @@ static const char * const stateNames[6] = {
             // display the new new datasource.
             [documentView provisionalDataSourceCommitted: _private->provisionalDataSource];
  
-            // If we're a frame (not the main frame) hookup the kde internals.  This introduces a nasty dependency 
-            // in kde on the view.
-            khtml::RenderPart *renderPartFrame = [self _renderFramePart];
-            if (renderPartFrame && isDocumentHTML) {
-                // Setting the widget will delete the previous KHTMLView associated with the frame.
-                [documentView _takeOwnershipOfWidget];
-                renderPartFrame->setWidget([documentView _widget]);
-            }
-           
             // Now that the provisional data source is committed, release it.
             [_private setProvisionalDataSource: nil];
         
@@ -367,10 +334,10 @@ static const char * const stateNames[6] = {
             //WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "%s:  checking complete, current state IFWEBFRAMESTATE_COMMITTED\n", [[self name] cString]);
             if (![ds isLoading]) {
                 id mainView = [[[self controller] mainFrame] webView];
-                id mainDocumentView = [mainView documentView];
+                NSView <IFDocumentView> *mainDocumentView = [mainView documentView];
 #if 0
                 id thisView = [self webView];
-                id thisDocumentView = [thisView documentView];
+                NSView <IFDocumentView> *thisDocumentView = [thisView documentView];
 #endif
                 [self _setState: IFWEBFRAMESTATE_COMPLETE];
                 
@@ -380,8 +347,8 @@ static const char * const stateNames[6] = {
                 // it may change the size of frames.
                 // FIXME:  Why is this necessary? and recurse.
                 {
-                    if ([mainView isDocumentHTML]){
-                        [mainDocumentView setNeedsLayout: YES];
+                    if ([mainView isDocumentHTML]) {
+                        [(IFHTMLView *)mainDocumentView setNeedsLayout: YES];
                     }
                     [mainDocumentView layout];
                     
diff --git a/WebKit/WebView.subproj/IFWebView.h b/WebKit/WebView.subproj/IFWebView.h
index 8ce3430..294de24 100644
--- a/WebKit/WebView.subproj/IFWebView.h
+++ b/WebKit/WebView.subproj/IFWebView.h
@@ -15,6 +15,7 @@
 @class IFWebController;
 @class IFWebViewPrivate;
 @protocol IFDocumentLoading;
+ at protocol IFDocumentView;
 
 @interface IFWebView : NSView
 {
@@ -28,9 +29,9 @@
 - (IFWebController *)controller;
 
 - frameScrollView;
-- documentView;
+- (NSView <IFDocumentView> *)documentView;
 
-- (BOOL) isDocumentHTML;
+- (BOOL)isDocumentHTML;
 
 - (void)setAllowsScrolling: (BOOL)flag;
 - (BOOL)allowsScrolling;
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index f99f90f..3740dd5 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -158,7 +158,7 @@
 
 // FIXME:  Should this method be private?
 // Called when a data source needs to create a frame.  This method encapsulates the
-// specifics of creating and initializaing a view of the appropriate class.
+// specifics of creating and initializing a view of the appropriate class.
 - (IFWebFrame *)createFrameNamed: (NSString *)fname for: (IFWebDataSource *)child inParent: (IFWebDataSource *)parent allowsScrolling: (BOOL)allowsScrolling;
 
 // Look for a frame named name, recursively.
diff --git a/WebKit/WebView.subproj/WebControllerPolicyDelegate.h b/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
index 6cb393e..705276d 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
@@ -5,7 +5,7 @@
         Public header file.
 */
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 /*
    ============================================================================= 
diff --git a/WebKit/WebView.subproj/WebControllerPolicyHandler.h b/WebKit/WebView.subproj/WebControllerPolicyHandler.h
index 6cb393e..705276d 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyHandler.h
+++ b/WebKit/WebView.subproj/WebControllerPolicyHandler.h
@@ -5,7 +5,7 @@
         Public header file.
 */
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 /*
    ============================================================================= 
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index c1ba2e4..08822ea 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -18,9 +18,6 @@
 #import <WebFoundation/IFURLCacheLoaderConstants.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <rendering/render_frames.h>
-
-
 @implementation IFWebControllerPrivate
 
 - init 
diff --git a/WebKit/WebView.subproj/WebDOMNode.m b/WebKit/WebView.subproj/WebDOMNode.m
index 30dc4f9..a9cb8fb 100644
--- a/WebKit/WebView.subproj/WebDOMNode.m
+++ b/WebKit/WebView.subproj/WebDOMNode.m
@@ -10,9 +10,12 @@
 
 #import <WebKit/IFWebView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
+
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
 #import <khtml_part.h>
 #import <xml/dom_docimpl.h>
+#endif
 
 @implementation IFDOMNode
 
@@ -38,7 +41,7 @@
 
 - initWithWebView:(IFWebView *)view
 {
-    return [self initWithDOMNode:[[view documentView] _widget]->part()->xmlDocImpl()];
+    return [self initWithDOMNode:[(IFHTMLView *)[view documentView] _widget]->part()->xmlDocImpl()];
 }
 
 - (void)dealloc
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index dc3a26a..7a259bd 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -18,8 +18,6 @@
 #import <WebFoundation/IFFileTypeMappings.h>
 #import <WebFoundation/IFNSDictionaryExtensions.h>
 
-#import <xml/dom_docimpl.h>
-
 @implementation IFWebDataSource
 
 -(id)initWithURL:(NSURL *)theURL
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index aecc462..d937f2b 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -26,8 +26,6 @@
 #import <WebFoundation/IFNSURLExtensions.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <kurl.h>
-
 @implementation IFWebDataSourcePrivate 
 
 - init
diff --git a/WebKit/WebView.subproj/WebDebugDOMNode.m b/WebKit/WebView.subproj/WebDebugDOMNode.m
index 30dc4f9..a9cb8fb 100644
--- a/WebKit/WebView.subproj/WebDebugDOMNode.m
+++ b/WebKit/WebView.subproj/WebDebugDOMNode.m
@@ -10,9 +10,12 @@
 
 #import <WebKit/IFWebView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
+
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
 #import <khtml_part.h>
 #import <xml/dom_docimpl.h>
+#endif
 
 @implementation IFDOMNode
 
@@ -38,7 +41,7 @@
 
 - initWithWebView:(IFWebView *)view
 {
-    return [self initWithDOMNode:[[view documentView] _widget]->part()->xmlDocImpl()];
+    return [self initWithDOMNode:[(IFHTMLView *)[view documentView] _widget]->part()->xmlDocImpl()];
 }
 
 - (void)dealloc
diff --git a/WebKit/WebView.subproj/WebDocument.h b/WebKit/WebView.subproj/WebDocument.h
index f5c3223..5a2c3df 100644
--- a/WebKit/WebView.subproj/WebDocument.h
+++ b/WebKit/WebView.subproj/WebDocument.h
@@ -3,7 +3,7 @@
 	Copyright 2002, Apple, Inc. All rights reserved.
 */
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 @class IFWebDataSource;
 @class IFError;
diff --git a/WebKit/WebView.subproj/WebDynamicScrollBarsView.h b/WebKit/WebView.subproj/WebDynamicScrollBarsView.h
index ba9e4c0..7266e5a 100644
--- a/WebKit/WebView.subproj/WebDynamicScrollBarsView.h
+++ b/WebKit/WebView.subproj/WebDynamicScrollBarsView.h
@@ -8,7 +8,7 @@
 
 #import <Cocoa/Cocoa.h>
 
-#import <WebCoreFrameView.h>
+#import <WebCore/WebCoreFrameView.h>
 
 // FIXME 2980779: This has grown to be more than just a dynamic scroll bar view,
 // and it no longer works outside of WebKit.
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 1a4ccc8..dbdd497 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -21,8 +21,6 @@
 
 #import <WebKit/WebKitDebug.h>
 
-#import <rendering/render_frames.h>
-
 @implementation IFWebFrame
 
 - init
@@ -208,7 +206,7 @@
 {
     [_private setDataSource: nil];
     if ([[self webView] isDocumentHTML])
-        [[[self webView] documentView] _reset];
+        [(IFHTMLView *)[[self webView] documentView] _reset];
     [_private setWebView: nil];
 }
 
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 58b9b52..a4aff8e 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -12,10 +12,6 @@
 @class IFWebView;
 @protocol IFDocumentLoading;
 
-namespace khtml {
-    class RenderPart;
-}
-
 typedef enum {
     IFWEBFRAMESTATE_UNINITIALIZED = 1,
     IFWEBFRAMESTATE_PROVISIONAL = 2,
@@ -43,7 +39,6 @@ typedef enum {
     IFWebView *webView;
     IFWebDataSource *dataSource;
     IFWebDataSource *provisionalDataSource;
-    khtml::RenderPart *renderFramePart;
     IFWebController *controller;
     IFWebFrameState state;
     BOOL scheduledLayoutPending;
@@ -60,16 +55,12 @@ typedef enum {
 - (IFWebDataSource *)dataSource;
 - (void)setProvisionalDataSource: (IFWebDataSource *)d;
 - (IFWebDataSource *)provisionalDataSource;
-- (void)setRenderFramePart: (khtml::RenderPart *)p;
-- (khtml::RenderPart *)renderFramePart;
 
 @end
 
 @interface IFWebFrame (IFPrivate)
 - (void)_parentDataSourceWillBeDeallocated;
 - (void)_setController: (IFWebController *)controller;
-- (void)_setRenderFramePart: (khtml::RenderPart *)p;
-- (khtml::RenderPart *)_renderFramePart;
 - (void)_setDataSource: (IFWebDataSource *)d;
 - (void)_transitionProvisionalToCommitted;
 - (void)_transitionProvisionalToLayoutAcceptable;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 8097e22..746fafd 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -1,8 +1,12 @@
 /*	
     IFWebFramePrivate.mm
 	    
-    Copyright 2001, Apple, Inc. All rights reserved.
+    Copyright 2001, 2002, Apple Computer, Inc. All rights reserved.
 */
+
+#import <WebKit/IFWebFramePrivate.h>
+
+#import <WebKit/IFDocument.h>
 #import <WebKit/IFDynamicScrollBarsView.h>
 #import <WebKit/IFHTMLView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
@@ -14,17 +18,12 @@
 #import <WebKit/IFWebCoreFrame.h>
 #import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
-#import <WebKit/IFWebFramePrivate.h>
 #import <WebKit/IFWebKitErrors.h>
 #import <WebKit/IFWebViewPrivate.h>
 #import <WebKit/WebKitDebug.h>
 
 #import <WebFoundation/WebFoundation.h>
 
-// includes from kde
-#import <khtmlview.h>
-#import <rendering/render_frames.h>
-
 static const char * const stateNames[6] = {
     "zero state",
     "IFWEBFRAMESTATE_UNINITIALIZED",
@@ -48,8 +47,6 @@ static const char * const stateNames[6] = {
     [webView autorelease];
     [dataSource autorelease];
     [provisionalDataSource autorelease];
-    if (renderFramePart)
-        renderFramePart->deref();
     [bridgeFrame release];
     
     [super dealloc];
@@ -95,16 +92,6 @@ static const char * const stateNames[6] = {
     }
 }
 
-- (khtml::RenderPart *)renderFramePart { return renderFramePart; }
-- (void)setRenderFramePart: (khtml::RenderPart *)p 
-{
-    if (p)
-        p->ref();
-    if (renderFramePart)
-        renderFramePart->deref();
-    renderFramePart = p;
-}
-
 @end
 
 @implementation IFWebFrame (IFPrivate)
@@ -121,16 +108,6 @@ static const char * const stateNames[6] = {
     [_private setController: controller];
 }
 
-- (void)_setRenderFramePart: (khtml::RenderPart *)p
-{
-    [_private setRenderFramePart:p];
-}
-
-- (khtml::RenderPart *)_renderFramePart
-{
-    return [_private renderFramePart];
-}
-
 - (void)_setDataSource: (IFWebDataSource *)ds
 {
     [_private setDataSource: ds];
@@ -151,17 +128,17 @@ static const char * const stateNames[6] = {
     
     _private->scheduledLayoutPending = NO;
     if (_private->state == IFWEBFRAMESTATE_LAYOUT_ACCEPTABLE) {
-        id documentView = [[self webView] documentView];
+        NSView <IFDocumentView> *documentView = [[self webView] documentView];
         
         if ([self controller])
             WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s:  performing timed layout, %f seconds since start of document load\n", [[self name] cString], CFAbsoluteTimeGetCurrent() - [[[[self controller] mainFrame] dataSource] _loadingStartedTime]);
             
-        if([[self webView] isDocumentHTML]){
-            NSView *view = (NSView *)documentView;
+        if ([[self webView] isDocumentHTML]) {
+            IFHTMLView *htmlView = (IFHTMLView *)documentView;
             
-            [documentView setNeedsLayout: YES];
+            [htmlView setNeedsLayout: YES];
             
-            NSRect frame = [view frame];
+            NSRect frame = [htmlView frame];
             
             if (frame.size.width == 0 || frame.size.height == 0){
                 // We must do the layout now, rather than depend on
@@ -173,7 +150,7 @@ static const char * const stateNames[6] = {
                 // check to see if any CSS is pending and delay
                 // the layout further to avoid the flash of unstyled
                 // content.                    
-                [documentView layout];
+                [htmlView layout];
             }
         }
             
@@ -238,8 +215,7 @@ static const char * const stateNames[6] = {
 - (void)_transitionProvisionalToCommitted
 {
     WEBKIT_ASSERT ([self controller] != nil);
-    id documentView = [[self webView] documentView];
-    BOOL isDocumentHTML = [[self webView] isDocumentHTML];
+    NSView <IFDocumentView> *documentView = [[self webView] documentView];
     
     switch ([self _state]) {
     	case IFWEBFRAMESTATE_PROVISIONAL:
@@ -253,15 +229,6 @@ static const char * const stateNames[6] = {
             // display the new new datasource.
             [documentView provisionalDataSourceCommitted: _private->provisionalDataSource];
  
-            // If we're a frame (not the main frame) hookup the kde internals.  This introduces a nasty dependency 
-            // in kde on the view.
-            khtml::RenderPart *renderPartFrame = [self _renderFramePart];
-            if (renderPartFrame && isDocumentHTML) {
-                // Setting the widget will delete the previous KHTMLView associated with the frame.
-                [documentView _takeOwnershipOfWidget];
-                renderPartFrame->setWidget([documentView _widget]);
-            }
-           
             // Now that the provisional data source is committed, release it.
             [_private setProvisionalDataSource: nil];
         
@@ -367,10 +334,10 @@ static const char * const stateNames[6] = {
             //WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "%s:  checking complete, current state IFWEBFRAMESTATE_COMMITTED\n", [[self name] cString]);
             if (![ds isLoading]) {
                 id mainView = [[[self controller] mainFrame] webView];
-                id mainDocumentView = [mainView documentView];
+                NSView <IFDocumentView> *mainDocumentView = [mainView documentView];
 #if 0
                 id thisView = [self webView];
-                id thisDocumentView = [thisView documentView];
+                NSView <IFDocumentView> *thisDocumentView = [thisView documentView];
 #endif
                 [self _setState: IFWEBFRAMESTATE_COMPLETE];
                 
@@ -380,8 +347,8 @@ static const char * const stateNames[6] = {
                 // it may change the size of frames.
                 // FIXME:  Why is this necessary? and recurse.
                 {
-                    if ([mainView isDocumentHTML]){
-                        [mainDocumentView setNeedsLayout: YES];
+                    if ([mainView isDocumentHTML]) {
+                        [(IFHTMLView *)mainDocumentView setNeedsLayout: YES];
                     }
                     [mainDocumentView layout];
                     
diff --git a/WebKit/WebView.subproj/WebFrameView.h b/WebKit/WebView.subproj/WebFrameView.h
index 8ce3430..294de24 100644
--- a/WebKit/WebView.subproj/WebFrameView.h
+++ b/WebKit/WebView.subproj/WebFrameView.h
@@ -15,6 +15,7 @@
 @class IFWebController;
 @class IFWebViewPrivate;
 @protocol IFDocumentLoading;
+ at protocol IFDocumentView;
 
 @interface IFWebView : NSView
 {
@@ -28,9 +29,9 @@
 - (IFWebController *)controller;
 
 - frameScrollView;
-- documentView;
+- (NSView <IFDocumentView> *)documentView;
 
-- (BOOL) isDocumentHTML;
+- (BOOL)isDocumentHTML;
 
 - (void)setAllowsScrolling: (BOOL)flag;
 - (BOOL)allowsScrolling;
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 6ec8e5c..ac5e0c7 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -10,6 +10,7 @@
 #import <WebKit/IFNSViewExtras.h>
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFWebCoreBridge.h>
+#import <WebKit/IFWebCoreFrame.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFWebViewPrivate.h>
@@ -18,14 +19,10 @@
 // Needed for the mouse move notification.
 #import <AppKit/NSResponder_Private.h>
 
-// KDE related includes
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
-#import <qpainter.h>
-#import <qevent.h>
-#import <html/html_documentimpl.h>
-#import <rendering/render_object.h>
-
-#import <KWQKHTMLPartImpl.h>
+#import <rendering/render_frames.h>
+#endif
 
 @implementation IFHTMLView
 
@@ -128,57 +125,55 @@
 // the data source is changed.
 - (void)provisionalDataSourceChanged:(IFWebDataSource *)dataSource 
 {
-    IFWebCoreBridge *bridge = [dataSource _bridge];
-
-    IFHTMLView *provisionalView = [[[dataSource webFrame] webView] documentView];
-    
-    NSRect r = [self frame];
-    
-    _private->provisionalWidget = [bridge createKHTMLViewWithNSView:provisionalView
-	width:(int)r.size.width height:(int)r.size.height
+    _private->provisionalWidget = [[dataSource _bridge]
+        createKHTMLViewWithNSView:[[[dataSource webFrame] webView] documentView]
+	width:(int)[self frame].size.width height:(int)[self frame].size.height
         marginWidth:[[[dataSource webFrame] webView] _marginWidth]
         marginHeight:[[[dataSource webFrame] webView] _marginHeight]];
 }
 
-- (void)provisionalDataSourceCommitted: (IFWebDataSource *)dataSource 
+- (void)provisionalDataSourceCommitted:(IFWebDataSource *)dataSource 
 {
-    IFHTMLViewPrivate *data = _private;
-    IFWebView *webView = [self _IF_parentWebView];
-    id frameScrollView = [webView frameScrollView];
-    
-    data->provisionalWidget->setView (frameScrollView);
+    if (_private->widgetOwned) {
+        delete _private->widget;
+    }
+
+    _private->widget = _private->provisionalWidget;
+    _private->widgetOwned = YES;
+    _private->provisionalWidget = 0;
 
-    if (data->widgetOwned)
-        delete data->widget;
+    _private->widget->setView([[self _IF_parentWebView] frameScrollView]);
 
-    data->widget = data->provisionalWidget;
-    data->widgetOwned = YES;
-    data->provisionalWidget = 0;
+    KHTMLRenderPart *renderPart = [[[self _bridge] frame] renderPart];
+    if (renderPart) {
+        // Setting the widget will delete the previous KHTMLView associated with the frame.
+        _private->widgetOwned = NO;
+        renderPart->setWidget(_private->widget);
+    }
 }
 
-- (void)dataSourceUpdated: (IFWebDataSource *)dataSource
+- (void)dataSourceUpdated:(IFWebDataSource *)dataSource
 {
 }
 
 - (void)reapplyStyles
 {
-    KHTMLView *widget = _private->widget;
-
-    if (widget && widget->part()->xmlDocImpl() && 
-        widget->part()->xmlDocImpl()->renderer()) {
-        if (_private->needsToApplyStyles){
+    if (!_private->needsToApplyStyles) {
+        return;
+    }
+    
 #ifdef _KWQ_TIMING        
     double start = CFAbsoluteTimeGetCurrent();
 #endif
-            widget->part()->xmlDocImpl()->updateStyleSelector();
-            _private->needsToApplyStyles = NO;
+
+    [[self _bridge] reapplyStyles];
+    
 #ifdef _KWQ_TIMING        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s apply style seconds = %f\n", widget->part()->baseURL().url().latin1(), thisTime);
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_TIMING, "%s apply style seconds = %f\n", [self URL], thisTime);
 #endif
-        }
-    }
 
+    _private->needsToApplyStyles = NO;
 }
 
 
@@ -186,32 +181,26 @@
 // understood how IFWebView will be subclassed.
 - (void)layout
 {
-    KHTMLView *widget = _private->widget;
-
     // Ensure that we will receive mouse move events.  Is this the best place to put this?
     [[self window] setAcceptsMouseMovedEvents: YES];
     [[self window] _setShouldPostEventNotifications: YES];
 
-    if (widget && widget->part()->xmlDocImpl() && 
-        widget->part()->xmlDocImpl()->renderer() &&
-        _private->needsLayout){
- #ifdef _KWQ_TIMING        
+    if (!_private->needsLayout) {
+        return;
+    }
+
+#ifdef _KWQ_TIMING        
     double start = CFAbsoluteTimeGetCurrent();
- #endif
+#endif
 
-        widget->part()->xmlDocImpl()->renderer()->setLayouted(false);
-        WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "%s doing layout\n", DEBUG_OBJECT(self));
-        widget->layout();
-        _private->needsLayout = NO;
- #ifdef _KWQ_TIMING        
-    double thisTime = CFAbsoluteTimeGetCurrent() - start;
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_TIMING, "%s layout seconds = %f\n", widget->part()->baseURL().url().latin1(), thisTime);
- #endif
-    }
-    else {
-        WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "%s NOT doing layout\n", DEBUG_OBJECT(self));
-    }
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_VIEW, "%s doing layout\n", DEBUG_OBJECT(self));
+    [[self _bridge] forceLayout];
+    _private->needsLayout = NO;
 
+#ifdef _KWQ_TIMING        
+    double thisTime = CFAbsoluteTimeGetCurrent() - start;
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_TIMING, "%s layout seconds = %f\n", [self URL], thisTime);
+#endif
 }
 
 
@@ -317,21 +306,8 @@
 
 
 // This should eventually be removed.
-- (void)drawRect:(NSRect)rect {
-    KHTMLView *widget = _private->widget;
-    //IFWebViewPrivate *data = _private;
-
-    //if (data->provisionalWidget != 0){
-    //    WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "not drawing, frame in provisional state.\n");
-    //    return;
-    //}
-    
-    if (widget == 0) {
-        // This used to fill with white, but the window-with-no-content case is now handled
-        // by IFHTMLView.
-        return;
-    }
-
+- (void)drawRect:(NSRect)rect
+{
     WEBKITDEBUGLEVEL (WEBKIT_LOG_VIEW, "%s drawing\n", DEBUG_OBJECT(self));
 
     [self reapplyStyles];
@@ -341,15 +317,11 @@
 #ifdef _KWQ_TIMING
     double start = CFAbsoluteTimeGetCurrent();
 #endif
-    QPainter p(widget);
 
     [self lockFocus];
-
+    
     //double start = CFAbsoluteTimeGetCurrent();
-    widget->drawContents( &p, (int)rect.origin.x,
-                              (int)rect.origin.y,
-                              (int)rect.size.width,
-                               (int)rect.size.height );
+    [[self _bridge] drawRect:rect];
     //WebKitDebugAtLevel (WEBKIT_LOG_TIMING, "draw time %e\n", CFAbsoluteTimeGetCurrent() - start);
 
 #ifdef DEBUG_LAYOUT
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index 5f6ba07..53a9857 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -40,6 +40,5 @@ class KHTMLView;
 
 - (KHTMLView *)_widget;
 - (KHTMLView *)_provisionalWidget;
-- (void)_takeOwnershipOfWidget;
 - (IFWebCoreBridge *)_bridge;
 @end
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index bb18a2f..45d1aee 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -16,8 +16,22 @@
 #import <WebKit/IFWebFramePrivate.h>
 #import <WebKit/IFWebViewPrivate.h>
 
-// Includes from KDE
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
 #import <khtmlview.h>
+#endif
+
+ at interface NSView (IFHTMLViewPrivate)
+- (void)_IF_stopIfPluginView;
+ at end
+
+ at implementation NSView (IFHTMLViewPrivate)
+- (void)_IF_stopIfPluginView
+{
+    if ([self isKindOfClass:[IFPluginView class]]) {
+        [(IFPluginView *)self stop];
+    }
+}
+ at end
 
 @implementation IFHTMLViewPrivate
 
@@ -35,19 +49,11 @@
 - (void)_reset
 {
     NSArray *subviews = [[self subviews] copy];
+    [subviews makeObjectsPerformSelector:@selector(_IF_stopIfPluginView)];
+    [subviews release];
 
     [IFImageRenderer stopAnimationsInView: self];
     
-    int count = [subviews count];
-    while (count--) {
-        id view = [subviews objectAtIndex:count];
-        if ([view isKindOfClass:[IFPluginView class]]) {
-            IFPluginView *pluginView = (IFPluginView *)view;
-            [pluginView stop];
-        }
-    }
-    [subviews release];
-
     delete _private->provisionalWidget;
     _private->provisionalWidget = 0;
     if (_private->widgetOwned)
@@ -72,11 +78,6 @@
     return _private->provisionalWidget;    
 }
 
-- (void)_takeOwnershipOfWidget
-{
-    _private->widgetOwned = NO;
-}
-
 // Required so view can access the part's selection.
 - (IFWebCoreBridge *)_bridge
 {
diff --git a/WebKit/WebView.subproj/WebImageView.h b/WebKit/WebView.subproj/WebImageView.h
index 3688cab..e1f78b7 100644
--- a/WebKit/WebView.subproj/WebImageView.h
+++ b/WebKit/WebView.subproj/WebImageView.h
@@ -5,7 +5,6 @@
 
 #import <Cocoa/Cocoa.h>
 
- at class IFWebDataSource;
 @class IFImageRepresentation;
 @protocol IFDocumentLoading;
 @protocol IFDocumentDragSettings;
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index 8f870e7..c0fefd8 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -30,49 +30,39 @@
     [super dealloc];
 }
 
-
 - (BOOL)isFlipped 
 {
     return YES;
 }
 
-
 - (void)drawRect:(NSRect)rect
 {
     [[representation image] beginAnimationInRect:[self frame] fromRect:[self frame]];
 }
 
-
 - (void)provisionalDataSourceChanged:(IFWebDataSource *)dataSource
 {
-
 }
 
-
 - (void)provisionalDataSourceCommitted:(IFWebDataSource *)dataSource
 {
     representation = [[dataSource representation] retain];
 }
 
-
 - (void)dataSourceUpdated:(IFWebDataSource *)dataSource
 {
-
 }
 
-
 - (void)layout
 {
     IFImageRenderer *image = [representation image];
-    
-    if(image){
+    if (image) {
         [self setFrameSize:[image size]];
         [image setFlipped:YES];
     }
 
 }
 
-
 - (void)setCanDragFrom: (BOOL)flag
 {
     canDragFrom = flag;
@@ -83,19 +73,16 @@
     return canDragFrom;
 }
 
-
 - (void)setCanDragTo: (BOOL)flag
 {
     canDragTo = flag;
 }
 
-
 - (BOOL)canDragTo
 {
     return canDragTo;
 }
 
-
 - (void)viewDidMoveToWindow
 {
     if (![self window])
@@ -103,5 +90,4 @@
     [super viewDidMoveToWindow];
 }
 
-
 @end
diff --git a/WebKit/WebView.subproj/WebPolicyDelegate.h b/WebKit/WebView.subproj/WebPolicyDelegate.h
index 6cb393e..705276d 100644
--- a/WebKit/WebView.subproj/WebPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebPolicyDelegate.h
@@ -5,7 +5,7 @@
         Public header file.
 */
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 /*
    ============================================================================= 
diff --git a/WebKit/WebView.subproj/WebRenderNode.m b/WebKit/WebView.subproj/WebRenderNode.m
index 376df90..1aa61ae 100644
--- a/WebKit/WebView.subproj/WebRenderNode.m
+++ b/WebKit/WebView.subproj/WebRenderNode.m
@@ -10,11 +10,16 @@
 
 #import <WebKit/IFWebView.h>
 #import <WebKit/IFHTMLViewPrivate.h>
+
+#ifndef WEBKIT_INDEPENDENT_OF_WEBCORE
+
 #import <khtmlview.h>
 #import <khtml_part.h>
 #import <xml/dom_docimpl.h>
 #import <rendering/render_frames.h>
 
+#endif
+
 @implementation IFRenderNode
 
 - initWithRenderObject:(khtml::RenderObject *)node
@@ -55,7 +60,7 @@
 
 - initWithWebView:(IFWebView *)view
 {
-    return [self initWithRenderObject:[[view documentView] _widget]->part()->xmlDocImpl()->renderer()];
+    return [self initWithRenderObject:[(IFHTMLView *)[view documentView] _widget]->part()->xmlDocImpl()->renderer()];
 }
 
 - (void)dealloc
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index f99f90f..3740dd5 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -158,7 +158,7 @@
 
 // FIXME:  Should this method be private?
 // Called when a data source needs to create a frame.  This method encapsulates the
-// specifics of creating and initializaing a view of the appropriate class.
+// specifics of creating and initializing a view of the appropriate class.
 - (IFWebFrame *)createFrameNamed: (NSString *)fname for: (IFWebDataSource *)child inParent: (IFWebDataSource *)parent allowsScrolling: (BOOL)allowsScrolling;
 
 // Look for a frame named name, recursively.
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index c1ba2e4..08822ea 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -18,9 +18,6 @@
 #import <WebFoundation/IFURLCacheLoaderConstants.h>
 #import <WebFoundation/IFURLHandle.h>
 
-#import <rendering/render_frames.h>
-
-
 @implementation IFWebControllerPrivate
 
 - init 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list