2011-03-27 Benjamin Poulain <benjamin.poulain@nokia.com>

        Reviewed by Andreas Kling.

        [Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled
        https://bugs.webkit.org/show_bug.cgi?id=57087

        Use explicit conversion for string to avoid depending on the default codec
        installed by the user code.

        * Api/qwebkitversion.cpp:
        (qWebKitVersion):
        * Api/qwebpage.cpp:
        (QWebPagePrivate::dynamicPropertyChangeEvent):
        (QWebPage::javaScriptConsoleMessage):
        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
        (convertToPropertyName):
        (DumpRenderTreeSupportQt::setEditingBehavior):
        (DumpRenderTreeSupportQt::plainText):
        * WebCoreSupport/EditorClientQt.cpp:
        (dumpRange):
        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (drtDescriptionSuitableForTestResult):
        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
        * WebCoreSupport/InspectorClientQt.cpp:
        (WebCore::InspectorClientQt::openInspectorFrontend):
        * WebCoreSupport/InspectorServerQt.cpp:
        (WebCore::parseWebSocketChallengeNumber):
        (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):

git-svn-id: svn://svn.chromium.org/blink/trunk@82059 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 427c63a4
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
*/ */
QString qWebKitVersion() QString qWebKitVersion()
{ {
return QString("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION); return QString::fromLatin1("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION);
} }
/*! /*!
......
...@@ -1168,7 +1168,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev ...@@ -1168,7 +1168,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev
QString p = q->property("_q_RepaintThrottlingPreset").toString(); QString p = q->property("_q_RepaintThrottlingPreset").toString();
for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) {
if(p == presets[i].name) { if (p == QLatin1String(presets[i].name)) {
FrameView::setRepaintThrottlingDeferredRepaintDelay( FrameView::setRepaintThrottlingDeferredRepaintDelay(
presets[i].deferredRepaintDelay); presets[i].deferredRepaintDelay);
FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading( FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(
...@@ -2073,7 +2073,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, ...@@ -2073,7 +2073,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber,
// Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html
// At this point DRT's WebPage has already been destroyed // At this point DRT's WebPage has already been destroyed
if (QWebPagePrivate::drtRun) { if (QWebPagePrivate::drtRun) {
if (message == "PLUGIN: NPP_Destroy") if (message == QLatin1String("PLUGIN: NPP_Destroy"))
fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData()); fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData());
} }
} }
......
2011-03-27 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Andreas Kling.
[Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled
https://bugs.webkit.org/show_bug.cgi?id=57087
Use explicit conversion for string to avoid depending on the default codec
installed by the user code.
* Api/qwebkitversion.cpp:
(qWebKitVersion):
* Api/qwebpage.cpp:
(QWebPagePrivate::dynamicPropertyChangeEvent):
(QWebPage::javaScriptConsoleMessage):
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(convertToPropertyName):
(DumpRenderTreeSupportQt::setEditingBehavior):
(DumpRenderTreeSupportQt::plainText):
* WebCoreSupport/EditorClientQt.cpp:
(dumpRange):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(drtDescriptionSuitableForTestResult):
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientQt::openInspectorFrontend):
* WebCoreSupport/InspectorServerQt.cpp:
(WebCore::parseWebSocketChallengeNumber):
(WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
2011-03-26 Andreas Kling <kling@webkit.org> 2011-03-26 Andreas Kling <kling@webkit.org>
Reviewed by Kenneth Rohde Christiansen. Reviewed by Kenneth Rohde Christiansen.
......
...@@ -531,7 +531,7 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt ...@@ -531,7 +531,7 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt
static QString convertToPropertyName(const QString& name) static QString convertToPropertyName(const QString& name)
{ {
QStringList parts = name.split('-'); QStringList parts = name.split(QLatin1Char('-'));
QString camelCaseName; QString camelCaseName;
for (int j = 0; j < parts.count(); ++j) { for (int j = 0; j < parts.count(); ++j) {
QString part = parts.at(j); QString part = parts.at(j);
...@@ -626,11 +626,11 @@ void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString& ...@@ -626,11 +626,11 @@ void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString&
{ {
WebCore::EditingBehaviorType coreEditingBehavior; WebCore::EditingBehaviorType coreEditingBehavior;
if (editingBehavior == "win") if (editingBehavior == QLatin1String("win"))
coreEditingBehavior = EditingWindowsBehavior; coreEditingBehavior = EditingWindowsBehavior;
else if (editingBehavior == "mac") else if (editingBehavior == QLatin1String("mac"))
coreEditingBehavior = EditingMacBehavior; coreEditingBehavior = EditingMacBehavior;
else if (editingBehavior == "unix") else if (editingBehavior == QLatin1String("unix"))
coreEditingBehavior = EditingUnixBehavior; coreEditingBehavior = EditingUnixBehavior;
else { else {
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
...@@ -923,10 +923,10 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti ...@@ -923,10 +923,10 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti
QString DumpRenderTreeSupportQt::plainText(const QVariant& range) QString DumpRenderTreeSupportQt::plainText(const QVariant& range)
{ {
QMap<QString, QVariant> map = range.toMap(); QMap<QString, QVariant> map = range.toMap();
QVariant startContainer = map.value("startContainer"); QVariant startContainer = map.value(QLatin1String("startContainer"));
map = startContainer.toMap(); map = startContainer.toMap();
return map.value("innerText").toString(); return map.value(QLatin1String("innerText")).toString();
} }
QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
......
...@@ -76,9 +76,9 @@ static QString dumpRange(WebCore::Range *range) ...@@ -76,9 +76,9 @@ static QString dumpRange(WebCore::Range *range)
return QLatin1String("(null)"); return QLatin1String("(null)");
WebCore::ExceptionCode code; WebCore::ExceptionCode code;
QString str = QString("range from %1 of %2 to %3 of %4") QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4")
.arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code))) .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
.arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code))); .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
return str; return str;
} }
......
...@@ -122,7 +122,7 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url) ...@@ -122,7 +122,7 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url)
if (_url.isEmpty() || !_url.isLocalFile()) if (_url.isEmpty() || !_url.isLocalFile())
return _url.string(); return _url.string();
// Remove the leading path from file urls // Remove the leading path from file urls
return QString(_url.string()).replace(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath, "").mid(1); return QString(_url.string()).remove(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath).mid(1);
} }
static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& error) static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& error)
...@@ -150,17 +150,17 @@ static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> n ...@@ -150,17 +150,17 @@ static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> n
{ {
QString result; QString result;
if (exception) { if (exception) {
result.append("ERROR"); result.append(QLatin1String("ERROR"));
return result; return result;
} }
if (!node) { if (!node) {
result.append("NULL"); result.append(QLatin1String("NULL"));
return result; return result;
} }
result.append(node->nodeName()); result.append(node->nodeName());
RefPtr<WebCore::Node> parent = node->parentNode(); RefPtr<WebCore::Node> parent = node->parentNode();
if (parent) { if (parent) {
result.append(" > "); result.append(QLatin1String(" > "));
result.append(drtDescriptionSuitableForTestResult(parent, 0)); result.append(drtDescriptionSuitableForTestResult(parent, 0));
} }
return result; return result;
...@@ -1229,7 +1229,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun ...@@ -1229,7 +1229,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n", printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n",
qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()), qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
(node) ? qPrintable(QString(" originating from " + drtDescriptionSuitableForTestResult(node, 0))) : ""); (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
if (policyDelegatePermissive) if (policyDelegatePermissive)
result = PolicyUse; result = PolicyUse;
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
QVariant valueToStore = settingToVariant(value); QVariant valueToStore = settingToVariant(value);
QString settingKey(settingStoragePrefix + QString(name)); QString settingKey(settingStoragePrefix + QString(name));
qsettings.setValue(settingKey, valueToStore); qsettings.setValue(settingKey, valueToStore);
qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); qsettings.setValue(settingKey + settingStorageTypeSuffix, QLatin1String(QVariant::typeToName(valueToStore.type())));
#endif // QT_NO_SETTINGS #endif // QT_NO_SETTINGS
} }
...@@ -220,7 +220,7 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* insp ...@@ -220,7 +220,7 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* insp
inspectorUrl = inspector->property("_q_inspectorUrl").toUrl(); inspectorUrl = inspector->property("_q_inspectorUrl").toUrl();
#endif #endif
if (!inspectorUrl.isValid()) if (!inspectorUrl.isValid())
inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html"); inspectorUrl = QUrl(QLatin1String("qrc:/webkit/inspector/inspector.html"));
#ifndef QT_NO_PROPERTIES #ifndef QT_NO_PROPERTIES
QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects"); QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects");
......
...@@ -73,11 +73,10 @@ static quint32 parseWebSocketChallengeNumber(QString field) ...@@ -73,11 +73,10 @@ static quint32 parseWebSocketChallengeNumber(QString field)
int numSpaces = 0; int numSpaces = 0;
for (int i = 0; i < field.size(); i++) { for (int i = 0; i < field.size(); i++) {
QChar c = field[i]; QChar c = field[i];
if (c == (QChar)' ') { if (c == QLatin1Char(' '))
numSpaces++; numSpaces++;
} else if ((c >= (QChar)'0') && (c <= (QChar)'9')) { else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9')))
nString.append((QChar)c); nString.append(c);
}
} }
quint32 num = nString.toLong(); quint32 num = nString.toLong();
quint32 result = (numSpaces ? (num / numSpaces) : num); quint32 result = (numSpaces ? (num / numSpaces) : num);
...@@ -195,7 +194,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() ...@@ -195,7 +194,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
m_path = header.path(); m_path = header.path();
m_contentType = header.contentType().toLatin1(); m_contentType = header.contentType().toLatin1();
m_contentLength = header.contentLength(); m_contentLength = header.contentLength();
if (header.hasKey("Upgrade") && (header.value("Upgrade") == QLatin1String("WebSocket"))) if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket")))
isWebSocket = true; isWebSocket = true;
m_data.clear(); m_data.clear();
...@@ -204,9 +203,9 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() ...@@ -204,9 +203,9 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
} }
if (m_endOfHeaders) { if (m_endOfHeaders) {
QStringList pathAndQuery = m_path.split("?"); QStringList pathAndQuery = m_path.split(QLatin1Char('?'));
m_path = pathAndQuery[0]; m_path = pathAndQuery[0];
QStringList words = m_path.split(QString::fromLatin1("/")); QStringList words = m_path.split(QLatin1Char('/'));
if (isWebSocket) { if (isWebSocket) {
// switch to websocket-style WebSocketService messaging // switch to websocket-style WebSocketService messaging
...@@ -216,18 +215,18 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() ...@@ -216,18 +215,18 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
QByteArray key3 = m_tcpConnection->read(8); QByteArray key3 = m_tcpConnection->read(8);
quint32 number1 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key1")); quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1")));
quint32 number2 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key2")); quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2")));
char responseData[16]; char responseData[16];
generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData); generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData);
QByteArray response(responseData, sizeof(responseData)); QByteArray response(responseData, sizeof(responseData));
QHttpResponseHeader responseHeader(101, "WebSocket Protocol Handshake", 1, 1); QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1);
responseHeader.setValue("Upgrade", header.value("Upgrade")); responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade")));
responseHeader.setValue("Connection", header.value("Connection")); responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection")));
responseHeader.setValue("Sec-WebSocket-Origin", header.value("Origin")); responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin")));
responseHeader.setValue("Sec-WebSocket-Location", ("ws://" + header.value("Host") + m_path)); responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
responseHeader.setContentLength(response.size()); responseHeader.setContentLength(response.size());
m_tcpConnection->write(responseHeader.toString().toLatin1()); m_tcpConnection->write(responseHeader.toString().toLatin1());
m_tcpConnection->write(response); m_tcpConnection->write(response);
...@@ -259,19 +258,19 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() ...@@ -259,19 +258,19 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
QString text = QString::fromLatin1("OK"); QString text = QString::fromLatin1("OK");
// If no path is specified, generate an index page. // If no path is specified, generate an index page.
if ((m_path == "") || (m_path == "/")) { if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) {
QString indexHtml = "<html><head><title>Remote Web Inspector</title></head><body><ul>\n"; QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n");
for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin();
it != m_server->m_inspectorClients.end(); it != m_server->m_inspectorClients.end();
++it) { ++it) {
indexHtml.append(QString("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n") indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
.arg(it.key()) .arg(it.key())
.arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString())); .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString()));
} }
indexHtml.append("</ul></body></html>"); indexHtml.append(QLatin1String("</ul></body></html>"));
response = indexHtml.toLatin1(); response = indexHtml.toLatin1();
} else { } else {
QString path = QString(":%1").arg(m_path); QString path = QString::fromLatin1(":%1").arg(m_path);
QFile file(path); QFile file(path);
// It seems that there should be an enum or define for these status codes somewhere in Qt or WebKit, // It seems that there should be an enum or define for these status codes somewhere in Qt or WebKit,
// but grep fails to turn one up. // but grep fails to turn one up.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment