From 87e5ef535ec96bcb55b17a3b3def78147fa5890a Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Fri, 30 Sep 2011 20:47:43 +0000 Subject: [PATCH] [Qt] Build fix: Qt::escape is deprecated in Qt5 https://bugs.webkit.org/show_bug.cgi?id=69162 Use QString::toHtmlEscaped in the Qt5 case. Patch by Pierre Rossi on 2011-09-30 Reviewed by Andreas Kling. Source/JavaScriptCore: * JavaScriptCore.pri: * wtf/qt/UtilsQt.h: Added. (escapeHtml): * wtf/wtf.pri: Source/WebCore: No new tests needed. * WebCore.pro: adjust the include path accordingly in the v8 case. Source/WebKit/qt: * Api/qwebpage.cpp: (QWebPage::javaScriptAlert): (QWebPage::javaScriptConfirm): (QWebPage::javaScriptPrompt): * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::setToolTip): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96421 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/JavaScriptCore/ChangeLog | 14 ++++++++ Source/JavaScriptCore/JavaScriptCore.pri | 1 + Source/JavaScriptCore/wtf/qt/UtilsQt.h | 37 ++++++++++++++++++++++ Source/JavaScriptCore/wtf/wtf.pri | 1 + Source/WebCore/ChangeLog | 14 ++++++++ Source/WebCore/WebCore.pro | 2 ++ Source/WebKit/qt/Api/qwebpage.cpp | 8 ++--- Source/WebKit/qt/ChangeLog | 16 ++++++++++ Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 4 +-- 9 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 Source/JavaScriptCore/wtf/qt/UtilsQt.h diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 79c7d64..121b309 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,17 @@ +2011-09-30 Pierre Rossi + + [Qt] Build fix: Qt::escape is deprecated in Qt5 + https://bugs.webkit.org/show_bug.cgi?id=69162 + + Use QString::toHtmlEscaped in the Qt5 case. + + Reviewed by Andreas Kling. + + * JavaScriptCore.pri: + * wtf/qt/UtilsQt.h: Added. + (escapeHtml): + * wtf/wtf.pri: + 2011-09-30 Yuqiang Xian Fix bug in getHostCallReturnValue of DFG JIT on X86 diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri index 618ee08..3db4c06 100644 --- a/Source/JavaScriptCore/JavaScriptCore.pri +++ b/Source/JavaScriptCore/JavaScriptCore.pri @@ -33,6 +33,7 @@ JAVASCRIPTCORE_INCLUDEPATH = \ $$PWD/runtime \ $$PWD/wtf \ $$PWD/wtf/gobject \ + $$PWD/wtf/qt \ $$PWD/wtf/symbian \ $$PWD/wtf/unicode \ $$PWD/yarr \ diff --git a/Source/JavaScriptCore/wtf/qt/UtilsQt.h b/Source/JavaScriptCore/wtf/qt/UtilsQt.h new file mode 100644 index 0000000..74067a8 --- /dev/null +++ b/Source/JavaScriptCore/wtf/qt/UtilsQt.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2011 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 WTF_UtilsQt_h +#define WTF_UtilsQt_h + +#include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#include +#endif + +inline QString escapeHtml(const QString& string) +{ +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + return string.toHtmlEscaped(); +#else + return Qt::escape(string); +#endif +} + +#endif // WTF_UtilsQt_h diff --git a/Source/JavaScriptCore/wtf/wtf.pri b/Source/JavaScriptCore/wtf/wtf.pri index 8ca7a58..6e50bb1 100644 --- a/Source/JavaScriptCore/wtf/wtf.pri +++ b/Source/JavaScriptCore/wtf/wtf.pri @@ -84,6 +84,7 @@ HEADERS += \ wtf/PassTraits.h \ wtf/Platform.h \ wtf/PossiblyNull.h \ + wtf/qt/UtilsQt.h \ wtf/RandomNumber.h \ wtf/RandomNumberSeed.h \ wtf/RedBlackTree.h \ diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 68afbdb..c368157 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2011-09-30 Pierre Rossi + + [Qt] Build fix: Qt::escape is deprecated in Qt5 + https://bugs.webkit.org/show_bug.cgi?id=69162 + + Use QString::toHtmlEscaped in the Qt5 case. + + Reviewed by Andreas Kling. + + No new tests needed. + + * WebCore.pro: adjust the include path accordingly + in the v8 case. + 2011-09-30 Ryosuke Niwa Remove unused ReplaceSelectionCommand::copyStyleToChildren diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro index ec2023c..33ee524 100644 --- a/Source/WebCore/WebCore.pro +++ b/Source/WebCore/WebCore.pro @@ -58,6 +58,8 @@ v8 { include($$PWD/../JavaScriptCore/yarr/yarr.pri) include($$PWD/../JavaScriptCore/wtf/wtf.pri) + INCLUDEPATH = $$PWD/../JavaScriptCore/wtf/qt $$INCLUDEPATH + SOURCES += \ platform/qt/PlatformSupportQt.cpp \ bindings/generic/BindingSecurityBase.cpp \ diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 376ee70..de18266 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -108,6 +108,7 @@ #include "SystemInfo.h" #endif // Q_OS_WIN32 #include "TextIterator.h" +#include "UtilsQt.h" #include "WebPlatformStrategies.h" #if USE(QTKIT) #include "WebSystemInterface.h" @@ -139,7 +140,6 @@ #include #include #include -#include #include #include #include @@ -2110,7 +2110,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) Q_UNUSED(frame) #ifndef QT_NO_MESSAGEBOX QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - QMessageBox::information(parent, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Ok); + QMessageBox::information(parent, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), escapeHtml(msg), QMessageBox::Ok); #endif } @@ -2127,7 +2127,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) return true; #else QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Yes, QMessageBox::No); + return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), escapeHtml(msg), QMessageBox::Yes, QMessageBox::No); #endif } @@ -2147,7 +2147,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr bool ok = false; #ifndef QT_NO_INPUTDIALOG QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - QString x = QInputDialog::getText(parent, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QLineEdit::Normal, defaultValue, &ok); + QString x = QInputDialog::getText(parent, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), escapeHtml(msg), QLineEdit::Normal, defaultValue, &ok); if (ok && result) *result = x; #endif diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 190ab1a..59958e5 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,19 @@ +2011-09-30 Pierre Rossi + + [Qt] Build fix: Qt::escape is deprecated in Qt5 + https://bugs.webkit.org/show_bug.cgi?id=69162 + + Use QString::toHtmlEscaped in the Qt5 case. + + Reviewed by Andreas Kling. + + * Api/qwebpage.cpp: + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::setToolTip): + 2011-09-23 Tor Arne Vestbø [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 993ff82..f64e454 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -74,9 +74,9 @@ #include "qwebview.h" #include #include -#include #include #include +#include #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) #include "FullScreenVideoQt.h" @@ -516,7 +516,7 @@ void ChromeClientQt::setToolTip(const String &tip, TextDirection) view->setToolTip(QString()); QToolTip::hideText(); } else { - QString dtip = QLatin1String("

") + Qt::escape(tip) + QLatin1String("

"); + QString dtip = QLatin1String("

") + escapeHtml(tip) + QLatin1String("

"); view->setToolTip(dtip); } #else -- 2.7.4