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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:53:42 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8e0b0f368b2eaece4f48f40bce07ea4b7a695b3f
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 19 04:39:51 2001 +0000

    Top level:
    
    	* prepare-ChangeLog: Improved C++ support; handle constructor
    	initializers and operator overloads properly, and ignore the const
    	qualifier so const methods get picked up.
    
    	Various changes relating to reduction in borrowed classes:
    
    	* Tests/qt/qpoint-test.chk, Tests/qt/qpoint-test.cpp,
    	Tests/qt/qrect-test.chk, Tests/qt/qrect-test.cpp,
    	Tests/qt/qsize-test.chk, Tests/qt/qsize-test.cpp: Disable tests
    	that don't apply to new versions of these classes.
    
    	* borrowed-classes.txt: Turn off QPoint, QSize, QRect.
    
    WebCore:
    
    	* src/kwq/KWQCString.mm: (QCString::QCString),
    	(QCString::isEmpty), (QCString::isNull), (QCString::length): Fix
    	some bugs found by the test suite in the emptiness/null semantics.
    
    	Reimplement QPoint, QSize and QRect:
    
    	* src/kwq/qt/qpoint.h, src/kwq/qt/qrect.h, src/kwq/qt/qsize.h:
    	Update.
    	* src/kwq/KWQPoint.mm: (QPoint::QPoint), (QPoint::x), (QPoint::y),
    	(QPoint::manhattanLength), (operator+), (operator-), (operator<<):
    	Fresh implementations.
    	* src/kwq/KWQRect.mm: (QRect::QRect), (QRect::isNull), (QRect::isValid),
    	(QRect::x), (QRect::y), (QRect::left), (QRect::top), (QRect::right),
    	(QRect::bottom), (QRect::width), (QRect::height), (QRect::topLeft),
    	(QRect::size), (QRect::setWidth), (QRect::setHeight), (QRect::intersect),
    	(QRect::intersects), (QRect::operator&), (operator==), (operator!=),
    	(operator<<): Likewise.
    	* src/kwq/KWQSize.mm: (QSize::QSize), (QSize::isValid), (QSize::width),
    	(QSize::height), (QSize::setWidth), (QSize::setHeight), (QSize::expandedTo),
    	(operator+), (operator==), (operator!=), (operator<<): Likewise.
    	* src/kwq/qt/_qpoint.cpp, src/kwq/qt/_qrect.cpp,
    	src/kwq/qt/_qsize.cpp: Disable the whole file contents when
    	building.
    	* src/kwq/Makefile.in: Add new files to build.
    
    	Start moving away from QShared so we can remove it:
    
    	* src/kwq/qt/qbrush.h, src/kwq/KWQBrush.mm: (QBrush::QBrush),
    	(QBrush::color),
    	(QBrush::setColor), (QBrush::style), (QBrush::setStyle),
    	(QBrush::operator==), (QBrush::operator!=): Don't use shared data
    	for this simple value object, the optimization value is
    	quastionable anyway.
    	* src/kwq/qt/qpen.h, src/kwq/KWQPen.mm: (QPen::QPen),
    	(QPen::color), (QPen::width), (QPen::style),
    	(QPen::setColor), (QPen::setWidth), (QPen::setStyle),
    	(QPen::operator==): Likewise.
    	* src/kwq/KWQPainter.mm: (QPainter::setPen), (QPainter::setBrush):
    	Update for changes to pen.
    	* src/kwq/KWQRefPtr.h: New reference-counted pointer template.
    	* src/kwq/qt/qguardedptr.h, src/kwq/KWQGuardedPtr.mm:
    	(QGuardedPtrPrivate::QGuardedPtrPrivate): Use KWQRefPtr instead of
    	QShared.
    	* src/kwq/qt/qvariant.h, src/kwq/KWQVariant.mm:
    	(QVariant::QVariant), (QVariant::~QVariant),
    	(QVariant::operator=): Use KWQRefPtr instead of
    	QShared.
    	* src/kwq/qt/qnamespace.h: Remove private constructor and
    	destructor since people want to subclass this.
    
    	* src/kwq/_KWQOwner.h: Add include guards and standard license.
    
    	* src/kdelibs/khtml/ecma/kjs_binding.h: Add include of qvariant.h,
    	how could stuff ever compile without this?
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@521 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index ea5d869..c965510 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,60 @@
+2001-12-18  Maciej Stachowiak  <mjs at apple.com>
+
+	* src/kwq/KWQCString.mm: (QCString::QCString),
+	(QCString::isEmpty), (QCString::isNull), (QCString::length): Fix
+	some bugs found by the test suite in the emptiness/null semantics.
+
+	Reimplement QPoint, QSize and QRect:
+
+	* src/kwq/qt/qpoint.h, src/kwq/qt/qrect.h, src/kwq/qt/qsize.h:
+	Update.
+	* src/kwq/KWQPoint.mm: (QPoint::QPoint), (QPoint::x), (QPoint::y),
+	(QPoint::manhattanLength), (operator+), (operator-), (operator<<):
+	Fresh implementations.
+	* src/kwq/KWQRect.mm: (QRect::QRect), (QRect::isNull), (QRect::isValid),
+	(QRect::x), (QRect::y), (QRect::left), (QRect::top), (QRect::right),
+	(QRect::bottom), (QRect::width), (QRect::height), (QRect::topLeft),
+	(QRect::size), (QRect::setWidth), (QRect::setHeight), (QRect::intersect),
+	(QRect::intersects), (QRect::operator&), (operator==), (operator!=),
+	(operator<<): Likewise.
+	* src/kwq/KWQSize.mm: (QSize::QSize), (QSize::isValid), (QSize::width),
+	(QSize::height), (QSize::setWidth), (QSize::setHeight), (QSize::expandedTo),
+	(operator+), (operator==), (operator!=), (operator<<): Likewise.
+	* src/kwq/qt/_qpoint.cpp, src/kwq/qt/_qrect.cpp,
+	src/kwq/qt/_qsize.cpp: Disable the whole file contents when
+	building.
+	* src/kwq/Makefile.in: Add new files to build.
+	
+	Start moving away from QShared so we can remove it:
+
+	* src/kwq/qt/qbrush.h, src/kwq/KWQBrush.mm: (QBrush::QBrush),
+	(QBrush::color),
+	(QBrush::setColor), (QBrush::style), (QBrush::setStyle),
+	(QBrush::operator==), (QBrush::operator!=): Don't use shared data
+	for this simple value object, the optimization value is
+	quastionable anyway.
+	* src/kwq/qt/qpen.h, src/kwq/KWQPen.mm: (QPen::QPen),
+	(QPen::color), (QPen::width), (QPen::style),
+	(QPen::setColor), (QPen::setWidth), (QPen::setStyle),
+	(QPen::operator==): Likewise.
+	* src/kwq/KWQPainter.mm: (QPainter::setPen), (QPainter::setBrush):
+	Update for changes to pen.
+	* src/kwq/KWQRefPtr.h: New reference-counted pointer template.
+	* src/kwq/qt/qguardedptr.h, src/kwq/KWQGuardedPtr.mm:
+	(QGuardedPtrPrivate::QGuardedPtrPrivate): Use KWQRefPtr instead of
+	QShared.
+	* src/kwq/qt/qvariant.h, src/kwq/KWQVariant.mm:
+	(QVariant::QVariant), (QVariant::~QVariant),
+	(QVariant::operator=): Use KWQRefPtr instead of
+	QShared.
+	* src/kwq/qt/qnamespace.h: Remove private constructor and
+	destructor since people want to subclass this.
+
+	* src/kwq/_KWQOwner.h: Add include guards and standard license.
+
+	* src/kdelibs/khtml/ecma/kjs_binding.h: Add include of qvariant.h,
+	how could stuff ever compile without this?
+
 2001-12-18  Richard Williamson  <rjw at apple.com>
 
         Finally fixed underlining.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index ea5d869..c965510 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,60 @@
+2001-12-18  Maciej Stachowiak  <mjs at apple.com>
+
+	* src/kwq/KWQCString.mm: (QCString::QCString),
+	(QCString::isEmpty), (QCString::isNull), (QCString::length): Fix
+	some bugs found by the test suite in the emptiness/null semantics.
+
+	Reimplement QPoint, QSize and QRect:
+
+	* src/kwq/qt/qpoint.h, src/kwq/qt/qrect.h, src/kwq/qt/qsize.h:
+	Update.
+	* src/kwq/KWQPoint.mm: (QPoint::QPoint), (QPoint::x), (QPoint::y),
+	(QPoint::manhattanLength), (operator+), (operator-), (operator<<):
+	Fresh implementations.
+	* src/kwq/KWQRect.mm: (QRect::QRect), (QRect::isNull), (QRect::isValid),
+	(QRect::x), (QRect::y), (QRect::left), (QRect::top), (QRect::right),
+	(QRect::bottom), (QRect::width), (QRect::height), (QRect::topLeft),
+	(QRect::size), (QRect::setWidth), (QRect::setHeight), (QRect::intersect),
+	(QRect::intersects), (QRect::operator&), (operator==), (operator!=),
+	(operator<<): Likewise.
+	* src/kwq/KWQSize.mm: (QSize::QSize), (QSize::isValid), (QSize::width),
+	(QSize::height), (QSize::setWidth), (QSize::setHeight), (QSize::expandedTo),
+	(operator+), (operator==), (operator!=), (operator<<): Likewise.
+	* src/kwq/qt/_qpoint.cpp, src/kwq/qt/_qrect.cpp,
+	src/kwq/qt/_qsize.cpp: Disable the whole file contents when
+	building.
+	* src/kwq/Makefile.in: Add new files to build.
+	
+	Start moving away from QShared so we can remove it:
+
+	* src/kwq/qt/qbrush.h, src/kwq/KWQBrush.mm: (QBrush::QBrush),
+	(QBrush::color),
+	(QBrush::setColor), (QBrush::style), (QBrush::setStyle),
+	(QBrush::operator==), (QBrush::operator!=): Don't use shared data
+	for this simple value object, the optimization value is
+	quastionable anyway.
+	* src/kwq/qt/qpen.h, src/kwq/KWQPen.mm: (QPen::QPen),
+	(QPen::color), (QPen::width), (QPen::style),
+	(QPen::setColor), (QPen::setWidth), (QPen::setStyle),
+	(QPen::operator==): Likewise.
+	* src/kwq/KWQPainter.mm: (QPainter::setPen), (QPainter::setBrush):
+	Update for changes to pen.
+	* src/kwq/KWQRefPtr.h: New reference-counted pointer template.
+	* src/kwq/qt/qguardedptr.h, src/kwq/KWQGuardedPtr.mm:
+	(QGuardedPtrPrivate::QGuardedPtrPrivate): Use KWQRefPtr instead of
+	QShared.
+	* src/kwq/qt/qvariant.h, src/kwq/KWQVariant.mm:
+	(QVariant::QVariant), (QVariant::~QVariant),
+	(QVariant::operator=): Use KWQRefPtr instead of
+	QShared.
+	* src/kwq/qt/qnamespace.h: Remove private constructor and
+	destructor since people want to subclass this.
+
+	* src/kwq/_KWQOwner.h: Add include guards and standard license.
+
+	* src/kdelibs/khtml/ecma/kjs_binding.h: Add include of qvariant.h,
+	how could stuff ever compile without this?
+
 2001-12-18  Richard Williamson  <rjw at apple.com>
 
         Finally fixed underlining.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index ea5d869..c965510 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,60 @@
+2001-12-18  Maciej Stachowiak  <mjs at apple.com>
+
+	* src/kwq/KWQCString.mm: (QCString::QCString),
+	(QCString::isEmpty), (QCString::isNull), (QCString::length): Fix
+	some bugs found by the test suite in the emptiness/null semantics.
+
+	Reimplement QPoint, QSize and QRect:
+
+	* src/kwq/qt/qpoint.h, src/kwq/qt/qrect.h, src/kwq/qt/qsize.h:
+	Update.
+	* src/kwq/KWQPoint.mm: (QPoint::QPoint), (QPoint::x), (QPoint::y),
+	(QPoint::manhattanLength), (operator+), (operator-), (operator<<):
+	Fresh implementations.
+	* src/kwq/KWQRect.mm: (QRect::QRect), (QRect::isNull), (QRect::isValid),
+	(QRect::x), (QRect::y), (QRect::left), (QRect::top), (QRect::right),
+	(QRect::bottom), (QRect::width), (QRect::height), (QRect::topLeft),
+	(QRect::size), (QRect::setWidth), (QRect::setHeight), (QRect::intersect),
+	(QRect::intersects), (QRect::operator&), (operator==), (operator!=),
+	(operator<<): Likewise.
+	* src/kwq/KWQSize.mm: (QSize::QSize), (QSize::isValid), (QSize::width),
+	(QSize::height), (QSize::setWidth), (QSize::setHeight), (QSize::expandedTo),
+	(operator+), (operator==), (operator!=), (operator<<): Likewise.
+	* src/kwq/qt/_qpoint.cpp, src/kwq/qt/_qrect.cpp,
+	src/kwq/qt/_qsize.cpp: Disable the whole file contents when
+	building.
+	* src/kwq/Makefile.in: Add new files to build.
+	
+	Start moving away from QShared so we can remove it:
+
+	* src/kwq/qt/qbrush.h, src/kwq/KWQBrush.mm: (QBrush::QBrush),
+	(QBrush::color),
+	(QBrush::setColor), (QBrush::style), (QBrush::setStyle),
+	(QBrush::operator==), (QBrush::operator!=): Don't use shared data
+	for this simple value object, the optimization value is
+	quastionable anyway.
+	* src/kwq/qt/qpen.h, src/kwq/KWQPen.mm: (QPen::QPen),
+	(QPen::color), (QPen::width), (QPen::style),
+	(QPen::setColor), (QPen::setWidth), (QPen::setStyle),
+	(QPen::operator==): Likewise.
+	* src/kwq/KWQPainter.mm: (QPainter::setPen), (QPainter::setBrush):
+	Update for changes to pen.
+	* src/kwq/KWQRefPtr.h: New reference-counted pointer template.
+	* src/kwq/qt/qguardedptr.h, src/kwq/KWQGuardedPtr.mm:
+	(QGuardedPtrPrivate::QGuardedPtrPrivate): Use KWQRefPtr instead of
+	QShared.
+	* src/kwq/qt/qvariant.h, src/kwq/KWQVariant.mm:
+	(QVariant::QVariant), (QVariant::~QVariant),
+	(QVariant::operator=): Use KWQRefPtr instead of
+	QShared.
+	* src/kwq/qt/qnamespace.h: Remove private constructor and
+	destructor since people want to subclass this.
+
+	* src/kwq/_KWQOwner.h: Add include guards and standard license.
+
+	* src/kdelibs/khtml/ecma/kjs_binding.h: Add include of qvariant.h,
+	how could stuff ever compile without this?
+
 2001-12-18  Richard Williamson  <rjw at apple.com>
 
         Finally fixed underlining.
