What's left of my trashed work to add more Qt functionality
authorstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jan 2007 22:19:16 +0000 (22:19 +0000)
committerstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jan 2007 22:19:16 +0000 (22:19 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19163 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
ChangeLog
WebCore/ChangeLog
WebCore/WebCore.pro
WebCore/platform/qt/FontPlatformDataQt.cpp
WebCore/platform/qt/ScrollViewQt.cpp
WebKit.pri
WebKitQt/Api/qwebframe.cpp
WebKitQt/Api/qwebframe.h
WebKitQt/Api/qwebframe_p.h
WebKitQt/Api/qwebpage.cpp
WebKitQt/Api/qwebpage.h
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKitQt/WebCoreSupport/FrameLoaderClientQt.h

index 44f5c9f..50bf410 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-26  George Staikos  <staikos@kde.org>
+
+        Remove headers - not needed now.
+
+        * WebKit.pri:
+
 2007-01-23  George Staikos <staikos@kde.org>
 
         Put everything back since we can't build everything without it yet.
index c7232de..b33900b 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-26  George Staikos  <staikos@kde.org>
+
+        Reviewed by Zack.
+
+        Qt implementation.
+
+        * WebCore.pro:
+        * platform/qt/FontPlatformDataQt.cpp:
+        (WebCore::FontPlatformData::FontPlatformData):
+        * platform/qt/ScrollViewQt.cpp:
+        (WebCore::ScrollView::scrollbarUnderMouse):
+
 2007-01-26  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Anders' rubberstamp
index aeee74c..f0521bb 100644 (file)
@@ -570,8 +570,8 @@ SOURCES += \
     platform/qt/GlyphPageTreeNodeQt.cpp \
     platform/qt/CookieJarQt.cpp \
     platform/qt/FontPlatformDataQt.cpp \
-    platform/qt/PlatformScrollBarQt.cpp \
     platform/qt/ScrollViewQt.cpp \
+    platform/qt/PlatformScrollBarQt.cpp \
     platform/qt/TemporaryLinkStubs.cpp \
     platform/qt/CursorQt.cpp \
     platform/qt/WidgetQt.cpp \
index eccedfe..cae3cee 100644 (file)
@@ -56,7 +56,12 @@ FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const
     m_font->setFamily(familyName.domString());
     m_font->setPixelSize(qRound(fontDescription.computedSize()));
     m_font->setItalic(fontDescription.italic());
-    m_font->setWeight(fontDescription.weight());
+    if (fontDescription.bold()) {
+        // Qt's Bold is 75, Webkit is 63.
+        m_font->setWeight(QFont::Bold);
+    } else {
+        m_font->setWeight(fontDescription.weight());
+    }
 }
 
 FontPlatformData::~FontPlatformData()
index 683e4b3..8f6658a 100644 (file)
 #include "FrameView.h"
 #include "FloatRect.h"
 #include "IntPoint.h"
+#include "PlatformMouseEvent.h"
 
 #include "FrameQt.h"
 #include "ScrollViewCanvasQt.h"
 
+#include <QDebug>
 #include <QScrollBar>
 #include <QScrollArea>
 
@@ -302,6 +304,16 @@ void ScrollView::wheelEvent(PlatformWheelEvent&)
 PlatformScrollbar* ScrollView::scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent)
 {
     // Probably don't care about this.
+#if 0
+    // Not so sure: frames with scrollbars have the wrong mouse cursor over
+    // the scrollbar.  Is this why?  FIXME
+    if (m_area->horizontalScrollBar()->geometry().contains(mouseEvent.pos())) {
+        return m_area->horizontalScrollBar();
+    }
+    if (m_area->verticalScrollBar()->geometry().contains(mouseEvent.pos())) {
+        return m_area->verticalScrollBar();
+    }
+#endif
     return 0;
 }
 
index 60fec92..3360306 100644 (file)
@@ -2,26 +2,6 @@
 
 INCLUDEPATH += $$PWD/WebKitQt/Api 
 
-# Remove this once we can actually use the API
-INCLUDEPATH += $$PWD/JavaScriptCore \
-               $$PWD/WebCore \
-               $$PWD/WebCore/platform \
-               $$PWD/WebCore/platform/qt \
-               $$PWD/WebCore/platform/network \
-               $$PWD/WebCore/platform/graphics \
-               $$PWD/WebCore/editing \
-               $$PWD/WebCore/page \
-               $$PWD/WebCore/page/qt \
-               $$PWD/WebCore/dom \
-               $$PWD/WebCore/html \
-               $$PWD/WebCore/history \
-               $$PWD/WebCore/rendering \
-               $$PWD/WebCore/loader \
-               $$PWD/WebCore/loader/qt \
-               $$PWD/WebCore/css \
-               $$PWD/WebCore/bridge \
-               $$PWD/WebKitQt/WebCoreSupport
-
 DEFINES += BUILDING_QT__=1
 
 isEmpty(OUTPUT_DIR):OUTPUT_DIR=$$PWD/WebKitBuild/Release
index 8e8a5a2..541caa7 100644 (file)
@@ -1,5 +1,6 @@
 /*
     Copyright (C) 2007 Trolltech ASA
+    Copyright (C) 2007 Staikos Computing Services Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -71,6 +72,9 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
     : QScrollArea(parent->widget())
     , d(new QWebFramePrivate)
 {
+    setLineWidth(0);
+    setMidLineWidth(0);
+    setFrameShape(QFrame::NoFrame);
     d->page = parent->d->page;
 
     d->frameLoaderClient = new FrameLoaderClientQt();
@@ -131,12 +135,23 @@ QString QWebFrame::renderTreeDump() const
     return externalRepresentation(d->frame->renderer());
 }
 
+QString QWebFrame::title() const
+{
+    if (d->frame->document())
+        return d->frame->document()->title();
+    else return QString();
+}
 
 QWebPage * QWebFrame::page() const
 {
     return d->page;
 }
 
+QString QWebFrame::selectedText() const
+{
+    return d->frame->selectedText();
+}
+
 void QWebFrame::resizeEvent(QResizeEvent *e)
 {
     QScrollArea::resizeEvent(e);
index 47671d2..07ac0d2 100644 (file)
@@ -1,5 +1,6 @@
 /*
     Copyright (C) 2007 Trolltech ASA
+    Copyright (C) 2007 Staikos Computing Services Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -49,10 +50,13 @@ public:
     QString markup() const;
     QString innerText() const;
     QString renderTreeDump() const;
+    QString selectedText() const;
+    QString title() const;
 
 signals:
     void cleared();
     void loadDone(bool ok);
+    void titleChanged(const QString& title);
 
 protected:
     void resizeEvent(QResizeEvent *);
index 4a50387..d9d130c 100644 (file)
@@ -1,5 +1,6 @@
 /*
     Copyright (C) 2007 Trolltech ASA
+    Copyright (C) 2007 Staikos Computing Services Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
index 6acc72c..115a2df 100644 (file)
@@ -1,5 +1,6 @@
 /*
     Copyright (C) 2007 Trolltech ASA
+    Copyright (C) 2007 Staikos Computing Services Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -40,6 +41,8 @@
 #include "KURL.h"
 #include "qboxlayout.h"
 
+#include <QDebug>
+
 using namespace WebCore;
 
 QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
@@ -105,14 +108,24 @@ QWebFrame *QWebPage::createFrame(QWebFrame *parentFrame, QWebFrameData *frameDat
 {
     if (parentFrame)
         return new QWebFrame(parentFrame, frameData);
-    return new QWebFrame(this, frameData);
+    QWebFrame *f = new QWebFrame(this, frameData);
+    connect(f, SIGNAL(titleChanged(const QString&)), this, SIGNAL(titleChanged(const QString&)));
+    return f;
 }
 
 void QWebPage::open(const QUrl &url)
 {
-    d->createMainFrame();
+    mainFrame()->d->frame->loader()->load(KURL(url.toString()));
+}
+
+QUrl QWebPage::url() const
+{
+    return QUrl((QString)mainFrame()->d->frame->loader()->url().url());
+}
 
-    d->mainFrame->d->frame->loader()->load(KURL(url.toString()));
+QString QWebPage::title() const
+{
+    return mainFrame()->title();
 }
 
 QWebFrame *QWebPage::mainFrame() const
@@ -121,12 +134,24 @@ QWebFrame *QWebPage::mainFrame() const
     return d->mainFrame;
 }
 
+QWebFrame *QWebPage::focusFrame() const
+{
+    Q_ASSERT(false);
+    return mainFrame(); // FIXME: this is not correct
+}
 
 QSize QWebPage::sizeHint() const
 {
     return QSize(800, 600);
 }
 
+void QWebPage::stop()
+{
+    FrameLoader *f = mainFrame()->d->frame->loader();
+    f->cancelMainResourceLoad();
+    f->stopAllLoaders();
+}
+
 QWebPageHistory QWebPage::history() const
 {
     WebCore::BackForwardList *lst = d->page->backForwardList();
index 5330313..d02d685 100644 (file)
@@ -1,5 +1,6 @@
 /*
     Copyright (C) 2007 Trolltech ASA
+    Copyright (C) 2007 Staikos Computing Services Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -46,17 +47,28 @@ public:
 
     void open(const QUrl &url);
 
-
     QWebFrame *mainFrame() const;
 
+    QWebFrame *focusFrame() const;
+
     QWebPageHistory history() const;
 
     QSize sizeHint() const;
 
+    QString title() const;
+
+    QUrl url() const;
+
 public slots:
+    /**
+     * Stops loading of the page, if loading.
+     */
+    void stop();
+
     void goBack();
     void goForward();
     void goToHistoryItem(const QWebHistoryItem &item);
