diff options
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp | 78 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h | 3 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 39 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h | 6 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 42 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 83 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 12 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 70 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 6 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 30 |
10 files changed, 287 insertions, 82 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index b11890d..7e485a0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -1,5 +1,6 @@ /* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -49,11 +50,16 @@ public: virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); #endif +#ifndef QT_NO_CURSOR virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); +#endif + virtual QPalette palette() const; virtual int screenNumber() const; - virtual WId winId() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; void _q_doLoadProgress(int progress); void _q_doLoadFinished(bool success); @@ -83,10 +89,7 @@ void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) if (q->title().isEmpty()) emit q->urlChanged(q->url()); - if (success) - emit q->loadFinished(); - else - emit q->loadFailed(); + emit q->loadFinished(success); } void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) @@ -99,11 +102,11 @@ void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) q->update(QRectF(dirtyRect)); } + void QGraphicsWebViewPrivate::setInputMethodEnabled(bool enable) { q->setAttribute(Qt::WA_InputMethodEnabled, enable); } - #if QT_VERSION >= 0x040600 void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) { @@ -113,7 +116,7 @@ void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool q->setInputMethodHints(q->inputMethodHints() & ~hint); } #endif - +#ifndef QT_NO_CURSOR QCursor QGraphicsWebViewPrivate::cursor() const { return q->cursor(); @@ -123,6 +126,12 @@ void QGraphicsWebViewPrivate::updateCursor(const QCursor& cursor) { q->setCursor(cursor); } +#endif + +QPalette QGraphicsWebViewPrivate::palette() const +{ + return q->palette(); +} int QGraphicsWebViewPrivate::screenNumber() const { @@ -136,14 +145,15 @@ int QGraphicsWebViewPrivate::screenNumber() const return 0; } -WId QGraphicsWebViewPrivate::winId() const +QWidget* QGraphicsWebViewPrivate::ownerWidget() const { const QList<QGraphicsView*> views = q->scene()->views(); + return views.value(0); +} - if (!views.isEmpty()) - return views.at(0)->winId(); - - return 0; +QObject* QGraphicsWebViewPrivate::pluginParent() const +{ + return q; } void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) @@ -185,8 +195,10 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) */ QGraphicsWebView::~QGraphicsWebView() { - if (d->page) + if (d->page) { d->page->d->view = 0; + d->page->d->client = 0; // unset the page client + } if (d->page && d->page->parent() == this) delete d->page; @@ -239,21 +251,38 @@ bool QGraphicsWebView::event(QEvent* event) // Re-implemented in order to allows fixing event-related bugs in patch releases. if (d->page) { +#ifndef QT_NO_CONTEXTMENU + if (event->type() == QEvent::GraphicsSceneContextMenu) { + if (!isEnabled()) + return false; + + QGraphicsSceneContextMenuEvent* ev = static_cast<QGraphicsSceneContextMenuEvent*>(event); + QContextMenuEvent fakeEvent(QContextMenuEvent::Reason(ev->reason()), ev->pos().toPoint()); + if (d->page->swallowContextMenuEvent(&fakeEvent)) { + event->accept(); + return true; + } + d->page->updatePositionDependentActions(fakeEvent.pos()); + } else +#endif // QT_NO_CONTEXTMENU + { #ifndef QT_NO_CURSOR #if QT_VERSION >= 0x040400 - } else if (event->type() == QEvent::CursorChange) { - // An unsetCursor will set the cursor to Qt::ArrowCursor. - // Thus this cursor change might be a QWidget::unsetCursor() - // If this is not the case and it came from WebCore, the - // QWebPageClient already has set its cursor internally - // to Qt::ArrowCursor, so updating the cursor is always - // right, as it falls back to the last cursor set by - // WebCore. - // FIXME: Add a QEvent::CursorUnset or similar to Qt. - if (cursor().shape() == Qt::ArrowCursor) - d->resetCursor(); + if (event->type() == QEvent::CursorChange) { + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); + } #endif #endif + } } return QGraphicsWidget::event(event); } @@ -608,7 +637,6 @@ void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) QMouseEvent me = QMouseEvent(QEvent::MouseMove, ev->pos().toPoint(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - d->page->setView(ev->widget()); d->page->event(&me); ev->setAccepted(accepted); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h index a8478d8..26f7374 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h @@ -95,8 +95,7 @@ public Q_SLOTS: Q_SIGNALS: void loadStarted(); - void loadFinished(); - void loadFailed(); + void loadFinished(bool); void progressChanged(qreal); void interactivityChanged(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 939d881..5b83870 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -30,12 +30,14 @@ #include "Document.h" #include "DocumentFragment.h" #include "FrameView.h" +#include "GraphicsContext.h" #include "HTMLElement.h" #include "JSGlobalObject.h" #include "JSHTMLElement.h" #include "JSObject.h" #include "NodeList.h" #include "PropertyNameArray.h" +#include "RenderImage.h" #include "ScriptFunctionCall.h" #include "StaticNodeList.h" #include "qt_runtime.h" @@ -45,6 +47,8 @@ #include <parser/SourceCode.h> #include <wtf/Vector.h> +#include <QPainter> + using namespace WebCore; class QWebElementPrivate { @@ -1411,3 +1415,38 @@ QWebElement QWebElement::enclosingElement(WebCore::Node* node) Returns true if this element points to a different underlying DOM object than \a o; otherwise returns false. */ + + +/*! + Render the element into \a painter . +*/ +void QWebElement::render(QPainter* painter) +{ + WebCore::Element* e = m_element; + Document* doc = e ? e->document() : 0; + if (!doc) + return; + + Frame* frame = doc->frame(); + if (!frame || !frame->view() || !frame->contentRenderer()) + return; + + FrameView* view = frame->view(); + + view->layoutIfNeededRecursive(); + + IntRect rect = e->getRect(); + + if (rect.size().isEmpty()) + return; + + GraphicsContext context(painter); + + context.save(); + context.translate(-rect.x(), -rect.y()); + view->setNodeToDraw(e); + view->paintContents(&context, rect); + view->setNodeToDraw(0); + context.restore(); +} + diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h index 3db4637..351ccb4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h @@ -31,6 +31,10 @@ namespace WebCore { class Node; } +QT_BEGIN_NAMESPACE +class QPainter; +QT_END_NAMESPACE + class QWebFrame; class QWebElementPrivate; @@ -133,6 +137,8 @@ public: QString styleProperty(const QString& name, StyleResolveStrategy strategy) const; void setStyleProperty(const QString& name, const QString& value); + void render(QPainter* painter); + private: explicit QWebElement(WebCore::Element*); explicit QWebElement(WebCore::Node*); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 780f862..d2c324d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -540,15 +540,26 @@ QUrl QWebFrame::url() const */ QUrl QWebFrame::requestedUrl() const { - // In the following edge cases (where the failing document - // loader does not get commited by the frame loader) it is - // safer to rely on outgoingReferrer than originalRequest. - if (!d->frame->loader()->activeDocumentLoader() - || (!d->frameLoaderClient->m_loadError.isNull() - && !d->frame->loader()->outgoingReferrer().isEmpty())) - return QUrl(d->frame->loader()->outgoingReferrer()); + // 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 d->frame->loader()->originalRequest().url(); + return loader->originalRequest().url(); } /*! \since 4.6 @@ -710,7 +721,9 @@ void QWebFrame::load(const QNetworkRequest &req, script can be specified through the charset attribute of the HTML script tag. It is also possible for the encoding to be specified by web server. - \sa toHtml() + \note This method will not affect session or global history for the frame. + + \sa toHtml(), setContent() */ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) { @@ -718,7 +731,7 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) WebCore::ResourceRequest request(kurl); const QByteArray utf8 = html.toUtf8(); WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); - WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), kurl); + WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), KURL()); d->frame->loader()->load(request, substituteData, false); } @@ -731,7 +744,9 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) The \a data is loaded immediately; external objects are loaded asynchronously. - \sa toHtml() + \note This method will not affect session or global history for the frame. + + \sa toHtml(), setHtml() */ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) { @@ -741,11 +756,10 @@ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, cons QString actualMimeType = mimeType; if (actualMimeType.isEmpty()) actualMimeType = QLatin1String("text/html"); - WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), kurl); + WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), KURL()); d->frame->loader()->load(request, substituteData, false); } - /*! Returns the parent frame of this frame, or 0 if the frame is the web pages main frame. @@ -1248,7 +1262,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) ScriptController *proxy = d->frame->script(); QVariant rc; if (proxy) { - JSC::JSValue v = d->frame->loader()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); + JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); int distance = 0; rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 655fd0e..31d193e 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -271,7 +271,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) { WebCore::InitializeLoggingChannelsIfNecessary(); JSC::initializeThreading(); - WebCore::FrameLoader::setLocalLoadPolicy(WebCore::FrameLoader::AllowLocalLoadsForLocalAndSubstituteData); + WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); chromeClient = new ChromeClientQt(q); contextMenuClient = new ContextMenuClientQt(); @@ -279,9 +279,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) page = new Page(chromeClient, contextMenuClient, editorClient, new DragClientQt(q), new InspectorClientQt(q), 0); - // ### should be configurable - page->settings()->setDefaultTextEncodingName("iso-8859-1"); - settings = new QWebSettings(page->settings()); #ifndef QT_NO_UNDOSTACK @@ -461,10 +458,10 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) switch (action) { case QWebPage::Back: - enabled = loader->canGoBackOrForward(-1); + enabled = page->canGoBackOrForward(-1); break; case QWebPage::Forward: - enabled = loader->canGoBackOrForward(1); + enabled = page->canGoBackOrForward(1); break; case QWebPage::Stop: enabled = loader->isLoading(); @@ -584,8 +581,6 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev) void QWebPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -606,8 +601,6 @@ void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev) void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -663,8 +656,6 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) void QWebPagePrivate::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -750,8 +741,6 @@ void QWebPagePrivate::handleClipboard(QEvent* ev, Qt::MouseButton button) void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -833,8 +822,6 @@ QMenu *QWebPage::createStandardContextMenu() #ifndef QT_NO_WHEELEVENT void QWebPagePrivate::wheelEvent(QGraphicsSceneWheelEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -990,8 +977,6 @@ void QWebPagePrivate::focusOutEvent(QFocusEvent*) void QWebPagePrivate::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) { - q->setView(ev->widget()); - #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos().toPoint(), QCursor::pos(), dropActionToDragOp(ev->possibleActions())); @@ -1016,8 +1001,6 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev) void QWebPagePrivate::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev) { - q->setView(ev->widget()); - #ifndef QT_NO_DRAGANDDROP DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); page->dragController()->dragExited(&dragData); @@ -1036,8 +1019,6 @@ void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent* ev) void QWebPagePrivate::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) { - q->setView(ev->widget()); - #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos().toPoint(), QCursor::pos(), dropActionToDragOp(ev->possibleActions())); @@ -1863,7 +1844,7 @@ void QWebPage::triggerAction(WebAction action, bool) WTF::RefPtr<WebCore::Frame> wcFrame = targetFrame->d->frame; targetFrame->d->frame->loader()->loadFrameRequest(frameLoadRequest(d->hitTestResult.linkUrl(), wcFrame.get()), /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, - /*FormState*/ 0); + /*FormState*/ 0, SendReferrer); break; } // fall through @@ -1975,7 +1956,7 @@ void QWebPage::setViewportSize(const QSize &size) const } } -QSize QWebPage::fixedContentsSize() const +QSize QWebPage::preferredContentsSize() const { QWebFrame* frame = d->mainFrame; if (frame) { @@ -1988,7 +1969,7 @@ QSize QWebPage::fixedContentsSize() const } /*! - \property QWebPage::fixedContentsSize + \property QWebPage::preferredContentsSize \since 4.6 \brief the size of the fixed layout @@ -1996,7 +1977,7 @@ QSize QWebPage::fixedContentsSize() const 1024x768 for example then webkit will layout the page as if the viewport were that size rather than something different. */ -void QWebPage::setFixedContentsSize(const QSize &size) const +void QWebPage::setPreferredContentsSize(const QSize &size) const { d->fixedLayoutSize = size; @@ -2684,6 +2665,43 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) */ /*! + \class QWebPage::ErrorPageExtensionOption + \since 4.6 + \brief The ErrorPageExtensionOption class describes the option + for the error page extension. + + \inmodule QtWebKit + + The ErrorPageExtensionOption class holds the \a url for which an error occoured as well as + the associated \a frame. + + The error itself is reported by an error \a domain, the \a error code as well as \a errorString. + + \sa QWebPage::ErrorPageExtensionReturn +*/ + +/*! + \class QWebPage::ErrorPageExtensionReturn + \since 4.6 + \brief The ErrorPageExtensionReturn describes the error page, which will be shown for the + frame for which the error occured. + + \inmodule QtWebKit + + The ErrorPageExtensionReturn class holds the data needed for creating an error page. Some are + optional such as \a contentType, which defaults to "text/html", as well as the \a encoding, which + is assumed to be UTF-8 if not indicated otherwise. + + The error page is stored in the \a content byte array, as HTML content. In order to convert a + QString to a byte array, the QString::toUtf8() method can be used. + + External objects such as stylesheets or images referenced in the HTML are located relative to + \a baseUrl. + + \sa QWebPage::ErrorPageExtensionOption, QString::toUtf8() +*/ + +/*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 \brief The ChooseMultipleFilesExtensionOption class describes the option @@ -2850,6 +2868,9 @@ QNetworkProxy QWebPage::networkProxy() const Sets the QNetworkAccessManager \a manager responsible for serving network requests for this QWebPage. + \note It is currently not supported to change the network access manager after the + QWebPage has used it. The results of doing this are undefined. + \sa networkAccessManager() */ void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager) @@ -3359,6 +3380,16 @@ quint64 QWebPage::bytesReceived() const */ /*! + \since 4.6 + \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); + \preliminary + + This signal is emitted when a \a frame of the current page requests a web resource. The application + may want to associate the \a request with the \a frame that initiated it by storing the \a frame + as an attribute of the \a request. +*/ + +/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index 41d1835..f2bbde0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -56,6 +56,7 @@ namespace WebCore { class InspectorClientQt; class ResourceHandle; class HitTestResult; + class QNetworkReplyHandler; struct FrameLoadRequest; } @@ -66,7 +67,7 @@ class QWEBKIT_EXPORT QWebPage : public QObject { Q_PROPERTY(bool modified READ isModified) Q_PROPERTY(QString selectedText READ selectedText) Q_PROPERTY(QSize viewportSize READ viewportSize WRITE setViewportSize) - Q_PROPERTY(QSize fixedContentsSize READ fixedContentsSize WRITE setFixedContentsSize) + Q_PROPERTY(QSize preferredContentsSize READ preferredContentsSize WRITE setPreferredContentsSize) Q_PROPERTY(bool forwardUnsupportedContent READ forwardUnsupportedContent WRITE setForwardUnsupportedContent) Q_PROPERTY(LinkDelegationPolicy linkDelegationPolicy READ linkDelegationPolicy WRITE setLinkDelegationPolicy) Q_PROPERTY(QPalette palette READ palette WRITE setPalette) @@ -236,8 +237,8 @@ public: QSize viewportSize() const; void setViewportSize(const QSize &size) const; - QSize fixedContentsSize() const; - void setFixedContentsSize(const QSize &size) const; + QSize preferredContentsSize() const; + void setPreferredContentsSize(const QSize &size) const; virtual bool event(QEvent*); bool focusNextPrevChild(bool next); @@ -288,6 +289,8 @@ public: enum ErrorDomain { QtNetwork, Http, WebKit }; class ErrorPageExtensionOption : public ExtensionOption { public: + QUrl url; + QWebFrame* frame; ErrorDomain domain; int error; QString errorString; @@ -344,6 +347,8 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); + void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); + protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); @@ -378,6 +383,7 @@ private: friend class WebCore::FrameLoaderClientQt; friend class WebCore::InspectorClientQt; friend class WebCore::ResourceHandle; + friend class WebCore::QNetworkReplyHandler; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWebPage::FindFlags) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index eedf7d1..ffa21e4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -62,6 +62,8 @@ public: QString localStoragePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; + float printingMinimumShrinkFactor; + float printingMaximumShrinkFactor; void apply(); WebCore::Settings* settings; @@ -174,6 +176,12 @@ void QWebSettingsPrivate::apply() QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath; settings->setLocalStorageDatabasePath(storagePath); + float minimumShrinkFactor = printingMinimumShrinkFactor > 0.0f ? printingMinimumShrinkFactor : global->printingMinimumShrinkFactor; + settings->setPrintingMinimumShrinkFactor(minimumShrinkFactor); + + float maximumShrinkFactor = printingMaximumShrinkFactor > 0.0f ? printingMaximumShrinkFactor : global->printingMaximumShrinkFactor; + settings->setPrintingMaximumShrinkFactor(maximumShrinkFactor); + value = attributes.value(QWebSettings::ZoomTextOnly, global->attributes.value(QWebSettings::ZoomTextOnly)); settings->setZoomsTextOnly(value); @@ -377,6 +385,9 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false); d->attributes.insert(QWebSettings::SessionStorageEnabled, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; + d->defaultTextEncoding = QLatin1String("iso-8859-1"); + d->printingMinimumShrinkFactor = 0.0f; + d->printingMaximumShrinkFactor = 0.0f; } /*! @@ -491,6 +502,60 @@ QString QWebSettings::defaultTextEncoding() const } /*! + \since 4.7 + Specifies minimum shrink fator allowed for printing. If set to 0 a + default value is used. + + When printing, content will be shrunk to reduce page usage, it + will reduced by a factor between printingMinimumShrinkFactor and + printingMaximumShrinkFactor. + + \sa printingMinimumShrinkFactor() + \sa setPrintingMaximumShrinkFactor() + \sa printingMaximumShrinkFactor() +*/ +void QWebSettings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor) +{ + d->printingMinimumShrinkFactor = printingMinimumShrinkFactor; + d->apply(); +} + +/*! + \since 4.7 + returns the minimum shrink factor used for printing. + + \sa setPrintingMinimumShrinkFactor() +*/ +float QWebSettings::printingMinimumShrinkFactor() const +{ + return d->printingMinimumShrinkFactor; +} + +/*! + \since 4.7 + Specifies maximum shrink fator allowed for printing. If set to 0 a + default value is used. + + \sa setPrintingMinimumShrinkFactor() +*/ +void QWebSettings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor) +{ + d->printingMaximumShrinkFactor = printingMaximumShrinkFactor; + d->apply(); +} + +/*! + \since 4.7 + returns the maximum shrink factor used for printing. + + \sa setPrintingMinimumShrinkFactor() +*/ +float QWebSettings::printingMaximumShrinkFactor() const +{ + return d->printingMaximumShrinkFactor; +} + +/*! Sets the path of the icon database to \a path. The icon database is used to store "favicons" associated with web sites. @@ -628,11 +693,6 @@ void QWebSettings::clearMemoryCaches() // Invalidating the font cache and freeing all inactive font data. WebCore::fontCache()->invalidate(); -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - // Empty the application cache. - WebCore::cacheStorage().empty(); -#endif - // Empty the Cross-Origin Preflight cache WebCore::CrossOriginPreflightResultCache::shared().empty(); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index 4790823..e68ea53 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -103,6 +103,12 @@ public: void setDefaultTextEncoding(const QString &encoding); QString defaultTextEncoding() const; + void setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor); + float printingMinimumShrinkFactor() const; + + void setPrintingMaximumShrinkFactor(float printingMaximimShrinkFactor); + float printingMaximumShrinkFactor() const; + static void setIconDatabasePath(const QString &location); static QString iconDatabasePath(); static void clearIconDatabase(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 41067f1..95d7183 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2008 Holger Hans Peter Freyther + Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -52,11 +53,16 @@ public: virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); #endif +#ifndef QT_NO_CURSOR virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); +#endif + virtual QPalette palette() const; virtual int screenNumber() const; - virtual WId winId() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; void _q_pageDestroyed(); @@ -89,7 +95,7 @@ void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) view->setInputMethodHints(view->inputMethodHints() & ~hint); } #endif - +#ifndef QT_NO_CURSOR QCursor QWebViewPrivate::cursor() const { return view->cursor(); @@ -99,6 +105,12 @@ void QWebViewPrivate::updateCursor(const QCursor& cursor) { view->setCursor(cursor); } +#endif + +QPalette QWebViewPrivate::palette() const +{ + return view->palette(); +} int QWebViewPrivate::screenNumber() const { @@ -110,12 +122,14 @@ int QWebViewPrivate::screenNumber() const return 0; } -WId QWebViewPrivate::winId() const +QWidget* QWebViewPrivate::ownerWidget() const { - if (view) - return view->winId(); + return view; +} - return 0; +QObject* QWebViewPrivate::pluginParent() const +{ + return view; } void QWebViewPrivate::_q_pageDestroyed() @@ -231,8 +245,10 @@ QWebView::QWebView(QWidget *parent) */ QWebView::~QWebView() { - if (d->page) + if (d->page) { d->page->d->view = 0; + d->page->d->client = 0; + } if (d->page && d->page->parent() == this) delete d->page; |