diff --git a/WebCore/khtml/ecma/kjs_binding.h b/WebCore/khtml/ecma/kjs_binding.h
index cf13ab6..f426b69 100644
--- a/WebCore/khtml/ecma/kjs_binding.h
+++ b/WebCore/khtml/ecma/kjs_binding.h
@@ -26,6 +26,7 @@
 #include <dom/dom_doc.h>
 #include <kurl.h>
 #include <qguardedptr.h>
+#include <qvariant.h>
 
 namespace KJS {
 
diff --git a/WebCore/kwq/KWQBrush.h b/WebCore/kwq/KWQBrush.h
index f859435..17c06bd 100644
--- a/WebCore/kwq/KWQBrush.h
+++ b/WebCore/kwq/KWQBrush.h
@@ -48,12 +48,12 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    QBrush();
-    QBrush(const QColor &);
-    QBrush::QBrush(const QColor &c, BrushStyle style);
-    QBrush(const QBrush &);
-    QBrush &operator=(const QBrush &);
-    ~QBrush();
+    QBrush::QBrush(const QColor &c = Qt::black, BrushStyle style = SolidPattern);
+
+    // Defaults are fine
+    // QBrush(const QBrush &);
+    // QBrush &operator=(const QBrush &);
+    // ~QBrush();
  
     // member functions --------------------------------------------------------
     
@@ -70,14 +70,8 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    void init(const QColor &, BrushStyle);
-    QBrush copy() const;
-    void detach();
-    struct QBrushData : public QShared { 
-        BrushStyle brushStyle;
-        QColor color;
-    } *data;
-
+    QColor brushColor;
+    BrushStyle brushStyle;
 }; // class QBrush =============================================================
 
 #endif
diff --git a/WebCore/kwq/KWQBrush.mm b/WebCore/kwq/KWQBrush.mm
index 376b91a..a908baf 100644
--- a/WebCore/kwq/KWQBrush.mm
+++ b/WebCore/kwq/KWQBrush.mm
@@ -25,96 +25,40 @@
 
 #include <qbrush.h>
 
-void QBrush::init(const QColor &color, BrushStyle style)
+QBrush::QBrush(const QColor &c, BrushStyle style) :  brushColor(c), brushStyle(style)
 {
-    data = new QBrushData();
-    data->color = color;
-    data->brushStyle = style;
-}
-
-QBrush::QBrush()
-{
-    init(Qt::black, SolidPattern);
-}
-
-
-QBrush::QBrush(const QColor &c)
-{
-    init(c, SolidPattern);
-}
-
-QBrush::QBrush(const QColor &c, BrushStyle style)
-{
-    init(c, style);
-}
-
-QBrush::QBrush(const QBrush &copyFrom)
-{
-    data = copyFrom.data;
-    data->ref();
-}
-
-QBrush &QBrush::operator=(const QBrush &assignFrom)
-{
-    assignFrom.data->ref();
-    if (data->deref()) {
-        delete data;
-    }
-    data = assignFrom.data;
-    return *this;
-}
-
-QBrush::~QBrush()
-{
-    if (data->deref()) {
-        delete data;
-    }
-}
-
-QBrush QBrush::copy() const
-{
-    return QBrush(data->color, data->brushStyle);
-}
-
-void QBrush::detach()
-{
-    if (data->count != 1) {
-        *this = copy();
-    }
 }
 
 const QColor &QBrush::color() const
 {
-    return data->color;
+    return brushColor;
 }
 
 void QBrush::setColor(const QColor &c)
 {
-    detach();
-    data->color = c;
+    brushColor = c;
 }
 
 Qt::BrushStyle QBrush::style() const
 {
-    return data->brushStyle;
+    return brushStyle;
 }
 
 void QBrush::setStyle(Qt::BrushStyle bs)
 {
-    detach();
-    data->brushStyle = bs;
+    brushStyle = bs;
 }
 
 bool QBrush::operator==(const QBrush &compareTo) const
 {
-    return (compareTo.data == data) || 
-        (compareTo.data->brushStyle == data->brushStyle && 
-         compareTo.data->color == data->color);
+    return compareTo.brushStyle == brushStyle && 
+         compareTo.brushColor == brushColor;
 }
 
 
 bool QBrush::operator!=(const QBrush &compareTo) const
 {
-    return !(operator==( compareTo ));
+    return compareTo.brushStyle != brushStyle || 
+         compareTo.brushColor != brushColor;
 }
 
diff --git a/WebCore/kwq/KWQCString.mm b/WebCore/kwq/KWQCString.mm
index 9ca079e..f7ccdda 100644
--- a/WebCore/kwq/KWQCString.mm
+++ b/WebCore/kwq/KWQCString.mm
@@ -42,9 +42,8 @@
 #define qstricmp(s1,s2) strcasecmp((s1),(s2))
 #define qstrnicmp(s1,s2,len) strncasecmp((s1),(s2),(len))
 
-QCString::QCString() : QByteArray(1)
+QCString::QCString() : QByteArray(0)
 {
-    *data() = '\0';
 }
 
 QCString::QCString(int size) : QByteArray(size)
@@ -82,12 +81,12 @@ QCString::QCString(const QCString &s) : QByteArray(s)
 
 bool QCString::isEmpty() const
 {
-    return data() == 0;
+    return length() == 0;
 }
 
 bool QCString::isNull() const
 {
-    return data() == 0 || *data() == '\0';
+    return data() == NULL;
 }
 
 int QCString::find(const char *s, int index=0, bool cs=TRUE) const
@@ -162,7 +161,7 @@ int QCString::contains(char c, bool cs=TRUE) const
 
 uint QCString::length() const
 {
-    return strlen(data());
+    return data() == NULL ? 0 : strlen(data());
 }
 
 bool QCString::resize(uint len)
diff --git a/WebCore/kwq/KWQGuardedPtr.h b/WebCore/kwq/KWQGuardedPtr.h
index 2eaacf3..df6fec7 100644
--- a/WebCore/kwq/KWQGuardedPtr.h
+++ b/WebCore/kwq/KWQGuardedPtr.h
@@ -30,24 +30,17 @@
 #include <config.h>
 #endif
 
+#include "KWQRefPtr.h"
+
 #include "qobject.h"
 
 // class QGuardedPtrPrivate ====================================================
 
-class QGuardedPtrPrivate : public QObject, public QShared {
-public:
-    QGuardedPtrPrivate(QObject *o);
-    ~QGuardedPtrPrivate();
-    
-    QObject *object() const;
-    
-private:
-    QObject *p;
-};
-
 // class QGuardedPtr ===========================================================
 
-template <class T> class QGuardedPtr : public QObject {
+class QGuardedPtrPrivate;
+
+template <class T> class QGuardedPtr {
 public:
 
     // typedefs ----------------------------------------------------------------
@@ -57,39 +50,37 @@ public:
 
     // constructors, copy constructors, and destructors ------------------------
 
-    QGuardedPtr() {
-        d = new QGuardedPtrPrivate(0L);
+    QGuardedPtr() : d(new QGuardedPtrPrivate(0))
+    {
     }
-    QGuardedPtr(T *o) {
-        d = new QGuardedPtrPrivate(o);
+    QGuardedPtr(T *o) : d(new QGuardedPtrPrivate(o))
+    {
     }
     
     QGuardedPtr(const QGuardedPtr<T> &p) {
         d = p.d;
-        ref();
     }
 
     ~QGuardedPtr() {
-        deref();
     }
 
     // member functions --------------------------------------------------------
 
     bool isNull() const {
-        return !d->object();
+        return d->object() == 0;
     }
 
     // operators ---------------------------------------------------------------
 
     QGuardedPtr &operator=(const QGuardedPtr &p) {
-        if (d != p.d) {
-            deref();
-            d = p.d;
-            ref();
-        } 
+        d = p.d;
         return *this;
     }
     
+    T &operator*() const {
+        return *(T*)d->object();
+    }
+
     operator T *() const {
         return (T*)d->object();
     }
@@ -101,26 +92,26 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    QGuardedPtrPrivate *d;
 
-    void ref()
+    KWQRefPtr<QGuardedPtrPrivate> d;
+}; // class QGuardedPtr ========================================================
+
+class QGuardedPtrPrivate {
+  public:
+    QGuardedPtrPrivate(QObject *o);
+    ~QGuardedPtrPrivate();
+
+    QObject *object()
     {
-        d->ref();
+      return p;
     }
     
-    void deref()
-    {
-        if (d->deref())
-            delete d;
-    }
-
-
-}; // class QGuardedPtr ========================================================
-
+  private:
+    QObject *p;
+    int refCount;
 
-inline QObject *QGuardedPtrPrivate::object() const
-{
-    return p;
-}
+    friend class KWQRefPtr<QGuardedPtrPrivate>;
+};
 
 #endif
+
diff --git a/WebCore/kwq/KWQGuardedPtr.mm b/WebCore/kwq/KWQGuardedPtr.mm
index b79580a..14c5d15 100644
--- a/WebCore/kwq/KWQGuardedPtr.mm
+++ b/WebCore/kwq/KWQGuardedPtr.mm
@@ -26,8 +26,9 @@
 #include <qguardedptr.h>
 
 QGuardedPtrPrivate::QGuardedPtrPrivate(QObject* o)
-    : QObject(0, "_ptrpriv" ), p(o)
+    : p(o)
 {
+    // FIXME: must connect
 }
 
 
diff --git a/WebCore/kwq/KWQNamespace.h b/WebCore/kwq/KWQNamespace.h
index f5c7d6f..6a63c17 100644
--- a/WebCore/kwq/KWQNamespace.h
+++ b/WebCore/kwq/KWQNamespace.h
@@ -276,16 +276,6 @@ public:
     // static member functions -------------------------------------------------
     // constructors, copy constructors, and destructors ------------------------
     
-// add no-arg constructor
-#ifdef _KWQ_PEDANTIC_
-    Qt() {}
-#endif
-
-// add no-op destructor
-#ifdef _KWQ_PEDANTIC_
-    ~Qt() {}
-#endif
-    
     // member functions --------------------------------------------------------
     // operators ---------------------------------------------------------------
 
@@ -294,17 +284,6 @@ public:
 
 private:
 
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
-    Qt(const Qt &);
-#endif
-
-// add assignment operator 
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
-    Qt &operator=(const Qt &);
-#endif
 
 }; // class Qt =================================================================
 
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 3cd0d40..4721a00 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -137,12 +137,6 @@ void QPainter::setPen(const QPen &pen)
 
 void QPainter::setPen(PenStyle style)
 {
-    QPen::QPenData *d = data->qpen.data;
-    if (d->count != 1) {
-        data->qpen.detach();
-        d = data->qpen.data;  
-    }
-
     data->qpen.setStyle(style);
     data->qpen.setColor(Qt::black);
     data->qpen.setWidth(0);
@@ -156,12 +150,6 @@ void QPainter::setBrush(const QBrush &brush)
 
 void QPainter::setBrush(BrushStyle style)
 {
-    QBrush::QBrushData *d = data->qbrush.data;
-    if (d->count != 1) {
-        data->qbrush.detach();
-        d = data->qbrush.data;  
-    }
-
     data->qbrush.setStyle(style);
     data->qbrush.setColor(Qt::black);
 }
diff --git a/WebCore/kwq/KWQPen.h b/WebCore/kwq/KWQPen.h
index dd09ac6..e944e03 100644
--- a/WebCore/kwq/KWQPen.h
+++ b/WebCore/kwq/KWQPen.h
@@ -34,7 +34,6 @@
 #include <qcolor.h>
 
 class QPainter;
-class QPenPrivate;
 
 // class QPen ==================================================================
 
@@ -49,10 +48,12 @@ public:
 
     // constructors, copy constructors, and destructors ------------------------
 
-    QPen();
-    QPen(const QColor &c, uint w=0, PenStyle ps=SolidLine);
-    QPen(const QPen &pen);
-    ~QPen();
+    QPen(const QColor &c = Qt::black, uint w = 0, PenStyle ps = SolidLine);
+
+    // defaults are fine
+    // QPen(const QPen &pen);
+    // ~QPen();
+    // QPen &operator=(const QPen &);
 
     // member functions --------------------------------------------------------
 
@@ -69,21 +70,14 @@ public:
     bool operator==(const QPen &) const;
     bool operator!=(const QPen &) const;
     
-    QPen &operator=(const QPen &);
-
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    QPen copy()  const;
-    void detach();
-    void init(const QColor &, uint, uint);
-    
-    struct QPenData : public QShared {
-        PenStyle  style;
-        uint      width;
-        QColor    color;
-        Q_UINT16  linest;
-    } *data;
+
+    PenStyle  penStyle;
+    uint      penWidth;
+    QColor    penColor;
+    Q_UINT16  linest;
  
 }; // class QPen ===============================================================
 
diff --git a/WebCore/kwq/KWQPen.mm b/WebCore/kwq/KWQPen.mm
index b972cdc..1c6d660 100644
--- a/WebCore/kwq/KWQPen.mm
+++ b/WebCore/kwq/KWQPen.mm
@@ -25,109 +25,47 @@
 
 #include <qpen.h>
 
-void QPen::init(const QColor &color, uint width, uint linestyle)
+QPen::QPen(const QColor &color, uint width, PenStyle style) : penStyle((PenStyle)(style & MPenStyle)), penWidth(width), penColor(color), linest (style)
 {
-    data = new QPenData();
-    data->style = (PenStyle)(linestyle & MPenStyle);
-    data->width = width;
-    data->color = color;
-    data->linest = linestyle;
 }
 
-QPen::QPen()
-{
-    init(Qt::black, 1, SolidLine);
-}
-
-
-QPen::QPen(const QColor &color, uint width, PenStyle style)
-{
-    init(color, width, style);
-}
-
-
-QPen::QPen(const QPen &copyFrom)
-{
-    data = copyFrom.data;
-    data->ref();
-}
-
-
-QPen::~QPen()
-{
-    if (data->deref()) {
-        delete data;
-    }
-}
-
-QPen QPen::copy() const
-{
-    QPen p(data->color, data->width, data->style);
-    return p;
-}
-
-void QPen::detach()
-{
-    if (data->count != 1) {
-        *this = copy();
-    }
-}
 
 const QColor &QPen::color() const
 {
-    return data->color;
+    return penColor;
 }
 
 uint QPen::width() const
 {
-    return data->width;
+    return penWidth;
 }
 
 QPen::PenStyle QPen::style() const
 {
-    return data->style;
+    return penStyle;
 }
 
 void QPen::setColor(const QColor &color)
 {
-    detach();
-    data->color = color;
+    penColor = color;
 }
 
 void QPen::setWidth(uint width)
 {
-    if (data->width == width) {
-        return;
-    }
-    detach();
-    data->width = width;
+    penWidth = width;
 }
 
 void QPen::setStyle(PenStyle style)
 {
-    if (data->style == style) {
-        return;
-    }
-    detach();
-    data->style = style;
-    data->linest = (data->linest & ~MPenStyle) | style;
-}
-
-QPen &QPen::operator=(const QPen &assignFrom)
-{
-    assignFrom.data->ref();
-    if (data->deref()) {
-        delete data;
-    }
-    data = assignFrom.data;
-    return *this;
+    penStyle = style;
+    linest = (linest & ~MPenStyle) | style;
 }
 
 bool QPen::operator==(const QPen &compareTo) const
 {
-    return (data->width == compareTo.data->width) &&
-        (data->style == compareTo.data->style) &&
-        (data->color == compareTo.data->color);
+    return (penWidth == compareTo.penWidth) &&
+        (penStyle == compareTo.penStyle) &&
+        (penColor == compareTo.penColor);
 }
 
 
diff --git a/WebCore/kwq/KWQKPrinter.mm b/WebCore/kwq/KWQPoint.mm
similarity index 68%
copy from WebCore/kwq/KWQKPrinter.mm
copy to WebCore/kwq/KWQPoint.mm
index b7d78fd..7437cdb 100644
--- a/WebCore/kwq/KWQKPrinter.mm
+++ b/WebCore/kwq/KWQPoint.mm
@@ -23,48 +23,46 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <kwqdebug.h>
-#include <kprinter.h>
+#include <qpoint.h>
 
-//FIX ME:
-static QSize tempQSize = QSize(0,0);
-
-bool KPrinter::setup(QWidget *parent=0)
+QPoint::QPoint() : xCoord(0), yCoord(0)
 {
-    _logNeverImplemented();
-    return FALSE;
 }
 
 
-bool KPrinter::newPage()
+QPoint::QPoint(int xIn, int yIn) : xCoord(xIn), yCoord(yIn)
 {
-    _logNeverImplemented();
-    return FALSE;
 }
 
-
-void KPrinter::setDocName(const QString &)
+int QPoint::x() const
 {
-    _logNeverImplemented();
+    return xCoord;
 }
 
-
-void KPrinter::setCreator(const QString &)
+int QPoint::y() const
 {
-    _logNeverImplemented();
+    return yCoord;
 }
 
-
-void KPrinter::setFullPage(bool)
+int QPoint::manhattanLength() const
 {
-    _logNeverImplemented();
+    return abs(xCoord) + abs(yCoord);
 }
 
 
-QSize KPrinter::margins() const
+QPoint operator+(const QPoint &a, const QPoint &b)
 {
-    _logNeverImplemented();
-    return tempQSize;
+    return QPoint(a.xCoord + b.xCoord, a.yCoord + b.yCoord);
 }
 
+QPoint operator-(const QPoint &a, const QPoint &b)
+{
+    return QPoint(a.xCoord - b.xCoord, a.yCoord - b.yCoord);
+}
 
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QPoint &p)
+{
+	return o << "QPoint: [x: " << p.x() << "; h: " << p.y() << "]";
+}
+#endif
diff --git a/WebCore/kwq/KWQPointArray.h b/WebCore/kwq/KWQPointArray.h
index 5a05dae..bebe621 100644
--- a/WebCore/kwq/KWQPointArray.h
+++ b/WebCore/kwq/KWQPointArray.h
@@ -50,7 +50,9 @@ public:
 
     QPoint();
     QPoint(int, int);