+
 signals:
     /**
      * Signal is emitted when load is started on one of the child
@@ -75,6 +87,11 @@ signals:
      * load finished is passed as an argument.
      */
     void loadFinished(QWebFrame *frame);
+    /**
+     * Signal is emitted when the title of this page has changed.
+     * Applies only to the main frame.  Sub-frame titles do not trigger this.
+     */
+    void titleChanged(const QString& title);
 
 protected:
     virtual QWebFrame *createFrame(QWebFrame *parentFrame, QWebFrameData *frameData);
index 1f9ca42..af4f092 100644 (file)
@@ -1,3 +1,31 @@
+2007-01-26  George Staikos  <staikos@kde.org>
+
+        Reviewed by Zack.
+
+        Qt implementation.
+
+        * Api/qwebframe.cpp:
+        (QWebFrame::QWebFrame):
+        (QWebFrame::title):
+        (QWebFrame::selectedText):
+        * Api/qwebframe.h:
+        * Api/qwebframe_p.h:
+        * Api/qwebpage.cpp:
+        (QWebPage::createFrame):
+        (QWebPage::open):
+        (QWebPage::url):
+        (QWebPage::title):
+        (QWebPage::focusFrame):
+        (QWebPage::stop):
+        * Api/qwebpage.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::setFrame):
+        (WebCore::FrameLoaderClientQt::detachFrameLoader):
+        (WebCore::FrameLoaderClientQt::dispatchDidReceiveTitle):
+        (WebCore::FrameLoaderClientQt::didChangeTitle):
+        (WebCore::FrameLoaderClientQt::setTitle):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2007-01-26  Lars Knoll <lars@trolltech.com>
 
         Make it compile again with Qt 4.2 and add the copyright
index 9b93dfb..bf72ae7 100644 (file)
@@ -78,6 +78,8 @@ void FrameLoaderClientQt::setFrame(QWebFrame *webFrame, FrameQt *frame)
             m_webFrame->page(), SIGNAL(loadProgressChanged(double)));
     connect(this, SIGNAL(loadFinished(QWebFrame*)),
             m_webFrame->page(), SIGNAL(loadFinished(QWebFrame *)));
+    connect(this, SIGNAL(titleChanged(const QString&)),
+            m_webFrame, SIGNAL(titleChanged(const QString&)));
 }
 
 void FrameLoaderClientQt::detachFrameLoader()
@@ -85,6 +87,7 @@ void FrameLoaderClientQt::detachFrameLoader()
     disconnect(this, SIGNAL(loadStarted(QWebFrame*)));
     disconnect(this, SIGNAL(loadProgressChanged(double)));
     disconnect(this, SIGNAL(loadFinished(QWebFrame*)));
+    disconnect(this, SIGNAL(titleChanged(const QString&)));
     m_webFrame = 0;
     m_frame = 0;
 }
@@ -331,7 +334,7 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad()
 
 void FrameLoaderClientQt::dispatchDidReceiveTitle(const String& title)
 {
-    notImplemented();
+    setTitle(title);
 }
 
 
@@ -443,7 +446,7 @@ void FrameLoaderClientQt::willChangeTitle(DocumentLoader*)
 
 void FrameLoaderClientQt::didChangeTitle(DocumentLoader *l)
 {
-    setTitle(l->title(), l->URL());
+    setTitle(l->title());
 }
 
 
@@ -554,9 +557,17 @@ void FrameLoaderClientQt::prepareForDataSourceReplacement()
 }
 
 
-void FrameLoaderClientQt::setTitle(const String& title, const KURL&)
+void FrameLoaderClientQt::setTitle(const String& title)
 {
-    //notImplemented();
+    QString t = title;
+    emit titleChanged(t);
+}
+
+
+void FrameLoaderClientQt::setTitle(const String& title, const KURL& url)
+{
+    Q_UNUSED(url)
+    setTitle(title);
 }
 
 
index 626375b..f666467 100644 (file)
@@ -29,6 +29,7 @@
 #define FrameLoaderClientQt_H
 
 #include <qobject.h>
+#include <QUrl>
 
 #include "FrameLoaderClient.h"
 #include "KURL.h"
@@ -61,6 +62,8 @@ namespace WebCore {
         void loadStarted(QWebFrame *frame);
         void loadProgressChanged(double d);
         void loadFinished(QWebFrame *frame);
+        void titleChanged(const QString& title);
+
     public:
         FrameLoaderClientQt();
         ~FrameLoaderClientQt();
@@ -157,6 +160,7 @@ namespace WebCore {
         virtual void addHistoryItemForFragmentScroll();
         virtual void didFinishLoad();
         virtual void prepareForDataSourceReplacement();
+        virtual void setTitle(const String& title);
         virtual void setTitle(const String& title, const KURL&);
 
         virtual String userAgent();