Title: [99318] trunk
Revision
99318
Author
[email protected]
Date
2011-11-04 14:04:14 -0700 (Fri, 04 Nov 2011)

Log Message

[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.

Patch by Raphael Kubo da Costa <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (99317 => 99318)


--- trunk/Source/WebKit/efl/ChangeLog	2011-11-04 21:00:11 UTC (rev 99317)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-11-04 21:04:14 UTC (rev 99318)
@@ -1,3 +1,20 @@
+2011-11-04  Raphael Kubo da Costa  <[email protected]>
+
+        [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  <[email protected]>
 
         [EFL] Use standard booleand data type.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp (99317 => 99318)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2011-11-04 21:00:11 UTC (rev 99317)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2011-11-04 21:04:14 UTC (rev 99318)
@@ -343,10 +343,10 @@
 #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 @@
 
     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;

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h (99317 => 99318)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h	2011-11-04 21:00:11 UTC (rev 99317)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h	2011-11-04 21:04:14 UTC (rev 99318)
@@ -24,13 +24,13 @@
 #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 @@
     static size_t _javascript_ObjectsCount();
     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*);
 

Modified: trunk/Tools/ChangeLog (99317 => 99318)


--- trunk/Tools/ChangeLog	2011-11-04 21:00:11 UTC (rev 99317)
+++ trunk/Tools/ChangeLog	2011-11-04 21:04:14 UTC (rev 99318)
@@ -1,3 +1,20 @@
+2011-11-04  Raphael Kubo da Costa  <[email protected]>
+
+        [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  <[email protected]>
 
         [Qt] Remove ENABLE_SQLITE from qmake files

Modified: trunk/Tools/DumpRenderTree/efl/DumpHistoryItem.cpp (99317 => 99318)


--- trunk/Tools/DumpRenderTree/efl/DumpHistoryItem.cpp	2011-11-04 21:00:11 UTC (rev 99317)
+++ trunk/Tools/DumpRenderTree/efl/DumpHistoryItem.cpp	2011-11-04 21:04:14 UTC (rev 99318)
@@ -31,14 +31,22 @@
 #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 @@
         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)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to