[EFL] DRT: Fix the order of the items in the dumped history list.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2011 21:04:14 +0000 (21:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2011 21:04:14 +0000 (21:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71562

It did not make much sense to hold the history list in a map, as we do not need
the keys. And the printed items must be sorted by target, which is more easily
done with a vector.

Should make tests such as http/tests/navigation/error404-frames.html pass.

Patch by Raphael Kubo da Costa <kubo@profusion.mobi> on 2011-11-04
Reviewed by Antonio Gomes.

Source/WebKit/efl:

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::childHistoryItems):
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Tools:

* DumpRenderTree/efl/DumpHistoryItem.cpp:
(compareHistoryItemsByTarget):
(dumpHistoryItem):

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

Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h
Tools/ChangeLog
Tools/DumpRenderTree/efl/DumpHistoryItem.cpp

index a3c6af8..158c9d5 100755 (executable)
@@ -1,3 +1,20 @@
+2011-11-04  Raphael Kubo da Costa  <kubo@profusion.mobi>
+
+        [EFL] DRT: Fix the order of the items in the dumped history list.
+        https://bugs.webkit.org/show_bug.cgi?id=71562
+
+        It did not make much sense to hold the history list in a map, as we do not need
+        the keys. And the printed items must be sorted by target, which is more easily
+        done with a vector.
+
+        Should make tests such as http/tests/navigation/error404-frames.html pass.
+
+        Reviewed by Antonio Gomes.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::childHistoryItems):
+        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
+
 2011-11-04  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         [EFL] Use standard booleand data type.
index edeb61f..b7f28d8 100644 (file)
@@ -343,10 +343,10 @@ unsigned DumpRenderTreeSupportEfl::workerThreadCount()
 #endif
 }
 
-HistoryItemChildrenMap DumpRenderTreeSupportEfl::childHistoryItems(const Ewk_History_Item* ewkHistoryItem)
+HistoryItemChildrenVector DumpRenderTreeSupportEfl::childHistoryItems(const Ewk_History_Item* ewkHistoryItem)
 {
     WebCore::HistoryItem* historyItem = EWKPrivate::coreHistoryItem(ewkHistoryItem);
-    HistoryItemChildrenMap kids;
+    HistoryItemChildrenVector kids;
 
     if (!historyItem)
         return kids;
@@ -356,7 +356,7 @@ HistoryItemChildrenMap DumpRenderTreeSupportEfl::childHistoryItems(const Ewk_His
 
     for (unsigned i = 0; i < size; ++i) {
         Ewk_History_Item* kid = ewk_history_item_new_from_core(children[i].get());
-        kids.set(DumpRenderTreeSupportEfl::historyItemTarget(kid), kid);
+        kids.append(kid);
     }
 
     return kids;
index 5e567d6..d6f25ff 100644 (file)
 #include <Eina.h>
 #include <FindOptions.h>
 #include <IntRect.h>
-#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 typedef struct _Evas_Object Evas_Object;
 typedef struct _Ewk_History_Item Ewk_History_Item;
 
-typedef HashMap<String, Ewk_History_Item*> HistoryItemChildrenMap;
+typedef Vector<Ewk_History_Item*> HistoryItemChildrenVector;
 
 namespace WebCore {
 class Frame;
@@ -69,7 +69,7 @@ public:
     static size_t javaScriptObjectsCount();
     static unsigned workerThreadCount();
 
-    static HistoryItemChildrenMap childHistoryItems(const Ewk_History_Item*);
+    static HistoryItemChildrenVector childHistoryItems(const Ewk_History_Item*);
     static String historyItemTarget(const Ewk_History_Item*);
     static bool isTargetItem(const Ewk_History_Item*);
 
index 02ebf8f..73d3d27 100644 (file)
@@ -1,3 +1,20 @@
+2011-11-04  Raphael Kubo da Costa  <kubo@profusion.mobi>
+
+        [EFL] DRT: Fix the order of the items in the dumped history list.
+        https://bugs.webkit.org/show_bug.cgi?id=71562
+
+        It did not make much sense to hold the history list in a map, as we do not need
+        the keys. And the printed items must be sorted by target, which is more easily
+        done with a vector.
+
+        Should make tests such as http/tests/navigation/error404-frames.html pass.
+
+        Reviewed by Antonio Gomes.
+
+        * DumpRenderTree/efl/DumpHistoryItem.cpp:
+        (compareHistoryItemsByTarget):
+        (dumpHistoryItem):
+
 2011-11-04  Patrick Gansterer  <paroga@webkit.org>
 
         [Qt] Remove ENABLE_SQLITE from qmake files
index fa6f3bb..125b128 100644 (file)
 #include "WebCoreSupport/DumpRenderTreeSupportEfl.h"
 #include "ewk_private.h"
 #include <EWebKit.h>
+#include <algorithm>
 #include <cstdio>
 #include <wtf/HashMap.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 Ewk_History_Item* prevTestBFItem = 0;
 const unsigned historyItemIndent = 8;
 
+static bool compareHistoryItemsByTarget(const Ewk_History_Item* item1, const Ewk_History_Item* item2)
+{
+    return WTF::codePointCompare(DumpRenderTreeSupportEfl::historyItemTarget(item1),
+                                 DumpRenderTreeSupportEfl::historyItemTarget(item2)) < 1;
+}
+
 static void dumpHistoryItem(const Ewk_History_Item* item, int indent, bool current)
 {
     ASSERT(item);
@@ -68,9 +76,14 @@ static void dumpHistoryItem(const Ewk_History_Item* item, int indent, bool curre
         printf("  **nav target**");
     putchar('\n');
 
-    const HistoryItemChildrenMap children = DumpRenderTreeSupportEfl::childHistoryItems(item);
-    for (HistoryItemChildrenMap::const_iterator it = children.begin(); it != children.end(); ++it)
-        dumpHistoryItem((*it).second, indent + 4, false);
+    HistoryItemChildrenVector children = DumpRenderTreeSupportEfl::childHistoryItems(item);
+
+    // Must sort to eliminate arbitrary result ordering which defeats reproducible testing.
+    std::stable_sort(children.begin(), children.end(), compareHistoryItemsByTarget);
+
+    const size_t size = children.size();
+    for (size_t i = 0; i < size; ++i)
+        dumpHistoryItem(children[i], indent + 4, false);
 }
 
 static void dumpBackForwardListForWebView(Evas_Object* view)