OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <objidl.h> | 8 #include <objidl.h> |
9 #include <mlang.h> | 9 #include <mlang.h> |
10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void SetJavaScriptFlags(const std::string& str) { | 77 void SetJavaScriptFlags(const std::string& str) { |
78 #if WEBKIT_USING_V8 | 78 #if WEBKIT_USING_V8 |
79 v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); | 79 v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); |
80 #endif | 80 #endif |
81 } | 81 } |
82 | 82 |
83 void EnableWebCoreNotImplementedLogging() { | 83 void EnableWebCoreNotImplementedLogging() { |
84 WebKit::enableLogChannel("NotYetImplemented"); | 84 WebKit::enableLogChannel("NotYetImplemented"); |
85 } | 85 } |
86 | 86 |
87 std::wstring DumpDocumentText(WebFrame* web_frame) { | 87 string16 DumpDocumentText(WebFrame* web_frame) { |
88 // We use the document element's text instead of the body text here because | 88 // We use the document element's text instead of the body text here because |
89 // not all documents have a body, such as XML documents. | 89 // not all documents have a body, such as XML documents. |
90 WebElement document_element = web_frame->document().documentElement(); | 90 WebElement document_element = web_frame->document().documentElement(); |
91 if (document_element.isNull()) | 91 if (document_element.isNull()) |
92 return std::wstring(); | 92 return string16(); |
93 | 93 |
94 return UTF16ToWideHack(document_element.innerText()); | 94 return document_element.innerText(); |
95 } | 95 } |
96 | 96 |
97 std::wstring DumpFramesAsText(WebFrame* web_frame, bool recursive) { | 97 string16 DumpFramesAsText(WebFrame* web_frame, bool recursive) { |
98 std::wstring result; | 98 string16 result; |
99 | 99 |
100 // Add header for all but the main frame. Skip empty frames. | 100 // Add header for all but the main frame. Skip empty frames. |
101 if (web_frame->parent() && | 101 if (web_frame->parent() && |
102 !web_frame->document().documentElement().isNull()) { | 102 !web_frame->document().documentElement().isNull()) { |
103 result.append(L"\n--------\nFrame: '"); | 103 result.append(ASCIIToUTF16("\n--------\nFrame: '")); |
104 result.append(UTF16ToWideHack(web_frame->name())); | 104 result.append(web_frame->name()); |
105 result.append(L"'\n--------\n"); | 105 result.append(ASCIIToUTF16("'\n--------\n")); |
106 } | 106 } |
107 | 107 |
108 result.append(DumpDocumentText(web_frame)); | 108 result.append(DumpDocumentText(web_frame)); |
109 result.append(L"\n"); | 109 result.append(ASCIIToUTF16("\n")); |
110 | 110 |
111 if (recursive) { | 111 if (recursive) { |
112 WebFrame* child = web_frame->firstChild(); | 112 WebFrame* child = web_frame->firstChild(); |
113 for (; child; child = child->nextSibling()) | 113 for (; child; child = child->nextSibling()) |
114 result.append(DumpFramesAsText(child, recursive)); | 114 result.append(DumpFramesAsText(child, recursive)); |
115 } | 115 } |
116 | 116 |
117 return result; | 117 return result; |
118 } | 118 } |
119 | 119 |
120 std::wstring DumpRenderer(WebFrame* web_frame) { | 120 string16 DumpRenderer(WebFrame* web_frame) { |
121 return UTF16ToWideHack(web_frame->renderTreeAsText()); | 121 return web_frame->renderTreeAsText(); |
122 } | 122 } |
123 | 123 |
124 bool CounterValueForElementById(WebFrame* web_frame, const std::string& id, | 124 bool CounterValueForElementById(WebFrame* web_frame, const std::string& id, |
125 std::wstring* counter_value) { | 125 std::wstring* counter_value) { |
126 WebString result = | 126 WebString result = |
127 web_frame->counterValueForElementById(WebString::fromUTF8(id)); | 127 web_frame->counterValueForElementById(WebString::fromUTF8(id)); |
128 if (result.isNull()) | 128 if (result.isNull()) |
129 return false; | 129 return false; |
130 | 130 |
131 *counter_value = UTF16ToWideHack(result); | 131 *counter_value = UTF16ToWideHack(result); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 NOTIMPLEMENTED(); | 416 NOTIMPLEMENTED(); |
417 return NULL; | 417 return NULL; |
418 #endif | 418 #endif |
419 } | 419 } |
420 | 420 |
421 int GetGlyphPageCount() { | 421 int GetGlyphPageCount() { |
422 return WebGlyphCache::pageCount(); | 422 return WebGlyphCache::pageCount(); |
423 } | 423 } |
424 | 424 |
425 } // namespace webkit_glue | 425 } // namespace webkit_glue |
OLD | NEW |