-    QPoint(const QPoint &);
+
+    // QPoint(const QPoint &);
+    // default copy constructor is fine
 
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
@@ -64,12 +66,6 @@ public:
 
     int manhattanLength() const;
 
-#ifdef USING_BORROWED_QPOINT
-    bool isNull() const;
-    void setX(int);
-    void setY(int);
-#endif
-
     // operators ---------------------------------------------------------------
 
     /* Note: Trolltech seems to want operator= to be a bitwise copy
@@ -79,31 +75,13 @@ public:
     friend QPoint operator+(const QPoint &, const QPoint &);
     friend QPoint operator-(const QPoint &, const QPoint &);
 
-#ifdef USING_BORROWED_QPOINT
-    QPoint &operator+=(const QPoint &);
-    QPoint &operator-=(const QPoint &);
-    QPoint &operator*=(int);
-    QPoint &operator*=(double);
-    QPoint &operator/=(int);
-    QPoint &operator/=(double);
-
-    friend bool operator==(const QPoint &, const QPoint &);
-    friend bool operator!=(const QPoint &, const QPoint &);
-    friend QPoint operator*(const QPoint &, int);
-    friend QPoint operator*(int, const QPoint &);
-    friend QPoint operator*(const QPoint &, double);
-    friend QPoint operator*(double, const QPoint &);
-    friend QPoint operator-(const QPoint &);
-    friend QPoint operator/(const QPoint &, int);
-    friend QPoint operator/(const QPoint &, double);
-#endif
-
 // protected -------------------------------------------------------------------
 
 // private ---------------------------------------------------------------------
+private:
 
-    QCOORD xx;
-    QCOORD yy;
+    QCOORD xCoord;
+    QCOORD yCoord;
 
 }; // class QPoint =============================================================
 
diff --git a/WebCore/kwq/KWQRect.h b/WebCore/kwq/KWQRect.h
index 3ae421d..ad8bfb9 100644
--- a/WebCore/kwq/KWQRect.h
+++ b/WebCore/kwq/KWQRect.h
@@ -50,14 +50,11 @@ public:
     // constructors, copy constructors, and destructors ------------------------
 
     QRect();
+    QRect(QPoint p, QSize s);
     QRect(int, int, int, int);
-    QRect(const QRect &);
+    // QRect(const QRect &);
+    // default copy constructor is fine
 
-#ifdef USING_BORROWED_QRECT
-    QRect(const QPoint &, const QPoint &);
-    QRect(const QPoint &, const QSize &);
-#endif
-    
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
     ~QRect() {}
@@ -77,48 +74,13 @@ public:
     int width() const;
     int height() const;
 
+    QPoint topLeft() const;
     QSize size() const;
     void setWidth(int);
     void setHeight(int);
     QRect intersect(const QRect &) const;
     bool intersects(const QRect &) const;
 
-#ifdef USING_BORROWED_QRECT
-    bool isEmpty() const;
-    QRect normalize() const;
-
-    void setLeft(int);
-    void setTop(int);
-    void setRight(int);
-    void setBottom(int);
-    void setX(int);
-    void setY(int);
-
-    QPoint topLeft() const;
-    QPoint bottomRight() const;
-    QPoint topRight() const;
-    QPoint bottomLeft() const;
-    QPoint center() const;
-
-    void rect(int *, int *, int *, int *) const;
-    void coords(int *, int *, int *, int *) const;
-
-    void setSize(const QSize &);
-    void setRect(int, int, int, int);
-    void setCoords(int, int, int, int);
-
-    void moveTopLeft(const QPoint &);
-    void moveBottomRight(const QPoint &);
-    void moveTopRight(const QPoint &);
-    void moveBottomLeft(const QPoint &);
-    void moveCenter(const QPoint &);
-    void moveBy(int, int);
-
-    bool contains(const QPoint &, bool proper=FALSE) const;
-    bool contains(int, int, bool proper=FALSE) const;
-    bool contains(const QRect &, bool proper=FALSE) const;
-    QRect unite(const QRect &) const;
-#endif // USING_BORROWED_QRECT
 
     // operators ---------------------------------------------------------------
 
@@ -128,15 +90,6 @@ public:
 
     QRect operator&(const QRect &) const;
 
-#ifdef USING_BORROWED_QRECT
-    friend bool operator==(const QRect &, const QRect &);
-    friend bool operator!=(const QRect &, const QRect &);
-
-    QRect operator|(const QRect &) const;
-    QRect& operator|=(const QRect &);
-    QRect& operator&=(const QRect &);
-#endif
-
 #ifdef _KWQ_IOSTREAM_
     friend ostream &operator<<(ostream &, const QRect &);
 #endif
@@ -145,11 +98,14 @@ public:
 
 // private ---------------------------------------------------------------------
 
-    QCOORD x1;
-    QCOORD x2;
-    QCOORD y1;
-    QCOORD y2;
+private:
+    QCOORD xp;
+    QCOORD yp;
+    QCOORD w;
+    QCOORD h;
 
+    friend bool operator==(const QRect &, const QRect &);
+    friend bool operator!=(const QRect &, const QRect &);
 }; // class QRect ==============================================================
 
 // operators associated with QRect =============================================
diff --git a/WebCore/kwq/KWQRect.mm b/WebCore/kwq/KWQRect.mm
new file mode 100644
index 0000000..799f658
--- /dev/null
+++ b/WebCore/kwq/KWQRect.mm
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2001 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include <qrect.h>
+
+#define MAX(a,b) ((a) >= (b) ? (a) : (b))
+
+
+QRect::QRect() : xp(0), yp(0), w(1), h(1)
+{
+}
+
+QRect::QRect(int x, int y, int width, int height) : xp(x), yp(y), w(width), h(height)
+{
+}
+
+QRect::QRect(QPoint p, QSize s) : xp(p.x()), yp(p.y()), w(s.width()), h(s.height())
+{
+}
+
+bool QRect::isNull() const
+{
+    return w == 0 && h == 0;
+}
+
+bool QRect::isValid() const
+{
+    return w > 0 && h > 0;
+}
+
+int QRect::x() const
+{
+    return xp;
+}
+
+int QRect::y() const
+{
+    return yp;
+}
+
+int QRect::left() const
+{
+    return xp;
+}
+
+int QRect::top() const
+{
+    return yp;
+}
+
+int QRect::right() const
+{
+    return xp + w - 1;
+}
+
+int QRect::bottom() const
+{
+    return yp + h - 1;
+}
+
+int QRect::width() const
+{
+    return w;
+}
+
+int QRect::height() const
+{
+    return h;
+}
+
+QPoint QRect::topLeft() const
+{
+    return QPoint(xp,yp);
+}
+
+QSize QRect::size() const
+{
+    return QSize(w,h);
+}
+
+void QRect::setWidth(int width)
+{
+    w = width;
+}
+
+void QRect::setHeight(int height)
+{
+    h = height;
+}
+
+QRect QRect::intersect(const QRect &r) const
+{
+    return operator&(r);
+}
+
+bool QRect::intersects(const QRect &r) const
+{
+    return (intersect(r)).isValid();
+}
+
+QRect QRect::operator&(const QRect &r) const
+{
+    int nx, ny, nw, nh;
+
+    nx = MAX(xp, r.xp);
+    ny = MAX(yp, r.yp);
+
+    if (xp + w <= r.xp + r.w) {
+        nw = xp + w - nx;
+    } else {
+        nw = r.xp + r.w - nx; 
+    }
+
+    if (yp + h <= r.yp + r.h) {
+        nh = yp + h - ny;
+    } else {
+        nh = r.yp + r.h - ny; 
+    }
+
+    return QRect(nx, ny, nw, nh);
+}
+
+bool operator==(const QRect &a, const QRect &b)
+{
+	return a.xp == b.xp && a.yp == b.yp && a.w == b.w && a.h == b.h;
+}
+
+bool operator!=(const QRect &a, const QRect &b)
+{
+	return a.xp != b.xp || a.yp != b.yp || a.w != b.w || a.h != b.h;
+}
+
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QRect &r)
+{
+    return o << "QRect: [left: " << r.left () << "; top: " << r.top() << "; right: " << r.right() << "; bottom: " << r.bottom() << "]";
+}
+#endif
+
+
diff --git a/WebCore/src/kwq/kio/kprinter.h b/WebCore/kwq/KWQRefPtr.h
similarity index 62%
copy from WebCore/src/kwq/kio/kprinter.h
copy to WebCore/kwq/KWQRefPtr.h
index 4562554..8615376 100644
--- a/WebCore/src/kwq/kio/kprinter.h
+++ b/WebCore/kwq/KWQRefPtr.h
@@ -23,30 +23,72 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef KPRINTER_H_
-#define KPRINTER_H_
+#ifndef KWQREFPTR_H_
+#define KWQREFPTR_H_
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#include <qpaintdevice.h>
-#include <qstring.h>
-#include <qwidget.h>
-#include <qsize.h>
 
-// NOTE: I stuck this file here rather than create a whole new 
-// kdeprint directory
-
-class KPrinter : public QPaintDevice {
+template <class T> class KWQRefPtr {
 public:
-    bool setup(QWidget *parent=0);
-    bool newPage();
-    void setDocName(const QString &);
-    void setCreator(const QString &);
-    void setFullPage(bool);
-    QSize margins() const;
+    explicit KWQRefPtr(T* ptr = 0) : pointer(ptr)
+    {
+        ref();
+    }
+
+    KWQRefPtr(const KWQRefPtr& r) : pointer(r.pointer)
+    {
+        ref();
+    }
+
+    KWQRefPtr& operator=(const KWQRefPtr& r) {
+        if (&r != this) {
+	    r.ref();
+	    unref();
+	    pointer = r.pointer;
+	}
+	return *this;
+    }
+
+    ~KWQRefPtr() 
+    {
+        unref();
+    }
+
+    bool isNull() const {
+        return pointer == 0;
+    }
+
+    T& operator*() const {
+        return *pointer;
+    }
+
+    T* operator->() const {
+        return pointer;
+    }
+
+private:
+    void unref() 
+    {
+        if (!isNull()) {
+	    if (--pointer->refCount == 0) {
+	        delete pointer;
+	    }
+	}
+    }
+
+    void ref() const 
+    {
+        if (!isNull()) {
+  	    ++pointer->refCount;
+	}
+    }
+
+    T* pointer;
 };
 
+
 #endif
 
diff --git a/WebCore/kwq/KWQSize.h b/WebCore/kwq/KWQSize.h
index 8e6014d..43fca06 100644
--- a/WebCore/kwq/KWQSize.h
+++ b/WebCore/kwq/KWQSize.h
@@ -48,7 +48,7 @@ public:
 
     QSize();
     QSize(int,int);
-    QSize(const QSize &);
+    // QSize(const QSize &);
 
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
@@ -64,13 +64,6 @@ public:
     void setHeight(int);
     QSize expandedTo(const QSize &) const;
 
-#ifdef USING_BORROWED_QSIZE
-    bool isNull() const;
-    bool isEmpty() const;
-    void transpose();
-    QSize boundedTo(const QSize &) const;
-#endif
-
     // operators ---------------------------------------------------------------
 
     /* Note: Trolltech seems to want operator= to be a bitwise copy
@@ -81,22 +74,6 @@ public:
     friend bool operator==(const QSize &, const QSize &);
     friend bool operator!=(const QSize &, const QSize &);
 
-#ifdef USING_BORROWED_QSIZE
-    QSize &operator+=(const QSize &);
-    QSize &operator-=(const QSize &);
-    QSize &operator*=(int);
-    QSize &operator*=(double);
-    QSize &operator/=(int);
-    QSize &operator/=(double);
-
-    friend QSize operator-(const QSize &, const QSize &);
-    friend QSize operator*(const QSize &, int);
-    friend QSize operator*(int, const QSize &);
-    friend QSize operator*(const QSize &, double);
-    friend QSize operator*(double, const QSize &);
-    friend QSize operator/(const QSize &, int);
-    friend QSize operator/(const QSize &, double);
-#endif
 
 #ifdef _KWQ_IOSTREAM_
     friend ostream &operator<<(ostream &, const QSize &);
diff --git a/WebCore/src/kwq/KWQKProcess.mm b/WebCore/kwq/KWQSize.mm
similarity index 62%
copy from WebCore/src/kwq/KWQKProcess.mm
copy to WebCore/kwq/KWQSize.mm
index b1a5c5c..8decf71 100644
--- a/WebCore/src/kwq/KWQKProcess.mm
+++ b/WebCore/kwq/KWQSize.mm
@@ -23,64 +23,63 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <kwqdebug.h>
-#include <kprocess.h>
+#include <qsize.h>
 
-KProcess::KProcess()
+QSize::QSize() : w(-1), h(-1)
 {
-    _logNotYetImplemented();
 }
 
-
-KProcess::~KProcess()
+QSize::QSize(int width, int height) : w(width), h(height)
 {
-    _logNotYetImplemented();
 }
 
-
-QStrList *KProcess::args()
+bool QSize::isValid() const
 {
-    _logNotYetImplemented();
-    return new QStrList();
+	return w >= 0 && h>= 0;
 }
 
-
-bool KProcess::isRunning() const
+int QSize::width() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	return w;
 }
 
-
-bool KProcess::writeStdin(const char *buffer, int buflen)
+int QSize::height() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	return h;
 }
 
-
-bool KProcess::start(RunMode runmode, Communication comm)
+void QSize::setWidth(int width)
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	w = width;
 }
-
-
-bool KProcess::kill(int signo=SIGTERM)
+void QSize::setHeight(int height)
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	h = height;
+}
+QSize QSize::expandedTo(const QSize &o) const
+{
+	return QSize(w > o.w ? w : o.w, h > o.h ? h : o.h);
 }
 
+QSize operator+(const QSize &a, const QSize &b)
+{
+	return QSize(a.w + b.w, a.h + b.h);
+}
 
-void KProcess::resume()
+bool operator==(const QSize &a, const QSize &b)
 {
-    _logNotYetImplemented();
+	return a.w == b.w && a.h == b.h;
 }
 
+bool operator!=(const QSize &a, const QSize &b)
+{
+	return a.w != b.w || a.h != b.h;
+}
 
-KProcess &KProcess::operator<<(const QString& arg)
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QSize &s)
 {
-    _logNotYetImplemented();
-    return *this;
+	return o << "QSize: [w: " << s.width() << "; h: " << s.height() << "]";
 }
+#endif
+
diff --git a/WebCore/kwq/KWQVariant.h b/WebCore/kwq/KWQVariant.h
index 41290ff..2458bae 100644
--- a/WebCore/kwq/KWQVariant.h
+++ b/WebCore/kwq/KWQVariant.h
@@ -30,10 +30,11 @@
 #include <config.h>
 #endif
 
+#include <KWQRefPtr.h>
+
 typedef unsigned int uint;
 
 class QString;
-class QVariantPrivate;
 
 // class QVariant ==============================================================
 
@@ -76,8 +77,9 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
+    class QVariantPrivate;
     
-    QVariantPrivate *d;
+    KWQRefPtr<QVariantPrivate> d;
 
 }; // class QVariant ===========================================================
 
diff --git a/WebCore/kwq/KWQVariant.mm b/WebCore/kwq/KWQVariant.mm
index 923b557..24a0a2b 100644
--- a/WebCore/kwq/KWQVariant.mm
+++ b/WebCore/kwq/KWQVariant.mm
@@ -26,32 +26,11 @@
 
 #include <qvariant.h>
 #include <qstring.h>
-#include <_qshared.h>
 
-class QVariantPrivate : public QShared {
-friend class QVariant;
+class QVariant::QVariantPrivate {
 public:
-    QVariantPrivate() {
-        t = QVariant::Invalid;
-    }
-    
-    QVariantPrivate(QVariantPrivate *other) {
-        switch (other->t) {
-            case QVariant::Invalid:
-                break;
-            case QVariant::String:
-                value.p = new QString(*((QString*)other->value.p));
-                break;
-            case QVariant::UInt:
-                value.u = other->value.u;
-                break;
-            case QVariant::Double:
-                value.d = other->value.d;
-                break;
-            case QVariant::Bool:
-                value.b = other->value.b;
-                break;
-        }
+    QVariantPrivate() : t(QVariant::Invalid), refCount(0)
+    {
     }
     
     ~QVariantPrivate() {
@@ -81,50 +60,46 @@ public:
         double d;
         void *p;
     } value;
+
+    int refCount;
+
+    friend KWQRefPtr<QVariantPrivate>;
 };
 
-QVariant::QVariant()
+QVariant::QVariant() : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
 }
 
 
-QVariant::QVariant(bool val, int i)
+QVariant::QVariant(bool val, int i) : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
     d->t = Bool;
     d->value.d = val;
 }
 
 
-QVariant::QVariant(double val)
+QVariant::QVariant(double val) : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
     d->t = Double;
     d->value.d = val;
 }
 
 
-QVariant::QVariant(const QString &s)
+QVariant::QVariant(const QString &s) : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
     d->t = String;
     d->value.p = new QString(s);
 }
 
 
-QVariant::QVariant(const QVariant &other)
+QVariant::QVariant(const QVariant &other) : d(0)
 {
-    d = new QVariantPrivate();
-    *this = other;
+    d = other.d;
 }
 
 
 QVariant::~QVariant()
 {
-    if (d->deref()) {
-        delete d;
-    }
 }
 
 
@@ -168,14 +143,7 @@ uint QVariant::toUInt() const
 
 QVariant &QVariant::operator=(const QVariant &other)
 {
-    QVariant &variant = (QVariant &)other;
-    
-    variant.d->ref();
-    if (d->deref()) {
-        delete d;
-    }
-    d = variant.d;
-    
+    d = other.d;
     return *this;
 }
 
diff --git a/WebCore/kwq/Makefile.in b/WebCore/kwq/Makefile.in
index 5e2f0be..8439651 100644
--- a/WebCore/kwq/Makefile.in
+++ b/WebCore/kwq/Makefile.in
@@ -40,6 +40,9 @@ MMOBJECTS = \
     KWQFontMetrics.o \
     KWQFrame.o \
     KWQGuardedPtr.o \
+    KWQPoint.o \
+    KWQRect.o \
+    KWQSize.o \
     KWQHBox.o \
     KWQImage.o \
     KWQInputDialog.o \
diff --git a/WebCore/kwq/_KWQOwner.h b/WebCore/kwq/_KWQOwner.h
index f6b9ba4..b82670d 100644
--- a/WebCore/kwq/_KWQOwner.h
+++ b/WebCore/kwq/_KWQOwner.h
@@ -1,3 +1,31 @@
+/*
+ * Copyright (C) 2001 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef KWQOWNER_H_
+#define KWQOWNER_H_
+
 #import <Cocoa/Cocoa.h>
 #import <WCBackForwardList.h>
 
@@ -15,3 +43,5 @@
 -(void)updateButtons;
 
 @end
+
+#endif
diff --git a/WebCore/kwq/qt/_qpoint.cpp b/WebCore/kwq/qt/_qpoint.cpp
index 338ef59..b029776 100644
--- a/WebCore/kwq/qt/_qpoint.cpp
+++ b/WebCore/kwq/qt/_qpoint.cpp
@@ -14,6 +14,10 @@
 
 #include "qpoint.h"
 
+// KWQ hacks ---------------------------------------------------------------
+
+#ifdef USING_BORROWED_QPOINT
+
 // for abs()
 #include <stdlib.h>
 
@@ -72,10 +76,6 @@ ostream &operator<<(ostream &o, const QPoint &p)
 }
 #endif
 
-// KWQ hacks ---------------------------------------------------------------
-
-#ifdef USING_BORROWED_QPOINT
-
 // -------------------------------------------------------------------------
 
 bool QPoint::isNull() const
diff --git a/WebCore/kwq/qt/_qrect.cpp b/WebCore/kwq/qt/_qrect.cpp
index cd7c3a8..32c5dfe 100644
--- a/WebCore/kwq/qt/_qrect.cpp
+++ b/WebCore/kwq/qt/_qrect.cpp
@@ -20,6 +20,10 @@
 
 #include <qrect.h>
 
+// KWQ hacks ---------------------------------------------------------------
+
+#ifdef USING_BORROWED_QRECT
+
 QRect::QRect()
 {
     x1 = x2 = y1 = y2 = 0;
@@ -143,10 +147,6 @@ ostream &operator<<(ostream &o, const QRect &r)
 }
 #endif
 
-// KWQ hacks ---------------------------------------------------------------
-
-#ifdef USING_BORROWED_QRECT
-
 // -------------------------------------------------------------------------
 
 QRect::QRect( const QPoint &topLeft, const QPoint &bottomRight )
diff --git a/WebCore/kwq/qt/_qsize.cpp b/WebCore/kwq/qt/_qsize.cpp
index f77e221..d5eb71e 100644
--- a/WebCore/kwq/qt/_qsize.cpp
+++ b/WebCore/kwq/qt/_qsize.cpp
@@ -20,6 +20,10 @@
 
 #include <qsize.h>
 
+// KWQ hacks ---------------------------------------------------------------
+
+#ifdef USING_BORROWED_QSIZE
+
 QSize::QSize() 
 {
     w = h = -1;
@@ -100,10 +104,6 @@ ostream &operator<<(ostream &o, const QSize &s)
 }
 #endif
 
-// KWQ hacks ---------------------------------------------------------------
-
-#ifdef USING_BORROWED_QSIZE
-
 // -------------------------------------------------------------------------
 
 bool QSize::isNull() const
diff --git a/WebCore/kwq/qt/qbrush.h b/WebCore/kwq/qt/qbrush.h
index f859435..17c06bd 100644
--- a/WebCore/kwq/qt/qbrush.h
+++ b/WebCore/kwq/qt/qbrush.h
@@ -48,12 +48,12 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    QBrush();
-    QBrush(const QColor &);
-    QBrush::QBrush(const QColor &c, BrushStyle style);
-    QBrush(const QBrush &);
-    QBrush &operator=(const QBrush &);
-    ~QBrush();
+    QBrush::QBrush(const QColor &c = Qt::black, BrushStyle style = SolidPattern);
+
+    // Defaults are fine
+    // QBrush(const QBrush &);
+    // QBrush &operator=(const QBrush &);
+    // ~QBrush();
  
     // member functions --------------------------------------------------------
     
@@ -70,14 +70,8 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    void init(const QColor &, BrushStyle);
-    QBrush copy() const;
-    void detach();
-    struct QBrushData : public QShared { 
-        BrushStyle brushStyle;
-        QColor color;
-    } *data;
-
+    QColor brushColor;
+    BrushStyle brushStyle;
 }; // class QBrush =============================================================
 
 #endif
diff --git a/WebCore/kwq/qt/qguardedptr.h b/WebCore/kwq/qt/qguardedptr.h
index 2eaacf3..df6fec7 100644
--- a/WebCore/kwq/qt/qguardedptr.h
+++ b/WebCore/kwq/qt/qguardedptr.h
@@ -30,24 +30,17 @@
 #include <config.h>
 #endif
 
+#include "KWQRefPtr.h"
+
 #include "qobject.h"
 
 // class QGuardedPtrPrivate ====================================================
 
-class QGuardedPtrPrivate : public QObject, public QShared {
-public:
-    QGuardedPtrPrivate(QObject *o);
-    ~QGuardedPtrPrivate();
-    
-    QObject *object() const;
-    
-private:
-    QObject *p;
-};
-
 // class QGuardedPtr ===========================================================
 
-template <class T> class QGuardedPtr : public QObject {
+class QGuardedPtrPrivate;
+
+template <class T> class QGuardedPtr {
 public:
 
     // typedefs ----------------------------------------------------------------
@@ -57,39 +50,37 @@ public:
 
     // constructors, copy constructors, and destructors ------------------------
 
-    QGuardedPtr() {
-        d = new QGuardedPtrPrivate(0L);
+    QGuardedPtr() : d(new QGuardedPtrPrivate(0))
+    {
     }
-    QGuardedPtr(T *o) {
-        d = new QGuardedPtrPrivate(o);
+    QGuardedPtr(T *o) : d(new QGuardedPtrPrivate(o))
+    {
     }
     
     QGuardedPtr(const QGuardedPtr<T> &p) {
         d = p.d;
-        ref();
     }
 
     ~QGuardedPtr() {
-        deref();
     }
 
     // member functions --------------------------------------------------------
 
     bool isNull() const {
-        return !d->object();
+        return d->object() == 0;
     }
 
     // operators ---------------------------------------------------------------
 
     QGuardedPtr &operator=(const QGuardedPtr &p) {
-        if (d != p.d) {
-            deref();
-            d = p.d;
-            ref();
-        } 
+        d = p.d;
         return *this;
     }
     
+    T &operator*() const {
+        return *(T*)d->object();
+    }
+
     operator T *() const {
         return (T*)d->object();
     }
@@ -101,26 +92,26 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    QGuardedPtrPrivate *d;
 
-    void ref()
+    KWQRefPtr<QGuardedPtrPrivate> d;
+}; // class QGuardedPtr ========================================================
+
+class QGuardedPtrPrivate {
+  public:
+    QGuardedPtrPrivate(QObject *o);
+    ~QGuardedPtrPrivate();
+
+    QObject *object()
     {
-        d->ref();
+      return p;
     }
     
-    void deref()
-    {
-        if (d->deref())
-            delete d;
-    }
-
-
-}; // class QGuardedPtr ========================================================
-
+  private:
+    QObject *p;
+    int refCount;
 
-inline QObject *QGuardedPtrPrivate::object() const
-{
-    return p;
-}
+    friend class KWQRefPtr<QGuardedPtrPrivate>;
+};
 
 #endif
+
diff --git a/WebCore/kwq/qt/qnamespace.h b/WebCore/kwq/qt/qnamespace.h
index f5c7d6f..6a63c17 100644
--- a/WebCore/kwq/qt/qnamespace.h
+++ b/WebCore/kwq/qt/qnamespace.h
@@ -276,16 +276,6 @@ public:
     // static member functions -------------------------------------------------
     // constructors, copy constructors, and destructors ------------------------
     
-// add no-arg constructor
-#ifdef _KWQ_PEDANTIC_
-    Qt() {}
-#endif
-
-// add no-op destructor
-#ifdef _KWQ_PEDANTIC_
-    ~Qt() {}
-#endif
-    
     // member functions --------------------------------------------------------
     // operators ---------------------------------------------------------------
 
@@ -294,17 +284,6 @@ public:
 
 private:
 
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
-    Qt(const Qt &);
-#endif
-
-// add assignment operator 
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
-    Qt &operator=(const Qt &);
-#endif
 
 }; // class Qt =================================================================
 
diff --git a/WebCore/kwq/qt/qpen.h b/WebCore/kwq/qt/qpen.h
index dd09ac6..e944e03 100644
--- a/WebCore/kwq/qt/qpen.h
+++ b/WebCore/kwq/qt/qpen.h
@@ -34,7 +34,6 @@
 #include <qcolor.h>
 
 class QPainter;
-class QPenPrivate;
 
 // class QPen ==================================================================
 
@@ -49,10 +48,12 @@ public:
 
     // constructors, copy constructors, and destructors ------------------------
 
-    QPen();
-    QPen(const QColor &c, uint w=0, PenStyle ps=SolidLine);
-    QPen(const QPen &pen);
-    ~QPen();
+    QPen(const QColor &c = Qt::black, uint w = 0, PenStyle ps = SolidLine);
+
+    // defaults are fine
+    // QPen(const QPen &pen);
+    // ~QPen();
+    // QPen &operator=(const QPen &);
 
     // member functions --------------------------------------------------------
 
@@ -69,21 +70,14 @@ public:
     bool operator==(const QPen &) const;
     bool operator!=(const QPen &) const;
     
-    QPen &operator=(const QPen &);
-
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    QPen copy()  const;
-    void detach();
-    void init(const QColor &, uint, uint);
-    
-    struct QPenData : public QShared {
-        PenStyle  style;
-        uint      width;
-        QColor    color;
-        Q_UINT16  linest;
-    } *data;
+
+    PenStyle  penStyle;
+    uint      penWidth;
+    QColor    penColor;
+    Q_UINT16  linest;
  
 }; // class QPen ===============================================================
 
diff --git a/WebCore/kwq/qt/qpoint.h b/WebCore/kwq/qt/qpoint.h
index 5a05dae..bebe621 100644
--- a/WebCore/kwq/qt/qpoint.h
+++ b/WebCore/kwq/qt/qpoint.h
@@ -50,7 +50,9 @@ public:
 
     QPoint();
     QPoint(int, int);
-    QPoint(const QPoint &);
+
+    // QPoint(const QPoint &);
+    // default copy constructor is fine
 
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
@@ -64,12 +66,6 @@ public:
 
     int manhattanLength() const;
 
-#ifdef USING_BORROWED_QPOINT
-    bool isNull() const;
-    void setX(int);
-    void setY(int);
-#endif
-
     // operators ---------------------------------------------------------------
 
     /* Note: Trolltech seems to want operator= to be a bitwise copy
@@ -79,31 +75,13 @@ public:
     friend QPoint operator+(const QPoint &, const QPoint &);
     friend QPoint operator-(const QPoint &, const QPoint &);
 
-#ifdef USING_BORROWED_QPOINT
-    QPoint &operator+=(const QPoint &);
-    QPoint &operator-=(const QPoint &);
-    QPoint &operator*=(int);
-    QPoint &operator*=(double);
-    QPoint &operator/=(int);
-    QPoint &operator/=(double);
-
-    friend bool operator==(const QPoint &, const QPoint &);
-    friend bool operator!=(const QPoint &, const QPoint &);
-    friend QPoint operator*(const QPoint &, int);
-    friend QPoint operator*(int, const QPoint &);
-    friend QPoint operator*(const QPoint &, double);
-    friend QPoint operator*(double, const QPoint &);
-    friend QPoint operator-(const QPoint &);
-    friend QPoint operator/(const QPoint &, int);
-    friend QPoint operator/(const QPoint &, double);
-#endif
-
 // protected -------------------------------------------------------------------
 
 // private ---------------------------------------------------------------------
+private:
 
-    QCOORD xx;
-    QCOORD yy;
+    QCOORD xCoord;
+    QCOORD yCoord;
 
 }; // class QPoint =============================================================
 
diff --git a/WebCore/kwq/qt/qrect.h b/WebCore/kwq/qt/qrect.h
index 3ae421d..ad8bfb9 100644
--- a/WebCore/kwq/qt/qrect.h
+++ b/WebCore/kwq/qt/qrect.h
@@ -50,14 +50,11 @@ public:
     // constructors, copy constructors, and destructors ------------------------
 
     QRect();
+    QRect(QPoint p, QSize s);
     QRect(int, int, int, int);
-    QRect(const QRect &);
+    // QRect(const QRect &);
+    // default copy constructor is fine
 
-#ifdef USING_BORROWED_QRECT
-    QRect(const QPoint &, const QPoint &);
-    QRect(const QPoint &, const QSize &);
-#endif
-    
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
     ~QRect() {}
@@ -77,48 +74,13 @@ public:
     int width() const;
     int height() const;
 
+    QPoint topLeft() const;
     QSize size() const;
     void setWidth(int);
     void setHeight(int);
     QRect intersect(const QRect &) const;
     bool intersects(const QRect &) const;
 
-#ifdef USING_BORROWED_QRECT
-    bool isEmpty() const;
-    QRect normalize() const;
-
-    void setLeft(int);
-    void setTop(int);
-    void setRight(int);
-    void setBottom(int);
-    void setX(int);
-    void setY(int);
-
-    QPoint topLeft() const;
-    QPoint bottomRight() const;
-    QPoint topRight() const;
-    QPoint bottomLeft() const;
-    QPoint center() const;
-
-    void rect(int *, int *, int *, int *) const;
-    void coords(int *, int *, int *, int *) const;
-
-    void setSize(const QSize &);
-    void setRect(int, int, int, int);
-    void setCoords(int, int, int, int);
-
-    void moveTopLeft(const QPoint &);
-    void moveBottomRight(const QPoint &);
-    void moveTopRight(const QPoint &);
-    void moveBottomLeft(const QPoint &);
-    void moveCenter(const QPoint &);
-    void moveBy(int, int);
-
-    bool contains(const QPoint &, bool proper=FALSE) const;
-    bool contains(int, int, bool proper=FALSE) const;
-    bool contains(const QRect &, bool proper=FALSE) const;
-    QRect unite(const QRect &) const;
-#endif // USING_BORROWED_QRECT
 
     // operators ---------------------------------------------------------------
 
@@ -128,15 +90,6 @@ public:
 
     QRect operator&(const QRect &) const;
 
-#ifdef USING_BORROWED_QRECT
-    friend bool operator==(const QRect &, const QRect &);
-    friend bool operator!=(const QRect &, const QRect &);
-
-    QRect operator|(const QRect &) const;
-    QRect& operator|=(const QRect &);
-    QRect& operator&=(const QRect &);
-#endif
-
 #ifdef _KWQ_IOSTREAM_
     friend ostream &operator<<(ostream &, const QRect &);
 #endif
@@ -145,11 +98,14 @@ public:
 
 // private ---------------------------------------------------------------------
 
-    QCOORD x1;
-    QCOORD x2;
-    QCOORD y1;
-    QCOORD y2;
+private:
+    QCOORD xp;
+    QCOORD yp;
+    QCOORD w;
+    QCOORD h;
 
+    friend bool operator==(const QRect &, const QRect &);
+    friend bool operator!=(const QRect &, const QRect &);
 }; // class QRect ==============================================================
 
 // operators associated with QRect =============================================
diff --git a/WebCore/kwq/qt/qsize.h b/WebCore/kwq/qt/qsize.h
index 8e6014d..43fca06 100644
--- a/WebCore/kwq/qt/qsize.h
+++ b/WebCore/kwq/qt/qsize.h
@@ -48,7 +48,7 @@ public:
 
     QSize();
     QSize(int,int);
-    QSize(const QSize &);
+    // QSize(const QSize &);
 
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
@@ -64,13 +64,6 @@ public:
     void setHeight(int);
     QSize expandedTo(const QSize &) const;
 
-#ifdef USING_BORROWED_QSIZE
-    bool isNull() const;
-    bool isEmpty() const;
-    void transpose();
-    QSize boundedTo(const QSize &) const;
-#endif
-
     // operators ---------------------------------------------------------------
 
     /* Note: Trolltech seems to want operator= to be a bitwise copy
@@ -81,22 +74,6 @@ public:
     friend bool operator==(const QSize &, const QSize &);
     friend bool operator!=(const QSize &, const QSize &);
 
-#ifdef USING_BORROWED_QSIZE
-    QSize &operator+=(const QSize &);
-    QSize &operator-=(const QSize &);
-    QSize &operator*=(int);
-    QSize &operator*=(double);
-    QSize &operator/=(int);
-    QSize &operator/=(double);
-
-    friend QSize operator-(const QSize &, const QSize &);
-    friend QSize operator*(const QSize &, int);
-    friend QSize operator*(int, const QSize &);
-    friend QSize operator*(const QSize &, double);
-    friend QSize operator*(double, const QSize &);
-    friend QSize operator/(const QSize &, int);
-    friend QSize operator/(const QSize &, double);
-#endif
 
 #ifdef _KWQ_IOSTREAM_
     friend ostream &operator<<(ostream &, const QSize &);
diff --git a/WebCore/kwq/qt/qvariant.h b/WebCore/kwq/qt/qvariant.h
index 41290ff..2458bae 100644
--- a/WebCore/kwq/qt/qvariant.h
+++ b/WebCore/kwq/qt/qvariant.h
@@ -30,10 +30,11 @@
 #include <config.h>
 #endif
 
+#include <KWQRefPtr.h>
+
 typedef unsigned int uint;
 
 class QString;
-class QVariantPrivate;
 
 // class QVariant ==============================================================
 
@@ -76,8 +77,9 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
+    class QVariantPrivate;
     
-    QVariantPrivate *d;
+    KWQRefPtr<QVariantPrivate> d;
 
 }; // class QVariant ===========================================================
 
diff --git a/WebCore/src/kdelibs/khtml/ecma/kjs_binding.h b/WebCore/src/kdelibs/khtml/ecma/kjs_binding.h
index cf13ab6..f426b69 100644
--- a/WebCore/src/kdelibs/khtml/ecma/kjs_binding.h
+++ b/WebCore/src/kdelibs/khtml/ecma/kjs_binding.h
@@ -26,6 +26,7 @@
 #include <dom/dom_doc.h>
 #include <kurl.h>
 #include <qguardedptr.h>
+#include <qvariant.h>
 
 namespace KJS {
 
diff --git a/WebCore/src/kwq/KWQBrush.mm b/WebCore/src/kwq/KWQBrush.mm
index 376b91a..a908baf 100644
--- a/WebCore/src/kwq/KWQBrush.mm
+++ b/WebCore/src/kwq/KWQBrush.mm
@@ -25,96 +25,40 @@
 
 #include <qbrush.h>
 
-void QBrush::init(const QColor &color, BrushStyle style)
+QBrush::QBrush(const QColor &c, BrushStyle style) :  brushColor(c), brushStyle(style)
 {
-    data = new QBrushData();
-    data->color = color;
-    data->brushStyle = style;
-}
-
-QBrush::QBrush()
-{
-    init(Qt::black, SolidPattern);
-}
-
-
-QBrush::QBrush(const QColor &c)
-{
-    init(c, SolidPattern);
-}
-
-QBrush::QBrush(const QColor &c, BrushStyle style)
-{
-    init(c, style);
-}
-
-QBrush::QBrush(const QBrush &copyFrom)
-{
-    data = copyFrom.data;
-    data->ref();
-}
-
-QBrush &QBrush::operator=(const QBrush &assignFrom)
-{
-    assignFrom.data->ref();
-    if (data->deref()) {
-        delete data;
-    }
-    data = assignFrom.data;
-    return *this;
-}
-
-QBrush::~QBrush()
-{
-    if (data->deref()) {
-        delete data;
-    }
-}
-
-QBrush QBrush::copy() const
-{
-    return QBrush(data->color, data->brushStyle);
-}
-
-void QBrush::detach()
-{
-    if (data->count != 1) {
-        *this = copy();
-    }
 }
 
 const QColor &QBrush::color() const
 {
-    return data->color;
+    return brushColor;
 }
 
 void QBrush::setColor(const QColor &c)
 {
-    detach();
-    data->color = c;
+    brushColor = c;
 }
 
 Qt::BrushStyle QBrush::style() const
 {
-    return data->brushStyle;
+    return brushStyle;
 }
 
 void QBrush::setStyle(Qt::BrushStyle bs)
 {
-    detach();
-    data->brushStyle = bs;
+    brushStyle = bs;
 }
 
 bool QBrush::operator==(const QBrush &compareTo) const
 {
-    return (compareTo.data == data) || 
-        (compareTo.data->brushStyle == data->brushStyle && 
-         compareTo.data->color == data->color);
+    return compareTo.brushStyle == brushStyle && 
+         compareTo.brushColor == brushColor;
 }
 
 
 bool QBrush::operator!=(const QBrush &compareTo) const
 {
-    return !(operator==( compareTo ));
+    return compareTo.brushStyle != brushStyle || 
+         compareTo.brushColor != brushColor;
 }
 
diff --git a/WebCore/src/kwq/KWQCString.mm b/WebCore/src/kwq/KWQCString.mm
index 9ca079e..f7ccdda 100644
--- a/WebCore/src/kwq/KWQCString.mm
+++ b/WebCore/src/kwq/KWQCString.mm
@@ -42,9 +42,8 @@
 #define qstricmp(s1,s2) strcasecmp((s1),(s2))
 #define qstrnicmp(s1,s2,len) strncasecmp((s1),(s2),(len))
 
-QCString::QCString() : QByteArray(1)
+QCString::QCString() : QByteArray(0)
 {
-    *data() = '\0';
 }
 
 QCString::QCString(int size) : QByteArray(size)
@@ -82,12 +81,12 @@ QCString::QCString(const QCString &s) : QByteArray(s)
 
 bool QCString::isEmpty() const
 {
-    return data() == 0;
+    return length() == 0;
 }
 
 bool QCString::isNull() const
 {
-    return data() == 0 || *data() == '\0';
+    return data() == NULL;
 }
 
 int QCString::find(const char *s, int index=0, bool cs=TRUE) const
@@ -162,7 +161,7 @@ int QCString::contains(char c, bool cs=TRUE) const
 
 uint QCString::length() const
 {
-    return strlen(data());
+    return data() == NULL ? 0 : strlen(data());
 }
 
 bool QCString::resize(uint len)
diff --git a/WebCore/src/kwq/KWQGuardedPtr.mm b/WebCore/src/kwq/KWQGuardedPtr.mm
index b79580a..14c5d15 100644
--- a/WebCore/src/kwq/KWQGuardedPtr.mm
+++ b/WebCore/src/kwq/KWQGuardedPtr.mm
@@ -26,8 +26,9 @@
 #include <qguardedptr.h>
 
 QGuardedPtrPrivate::QGuardedPtrPrivate(QObject* o)
-    : QObject(0, "_ptrpriv" ), p(o)
+    : p(o)
 {
+    // FIXME: must connect
 }
 
 
diff --git a/WebCore/src/kwq/KWQPainter.mm b/WebCore/src/kwq/KWQPainter.mm
index 3cd0d40..4721a00 100644
--- a/WebCore/src/kwq/KWQPainter.mm
+++ b/WebCore/src/kwq/KWQPainter.mm
@@ -137,12 +137,6 @@ void QPainter::setPen(const QPen &pen)
 
 void QPainter::setPen(PenStyle style)
 {
-    QPen::QPenData *d = data->qpen.data;
-    if (d->count != 1) {
-        data->qpen.detach();
-        d = data->qpen.data;  
-    }
-
     data->qpen.setStyle(style);
     data->qpen.setColor(Qt::black);
     data->qpen.setWidth(0);
@@ -156,12 +150,6 @@ void QPainter::setBrush(const QBrush &brush)
 
 void QPainter::setBrush(BrushStyle style)
 {
-    QBrush::QBrushData *d = data->qbrush.data;
-    if (d->count != 1) {
-        data->qbrush.detach();
-        d = data->qbrush.data;  
-    }
-
     data->qbrush.setStyle(style);
     data->qbrush.setColor(Qt::black);
 }
diff --git a/WebCore/src/kwq/KWQPen.mm b/WebCore/src/kwq/KWQPen.mm
index b972cdc..1c6d660 100644
--- a/WebCore/src/kwq/KWQPen.mm
+++ b/WebCore/src/kwq/KWQPen.mm
@@ -25,109 +25,47 @@
 
 #include <qpen.h>
 
-void QPen::init(const QColor &color, uint width, uint linestyle)
+QPen::QPen(const QColor &color, uint width, PenStyle style) : penStyle((PenStyle)(style & MPenStyle)), penWidth(width), penColor(color), linest (style)
 {
-    data = new QPenData();
-    data->style = (PenStyle)(linestyle & MPenStyle);
-    data->width = width;
-    data->color = color;
-    data->linest = linestyle;
 }
 
-QPen::QPen()
-{
-    init(Qt::black, 1, SolidLine);
-}
-
-
-QPen::QPen(const QColor &color, uint width, PenStyle style)
-{
-    init(color, width, style);
-}
-
-
-QPen::QPen(const QPen &copyFrom)
-{
-    data = copyFrom.data;
-    data->ref();
-}
-
-
-QPen::~QPen()
-{
-    if (data->deref()) {
-        delete data;
-    }
-}
-
-QPen QPen::copy() const
-{
-    QPen p(data->color, data->width, data->style);
-    return p;
-}
-
-void QPen::detach()
-{
-    if (data->count != 1) {
-        *this = copy();
-    }
-}
 
 const QColor &QPen::color() const
 {
-    return data->color;
+    return penColor;
 }
 
 uint QPen::width() const
 {
-    return data->width;
+    return penWidth;
 }
 
 QPen::PenStyle QPen::style() const
 {
-    return data->style;
+    return penStyle;
 }
 
 void QPen::setColor(const QColor &color)
 {
-    detach();
-    data->color = color;
+    penColor = color;
 }
 
 void QPen::setWidth(uint width)
 {
-    if (data->width == width) {
-        return;
-    }
-    detach();
-    data->width = width;
+    penWidth = width;
 }
 
 void QPen::setStyle(PenStyle style)
 {
-    if (data->style == style) {
-        return;
-    }
-    detach();
-    data->style = style;
-    data->linest = (data->linest & ~MPenStyle) | style;
-}
-
-QPen &QPen::operator=(const QPen &assignFrom)
-{
-    assignFrom.data->ref();
-    if (data->deref()) {
-        delete data;
-    }
-    data = assignFrom.data;
-    return *this;
+    penStyle = style;
+    linest = (linest & ~MPenStyle) | style;
 }
 
 bool QPen::operator==(const QPen &compareTo) const
 {
-    return (data->width == compareTo.data->width) &&
-        (data->style == compareTo.data->style) &&
-        (data->color == compareTo.data->color);
+    return (penWidth == compareTo.penWidth) &&
+        (penStyle == compareTo.penStyle) &&
+        (penColor == compareTo.penColor);
 }
 
 
diff --git a/WebCore/kwq/KWQKPrinter.mm b/WebCore/src/kwq/KWQPoint.mm
similarity index 68%
copy from WebCore/kwq/KWQKPrinter.mm
copy to WebCore/src/kwq/KWQPoint.mm
index b7d78fd..7437cdb 100644
--- a/WebCore/kwq/KWQKPrinter.mm
+++ b/WebCore/src/kwq/KWQPoint.mm
@@ -23,48 +23,46 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <kwqdebug.h>
-#include <kprinter.h>
+#include <qpoint.h>
 
-//FIX ME:
-static QSize tempQSize = QSize(0,0);
-
-bool KPrinter::setup(QWidget *parent=0)
+QPoint::QPoint() : xCoord(0), yCoord(0)
 {
-    _logNeverImplemented();
-    return FALSE;
 }
 
 
-bool KPrinter::newPage()
+QPoint::QPoint(int xIn, int yIn) : xCoord(xIn), yCoord(yIn)
 {
-    _logNeverImplemented();
-    return FALSE;
 }
 
-
-void KPrinter::setDocName(const QString &)
+int QPoint::x() const
 {
-    _logNeverImplemented();
+    return xCoord;
 }
 
-
-void KPrinter::setCreator(const QString &)
+int QPoint::y() const
 {
-    _logNeverImplemented();
+    return yCoord;
 }
 
-
-void KPrinter::setFullPage(bool)
+int QPoint::manhattanLength() const
 {
-    _logNeverImplemented();
+    return abs(xCoord) + abs(yCoord);
 }
 
 
-QSize KPrinter::margins() const
+QPoint operator+(const QPoint &a, const QPoint &b)
 {
-    _logNeverImplemented();
-    return tempQSize;
+    return QPoint(a.xCoord + b.xCoord, a.yCoord + b.yCoord);
 }
 
+QPoint operator-(const QPoint &a, const QPoint &b)
+{
+    return QPoint(a.xCoord - b.xCoord, a.yCoord - b.yCoord);
+}
 
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QPoint &p)
+{
+	return o << "QPoint: [x: " << p.x() << "; h: " << p.y() << "]";
+}
+#endif
diff --git a/WebCore/src/kwq/KWQRect.mm b/WebCore/src/kwq/KWQRect.mm
new file mode 100644
index 0000000..799f658
--- /dev/null
+++ b/WebCore/src/kwq/KWQRect.mm
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2001 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include <qrect.h>
+
+#define MAX(a,b) ((a) >= (b) ? (a) : (b))
+
+
+QRect::QRect() : xp(0), yp(0), w(1), h(1)
+{
+}
+
+QRect::QRect(int x, int y, int width, int height) : xp(x), yp(y), w(width), h(height)
+{
+}
+
+QRect::QRect(QPoint p, QSize s) : xp(p.x()), yp(p.y()), w(s.width()), h(s.height())
+{
+}
+
+bool QRect::isNull() const
+{
+    return w == 0 && h == 0;
+}
+
+bool QRect::isValid() const
+{
+    return w > 0 && h > 0;
+}
+
+int QRect::x() const
+{
+    return xp;
+}
+
+int QRect::y() const
+{
+    return yp;
+}
+
+int QRect::left() const
+{
+    return xp;
+}
+
+int QRect::top() const
+{
+    return yp;
+}
+
+int QRect::right() const
+{
+    return xp + w - 1;
+}
+
+int QRect::bottom() const
+{
+    return yp + h - 1;
+}
+
+int QRect::width() const
+{
+    return w;
+}
+
+int QRect::height() const
+{
+    return h;
+}
+
+QPoint QRect::topLeft() const
+{
+    return QPoint(xp,yp);
+}
+
+QSize QRect::size() const
+{
+    return QSize(w,h);
+}
+
+void QRect::setWidth(int width)
+{
+    w = width;
+}
+
+void QRect::setHeight(int height)
+{
+    h = height;
+}
+
+QRect QRect::intersect(const QRect &r) const
+{
+    return operator&(r);
+}
+
+bool QRect::intersects(const QRect &r) const
+{
+    return (intersect(r)).isValid();
+}
+
+QRect QRect::operator&(const QRect &r) const
+{
+    int nx, ny, nw, nh;
+
+    nx = MAX(xp, r.xp);
+    ny = MAX(yp, r.yp);
+
+    if (xp + w <= r.xp + r.w) {
+        nw = xp + w - nx;
+    } else {
+        nw = r.xp + r.w - nx; 
+    }
+
+    if (yp + h <= r.yp + r.h) {
+        nh = yp + h - ny;
+    } else {
+        nh = r.yp + r.h - ny; 
+    }
+
+    return QRect(nx, ny, nw, nh);
+}
+
+bool operator==(const QRect &a, const QRect &b)
+{
+	return a.xp == b.xp && a.yp == b.yp && a.w == b.w && a.h == b.h;
+}
+
+bool operator!=(const QRect &a, const QRect &b)
+{
+	return a.xp != b.xp || a.yp != b.yp || a.w != b.w || a.h != b.h;
+}
+
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QRect &r)
+{
+    return o << "QRect: [left: " << r.left () << "; top: " << r.top() << "; right: " << r.right() << "; bottom: " << r.bottom() << "]";
+}
+#endif
+
+
diff --git a/WebCore/src/kwq/kio/kprinter.h b/WebCore/src/kwq/KWQRefPtr.h
similarity index 62%
copy from WebCore/src/kwq/kio/kprinter.h
copy to WebCore/src/kwq/KWQRefPtr.h
index 4562554..8615376 100644
--- a/WebCore/src/kwq/kio/kprinter.h
+++ b/WebCore/src/kwq/KWQRefPtr.h
@@ -23,30 +23,72 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef KPRINTER_H_
-#define KPRINTER_H_
+#ifndef KWQREFPTR_H_
+#define KWQREFPTR_H_
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#include <qpaintdevice.h>
-#include <qstring.h>
-#include <qwidget.h>
-#include <qsize.h>
 
-// NOTE: I stuck this file here rather than create a whole new 
-// kdeprint directory
-
-class KPrinter : public QPaintDevice {
+template <class T> class KWQRefPtr {
 public:
-    bool setup(QWidget *parent=0);
-    bool newPage();
-    void setDocName(const QString &);
-    void setCreator(const QString &);
-    void setFullPage(bool);
-    QSize margins() const;
+    explicit KWQRefPtr(T* ptr = 0) : pointer(ptr)
+    {
+        ref();
+    }
+
+    KWQRefPtr(const KWQRefPtr& r) : pointer(r.pointer)
+    {
+        ref();
+    }
+
+    KWQRefPtr& operator=(const KWQRefPtr& r) {
+        if (&r != this) {
+	    r.ref();
+	    unref();
+	    pointer = r.pointer;
+	}
+	return *this;
+    }
+
+    ~KWQRefPtr() 
+    {
+        unref();
+    }
+
+    bool isNull() const {
+        return pointer == 0;
+    }
+
+    T& operator*() const {
+        return *pointer;
+    }
+
+    T* operator->() const {
+        return pointer;
+    }
+
+private:
+    void unref() 
+    {
+        if (!isNull()) {
+	    if (--pointer->refCount == 0) {
+	        delete pointer;
+	    }
+	}
+    }
+
+    void ref() const 
+    {
+        if (!isNull()) {
+  	    ++pointer->refCount;
+	}
+    }
+
+    T* pointer;
 };
 
+
 #endif
 
diff --git a/WebCore/src/kwq/KWQKProcess.mm b/WebCore/src/kwq/KWQSize.mm
similarity index 62%
copy from WebCore/src/kwq/KWQKProcess.mm
copy to WebCore/src/kwq/KWQSize.mm
index b1a5c5c..8decf71 100644
--- a/WebCore/src/kwq/KWQKProcess.mm
+++ b/WebCore/src/kwq/KWQSize.mm
@@ -23,64 +23,63 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <kwqdebug.h>
-#include <kprocess.h>
+#include <qsize.h>
 
-KProcess::KProcess()
+QSize::QSize() : w(-1), h(-1)
 {
-    _logNotYetImplemented();
 }
 
-
-KProcess::~KProcess()
+QSize::QSize(int width, int height) : w(width), h(height)
 {
-    _logNotYetImplemented();
 }
 
-
-QStrList *KProcess::args()
+bool QSize::isValid() const
 {
-    _logNotYetImplemented();
-    return new QStrList();
+	return w >= 0 && h>= 0;
 }
 
-
-bool KProcess::isRunning() const
+int QSize::width() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	return w;
 }
 
-
-bool KProcess::writeStdin(const char *buffer, int buflen)
+int QSize::height() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	return h;
 }
 
-
-bool KProcess::start(RunMode runmode, Communication comm)
+void QSize::setWidth(int width)
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	w = width;
 }
-
-
-bool KProcess::kill(int signo=SIGTERM)
+void QSize::setHeight(int height)
 {
-    _logNotYetImplemented();
-    return FALSE;    
+	h = height;
+}
+QSize QSize::expandedTo(const QSize &o) const
+{
+	return QSize(w > o.w ? w : o.w, h > o.h ? h : o.h);
 }
 
+QSize operator+(const QSize &a, const QSize &b)
+{
+	return QSize(a.w + b.w, a.h + b.h);
+}
 
-void KProcess::resume()
+bool operator==(const QSize &a, const QSize &b)
 {
-    _logNotYetImplemented();
+	return a.w == b.w && a.h == b.h;
 }
 
+bool operator!=(const QSize &a, const QSize &b)
+{
+	return a.w != b.w || a.h != b.h;
+}
 
-KProcess &KProcess::operator<<(const QString& arg)
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QSize &s)
 {
-    _logNotYetImplemented();
-    return *this;
+	return o << "QSize: [w: " << s.width() << "; h: " << s.height() << "]";
 }
+#endif
+
diff --git a/WebCore/src/kwq/KWQVariant.mm b/WebCore/src/kwq/KWQVariant.mm
index 923b557..24a0a2b 100644
--- a/WebCore/src/kwq/KWQVariant.mm
+++ b/WebCore/src/kwq/KWQVariant.mm
@@ -26,32 +26,11 @@
 
 #include <qvariant.h>
 #include <qstring.h>
-#include <_qshared.h>
 
-class QVariantPrivate : public QShared {
-friend class QVariant;
+class QVariant::QVariantPrivate {
 public:
-    QVariantPrivate() {
-        t = QVariant::Invalid;
-    }
-    
-    QVariantPrivate(QVariantPrivate *other) {
-        switch (other->t) {
-            case QVariant::Invalid:
-                break;
-            case QVariant::String:
-                value.p = new QString(*((QString*)other->value.p));
-                break;
-            case QVariant::UInt:
-                value.u = other->value.u;
-                break;
-            case QVariant::Double:
-                value.d = other->value.d;
-                break;
-            case QVariant::Bool:
-                value.b = other->value.b;
-                break;
-        }
+    QVariantPrivate() : t(QVariant::Invalid), refCount(0)
+    {
     }
     
     ~QVariantPrivate() {
@@ -81,50 +60,46 @@ public:
         double d;
         void *p;
     } value;
+
+    int refCount;
+
+    friend KWQRefPtr<QVariantPrivate>;
 };
 
-QVariant::QVariant()
+QVariant::QVariant() : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
 }
 
 
-QVariant::QVariant(bool val, int i)
+QVariant::QVariant(bool val, int i) : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
     d->t = Bool;
     d->value.d = val;
 }
 
 
-QVariant::QVariant(double val)
+QVariant::QVariant(double val) : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
     d->t = Double;
     d->value.d = val;
 }
 
 
-QVariant::QVariant(const QString &s)
+QVariant::QVariant(const QString &s) : d(new QVariantPrivate())
 {
-    d = new QVariantPrivate();
     d->t = String;
     d->value.p = new QString(s);
 }
 
 
-QVariant::QVariant(const QVariant &other)
+QVariant::QVariant(const QVariant &other) : d(0)
 {
-    d = new QVariantPrivate();
-    *this = other;
+    d = other.d;
 }
 
 
 QVariant::~QVariant()
 {
-    if (d->deref()) {
-        delete d;
-    }
 }
 
 
@@ -168,14 +143,7 @@ uint QVariant::toUInt() const
 
 QVariant &QVariant::operator=(const QVariant &other)
 {
-    QVariant &variant = (QVariant &)other;
-    
-    variant.d->ref();
-    if (d->deref()) {
-        delete d;
-    }
-    d = variant.d;
-    
+    d = other.d;
     return *this;
 }
 
diff --git a/WebCore/src/kwq/Makefile.in b/WebCore/src/kwq/Makefile.in
index 5e2f0be..8439651 100644
--- a/WebCore/src/kwq/Makefile.in
+++ b/WebCore/src/kwq/Makefile.in
@@ -40,6 +40,9 @@ MMOBJECTS = \
     KWQFontMetrics.o \
     KWQFrame.o \
     KWQGuardedPtr.o \
+    KWQPoint.o \
+    KWQRect.o \
+    KWQSize.o \
     KWQHBox.o \
     KWQImage.o \
     KWQInputDialog.o \
diff --git a/WebCore/src/kwq/_KWQOwner.h b/WebCore/src/kwq/_KWQOwner.h
index f6b9ba4..b82670d 100644
--- a/WebCore/src/kwq/_KWQOwner.h
+++ b/WebCore/src/kwq/_KWQOwner.h
@@ -1,3 +1,31 @@
+/*
+ * Copyright (C) 2001 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef KWQOWNER_H_
+#define KWQOWNER_H_
+
 #import <Cocoa/Cocoa.h>
 #import <WCBackForwardList.h>
 
@@ -15,3 +43,5 @@
 -(void)updateButtons;
 
 @end
+
+#endif
diff --git a/WebCore/src/kwq/qt/_qpoint.cpp b/WebCore/src/kwq/qt/_qpoint.cpp
index 338ef59..b029776 100644
--- a/WebCore/src/kwq/qt/_qpoint.cpp
+++ b/WebCore/src/kwq/qt/_qpoint.cpp
@@ -14,6 +14,10 @@
 
 #include "qpoint.h"
 
+// KWQ hacks ---------------------------------------------------------------
+
+#ifdef USING_BORROWED_QPOINT
+
 // for abs()
 #include <stdlib.h>
 
@@ -72,10 +76,6 @@ ostream &operator<<(ostream &o, const QPoint &p)
 }
 #endif
 
-// KWQ hacks ---------------------------------------------------------------
-
-#ifdef USING_BORROWED_QPOINT
-
 // -------------------------------------------------------------------------
 
 bool QPoint::isNull() const
diff --git a/WebCore/src/kwq/qt/_qrect.cpp b/WebCore/src/kwq/qt/_qrect.cpp
index cd7c3a8..32c5dfe 100644
--- a/WebCore/src/kwq/qt/_qrect.cpp
+++ b/WebCore/src/kwq/qt/_qrect.cpp
@@ -20,6 +20,10 @@
 
 #include <qrect.h>
 
+// KWQ hacks ---------------------------------------------------------------
+
+#ifdef USING_BORROWED_QRECT
+
 QRect::QRect()
 {
     x1 = x2 = y1 = y2 = 0;
@@ -143,10 +147,6 @@ ostream &operator<<(ostream &o, const QRect &r)
 }
 #endif
 
-// KWQ hacks ---------------------------------------------------------------
-
-#ifdef USING_BORROWED_QRECT
-
 // -------------------------------------------------------------------------
 
 QRect::QRect( const QPoint &topLeft, const QPoint &bottomRight )
diff --git a/WebCore/src/kwq/qt/_qsize.cpp b/WebCore/src/kwq/qt/_qsize.cpp
index f77e221..d5eb71e 100644
--- a/WebCore/src/kwq/qt/_qsize.cpp
+++ b/WebCore/src/kwq/qt/_qsize.cpp
@@ -20,6 +20,10 @@
 
 #include <qsize.h>
 
+// KWQ hacks ---------------------------------------------------------------
+
+#ifdef USING_BORROWED_QSIZE
+
 QSize::QSize() 
 {
     w = h = -1;
@@ -100,10 +104,6 @@ ostream &operator<<(ostream &o, const QSize &s)
 }
 #endif
 
-// KWQ hacks ---------------------------------------------------------------
-
-#ifdef USING_BORROWED_QSIZE
-
 // -------------------------------------------------------------------------
 
 bool QSize::isNull() const
diff --git a/WebCore/src/kwq/qt/qbrush.h b/WebCore/src/kwq/qt/qbrush.h
index f859435..17c06bd 100644
--- a/WebCore/src/kwq/qt/qbrush.h
+++ b/WebCore/src/kwq/qt/qbrush.h
@@ -48,12 +48,12 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    QBrush();
-    QBrush(const QColor &);
-    QBrush::QBrush(const QColor &c, BrushStyle style);
-    QBrush(const QBrush &);
-    QBrush &operator=(const QBrush &);
-    ~QBrush();
+    QBrush::QBrush(const QColor &c = Qt::black, BrushStyle style = SolidPattern);
+
+    // Defaults are fine
+    // QBrush(const QBrush &);
+    // QBrush &operator=(const QBrush &);
+    // ~QBrush();
  
     // member functions --------------------------------------------------------
     
@@ -70,14 +70,8 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    void init(const QColor &, BrushStyle);
-    QBrush copy() const;
-    void detach();
-    struct QBrushData : public QShared { 
-        BrushStyle brushStyle;
-        QColor color;
-    } *data;
-
+    QColor brushColor;
+    BrushStyle brushStyle;
 }; // class QBrush =============================================================
 
 #endif
diff --git a/WebCore/src/kwq/qt/qguardedptr.h b/WebCore/src/kwq/qt/qguardedptr.h
index 2eaacf3..df6fec7 100644
--- a/WebCore/src/kwq/qt/qguardedptr.h
+++ b/WebCore/src/kwq/qt/qguardedptr.h
@@ -30,24 +30,17 @@
 #include <config.h>
 #endif
 
+#include "KWQRefPtr.h"
+
 #include "qobject.h"
 
 // class QGuardedPtrPrivate ====================================================
 
-class QGuardedPtrPrivate : public QObject, public QShared {
-public:
-    QGuardedPtrPrivate(QObject *o);
-    ~QGuardedPtrPrivate();
-    
-    QObject *object() const;
-    
-private:
-    QObject *p;
-};
-
 // class QGuardedPtr ===========================================================
 
-template <class T> class QGuardedPtr : public QObject {
+class QGuardedPtrPrivate;
+
+template <class T> class QGuardedPtr {
 public:
 
     // typedefs ----------------------------------------------------------------
@@ -57,39 +50,37 @@ public:
 
     // constructors, copy constructors, and destructors ------------------------
 
-    QGuardedPtr() {
-        d = new QGuardedPtrPrivate(0L);
+    QGuardedPtr() : d(new QGuardedPtrPrivate(0))
+    {
     }
-    QGuardedPtr(T *o) {
-        d = new QGuardedPtrPrivate(o);
+    QGuardedPtr(T *o) : d(new QGuardedPtrPrivate(o))
+    {
     }
     
     QGuardedPtr(const QGuardedPtr<T> &p) {
         d = p.d;
-        ref();
     }
 
     ~QGuardedPtr() {
-        deref();
     }
 
     // member functions --------------------------------------------------------
 
     bool isNull() const {
-        return !d->object();
+        return d->object() == 0;
     }
 
     // operators ---------------------------------------------------------------
 
     QGuardedPtr &operator=(const QGuardedPtr &p) {
-        if (d != p.d) {
-            deref();
-            d = p.d;
-            ref();
-        } 
+        d = p.d;
         return *this;
     }
     
+    T &operator*() const {
+        return *(T*)d->object();
+    }
+
     operator T *() const {
         return (T*)d->object();
     }
@@ -101,26 +92,26 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    QGuardedPtrPrivate *d;
 
-    void ref()
+    KWQRefPtr<QGuardedPtrPrivate> d;
+}; // class QGuardedPtr ========================================================
+
+class QGuardedPtrPrivate {
+  public:
+    QGuardedPtrPrivate(QObject *o);
+    ~QGuardedPtrPrivate();
+
+    QObject *object()
     {
-        d->ref();
+      return p;
     }
     
-    void deref()
-    {
-        if (d->deref())
-            delete d;
-    }
-
-
-}; // class QGuardedPtr ========================================================
-
+  private:
+    QObject *p;
+    int refCount;
 
-inline QObject *QGuardedPtrPrivate::object() const
-{
-    return p;
-}
+    friend class KWQRefPtr<QGuardedPtrPrivate>;
+};
 
 #endif
+
diff --git a/WebCore/src/kwq/qt/qnamespace.h b/WebCore/src/kwq/qt/qnamespace.h
index f5c7d6f..6a63c17 100644
--- a/WebCore/src/kwq/qt/qnamespace.h
+++ b/WebCore/src/kwq/qt/qnamespace.h
@@ -276,16 +276,6 @@ public:
     // static member functions -------------------------------------------------
     // constructors, copy constructors, and destructors ------------------------
     
-// add no-arg constructor
-#ifdef _KWQ_PEDANTIC_
-    Qt() {}
-#endif
-
-// add no-op destructor
-#ifdef _KWQ_PEDANTIC_
-    ~Qt() {}
-#endif
-    
     // member functions --------------------------------------------------------
     // operators ---------------------------------------------------------------
 
@@ -294,17 +284,6 @@ public:
 
 private:
 
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
-    Qt(const Qt &);
-#endif
-
-// add assignment operator 
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
-    Qt &operator=(const Qt &);
-#endif
 
 }; // class Qt =================================================================
 
diff --git a/WebCore/src/kwq/qt/qpen.h b/WebCore/src/kwq/qt/qpen.h
index dd09ac6..e944e03 100644
--- a/WebCore/src/kwq/qt/qpen.h
+++ b/WebCore/src/kwq/qt/qpen.h
@@ -34,7 +34,6 @@
 #include <qcolor.h>
 
 class QPainter;
-class QPenPrivate;
 
 // class QPen ==================================================================
 
@@ -49,10 +48,12 @@ public:
 
     // constructors, copy constructors, and destructors ------------------------
 
-    QPen();
-    QPen(const QColor &c, uint w=0, PenStyle ps=SolidLine);
-    QPen(const QPen &pen);
-    ~QPen();
+    QPen(const QColor &c = Qt::black, uint w = 0, PenStyle ps = SolidLine);
+
+    // defaults are fine
+    // QPen(const QPen &pen);
+    // ~QPen();
+    // QPen &operator=(const QPen &);
 
     // member functions --------------------------------------------------------
 
@@ -69,21 +70,14 @@ public:
     bool operator==(const QPen &) const;
     bool operator!=(const QPen &) const;
     
-    QPen &operator=(const QPen &);
-
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
-    QPen copy()  const;
-    void detach();
-    void init(const QColor &, uint, uint);
-    
-    struct QPenData : public QShared {
-        PenStyle  style;
-        uint      width;
-        QColor    color;
-        Q_UINT16  linest;
-    } *data;
+
+    PenStyle  penStyle;
+    uint      penWidth;
+    QColor    penColor;
+    Q_UINT16  linest;
  
 }; // class QPen ===============================================================
 
diff --git a/WebCore/src/kwq/qt/qpoint.h b/WebCore/src/kwq/qt/qpoint.h
index 5a05dae..bebe621 100644
--- a/WebCore/src/kwq/qt/qpoint.h
+++ b/WebCore/src/kwq/qt/qpoint.h
@@ -50,7 +50,9 @@ public:
 
     QPoint();
     QPoint(int, int);
-    QPoint(const QPoint &);
+
+    // QPoint(const QPoint &);
+    // default copy constructor is fine
 
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
@@ -64,12 +66,6 @@ public:
 
     int manhattanLength() const;
 
-#ifdef USING_BORROWED_QPOINT
-    bool isNull() const;
-    void setX(int);
-    void setY(int);
-#endif
-
     // operators ---------------------------------------------------------------
 
     /* Note: Trolltech seems to want operator= to be a bitwise copy
@@ -79,31 +75,13 @@ public:
     friend QPoint operator+(const QPoint &, const QPoint &);
     friend QPoint operator-(const QPoint &, const QPoint &);
 
-#ifdef USING_BORROWED_QPOINT
-    QPoint &operator+=(const QPoint &);
-    QPoint &operator-=(const QPoint &);
-    QPoint &operator*=(int);
-    QPoint &operator*=(double);
-    QPoint &operator/=(int);
-    QPoint &operator/=(double);
-
-    friend bool operator==(const QPoint &, const QPoint &);
-    friend bool operator!=(const QPoint &, const QPoint &);
-    friend QPoint operator*(const QPoint &, int);
-    friend QPoint operator*(int, const QPoint &);
-    friend QPoint operator*(const QPoint &, double);
-    friend QPoint operator*(double, const QPoint &);
-    friend QPoint operator-(const QPoint &);
-    friend QPoint operator/(const QPoint &, int);
-    friend QPoint operator/(const QPoint &, double);
-#endif
-
 // protected -------------------------------------------------------------------
 
 // private ---------------------------------------------------------------------
+private:
 
-    QCOORD xx;
-    QCOORD yy;
+    QCOORD xCoord;
+    QCOORD yCoord;
 
 }; // class QPoint =============================================================
 
diff --git a/WebCore/src/kwq/qt/qrect.h b/WebCore/src/kwq/qt/qrect.h
index 3ae421d..ad8bfb9 100644
--- a/WebCore/src/kwq/qt/qrect.h
+++ b/WebCore/src/kwq/qt/qrect.h
@@ -50,14 +50,11 @@ public:
     // constructors, copy constructors, and destructors ------------------------
 
     QRect();
+    QRect(QPoint p, QSize s);
     QRect(int, int, int, int);
-    QRect(const QRect &);
+    // QRect(const QRect &);
+    // default copy constructor is fine
 
-#ifdef USING_BORROWED_QRECT
-    QRect(const QPoint &, const QPoint &);
-    QRect(const QPoint &, const QSize &);
-#endif
-    
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
     ~QRect() {}
@@ -77,48 +74,13 @@ public:
     int width() const;
     int height() const;
 
+    QPoint topLeft() const;
     QSize size() const;
     void setWidth(int);
     void setHeight(int);
     QRect intersect(const QRect &) const;
     bool intersects(const QRect &) const;
 
-#ifdef USING_BORROWED_QRECT
-    bool isEmpty() const;
-    QRect normalize() const;
-
-    void setLeft(int);
-    void setTop(int);
-    void setRight(int);
-    void setBottom(int);
-    void setX(int);
-    void setY(int);
-
-    QPoint topLeft() const;
-    QPoint bottomRight() const;
-    QPoint topRight() const;
-    QPoint bottomLeft() const;
-    QPoint center() const;
-
-    void rect(int *, int *, int *, int *) const;
-    void coords(int *, int *, int *, int *) const;
-
-    void setSize(const QSize &);
-    void setRect(int, int, int, int);
-    void setCoords(int, int, int, int);
-
-    void moveTopLeft(const QPoint &);
-    void moveBottomRight(const QPoint &);
-    void moveTopRight(const QPoint &);
-    void moveBottomLeft(const QPoint &);
-    void moveCenter(const QPoint &);
-    void moveBy(int, int);
-
-    bool contains(const QPoint &, bool proper=FALSE) const;
-    bool contains(int, int, bool proper=FALSE) const;
-    bool contains(const QRect &, bool proper=FALSE) const;
-    QRect unite(const QRect &) const;
-#endif // USING_BORROWED_QRECT
 
     // operators ---------------------------------------------------------------
 
@@ -128,15 +90,6 @@ public:
 
     QRect operator&(const QRect &) const;
 
-#ifdef USING_BORROWED_QRECT
-    friend bool operator==(const QRect &, const QRect &);
-    friend bool operator!=(const QRect &, const QRect &);
-
-    QRect operator|(const QRect &) const;
-    QRect& operator|=(const QRect &);
-    QRect& operator&=(const QRect &);
-#endif
-
 #ifdef _KWQ_IOSTREAM_
     friend ostream &operator<<(ostream &, const QRect &);
 #endif
@@ -145,11 +98,14 @@ public:
 
 // private ---------------------------------------------------------------------
 
-    QCOORD x1;
-    QCOORD x2;
-    QCOORD y1;
-    QCOORD y2;
+private:
+    QCOORD xp;
+    QCOORD yp;
+    QCOORD w;
+    QCOORD h;
 
+    friend bool operator==(const QRect &, const QRect &);
+    friend bool operator!=(const QRect &, const QRect &);
 }; // class QRect ==============================================================
 
 // operators associated with QRect =============================================
diff --git a/WebCore/src/kwq/qt/qsize.h b/WebCore/src/kwq/qt/qsize.h
index 8e6014d..43fca06 100644
--- a/WebCore/src/kwq/qt/qsize.h
+++ b/WebCore/src/kwq/qt/qsize.h
@@ -48,7 +48,7 @@ public:
 
     QSize();
     QSize(int,int);
-    QSize(const QSize &);
+    // QSize(const QSize &);
 
 // add no-op destructor
 #ifdef _KWQ_PEDANTIC_
@@ -64,13 +64,6 @@ public:
     void setHeight(int);
     QSize expandedTo(const QSize &) const;
 
-#ifdef USING_BORROWED_QSIZE
-    bool isNull() const;
-    bool isEmpty() const;
-    void transpose();
-    QSize boundedTo(const QSize &) const;
-#endif
-
     // operators ---------------------------------------------------------------
 
     /* Note: Trolltech seems to want operator= to be a bitwise copy
@@ -81,22 +74,6 @@ public:
     friend bool operator==(const QSize &, const QSize &);
     friend bool operator!=(const QSize &, const QSize &);
 
-#ifdef USING_BORROWED_QSIZE
-    QSize &operator+=(const QSize &);
-    QSize &operator-=(const QSize &);
-    QSize &operator*=(int);
-    QSize &operator*=(double);
-    QSize &operator/=(int);
-    QSize &operator/=(double);
-
-    friend QSize operator-(const QSize &, const QSize &);
-    friend QSize operator*(const QSize &, int);
-    friend QSize operator*(int, const QSize &);
-    friend QSize operator*(const QSize &, double);
-    friend QSize operator*(double, const QSize &);
-    friend QSize operator/(const QSize &, int);
-    friend QSize operator/(const QSize &, double);
-#endif
 
 #ifdef _KWQ_IOSTREAM_
     friend ostream &operator<<(ostream &, const QSize &);
diff --git a/WebCore/src/kwq/qt/qvariant.h b/WebCore/src/kwq/qt/qvariant.h
index 41290ff..2458bae 100644
--- a/WebCore/src/kwq/qt/qvariant.h
+++ b/WebCore/src/kwq/qt/qvariant.h
@@ -30,10 +30,11 @@
 #include <config.h>
 #endif
 
+#include <KWQRefPtr.h>
+
 typedef unsigned int uint;
 
 class QString;
-class QVariantPrivate;
 
 // class QVariant ==============================================================
 
@@ -76,8 +77,9 @@ public:
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
 private:
+    class QVariantPrivate;
     
-    QVariantPrivate *d;
+    KWQRefPtr<QVariantPrivate> d;
 
 }; // class QVariant ===========================================================
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list