[qtwebkit] - fix for qt-4.6.x - add condition for rhel - enable shared for webkit build

Than Ngo than at fedoraproject.org
Tue May 24 12:05:50 UTC 2011


commit fb793c02c7136a1bd154656105ede895b2efcb55
Author: Than Ngo <than at redhat.com>
Date:   Tue May 24 14:05:06 2011 +0200

    - fix for qt-4.6.x
    - add condition for rhel
    - enable shared for webkit build

 qtwebkit.spec                      |   42 +++++-
 webkit-qtwebkit-2.2-shared.patch   |   12 ++
 webkit-qtwebkit-2.2tp1-qt46.patch  |  282 ++++++++++++++++++++++++++++++++++++
 webkit-qtwebkit-type-casting.patch |  264 ++-------------------------------
 4 files changed, 345 insertions(+), 255 deletions(-)
---
diff --git a/qtwebkit.spec b/qtwebkit.spec
index 50b0371..5a79791 100644
--- a/qtwebkit.spec
+++ b/qtwebkit.spec
@@ -18,13 +18,22 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 # search /usr/lib{,64}/mozilla/plugins-wrapped for browser plugins too
 Patch1: webkit-qtwebkit-2.2-tp1-pluginpath.patch
-# an attempt to make this work with qt-4.6.x too, work-in-progress
+
+# type casting
 Patch2: webkit-qtwebkit-type-casting.patch
-# include JavaScriptCore -debuginfo too 
+
+# include JavaScriptCore -debuginfo except on s390(x) during linking of libQtWebKit
 Patch3: webkit-qtwebkit-2.2-javascriptcore_debuginfo.patch
+
 # don't use -Werror
 Patch4: webkit-qtwebkit-2.2-no_Werror.patch
 
+# fix for qt-4.6.x 
+Patch5: webkit-qtwebkit-2.2tp1-qt46.patch
+
+# shared
+Patch6: webkit-qtwebkit-2.2-shared.patch
+
 BuildRequires: bison
 BuildRequires: chrpath
 BuildRequires: flex
@@ -41,10 +50,20 @@ BuildRequires: qt-mobility-devel >= 1.2
 %endif
 BuildRequires: sqlite-devel
 
+# Not used, gstreamer and qtmultimedia are preferred
+%if 0
+BuildRequires: phonon-devel
+Requires: qt4%{?_isa} >= %{_qt4_version}
+%global phonon_ver %(pkg-config --modversion phonon 2>/dev/null || echo 4.5.0)
+Requires: phonon%{?_isa} >= %{phonon_ver}
+%endif
+
+%if 0%{?fedora}
 Obsoletes: qt-webkit < 1:4.8.0
 Provides: qt-webkit = 2:%{version}-%{release}
 Provides: qt4-webkit = 2:%{version}-%{release}
 Provides: qt4-webkit%{?_isa} = 2:%{version}-%{release}
+%endif
 
 %description
 %{summary}
@@ -53,13 +72,16 @@ Provides: qt4-webkit%{?_isa} = 2:%{version}-%{release}
 Summary: Development files for %{name}
 Group: Development/Libraries
 Requires: %{name}%{?_isa} = %{version}-%{release}
+%if 0%{?fedora}
 # when qt_webkit_version.pri was moved from qt-devel => qt-webkit-devel
 Conflicts: qt-devel < 1:4.7.2-9
 Requires: qt4-devel
-Obsoletes: qt-webkit-devel < 1:4.8.0
+Obsoletes: qt-webkit-devel < 1:4.7.3
 Provides:  qt-webkit-devel = 2:%{version}-%{release}
 Provides:  qt4-webkit-devel = 2:%{version}-%{release}
 Provides:  qt4-webkit-devel%{?_isa} = 2:%{version}-%{release}
+%endif
+
 %description devel
 %{summary}.
 
