summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/qt/Api
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/qt/Api')
-rw-r--r--Source/WebKit/qt/Api/DerivedSources.pro1
-rw-r--r--Source/WebKit/qt/Api/qgraphicswebview.cpp67
-rw-r--r--Source/WebKit/qt/Api/qgraphicswebview.h7
-rw-r--r--Source/WebKit/qt/Api/qwebframe.cpp25
-rw-r--r--Source/WebKit/qt/Api/qwebhistory.cpp7
-rw-r--r--Source/WebKit/qt/Api/qwebhistoryinterface.cpp4
-rw-r--r--Source/WebKit/qt/Api/qwebkitplatformplugin.h5
-rw-r--r--Source/WebKit/qt/Api/qwebkitversion.cpp2
-rw-r--r--Source/WebKit/qt/Api/qwebpage.cpp71
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.cpp23
10 files changed, 115 insertions, 97 deletions
diff --git a/Source/WebKit/qt/Api/DerivedSources.pro b/Source/WebKit/qt/Api/DerivedSources.pro
index 8084242..8be6748 100644
--- a/Source/WebKit/qt/Api/DerivedSources.pro
+++ b/Source/WebKit/qt/Api/DerivedSources.pro
@@ -19,7 +19,6 @@ win32-msvc* | wince* {
} else {
QUOTE = "\'"
DOUBLE_ESCAPED_QUOTE = "\\\'"
- ESCAPE = "\\"
}
qtheader_module.target = $${DESTDIR}/QtWebKit
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp
index b1c9586..b7b28bc 100644
--- a/Source/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp
@@ -55,7 +55,8 @@ public:
QGraphicsWebViewPrivate(QGraphicsWebView* parent)
: q(parent)
, page(0)
- , resizesToContents(false) {}
+ , resizesToContents(false)
+ , renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform) {}
virtual ~QGraphicsWebViewPrivate();
@@ -74,6 +75,7 @@ public:
QGraphicsWebView* q;
QWebPage* page;
bool resizesToContents;
+ QPainter::RenderHints renderHints;
QGraphicsItemOverlay* overlay() const
{
@@ -279,6 +281,8 @@ QWebPage* QGraphicsWebView::page() const
*/
void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*)
{
+ QPainter::RenderHints oldHints = painter->renderHints();
+ painter->setRenderHints(oldHints | d->renderHints);
#if ENABLE(TILED_BACKING_STORE)
if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) {
// FIXME: We should set the backing store viewport earlier than in paint
@@ -286,6 +290,7 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem*
// QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change.
WebCore::GraphicsContext context(painter);
page()->mainFrame()->d->renderFromTiledBackingStore(&context, option->exposedRect.toAlignedRect());
+ painter->setRenderHints(oldHints);
return;
}
#endif
@@ -294,6 +299,7 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem*
#else
page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect());
#endif
+ painter->setRenderHints(oldHints);
}
/*! \reimp
@@ -357,6 +363,65 @@ QVariant QGraphicsWebView::inputMethodQuery(Qt::InputMethodQuery query) const
return QVariant();
}
+/*!
+ \property QGraphicsWebView::renderHints
+ \since 4.8
+ \brief the default render hints for the view
+
+ These hints are used to initialize QPainter before painting the Web page.
+
+ QPainter::TextAntialiasing and QPainter::SmoothPixmapTransform are enabled by default and will be
+ used to render the item in addition of what has been set on the painter given by QGraphicsScene.
+
+ \note This property is not available on Symbian. However, the getter and
+ setter functions can still be used directly.
+
+ \sa QPainter::renderHints()
+*/
+
+/*!
+ \since 4.8
+ Returns the render hints used by the view to render content.
+
+ \sa QPainter::renderHints()
+*/
+QPainter::RenderHints QGraphicsWebView::renderHints() const
+{
+ return d->renderHints;
+}
+
+/*!
+ \since 4.8
+ Sets the render hints used by the view to the specified \a hints.
+
+ \sa QPainter::setRenderHints()
+*/
+void QGraphicsWebView::setRenderHints(QPainter::RenderHints hints)
+{
+ if (hints == d->renderHints)
+ return;
+ d->renderHints = hints;
+ update();
+}
+
+/*!
+ \since 4.8
+ If \a enabled is true, enables the specified render \a hint; otherwise
+ disables it.
+
+ \sa renderHints, QPainter::renderHints()
+*/
+void QGraphicsWebView::setRenderHint(QPainter::RenderHint hint, bool enabled)
+{
+ QPainter::RenderHints oldHints = d->renderHints;
+ if (enabled)
+ d->renderHints |= hint;
+ else
+ d->renderHints &= ~hint;
+ if (oldHints != d->renderHints)
+ update();
+}
+
/*! \reimp
*/
bool QGraphicsWebView::event(QEvent* event)
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h
index 733c224..ceb0ad8 100644
--- a/Source/WebKit/qt/Api/qgraphicswebview.h
+++ b/Source/WebKit/qt/Api/qgraphicswebview.h
@@ -50,6 +50,9 @@ class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
Q_PROPERTY(bool resizesToContents READ resizesToContents WRITE setResizesToContents)
Q_PROPERTY(bool tiledBackingStoreFrozen READ isTiledBackingStoreFrozen WRITE setTiledBackingStoreFrozen)
+ Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints)
+ Q_FLAGS(QPainter::RenderHints)
+
public:
explicit QGraphicsWebView(QGraphicsItem* parent = 0);
~QGraphicsWebView();
@@ -99,6 +102,10 @@ public:
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ QPainter::RenderHints renderHints() const;
+ void setRenderHints(QPainter::RenderHints);
+ void setRenderHint(QPainter::RenderHint, bool enabled = true);
+
public Q_SLOTS:
void stop();
void back();
diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp
index 6f98bca..e5124bd 100644
--- a/Source/WebKit/qt/Api/qwebframe.cpp
+++ b/Source/WebKit/qt/Api/qwebframe.cpp
@@ -731,7 +731,7 @@ QMultiMap<QString, QString> QWebFrame::metaData() const
static inline QUrl ensureAbsoluteUrl(const QUrl &url)
{
- if (!url.isRelative())
+ if (!url.isValid() || !url.isRelative())
return url;
// This contains the URL with absolute path but without
@@ -780,26 +780,7 @@ QUrl QWebFrame::url() const
*/
QUrl QWebFrame::requestedUrl() const
{
- // There are some possible edge cases to be handled here,
- // apart from checking if activeDocumentLoader is valid:
- //
- // * Method can be called while processing an unsucessful load.
- // In this case, frameLoaderClient will hold the current error
- // (m_loadError), and we will make use of it to recover the 'failingURL'.
- // * If the 'failingURL' holds a null'ed string though, we fallback
- // to 'outgoingReferrer' (it yet is safer than originalRequest).
- FrameLoader* loader = d->frame->loader();
- FrameLoaderClientQt* loaderClient = d->frameLoaderClient;
-
- if (!loader->activeDocumentLoader()
- || !loaderClient->m_loadError.isNull()) {
- if (!loaderClient->m_loadError.failingURL().isNull())
- return QUrl(loaderClient->m_loadError.failingURL());
- else if (!loader->outgoingReferrer().isEmpty())
- return QUrl(loader->outgoingReferrer());
- }
-
- return loader->originalRequest().url();
+ return d->frameLoaderClient->lastRequestedUrl();
}
/*!
\since 4.6
@@ -893,11 +874,9 @@ void QWebFrame::load(const QNetworkRequest &req,
case QNetworkAccessManager::DeleteOperation:
request.setHTTPMethod("DELETE");
break;
-#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
case QNetworkAccessManager::CustomOperation:
request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData());
break;
-#endif
case QNetworkAccessManager::UnknownOperation:
// eh?
break;
diff --git a/Source/WebKit/qt/Api/qwebhistory.cpp b/Source/WebKit/qt/Api/qwebhistory.cpp
index a9761de..33bad41 100644
--- a/Source/WebKit/qt/Api/qwebhistory.cpp
+++ b/Source/WebKit/qt/Api/qwebhistory.cpp
@@ -23,11 +23,13 @@
#include "qwebframe_p.h"
#include "BackForwardListImpl.h"
-#include "PlatformString.h"
+#include "IconDatabaseBase.h"
#include "Image.h"
+#include "IntSize.h"
#include "KURL.h"
#include "Page.h"
#include "PageGroup.h"
+#include "PlatformString.h"
#include <QSharedData>
#include <QDebug>
@@ -156,7 +158,8 @@ QDateTime QWebHistoryItem::lastVisited() const
QIcon QWebHistoryItem::icon() const
{
if (d->item)
- return *d->item->icon()->nativeImageForCurrentFrame();
+ return *WebCore::iconDatabase().synchronousIconForPageURL(d->item->url(), WebCore::IntSize(16, 16))->nativeImageForCurrentFrame();
+
return QIcon();
}
diff --git a/Source/WebKit/qt/Api/qwebhistoryinterface.cpp b/Source/WebKit/qt/Api/qwebhistoryinterface.cpp
index 61cf5af..40ff5c9 100644
--- a/Source/WebKit/qt/Api/qwebhistoryinterface.cpp
+++ b/Source/WebKit/qt/Api/qwebhistoryinterface.cpp
@@ -69,8 +69,8 @@ void QWebHistoryInterface::setDefaultInterface(QWebHistoryInterface* defaultInte
/*!
Returns the default interface that will be used by WebKit. If no default interface has been set,
- Webkit will not keep track of visited links and a null pointer will be returned.
- \sa setDefaultInterface
+ WebKit will not keep track of visited links and a null pointer will be returned.
+ \sa setDefaultInterface()
*/
QWebHistoryInterface* QWebHistoryInterface::defaultInterface()
{
diff --git a/Source/WebKit/qt/Api/qwebkitplatformplugin.h b/Source/WebKit/qt/Api/qwebkitplatformplugin.h
index 2a94e0c..f274a0b 100644
--- a/Source/WebKit/qt/Api/qwebkitplatformplugin.h
+++ b/Source/WebKit/qt/Api/qwebkitplatformplugin.h
@@ -26,6 +26,7 @@
* and may be changed from version to version or even be completely removed.
*/
+#include <QColor>
#include <QObject>
#include <QUrl>
#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA
@@ -46,6 +47,10 @@ public:
virtual bool itemIsSelected(int index) const = 0;
virtual int itemCount() const = 0;
virtual bool multiple() const = 0;
+ virtual QColor backgroundColor() const = 0;
+ virtual QColor foregroundColor() const = 0;
+ virtual QColor itemBackgroundColor(int index) const = 0;
+ virtual QColor itemForegroundColor(int index) const = 0;
};
class QWebSelectMethod : public QObject
diff --git a/Source/WebKit/qt/Api/qwebkitversion.cpp b/Source/WebKit/qt/Api/qwebkitversion.cpp
index 181913b..1143f99 100644
--- a/Source/WebKit/qt/Api/qwebkitversion.cpp
+++ b/Source/WebKit/qt/Api/qwebkitversion.cpp
@@ -40,7 +40,7 @@
*/
QString qWebKitVersion()
{
- return QString("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION);
+ return QString::fromLatin1("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION);
}
/*!
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp
index 5dd57f5..ac1d562 100644
--- a/Source/WebKit/qt/Api/qwebpage.cpp
+++ b/Source/WebKit/qt/Api/qwebpage.cpp
@@ -104,6 +104,9 @@
#include "Scrollbar.h"
#include "SecurityOrigin.h"
#include "Settings.h"
+#if defined Q_OS_WIN32
+#include "SystemInfo.h"
+#endif // Q_OS_WIN32
#include "TextIterator.h"
#include "WebPlatformStrategies.h"
#include "WindowFeatures.h"
@@ -312,9 +315,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
ScriptController::initializeThreading();
WTF::initializeMainThread();
WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData);
-#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
- WebCore::Font::setCodePath(WebCore::Font::Complex);
-#endif
WebPlatformStrategies::initialize();
@@ -1168,7 +1168,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev
QString p = q->property("_q_RepaintThrottlingPreset").toString();
for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) {
- if(p == presets[i].name) {
+ if (p == QLatin1String(presets[i].name)) {
FrameView::setRepaintThrottlingDeferredRepaintDelay(
presets[i].deferredRepaintDelay);
FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(
@@ -1219,6 +1219,9 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev
else if (event->propertyName() == "_q_webInspectorServerPort") {
InspectorServerQt* inspectorServer = InspectorServerQt::server();
inspectorServer->listen(inspectorServerPort());
+ } else if (event->propertyName() == "_q_deadDecodedDataDeletionInterval") {
+ double interval = q->property("_q_deadDecodedDataDeletionInterval").toDouble();
+ memoryCache()->setDeadDecodedDataDeletionInterval(interval);
}
}
#endif
@@ -2070,7 +2073,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber,
// Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html
// At this point DRT's WebPage has already been destroyed
if (QWebPagePrivate::drtRun) {
- if (message == "PLUGIN: NPP_Destroy")
+ if (message == QLatin1String("PLUGIN: NPP_Destroy"))
fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData());
}
}
@@ -2540,7 +2543,7 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av
result.m_minimumScaleFactor = conf.minimumScale;
result.m_maximumScaleFactor = conf.maximumScale;
result.m_devicePixelRatio = conf.devicePixelRatio;
- result.m_isUserScalable = conf.userScalable;
+ result.m_isUserScalable = static_cast<bool>(conf.userScalable);
d->pixelRatio = conf.devicePixelRatio;
@@ -3169,10 +3172,10 @@ bool QWebPage::focusNextPrevChild(bool next)
void QWebPage::setContentEditable(bool editable)
{
if (isContentEditable() != editable) {
+ d->page->setEditable(editable);
d->page->setTabKeyCyclesThroughElements(!editable);
if (d->mainFrame) {
WebCore::Frame* frame = d->mainFrame->d->frame;
- frame->document()->setDesignMode(editable ? WebCore::Document::on : WebCore::Document::off);
if (editable) {
frame->editor()->applyEditingStyleToBodyElement();
// FIXME: mac port calls this if there is no selectedDOMRange
@@ -3186,7 +3189,7 @@ void QWebPage::setContentEditable(bool editable)
bool QWebPage::isContentEditable() const
{
- return d->mainFrame && d->mainFrame->d->frame->document()->inDesignMode();
+ return d->page->isEditable();
}
/*!
@@ -3772,52 +3775,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
#ifdef Q_OS_AIX
firstPartTemp += QString::fromLatin1("AIX");
#elif defined Q_OS_WIN32
-
- switch (QSysInfo::WindowsVersion) {
- case QSysInfo::WV_32s:
- firstPartTemp += QString::fromLatin1("Windows 3.1");
- break;
- case QSysInfo::WV_95:
- firstPartTemp += QString::fromLatin1("Windows 95");
- break;
- case QSysInfo::WV_98:
- firstPartTemp += QString::fromLatin1("Windows 98");
- break;
- case QSysInfo::WV_Me:
- firstPartTemp += QString::fromLatin1("Windows 98; Win 9x 4.90");
- break;
- case QSysInfo::WV_NT:
- firstPartTemp += QString::fromLatin1("WinNT4.0");
- break;
- case QSysInfo::WV_2000:
- firstPartTemp += QString::fromLatin1("Windows NT 5.0");
- break;
- case QSysInfo::WV_XP:
- firstPartTemp += QString::fromLatin1("Windows NT 5.1");
- break;
- case QSysInfo::WV_2003:
- firstPartTemp += QString::fromLatin1("Windows NT 5.2");
- break;
- case QSysInfo::WV_VISTA:
- firstPartTemp += QString::fromLatin1("Windows NT 6.0");
- break;
- case QSysInfo::WV_WINDOWS7:
- firstPartTemp += QString::fromLatin1("Windows NT 6.1");
- break;
- case QSysInfo::WV_CE:
- firstPartTemp += QString::fromLatin1("Windows CE");
- break;
- case QSysInfo::WV_CENET:
- firstPartTemp += QString::fromLatin1("Windows CE .NET");
- break;
- case QSysInfo::WV_CE_5:
- firstPartTemp += QString::fromLatin1("Windows CE 5.x");
- break;
- case QSysInfo::WV_CE_6:
- firstPartTemp += QString::fromLatin1("Windows CE 6.x");
- break;
- }
-
+ firstPartTemp += windowsVersionForUAString();
#elif defined Q_OS_DARWIN
#ifdef __i386__ || __x86_64__
firstPartTemp += QString::fromLatin1("Intel Mac OS X");
@@ -4086,7 +4044,8 @@ quint64 QWebPage::bytesReceived() const
/*!
\fn void QWebPage::repaintRequested(const QRect& dirtyRect)
- This signal is emitted whenever this QWebPage should be updated and no view was set.
+ This signal is emitted whenever this QWebPage should be updated. It's useful
+ when rendering a QWebPage without a QWebView or QGraphicsWebView.
\a dirtyRect contains the area that needs to be updated. To paint the QWebPage get
the mainFrame() and call the render(QPainter*, const QRegion&) method with the
\a dirtyRect as the second parameter.
@@ -4131,6 +4090,8 @@ quint64 QWebPage::bytesReceived() const
At signal emission time the meta-data of the QNetworkReply \a reply is available.
+ \note The receiving slot is responsible for deleting the QNetworkReply \a reply.
+
\note This signal is only emitted if the forwardUnsupportedContent property is set to true.
\sa downloadRequested()
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp
index 3f0b436..f744e81 100644
--- a/Source/WebKit/qt/Api/qwebsettings.cpp
+++ b/Source/WebKit/qt/Api/qwebsettings.cpp
@@ -28,6 +28,9 @@
#include "MemoryCache.h"
#include "CrossOriginPreflightResultCache.h"
#include "FontCache.h"
+#if ENABLE(ICONDATABASE)
+#include "IconDatabaseClientQt.h"
+#endif
#include "Page.h"
#include "PageCache.h"
#include "Settings.h"
@@ -477,25 +480,16 @@ QWebSettings::QWebSettings()
d->fontFamilies.insert(QWebSettings::StandardFont, defaultFont.defaultFamily());
d->fontFamilies.insert(QWebSettings::SerifFont, defaultFont.defaultFamily());
-#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
defaultFont.setStyleHint(QFont::Fantasy);
d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily());
defaultFont.setStyleHint(QFont::Cursive);
d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily());
-#else
- d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily());
- d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily());
-#endif
defaultFont.setStyleHint(QFont::SansSerif);
d->fontFamilies.insert(QWebSettings::SansSerifFont, defaultFont.defaultFamily());
-#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
defaultFont.setStyleHint(QFont::Monospace);
-#else
- defaultFont.setStyleHint(QFont::TypeWriter);
-#endif
d->fontFamilies.insert(QWebSettings::FixedFont, defaultFont.defaultFamily());
d->attributes.insert(QWebSettings::AutoLoadImages, true);
@@ -645,13 +639,18 @@ QString QWebSettings::defaultTextEncoding() const
*/
void QWebSettings::setIconDatabasePath(const QString& path)
{
- WebCore::iconDatabase().delayDatabaseCleanup();
+#if ENABLE(ICONDATABASE)
+ // Make sure that IconDatabaseClientQt is instantiated.
+ WebCore::IconDatabaseClientQt::instance();
+#endif
+
+ WebCore::IconDatabase::delayDatabaseCleanup();
if (!path.isEmpty()) {
WebCore::iconDatabase().setEnabled(true);
QFileInfo info(path);
if (info.isDir() && info.isWritable())
- WebCore::iconDatabase().open(path);
+ WebCore::iconDatabase().open(path, WebCore::IconDatabase::defaultDatabaseFilename());
} else {
WebCore::iconDatabase().setEnabled(false);
WebCore::iconDatabase().close();
@@ -693,7 +692,7 @@ void QWebSettings::clearIconDatabase()
*/
QIcon QWebSettings::iconForUrl(const QUrl& url)
{
- WebCore::Image* image = WebCore::iconDatabase().iconForPageURL(WebCore::KURL(url).string(),
+ WebCore::Image* image = WebCore::iconDatabase().synchronousIconForPageURL(WebCore::KURL(url).string(),
WebCore::IntSize(16, 16));
if (!image)
return QPixmap();