[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:26:56 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b3445ef04bb6301d0a7a72cbe2a3c4b9f67512d1
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 24 17:31:36 2002 +0000

    	- fixed 2949235 -- checkboxes in wrong place until you scroll away and back
    
    	The problem here was that we put views in when we print, but we never removed them.
    	I added code to keep track of existing views, and remove them if they are not re-added.
    
            * kwq/KWQKHTMLPartImpl.h: Add paint, addedWidget, buildViewsNotAddedSet, and viewsNotYetAdded.
    	It might be nice to find a different place to hang this that is not included by the KHTML code.
    	But I think that having this on the bridge would be worse.
            * kwq/KWQKHTMLPartImpl.mm:
            (KWQKHTMLPartImpl::paint): Added. Removes any views that are not explicitly added by RenderWidget
    	during the print process.
            (KWQKHTMLPartImpl::addedWidget): Added. Called by KWQScrollView to tell us a view was added.
            (KWQKHTMLPartImpl::buildViewsNotYetAddedSet): Added. Used to build the initial set of views.
    
            * kwq/KWQScrollView.mm: (QScrollView::addChild): Added call to KWQKHTMLPartImpl::addedWidget.
            * kwq/WebCoreBridge.mm: (-[WebCoreBridge drawRect:withPainter:]): Calls KWQKHTMLPartImpl::paint.
    
            * kwq/KWQWindowWidget.mm: (KWQWindowWidget::frameGeometry), (KWQWindowWidget::mapToGlobal),
    	(KWQWindowWidget::mapFromGlobal), (KWQWindowWidget::internalSetGeometry):
    	Fixed logic to work properly for windows not on main screen.
    
            * khtml/khtml_part.cpp: Moved the boundary of an existing ifndef APPLE_CHANGES so that
    	KHTMLPart::show() and hide() are not compiled, mainly for clarity.
            * khtml/rendering/render_replaced.cpp: (RenderWidget::detach): Removed unneeded APPLE_CHANGES.
    
            * kwq/KWQWindowWidget.h: Removed some unneeded virtual functions.
            * kwq/qt/qscrollview.h: Removed some unneeded virtual functions, made others non-virtual.
            * kwq/qt/qwidget.h: Removed some unneeded virtual functions, made others non-virtual.
            * kwq/KWQWidget.mm: Removed a lot of unused and unneeded stuff.
    
            * force-clean-timestamp: Needed to do this because I changed header files.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1653 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 0a7ec55..127a694 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,39 @@
 2002-07-24  Darin Adler  <darin at apple.com>
 
+	- fixed 2949235 -- checkboxes in wrong place until you scroll away and back
+
+	The problem here was that we put views in when we print, but we never removed them.
+	I added code to keep track of existing views, and remove them if they are not re-added.
+
+        * kwq/KWQKHTMLPartImpl.h: Add paint, addedWidget, buildViewsNotAddedSet, and viewsNotYetAdded.
+	It might be nice to find a different place to hang this that is not included by the KHTML code.
+	But I think that having this on the bridge would be worse.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::paint): Added. Removes any views that are not explicitly added by RenderWidget
+	during the print process.
+        (KWQKHTMLPartImpl::addedWidget): Added. Called by KWQScrollView to tell us a view was added.
+        (KWQKHTMLPartImpl::buildViewsNotYetAddedSet): Added. Used to build the initial set of views.
+
+        * kwq/KWQScrollView.mm: (QScrollView::addChild): Added call to KWQKHTMLPartImpl::addedWidget.
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge drawRect:withPainter:]): Calls KWQKHTMLPartImpl::paint.
+
+        * kwq/KWQWindowWidget.mm: (KWQWindowWidget::frameGeometry), (KWQWindowWidget::mapToGlobal),
+	(KWQWindowWidget::mapFromGlobal), (KWQWindowWidget::internalSetGeometry):
+	Fixed logic to work properly for windows not on main screen.
+
+        * khtml/khtml_part.cpp: Moved the boundary of an existing ifndef APPLE_CHANGES so that
+	KHTMLPart::show() and hide() are not compiled, mainly for clarity.
+        * khtml/rendering/render_replaced.cpp: (RenderWidget::detach): Removed unneeded APPLE_CHANGES.
+
+        * kwq/KWQWindowWidget.h: Removed some unneeded virtual functions.
+        * kwq/qt/qscrollview.h: Removed some unneeded virtual functions, made others non-virtual.
+        * kwq/qt/qwidget.h: Removed some unneeded virtual functions, made others non-virtual.
+        * kwq/KWQWidget.mm: Removed a lot of unused and unneeded stuff.
+
+        * force-clean-timestamp: Needed to do this because I changed header files.
+
+2002-07-24  Darin Adler  <darin at apple.com>
+
 	- fixed 3006329 - space should be stripped from beginning of relative url
 
         * kwq/KWQKURL.mm: (KURL::normalizeRelativeURLString): Added a call to stripWhiteSpace.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 0a7ec55..127a694 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,39 @@
 2002-07-24  Darin Adler  <darin at apple.com>
 
+	- fixed 2949235 -- checkboxes in wrong place until you scroll away and back
+
+	The problem here was that we put views in when we print, but we never removed them.
+	I added code to keep track of existing views, and remove them if they are not re-added.
+
+        * kwq/KWQKHTMLPartImpl.h: Add paint, addedWidget, buildViewsNotAddedSet, and viewsNotYetAdded.
+	It might be nice to find a different place to hang this that is not included by the KHTML code.
+	But I think that having this on the bridge would be worse.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::paint): Added. Removes any views that are not explicitly added by RenderWidget
+	during the print process.
+        (KWQKHTMLPartImpl::addedWidget): Added. Called by KWQScrollView to tell us a view was added.
+        (KWQKHTMLPartImpl::buildViewsNotYetAddedSet): Added. Used to build the initial set of views.
+
+        * kwq/KWQScrollView.mm: (QScrollView::addChild): Added call to KWQKHTMLPartImpl::addedWidget.
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge drawRect:withPainter:]): Calls KWQKHTMLPartImpl::paint.
+
+        * kwq/KWQWindowWidget.mm: (KWQWindowWidget::frameGeometry), (KWQWindowWidget::mapToGlobal),
+	(KWQWindowWidget::mapFromGlobal), (KWQWindowWidget::internalSetGeometry):
+	Fixed logic to work properly for windows not on main screen.
+
+        * khtml/khtml_part.cpp: Moved the boundary of an existing ifndef APPLE_CHANGES so that
+	KHTMLPart::show() and hide() are not compiled, mainly for clarity.
+        * khtml/rendering/render_replaced.cpp: (RenderWidget::detach): Removed unneeded APPLE_CHANGES.
+
+        * kwq/KWQWindowWidget.h: Removed some unneeded virtual functions.
+        * kwq/qt/qscrollview.h: Removed some unneeded virtual functions, made others non-virtual.
+        * kwq/qt/qwidget.h: Removed some unneeded virtual functions, made others non-virtual.
+        * kwq/KWQWidget.mm: Removed a lot of unused and unneeded stuff.
+
+        * force-clean-timestamp: Needed to do this because I changed header files.
+
+2002-07-24  Darin Adler  <darin at apple.com>
+
 	- fixed 3006329 - space should be stripped from beginning of relative url
 
         * kwq/KWQKURL.mm: (KURL::normalizeRelativeURLString): Added a call to stripWhiteSpace.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0a7ec55..127a694 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,39 @@
 2002-07-24  Darin Adler  <darin at apple.com>
 
+	- fixed 2949235 -- checkboxes in wrong place until you scroll away and back
+
+	The problem here was that we put views in when we print, but we never removed them.
+	I added code to keep track of existing views, and remove them if they are not re-added.
+
+        * kwq/KWQKHTMLPartImpl.h: Add paint, addedWidget, buildViewsNotAddedSet, and viewsNotYetAdded.
+	It might be nice to find a different place to hang this that is not included by the KHTML code.
+	But I think that having this on the bridge would be worse.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::paint): Added. Removes any views that are not explicitly added by RenderWidget
+	during the print process.
+        (KWQKHTMLPartImpl::addedWidget): Added. Called by KWQScrollView to tell us a view was added.
+        (KWQKHTMLPartImpl::buildViewsNotYetAddedSet): Added. Used to build the initial set of views.
+
+        * kwq/KWQScrollView.mm: (QScrollView::addChild): Added call to KWQKHTMLPartImpl::addedWidget.
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge drawRect:withPainter:]): Calls KWQKHTMLPartImpl::paint.
+
+        * kwq/KWQWindowWidget.mm: (KWQWindowWidget::frameGeometry), (KWQWindowWidget::mapToGlobal),
+	(KWQWindowWidget::mapFromGlobal), (KWQWindowWidget::internalSetGeometry):
+	Fixed logic to work properly for windows not on main screen.
+
+        * khtml/khtml_part.cpp: Moved the boundary of an existing ifndef APPLE_CHANGES so that
+	KHTMLPart::show() and hide() are not compiled, mainly for clarity.
+        * khtml/rendering/render_replaced.cpp: (RenderWidget::detach): Removed unneeded APPLE_CHANGES.
+
+        * kwq/KWQWindowWidget.h: Removed some unneeded virtual functions.
+        * kwq/qt/qscrollview.h: Removed some unneeded virtual functions, made others non-virtual.
+        * kwq/qt/qwidget.h: Removed some unneeded virtual functions, made others non-virtual.
+        * kwq/KWQWidget.mm: Removed a lot of unused and unneeded stuff.
+
+        * force-clean-timestamp: Needed to do this because I changed header files.
+
+2002-07-24  Darin Adler  <darin at apple.com>
+
 	- fixed 3006329 - space should be stripped from beginning of relative url
 
         * kwq/KWQKURL.mm: (KURL::normalizeRelativeURLString): Added a call to stripWhiteSpace.
diff --git a/WebCore/force-clean-timestamp b/WebCore/force-clean-timestamp
index ab7c11f..1e99be8 100644
--- a/WebCore/force-clean-timestamp
+++ b/WebCore/force-clean-timestamp
@@ -1 +1 @@
-QFont change 7/23 (and Project Builder bug 3005427)
\ No newline at end of file
+QWidget change 7/24 (and Project Builder bug 3005427)
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 42574b3..8641515 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -3672,8 +3672,6 @@ void KHTMLPart::restoreState( QDataStream &stream )
 
 }
 
-#endif
-
 void KHTMLPart::show()
 {
   if ( d->m_view )
@@ -3686,6 +3684,8 @@ void KHTMLPart::hide()
     d->m_view->hide();
 }
 
+#endif // APPLE_CHANGES
+
 DOM::Node KHTMLPart::nodeUnderMouse() const
 {
     return d->m_view->nodeUnderMouse();
diff --git a/WebCore/khtml/rendering/render_replaced.cpp b/WebCore/khtml/rendering/render_replaced.cpp
index 118789f..b61df22 100644
--- a/WebCore/khtml/rendering/render_replaced.cpp
+++ b/WebCore/khtml/rendering/render_replaced.cpp
@@ -140,11 +140,8 @@ void RenderWidget::detach()
         if ( m_view )
             m_view->removeChild( m_widget );
 
-#ifndef APPLE_CHANGES
-        // Referencing the widget here is not safe.
         m_widget->removeEventFilter( this );
         m_widget->setMouseTracking( false );
-#endif
     }
     deref();
 }
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 920d95f..ed2c8ea 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -43,13 +43,16 @@ namespace DOM {
 }
 
 namespace khtml {
+    class RenderObject;
     class RenderPart;
 }
 
 #ifdef __OBJC__
 @class WebCoreBridge;
+ at class NSMutableSet;
 #else
 class WebCoreBridge;
+class NSMutableSet;
 #endif
 
 class KWQKHTMLPartImpl : public QObject
@@ -104,7 +107,13 @@ public:
 
     bool isFrameSet();
 
-    void overURL( const QString &url, const QString &target, int modifierState);
+    void overURL(const QString &url, const QString &target, int modifierState);
+
+    // Draw the contents of the view, with the side effect of putting all the widgets into place.
+    void paint(QPainter &, int x, int y, int width, int height);
+    
+    // Used by KWQWidget to tell the paint call that this widget should stay.
+    static void addedWidget(QWidget *);
 
 private:
     KHTMLPart *part;
@@ -118,6 +127,9 @@ private:
     QString m_documentSource;
     bool m_decodingStarted;
     
+    static void buildViewsNotYetAddedSet(khtml::RenderObject *);
+    static NSMutableSet *viewsNotYetAdded;
+    
     friend class KHTMLPart;
 };
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 218d97f..28632ca 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -39,18 +39,12 @@
 
 #undef _KWQ_TIMING
 