@@ -69,12 +91,12 @@ Provides:  qt4-webkit-devel%{?_isa} = 2:%{version}-%{release}
 
 %patch1 -p1 -b .pluginpath
 %patch2 -p1 -b .type-cast
-# workaround memory exhaustion during linking of libQtWebKit on s390
 %ifnarch s390
 %patch3 -p1 -b .javascriptcore_debuginfo
 %endif
 %patch4 -p1 -b .no_Werror
-
+%patch5 -p1 -b .qt46
+%patch6 -p1 -b .shared
 
 %build 
 
@@ -98,9 +120,10 @@ make install INSTALL_ROOT=%{buildroot} -C WebKitBuild/Release
 ## HACK, there has to be a better way
 chrpath --list   %{buildroot}%{_qt4_libdir}/libQtWebKit.so.4.9.0 ||:
 chrpath --delete %{buildroot}%{_qt4_libdir}/libQtWebKit.so.4.9.0 ||:
+%if 0%{?fedora}
 chrpath --list   %{buildroot}%{_qt4_importdir}/QtWebKit/libqmlwebkitplugin.so ||:
 chrpath --delete %{buildroot}%{_qt4_importdir}/QtWebKit/libqmlwebkitplugin.so ||:
-
+%endif
 
 %clean
 rm -rf %{buildroot} 
@@ -114,7 +137,7 @@ rm -rf %{buildroot}
 %files
 %defattr(-,root,root,-)
 %{_qt4_libdir}/libQtWebKit.so.4*
-%{_qt4_importdir}/QtWebKit/
+%{?fedora:%{_qt4_importdir}/QtWebKit/}
 
 %files devel
 %defattr(-,root,root,-)
@@ -126,6 +149,11 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Tue May 24 2011 Than Ngo <than at redhat.com> - 2.2-3.20110513
+- fix for qt-4.6.x
+- add condition for rhel
+- enable shared for qtwebkit build
+
 * Thu May 19 2011 Rex Dieter <rdieter at fedoraproject.org> 2.2-2.20110513
 - bump up Obsoletes: qt-webkit a bit, to be on the safe side
 
