[Qt][WK2] fast/forms/access-key-for-all-elements.html fails
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Sep 2012 16:07:53 +0000 (16:07 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Sep 2012 16:07:53 +0000 (16:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73917

Patch by Lauro Neto <lauro.neto@openbossa.org> on 2012-09-13
Reviewed by Simon Hausmann.

Access-key tests were failing due to hardcoded Mac OS X in the
Qt WK2 user agent string. This commit moves the WK1 implementation
to a shared one to be used by both versions.

Source/WebCore:

Adds the shared user agent implementation.

* Target.pri:
* platform/qt/UserAgentQt.cpp: Added.
(WebCore):
(WebCore::UserAgentQt::standardUserAgent):
* platform/qt/UserAgentQt.h: Added.
(WebCore):
(UserAgentQt):

Source/WebKit/qt:

Change QWebPage to use the shared user agent implementation.

* Api/qwebpage.cpp:
(QWebPage::userAgentForUrl):

Source/WebKit2:

Use the shared implementation instead of hardcoding the user agent.

* UIProcess/qt/WebPageProxyQt.cpp:
(WebKit::WebPageProxy::standardUserAgent):

LayoutTests:

Unskip now passing tests.

* platform/qt-5.0-wk2/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128472 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/qt-5.0-wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/platform/qt/UserAgentQt.cpp [new file with mode: 0644]
Source/WebCore/platform/qt/UserAgentQt.h [new file with mode: 0644]
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp

index a486e61..5a7892e 100644 (file)
@@ -1,3 +1,18 @@
+2012-09-13  Lauro Neto  <lauro.neto@openbossa.org>
+
+        [Qt][WK2] fast/forms/access-key-for-all-elements.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=73917
+
+        Reviewed by Simon Hausmann.
+
+        Access-key tests were failing due to hardcoded Mac OS X in the
+        Qt WK2 user agent string. This commit moves the WK1 implementation
+        to a shared one to be used by both versions.
+
+        Unskip now passing tests.
+
+        * platform/qt-5.0-wk2/Skipped:
+
 2012-09-13  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [EFL][WK2] Gardening after r128393
index b367ce9..be06bff 100644 (file)
@@ -46,7 +46,6 @@ editing/selection/select-out-of-editable.html
 fast/dom/vertical-scrollbar-in-rtl.html
 fast/dynamic/layer-hit-test-crash.html
 fast/encoding/mailto-always-utf-8.html
-fast/events/access-key-self-destruct.html
 fast/events/context-no-deselect.html
 fast/events/context-onmousedown-event.html
 fast/events/contextmenu-scrolled-page-with-frame.html
@@ -62,12 +61,9 @@ fast/events/scroll-in-scaled-page-with-overflow-hidden.html
 fast/events/selectstart-prevent-selection-on-right-click.html
 fast/events/wheelevent-in-horizontal-scrollbar-in-rtl.html
 fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html
-fast/forms/access-key.html
 fast/forms/focus-change-on-keypress.html
-fast/forms/focus-selection-textarea.html
 fast/forms/interactive-validation-attach-assertion.html
 fast/forms/legend-access-key.html
-fast/forms/select-accesskey.html
 fast/loader/policy-delegate-action-hit-test-zoomed.html
 
 svg/custom/use-events-crash.svg
@@ -211,10 +207,6 @@ svg/as-object/svg-embedded-in-html-in-iframe.html
 # https://bugs.webkit.org/show_bug.cgi?id=70935
 fast/transforms/scrollIntoView-transformed.html
 
-# [Qt][WK2] fast/forms/access-key-for-all-elements.html fails
-# https://bugs.webkit.org/show_bug.cgi?id=73917
-fast/forms/access-key-for-all-elements.html
-
 # [Qt][WK2] css3/unicode-bidi-isolate-aharon-failing.html fails
 # https://bugs.webkit.org/show_bug.cgi?id=74505
 css3/unicode-bidi-isolate-aharon-failing.html
@@ -235,7 +227,6 @@ svg/custom/getscreenctm-in-scrollable-div-area.xhtml
 # Failing tests on qt-wk2 after unskipping qt-5.0/Skipped tests, need more investigation
 editing/selection/click-in-margins-inside-editable-div.html
 fast/block/basic/020.html
-fast/dom/access-key-iframe.html
 fast/history/visited-link-background-color.html
 fast/layers/layer-visibility-sublayer.html
 fast/layers/layer-visibility.html
index 349b9b7..1696c33 100644 (file)
@@ -1,3 +1,24 @@
+2012-09-13  Lauro Neto  <lauro.neto@openbossa.org>
+
+        [Qt][WK2] fast/forms/access-key-for-all-elements.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=73917
+
+        Reviewed by Simon Hausmann.
+
+        Access-key tests were failing due to hardcoded Mac OS X in the
+        Qt WK2 user agent string. This commit moves the WK1 implementation
+        to a shared one to be used by both versions.
+
+        Adds the shared user agent implementation.
+
+        * Target.pri:
+        * platform/qt/UserAgentQt.cpp: Added.
+        (WebCore):
+        (WebCore::UserAgentQt::standardUserAgent):
+        * platform/qt/UserAgentQt.h: Added.
+        (WebCore):
+        (UserAgentQt):
+
 2012-09-13  Kenneth Rohde Christiansen  <kenneth@webkit.org>
 
         [EFL] Use RefPtr for storing cairo_surface_t
index e92d92f..5199372 100644 (file)
@@ -2227,6 +2227,7 @@ HEADERS += \
     platform/qt/QWebPageClient.h \
     platform/qt/RenderThemeQt.h \
     platform/qt/RenderThemeQtMobile.h \
+    platform/qt/UserAgentQt.h \
     platform/ScrollableArea.h \
     platform/ScrollAnimator.h \
     platform/Scrollbar.h \
@@ -2785,6 +2786,7 @@ SOURCES += \
     platform/qt/RunLoopQt.cpp \
     platform/qt/SharedBufferQt.cpp \
     platform/qt/ThirdPartyCookiesQt.cpp \
+    platform/qt/UserAgentQt.cpp \
     platform/graphics/qt/FontCacheQt.cpp \
     platform/graphics/qt/FontCustomPlatformDataQt.cpp \
     platform/graphics/qt/GlyphPageTreeNodeQt.cpp \
diff --git a/Source/WebCore/platform/qt/UserAgentQt.cpp b/Source/WebCore/platform/qt/UserAgentQt.cpp
new file mode 100644 (file)
index 0000000..1ce0640
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+    Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2007 Staikos Computing Services Inc.
+    Copyright (C) 2007 Apple Inc.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+#include "config.h"
+
+#include "UserAgentQt.h"
+
+#include <QCoreApplication>
+
+#include <wtf/text/WTFString.h>
+#if defined Q_OS_WIN32
+#include <SystemInfo.h>
+#endif // Q_OS_WIN32
+
+namespace WebCore {
+
+/*!
+    This function is called when a user agent for HTTP requests is needed.
+
+    This implementation returns the following value:
+
+    "Mozilla/5.0 (%Platform%%Security%%Subplatform%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%"
+
+    In this string the following values are replaced the first time the function is called:
+    \list
+    \li %Platform% expands to the windowing system followed by "; " if it is not Windows (e.g. "X11; ").
+    \li %Security% expands to "N; " if SSL is disabled.
+    \li %Subplatform% expands to the operating system version (e.g. "Windows NT 6.1" or "Intel Mac OS X 10.5").
+    \li %WebKitVersion% is the version of WebKit the application was compiled against.
+    /endlist
+
+    The following value is replaced each time the funciton is called
+    \list
+    \li %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version.
+    \endlist
+*/
+String UserAgentQt::standardUserAgent(const String &applicationNameForUserAgent, unsigned int webkitMajorVersion, unsigned int webkitMinorVersion)
+{
+    static QString ua;
+
+    if (ua.isNull()) {
+
+        ua = QLatin1String("Mozilla/5.0 (%1%2%3) AppleWebKit/%4 (KHTML, like Gecko) %99 Safari/%5");
+
+        // Platform.
+        ua = ua.arg(QLatin1String(
+#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
+        ));
+
+        // Security strength.
+        QString securityStrength;
+#if defined(QT_NO_OPENSSL)
+        securityStrength = QLatin1String("N; ");
+#endif
+        ua = ua.arg(securityStrength);
+
+        // Operating system.
+        ua = ua.arg(QLatin1String(
+#ifdef Q_OS_AIX
+            "AIX"
+#elif defined Q_OS_WIN32
+            windowsVersionForUAString()
+#elif defined Q_OS_DARWIN
+#ifdef __i386__ || __x86_64__
+            "Intel Mac OS X"
+#else
+            "PPC Mac OS X"
+#endif
+
+#elif defined Q_OS_BSDI
+            "BSD"
+#elif defined Q_OS_BSD4
+            "BSD Four"
+#elif defined Q_OS_CYGWIN
+            "Cygwin"
+#elif defined Q_OS_DGUX
+            "DG/UX"
+#elif defined Q_OS_DYNIX
+            "DYNIX/ptx"
+#elif defined Q_OS_FREEBSD
+            "FreeBSD"
+#elif defined Q_OS_HPUX
+            "HP-UX"
+#elif defined Q_OS_HURD
+            "GNU Hurd"
+#elif defined Q_OS_IRIX
+            "SGI Irix"
+#elif defined Q_OS_LINUX
+
+#if defined(__x86_64__)
+            "Linux x86_64"
+#elif defined(__i386__)
+            "Linux i686"
+#else
+            "Linux"
+#endif
+
+#elif defined Q_OS_LYNX
+            "LynxOS"
+#elif defined Q_OS_NETBSD
+            "NetBSD"
+#elif defined Q_OS_OS2
+            "OS/2"
+#elif defined Q_OS_OPENBSD
+            "OpenBSD"
+#elif defined Q_OS_OS2EMX
+            "OS/2"
+#elif defined Q_OS_OSF
+            "HP Tru64 UNIX"
+#elif defined Q_OS_QNX6
+            "QNX RTP Six"
+#elif defined Q_OS_QNX
+            "QNX"
+#elif defined Q_OS_RELIANT
+            "Reliant UNIX"
+#elif defined Q_OS_SCO
+            "SCO OpenServer"
+#elif defined Q_OS_SOLARIS
+            "Sun Solaris"
+#elif defined Q_OS_ULTRIX
+            "DEC Ultrix"
+#elif defined Q_OS_UNIX
+            "UNIX BSD/SYSV system"
+#elif defined Q_OS_UNIXWARE
+            "UnixWare Seven, Open UNIX Eight"
+#else
+            "Unknown"
+#endif
+        ));
+
+        // WebKit version.
+        // FIXME "+" in the version string?
+        QString version = QString(QLatin1String("%1.%2")).arg(QString::number(webkitMajorVersion),
+                                                               QString::number(webkitMinorVersion));
+        ua = ua.arg(version, version);
+    }
+
+    QString appName;
+    if (applicationNameForUserAgent.isEmpty())
+        appName = QCoreApplication::applicationName();
+    else
+        appName = applicationNameForUserAgent;
+
+    if (!appName.isEmpty()) {
+        QString appVer = QCoreApplication::applicationVersion();
+        if (!appVer.isEmpty())
+            appName.append(QLatin1Char('/') + appVer);
+    } else {
+        // Qt version.
+        appName = QLatin1String("Qt/") + QLatin1String(qVersion());
+    }
+
+    return ua.arg(appName);
+}
+
+}
diff --git a/Source/WebCore/platform/qt/UserAgentQt.h b/Source/WebCore/platform/qt/UserAgentQt.h
new file mode 100644 (file)
index 0000000..d4b4f78
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+#ifndef UserAgentQt_h
+#define UserAgentQt_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class UserAgentQt {
+public:
+    static String standardUserAgent(const String &applicationNameForUserAgent, unsigned int webkitMajorVersion, unsigned int webkitMinorVersion);
+};
+
+}
+
+#endif // UserAgentQt_h
index 7fb7413..a327eaf 100644 (file)
@@ -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.
 
 #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"
 
