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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:50:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 7cfc6fa7ed64837c7734e7e0c4ca635d2681f65e
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 19 03:50:13 2001 +0000

    Chnages (hacks) to get khtmlview test to run.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@370 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/khtml/css/csshelper.cpp b/WebCore/khtml/css/csshelper.cpp
index 00522a3..472a425 100644
--- a/WebCore/khtml/css/csshelper.cpp
+++ b/WebCore/khtml/css/csshelper.cpp
@@ -141,10 +141,11 @@ DOMString khtml::parseURL(const DOMString &url)
 
 void khtml::setFontSize( QFont &f,  int  pixelsize, const KHTMLSettings *s, QPaintDeviceMetrics *devMetrics )
 {
-    QFontDatabase db;
-
     float size = pixelsize;
 
+#ifndef _KWQ_
+    QFontDatabase db;
+
     float toPix = 1.;
     if ( !khtml::printpainter )
         toPix = devMetrics->logicalDpiY()/72.;
@@ -182,7 +183,7 @@ void khtml::setFontSize( QFont &f,  int  pixelsize, const KHTMLSettings *s, QPai
 //         else if ( size > 4 && size < 16 )
 //             size = float( int( ( size + 1 ) / 2 )*2 );
     }
-
+#endif
     //qDebug(" -->>> using %f pixel font", size);
 
     f.setPixelSizeFloat( size );
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 3d95a6f..d711ea9 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -77,7 +77,9 @@ static CSSStyleSelector::Encodedurl *encodedurl;
 CSSStyleSelector::CSSStyleSelector(DocumentImpl * doc)
 {
     strictParsing = doc->parseMode() == DocumentImpl::Strict;
-    if(!defaultStyle) loadDefaultStyle(doc->view()?doc->view()->part()->settings():0);
+    if(!defaultStyle){
+        loadDefaultStyle(doc->view()?doc->view()->part()->settings():0);
+    }
 
     selectors = 0;
     selectorCache = 0;
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 51228f3..376c33b 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -225,7 +225,8 @@ void KHTMLView::init()
     lstViews->append( this );
 
     if(!d->paintBuffer) d->paintBuffer = new QPixmap(PAINT_BUFFER_HEIGHT, PAINT_BUFFER_HEIGHT);
-   if(!d->tp) d->tp = new QPainter();
+    
+    if(!d->tp) d->tp = new QPainter();
 
     setFocusPolicy(QWidget::StrongFocus);
     viewport()->setFocusPolicy( QWidget::WheelFocus );
@@ -305,7 +306,18 @@ void KHTMLView::drawContents( QPainter *p, int ex, int ey, int ew, int eh )
         d->tp->begin(d->paintBuffer);
         d->tp->translate(-ex, -ey-py);
         d->tp->fillRect(ex, ey+py, ew, ph, palette().normal().brush(QColorGroup::Base));
-        m_part->xmlDocImpl()->renderer()->print(d->tp, ex, ey+py, ew, ph, 0, 0);
+        
+        // FIXME!
+        RenderObject *ro;
+        DOM::DocumentImpl *doc;
+        
+        doc = m_part->xmlDocImpl();
+        if (doc){
+            ro = doc->renderer();
+            if (ro){
+                ro->print(d->tp, ex, ey+py, ew, ph, 0, 0);
+            }
+        }
 #ifdef BOX_DEBUG
 	if (m_part->xmlDocImpl()->focusNode())
 	{
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index 58b39fc..a297ae4 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -180,6 +180,14 @@ NodeImpl *NodeImpl::addChild(NodeImpl *)
   return 0;
 }
 
+#ifdef _KWQ_
+khtml::RenderObject *NodeImpl::renderer() const
+{
+    return m_render;
+}
+#endif
+
+
 QString NodeImpl::toHTML() const
 {
     NodeImpl* fc = firstChild();
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index 22eafd2..8f98b0c 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -193,7 +193,12 @@ public:
     virtual khtml::RenderStyle *style() const { return 0; }
 
     virtual void setRenderer(khtml::RenderObject *object) { m_render = object; }
+#ifdef _KWQ_
+    khtml::RenderObject *renderer() const;
+#else
     virtual khtml::RenderObject *renderer() const { return m_render; }
+#endif
+
 
     virtual DOM::CSSStyleDeclarationImpl *styleRules() { return 0; }
 
diff --git a/WebCore/kwq/KWQColor.h b/WebCore/kwq/KWQColor.h
index 2a1f005..830391a 100644
--- a/WebCore/kwq/KWQColor.h
+++ b/WebCore/kwq/KWQColor.h
@@ -113,6 +113,7 @@ public:
 #else
     void *color;
 #endif
+    QString cname;
 #endif
 
 }; // class QColor =============================================================
diff --git a/WebCore/kwq/KWQColor.mm b/WebCore/kwq/KWQColor.mm
index d93707e..7b54ba3 100644
--- a/WebCore/kwq/KWQColor.mm
+++ b/WebCore/kwq/KWQColor.mm
@@ -37,6 +37,7 @@
 
 #include <qcolor.h>
 
+
 QRgb qRgb(int r, int g, int b)
 {
     return r << 16 | g << 8 | b;
@@ -65,11 +66,11 @@ QColor::QColor(int r, int g, int b)
 }
 
 
-QColor::QColor(const char *)
+QColor::QColor(const char *n)
 {
-    if ( !globals_init )
-	initGlobalColors();
-    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+ //   if ( !globals_init )
+//	initGlobalColors();
+//    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
     // FIXME: need to implement real construction of color based on string
     _initialize (0,0,0);
 }
@@ -106,12 +107,16 @@ QColor::QColor(const QColor &copyFrom)
 QString QColor::name() const
 {
     NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    // FIXME!  Must map onto named colors.
+    return "white";
 }
 
 
-void QColor::setNamedColor(const QString&)
+void QColor::setNamedColor(const QString&n)
 {
-    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    //NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED) color = %s\n", __FILE__, __FUNCTION__, __LINE__, n.ascii());
+    NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    // Do something better here.
 }
 
 
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index dc48703..424a41c 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -106,7 +106,7 @@ void QFont::setFamily(const QString &qfamilyName)
     NSFont *oldFont = data->font;
     
     familyName = QSTRING_TO_NSSTRING(qfamilyName);
-    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toFamily: familyName] retain];
+    data->font = [[[NSFontManager sharedFontManager] convertFont: oldFont toFamily: familyName] retain];
 
     [oldFont release];
 }