diff --git a/webkit-qtwebkit-2.2-shared.patch b/webkit-qtwebkit-2.2-shared.patch
new file mode 100644
index 0000000..b745e98
--- /dev/null
+++ b/webkit-qtwebkit-2.2-shared.patch
@@ -0,0 +1,12 @@
+diff -up webkit-qtwebkit/Source/WebKit.pri.shared webkit-qtwebkit/Source/WebKit.pri
+--- webkit-qtwebkit/Source/WebKit.pri.shared	2011-05-24 11:17:56.000000000 +0200
++++ webkit-qtwebkit/Source/WebKit.pri	2011-05-24 11:19:09.000000000 +0200
+@@ -27,7 +27,7 @@ CONFIG(standalone_package): DEFINES *= N
+ CONFIG += depend_includepath
+ DEPENDPATH += $$OUT_PWD
+ 
+-DEFINES += BUILDING_QT__=1
++DEFINES += QT_SHARED BUILDING_QT__=1
+ building-libs {
+     win32-msvc*|win32-icc: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32
+ } else {
diff --git a/webkit-qtwebkit-2.2tp1-qt46.patch b/webkit-qtwebkit-2.2tp1-qt46.patch
new file mode 100644
index 0000000..52075ba
--- /dev/null
+++ b/webkit-qtwebkit-2.2tp1-qt46.patch
@@ -0,0 +1,282 @@
+diff -up webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp.type-cast webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp
+--- webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -1050,6 +1050,11 @@ void ContextMenuController::checkOrEnabl
+             shouldEnable = true;
+             break;
+ #endif
++#if PLATFORM(QT)
++        case ContextMenuItemTagSelectAll:
++            shouldEnable = true;
++            break;
++#endif
+         case ContextMenuItemTagUnderline: {
+             shouldCheck = frame->editor()->selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") != FalseTriState;
+             shouldEnable = frame->editor()->canEditRichly();
+diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
+--- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -73,8 +73,9 @@ FontPlatformData::FontPlatformData(const
+     font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing);
+     const bool smallCaps = description.smallCaps();
+     font.setCapitalization(smallCaps ? QFont::SmallCaps : QFont::MixedCase);
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     font.setStyleStrategy(QFont::ForceIntegerMetrics);
+-
++#endif
+     m_data->bold = font.bold();
+     // WebKit allows font size zero but QFont does not. We will return
+     // m_data->size if a font size of zero is requested and pixelSize()
+diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp
+--- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -186,17 +186,20 @@ static void drawTextCommon(GraphicsConte
+             p->restore();
+             return;
+         }
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+         int skipWidth = QFontMetrics(font).width(string, from, Qt::TextBypassShaping);
+         pt.setX(pt.x() + skipWidth);
+         string = fromRawDataWithoutRef(sanitized, from, to - from);
++#endif
+     }
+ 
+     p->setFont(font);
+ 
+     int flags = run.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     if (!isComplexText && !(ctx->textDrawingMode() & TextModeStroke))
+         flags |= Qt::TextBypassShaping;
+-
++#endif
+     QPainterPath textStrokePath;
+     if (ctx->textDrawingMode() & TextModeStroke)
+         textStrokePath.addText(pt, font, string);
+@@ -212,7 +215,11 @@ static void drawTextCommon(GraphicsConte
+                 p->restore();
+             } else {
+                 QFontMetrics fm(font);
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+                 QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1, flags), fm.height());
++#else
++                QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1), fm.height());
++#endif
+                 QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
+                 if (shadowPainter) {
+                     // Since it will be blurred anyway, we don't care about render hints.
+@@ -229,7 +236,11 @@ static void drawTextCommon(GraphicsConte
+                 p->translate(-ctxShadow->offset());
+             } else {
+                 QFontMetrics fm(font);
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+                 QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1, flags), fm.height());
++#else
++                QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1), fm.height());
++#endif
+                 QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
+                 if (shadowPainter) {
+                     // Since it will be blurred anyway, we don't care about render hints.
+@@ -254,7 +265,11 @@ static void drawTextCommon(GraphicsConte
+ 
+ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
+ {
+-    drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */true);
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
++    drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */false);
++#else
++    Q_ASSERT(false);
++#endif
+ }
+ 
+ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
+@@ -402,6 +417,7 @@ int Font::offsetForPositionForSimpleText
+ 
+ float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+ {
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     if (!primaryFont()->platformData().size())
+         return 0;
+ 
+@@ -418,11 +434,16 @@ float Font::floatWidthForSimpleText(cons
+         w -= m_wordSpacing;
+ 
+     return w + run.expansion();
++#else
++    Q_ASSERT(false);
++    return 0.0f;
++#endif
+ }
+ 
+ 
+ FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
+ {
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     String sanitized = Font::normalizeSpaces(run.characters(), run.length());
+     QString wholeText = fromRawDataWithoutRef(sanitized);
+     QString selectedText = fromRawDataWithoutRef(sanitized, from, qMin(to - from, wholeText.length() - from));
+@@ -431,6 +452,10 @@ FloatRect Font::selectionRectForSimpleTe
+     int width = QFontMetrics(font()).width(selectedText, -1, Qt::TextBypassShaping);
+ 
+     return FloatRect(pt.x() + startX, pt.y(), width, h);
++#else
++    Q_ASSERT(false);
++    return FloatRect();
++#endif
+ }
+ 
+ bool Font::canExpandAroundIdeographsInComplexText()
+diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+--- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -233,8 +233,11 @@ PassRefPtr<ByteArray> getImageData(const
+     ASSERT(!image.isNull());
+ 
+     const int bytesPerLine = image.bytesPerLine();
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     const uchar* bits = image.constBits();
+-
++#else
++    const uchar* bits = image.bits();
++#endif
+     quint32* destRows = reinterpret_cast_ptr<quint32*>(&data[desty * rect.width() * 4 + destx * 4]);
+ 
+     if (multiplied == Unmultiplied) {
+diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
+--- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -194,8 +194,15 @@ void ImageDecoderQt::internalReadImage(s
+ 
+ bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex)
+ {
+-    QPixmap pixmap = QPixmap::fromImageReader(m_reader.get());
++    QPixmap pixmap;
+ 
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
++    pixmap = QPixmap::fromImageReader(m_reader.get());
++#else
++    QImage img;
++    if (m_reader->read(&img))
++        pixmap = QPixmap::fromImage(img);
++#endif
+     if (pixmap.isNull()) {
+         frameCount();
+         repetitionCount();
+diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+--- webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -362,8 +362,10 @@ String QNetworkReplyHandler::httpMethod(
+         return "PUT";
+     case QNetworkAccessManager::DeleteOperation:
+         return "DELETE";
++#if QT_VERSION >= 0x040700
+     case QNetworkAccessManager::CustomOperation:
+         return m_resourceHandle->firstRequest().httpMethod();
++#endif
+     default:
+         ASSERT_NOT_REACHED();
+         return "GET";
+@@ -390,7 +392,11 @@ QNetworkReplyHandler::QNetworkReplyHandl
+     else if (r.httpMethod() == "DELETE")
+         m_method = QNetworkAccessManager::DeleteOperation;
+     else
++#if QT_VERSION >= 0x040700
+         m_method = QNetworkAccessManager::CustomOperation;
++#else
++        m_method = QNetworkAccessManager::UnknownOperation;
++#endif
+ 
+     QObject* originatingObject = 0;
+     if (m_resourceHandle->getInternal()->m_context)
+@@ -511,10 +517,16 @@ void QNetworkReplyHandler::sendResponseI
+         response.setHTTPStatusText(m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData());
+ 
+         // Add remaining headers.
+-        foreach (const QNetworkReply::RawHeaderPair& pair, m_replyWrapper->reply()->rawHeaderPairs())
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
++        foreach (const QNetworkReply::RawHeaderPair& pair, m_replyWrapper->reply()->rawHeaderPairs()) {
+             response.setHTTPHeaderField(QString::fromLatin1(pair.first), QString::fromLatin1(pair.second));
++        }
++#else
++        foreach (const QByteArray& headerName, m_replyWrapper->reply()->rawHeaderList()) {
++            response.setHTTPHeaderField(QString::fromAscii(headerName), QString::fromAscii(m_replyWrapper->reply()->rawHeader(headerName)));
++        }
++#endif
+     }
+-
+     QUrl redirection = m_replyWrapper->reply()->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
+     if (redirection.isValid()) {
+         redirect(response, redirection);
+@@ -641,8 +653,10 @@ QNetworkReply* QNetworkReplyHandler::sen
+         case QNetworkAccessManager::DeleteOperation: {
+             return manager->deleteResource(m_request);
+         }
++#if QT_VERSION >= 0x040700
+         case QNetworkAccessManager::CustomOperation:
+             return manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data());
++#endif
+         case QNetworkAccessManager::UnknownOperation:
+             ASSERT_NOT_REACHED();
+             return 0;
+diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
+--- webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp	2011-05-19 15:07:35.000000000 +0200
+@@ -82,13 +82,13 @@ QNetworkRequest ResourceRequest::toNetwo
+     default:
+         break;
+     }
+-
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     if (!allowCookies()) {
+         request.setAttribute(QNetworkRequest::CookieLoadControlAttribute, QNetworkRequest::Manual);
+         request.setAttribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Manual);
+         request.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual);
+     }
+-
++#endif
+     return request;
+ }
+ 
+diff -up webkit-qtwebkit/Source/WebKit/qt/Api/qwebframe.cpp.type-casting webkit-qtwebkit/Source/WebKit/qt/Api/qwebframe.cpp
+--- webkit-qtwebkit/Source/WebKit/qt/Api/qwebframe.cpp.type-casting	2011-05-24 09:55:43.000000000 +0200
++++ webkit-qtwebkit/Source/WebKit/qt/Api/qwebframe.cpp	2011-05-24 09:59:16.000000000 +0200
+@@ -907,9 +907,11 @@ void QWebFrame::load(const QNetworkReque
+         case QNetworkAccessManager::DeleteOperation:
+             request.setHTTPMethod("DELETE");
+             break;
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+         case QNetworkAccessManager::CustomOperation:
+             request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData());
+             break;
++#endif
+         case QNetworkAccessManager::UnknownOperation:
+             // eh?
+             break;
+diff -up webkit-qtwebkit/Source/WebKit/qt/Api/qwebsettings.cpp.type-casting webkit-qtwebkit/Source/WebKit/qt/Api/qwebsettings.cpp
+--- webkit-qtwebkit/Source/WebKit/qt/Api/qwebsettings.cpp.type-casting	2011-05-24 09:46:59.000000000 +0200
++++ webkit-qtwebkit/Source/WebKit/qt/Api/qwebsettings.cpp	2011-05-24 09:53:45.000000000 +0200
+@@ -480,16 +480,25 @@ QWebSettings::QWebSettings()
+     d->fontFamilies.insert(QWebSettings::StandardFont, defaultFont.defaultFamily());
+     d->fontFamilies.insert(QWebSettings::SerifFont, defaultFont.defaultFamily());
+ 
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     defaultFont.setStyleHint(QFont::Fantasy);
+     d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily());
+ 
+     defaultFont.setStyleHint(QFont::Cursive);
+     d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily());
++#else
++    d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily());
++    d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily());
++#endif
+ 
+     defaultFont.setStyleHint(QFont::SansSerif);
+     d->fontFamilies.insert(QWebSettings::SansSerifFont, defaultFont.defaultFamily());
+ 
++#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+     defaultFont.setStyleHint(QFont::Monospace);
++#else
++    defaultFont.setStyleHint(QFont::TypeWriter);
++#endif
+     d->fontFamilies.insert(QWebSettings::FixedFont, defaultFont.defaultFamily());
+ 
+     d->attributes.insert(QWebSettings::AutoLoadImages, true);
diff --git a/webkit-qtwebkit-type-casting.patch b/webkit-qtwebkit-type-casting.patch
index 10a83e0..80453f6 100644
--- a/webkit-qtwebkit-type-casting.patch
+++ b/webkit-qtwebkit-type-casting.patch
@@ -1,6 +1,6 @@
 diff -up webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp.type-cast webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp
---- webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp	2011-05-13 13:39:06.626230025 -0500
+--- webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -118,7 +118,7 @@ JSValue JSDocument::createTouchList(Exec
  {
      RefPtr<TouchList> touchList = TouchList::create();
@@ -11,8 +11,8 @@ diff -up webkit-qtwebkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp.type-ca
  
      return toJS(exec, globalObject(), touchList.release());
 diff -up webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp
---- webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp	2011-05-13 13:39:06.626230025 -0500
+--- webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -55,8 +55,8 @@ bool isCharacterSmartReplaceExempt(UChar
      const char prev[] = "([\"\'#$/-`{\0";
      const char next[] = ")].,;:?\'!\"%*-/}\0";
@@ -24,24 +24,9 @@ diff -up webkit-qtwebkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp.type-cast
            return true;
      }
  
-diff -up webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp.type-cast webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp
---- webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/page/ContextMenuController.cpp	2011-05-13 13:39:06.627229928 -0500
-@@ -1050,6 +1050,11 @@ void ContextMenuController::checkOrEnabl
-             shouldEnable = true;
-             break;
- #endif
-+#if PLATFORM(QT)
-+        case ContextMenuItemTagSelectAll:
-+            shouldEnable = true;
-+            break;
-+#endif
-         case ContextMenuItemTagUnderline: {
-             shouldCheck = frame->editor()->selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") != FalseTriState;
-             shouldEnable = frame->editor()->canEditRichly();
 diff -up webkit-qtwebkit/Source/WebCore/page/Frame.cpp.type-cast webkit-qtwebkit/Source/WebCore/page/Frame.cpp
---- webkit-qtwebkit/Source/WebCore/page/Frame.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/page/Frame.cpp	2011-05-13 13:39:06.627229928 -0500
+--- webkit-qtwebkit/Source/WebCore/page/Frame.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/page/Frame.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -969,7 +969,7 @@ void Frame::tiledBackingStorePaintEnd(co
          return;
      unsigned size = paintedArea.size();
@@ -51,137 +36,9 @@ diff -up webkit-qtwebkit/Source/WebCore/page/Frame.cpp.type-cast webkit-qtwebkit
          m_page->chrome()->invalidateContentsAndWindow(m_view->contentsToWindow(paintedArea[n]), false);
  }
  
-diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
---- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp	2011-05-13 13:39:06.627229928 -0500
-@@ -73,8 +73,9 @@ FontPlatformData::FontPlatformData(const
-     font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing);
-     const bool smallCaps = description.smallCaps();
-     font.setCapitalization(smallCaps ? QFont::SmallCaps : QFont::MixedCase);
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-     font.setStyleStrategy(QFont::ForceIntegerMetrics);
--
-+#endif
-     m_data->bold = font.bold();
-     // WebKit allows font size zero but QFont does not. We will return
-     // m_data->size if a font size of zero is requested and pixelSize()
-diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp
---- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/FontQt.cpp	2011-05-13 13:39:06.627229928 -0500
-@@ -186,17 +186,20 @@ static void drawTextCommon(GraphicsConte
-             p->restore();
-             return;
-         }
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-         int skipWidth = QFontMetrics(font).width(string, from, Qt::TextBypassShaping);
-         pt.setX(pt.x() + skipWidth);
-         string = fromRawDataWithoutRef(sanitized, from, to - from);
-+#endif
-     }
- 
-     p->setFont(font);
- 
-     int flags = run.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-     if (!isComplexText && !(ctx->textDrawingMode() & TextModeStroke))
-         flags |= Qt::TextBypassShaping;
--
-+#endif
-     QPainterPath textStrokePath;
-     if (ctx->textDrawingMode() & TextModeStroke)
-         textStrokePath.addText(pt, font, string);
-@@ -212,7 +215,11 @@ static void drawTextCommon(GraphicsConte
-                 p->restore();
-             } else {
-                 QFontMetrics fm(font);
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-                 QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1, flags), fm.height());
-+#else
-+                QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1), fm.height());
-+#endif
-                 QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
-                 if (shadowPainter) {
-                     // Since it will be blurred anyway, we don't care about render hints.
-@@ -229,7 +236,11 @@ static void drawTextCommon(GraphicsConte
-                 p->translate(-ctxShadow->offset());
-             } else {
-                 QFontMetrics fm(font);
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-                 QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1, flags), fm.height());
-+#else
-+                QRectF boundingRect(pt.x(), point.y() - fm.ascent(), fm.width(string, -1), fm.height());
-+#endif
-                 QPainter* shadowPainter = ctxShadow->beginShadowLayer(ctx, boundingRect);
-                 if (shadowPainter) {
-                     // Since it will be blurred anyway, we don't care about render hints.
-@@ -254,7 +265,11 @@ static void drawTextCommon(GraphicsConte
- 
- void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
- {
--    drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */true);
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-+    drawTextCommon(ctx, run, point, from, to, font(), /* isComplexText = */false);
-+#else
-+    Q_ASSERT(false);
-+#endif
- }
- 
- float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
-@@ -402,6 +417,7 @@ int Font::offsetForPositionForSimpleText
- 
- float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
- {
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-     if (!primaryFont()->platformData().size())
-         return 0;
- 
-@@ -418,11 +434,16 @@ float Font::floatWidthForSimpleText(cons
-         w -= m_wordSpacing;
- 
-     return w + run.expansion();
-+#else
-+    Q_ASSERT(false);
-+    return 0.0f;
-+#endif
- }
- 
- 
- FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
- {
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-     String sanitized = Font::normalizeSpaces(run.characters(), run.length());
-     QString wholeText = fromRawDataWithoutRef(sanitized);
-     QString selectedText = fromRawDataWithoutRef(sanitized, from, qMin(to - from, wholeText.length() - from));
-@@ -431,6 +452,10 @@ FloatRect Font::selectionRectForSimpleTe
-     int width = QFontMetrics(font()).width(selectedText, -1, Qt::TextBypassShaping);
- 
-     return FloatRect(pt.x() + startX, pt.y(), width, h);
-+#else
-+    Q_ASSERT(false);
-+    return FloatRect();
-+#endif
- }
- 
- bool Font::canExpandAroundIdeographsInComplexText()
-diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
---- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp	2011-05-13 13:39:06.628229831 -0500
-@@ -233,8 +233,11 @@ PassRefPtr<ByteArray> getImageData(const
-     ASSERT(!image.isNull());
- 
-     const int bytesPerLine = image.bytesPerLine();
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-     const uchar* bits = image.constBits();
--
-+#else
-+    const uchar* bits = image.bits();
-+#endif
-     quint32* destRows = reinterpret_cast_ptr<quint32*>(&data[desty * rect.width() * 4 + destx * 4]);
- 
-     if (multiplied == Unmultiplied) {
 diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
---- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp	2011-05-13 13:39:06.628229831 -0500
+--- webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -184,7 +184,7 @@ void ImageDecoderQt::internalReadImage(s
        setFailed();
  
@@ -191,26 +48,9 @@ diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp.
          if (m_frameBufferCache[i].status() != ImageFrame::FrameComplete)
              return;
      }
-@@ -194,8 +194,15 @@ void ImageDecoderQt::internalReadImage(s
- 
- bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex)
- {
--    QPixmap pixmap = QPixmap::fromImageReader(m_reader.get());
-+    QPixmap pixmap;
- 
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-+    pixmap = QPixmap::fromImageReader(m_reader.get());
-+#else
-+    QImage img;
-+    if (m_reader->read(&img))
-+        pixmap = QPixmap::fromImage(img);
-+#endif
-     if (pixmap.isNull()) {
-         frameCount();
-         repetitionCount();
 diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp
---- webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp	2011-05-13 13:39:06.628229831 -0500
+--- webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -76,8 +76,8 @@ void TiledBackingStore::invalidate(const
      Tile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
      Tile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(dirtyRect.maxX(), dirtyRect.maxY()));
@@ -245,8 +85,8 @@ diff -up webkit-qtwebkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp.
              if (tileAt(currentCoordinate))
                  continue;
 diff -up webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp
---- webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp	2011-05-13 13:39:06.628229831 -0500
+--- webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -223,7 +223,7 @@ const size_t imageTypesSize = sizeof(ima
  static inline size_t dataSizeNeededForImageSniffing()
  {
@@ -257,8 +97,8 @@ diff -up webkit-qtwebkit/Source/WebCore/platform/network/MIMESniffing.cpp.type-c
              result = imageTypes[i].size;
      }
 diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
---- webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp	2011-05-13 13:46:40.024092720 -0500
+--- webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -71,7 +71,7 @@ FormDataIODevice::~FormDataIODevice()
  
  qint64 FormDataIODevice::computeSize() 
@@ -277,62 +117,9 @@ diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler
                  moveToNextElement();
          } else {
              const QByteArray data = m_currentFile->read(available);
-@@ -362,8 +362,10 @@ String QNetworkReplyHandler::httpMethod(
-         return "PUT";
-     case QNetworkAccessManager::DeleteOperation:
-         return "DELETE";
-+#if QT_VERSION >= 0x040700
-     case QNetworkAccessManager::CustomOperation:
-         return m_resourceHandle->firstRequest().httpMethod();
-+#endif
-     default:
-         ASSERT_NOT_REACHED();
-         return "GET";
-@@ -390,7 +392,11 @@ QNetworkReplyHandler::QNetworkReplyHandl
-     else if (r.httpMethod() == "DELETE")
-         m_method = QNetworkAccessManager::DeleteOperation;
-     else
-+#if QT_VERSION >= 0x040700
-         m_method = QNetworkAccessManager::CustomOperation;
-+#else
-+        m_method = QNetworkAccessManager::UnknownOperation;
-+#endif
- 
-     QObject* originatingObject = 0;
-     if (m_resourceHandle->getInternal()->m_context)
-@@ -511,10 +517,16 @@ void QNetworkReplyHandler::sendResponseI
-         response.setHTTPStatusText(m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData());
- 
-         // Add remaining headers.
--        foreach (const QNetworkReply::RawHeaderPair& pair, m_replyWrapper->reply()->rawHeaderPairs())
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-+        foreach (const QNetworkReply::RawHeaderPair& pair, m_replyWrapper->reply()->rawHeaderPairs()) {
-             response.setHTTPHeaderField(QString::fromLatin1(pair.first), QString::fromLatin1(pair.second));
-+        }
-+#else
-+        foreach (const QByteArray& headerName, m_replyWrapper->reply()->rawHeaderList()) {
-+            response.setHTTPHeaderField(QString::fromAscii(headerName), QString::fromAscii(m_replyWrapper->reply()->rawHeader(headerName)));
-+        }
-+#endif
-     }
--
-     QUrl redirection = m_replyWrapper->reply()->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
-     if (redirection.isValid()) {
-         redirect(response, redirection);
-@@ -641,8 +653,10 @@ QNetworkReply* QNetworkReplyHandler::sen
-         case QNetworkAccessManager::DeleteOperation: {
-             return manager->deleteResource(m_request);
-         }
-+#if QT_VERSION >= 0x040700
-         case QNetworkAccessManager::CustomOperation:
-             return manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data());
-+#endif
-         case QNetworkAccessManager::UnknownOperation:
-             ASSERT_NOT_REACHED();
-             return 0;
 diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp
---- webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp	2011-05-13 13:39:06.629229734 -0500
+--- webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp.type-cast	2011-05-12 16:42:28.000000000 +0200
++++ webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp	2011-05-19 15:07:35.000000000 +0200
 @@ -44,7 +44,7 @@ bool QtMIMETypeSniffer::sniff()
      // See QNetworkReplyWrapper::setFinished().
      const bool isReplyFinished = m_reply->property("_q_isFinished").toBool();
@@ -342,22 +129,3 @@ diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cp
          return false;
  
      QByteArray data = m_reply->peek(m_sniffer.dataSize());
-diff -up webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp.type-cast webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
---- webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp.type-cast	2011-05-12 09:42:28.000000000 -0500
-+++ webkit-qtwebkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp	2011-05-13 13:39:06.629229734 -0500
-@@ -82,13 +82,13 @@ QNetworkRequest ResourceRequest::toNetwo
-     default:
-         break;
-     }
--
-+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-     if (!allowCookies()) {
-         request.setAttribute(QNetworkRequest::CookieLoadControlAttribute, QNetworkRequest::Manual);
-         request.setAttribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Manual);
-         request.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual);
-     }
--
-+#endif
-     return request;
- }
- 


More information about the scm-commits mailing list