@@ -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);
 }
 
 
index a76302f..53a092b 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-13  Lauro Neto  <lauro.neto@openbossa.org>
+
+        [Qt][WK2] fast/forms/access-key-for-all-elements.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=73917
+
+        Reviewed by Simon Hausmann.
+
+        Access-key tests were failing due to hardcoded Mac OS X in the
+        Qt WK2 user agent string. This commit moves the WK1 implementation
+        to a shared one to be used by both versions.
+
+        Change QWebPage to use the shared user agent implementation.
+
+        * Api/qwebpage.cpp:
+        (QWebPage::userAgentForUrl):
+
 2012-09-13  Oswald Buddenhagen  <oswald.buddenhagen@nokia.com>
 
         [Qt] Fix qdoc executable preparation
index 06cd0b2..a07957d 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-13  Lauro Neto  <lauro.neto@openbossa.org>
+
+        [Qt][WK2] fast/forms/access-key-for-all-elements.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=73917
+
+        Reviewed by Simon Hausmann.
+
+        Access-key tests were failing due to hardcoded Mac OS X in the
+        Qt WK2 user agent string. This commit moves the WK1 implementation
+        to a shared one to be used by both versions.
+
+        Use the shared implementation instead of hardcoding the user agent.
+
+        * UIProcess/qt/WebPageProxyQt.cpp:
+        (WebKit::WebPageProxy::standardUserAgent):
+
 2012-09-13  Simon Hausmann  <simon.hausmann@nokia.com>
 
         [Qt] Fix build of WTR and the QML2 plugin on Windows
index 558d47d..ef6d547 100644 (file)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
  * Copyright (C) 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,6 +28,8 @@
 #include "WebPageProxy.h"
 
 #include "PageClient.h"
+#include "UserAgentQt.h"
+#include "WebKitVersion.h"
 #include "WebPageMessages.h"
 #include "WebProcessProxy.h"
 #include <WebCore/Editor.h>
@@ -44,8 +47,7 @@ namespace WebKit {
 
 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
 {
-    // FIXME: This should not be hard coded.
-    return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6) AppleWebKit/531.4 (KHTML, like Gecko) Version/4.0.3 Safari/531.4";
+    return UserAgentQt::standardUserAgent(applicationNameForUserAgent, WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION);
 }
 
 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)