Title: [131279] trunk/Source
Revision
131279
Author
[email protected]
Date
2012-10-14 16:39:58 -0700 (Sun, 14 Oct 2012)

Log Message

Move QDataStream functions into HistoryItemQt.cpp
https://bugs.webkit.org/show_bug.cgi?id=99203

Reviewed by Andreas Kling.

Source/WebCore:

It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
inside WebCore, so move them there. If in the future they are required elsewhere, they should
be moved into a separate header instead of polluting headers unnecessarily.

* history/qt/HistoryItemQt.cpp:
(operator<<):
(operator>>):
* platform/FractionalLayoutUnit.h:
* platform/graphics/IntPoint.h:

Source/WebKit2:

Forward declare QTransform.

* Shared/qt/WebEventFactoryQt.h:

Source/WTF:

It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
inside WebCore, so move them there. If in the future they are required elsewhere, they should
be moved into a separate header instead of polluting headers unnecessarily.

* wtf/Vector.h:
* wtf/qt/StringQt.cpp:
* wtf/text/WTFString.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (131278 => 131279)


--- trunk/Source/WTF/ChangeLog	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WTF/ChangeLog	2012-10-14 23:39:58 UTC (rev 131279)
@@ -1,3 +1,18 @@
+2012-10-12  Anders Carlsson  <[email protected]>
+
+        Move QDataStream functions into HistoryItemQt.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=99203
+
+        Reviewed by Andreas Kling.
+
+        It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
+        inside WebCore, so move them there. If in the future they are required elsewhere, they should
+        be moved into a separate header instead of polluting headers unnecessarily.
+
+        * wtf/Vector.h:
+        * wtf/qt/StringQt.cpp:
+        * wtf/text/WTFString.h:
+
 2012-10-12  Michael Saboff  <[email protected]>
 
         StringBuilder::append(StringBuilder&) doesn't take into account the bit size of the argument string

Modified: trunk/Source/WTF/wtf/Vector.h (131278 => 131279)


--- trunk/Source/WTF/wtf/Vector.h	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WTF/wtf/Vector.h	2012-10-14 23:39:58 UTC (rev 131279)
@@ -32,10 +32,6 @@
 #include <limits>
 #include <utility>
 
-#if PLATFORM(QT)
-#include <QDataStream>
-#endif
-
 namespace WTF {
 
     using std::min;
@@ -695,32 +691,6 @@
         Buffer m_buffer;
     };
 
-#if PLATFORM(QT)
-    template<typename T>
-    QDataStream& operator<<(QDataStream& stream, const Vector<T>& data)
-    {
-        stream << qint64(data.size());
-        foreach (const T& i, data)
-            stream << i;
-        return stream;
-    }
-
-    template<typename T>
-    QDataStream& operator>>(QDataStream& stream, Vector<T>& data)
-    {
-        data.clear();
-        qint64 count;
-        T item;
-        stream >> count;
-        data.reserveCapacity(count);
-        for (qint64 i = 0; i < count; ++i) {
-            stream >> item;
-            data.append(item);
-        }
-        return stream;
-    }
-#endif
-
     template<typename T, size_t inlineCapacity>
     Vector<T, inlineCapacity>::Vector(const Vector& other)
         : m_size(other.size())

Modified: trunk/Source/WTF/wtf/qt/StringQt.cpp (131278 => 131279)


--- trunk/Source/WTF/wtf/qt/StringQt.cpp	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WTF/wtf/qt/StringQt.cpp	2012-10-14 23:39:58 UTC (rev 131279)
@@ -70,22 +70,6 @@
     return QString(reinterpret_cast<const QChar*>(characters()), length());
 }
 
-QDataStream& operator<<(QDataStream& stream, const String& str)
-{
-    // could be faster
-    stream << QString(str);
-    return stream;
 }
 
-QDataStream& operator>>(QDataStream& stream, String& str)
-{
-    // mabe not the fastest way, but really easy
-    QString tmp;
-    stream >> tmp;
-    str = tmp;
-    return stream;
-}
-
-}
-
 // vim: ts=4 sw=4 et

Modified: trunk/Source/WTF/wtf/text/WTFString.h (131278 => 131279)


--- trunk/Source/WTF/wtf/text/WTFString.h	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WTF/wtf/text/WTFString.h	2012-10-14 23:39:58 UTC (rev 131279)
@@ -40,7 +40,6 @@
 QT_BEGIN_NAMESPACE
 class QString;
 QT_END_NAMESPACE
-#include <QDataStream>
 #endif
 
 #if PLATFORM(WX)
@@ -465,11 +464,6 @@
     RefPtr<StringImpl> m_impl;
 };
 
-#if PLATFORM(QT)
-QDataStream& operator<<(QDataStream& stream, const String& str);
-QDataStream& operator>>(QDataStream& stream, String& str);
-#endif
-
 inline bool operator==(const String& a, const String& b) { return equal(a.impl(), b.impl()); }
 inline bool operator==(const String& a, const LChar* b) { return equal(a.impl(), b); }
 inline bool operator==(const String& a, const char* b) { return equal(a.impl(), reinterpret_cast<const LChar*>(b)); }

Modified: trunk/Source/WebCore/ChangeLog (131278 => 131279)


