[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:52:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9dcf95124a8cf6e954909b07dc07eea2e5b76f09
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 30 02:02:26 2001 +0000

    Lots of little changes.  More stubbling towards getting events to work.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@470 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index add7090..5db6ed1 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -73,7 +73,7 @@ RenderFormElement::~RenderFormElement()
 
 short RenderFormElement::baselinePosition( bool f ) const
 {
-    return RenderWidget::baselinePosition( f ) - 2 - QFontMetrics( style()->font() ).descent();
+    return RenderWidget::baselinePosition( f ) - 6 - QFontMetrics( style()->font() ).descent();
 }
 
 short RenderFormElement::calcReplacedWidth(bool*) const
@@ -258,6 +258,13 @@ bool RenderFormElement::eventFilter(QObject* /*o*/, QEvent* e)
     return deleted;
 }
 
+void RenderFormElement::performAction(QObject::Actions action)
+{
+    fprintf (stdout, "RenderFormElement::performAction():  %d\n", action);
+    if (action == QObject::ACTION_BUTTON_CLICKED)
+        slotClicked();
+}
+
 void RenderFormElement::slotClicked()
 {
     if(isRenderButton()) {
@@ -310,8 +317,9 @@ RenderCheckBox::RenderCheckBox(QScrollView *view,
     b->setMouseTracking(true);
     setQWidget(b);
     b->installEventFilter(this);
-    connect(b,SIGNAL(stateChanged(int)),this,SLOT(slotStateChanged(int)));
-    connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
+
+    connect(b, "SIGNAL(stateChanged(int))", this, "SLOT(slotStateChanged(int))");
+    connect(b, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
 }
 
 
@@ -352,7 +360,7 @@ RenderRadioButton::RenderRadioButton(QScrollView *view,
     b->setMouseTracking(true);
     setQWidget(b);
     b->installEventFilter(this);
-    connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
+    connect(b, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
 }
 
 void RenderRadioButton::setChecked(bool checked)
@@ -399,7 +407,12 @@ RenderSubmitButton::RenderSubmitButton(QScrollView *view, HTMLInputElementImpl *
     setQWidget(p);
     p->setMouseTracking(true);
     p->installEventFilter(this);
-    connect(p, SIGNAL(clicked()), this, SLOT(slotClicked()));
+    connect(p, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
+    
+    // Need to store a reference to this object and then invoke slotClicked on it.
+    //p->setAction (&RenderFormElement::slotClicked);
+    //p->setRenderObject (this);
+    p->setTarget (this);
 }
 
 void RenderSubmitButton::calcMinMaxWidth()
@@ -442,7 +455,10 @@ QString RenderSubmitButton::defaultLabel() {
 
 short RenderSubmitButton::baselinePosition( bool f ) const
 {
-    return RenderFormElement::baselinePosition( f );
+    //return RenderFormElement::baselinePosition( f );
+    // FIXED: [rjw] Where does this magic number '8' come from.  It's also used above in
+    // RenderSubmitButton::calcMinMaxWidth().
+    return RenderWidget::baselinePosition( f ) - 8 - QFontMetrics( style()->font() ).descent();
 }
 
 // -------------------------------------------------------------------------------
@@ -515,8 +531,8 @@ RenderLineEdit::RenderLineEdit(QScrollView *view, HTMLInputElementImpl *element)
 {
     LineEditWidget *edit = new LineEditWidget(view->viewport());
     edit->installEventFilter(this);
-    connect(edit,SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
-    connect(edit,SIGNAL(textChanged(const QString &)),this,SLOT(slotTextChanged(const QString &)));
+    connect(edit,"SIGNAL(returnPressed())", this, "SLOT(slotReturnPressed())");
+    connect(edit,"SIGNAL(textChanged(const QString &))", this, "SLOT(slotTextChanged(const QString &))");
 
     if(element->inputType() == HTMLInputElementImpl::PASSWORD)
         edit->setEchoMode( QLineEdit::Password );
@@ -572,7 +588,7 @@ void RenderLineEdit::calcMinMaxWidth()
             h = 22;
         s = QSize( w + 8, h ).expandedTo( QApplication::globalStrut() );
     } else
-	s = QSize( w + 4, h + 4 ).expandedTo( QApplication::globalStrut() );
+	s = QSize( w + 6, h + 6 ).expandedTo( QApplication::globalStrut() );
 
     setIntrinsicWidth( s.width() );
     setIntrinsicHeight( s.height() );
@@ -632,12 +648,12 @@ RenderFileButton::RenderFileButton(QScrollView *view, HTMLInputElementImpl *elem
 
     m_edit->installEventFilter(this);
 
-    connect(m_edit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
-    connect(m_edit, SIGNAL(textChanged(const QString &)),this,SLOT(slotTextChanged(const QString &)));
+    connect(m_edit, "SIGNAL(returnPressed())", this, "SLOT(slotReturnPressed())");
+    connect(m_edit, "SIGNAL(textChanged(const QString &))", this, "SLOT(slotTextChanged(const QString &))");
 
     m_button = new QPushButton(i18n("Browse..."), w);
     m_button->setFocusPolicy(QWidget::ClickFocus);
-    connect(m_button,SIGNAL(clicked()), this, SLOT(slotClicked()));
+    connect(m_button, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
 
     w->setStretchFactor(m_edit, 2);
     w->setFocusProxy(m_edit);
@@ -1045,7 +1061,7 @@ KListBox* RenderSelect::createListBox()
     lb->setSelectionMode(m_multiple ? QListBox::Extended : QListBox::Single);
     // ### looks broken
     //lb->setAutoMask(true);
-    connect( lb, SIGNAL( selectionChanged() ), this, SLOT( slotSelectionChanged() ) );
+    connect( lb, "SIGNAL(selectionChanged())", this, "SLOT(slotSelectionChanged())" );
     m_ignoreSelectEvents = false;
     lb->setMouseTracking(true);
 
@@ -1056,7 +1072,7 @@ ComboBoxWidget *RenderSelect::createComboBox()
 {
     ComboBoxWidget *cb = new ComboBoxWidget(m_view->viewport());
     cb->installEventFilter(this);
-    connect(cb, SIGNAL(activated(int)), this, SLOT(slotSelected(int)));
+    connect(cb, "SIGNAL(activated(int))", this, "SLOT(slotSelected(int))");
     return cb;
 }
 
@@ -1136,7 +1152,7 @@ RenderTextArea::RenderTextArea(QScrollView *view, HTMLTextAreaElementImpl *eleme
     setQWidget(edit);
     edit->installEventFilter(this);
 
-    connect(edit,SIGNAL(textChanged()),this,SLOT(slotTextChanged()));
+    connect(edit, "SIGNAL(textChanged())", this, "SLOT(slotTextChanged())");
 }
 
 RenderTextArea::~RenderTextArea()
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index 00b56f1..45aef16 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -84,6 +84,8 @@ public:
 
     virtual bool eventFilter(QObject*, QEvent*);
 
+    void performAction(QObject::Actions action);
+
 public slots:
     virtual void slotClicked();
 
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 13f362e..4385241 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -118,7 +118,12 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
     // FIXME: [kocienda]
     // This hack gets the underline in a better place but we should be
     // doing something better.
-    underlineOffset+=2;
+    // FIXED: [rjw]  Don't need this.
+    if (pt->fontMetrics().descent() > 2)
+        underlineOffset = underlineOffset - pt->fontMetrics().descent() + 4;
+    else if (pt->fontMetrics().descent() == 2)
+        underlineOffset +=  2;
+    
 
     if(deco & UNDERLINE){
         //fprintf (stderr, "UNDERLINE (%d, %d) to (%d, %d)\n", _tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
diff --git a/WebCore/kwq/KWQButton.h b/WebCore/kwq/KWQButton.h
index 8ee3254..3b4f19f 100644
--- a/WebCore/kwq/KWQButton.h
+++ b/WebCore/kwq/KWQButton.h
@@ -52,7 +52,7 @@ public:
 
     virtual void setText(const QString &);
     QString text() const;
-
+    
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
diff --git a/WebCore/kwq/KWQButton.mm b/WebCore/kwq/KWQButton.mm
index 5e4241f..81bee25 100644
--- a/WebCore/kwq/KWQButton.mm
+++ b/WebCore/kwq/KWQButton.mm
@@ -50,4 +50,3 @@ QString QButton::text() const
     KWQNSButton *button = (KWQNSButton *)getView();
     return NSSTRING_TO_QSTRING([button title]);
 }
-
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index 9c624b0..975a0a8 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -46,8 +46,8 @@ void QComboBox::init(bool isEditable)
     KWQNSComboBox *comboBox;
     
     comboBox = [[[KWQNSComboBox alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this] autorelease];
-    if (isEditable == FALSE)
-        [comboBox setEditable: NO];
+    //if (isEditable == FALSE)
+    //    [comboBox setEditable: NO];
     setView (comboBox);
 }
 
@@ -91,7 +91,9 @@ void QComboBox::insertItem(const QString &text, int index)
     
     if (index < 0)
         index = count();
-    [comboBox insertItemWithObjectValue: QSTRING_TO_NSSTRING (text) atIndex: index]; 
+    // Hack to allow multiple items with same name.   Ugh.
+    [comboBox insertItemWithTitle: [NSString stringWithFormat: @"%d", index, nil] atIndex: index]; 
+    [[comboBox itemAtIndex: index] setTitle: QSTRING_TO_NSSTRING (text)];
 }
 
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 1c25e81..958eb00 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1051,7 +1051,11 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
   // the mouse is pressed again.
   d->m_bMousePressed = false;
 
-    openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+    // HACK!  FIXME!
+    if (d->m_strSelectedURL != QString::null) {
+        [((QWidget *)view())->getView() resetView];
+        openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+    }
     
 #define QT_NO_CLIPBOARD 1
 #ifndef QT_NO_CLIPBOARD
@@ -1141,7 +1145,7 @@ KJSProxy *KHTMLPart::jScript()
 }
 
 
-KURL KHTMLPart::completeURL(const QString &url, const QString &target = QString::null)
+KURL KHTMLPart::completeURL(const QString &url, const QString &target)
 {
     if (d->m_baseURL.isEmpty()) {
         return KURL(d->m_workingURL);
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 1c25e81..958eb00 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -1051,7 +1051,11 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
   // the mouse is pressed again.
   d->m_bMousePressed = false;
 
-    openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+    // HACK!  FIXME!
+    if (d->m_strSelectedURL != QString::null) {
+        [((QWidget *)view())->getView() resetView];
+        openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+    }
     
 #define QT_NO_CLIPBOARD 1
 #ifndef QT_NO_CLIPBOARD
@@ -1141,7 +1145,7 @@ KJSProxy *KHTMLPart::jScript()
 }
 
 
-KURL KHTMLPart::completeURL(const QString &url, const QString &target = QString::null)
+KURL KHTMLPart::completeURL(const QString &url, const QString &target)
 {
     if (d->m_baseURL.isEmpty()) {
         return KURL(d->m_workingURL);
diff --git a/WebCore/kwq/KWQObject.h b/WebCore/kwq/KWQObject.h
index a791d2e..4d4c1d6 100644
--- a/WebCore/kwq/KWQObject.h
+++ b/WebCore/kwq/KWQObject.h
@@ -39,9 +39,9 @@
 
 // FIXME: should these macros be in "kwq.h" or other header file?
 #define slots
-#define SLOT(x) "x"
+#define SLOT(x) """## x ##"""
 #define signals protected
-#define SIGNAL(x) "x"
+#define SIGNAL(x) """## x ##"""
 #define emit
 #define Q_OBJECT
 #define Q_PROPERTY(text)
@@ -71,6 +71,9 @@ class QVariant;
 
 class QObject : public Qt {
 public:
+    enum Actions {
+        ACTION_BUTTON_CLICKED = 1
+    };
 
     // typedefs ----------------------------------------------------------------
     // enums -------------------------------------------------------------------
@@ -96,7 +99,7 @@ public:
 
     QVariant property(const char *name) const;
     bool inherits(const char *) const;
-    bool connect(const QObject *, const char *, const char *) const;
+    bool connect(const QObject *src, const char *signal, const char *slot) const;
 
     int startTimer(int);
     void killTimer(int);
@@ -107,6 +110,12 @@ public:
 
     void blockSignals(bool);
 
+#ifdef _KWQ_
+    virtual void performAction(QObject::Actions action);
+    void emitAction(QObject::Actions action);
+    void setTarget (QObject *obj);
+#endif    
+    
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -118,6 +127,7 @@ private:
     QObject(const QObject &);
     QObject &operator=(const QObject &);
 
+    QObject *target;
 }; // class QObject ============================================================
 
 #endif
diff --git a/WebCore/kwq/KWQObject.mm b/WebCore/kwq/KWQObject.mm
index e7b75d4..d056381 100644
--- a/WebCore/kwq/KWQObject.mm
+++ b/WebCore/kwq/KWQObject.mm
@@ -28,19 +28,49 @@
 
 #include <kwqdebug.h>
 
-bool QObject::connect(const QObject *src, const char *signal, const QObject *dest, 
+bool QObject::connect(const QObject *sender, const char *signal, const QObject *dest, 
     const char *slot)
 {
+    if (sender)
+        ((QObject *)sender)->setTarget ((QObject *)dest);
+    KWQDEBUG4 ("src = 0x%08x, signal = %s, dest = 0x%08x, slot = %s\n", sender, signal, dest, slot);
     return FALSE;
 }
 
 
+
+bool QObject::connect(const QObject *sender, const char *signal, const char *slot) const
+{
+    if (sender)
+        ((QObject *)sender)->setTarget ((QObject *)sender);
+    KWQDEBUG3 ("src = 0x%08x, signal = %s, slot = %s\n", sender, signal, slot);
+    return FALSE;    
+}
+
+
+void QObject::emitAction(QObject::Actions action)
+{
+    target->performAction (action);
+}
+
+
+void QObject::performAction(QObject::Actions action)
+{
+}
+
+
 bool QObject::disconnect( const QObject *, const char *, const QObject *, 
     const char *)
 {
     return FALSE;
 }
 
+void QObject::setTarget (QObject *t)
+{
+    target = t;
+}
+
+
 
 QObject::QObject(QObject *parent=0, const char *name=0)
 {
@@ -79,13 +109,6 @@ bool QObject::inherits(const char *) const
 }
 
 
-bool QObject::connect(const QObject *, const char *, const char *) const
-{
-    _logNeverImplemented();
-    return FALSE;    
-}
-
-
 int QObject:: startTimer(int)
 {
     _logNeverImplemented();
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 9274f51..5fa6b11 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -485,6 +485,7 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
     // This will draw the text from the top of the bounding box down.
     // Qt expects to draw from the baseline.
     y = y - (int)([font defaultLineHeightForFont] + [font descender]);
+    //y = y - (int)([font defaultLineHeightForFont]);
 
 #ifdef SLOW_SAFE_DRAWING
 
diff --git a/WebCore/kwq/KWQRadioButton.mm b/WebCore/kwq/KWQRadioButton.mm
index 09056eb..6e31ffd 100644
--- a/WebCore/kwq/KWQRadioButton.mm
+++ b/WebCore/kwq/KWQRadioButton.mm
@@ -33,8 +33,9 @@ QRadioButton::QRadioButton(QWidget *w) : QButton (w)
     KWQNSButton *button;
     
     button = (KWQNSButton *)getView();
-    [button setButtonType: NSSwitchButton];
-    setView (button);
+    [button setButtonType: NSRadioButton];
+    [button sizeToFit];
+    //setView (button);
 }
 
 
diff --git a/WebCore/kwq/KWQView.h b/WebCore/kwq/KWQView.h
index 7283c13..4ed3055 100644
--- a/WebCore/kwq/KWQView.h
+++ b/WebCore/kwq/KWQView.h
@@ -45,7 +45,7 @@ class KHTMLPart;
 - initWithFrame: (NSRect)r widget: (QWidget *)w; 
 @end
 
- at interface KWQNSComboBox : NSComboBox
+ at interface KWQNSComboBox : NSPopUpButton
 {
     QWidget *widget;
 }
diff --git a/WebCore/kwq/KWQView.mm b/WebCore/kwq/KWQView.mm
index 7c266c1..0311903 100644
--- a/WebCore/kwq/KWQView.mm
+++ b/WebCore/kwq/KWQView.mm
@@ -69,10 +69,20 @@
 - initWithFrame: (NSRect) r widget: (QWidget *)w 
 {
     [super initWithFrame: r];
+    [self setBordered:YES];
+    [self setBezelStyle:NSRoundedBezelStyle];
     widget = w;
+    
+    [self setTarget: self];
+    [self setAction: @selector(action:)];
     return self;
 }
 
+- action: sender
+{
+    widget->emitAction(QObject::ACTION_BUTTON_CLICKED);
+}
+
 @end
 
 
diff --git a/WebCore/kwq/KWQWidget.h b/WebCore/kwq/KWQWidget.h
index 3d9ba4a..0b883fe 100644
--- a/WebCore/kwq/KWQWidget.h
+++ b/WebCore/kwq/KWQWidget.h
@@ -154,7 +154,7 @@ public:
 #ifdef _KWQ_
 
     virtual void paint (void *);
-    
+            
 #if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
     NSView 	*getView() const;
     void 	setView(NSView *aView);
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 260cf71..61da965 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -79,6 +79,7 @@ private:
 #else
     void 	*view;
 #endif
+    void	*action();
 };
 
 QWidget::QWidget(QWidget *parent=0, const char *name=0, WFlags f=0) 
@@ -328,10 +329,14 @@ void QWidget::constPolish() const
 
 QSize QWidget::minimumSizeHint() const
 {
-    // Used by embedded java (KJavaEmbed::sizeHint().  Will be replaced.
-    // Used by RenderSubmitButton::calcMinMaxWidth(), where it is called
-    // on a button widget.  Will be replaced.
-    _logNeverImplemented();
+    NSView *view = getView();
+    
+    if ([view isKindOfClass: [NSControl class]]){
+        [(NSControl *)getView() sizeToFit];
+        NSRect frame = [getView() frame];
+        return QSize ((int)frame.size.width, (int)frame.size.height);
+    }
+
     return QSize (0,0);
 }
 
diff --git a/WebCore/kwq/qt/qbutton.h b/WebCore/kwq/qt/qbutton.h
index 8ee3254..3b4f19f 100644
--- a/WebCore/kwq/qt/qbutton.h
+++ b/WebCore/kwq/qt/qbutton.h
@@ -52,7 +52,7 @@ public:
 
     virtual void setText(const QString &);
     QString text() const;
-
+    
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
diff --git a/WebCore/kwq/qt/qobject.h b/WebCore/kwq/qt/qobject.h
index a791d2e..4d4c1d6 100644
--- a/WebCore/kwq/qt/qobject.h
+++ b/WebCore/kwq/qt/qobject.h
@@ -39,9 +39,9 @@
 
 // FIXME: should these macros be in "kwq.h" or other header file?
 #define slots
-#define SLOT(x) "x"
+#define SLOT(x) """## x ##"""
 #define signals protected
-#define SIGNAL(x) "x"
+#define SIGNAL(x) """## x ##"""
 #define emit
 #define Q_OBJECT
 #define Q_PROPERTY(text)
@@ -71,6 +71,9 @@ class QVariant;
 
 class QObject : public Qt {
 public:
+    enum Actions {
+        ACTION_BUTTON_CLICKED = 1
+    };
 
     // typedefs ----------------------------------------------------------------
     // enums -------------------------------------------------------------------
@@ -96,7 +99,7 @@ public:
 
     QVariant property(const char *name) const;
     bool inherits(const char *) const;
-    bool connect(const QObject *, const char *, const char *) const;
+    bool connect(const QObject *src, const char *signal, const char *slot) const;
 
     int startTimer(int);
     void killTimer(int);
@@ -107,6 +110,12 @@ public:
 
     void blockSignals(bool);
 
+#ifdef _KWQ_
+    virtual void performAction(QObject::Actions action);
+    void emitAction(QObject::Actions action);
+    void setTarget (QObject *obj);
+#endif    
+    
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -118,6 +127,7 @@ private:
     QObject(const QObject &);
     QObject &operator=(const QObject &);
 
+    QObject *target;
 }; // class QObject ============================================================
 
 #endif
diff --git a/WebCore/kwq/qt/qwidget.h b/WebCore/kwq/qt/qwidget.h
index 3d9ba4a..0b883fe 100644
--- a/WebCore/kwq/qt/qwidget.h
+++ b/WebCore/kwq/qt/qwidget.h
@@ -154,7 +154,7 @@ public:
 #ifdef _KWQ_
 
     virtual void paint (void *);
-    
+            
 #if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
     NSView 	*getView() const;
     void 	setView(NSView *aView);
diff --git a/WebCore/src/kdelibs/khtml/rendering/render_form.cpp b/WebCore/src/kdelibs/khtml/rendering/render_form.cpp
index add7090..5db6ed1 100644
--- a/WebCore/src/kdelibs/khtml/rendering/render_form.cpp
+++ b/WebCore/src/kdelibs/khtml/rendering/render_form.cpp
@@ -73,7 +73,7 @@ RenderFormElement::~RenderFormElement()
 
 short RenderFormElement::baselinePosition( bool f ) const
 {
-    return RenderWidget::baselinePosition( f ) - 2 - QFontMetrics( style()->font() ).descent();
+    return RenderWidget::baselinePosition( f ) - 6 - QFontMetrics( style()->font() ).descent();
 }
 
 short RenderFormElement::calcReplacedWidth(bool*) const
@@ -258,6 +258,13 @@ bool RenderFormElement::eventFilter(QObject* /*o*/, QEvent* e)
     return deleted;
 }
 
+void RenderFormElement::performAction(QObject::Actions action)
+{
+    fprintf (stdout, "RenderFormElement::performAction():  %d\n", action);
+    if (action == QObject::ACTION_BUTTON_CLICKED)
+        slotClicked();
+}
+
 void RenderFormElement::slotClicked()
 {
     if(isRenderButton()) {
@@ -310,8 +317,9 @@ RenderCheckBox::RenderCheckBox(QScrollView *view,
     b->setMouseTracking(true);
     setQWidget(b);
     b->installEventFilter(this);
-    connect(b,SIGNAL(stateChanged(int)),this,SLOT(slotStateChanged(int)));
-    connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
+
+    connect(b, "SIGNAL(stateChanged(int))", this, "SLOT(slotStateChanged(int))");
+    connect(b, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
 }
 
 
@@ -352,7 +360,7 @@ RenderRadioButton::RenderRadioButton(QScrollView *view,
     b->setMouseTracking(true);
     setQWidget(b);
     b->installEventFilter(this);
-    connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
+    connect(b, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
 }
 
 void RenderRadioButton::setChecked(bool checked)
@@ -399,7 +407,12 @@ RenderSubmitButton::RenderSubmitButton(QScrollView *view, HTMLInputElementImpl *
     setQWidget(p);
     p->setMouseTracking(true);
     p->installEventFilter(this);
-    connect(p, SIGNAL(clicked()), this, SLOT(slotClicked()));
+    connect(p, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
+    
+    // Need to store a reference to this object and then invoke slotClicked on it.
+    //p->setAction (&RenderFormElement::slotClicked);
+    //p->setRenderObject (this);
+    p->setTarget (this);
 }
 
 void RenderSubmitButton::calcMinMaxWidth()
@@ -442,7 +455,10 @@ QString RenderSubmitButton::defaultLabel() {
 
 short RenderSubmitButton::baselinePosition( bool f ) const
 {
-    return RenderFormElement::baselinePosition( f );
+    //return RenderFormElement::baselinePosition( f );
+    // FIXED: [rjw] Where does this magic number '8' come from.  It's also used above in
+    // RenderSubmitButton::calcMinMaxWidth().
+    return RenderWidget::baselinePosition( f ) - 8 - QFontMetrics( style()->font() ).descent();
 }
 
 // -------------------------------------------------------------------------------
@@ -515,8 +531,8 @@ RenderLineEdit::RenderLineEdit(QScrollView *view, HTMLInputElementImpl *element)
 {
     LineEditWidget *edit = new LineEditWidget(view->viewport());
     edit->installEventFilter(this);
-    connect(edit,SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
-    connect(edit,SIGNAL(textChanged(const QString &)),this,SLOT(slotTextChanged(const QString &)));
+    connect(edit,"SIGNAL(returnPressed())", this, "SLOT(slotReturnPressed())");
+    connect(edit,"SIGNAL(textChanged(const QString &))", this, "SLOT(slotTextChanged(const QString &))");
 
     if(element->inputType() == HTMLInputElementImpl::PASSWORD)
         edit->setEchoMode( QLineEdit::Password );
@@ -572,7 +588,7 @@ void RenderLineEdit::calcMinMaxWidth()
             h = 22;
         s = QSize( w + 8, h ).expandedTo( QApplication::globalStrut() );
     } else
-	s = QSize( w + 4, h + 4 ).expandedTo( QApplication::globalStrut() );
+	s = QSize( w + 6, h + 6 ).expandedTo( QApplication::globalStrut() );
 
     setIntrinsicWidth( s.width() );
     setIntrinsicHeight( s.height() );
@@ -632,12 +648,12 @@ RenderFileButton::RenderFileButton(QScrollView *view, HTMLInputElementImpl *elem
 
     m_edit->installEventFilter(this);
 
-    connect(m_edit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
-    connect(m_edit, SIGNAL(textChanged(const QString &)),this,SLOT(slotTextChanged(const QString &)));
+    connect(m_edit, "SIGNAL(returnPressed())", this, "SLOT(slotReturnPressed())");
+    connect(m_edit, "SIGNAL(textChanged(const QString &))", this, "SLOT(slotTextChanged(const QString &))");
 
     m_button = new QPushButton(i18n("Browse..."), w);
     m_button->setFocusPolicy(QWidget::ClickFocus);
-    connect(m_button,SIGNAL(clicked()), this, SLOT(slotClicked()));
+    connect(m_button, "SIGNAL(clicked())", this, "SLOT(slotClicked())");
 
     w->setStretchFactor(m_edit, 2);
     w->setFocusProxy(m_edit);
@@ -1045,7 +1061,7 @@ KListBox* RenderSelect::createListBox()
     lb->setSelectionMode(m_multiple ? QListBox::Extended : QListBox::Single);
     // ### looks broken
     //lb->setAutoMask(true);
-    connect( lb, SIGNAL( selectionChanged() ), this, SLOT( slotSelectionChanged() ) );
+    connect( lb, "SIGNAL(selectionChanged())", this, "SLOT(slotSelectionChanged())" );
     m_ignoreSelectEvents = false;
     lb->setMouseTracking(true);
 
@@ -1056,7 +1072,7 @@ ComboBoxWidget *RenderSelect::createComboBox()
 {
     ComboBoxWidget *cb = new ComboBoxWidget(m_view->viewport());
     cb->installEventFilter(this);
-    connect(cb, SIGNAL(activated(int)), this, SLOT(slotSelected(int)));
+    connect(cb, "SIGNAL(activated(int))", this, "SLOT(slotSelected(int))");
     return cb;
 }
 
@@ -1136,7 +1152,7 @@ RenderTextArea::RenderTextArea(QScrollView *view, HTMLTextAreaElementImpl *eleme
     setQWidget(edit);
     edit->installEventFilter(this);
 
-    connect(edit,SIGNAL(textChanged()),this,SLOT(slotTextChanged()));
+    connect(edit, "SIGNAL(textChanged())", this, "SLOT(slotTextChanged())");
 }
 
 RenderTextArea::~RenderTextArea()
diff --git a/WebCore/src/kdelibs/khtml/rendering/render_form.h b/WebCore/src/kdelibs/khtml/rendering/render_form.h
index 00b56f1..45aef16 100644
--- a/WebCore/src/kdelibs/khtml/rendering/render_form.h
+++ b/WebCore/src/kdelibs/khtml/rendering/render_form.h
@@ -84,6 +84,8 @@ public:
 
     virtual bool eventFilter(QObject*, QEvent*);
 
+    void performAction(QObject::Actions action);
+
 public slots:
     virtual void slotClicked();
 
diff --git a/WebCore/src/kdelibs/khtml/rendering/render_text.cpp b/WebCore/src/kdelibs/khtml/rendering/render_text.cpp
index 13f362e..4385241 100644
--- a/WebCore/src/kdelibs/khtml/rendering/render_text.cpp
+++ b/WebCore/src/kdelibs/khtml/rendering/render_text.cpp
@@ -118,7 +118,12 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
     // FIXME: [kocienda]
     // This hack gets the underline in a better place but we should be
     // doing something better.
-    underlineOffset+=2;
+    // FIXED: [rjw]  Don't need this.
+    if (pt->fontMetrics().descent() > 2)
+        underlineOffset = underlineOffset - pt->fontMetrics().descent() + 4;
+    else if (pt->fontMetrics().descent() == 2)
+        underlineOffset +=  2;
+    
 
     if(deco & UNDERLINE){
         //fprintf (stderr, "UNDERLINE (%d, %d) to (%d, %d)\n", _tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
diff --git a/WebCore/src/kwq/KWQButton.mm b/WebCore/src/kwq/KWQButton.mm
index 5e4241f..81bee25 100644
--- a/WebCore/src/kwq/KWQButton.mm
+++ b/WebCore/src/kwq/KWQButton.mm
@@ -50,4 +50,3 @@ QString QButton::text() const
     KWQNSButton *button = (KWQNSButton *)getView();
     return NSSTRING_TO_QSTRING([button title]);
 }
-
diff --git a/WebCore/src/kwq/KWQComboBox.mm b/WebCore/src/kwq/KWQComboBox.mm
index 9c624b0..975a0a8 100644
--- a/WebCore/src/kwq/KWQComboBox.mm
+++ b/WebCore/src/kwq/KWQComboBox.mm
@@ -46,8 +46,8 @@ void QComboBox::init(bool isEditable)
     KWQNSComboBox *comboBox;
     
     comboBox = [[[KWQNSComboBox alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this] autorelease];
-    if (isEditable == FALSE)
-        [comboBox setEditable: NO];
+    //if (isEditable == FALSE)
+    //    [comboBox setEditable: NO];
     setView (comboBox);
 }
 
@@ -91,7 +91,9 @@ void QComboBox::insertItem(const QString &text, int index)
     
     if (index < 0)
         index = count();
-    [comboBox insertItemWithObjectValue: QSTRING_TO_NSSTRING (text) atIndex: index]; 
+    // Hack to allow multiple items with same name.   Ugh.
+    [comboBox insertItemWithTitle: [NSString stringWithFormat: @"%d", index, nil] atIndex: index]; 
+    [[comboBox itemAtIndex: index] setTitle: QSTRING_TO_NSSTRING (text)];
 }
 
 
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index 1c25e81..958eb00 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -1051,7 +1051,11 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
   // the mouse is pressed again.
   d->m_bMousePressed = false;
 
-    openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+    // HACK!  FIXME!
+    if (d->m_strSelectedURL != QString::null) {
+        [((QWidget *)view())->getView() resetView];
+        openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+    }
     
 #define QT_NO_CLIPBOARD 1
 #ifndef QT_NO_CLIPBOARD
@@ -1141,7 +1145,7 @@ KJSProxy *KHTMLPart::jScript()
 }
 
 
-KURL KHTMLPart::completeURL(const QString &url, const QString &target = QString::null)
+KURL KHTMLPart::completeURL(const QString &url, const QString &target)
 {
     if (d->m_baseURL.isEmpty()) {
         return KURL(d->m_workingURL);
diff --git a/WebCore/src/kwq/KWQObject.mm b/WebCore/src/kwq/KWQObject.mm
index e7b75d4..d056381 100644
--- a/WebCore/src/kwq/KWQObject.mm
+++ b/WebCore/src/kwq/KWQObject.mm
@@ -28,19 +28,49 @@
 
 #include <kwqdebug.h>
 
-bool QObject::connect(const QObject *src, const char *signal, const QObject *dest, 
+bool QObject::connect(const QObject *sender, const char *signal, const QObject *dest, 
     const char *slot)
 {
+    if (sender)
+        ((QObject *)sender)->setTarget ((QObject *)dest);
+    KWQDEBUG4 ("src = 0x%08x, signal = %s, dest = 0x%08x, slot = %s\n", sender, signal, dest, slot);
     return FALSE;
 }
 
 
+
+bool QObject::connect(const QObject *sender, const char *signal, const char *slot) const
+{
+    if (sender)
+        ((QObject *)sender)->setTarget ((QObject *)sender);
+    KWQDEBUG3 ("src = 0x%08x, signal = %s, slot = %s\n", sender, signal, slot);
+    return FALSE;    
+}
+
+
+void QObject::emitAction(QObject::Actions action)
+{
+    target->performAction (action);
+}
+
+
+void QObject::performAction(QObject::Actions action)
+{
+}
+
+
 bool QObject::disconnect( const QObject *, const char *, const QObject *, 
     const char *)
 {
     return FALSE;
 }
 
+void QObject::setTarget (QObject *t)
+{
+    target = t;
+}
+
+
 
 QObject::QObject(QObject *parent=0, const char *name=0)
 {
@@ -79,13 +109,6 @@ bool QObject::inherits(const char *) const
 }
 
 
-bool QObject::connect(const QObject *, const char *, const char *) const
-{
-    _logNeverImplemented();
-    return FALSE;    
-}
-
-
 int QObject:: startTimer(int)
 {
     _logNeverImplemented();
diff --git a/WebCore/src/kwq/KWQPainter.mm b/WebCore/src/kwq/KWQPainter.mm
index 9274f51..5fa6b11 100644
--- a/WebCore/src/kwq/KWQPainter.mm
+++ b/WebCore/src/kwq/KWQPainter.mm
@@ -485,6 +485,7 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
     // This will draw the text from the top of the bounding box down.
     // Qt expects to draw from the baseline.
     y = y - (int)([font defaultLineHeightForFont] + [font descender]);
+    //y = y - (int)([font defaultLineHeightForFont]);
 
 #ifdef SLOW_SAFE_DRAWING
 
diff --git a/WebCore/src/kwq/KWQRadioButton.mm b/WebCore/src/kwq/KWQRadioButton.mm
index 09056eb..6e31ffd 100644
--- a/WebCore/src/kwq/KWQRadioButton.mm
+++ b/WebCore/src/kwq/KWQRadioButton.mm
@@ -33,8 +33,9 @@ QRadioButton::QRadioButton(QWidget *w) : QButton (w)
     KWQNSButton *button;
     
     button = (KWQNSButton *)getView();
-    [button setButtonType: NSSwitchButton];
-    setView (button);
+    [button setButtonType: NSRadioButton];
+    [button sizeToFit];
+    //setView (button);
 }
 
 
diff --git a/WebCore/src/kwq/KWQStyle.h b/WebCore/src/kwq/KWQStyle.h
index ada01c5..5bc7df2 100644
--- a/WebCore/src/kwq/KWQStyle.h
+++ b/WebCore/src/kwq/KWQStyle.h
@@ -51,8 +51,8 @@ public:
     // member functions --------------------------------------------------------
 
     GUIStyle guiStyle() const;
-    virtual QSize indicatorSize() { return QSize(0,0); };
-    virtual QSize exclusiveIndicatorSize() { return QSize(0,0); };
+    virtual QSize indicatorSize() { return QSize(22,22); };	// FIXME!  Shouldn't be hardcoded.
+    virtual QSize exclusiveIndicatorSize() { return QSize(22,22); };// FIXME!  Shouldn't be hardcoded.
 
     // operators ---------------------------------------------------------------
 
diff --git a/WebCore/src/kwq/KWQView.h b/WebCore/src/kwq/KWQView.h
index 7283c13..4ed3055 100644
--- a/WebCore/src/kwq/KWQView.h
+++ b/WebCore/src/kwq/KWQView.h
@@ -45,7 +45,7 @@ class KHTMLPart;
 - initWithFrame: (NSRect)r widget: (QWidget *)w; 
 @end
 
- at interface KWQNSComboBox : NSComboBox
+ at interface KWQNSComboBox : NSPopUpButton
 {
     QWidget *widget;
 }
diff --git a/WebCore/src/kwq/KWQView.mm b/WebCore/src/kwq/KWQView.mm
index 7c266c1..0311903 100644
--- a/WebCore/src/kwq/KWQView.mm
+++ b/WebCore/src/kwq/KWQView.mm
@@ -69,10 +69,20 @@
 - initWithFrame: (NSRect) r widget: (QWidget *)w 
 {
     [super initWithFrame: r];
+    [self setBordered:YES];
+    [self setBezelStyle:NSRoundedBezelStyle];
     widget = w;
+    
+    [self setTarget: self];
+    [self setAction: @selector(action:)];
     return self;
 }
 
+- action: sender
+{
+    widget->emitAction(QObject::ACTION_BUTTON_CLICKED);
+}
+
 @end
 
 
diff --git a/WebCore/src/kwq/KWQWidget.mm b/WebCore/src/kwq/KWQWidget.mm
index 260cf71..61da965 100644
--- a/WebCore/src/kwq/KWQWidget.mm
+++ b/WebCore/src/kwq/KWQWidget.mm
@@ -79,6 +79,7 @@ private:
 #else
     void 	*view;
 #endif
+    void	*action();
 };
 
 QWidget::QWidget(QWidget *parent=0, const char *name=0, WFlags f=0) 
@@ -328,10 +329,14 @@ void QWidget::constPolish() const
 
 QSize QWidget::minimumSizeHint() const
 {
-    // Used by embedded java (KJavaEmbed::sizeHint().  Will be replaced.
-    // Used by RenderSubmitButton::calcMinMaxWidth(), where it is called
-    // on a button widget.  Will be replaced.
-    _logNeverImplemented();
+    NSView *view = getView();
+    
+    if ([view isKindOfClass: [NSControl class]]){
+        [(NSControl *)getView() sizeToFit];
+        NSRect frame = [getView() frame];
+        return QSize ((int)frame.size.width, (int)frame.size.height);
+    }
+
     return QSize (0,0);
 }
 
diff --git a/WebCore/src/kwq/qt/qbutton.h b/WebCore/src/kwq/qt/qbutton.h
index 8ee3254..3b4f19f 100644
--- a/WebCore/src/kwq/qt/qbutton.h
+++ b/WebCore/src/kwq/qt/qbutton.h
@@ -52,7 +52,7 @@ public:
 
     virtual void setText(const QString &);
     QString text() const;
-
+    
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
diff --git a/WebCore/src/kwq/qt/qobject.h b/WebCore/src/kwq/qt/qobject.h
index a791d2e..4d4c1d6 100644
--- a/WebCore/src/kwq/qt/qobject.h
+++ b/WebCore/src/kwq/qt/qobject.h
@@ -39,9 +39,9 @@
 
 // FIXME: should these macros be in "kwq.h" or other header file?
 #define slots
-#define SLOT(x) "x"
+#define SLOT(x) """## x ##"""
 #define signals protected
-#define SIGNAL(x) "x"
+#define SIGNAL(x) """## x ##"""
 #define emit
 #define Q_OBJECT
 #define Q_PROPERTY(text)
@@ -71,6 +71,9 @@ class QVariant;
 
 class QObject : public Qt {
 public:
+    enum Actions {
+        ACTION_BUTTON_CLICKED = 1
+    };
 
     // typedefs ----------------------------------------------------------------
     // enums -------------------------------------------------------------------
@@ -96,7 +99,7 @@ public:
 
     QVariant property(const char *name) const;
     bool inherits(const char *) const;
-    bool connect(const QObject *, const char *, const char *) const;
+    bool connect(const QObject *src, const char *signal, const char *slot) const;
 
     int startTimer(int);
     void killTimer(int);
@@ -107,6 +110,12 @@ public:
 
     void blockSignals(bool);
 
+#ifdef _KWQ_
+    virtual void performAction(QObject::Actions action);
+    void emitAction(QObject::Actions action);
+    void setTarget (QObject *obj);
+#endif    
+    
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -118,6 +127,7 @@ private:
     QObject(const QObject &);
     QObject &operator=(const QObject &);
 
+    QObject *target;
 }; // class QObject ============================================================
 
 #endif
diff --git a/WebCore/src/kwq/qt/qwidget.h b/WebCore/src/kwq/qt/qwidget.h
index 3d9ba4a..0b883fe 100644
--- a/WebCore/src/kwq/qt/qwidget.h
+++ b/WebCore/src/kwq/qt/qwidget.h
@@ -154,7 +154,7 @@ public:
 #ifdef _KWQ_
 
     virtual void paint (void *);
-    
+            
 #if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
     NSView 	*getView() const;
     void 	setView(NSView *aView);
diff --git a/WebKit/WebView.subproj/NSWebPageDataSource.mm b/WebKit/WebView.subproj/NSWebPageDataSource.mm
index 18fcc06..5577a48 100644
--- a/WebKit/WebView.subproj/NSWebPageDataSource.mm
+++ b/WebKit/WebView.subproj/NSWebPageDataSource.mm
@@ -9,10 +9,11 @@
 
     NSAutoreleasePool *localPool;
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    NSArray *fontSizeArray = [NSArray arrayWithObjects:@"6", @"7", @"8", @"9", @"10", @"12", @"14", @"16", nil];
+    NSArray *fontSizeArray = [NSArray arrayWithObjects:@"7", @"8", @"9", @"10", @"12", @"13", @"14", @"16", nil];
     
     NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
-        @"0xffffffff", 		@"WebKitLogLevel",
+//        @"0xffffffff", 		@"WebKitLogLevel",
+        @"0x0", 		@"WebKitLogLevel",
         @"Arial", 		@"WebKitStandardFont",
         @"Courier",  		@"WebKitFixedFont",
         @"Times-Roman", 	@"WebKitSerifFont",

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list