diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit/qt/Api | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit/qt/Api')
-rw-r--r-- | Source/WebKit/qt/Api/qgraphicswebview.cpp | 21 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qgraphicswebview.h | 3 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qwebelement.cpp | 19 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qwebelement.h | 1 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qwebframe.cpp | 12 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qwebpage.cpp | 106 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qwebpage_p.h | 1 | ||||
-rw-r--r-- | Source/WebKit/qt/Api/qwebsettings.cpp | 20 |
8 files changed, 102 insertions, 81 deletions
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index b6ac31b..b1c9586 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -69,9 +69,6 @@ public: void _q_contentsSizeChanged(const QSize&); void _q_scaleChanged(); -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) - void _q_updateMicroFocus(); -#endif void _q_pageDestroyed(); QGraphicsWebView* q; @@ -112,20 +109,6 @@ void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) emit q->loadFinished(success); } -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) -void QGraphicsWebViewPrivate::_q_updateMicroFocus() -{ - // Ideally, this should be handled by a common call to an updateMicroFocus function - // in QGraphicsItem. See http://bugreports.qt.nokia.com/browse/QTBUG-7578. - QList<QGraphicsView*> views = q->scene()->views(); - for (int c = 0; c < views.size(); ++c) { - QInputContext* ic = views.at(c)->inputContext(); - if (ic) - ic->update(); - } -} -#endif - void QGraphicsWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -381,6 +364,8 @@ bool QGraphicsWebView::event(QEvent* event) // Re-implemented in order to allows fixing event-related bugs in patch releases. if (d->page) { + if (event->type() == QEvent::PaletteChange) + d->page->setPalette(palette()); #ifndef QT_NO_CONTEXTMENU if (event->type() == QEvent::GraphicsSceneContextMenu) { if (!isEnabled()) @@ -487,7 +472,7 @@ void QGraphicsWebView::setPage(QWebPage* page) this, SLOT(_q_pageDestroyed())); #if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) connect(d->page, SIGNAL(microFocusChanged()), - this, SLOT(_q_updateMicroFocus())); + this, SLOT(updateMicroFocus())); #endif } diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h index e08e895..733c224 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.h +++ b/Source/WebKit/qt/Api/qgraphicswebview.h @@ -144,9 +144,6 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) - Q_PRIVATE_SLOT(d, void _q_updateMicroFocus()) -#endif Q_PRIVATE_SLOT(d, void _q_pageDestroyed()) // we don't want to change the moc based on USE() macro, so this function is here // but will be empty if ACCLERATED_COMPOSITING is disabled diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 60ae3a0..b0b1b92 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -49,7 +49,9 @@ #include "StaticNodeList.h" #include "qwebframe.h" #include "qwebframe_p.h" +#if USE(JSC) #include "runtime_root.h" +#endif #include <wtf/Vector.h> #include <wtf/text/CString.h> @@ -784,7 +786,7 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource) if (!setupScriptContext(m_element, thisValue, state, scriptController)) return QVariant(); #if USE(JSC) - JSC::ScopeChain& scopeChain = state->dynamicGlobalObject()->globalScopeChain(); + JSC::ScopeChainNode* scopeChain = state->dynamicGlobalObject()->globalScopeChain(); JSC::UString script(reinterpret_cast_ptr<const UChar*>(scriptSource.data()), scriptSource.length()); JSC::Completion completion = JSC::evaluate(state, scopeChain, JSC::makeSource(script), thisValue); if ((completion.complType() != JSC::ReturnValue) && (completion.complType() != JSC::Normal)) @@ -1485,6 +1487,14 @@ QWebElement QWebElement::enclosingElement(WebCore::Node* node) */ void QWebElement::render(QPainter* painter) { + render(painter, QRect()); +} + +/*! + Render the element into \a painter clipping to \a clip. +*/ +void QWebElement::render(QPainter* painter, const QRect& clip) +{ WebCore::Element* e = m_element; Document* doc = e ? e->document() : 0; if (!doc) @@ -1503,12 +1513,17 @@ void QWebElement::render(QPainter* painter) if (rect.size().isEmpty()) return; + QRect finalClipRect = rect; + if (!clip.isEmpty()) + rect.intersect(clip.translated(rect.location())); + GraphicsContext context(painter); context.save(); context.translate(-rect.x(), -rect.y()); + painter->setClipRect(finalClipRect, Qt::IntersectClip); view->setNodeToDraw(e); - view->paintContents(&context, rect); + view->paintContents(&context, finalClipRect); view->setNodeToDraw(0); context.restore(); } diff --git a/Source/WebKit/qt/Api/qwebelement.h b/Source/WebKit/qt/Api/qwebelement.h index b94c372..4b1a758 100644 --- a/Source/WebKit/qt/Api/qwebelement.h +++ b/Source/WebKit/qt/Api/qwebelement.h @@ -156,6 +156,7 @@ public: void setStyleProperty(const QString& name, const QString& value); void render(QPainter* painter); + void render(QPainter* painter, const QRect& clipRect); private: explicit QWebElement(WebCore::Element*); diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index dce0137..6f98bca 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -554,6 +554,7 @@ QWebFrame::~QWebFrame() Qt properties will be exposed as JavaScript properties and slots as JavaScript methods. + The interaction between C++ and JavaScript is explained in the documentation of the \l{The QtWebKit Bridge}{QtWebKit bridge}. If you want to ensure that your QObjects remain accessible after loading a new URL, you should add them in a slot connected to the @@ -578,6 +579,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object Qt properties will be exposed as JavaScript properties and slots as JavaScript methods. + The interaction between C++ and JavaScript is explained in the documentation of the \l{The QtWebKit Bridge}{QtWebKit bridge}. If you want to ensure that your QObjects remain accessible after loading a new URL, you should add them in a slot connected to the @@ -732,7 +734,15 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url) if (!url.isRelative()) return url; - return QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath()); + // This contains the URL with absolute path but without + // the query and the fragment part. + QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath()); + + // The path is removed so the query and the fragment parts are there. + QString pathRemoved = url.toString(QUrl::RemovePath); + QUrl toResolve(pathRemoved); + + return baseUrl.resolved(toResolve); } /*! diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 075756d..5dd57f5 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -62,6 +62,10 @@ #include "FrameLoaderClientQt.h" #include "FrameTree.h" #include "FrameView.h" +#if ENABLE(CLIENT_BASED_GEOLOCATION) +#include "GeolocationClientMock.h" +#include "GeolocationClientQt.h" +#endif // CLIENT_BASED_GEOLOCATION #include "GeolocationPermissionClientQt.h" #include "HTMLFormElement.h" #include "HTMLFrameOwnerElement.h" @@ -119,7 +123,6 @@ #include <QFileDialog> #include <QHttpRequestHeader> #include <QInputDialog> -#include <QLocale> #include <QMessageBox> #include <QNetworkProxy> #include <QUndoStack> @@ -137,7 +140,9 @@ #if defined(Q_WS_X11) #include <QX11Info> #endif - +#if ENABLE(QT_USERAGENT_DEVICEMODEL) +#include <qsysteminfo.h> +#endif using namespace WebCore; @@ -297,7 +302,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) , currentContextMenu(0) #endif , settings(0) - , editable(false) , useFixedLayout(false) , pluginFactory(0) , inspectorFrontend(0) @@ -324,8 +328,19 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) pageClients.deviceOrientationClient = new DeviceOrientationClientQt(q); pageClients.deviceMotionClient = new DeviceMotionClientQt(q); #endif +#if ENABLE(CLIENT_BASED_GEOLOCATION) + if (QWebPagePrivate::drtRun) + pageClients.geolocationClient = new GeolocationClientMock(); + else + pageClients.geolocationClient = new GeolocationClientQt(q); +#endif page = new Page(pageClients); +#if ENABLE(CLIENT_BASED_GEOLOCATION) + // In case running in DumpRenderTree mode set the controller to mock provider. + if (QWebPagePrivate::drtRun) + static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(page->geolocationController()); +#endif settings = new QWebSettings(page->settings()); history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList())); @@ -2431,7 +2446,7 @@ void QWebPage::setViewportSize(const QSize &size) const QWebFrame *frame = mainFrame(); if (frame->d->frame && frame->d->frame->view()) { WebCore::FrameView* view = frame->d->frame->view(); - view->setFrameRect(QRect(QPoint(0, 0), size)); + view->resize(size); view->adjustViewSize(); } } @@ -3153,11 +3168,11 @@ bool QWebPage::focusNextPrevChild(bool next) */ void QWebPage::setContentEditable(bool editable) { - if (d->editable != editable) { - d->editable = editable; + if (isContentEditable() != 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 @@ -3171,7 +3186,7 @@ void QWebPage::setContentEditable(bool editable) bool QWebPage::isContentEditable() const { - return d->editable; + return d->mainFrame && d->mainFrame->d->frame->document()->inDesignMode(); } /*! @@ -3676,16 +3691,15 @@ QWebPluginFactory *QWebPage::pluginFactory() const The default implementation returns the following value: - "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%" + "Mozilla/5.0 (%Platform%%Security%%Subplatform%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%" On mobile platforms such as Symbian S60 and Maemo, "Mobile Safari" is used instead of "Safari". In this string the following values are replaced at run-time: \list - \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system. - \o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true. - \o %Locale% is replaced with QLocale::name(). The locale is determined from the view of the QWebPage. If no view is set on the QWebPage, - then a default constructed QLocale is used instead. + \o %Platform% expands to the windowing system followed by "; " if it is not Windows (e.g. "X11; "). + \o %Security% expands to "N; " if SSL is disabled. + \o %Subplatform% expands to the operating system version (e.g. "Windows NT 6.1" or "Intel Mac OS X 10.5"). \o %WebKitVersion% is the version of WebKit the application was compiled against. \o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. \endlist @@ -3704,17 +3718,21 @@ QString QWebPage::userAgentForUrl(const QUrl&) const // Platform #ifdef Q_WS_MAC - "Macintosh" + "Macintosh; " #elif defined Q_WS_QWS - "QtEmbedded" + "QtEmbedded; " +#elif defined Q_WS_MAEMO_5 + "Maemo" +#elif defined Q_WS_MAEMO_6 + "MeeGo" #elif defined Q_WS_WIN - "Windows" + // Nothing #elif defined Q_WS_X11 - "X11" + "X11; " #elif defined Q_OS_SYMBIAN "Symbian" #else - "Unknown" + "Unknown; " #endif ); @@ -3722,38 +3740,31 @@ QString QWebPage::userAgentForUrl(const QUrl&) const QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); switch (symbianVersion) { case QSysInfo::SV_9_2: - firstPartTemp += QString::fromLatin1("OS/9.2"); + firstPartTemp += QString::fromLatin1("OS/9.2; "); break; case QSysInfo::SV_9_3: - firstPartTemp += QString::fromLatin1("OS/9.3"); + firstPartTemp += QString::fromLatin1("OS/9.3; "); break; case QSysInfo::SV_9_4: - firstPartTemp += QString::fromLatin1("OS/9.4"); + firstPartTemp += QString::fromLatin1("OS/9.4; "); break; case QSysInfo::SV_SF_2: - firstPartTemp += QString::fromLatin1("/2"); + firstPartTemp += QString::fromLatin1("/2; "); break; case QSysInfo::SV_SF_3: - firstPartTemp += QString::fromLatin1("/3"); + firstPartTemp += QString::fromLatin1("/3; "); break; case QSysInfo::SV_SF_4: - firstPartTemp += QString::fromLatin1("/4"); + firstPartTemp += QString::fromLatin1("/4; "); + break; default: + firstPartTemp += QString::fromLatin1("; "); break; } #endif - firstPartTemp += QString::fromLatin1("; "); - - // SSL support -#if !defined(QT_NO_OPENSSL) - // we could check QSslSocket::supportsSsl() here, but this makes - // OpenSSL, certificates etc being loaded in all cases were QWebPage - // is used. This loading is not needed for non-https. - firstPartTemp += QString::fromLatin1("U; "); - // this may lead to a false positive: We indicate SSL since it is - // compiled in even though supportsSsl() might return false -#else +#if defined(QT_NO_OPENSSL) + // No SSL support firstPartTemp += QString::fromLatin1("N; "); #endif @@ -3833,6 +3844,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const #elif defined Q_OS_IRIX firstPartTemp += QString::fromLatin1("SGI Irix"); #elif defined Q_OS_LINUX +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) #if defined(__x86_64__) firstPartTemp += QString::fromLatin1("Linux x86_64"); @@ -3841,6 +3853,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const #else firstPartTemp += QString::fromLatin1("Linux"); #endif +#endif #elif defined Q_OS_LYNX firstPartTemp += QString::fromLatin1("LynxOS"); @@ -3890,8 +3903,17 @@ QString QWebPage::userAgentForUrl(const QUrl&) const firstPartTemp += QString::fromLatin1("Unknown"); #endif - // language is the split - firstPartTemp += QString::fromLatin1("; "); +#if ENABLE(QT_USERAGENT_DEVICEMODEL) + // adding Model Number + QtMobility::QSystemDeviceInfo systemDeviceInfo; + + QString model = systemDeviceInfo.model(); + if (!model.isEmpty()) { + if (!firstPartTemp.endsWith("; ")) + firstPartTemp += QString::fromLatin1("; "); + firstPartTemp += systemDeviceInfo.model(); + } +#endif firstPartTemp.squeeze(); firstPart = firstPartTemp; @@ -3911,7 +3933,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const QString thirdPartTemp; thirdPartTemp.reserve(150); -#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) thirdPartTemp += QLatin1String(" Mobile Safari/"); #else thirdPartTemp += QLatin1String(" Safari/"); @@ -3924,14 +3946,6 @@ QString QWebPage::userAgentForUrl(const QUrl&) const Q_ASSERT(!thirdPart.isNull()); } - // Language - QString languageName; - if (d->client && d->client->ownerWidget()) - languageName = d->client->ownerWidget()->locale().name(); - else - languageName = QLocale().name(); - languageName.replace(QLatin1Char('_'), QLatin1Char('-')); - // Application name/version QString appName = QCoreApplication::applicationName(); if (!appName.isEmpty()) { @@ -3943,7 +3957,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const appName = QString::fromLatin1("Qt/") + QString::fromLatin1(qVersion()); } - return firstPart + languageName + secondPart + appName + thirdPart; + return firstPart + secondPart + appName + thirdPart; } diff --git a/Source/WebKit/qt/Api/qwebpage_p.h b/Source/WebKit/qt/Api/qwebpage_p.h index 7bd1252..86f54b7 100644 --- a/Source/WebKit/qt/Api/qwebpage_p.h +++ b/Source/WebKit/qt/Api/qwebpage_p.h @@ -200,7 +200,6 @@ public: #endif QWebSettings *settings; QPalette palette; - bool editable; bool useFixedLayout; QAction *actions[QWebPage::WebActionCount]; diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index e2d6061..3f0b436 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -645,16 +645,16 @@ QString QWebSettings::defaultTextEncoding() const */ void QWebSettings::setIconDatabasePath(const QString& path) { - WebCore::iconDatabase()->delayDatabaseCleanup(); + WebCore::iconDatabase().delayDatabaseCleanup(); if (!path.isEmpty()) { - WebCore::iconDatabase()->setEnabled(true); + WebCore::iconDatabase().setEnabled(true); QFileInfo info(path); if (info.isDir() && info.isWritable()) - WebCore::iconDatabase()->open(path); + WebCore::iconDatabase().open(path); } else { - WebCore::iconDatabase()->setEnabled(false); - WebCore::iconDatabase()->close(); + WebCore::iconDatabase().setEnabled(false); + WebCore::iconDatabase().close(); } } @@ -666,8 +666,8 @@ void QWebSettings::setIconDatabasePath(const QString& path) */ QString QWebSettings::iconDatabasePath() { - if (WebCore::iconDatabase()->isEnabled() && WebCore::iconDatabase()->isOpen()) - return WebCore::iconDatabase()->databasePath(); + if (WebCore::iconDatabase().isEnabled() && WebCore::iconDatabase().isOpen()) + return WebCore::iconDatabase().databasePath(); else return QString(); } @@ -677,8 +677,8 @@ QString QWebSettings::iconDatabasePath() */ void QWebSettings::clearIconDatabase() { - if (WebCore::iconDatabase()->isEnabled() && WebCore::iconDatabase()->isOpen()) - WebCore::iconDatabase()->removeAllIcons(); + if (WebCore::iconDatabase().isEnabled() && WebCore::iconDatabase().isOpen()) + WebCore::iconDatabase().removeAllIcons(); } /*! @@ -693,7 +693,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().iconForPageURL(WebCore::KURL(url).string(), WebCore::IntSize(16, 16)); if (!image) return QPixmap(); |