--- trunk/Source/WebCore/ChangeLog	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WebCore/ChangeLog	2012-10-14 23:39:58 UTC (rev 131279)
@@ -1,3 +1,20 @@
+2012-10-12  Anders Carlsson  <[email protected]>
+
+        Move QDataStream functions into HistoryItemQt.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=99203
+
+        Reviewed by Andreas Kling.
+
+        It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
+        inside WebCore, so move them there. If in the future they are required elsewhere, they should
+        be moved into a separate header instead of polluting headers unnecessarily.
+
+        * history/qt/HistoryItemQt.cpp:
+        (operator<<):
+        (operator>>):
+        * platform/FractionalLayoutUnit.h:
+        * platform/graphics/IntPoint.h:
+
 2012-10-14  Sam Weinig  <[email protected]>
 
         Make UserScript and UserStyleSheet value objects that are copyable

Modified: trunk/Source/WebCore/history/qt/HistoryItemQt.cpp (131278 => 131279)


--- trunk/Source/WebCore/history/qt/HistoryItemQt.cpp	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WebCore/history/qt/HistoryItemQt.cpp	2012-10-14 23:39:58 UTC (rev 131279)
@@ -23,6 +23,61 @@
 #include "FormData.h"
 #include <wtf/text/CString.h>
 
+static QDataStream& operator<<(QDataStream& stream, const WebCore::IntPoint& point)
+{
+    stream << point.x() << point.y();
+    return stream;
+}
+
+static QDataStream& operator>>(QDataStream& stream, WebCore::IntPoint& point)
+{
+    int x, y;
+    stream >> x >> y;
+    point.setX(x);
+    point.setY(y);
+    return stream;
+}
+
+static QDataStream& operator<<(QDataStream& stream, const String& str)
+{
+    // could be faster
+    stream << QString(str);
+    return stream;
+}
+
+static QDataStream& operator>>(QDataStream& stream, String& str)
+{
+    // mabe not the fastest way, but really easy
+    QString tmp;
+    stream >> tmp;
+    str = tmp;
+    return stream;
+}
+
+template<typename T>
+QDataStream& operator<<(QDataStream& stream, const Vector<T>& data)
+{
+    stream << qint64(data.size());
+    foreach (const T& i, data)
+        stream << i;
+    return stream;
+}
+
+template<typename T>
+QDataStream& operator>>(QDataStream& stream, Vector<T>& data)
+{
+    data.clear();
+    qint64 count;
+    T item;
+    stream >> count;
+    data.reserveCapacity(count);
+    for (qint64 i = 0; i < count; ++i) {
+        stream >> item;
+        data.append(item);
+    }
+    return stream;
+}
+
 bool WebCore::HistoryItem::restoreState(QDataStream& in, int version)
 {
     // we only support version 1 for now

Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (131278 => 131279)


--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h	2012-10-14 23:39:58 UTC (rev 131279)
@@ -38,10 +38,6 @@
 #include <wtf/MathExtras.h>
 #include <wtf/SaturatedArithmetic.h>
 
-#if PLATFORM(QT)
-#include <QDataStream>
-#endif
-
 namespace WebCore {
 
 #ifdef NDEBUG
@@ -824,26 +820,6 @@
     return (fraction + size).round() - fraction.round();
 }
 
-#if PLATFORM(QT)
-inline QDataStream& operator<<(QDataStream& stream, const FractionalLayoutUnit& value)
-{
-    if (kFixedPointDenominator == 1)
-        stream << value.rawValue();
-    else
-        stream << QString::fromLatin1("%1").arg(value.toFloat(), 0, 'f', 2);
-
-    return stream;
-}
-
-inline QDataStream& operator>>(QDataStream& stream, FractionalLayoutUnit& value)
-{
-    float v;
-    stream >> v;
-    value = v;
-    return stream;
-}
-#endif
-
 } // namespace WebCore
 
 #endif // FractionalLayoutUnit_h

Modified: trunk/Source/WebCore/platform/graphics/IntPoint.h (131278 => 131279)


--- trunk/Source/WebCore/platform/graphics/IntPoint.h	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WebCore/platform/graphics/IntPoint.h	2012-10-14 23:39:58 UTC (rev 131279)
@@ -29,10 +29,6 @@
 #include "IntSize.h"
 #include <wtf/MathExtras.h>
 
-#if PLATFORM(QT)
-#include <QDataStream>
-#endif
-
 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
 typedef struct CGPoint CGPoint;
 #endif
@@ -229,23 +225,6 @@
     return ((*this) - point).diagonalLengthSquared();
 }
 
-#if PLATFORM(QT)
-inline QDataStream& operator<<(QDataStream& stream, const IntPoint& point)
-{
-    stream << point.x() << point.y();
-    return stream;
-}
-
-inline QDataStream& operator>>(QDataStream& stream, IntPoint& point)
-{
-    int x, y;
-    stream >> x >> y;
-    point.setX(x);
-    point.setY(y);
-    return stream;
-}
-#endif
-
 } // namespace WebCore
 
 #endif // IntPoint_h

Modified: trunk/Source/WebKit2/ChangeLog (131278 => 131279)


--- trunk/Source/WebKit2/ChangeLog	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-14 23:39:58 UTC (rev 131279)
@@ -1,3 +1,14 @@
+2012-10-14  Anders Carlsson  <[email protected]>
+
+        Move QDataStream functions into HistoryItemQt.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=99203
+
+        Reviewed by Andreas Kling.
+
+        Forward declare QTransform.
+
+        * Shared/qt/WebEventFactoryQt.h:
+
 2012-10-12  Anders Carlsson  <[email protected]>
 
         Explicitly mark messages variadic

Modified: trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.h (131278 => 131279)


--- trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.h	2012-10-14 23:21:31 UTC (rev 131278)
+++ trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.h	2012-10-14 23:39:58 UTC (rev 131279)
@@ -38,6 +38,7 @@
 class QMouseEvent;
 class QWheelEvent;
 class QKeyEvent;
+class QTransform;
 
 QT_END_NAMESPACE
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to