@@ -116,7 +116,7 @@ void QFont::setPixelSizeFloat(float sz)
 {
     NSFont *oldFont = data->font;
 
-    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toSize: sz] retain];
+    data->font = [[[NSFontManager sharedFontManager] convertFont: oldFont toSize: sz] retain];
 
     [oldFont release];
 }
diff --git a/WebCore/kwq/KWQKGlobalSettings.mm b/WebCore/kwq/KWQKGlobalSettings.mm
index e040e4d..1c3889a 100644
--- a/WebCore/kwq/KWQKGlobalSettings.mm
+++ b/WebCore/kwq/KWQKGlobalSettings.mm
@@ -27,24 +27,30 @@
 
 #include <kglobalsettings.h>
 
+#include <kwqdebug.h>
 
 QFont KGlobalSettings::generalFont()
 {
+    return QFont();
 }
 
 
 QFont KGlobalSettings::windowTitleFont()
 {
+    return QFont();
 }
 
 
 QFont KGlobalSettings::menuFont()
 {
+    return QFont();
 }
 
 
 int KGlobalSettings::contrast()
 {
+    _logNotYetImplemented();
+    return 0;
 }
 
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 31c5cbf..2693b6d 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -91,6 +91,8 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 class KHTMLPartPrivate
 {
 public:
+    KHTMLView *m_view;
+    
     DOM::DocumentImpl *m_doc;
     khtml::Decoder *m_decoder;
 
@@ -114,10 +116,12 @@ public:
             cache_init = true;
         }
         m_part = part;
+        m_view = 0L;
         m_doc = new HTMLDocumentImpl();
         m_decoder = 0L;
         m_bFirstData = true;
-        m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+        //m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+        m_settings = new KHTMLSettings();
         m_haveEncoding = false;
         m_recv = [[KHTMLPartNotificationReceiver alloc] init];
         m_recv->m_part = part;
@@ -171,7 +175,7 @@ void KHTMLPart::slotData(id <WCURICacheData> data)
 bool KHTMLPart::openURL( const KURL &url )
 {
     // Close the previous URL.
-    //closeURL();
+    closeURL();
     
     //if ( args.doPost() && (url.protocol().startsWith("http")) )
     //{
@@ -208,9 +212,9 @@ bool KHTMLPart::openURL( const KURL &url )
 
 bool KHTMLPart::closeURL()
 {
-    if (d && d->m_doc) {
-        recursive(0, d->m_doc);
-    }
+    //if (d && d->m_doc) {
+    //    recursive(0, d->m_doc);
+    //}
 
     // Cancel any pending loads.
     
@@ -335,10 +339,10 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset)
 {
     //d->m_referrer = url.url();
     
-    d->m_doc = new HTMLDocumentImpl();
+    d->m_doc = new HTMLDocumentImpl(d->m_view);
     d->m_doc->ref();
     //FIXME: do we need this? 
-    //d->m_doc->attach( d->m_view );
+    d->m_doc->attach( d->m_view );
     d->m_doc->setURL( url.url() );
 
     /* FIXME: we'll need to make this work....
@@ -451,7 +455,9 @@ void KHTMLPart::setBaseURL( const KURL &url )
 
 KURL KHTMLPart::baseURL() const
 {
-    _logNeverImplemented();
+    // FIXME!
+    _logPartiallyImplemented();
+    return KURL();
 }
 
 
@@ -643,7 +649,7 @@ DOM::DocumentImpl *KHTMLPart::xmlDocImpl() const
 
 const KHTMLSettings *KHTMLPart::settings() const
 {
-    _logNotYetImplemented();
+    return d->m_settings;
 }
 
 
@@ -673,7 +679,12 @@ void KHTMLPart::scheduleRedirection( int delay, const QString &url )
 
 KHTMLView *KHTMLPart::view() const
 {
-    _logNotYetImplemented();
+    return d->m_view;
+}
+
+void KHTMLPart::setView(KHTMLView *view)
+{
+    d->m_view = view;
 }
 
 
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 31c5cbf..2693b6d 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -91,6 +91,8 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 class KHTMLPartPrivate
 {
 public:
+    KHTMLView *m_view;
+    
     DOM::DocumentImpl *m_doc;
     khtml::Decoder *m_decoder;
 
@@ -114,10 +116,12 @@ public:
             cache_init = true;
         }
         m_part = part;
+        m_view = 0L;
         m_doc = new HTMLDocumentImpl();
         m_decoder = 0L;
         m_bFirstData = true;
-        m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+        //m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+        m_settings = new KHTMLSettings();
         m_haveEncoding = false;
         m_recv = [[KHTMLPartNotificationReceiver alloc] init];
         m_recv->m_part = part;
@@ -171,7 +175,7 @@ void KHTMLPart::slotData(id <WCURICacheData> data)
 bool KHTMLPart::openURL( const KURL &url )
 {
     // Close the previous URL.
-    //closeURL();
+    closeURL();
     
     //if ( args.doPost() && (url.protocol().startsWith("http")) )
     //{
@@ -208,9 +212,9 @@ bool KHTMLPart::openURL( const KURL &url )
 
 bool KHTMLPart::closeURL()
 {
-    if (d && d->m_doc) {
-        recursive(0, d->m_doc);
-    }
+    //if (d && d->m_doc) {
+    //    recursive(0, d->m_doc);
+    //}
 
     // Cancel any pending loads.
     
@@ -335,10 +339,10 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset)
 {
     //d->m_referrer = url.url();
     
-    d->m_doc = new HTMLDocumentImpl();
+    d->m_doc = new HTMLDocumentImpl(d->m_view);
     d->m_doc->ref();
     //FIXME: do we need this? 
-    //d->m_doc->attach( d->m_view );
+    d->m_doc->attach( d->m_view );
     d->m_doc->setURL( url.url() );
 
     /* FIXME: we'll need to make this work....
@@ -451,7 +455,9 @@ void KHTMLPart::setBaseURL( const KURL &url )
 
 KURL KHTMLPart::baseURL() const
 {
-    _logNeverImplemented();
+    // FIXME!
+    _logPartiallyImplemented();
+    return KURL();
 }
 
 
@@ -643,7 +649,7 @@ DOM::DocumentImpl *KHTMLPart::xmlDocImpl() const
 
 const KHTMLSettings *KHTMLPart::settings() const
 {
-    _logNotYetImplemented();
+    return d->m_settings;
 }
 
 
@@ -673,7 +679,12 @@ void KHTMLPart::scheduleRedirection( int delay, const QString &url )
 
 KHTMLView *KHTMLPart::view() const
 {
-    _logNotYetImplemented();
+    return d->m_view;
+}
+
+void KHTMLPart::setView(KHTMLView *view)
+{
+    d->m_view = view;
 }
 
 
diff --git a/WebCore/kwq/KWQKHTMLSettings.h b/WebCore/kwq/KWQKHTMLSettings.h
index a4287ba..977b7de 100644
--- a/WebCore/kwq/KWQKHTMLSettings.h
+++ b/WebCore/kwq/KWQKHTMLSettings.h
@@ -38,6 +38,8 @@
 class KHTMLSettings
 {
 public:
+    KHTMLSettings::KHTMLSettings();
+
     // Font settings
     QString stdFontName() const;
     QString fixedFontName() const;
@@ -65,6 +67,9 @@ public:
 
     bool isFormCompletionEnabled() const;
     int maxFormCompletionItems() const;
+
+private:
+    QValueList<int>     m_fontSizes;
 };
 
 #endif
diff --git a/WebCore/kwq/KWQKHTMLSettings.mm b/WebCore/kwq/KWQKHTMLSettings.mm
index 137b0c3..daf5a1c 100644
--- a/WebCore/kwq/KWQKHTMLSettings.mm
+++ b/WebCore/kwq/KWQKHTMLSettings.mm
@@ -27,45 +27,59 @@
 
 #include <khtml_settings.h>
 
+KHTMLSettings::KHTMLSettings()
+{
+    m_fontSizes.clear();
+    m_fontSizes << 6;
+    m_fontSizes << 8;
+    m_fontSizes << 10;
+    m_fontSizes << 12;
+    m_fontSizes << 14;
+    m_fontSizes << 16;
+    m_fontSizes << 18;
+    m_fontSizes << 20;
+}
+
 QString KHTMLSettings::stdFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Arial");
 }
 
 
 QString KHTMLSettings::fixedFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Courier");
 }
 
 
 QString KHTMLSettings::serifFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Times-Roman");
 }
 
 
 QString KHTMLSettings::sansSerifFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Arial");
 }
 
 
 QString KHTMLSettings::cursiveFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Times-Roman");
 }
 
 
 QString KHTMLSettings::fantasyFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Times-Roman");
 }
 
 
 QString KHTMLSettings::settingsToCSS() const
 {
     _logNotYetImplemented();
+    return "";
 }
 
 QFont::CharSet KHTMLSettings::charset() const
@@ -88,7 +102,7 @@ const QString &KHTMLSettings::encoding() const
 
 int KHTMLSettings::minFontSize() const
 {
-    _logNotYetImplemented();
+    return 6;
 }
 
 
@@ -112,7 +126,7 @@ void KHTMLSettings::setScript( QFont::CharSet c )
 
 const QValueList<int> &KHTMLSettings::fontSizes() const
 {
-    _logNotYetImplemented();
+    return m_fontSizes;
 }
 
 
diff --git a/WebCore/kwq/khtml/khtml_settings.h b/WebCore/kwq/khtml/khtml_settings.h
index a4287ba..977b7de 100644
--- a/WebCore/kwq/khtml/khtml_settings.h
+++ b/WebCore/kwq/khtml/khtml_settings.h
@@ -38,6 +38,8 @@
 class KHTMLSettings
 {
 public:
+    KHTMLSettings::KHTMLSettings();
+
     // Font settings
     QString stdFontName() const;
     QString fixedFontName() const;
@@ -65,6 +67,9 @@ public:
 
     bool isFormCompletionEnabled() const;
     int maxFormCompletionItems() const;
+
+private:
+    QValueList<int>     m_fontSizes;
 };
 
 #endif
diff --git a/WebCore/kwq/qt/qcolor.h b/WebCore/kwq/qt/qcolor.h
index 2a1f005..830391a 100644
--- a/WebCore/kwq/qt/qcolor.h
+++ b/WebCore/kwq/qt/qcolor.h
@@ -113,6 +113,7 @@ public:
 #else
     void *color;
 #endif
+    QString cname;
 #endif
 
 }; // class QColor =============================================================
diff --git a/WebCore/kwq/tests/khtmlview/draw.mm b/WebCore/kwq/tests/khtmlview/draw.mm
index 3509014..bf6923f 100644
--- a/WebCore/kwq/tests/khtmlview/draw.mm
+++ b/WebCore/kwq/tests/khtmlview/draw.mm
@@ -66,13 +66,16 @@ int main( int argc, char **argv )
     // by WebPageDocument.
     // [[WebPageDocument alloc] initWithURL: (NSURL *)url];
     KHTMLPart *w = new KHTMLPart();
-    w->openURL (url);
 
     // Create the KHTMLView.  This will eventually be covered by the
     // WebPageView. 
     // [[WebPageView alloc] initWithFrame: (NSRect)rect document: (WebPageDocument *)doc]
     KHTMLView   *htmlView = new KHTMLView (w, 0);
     KWQHTMLView *kwqHTMLView = [[[KWQHTMLView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: htmlView] autorelease];
+        
+    w->setView (htmlView);
+
+    w->openURL (url);
     
     htmlView->setView (kwqHTMLView);
     
diff --git a/WebCore/src/kdelibs/khtml/css/csshelper.cpp b/WebCore/src/kdelibs/khtml/css/csshelper.cpp
index 00522a3..472a425 100644
--- a/WebCore/src/kdelibs/khtml/css/csshelper.cpp
+++ b/WebCore/src/kdelibs/khtml/css/csshelper.cpp
@@ -141,10 +141,11 @@ DOMString khtml::parseURL(const DOMString &url)
 
 void khtml::setFontSize( QFont &f,  int  pixelsize, const KHTMLSettings *s, QPaintDeviceMetrics *devMetrics )
 {
-    QFontDatabase db;
-
     float size = pixelsize;
 
+#ifndef _KWQ_
+    QFontDatabase db;
+
     float toPix = 1.;
     if ( !khtml::printpainter )
         toPix = devMetrics->logicalDpiY()/72.;
@@ -182,7 +183,7 @@ void khtml::setFontSize( QFont &f,  int  pixelsize, const KHTMLSettings *s, QPai
 //         else if ( size > 4 && size < 16 )
 //             size = float( int( ( size + 1 ) / 2 )*2 );
     }
-
+#endif
     //qDebug(" -->>> using %f pixel font", size);
 
     f.setPixelSizeFloat( size );
diff --git a/WebCore/src/kdelibs/khtml/css/cssstyleselector.cpp b/WebCore/src/kdelibs/khtml/css/cssstyleselector.cpp
index 3d95a6f..d711ea9 100644
--- a/WebCore/src/kdelibs/khtml/css/cssstyleselector.cpp
+++ b/WebCore/src/kdelibs/khtml/css/cssstyleselector.cpp
@@ -77,7 +77,9 @@ static CSSStyleSelector::Encodedurl *encodedurl;
 CSSStyleSelector::CSSStyleSelector(DocumentImpl * doc)
 {
     strictParsing = doc->parseMode() == DocumentImpl::Strict;
-    if(!defaultStyle) loadDefaultStyle(doc->view()?doc->view()->part()->settings():0);
+    if(!defaultStyle){
+        loadDefaultStyle(doc->view()?doc->view()->part()->settings():0);
+    }
 
     selectors = 0;
     selectorCache = 0;
diff --git a/WebCore/src/kdelibs/khtml/khtmlview.cpp b/WebCore/src/kdelibs/khtml/khtmlview.cpp
index 51228f3..376c33b 100644
--- a/WebCore/src/kdelibs/khtml/khtmlview.cpp
+++ b/WebCore/src/kdelibs/khtml/khtmlview.cpp
@@ -225,7 +225,8 @@ void KHTMLView::init()
     lstViews->append( this );
 
     if(!d->paintBuffer) d->paintBuffer = new QPixmap(PAINT_BUFFER_HEIGHT, PAINT_BUFFER_HEIGHT);
-   if(!d->tp) d->tp = new QPainter();
+    
+    if(!d->tp) d->tp = new QPainter();
 
     setFocusPolicy(QWidget::StrongFocus);
     viewport()->setFocusPolicy( QWidget::WheelFocus );
@@ -305,7 +306,18 @@ void KHTMLView::drawContents( QPainter *p, int ex, int ey, int ew, int eh )
         d->tp->begin(d->paintBuffer);
         d->tp->translate(-ex, -ey-py);
         d->tp->fillRect(ex, ey+py, ew, ph, palette().normal().brush(QColorGroup::Base));
-        m_part->xmlDocImpl()->renderer()->print(d->tp, ex, ey+py, ew, ph, 0, 0);
+        
+        // FIXME!
+        RenderObject *ro;
+        DOM::DocumentImpl *doc;
+        
+        doc = m_part->xmlDocImpl();
+        if (doc){
+            ro = doc->renderer();
+            if (ro){
+                ro->print(d->tp, ex, ey+py, ew, ph, 0, 0);
+            }
+        }
 #ifdef BOX_DEBUG
 	if (m_part->xmlDocImpl()->focusNode())
 	{
diff --git a/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.cpp b/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.cpp
index 58b39fc..a297ae4 100644
--- a/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.cpp
@@ -180,6 +180,14 @@ NodeImpl *NodeImpl::addChild(NodeImpl *)
   return 0;
 }
 
+#ifdef _KWQ_
+khtml::RenderObject *NodeImpl::renderer() const
+{
+    return m_render;
+}
+#endif
+
+
 QString NodeImpl::toHTML() const
 {
     NodeImpl* fc = firstChild();
diff --git a/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.h b/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.h
index 22eafd2..8f98b0c 100644
--- a/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/src/kdelibs/khtml/xml/dom_nodeimpl.h
@@ -193,7 +193,12 @@ public:
     virtual khtml::RenderStyle *style() const { return 0; }
 
     virtual void setRenderer(khtml::RenderObject *object) { m_render = object; }
+#ifdef _KWQ_
+    khtml::RenderObject *renderer() const;
+#else
     virtual khtml::RenderObject *renderer() const { return m_render; }
+#endif
+
 
     virtual DOM::CSSStyleDeclarationImpl *styleRules() { return 0; }
 
diff --git a/WebCore/src/kwq/KWQColor.mm b/WebCore/src/kwq/KWQColor.mm
index d93707e..7b54ba3 100644
--- a/WebCore/src/kwq/KWQColor.mm
+++ b/WebCore/src/kwq/KWQColor.mm
@@ -37,6 +37,7 @@
 
 #include <qcolor.h>
 
+
 QRgb qRgb(int r, int g, int b)
 {
     return r << 16 | g << 8 | b;
@@ -65,11 +66,11 @@ QColor::QColor(int r, int g, int b)
 }
 
 
-QColor::QColor(const char *)
+QColor::QColor(const char *n)
 {
-    if ( !globals_init )
-	initGlobalColors();
-    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+ //   if ( !globals_init )
+//	initGlobalColors();
+//    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
     // FIXME: need to implement real construction of color based on string
     _initialize (0,0,0);
 }
@@ -106,12 +107,16 @@ QColor::QColor(const QColor &copyFrom)
 QString QColor::name() const
 {
     NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    // FIXME!  Must map onto named colors.
+    return "white";
 }
 
 
-void QColor::setNamedColor(const QString&)
+void QColor::setNamedColor(const QString&n)
 {
-    NSLog (@"WARNING %s:%s:%d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    //NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED) color = %s\n", __FILE__, __FUNCTION__, __LINE__, n.ascii());
+    NSLog (@"WARNING %s:%s %d (NOT YET IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
+    // Do something better here.
 }
 
 
diff --git a/WebCore/src/kwq/KWQFont.mm b/WebCore/src/kwq/KWQFont.mm
index dc48703..424a41c 100644
--- a/WebCore/src/kwq/KWQFont.mm
+++ b/WebCore/src/kwq/KWQFont.mm
@@ -106,7 +106,7 @@ void QFont::setFamily(const QString &qfamilyName)
     NSFont *oldFont = data->font;
     
     familyName = QSTRING_TO_NSSTRING(qfamilyName);
-    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toFamily: familyName] retain];
+    data->font = [[[NSFontManager sharedFontManager] convertFont: oldFont toFamily: familyName] retain];
 
     [oldFont release];
 }
@@ -116,7 +116,7 @@ void QFont::setPixelSizeFloat(float sz)
 {
     NSFont *oldFont = data->font;
 
-    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toSize: sz] retain];
+    data->font = [[[NSFontManager sharedFontManager] convertFont: oldFont toSize: sz] retain];
 
     [oldFont release];
 }
diff --git a/WebCore/src/kwq/KWQKGlobalSettings.mm b/WebCore/src/kwq/KWQKGlobalSettings.mm
index e040e4d..1c3889a 100644
--- a/WebCore/src/kwq/KWQKGlobalSettings.mm
+++ b/WebCore/src/kwq/KWQKGlobalSettings.mm
@@ -27,24 +27,30 @@
 
 #include <kglobalsettings.h>
 
+#include <kwqdebug.h>
 
 QFont KGlobalSettings::generalFont()
 {
+    return QFont();
 }
 
 
 QFont KGlobalSettings::windowTitleFont()
 {
+    return QFont();
 }
 
 
 QFont KGlobalSettings::menuFont()
 {
+    return QFont();
 }
 
 
 int KGlobalSettings::contrast()
 {
+    _logNotYetImplemented();
+    return 0;
 }
 
 
diff --git a/WebCore/src/kwq/KWQKHTMLPart.h b/WebCore/src/kwq/KWQKHTMLPart.h
index d694f81..c8f7dd0 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.h
+++ b/WebCore/src/kwq/KWQKHTMLPart.h
@@ -529,6 +529,7 @@ public:
     // The following are only present to get khtml to build.
     void scheduleRedirection( int delay, const QString &url ); // ### KDE 3.0: make private?
     KHTMLView *view() const;
+    void setView(KHTMLView *view);
     QWidget *widget();
     KHTMLPart *opener();
     KHTMLPart *parentPart();
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index 31c5cbf..2693b6d 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -91,6 +91,8 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 class KHTMLPartPrivate
 {
 public:
+    KHTMLView *m_view;
+    
     DOM::DocumentImpl *m_doc;
     khtml::Decoder *m_decoder;
 
@@ -114,10 +116,12 @@ public:
             cache_init = true;
         }
         m_part = part;
+        m_view = 0L;
         m_doc = new HTMLDocumentImpl();
         m_decoder = 0L;
         m_bFirstData = true;
-        m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+        //m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+        m_settings = new KHTMLSettings();
         m_haveEncoding = false;
         m_recv = [[KHTMLPartNotificationReceiver alloc] init];
         m_recv->m_part = part;
@@ -171,7 +175,7 @@ void KHTMLPart::slotData(id <WCURICacheData> data)
 bool KHTMLPart::openURL( const KURL &url )
 {
     // Close the previous URL.
-    //closeURL();
+    closeURL();
     
     //if ( args.doPost() && (url.protocol().startsWith("http")) )
     //{
@@ -208,9 +212,9 @@ bool KHTMLPart::openURL( const KURL &url )
 
 bool KHTMLPart::closeURL()
 {
-    if (d && d->m_doc) {
-        recursive(0, d->m_doc);
-    }
+    //if (d && d->m_doc) {
+    //    recursive(0, d->m_doc);
+    //}
 
     // Cancel any pending loads.
     
@@ -335,10 +339,10 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset)
 {
     //d->m_referrer = url.url();
     
-    d->m_doc = new HTMLDocumentImpl();
+    d->m_doc = new HTMLDocumentImpl(d->m_view);
     d->m_doc->ref();
     //FIXME: do we need this? 
-    //d->m_doc->attach( d->m_view );
+    d->m_doc->attach( d->m_view );
     d->m_doc->setURL( url.url() );
 
     /* FIXME: we'll need to make this work....
@@ -451,7 +455,9 @@ void KHTMLPart::setBaseURL( const KURL &url )
 
 KURL KHTMLPart::baseURL() const
 {
-    _logNeverImplemented();
+    // FIXME!
+    _logPartiallyImplemented();
+    return KURL();
 }
 
 
@@ -643,7 +649,7 @@ DOM::DocumentImpl *KHTMLPart::xmlDocImpl() const
 
 const KHTMLSettings *KHTMLPart::settings() const
 {
-    _logNotYetImplemented();
+    return d->m_settings;
 }
 
 
@@ -673,7 +679,12 @@ void KHTMLPart::scheduleRedirection( int delay, const QString &url )
 
 KHTMLView *KHTMLPart::view() const
 {
-    _logNotYetImplemented();
+    return d->m_view;
+}
+
+void KHTMLPart::setView(KHTMLView *view)
+{
+    d->m_view = view;
 }
 
 
diff --git a/WebCore/src/kwq/KWQKHTMLSettings.mm b/WebCore/src/kwq/KWQKHTMLSettings.mm
index 137b0c3..daf5a1c 100644
--- a/WebCore/src/kwq/KWQKHTMLSettings.mm
+++ b/WebCore/src/kwq/KWQKHTMLSettings.mm
@@ -27,45 +27,59 @@
 
 #include <khtml_settings.h>
 
+KHTMLSettings::KHTMLSettings()
+{
+    m_fontSizes.clear();
+    m_fontSizes << 6;
+    m_fontSizes << 8;
+    m_fontSizes << 10;
+    m_fontSizes << 12;
+    m_fontSizes << 14;
+    m_fontSizes << 16;
+    m_fontSizes << 18;
+    m_fontSizes << 20;
+}
+
 QString KHTMLSettings::stdFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Arial");
 }
 
 
 QString KHTMLSettings::fixedFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Courier");
 }
 
 
 QString KHTMLSettings::serifFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Times-Roman");
 }
 
 
 QString KHTMLSettings::sansSerifFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Arial");
 }
 
 
 QString KHTMLSettings::cursiveFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Times-Roman");
 }
 
 
 QString KHTMLSettings::fantasyFontName() const
 {
-    _logNotYetImplemented();
+    return QString ("Times-Roman");
 }
 
 
 QString KHTMLSettings::settingsToCSS() const
 {
     _logNotYetImplemented();
+    return "";
 }
 
 QFont::CharSet KHTMLSettings::charset() const
@@ -88,7 +102,7 @@ const QString &KHTMLSettings::encoding() const
 
 int KHTMLSettings::minFontSize() const
 {
-    _logNotYetImplemented();
+    return 6;
 }
 
 
@@ -112,7 +126,7 @@ void KHTMLSettings::setScript( QFont::CharSet c )
 
 const QValueList<int> &KHTMLSettings::fontSizes() const
 {
-    _logNotYetImplemented();
+    return m_fontSizes;
 }
 
 
diff --git a/WebCore/src/kwq/khtml/khtml_settings.h b/WebCore/src/kwq/khtml/khtml_settings.h
index a4287ba..977b7de 100644
--- a/WebCore/src/kwq/khtml/khtml_settings.h
+++ b/WebCore/src/kwq/khtml/khtml_settings.h
@@ -38,6 +38,8 @@
 class KHTMLSettings
 {
 public:
+    KHTMLSettings::KHTMLSettings();
+
     // Font settings
     QString stdFontName() const;
     QString fixedFontName() const;
@@ -65,6 +67,9 @@ public:
 
     bool isFormCompletionEnabled() const;
     int maxFormCompletionItems() const;
+
+private:
+    QValueList<int>     m_fontSizes;
 };
 
 #endif
diff --git a/WebCore/src/kwq/qt/qcolor.h b/WebCore/src/kwq/qt/qcolor.h
index 2a1f005..830391a 100644
--- a/WebCore/src/kwq/qt/qcolor.h
+++ b/WebCore/src/kwq/qt/qcolor.h
@@ -113,6 +113,7 @@ public:
 #else
     void *color;
 #endif
+    QString cname;
 #endif
 
 }; // class QColor =============================================================
diff --git a/WebCore/src/kwq/tests/khtmlview/draw.mm b/WebCore/src/kwq/tests/khtmlview/draw.mm
index 3509014..bf6923f 100644
--- a/WebCore/src/kwq/tests/khtmlview/draw.mm
+++ b/WebCore/src/kwq/tests/khtmlview/draw.mm
@@ -66,13 +66,16 @@ int main( int argc, char **argv )
     // by WebPageDocument.
     // [[WebPageDocument alloc] initWithURL: (NSURL *)url];
     KHTMLPart *w = new KHTMLPart();
-    w->openURL (url);
 
     // Create the KHTMLView.  This will eventually be covered by the
     // WebPageView. 
     // [[WebPageView alloc] initWithFrame: (NSRect)rect document: (WebPageDocument *)doc]
     KHTMLView   *htmlView = new KHTMLView (w, 0);
     KWQHTMLView *kwqHTMLView = [[[KWQHTMLView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: htmlView] autorelease];
+        
+    w->setView (htmlView);
+
+    w->openURL (url);
     
     htmlView->setView (kwqHTMLView);
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list