Commit bf876948 authored by staikos's avatar staikos

What's left of my trashed work to add more Qt functionality



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cf81ddd9
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.
......
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
......
......@@ -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 \
......
......@@ -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()
......
......@@ -34,10 +34,12 @@
#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;
}
......
......@@ -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
......
/*
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);
......
/*
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 *);
......
/*
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
......
/*
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();
......
/*
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);
......
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
......
......@@ -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);
}
......
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment