diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
| commit | d0424a769059c84ae20beb3c217812792ea6726b (patch) | |
| tree | 6f94a5c3db8c52c6694ee56498542a6c35417350 /Source/WebKit/qt/Api/qwebpage.cpp | |
| parent | 88a04ac016f57c2d78e714682445dff2e7db4ade (diff) | |
| download | qtwebkit-d0424a769059c84ae20beb3c217812792ea6726b.tar.gz | |
Imported WebKit commit 37c5e5041d39a14ea0d429a77ebd352e4bd26516 (http://svn.webkit.org/repository/webkit/trunk@128608)
New snapshot that enables WebKit2 build on Windows (still some bugs) and allows for WebKit to be built with qmake && make
Diffstat (limited to 'Source/WebKit/qt/Api/qwebpage.cpp')
| -rw-r--r-- | Source/WebKit/qt/Api/qwebpage.cpp | 163 |
1 files changed, 7 insertions, 156 deletions
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index e1c06515b..a327eaf2e 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2007 Staikos Computing Services Inc. Copyright (C) 2007 Apple Inc. @@ -113,7 +113,9 @@ #include "SystemInfo.h" #endif // Q_OS_WIN32 #include "TextIterator.h" +#include "UserAgentQt.h" #include "WebEventConversion.h" +#include "WebKitVersion.h" #include "WindowFeatures.h" #include "WorkerThread.h" @@ -800,7 +802,7 @@ void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button, const QPo QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { - HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos)); + HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos), false); if (result.isContentEditable()) { QEvent event(QEvent::RequestSoftwareInputPanel); QApplication::sendEvent(client->ownerWidget(), &event); @@ -1557,7 +1559,7 @@ IntPoint QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch(const IntPoi int x = touchPoint.x(); int y = touchPoint.y(); - RefPtr<NodeList> intersectedNodes = document->nodesFromRect(x, y, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding); + RefPtr<NodeList> intersectedNodes = document->nodesFromRect(x, y, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding, false /*ignoreClipping*/, false /*allowShadowContent*/); if (!intersectedNodes) return IntPoint(); @@ -3363,7 +3365,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) d->createMainFrame(); WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); - HitTestResult result = focusedFrame->eventHandler()->hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos)); + HitTestResult result = focusedFrame->eventHandler()->hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos), /*allowShadowContent*/ false); if (result.scrollbar()) d->hitTestResult = QWebHitTestResult(); else @@ -3784,158 +3786,7 @@ QWebPluginFactory *QWebPage::pluginFactory() const */ QString QWebPage::userAgentForUrl(const QUrl&) const { - // splitting the string in three and user QStringBuilder is better than using QString::arg() - static QString firstPart; - static QString secondPart; - static QString thirdPart; - - if (firstPart.isNull() || secondPart.isNull() || thirdPart.isNull()) { - QString firstPartTemp; - firstPartTemp.reserve(150); - firstPartTemp += QString::fromLatin1("Mozilla/5.0 (" - - // Platform -#ifdef Q_WS_MAC - "Macintosh; " -#elif defined Q_WS_QWS - "QtEmbedded; " -#elif defined Q_WS_WIN - // Nothing -#elif defined Q_WS_X11 - "X11; " -#else - "Unknown; " -#endif - ); - -#if defined(QT_NO_OPENSSL) - // No SSL support - firstPartTemp += QString::fromLatin1("N; "); -#endif - - // Operating system -#ifdef Q_OS_AIX - firstPartTemp += QString::fromLatin1("AIX"); -#elif defined Q_OS_WIN32 - firstPartTemp += windowsVersionForUAString(); -#elif defined Q_OS_DARWIN -#ifdef __i386__ || __x86_64__ - firstPartTemp += QString::fromLatin1("Intel Mac OS X"); -#else - firstPartTemp += QString::fromLatin1("PPC Mac OS X"); -#endif - -#elif defined Q_OS_BSDI - firstPartTemp += QString::fromLatin1("BSD"); -#elif defined Q_OS_BSD4 - firstPartTemp += QString::fromLatin1("BSD Four"); -#elif defined Q_OS_CYGWIN - firstPartTemp += QString::fromLatin1("Cygwin"); -#elif defined Q_OS_DGUX - firstPartTemp += QString::fromLatin1("DG/UX"); -#elif defined Q_OS_DYNIX - firstPartTemp += QString::fromLatin1("DYNIX/ptx"); -#elif defined Q_OS_FREEBSD - firstPartTemp += QString::fromLatin1("FreeBSD"); -#elif defined Q_OS_HPUX - firstPartTemp += QString::fromLatin1("HP-UX"); -#elif defined Q_OS_HURD - firstPartTemp += QString::fromLatin1("GNU Hurd"); -#elif defined Q_OS_IRIX - firstPartTemp += QString::fromLatin1("SGI Irix"); -#elif defined Q_OS_LINUX - -#if defined(__x86_64__) - firstPartTemp += QString::fromLatin1("Linux x86_64"); -#elif defined(__i386__) - firstPartTemp += QString::fromLatin1("Linux i686"); -#else - firstPartTemp += QString::fromLatin1("Linux"); -#endif - -#elif defined Q_OS_LYNX - firstPartTemp += QString::fromLatin1("LynxOS"); -#elif defined Q_OS_NETBSD - firstPartTemp += QString::fromLatin1("NetBSD"); -#elif defined Q_OS_OS2 - firstPartTemp += QString::fromLatin1("OS/2"); -#elif defined Q_OS_OPENBSD - firstPartTemp += QString::fromLatin1("OpenBSD"); -#elif defined Q_OS_OS2EMX - firstPartTemp += QString::fromLatin1("OS/2"); -#elif defined Q_OS_OSF - firstPartTemp += QString::fromLatin1("HP Tru64 UNIX"); -#elif defined Q_OS_QNX6 - firstPartTemp += QString::fromLatin1("QNX RTP Six"); -#elif defined Q_OS_QNX - firstPartTemp += QString::fromLatin1("QNX"); -#elif defined Q_OS_RELIANT - firstPartTemp += QString::fromLatin1("Reliant UNIX"); -#elif defined Q_OS_SCO - firstPartTemp += QString::fromLatin1("SCO OpenServer"); -#elif defined Q_OS_SOLARIS - firstPartTemp += QString::fromLatin1("Sun Solaris"); -#elif defined Q_OS_ULTRIX - firstPartTemp += QString::fromLatin1("DEC Ultrix"); -#elif defined Q_OS_UNIX - firstPartTemp += QString::fromLatin1("UNIX BSD/SYSV system"); -#elif defined Q_OS_UNIXWARE - firstPartTemp += QString::fromLatin1("UnixWare Seven, Open UNIX Eight"); -#else - firstPartTemp += QString::fromLatin1("Unknown"); -#endif - -#if USE(QT_MOBILITY_SYSTEMINFO) - // 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; - - QString secondPartTemp; - secondPartTemp.reserve(150); - secondPartTemp += QString::fromLatin1(") "); - - // webkit/qt version - secondPartTemp += QString::fromLatin1("AppleWebKit/"); - secondPartTemp += qWebKitVersion(); - secondPartTemp += QString::fromLatin1(" (KHTML, like Gecko) "); - - - // Application name split the third part - secondPartTemp.squeeze(); - secondPart = secondPartTemp; - - QString thirdPartTemp; - thirdPartTemp.reserve(150); - thirdPartTemp += QLatin1String(" Safari/"); - thirdPartTemp += qWebKitVersion(); - thirdPartTemp.squeeze(); - thirdPart = thirdPartTemp; - Q_ASSERT(!firstPart.isNull()); - Q_ASSERT(!secondPart.isNull()); - Q_ASSERT(!thirdPart.isNull()); - } - - // Application name/version - QString appName = QCoreApplication::applicationName(); - if (!appName.isEmpty()) { - QString appVer = QCoreApplication::applicationVersion(); - if (!appVer.isEmpty()) - appName.append(QLatin1Char('/') + appVer); - } else { - // Qt version - appName = QString::fromLatin1("Qt/") + QString::fromLatin1(qVersion()); - } - - return firstPart + secondPart + appName + thirdPart; + return UserAgentQt::standardUserAgent("", WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION); } |
