summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/glue/webkit_glue.cc47
-rw-r--r--webkit/glue/webkit_glue.h9
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc4
-rw-r--r--webkit/tools/test_shell/test_shell.cc16
-rw-r--r--webkit/tools/test_shell/test_shell.h6
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_mac.mm2
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc2
8 files changed, 46 insertions, 42 deletions
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 45944fc..fe3edd9 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -122,13 +122,13 @@ string16 DumpRenderer(WebFrame* web_frame) {
}
bool CounterValueForElementById(WebFrame* web_frame, const std::string& id,
- std::wstring* counter_value) {
+ string16* counter_value) {
WebString result =
web_frame->counterValueForElementById(WebString::fromUTF8(id));
if (result.isNull())
return false;
- *counter_value = UTF16ToWideHack(result);
+ *counter_value = result;
return true;
}
@@ -151,19 +151,21 @@ int NumberOfPages(WebFrame* web_frame,
return number_of_pages;
}
-std::wstring DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) {
+string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) {
gfx::Size offset = web_frame->scrollOffset();
- std::wstring result;
+ std::string result_utf8;
if (offset.width() > 0 || offset.height() > 0) {
if (web_frame->parent()) {
- base::StringAppendF(&result, L"frame '%ls' ", UTF16ToWide(
- web_frame->name()).c_str());
+ base::StringAppendF(&result_utf8, "frame '%s' ",
+ UTF16ToUTF8(web_frame->name()).c_str());
}
- base::StringAppendF(&result, L"scrolled to %d,%d\n",
+ base::StringAppendF(&result_utf8, "scrolled to %d,%d\n",
offset.width(), offset.height());
}
+ string16 result = UTF8ToUTF16(result_utf8);
+
if (recursive) {
WebFrame* child = web_frame->firstChild();
for (; child; child = child->nextSibling())
@@ -183,16 +185,16 @@ static bool HistoryItemCompareLess(const WebHistoryItem& item1,
return target1 < target2;
}
-// Writes out a HistoryItem into a string in a readable format.
-static std::wstring DumpHistoryItem(const WebHistoryItem& item,
- int indent, bool is_current) {
- std::wstring result;
+// Writes out a HistoryItem into a UTF-8 string in a readable format.
+static std::string DumpHistoryItem(const WebHistoryItem& item,
+ int indent, bool is_current) {
+ std::string result;
if (is_current) {
- result.append(L"curr->");
- result.append(indent - 6, L' '); // 6 == L"curr->".length()
+ result.append("curr->");
+ result.append(indent - 6, ' '); // 6 == "curr->".length()
} else {
- result.append(indent, L' ');
+ result.append(indent, ' ');
}
std::string url = item.urlString().utf8();
@@ -207,12 +209,12 @@ static std::wstring DumpHistoryItem(const WebHistoryItem& item,
url.replace(kDataUrlPatternSize, url.length(), path);
}
- result.append(UTF8ToWide(url));
+ result.append(url);
if (!item.target().isEmpty())
- result.append(L" (in frame \"" + UTF16ToWide(item.target()) + L"\")");
+ result.append(" (in frame \"" + UTF16ToUTF8(item.target()) + "\")");
if (item.isTargetItem())
- result.append(L" **nav target**");
- result.append(L"\n");
+ result.append(" **nav target**");
+ result.append("\n");
const WebVector<WebHistoryItem>& children = item.children();
if (!children.isEmpty()) {
@@ -231,10 +233,11 @@ static std::wstring DumpHistoryItem(const WebHistoryItem& item,
return result;
}
-std::wstring DumpHistoryState(const std::string& history_state, int indent,
- bool is_current) {
- return DumpHistoryItem(HistoryItemFromString(history_state), indent,
- is_current);
+string16 DumpHistoryState(const std::string& history_state, int indent,
+ bool is_current) {
+ return UTF8ToUTF16(
+ DumpHistoryItem(HistoryItemFromString(history_state), indent,
+ is_current));
}
void ResetBeforeTestRun(WebView* view) {
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index d514984..728202b 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -64,7 +64,7 @@ string16 DumpRenderer(WebKit::WebFrame* web_frame);
// counter_value. Return false when the specified id doesn't exist.
bool CounterValueForElementById(WebKit::WebFrame* web_frame,
const std::string& id,
- std::wstring* counter_value);
+ string16* counter_value);
// Returns the number of page where the specified element will be put.
int PageNumberForElementById(WebKit::WebFrame* web_frame,
@@ -78,13 +78,12 @@ int NumberOfPages(WebKit::WebFrame* web_frame,
float page_height_in_pixels);
// Returns a dump of the scroll position of the webframe.
-std::wstring DumpFrameScrollPosition(WebKit::WebFrame* web_frame,
- bool recursive);
+string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive);
// Returns a dump of the given history state suitable for implementing the
// dumpBackForwardList command of the layoutTestController.
-std::wstring DumpHistoryState(const std::string& history_state, int indent,
- bool is_current);
+string16 DumpHistoryState(const std::string& history_state, int indent,
+ bool is_current);
// Cleans up state left over from the previous test run.
void ResetBeforeTestRun(WebKit::WebView* view);
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index 1918106..3ddfaab 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -1341,12 +1341,12 @@ void LayoutTestController::counterValueForElementById(
result->SetNull();
if (args.size() < 1 || !args[0].isString())
return;
- std::wstring counterValue;
+ string16 counterValue;
if (!webkit_glue::CounterValueForElementById(shell_->webView()->mainFrame(),
args[0].ToString(),
&counterValue))
return;
- result->Set(WideToUTF8(counterValue));
+ result->Set(UTF16ToUTF8(counterValue));
}
static bool ParsePageSizeParameters(const CppArgumentList& args,
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index fc4c7e7..96d5415 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -275,14 +275,14 @@ void TestShell::Dump(TestShell* shell) {
bool recursive = shell->layout_test_controller_->
ShouldDumpChildFrameScrollPositions();
- printf("%s", WideToUTF8(
+ printf("%s", UTF16ToUTF8(
webkit_glue::DumpFrameScrollPosition(frame, recursive)).c_str());
}
if (shell->layout_test_controller_->ShouldDumpBackForwardList()) {
- std::wstring bfDump;
+ string16 bfDump;
DumpAllBackForwardLists(&bfDump);
- printf("%s", WideToUTF8(bfDump).c_str());
+ printf("%s", UTF16ToUTF8(bfDump).c_str());
}
}
@@ -566,7 +566,7 @@ void TestShell::BindJSObjectsToWindow(WebFrame* frame) {
}
}
-void TestShell::DumpBackForwardEntry(int index, std::wstring* result) {
+void TestShell::DumpBackForwardEntry(int index, string16* result) {
int current_index = navigation_controller_->GetLastCommittedEntryIndex();
std::string content_state =
@@ -580,13 +580,15 @@ void TestShell::DumpBackForwardEntry(int index, std::wstring* result) {
webkit_glue::DumpHistoryState(content_state, 8, index == current_index));
}
-void TestShell::DumpBackForwardList(std::wstring* result) {
- result->append(L"\n============== Back Forward List ==============\n");
+void TestShell::DumpBackForwardList(string16* result) {
+ result->append(ASCIIToUTF16(
+ "\n============== Back Forward List ==============\n"));
for (int i = 0; i < navigation_controller_->GetEntryCount(); ++i)
DumpBackForwardEntry(i, result);
- result->append(L"===============================================\n");
+ result->append(ASCIIToUTF16(
+ "===============================================\n"));
}
void TestShell::CallJSGC() {
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h
index 61b7ff2..29d3d1f 100644
--- a/webkit/tools/test_shell/test_shell.h
+++ b/webkit/tools/test_shell/test_shell.h
@@ -260,13 +260,13 @@ public:
// Writes the back-forward list data for every open window into result.
// Should call DumpBackForwardListOfWindow on each TestShell window.
- static void DumpAllBackForwardLists(std::wstring* result);
+ static void DumpAllBackForwardLists(string16* result);
// Writes the single back-forward entry into result.
- void DumpBackForwardEntry(int index, std::wstring* result);
+ void DumpBackForwardEntry(int index, string16* result);
// Writes the back-forward list data for this test shell into result.
- void DumpBackForwardList(std::wstring* result);
+ void DumpBackForwardList(string16* result);
// Dumps the output from given test as text and/or image depending on
// the flags set.
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index 3c60fb6..38c0dad 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -487,7 +487,7 @@ void TestShell::ResizeSubViews() {
// GTK manages layout for us so we do nothing.
}
-/* static */ void TestShell::DumpAllBackForwardLists(std::wstring* result) {
+/* static */ void TestShell::DumpAllBackForwardLists(string16* result) {
result->clear();
for (WindowList::iterator iter = TestShell::windowList()->begin();
iter != TestShell::windowList()->end(); iter++) {
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm
index 8224af5..3f95276 100644
--- a/webkit/tools/test_shell/test_shell_mac.mm
+++ b/webkit/tools/test_shell/test_shell_mac.mm
@@ -525,7 +525,7 @@ void TestShell::ResizeSubViews() {
// handled by Cocoa for us
}
-/* static */ void TestShell::DumpAllBackForwardLists(std::wstring* result) {
+/* static */ void TestShell::DumpAllBackForwardLists(string16* result) {
result->clear();
for (WindowList::iterator iter = TestShell::windowList()->begin();
iter != TestShell::windowList()->end(); iter++) {
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index aba23fc..60a4b1a 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -227,7 +227,7 @@ ATOM TestShell::RegisterWindowClass() {
return RegisterClassEx(&wcex);
}
-void TestShell::DumpAllBackForwardLists(std::wstring* result) {
+void TestShell::DumpAllBackForwardLists(string16* result) {
result->clear();
for (WindowList::iterator iter = TestShell::windowList()->begin();
iter != TestShell::windowList()->end(); iter++) {