-static void recursive(const DOM::Node &pNode, const DOM::Node &node)
-{
-    DOM::Node cur_child = node.lastChild();
+using khtml::Decoder;
+using khtml::RenderObject;
+using khtml::RenderPart;
+using khtml::RenderWidget;
 
-    KWQDEBUG("cur_child: %s = %s", cur_child.nodeName().string().latin1(), cur_child.nodeValue().string().latin1());
-
-    while(!cur_child.isNull())
-    {
-        recursive(node, cur_child);
-        cur_child = cur_child.previousSibling();
-    }
-}
+NSMutableSet *KWQKHTMLPartImpl::viewsNotYetAdded = nil;
 
 void KHTMLPart::onURL(const QString &)
 {
@@ -240,7 +234,7 @@ void KWQKHTMLPartImpl::write( const char *str, int len )
 
     // begin lines added in lieu of big fixme    
     if ( !d->m_decoder ) {
-        d->m_decoder = new khtml::Decoder();
+        d->m_decoder = new Decoder();
         if(!d->m_encoding.isNull())
             d->m_decoder->setEncoding(d->m_encoding.latin1(), d->m_haveEncoding);
         else {
@@ -424,7 +418,7 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
     [frame loadURL:clickedURL.getNSURL()];
 }
 
-bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
+bool KWQKHTMLPartImpl::requestFrame( RenderPart *frame, const QString &url, const QString &frameName,
                                      const QStringList &params, bool isIFrame )
 {
     KWQ_ASSERT(!frameExists(frameName));
@@ -449,7 +443,7 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     {
         // static cast is safe as of isIFrame being false.
         // but: shouldn't we support this javascript hack for iframes aswell?
-        khtml::RenderFrame* rf = static_cast<khtml::RenderFrame*>(frame);
+        RenderFrame* rf = static_cast<RenderFrame*>(frame);
         assert(rf);
         QVariant res = executeScript( DOM::Node(rf->frameImpl()), url.right( url.length() - 11) );
         if ( res.type() == QVariant::String ) {
@@ -465,7 +459,7 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     return true;
 }
 
-bool KWQKHTMLPartImpl::requestObject(khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
+bool KWQKHTMLPartImpl::requestObject(RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
 {
     if (url.isEmpty()) {
         return false;
@@ -666,67 +660,118 @@ void KWQKHTMLPartImpl::unfocusWindow()
     [bridge unfocusWindow];
 }
 
-
 void KWQKHTMLPartImpl::overURL( const QString &url, const QString &target, int modifierState)
 {
-  if (url.isEmpty()) {
-      setStatusBarText(QString());
-      return;
-  }
-
-  NSString *message;
+    if (url.isEmpty()) {
+        setStatusBarText(QString());
+        return;
+    }
 
-  // FIXME: This would do strange things with a link that said "xjavascript:".
-  int position = url.find("javascript:", 0, false);
-  if (position != -1) {
-      // FIXME: Is it worthwhile to special-case scripts that do a window.open and nothing else?
-      const QString scriptName = url.mid(position + strlen("javascript:"));
-      message = [NSString stringWithFormat:@"Run script \"%@\"", scriptName.getNSString()];
-      setStatusBarText(QString::fromNSString(message));
-      return;
-  }
+    NSString *message;
+    
+    // FIXME: This would do strange things with a link that said "xjavascript:".
+    int position = url.find("javascript:", 0, false);
+    if (position != -1) {
+        // FIXME: Is it worthwhile to special-case scripts that do a window.open and nothing else?
+        const QString scriptName = url.mid(position + strlen("javascript:"));
+        message = [NSString stringWithFormat:@"Run script \"%@\"", scriptName.getNSString()];
+        setStatusBarText(QString::fromNSString(message));
+        return;
+    }
+    
+    KURL u = part->completeURL(url);
+    
+    if (u.protocol() == QString("mailto")) {
+        // FIXME: addressbook integration? probably not worth it...
+        
+        setStatusBarText(QString::fromNSString([NSString stringWithFormat:@"Send email to %@", KURL::decode_string(u.path()).getNSString()]));
+        return;
+    }
+    
+    NSString *format;
+    
+    if (target == QString("_blank")) {
+        // FIXME: should use curly quotes
+        format = @"Open \"%@\" in a new window";
+        
+    } else if (!target.isEmpty() &&
+                (target != QString("_top")) &&
+                (target != QString("_self")) &&
+                (target != QString("_parent"))) {
+        if (frameExists(target)) {
+            // FIXME: distinguish existing frame in same window from
+            // existing frame name for other window
+            format = @"Go to \"%@\" in another frame";
+        } else {
+            format = @"Open \"%@\" in a new window";
+        }
+    } else {
+        format = @"Go to \"%@\"";
+    }
+    
+    if ([bridge modifierTrackingEnabled]) {
+        if (modifierState & MetaButton) {
+            if (modifierState & ShiftButton) {
+                format = @"Open \"%@\" in a new window, behind the current window";
+            } else {
+                format = @"Open \"%@\" in a new window";
+            }
+        } else if (modifierState & AltButton) {
+            format = @"Download \"%@\"";
+        }
+    }
+    
+    setStatusBarText(QString::fromNSString([NSString stringWithFormat:format, url.getNSString()]));
+}
 
-  KURL u = part->completeURL(url);
+void KWQKHTMLPartImpl::paint(QPainter &p, int x, int y, int width, int height)
+{
+    DOM::DocumentImpl *doc = part->xmlDocImpl();
+    if (!doc) {
+        return;
+    }
+    RenderObject *renderer = doc->renderer();
+    if (!renderer) {
+        return;
+    }
+    
+    // Walk the render tree, putting all the views into a set.
+    KWQ_ASSERT(viewsNotYetAdded == nil);
+    viewsNotYetAdded = [[NSMutableSet alloc] init];
+    buildViewsNotYetAddedSet(renderer);
+    
+    // We will remove views from the set when the corresponding widget gets an addChild call.
+    
+    renderer->print(&p, x, y, width, height, 0, 0);
 
-  if (u.protocol() == QString("mailto")) {
-      // FIXME: addressbook integration? probably not worth it...
-      
-      setStatusBarText(QString::fromNSString([NSString stringWithFormat:@"Send email to %@", KURL::decode_string(u.path()).getNSString()]));
-      return;
-  }
+    // Call removeFromSuperview on any that are still in the set at the end.
+    [viewsNotYetAdded makeObjectsPerformSelector:@selector(removeFromSuperview)];
+    [viewsNotYetAdded release];
+    viewsNotYetAdded = nil;
+}
 
-  NSString *format;
-
-  if (target == QString("_blank")) {
-      // FIXME: should use curly quotes
-      format = @"Open \"%@\" in a new window";
-      
-  } else if (!target.isEmpty() &&
-             (target != QString("_top")) &&
-             (target != QString("_self")) &&
-             (target != QString("_parent"))) {
-      if (frameExists(target)) {
-	  // FIXME: distinguish existing frame in same window from
-	  // existing frame name for other window
-          format = @"Go to \"%@\" in another frame";
-      } else {
-	  format = @"Open \"%@\" in a new window";
-      }
-  } else {
-      format = @"Go to \"%@\"";
-  }
+void KWQKHTMLPartImpl::addedWidget(QWidget *widget)
+{
+    NSView *view = widget->getView();
+    if (view) {
+        [viewsNotYetAdded removeObject:view];
+    }
+}
 
-  if ([bridge modifierTrackingEnabled]) {
-      if (modifierState & MetaButton) {
-	  if (modifierState & ShiftButton) {
-	      format = @"Open \"%@\" in a new window, behind the current window";
-	  } else {
-	      format = @"Open \"%@\" in a new window";
-	  }
-      } else if (modifierState & AltButton) {
-	  format = @"Download \"%@\"";
-      }
-  }
-  
-  setStatusBarText(QString::fromNSString([NSString stringWithFormat:format, url.getNSString()]));
+void KWQKHTMLPartImpl::buildViewsNotYetAddedSet(RenderObject *renderObject)
+{
+    RenderWidget *renderWidget = dynamic_cast<RenderWidget *>(renderObject);
+    if (renderWidget) {
+        QWidget *widget = renderWidget->widget();
+        if (widget) {
+            NSView *view = widget->getView();
+            if (view) {
+                [viewsNotYetAdded addObject:view];
+            }
+        }
+    }
+    
+    for (RenderObject *child = renderObject->firstChild(); child; child = child->nextSibling()) {
+        buildViewsNotYetAddedSet(child);
+    }
 }
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.h b/WebCore/kwq/KWQKHTMLPartImpl.h
index 920d95f..ed2c8ea 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.h
+++ b/WebCore/kwq/KWQKHTMLPartImpl.h
@@ -43,13 +43,16 @@ namespace DOM {
 }
 
 namespace khtml {
+    class RenderObject;
     class RenderPart;
 }
 
 #ifdef __OBJC__
 @class WebCoreBridge;
+ at class NSMutableSet;
 #else
 class WebCoreBridge;
+class NSMutableSet;
 #endif
 
 class KWQKHTMLPartImpl : public QObject
@@ -104,7 +107,13 @@ public:
 
     bool isFrameSet();
 
-    void overURL( const QString &url, const QString &target, int modifierState);
+    void overURL(const QString &url, const QString &target, int modifierState);
+
+    // Draw the contents of the view, with the side effect of putting all the widgets into place.
+    void paint(QPainter &, int x, int y, int width, int height);
+    
+    // Used by KWQWidget to tell the paint call that this widget should stay.
+    static void addedWidget(QWidget *);
 
 private:
     KHTMLPart *part;
@@ -118,6 +127,9 @@ private:
     QString m_documentSource;
     bool m_decodingStarted;
     
+    static void buildViewsNotYetAddedSet(khtml::RenderObject *);
+    static NSMutableSet *viewsNotYetAdded;
+    
     friend class KHTMLPart;
 };
 
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 218d97f..28632ca 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -39,18 +39,12 @@
 
 #undef _KWQ_TIMING
 
-static void recursive(const DOM::Node &pNode, const DOM::Node &node)
-{
-    DOM::Node cur_child = node.lastChild();
+using khtml::Decoder;
+using khtml::RenderObject;
+using khtml::RenderPart;
+using khtml::RenderWidget;
 
-    KWQDEBUG("cur_child: %s = %s", cur_child.nodeName().string().latin1(), cur_child.nodeValue().string().latin1());
-
-    while(!cur_child.isNull())
-    {
-        recursive(node, cur_child);
-        cur_child = cur_child.previousSibling();
-    }
-}
+NSMutableSet *KWQKHTMLPartImpl::viewsNotYetAdded = nil;
 
 void KHTMLPart::onURL(const QString &)
 {
@@ -240,7 +234,7 @@ void KWQKHTMLPartImpl::write( const char *str, int len )
 
     // begin lines added in lieu of big fixme    
     if ( !d->m_decoder ) {
-        d->m_decoder = new khtml::Decoder();
+        d->m_decoder = new Decoder();
         if(!d->m_encoding.isNull())
             d->m_decoder->setEncoding(d->m_encoding.latin1(), d->m_haveEncoding);
         else {
@@ -424,7 +418,7 @@ void KWQKHTMLPartImpl::urlSelected( const QString &url, int button, int state, c
     [frame loadURL:clickedURL.getNSURL()];
 }
 
-bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
+bool KWQKHTMLPartImpl::requestFrame( RenderPart *frame, const QString &url, const QString &frameName,
                                      const QStringList &params, bool isIFrame )
 {
     KWQ_ASSERT(!frameExists(frameName));
@@ -449,7 +443,7 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     {
         // static cast is safe as of isIFrame being false.
         // but: shouldn't we support this javascript hack for iframes aswell?
-        khtml::RenderFrame* rf = static_cast<khtml::RenderFrame*>(frame);
+        RenderFrame* rf = static_cast<RenderFrame*>(frame);
         assert(rf);
         QVariant res = executeScript( DOM::Node(rf->frameImpl()), url.right( url.length() - 11) );
         if ( res.type() == QVariant::String ) {
@@ -465,7 +459,7 @@ bool KWQKHTMLPartImpl::requestFrame( khtml::RenderPart *frame, const QString &ur
     return true;
 }
 
-bool KWQKHTMLPartImpl::requestObject(khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
+bool KWQKHTMLPartImpl::requestObject(RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
 {
     if (url.isEmpty()) {
         return false;
@@ -666,67 +660,118 @@ void KWQKHTMLPartImpl::unfocusWindow()
     [bridge unfocusWindow];
 }
 
-
 void KWQKHTMLPartImpl::overURL( const QString &url, const QString &target, int modifierState)
 {
-  if (url.isEmpty()) {
-      setStatusBarText(QString());
-      return;
-  }
-
-  NSString *message;
+    if (url.isEmpty()) {
+        setStatusBarText(QString());
+        return;
+    }
 
-  // FIXME: This would do strange things with a link that said "xjavascript:".
-  int position = url.find("javascript:", 0, false);
-  if (position != -1) {
-      // FIXME: Is it worthwhile to special-case scripts that do a window.open and nothing else?
-      const QString scriptName = url.mid(position + strlen("javascript:"));
-      message = [NSString stringWithFormat:@"Run script \"%@\"", scriptName.getNSString()];
-      setStatusBarText(QString::fromNSString(message));
-      return;
-  }
+    NSString *message;
+    
+    // FIXME: This would do strange things with a link that said "xjavascript:".
+    int position = url.find("javascript:", 0, false);
+    if (position != -1) {
+        // FIXME: Is it worthwhile to special-case scripts that do a window.open and nothing else?
+        const QString scriptName = url.mid(position + strlen("javascript:"));
+        message = [NSString stringWithFormat:@"Run script \"%@\"", scriptName.getNSString()];
+        setStatusBarText(QString::fromNSString(message));
+        return;
+    }
+    
+    KURL u = part->completeURL(url);
+    
+    if (u.protocol() == QString("mailto")) {
+        // FIXME: addressbook integration? probably not worth it...
+        
+        setStatusBarText(QString::fromNSString([NSString stringWithFormat:@"Send email to %@", KURL::decode_string(u.path()).getNSString()]));
+        return;
+    }
+    
+    NSString *format;
+    
+    if (target == QString("_blank")) {
+        // FIXME: should use curly quotes
+        format = @"Open \"%@\" in a new window";
+        
+    } else if (!target.isEmpty() &&
+                (target != QString("_top")) &&
+                (target != QString("_self")) &&
+                (target != QString("_parent"))) {
+        if (frameExists(target)) {
+            // FIXME: distinguish existing frame in same window from
+            // existing frame name for other window
+            format = @"Go to \"%@\" in another frame";
+        } else {
+            format = @"Open \"%@\" in a new window";
+        }
+    } else {
+        format = @"Go to \"%@\"";
+    }
+    
+    if ([bridge modifierTrackingEnabled]) {
+        if (modifierState & MetaButton) {
+            if (modifierState & ShiftButton) {
+                format = @"Open \"%@\" in a new window, behind the current window";
+            } else {
+                format = @"Open \"%@\" in a new window";
+            }
+        } else if (modifierState & AltButton) {
+            format = @"Download \"%@\"";
+        }
+    }
+    
+    setStatusBarText(QString::fromNSString([NSString stringWithFormat:format, url.getNSString()]));
+}
 
-  KURL u = part->completeURL(url);
+void KWQKHTMLPartImpl::paint(QPainter &p, int x, int y, int width, int height)
+{
+    DOM::DocumentImpl *doc = part->xmlDocImpl();
+    if (!doc) {
+        return;
+    }
+    RenderObject *renderer = doc->renderer();
+    if (!renderer) {
+        return;
+    }
+    
+    // Walk the render tree, putting all the views into a set.
+    KWQ_ASSERT(viewsNotYetAdded == nil);
+    viewsNotYetAdded = [[NSMutableSet alloc] init];
+    buildViewsNotYetAddedSet(renderer);
+    
+    // We will remove views from the set when the corresponding widget gets an addChild call.
+    
+    renderer->print(&p, x, y, width, height, 0, 0);
 
-  if (u.protocol() == QString("mailto")) {
-      // FIXME: addressbook integration? probably not worth it...
-      
-      setStatusBarText(QString::fromNSString([NSString stringWithFormat:@"Send email to %@", KURL::decode_string(u.path()).getNSString()]));
-      return;
-  }
+    // Call removeFromSuperview on any that are still in the set at the end.
+    [viewsNotYetAdded makeObjectsPerformSelector:@selector(removeFromSuperview)];
+    [viewsNotYetAdded release];
+    viewsNotYetAdded = nil;
+}
 
-  NSString *format;
-
-  if (target == QString("_blank")) {
-      // FIXME: should use curly quotes
-      format = @"Open \"%@\" in a new window";
-      
-  } else if (!target.isEmpty() &&
-             (target != QString("_top")) &&
-             (target != QString("_self")) &&
-             (target != QString("_parent"))) {
-      if (frameExists(target)) {
-	  // FIXME: distinguish existing frame in same window from
-	  // existing frame name for other window
-          format = @"Go to \"%@\" in another frame";
-      } else {
-	  format = @"Open \"%@\" in a new window";
-      }
-  } else {
-      format = @"Go to \"%@\"";
-  }
+void KWQKHTMLPartImpl::addedWidget(QWidget *widget)
+{
+    NSView *view = widget->getView();
+    if (view) {
+        [viewsNotYetAdded removeObject:view];
+    }
+}
 
-  if ([bridge modifierTrackingEnabled]) {
-      if (modifierState & MetaButton) {
-	  if (modifierState & ShiftButton) {
-	      format = @"Open \"%@\" in a new window, behind the current window";
-	  } else {
-	      format = @"Open \"%@\" in a new window";
-	  }
-      } else if (modifierState & AltButton) {
-	  format = @"Download \"%@\"";
-      }
-  }
-  
-  setStatusBarText(QString::fromNSString([NSString stringWithFormat:format, url.getNSString()]));
+void KWQKHTMLPartImpl::buildViewsNotYetAddedSet(RenderObject *renderObject)
+{
+    RenderWidget *renderWidget = dynamic_cast<RenderWidget *>(renderObject);
+    if (renderWidget) {
+        QWidget *widget = renderWidget->widget();
+        if (widget) {
+            NSView *view = widget->getView();
+            if (view) {
+                [viewsNotYetAdded addObject:view];
+            }
+        }
+    }
+    
+    for (RenderObject *child = renderObject->firstChild(); child; child = child->nextSibling()) {
+        buildViewsNotYetAddedSet(child);
+    }
 }
diff --git a/WebCore/kwq/KWQScrollView.h b/WebCore/kwq/KWQScrollView.h
index 19768b9..5be9a18 100644
--- a/WebCore/kwq/KWQScrollView.h
+++ b/WebCore/kwq/KWQScrollView.h
@@ -38,9 +38,9 @@ class QScrollView : public QFrame {
 public:
     enum ScrollBarMode { AlwaysOff, AlwaysOn, Auto };
 
-    QScrollView(QWidget *parent=0, const char *name=0, int f=0);
+    QScrollView(QWidget *parent = 0, const char *name = 0, int flags = 0);
 
-    QWidget* viewport() const;
+    QWidget *viewport() const;
     int visibleWidth() const;
     int visibleHeight() const;
     int contentsWidth() const;
@@ -49,28 +49,26 @@ public:
     int contentsY() const;
     void scrollBy(int dx, int dy);
 
-    virtual void setContentsPos(int x, int y);
+    void setContentsPos(int x, int y);
 
     virtual void setVScrollBarMode(ScrollBarMode);
     virtual void setHScrollBarMode(ScrollBarMode);
 
-    virtual void addChild(QWidget* child, int x=0, int y=0);
-    void removeChild(QWidget* child);
+    void addChild(QWidget *child, int x = 0, int y = 0);
+    void removeChild(QWidget *child);
     int childX(QWidget *child);
     int childY(QWidget *child);
 
     virtual void resizeContents(int w, int h);
     void updateContents(int x, int y, int w, int h);
     void updateContents(const QRect &r);
-    void repaintContents(int x, int y, int w, int h, bool erase=TRUE);
+    void repaintContents(int x, int y, int w, int h, bool erase = true);
     QPoint contentsToViewport(const QPoint &);
     void contentsToViewport(int x, int y, int& vx, int& vy);
     void viewportToContents(int vx, int vy, int& x, int& y);
 
-    virtual void viewportWheelEvent(QWheelEvent *);
-
-    QWidget *clipper() const;
-    void enableClipper(bool);
+    QWidget *clipper() const { return 0; }
+    void enableClipper(bool) { }
 
     void setStaticBackground(bool);
 
diff --git a/WebCore/kwq/KWQScrollView.mm b/WebCore/kwq/KWQScrollView.mm
index 85bcbdc..a42153a 100644
--- a/WebCore/kwq/KWQScrollView.mm
+++ b/WebCore/kwq/KWQScrollView.mm
@@ -29,6 +29,8 @@
 
 #import <kwqdebug.h>
 
+#import <KWQKHTMLPartImpl.h>
+
 /*
     This class implementation does NOT actually emulate the Qt QScrollView.
     It does provide an implementation that khtml will use to interact with
@@ -90,7 +92,6 @@ int QScrollView::visibleWidth() const
     return visibleWidth;
 }
 
-
 int QScrollView::visibleHeight() const
 {
     NSScrollView *view = (NSScrollView *)getView();
@@ -101,11 +102,10 @@ int QScrollView::visibleHeight() const
     } else {
         visibleHeight = (int)[view bounds].size.height;
     }
-        
+    
     return visibleHeight;
 }
 
-
 int QScrollView::contentsWidth() const
 {
     NSView *docView, *view = getView();
@@ -115,7 +115,6 @@ int QScrollView::contentsWidth() const
     return (int)[view bounds].size.width;
 }
 
-
 int QScrollView::contentsHeight() const
 {
     NSView *docView, *view = getView();
@@ -195,9 +194,10 @@ void QScrollView::addChild(QWidget* child, int x, int y)
     NSView *thisView, *thisDocView, *subview;
 
     KWQ_ASSERT(child != this);
+    
+    KWQKHTMLPartImpl::addedWidget(child);
 
-    //if (child->x() != x || child->y() != y)
-        child->move(x, y);
+    child->move(x, y);
     
     thisView = getView();
     thisDocView = [thisView _KWQ_getDocumentView];
@@ -211,7 +211,6 @@ void QScrollView::addChild(QWidget* child, int x, int y)
     // code in QWidget::internalSetGeometry.
     if ([subview conformsToProtocol:@protocol(WebCoreFrameView)]) {
         subview = [subview superview];
-        //[subview setFrameOrigin: NSMakePoint (x, y)];
     }
     
     KWQ_ASSERT(subview != thisView);
@@ -244,8 +243,7 @@ void QScrollView::resizeContents(int w, int h)
         if (h < 0)
             h = 0;
         [view setFrameSize: NSMakeSize (w,h)];
-    }
-    else {
+    } else {
         resize (w, h);
     }
 }
@@ -305,22 +303,6 @@ void QScrollView::viewportToContents(int vx, int vy, int& x, int& y)
     y = (int)np.y;
 }
 
-void QScrollView::viewportWheelEvent(QWheelEvent *)
-{
-    _logNeverImplemented();
-}
-
-QWidget *QScrollView::clipper() const
-{
-    _logNeverImplemented();
-    return (QWidget *)this;
-}
-
-void QScrollView::enableClipper(bool)
-{
-    _logNeverImplemented();
-}
-
 void QScrollView::setStaticBackground(bool)
 {
     _logNeverImplemented();
@@ -328,7 +310,6 @@ void QScrollView::setStaticBackground(bool)
 
 void QScrollView::resizeEvent(QResizeEvent *)
 {
-    _logNeverImplemented();
 }
 
 void QScrollView::ensureVisible(int,int)
diff --git a/WebCore/kwq/KWQWidget.h b/WebCore/kwq/KWQWidget.h
index c3eff4a..d58fb8e 100644
--- a/WebCore/kwq/KWQWidget.h
+++ b/WebCore/kwq/KWQWidget.h
@@ -66,10 +66,12 @@ public:
     virtual ~QWidget();
 
     virtual QSize sizeHint() const;
-    virtual void setActiveWindow();
     virtual void setEnabled(bool);
-    virtual void setAutoMask(bool);
-    virtual void setMouseTracking(bool);
+    
+    void setActiveWindow();
+
+    void setAutoMask(bool) { }
+    void setMouseTracking(bool) { }
 
     long winId() const;
     int x() const;
@@ -107,24 +109,23 @@ public:
     virtual void setFont(const QFont &);
     
     void constPolish() const;
-    virtual QSize minimumSizeHint() const;
     bool isVisible() const;
-    virtual void setCursor(const QCursor &);
-    virtual QCursor cursor();
+    void setCursor(const QCursor &);
+    QCursor cursor();
     void unsetCursor();
     bool event(QEvent *);
     bool focusNextPrevChild(bool);
     bool hasMouseTracking() const;
 
-    virtual void show();
-    virtual void hide();
+    void show() { }
+    void hide() { }
 
-    virtual void showEvent(QShowEvent *);
-    virtual void hideEvent(QHideEvent *);
-    virtual void wheelEvent(QWheelEvent *);
-    virtual void keyPressEvent(QKeyEvent *);
-    virtual void keyReleaseEvent(QKeyEvent *);
-    virtual void focusOutEvent(QFocusEvent *);
+    void showEvent(QShowEvent *) { }
+    void hideEvent(QHideEvent *) { }
+    void wheelEvent(QWheelEvent *) { }
+    void keyPressEvent(QKeyEvent *) { }
+    void keyReleaseEvent(QKeyEvent *) { }
+    void focusOutEvent(QFocusEvent *) { }
 
     enum BackgroundMode { NoBackground };    
     void setBackgroundMode(BackgroundMode) { }
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 5817a24..562e88c 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,15 +24,16 @@
  */
 
 #import <qwidget.h>
-#import <WebCoreFrameView.h>
+
 #import <KWQView.h>
+#import <WebCoreFrameView.h>
 #import <kwqdebug.h>
 #import <KWQWindowWidget.h>
 
 /*
-    A QWidget rougly corresponds to an NSView.  In Qt a QFrame and QMainWindow inherit
+    A QWidget roughly corresponds to an NSView.  In Qt a QFrame and QMainWindow inherit
     from a QWidget.  In Cocoa a NSWindow does not inherit from NSView.  We
-    emulate QWidgets using NSViews.
+    emulate most QWidgets using NSViews.
 */
 
 
@@ -82,14 +83,6 @@ void QWidget::setEnabled(bool)
 {
 }
 
-void QWidget::setAutoMask(bool) 
-{
-}
-
-void QWidget::setMouseTracking(bool) 
-{
-}
-
 long QWidget::winId() const
 {
     return (long)this;
@@ -163,11 +156,7 @@ QWidget *QWidget::topLevelWidget() const
 	window = [view window];
     }
 
-    if (window != nil) {	
-	return KWQWindowWidget::fromNSWindow(window);
-    } else {
-	return NULL;
-    }
+    return window ? KWQWindowWidget::fromNSWindow(window) : NULL;
 }
 
 QPoint QWidget::mapToGlobal(const QPoint &p) const
@@ -255,20 +244,6 @@ void QWidget::constPolish() const
 {
 }
 
-QSize QWidget::minimumSizeHint() const
-{
-    NSView *view = getView();
-    
-    if ([view isKindOfClass:[NSControl class]]) {
-        NSControl *control = (NSControl *)view;
-        [control sizeToFit];
-        NSRect frame = [view frame];
-        return QSize((int)frame.size.width, (int)frame.size.height);
-    }
-
-    return QSize(0,0);
-}
-
 bool QWidget::isVisible() const
 {
     // FIXME - rewrite interms of top level widget?
@@ -314,14 +289,6 @@ bool QWidget::hasMouseTracking() const
     return true;
 }
 
-void QWidget::show()
-{
-}
-
-void QWidget::hide()
-{
-}
-
 void QWidget::internalSetGeometry(int x, int y, int w, int h)
 {
     NSView *view = getView();
@@ -337,34 +304,10 @@ void QWidget::internalSetGeometry(int x, int y, int w, int h)
     [view setFrame:NSMakeRect(x, y, w, h)];
 }
 
-void QWidget::showEvent(QShowEvent *)
-{
-}
-
-void QWidget::hideEvent(QHideEvent *)
-{
-}
-
-void QWidget::wheelEvent(QWheelEvent *)
-{
-}
-
-void QWidget::keyPressEvent(QKeyEvent *)
-{
-}
-
-void QWidget::keyReleaseEvent(QKeyEvent *)
-{
-}
-
-void QWidget::focusOutEvent(QFocusEvent *)
-{
-}
-
 QPoint QWidget::mapFromGlobal(const QPoint &p) const
 {
     NSPoint bp;
-    bp = [[data->view window] convertScreenToBase: [data->view convertPoint: NSMakePoint(p.x(), p.y()) toView: nil]];
+    bp = [[data->view window] convertScreenToBase:[data->view convertPoint:NSMakePoint(p.x(), p.y()) toView:nil]];
     return QPoint((int)bp.x, (int)bp.y);
 }
 
@@ -382,15 +325,16 @@ void QWidget::setView(NSView *view)
 
 void QWidget::endEditing()
 {
-    id window, firstResponder;
+    // FIXME: This seems to end editing of any widget in the same window, not just this one.
     
-    // Catch the field editor case.
-    window = [getView() window];
-    [window endEditingFor: nil];
+    // Handle the field editor case.
+    // This is probably not necessary, given the next bit of code.
+    NSWindow *window = [getView() window];
+    [window endEditingFor:nil];
     
-    // The previous case is probably not necessary, given that we whack
-    // any NSText first responders.
-    firstResponder = [window firstResponder];
-    if ([firstResponder isKindOfClass: [NSText class]])
-        [window makeFirstResponder: nil];
+    // Whack any NSText first responders.
+    NSResponder *firstResponder = [window firstResponder];
+    if ([firstResponder isKindOfClass:[NSText class]]) {
+        [window makeFirstResponder:nil];
+    }
 }
diff --git a/WebCore/kwq/KWQWindowWidget.h b/WebCore/kwq/KWQWindowWidget.h
index 606a620..8d5b973 100644
--- a/WebCore/kwq/KWQWindowWidget.h
+++ b/WebCore/kwq/KWQWindowWidget.h
@@ -44,13 +44,11 @@ class KWQWindowWidget : public QWidget
     static KWQWindowWidget *fromNSWindow(NSWindow *window);
 
     virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
     virtual QRect frameGeometry() const;
 
     virtual QWidget *topLevelWidget() const;
     virtual QPoint mapToGlobal(const QPoint &) const;
     virtual QPoint mapFromGlobal(const QPoint &) const;
-    virtual void setCursor(const QCursor &);
 
  protected:
     virtual void internalSetGeometry( int x, int y, int w, int h );
diff --git a/WebCore/kwq/KWQWindowWidget.mm b/WebCore/kwq/KWQWindowWidget.mm
index cf51b09..fa8a141 100644
--- a/WebCore/kwq/KWQWindowWidget.mm
+++ b/WebCore/kwq/KWQWindowWidget.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,6 +24,7 @@
  */
 
 #import <KWQWindowWidget.h>
+
 #import <Cocoa/Cocoa.h>
 
 class KWQWindowWidgetPrivate
@@ -81,16 +82,10 @@ QSize KWQWindowWidget::sizeHint() const
     return size();
 }
 
-QSize KWQWindowWidget::minimumSizeHint() const
-{
-    return size();
-}
-
 QRect KWQWindowWidget::frameGeometry() const
 {
     NSRect frame = [d->window frame];
-    NSRect screenFrame = [[d->window screen] frame];
-    return QRect((int)frame.origin.x, (int)(screenFrame.size.height - frame.origin.y - frame.size.height),
+    return QRect((int)frame.origin.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - frame.origin.y),
 		 (int)frame.size.width, (int)frame.size.height);
 }
 
@@ -101,36 +96,20 @@ QWidget *KWQWindowWidget::topLevelWidget() const
 
 QPoint KWQWindowWidget::mapToGlobal(const QPoint &p) const
 {
-    NSRect screenFrame = [[d->window screen] frame];
-    NSRect frame = [d->window frame];
-    NSPoint windowPoint = NSMakePoint(p.x(), frame.size.height - p.y());
-
+    NSPoint windowPoint = NSMakePoint(p.x(), [d->window frame].size.height - p.y());
     NSPoint screenPoint = [d->window convertBaseToScreen:windowPoint];
-
-    return QPoint((int)screenPoint.x, (int)(screenFrame.size.height - screenFrame.origin.y - screenPoint.y));
+    return QPoint((int)screenPoint.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y));
 }
 
 QPoint KWQWindowWidget::mapFromGlobal(const QPoint &p) const
 {
-    NSRect screenFrame = [[d->window screen] frame];
-    NSRect frame = [d->window frame];
-    NSPoint screenPoint = NSMakePoint(p.x(), screenFrame.size.height - screenFrame.origin.y - p.y());
-
+    NSPoint screenPoint = NSMakePoint(p.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - p.y());
     NSPoint windowPoint = [d->window convertScreenToBase:screenPoint];
-
-    return QPoint((int)windowPoint.x, (int)(frame.size.height - windowPoint.y));
-}
-
-void KWQWindowWidget::setCursor(const QCursor &)
-{
+    return QPoint((int)windowPoint.x, (int)([d->window frame].size.height - windowPoint.y));
 }
 
-void KWQWindowWidget::internalSetGeometry( int x, int y, int w, int h )
+void KWQWindowWidget::internalSetGeometry(int x, int y, int w, int h)
 {
     // FIXME: should try to avoid saving changes
-    NSRect screenFrame = [[d->window screen] frame];
-    [d->window setFrame:NSMakeRect(x, screenFrame.size.height - y - h,
-			       w, h) display:NO];
+    [d->window setFrame:NSMakeRect(x, NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - y - h, w, h) display:NO];
 }
-
-
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 097b6bb..100673c 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -189,21 +189,15 @@ using namespace khtml;
     }
 }
 
-- (void)_drawRect:(NSRect)rect withPainter:(QPainter *)p
+- (void)drawRect:(NSRect)rect withPainter:(QPainter *)p
 {
-    DOM::DocumentImpl *doc = part->xmlDocImpl();
-    if (doc) {
-        khtml::RenderObject *renderer = doc->renderer();
-        if (renderer) {
-            renderer->print(p, (int)rect.origin.x, (int)rect.origin.y, (int)rect.size.width, (int)rect.size.height, 0, 0);
-        }
-    }
+    part->impl->paint(*p, (int)rect.origin.x, (int)rect.origin.y, (int)rect.size.width, (int)rect.size.height);
 }
 
 - (void)drawRect:(NSRect)rect
 {
     QPainter p;
-    [self _drawRect:rect withPainter:&p];
+    [self drawRect:rect withPainter:&p];
 }
 
 - (void)adjustFrames:(NSRect)rect
@@ -215,7 +209,7 @@ using namespace khtml;
     [self forceLayout];
     QPainter p;
     p.setPaintingDisabled(YES);
-    [self _drawRect:rect withPainter:&p];
+    [self drawRect:rect withPainter:&p];
 }
 
 - (NSObject *)copyDOMNode:(DOM::NodeImpl *)node copier:(id <WebCoreDOMTreeCopier>)copier
diff --git a/WebCore/kwq/qt/qscrollview.h b/WebCore/kwq/qt/qscrollview.h
index 19768b9..5be9a18 100644
--- a/WebCore/kwq/qt/qscrollview.h
+++ b/WebCore/kwq/qt/qscrollview.h
@@ -38,9 +38,9 @@ class QScrollView : public QFrame {
 public:
     enum ScrollBarMode { AlwaysOff, AlwaysOn, Auto };
 
-    QScrollView(QWidget *parent=0, const char *name=0, int f=0);
+    QScrollView(QWidget *parent = 0, const char *name = 0, int flags = 0);
 
-    QWidget* viewport() const;
+    QWidget *viewport() const;
     int visibleWidth() const;
     int visibleHeight() const;
     int contentsWidth() const;
@@ -49,28 +49,26 @@ public:
     int contentsY() const;
     void scrollBy(int dx, int dy);
 
-    virtual void setContentsPos(int x, int y);
+    void setContentsPos(int x, int y);
 
     virtual void setVScrollBarMode(ScrollBarMode);
     virtual void setHScrollBarMode(ScrollBarMode);
 
-    virtual void addChild(QWidget* child, int x=0, int y=0);
-    void removeChild(QWidget* child);
+    void addChild(QWidget *child, int x = 0, int y = 0);
+    void removeChild(QWidget *child);
     int childX(QWidget *child);
     int childY(QWidget *child);
 
     virtual void resizeContents(int w, int h);
     void updateContents(int x, int y, int w, int h);
     void updateContents(const QRect &r);
-    void repaintContents(int x, int y, int w, int h, bool erase=TRUE);
+    void repaintContents(int x, int y, int w, int h, bool erase = true);
     QPoint contentsToViewport(const QPoint &);
     void contentsToViewport(int x, int y, int& vx, int& vy);
     void viewportToContents(int vx, int vy, int& x, int& y);
 
-    virtual void viewportWheelEvent(QWheelEvent *);
-
-    QWidget *clipper() const;
-    void enableClipper(bool);
+    QWidget *clipper() const { return 0; }
+    void enableClipper(bool) { }
 
     void setStaticBackground(bool);
 
diff --git a/WebCore/kwq/qt/qwidget.h b/WebCore/kwq/qt/qwidget.h
index c3eff4a..d58fb8e 100644
--- a/WebCore/kwq/qt/qwidget.h
+++ b/WebCore/kwq/qt/qwidget.h
@@ -66,10 +66,12 @@ public:
     virtual ~QWidget();
 
     virtual QSize sizeHint() const;
-    virtual void setActiveWindow();
     virtual void setEnabled(bool);
-    virtual void setAutoMask(bool);
-    virtual void setMouseTracking(bool);
+    
+    void setActiveWindow();
+
+    void setAutoMask(bool) { }
+    void setMouseTracking(bool) { }
 
     long winId() const;
     int x() const;
@@ -107,24 +109,23 @@ public:
     virtual void setFont(const QFont &);
     
     void constPolish() const;
-    virtual QSize minimumSizeHint() const;
     bool isVisible() const;
-    virtual void setCursor(const QCursor &);
-    virtual QCursor cursor();
+    void setCursor(const QCursor &);
+    QCursor cursor();
     void unsetCursor();
     bool event(QEvent *);
     bool focusNextPrevChild(bool);
     bool hasMouseTracking() const;
 
-    virtual void show();
-    virtual void hide();
+    void show() { }
+    void hide() { }
 
-    virtual void showEvent(QShowEvent *);
-    virtual void hideEvent(QHideEvent *);
-    virtual void wheelEvent(QWheelEvent *);
-    virtual void keyPressEvent(QKeyEvent *);
-    virtual void keyReleaseEvent(QKeyEvent *);
-    virtual void focusOutEvent(QFocusEvent *);
+    void showEvent(QShowEvent *) { }
+    void hideEvent(QHideEvent *) { }
+    void wheelEvent(QWheelEvent *) { }
+    void keyPressEvent(QKeyEvent *) { }
+    void keyReleaseEvent(QKeyEvent *) { }
+    void focusOutEvent(QFocusEvent *) { }
 
     enum BackgroundMode { NoBackground };    
     void setBackgroundMode(BackgroundMode) { }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list