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 44f5c9fec50a6b8f44aeff0a18337484f5922a5b..50bf4106ab782346a999ff46192b343a142bc062 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 c7232de6ce125e1d41a62ed56476b9d7affa3490..b33900b327ee31675ea38ae72f2c9b67cadfba84 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 aeee74c4b7ef9c91353171fc13c8350788847d80..f0521bb3453b41a0b78dedba7836914ffee380e6 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 eccedfeb5e6b7520236f65d02ae559031f379897..cae3cee2bf82f2bb7a88bd543b2583c1c0cdd293 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 683e4b353427dfacf94f7c95c67ed5f031897630..8f6658aced98b6ff4eb182934c133dfd54299e88 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 60fec923371ea0a9ce76bc2341b131544442bb3f..33603067bc310c24de96a8535a99e008e258d0f8 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 8e8a5a20d19afe9384a0dbf6ebf1e212ab42e16f..541caa744240824749f0ac4ba6a8e00084f9c554 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 47671d2684e50f4dfd6da5968744a7223f0fc6d0..07ac0d2711a05def81861a2954eabc62413d3a16 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 4a50387125d5ae4ecb4e497e125ca441ed1a2785..d9d130c6ca0139d84889272c54fd9655053e97c3 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 6acc72c15fd656e2987e2d15809f5bd198054d0d..115a2df84f06aadf62caddac84d429698ac88fcd 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 53303137cbc1cbbba2560ecce343af44ae2a0c8c..d02d685845a961ebb645dab9521ca105adc1df99 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 1f9ca4254d69c28de3364e9cd29651a898b4501e..af4f092d5cebe7dadaabdaa401c5978f8a51219d 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 9b93dfb3b5b396ff31872462b9bfe77816156d7c..bf72ae758fba9faa6dac93f1e15a05b8a840e734 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 626375b0ea2a43c46ca1fa505874f0415ecf39de..f6664678eebdb71cab10cc324a1c25e748613efd 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();