Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 9391: Enabled WebFrameTest, stubbed out a gtk test shell function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/logging.cc ('k') | webkit/tools/test_shell/SConscript » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 #include "Settings.h" 118 #include "Settings.h"
119 #include "SkiaUtils.h" 119 #include "SkiaUtils.h"
120 #include "SubstituteData.h" 120 #include "SubstituteData.h"
121 #include "TextIterator.h" 121 #include "TextIterator.h"
122 #include "TextAffinity.h" 122 #include "TextAffinity.h"
123 #include "XPathResult.h" 123 #include "XPathResult.h"
124 124
125 MSVC_POP_WARNING(); 125 MSVC_POP_WARNING();
126 126
127 #undef LOG 127 #undef LOG
128 #include "base/basictypes.h"
128 #include "base/gfx/bitmap_platform_device.h" 129 #include "base/gfx/bitmap_platform_device.h"
129 #include "base/gfx/platform_canvas.h" 130 #include "base/gfx/platform_canvas.h"
130 #include "base/gfx/rect.h" 131 #include "base/gfx/rect.h"
131 #include "base/logging.h" 132 #include "base/logging.h"
132 #include "base/message_loop.h" 133 #include "base/message_loop.h"
133 #include "base/stats_counters.h" 134 #include "base/stats_counters.h"
134 #include "base/string_util.h" 135 #include "base/string_util.h"
135 #include "base/time.h" 136 #include "base/time.h"
136 #include "net/base/net_errors.h" 137 #include "net/base/net_errors.h"
137 #include "webkit/glue/dom_operations.h" 138 #include "webkit/glue/dom_operations.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 RefPtr<Range> range(doc->createRange()); 217 RefPtr<Range> range(doc->createRange());
217 ExceptionCode exception = 0; 218 ExceptionCode exception = 0;
218 range->selectNodeContents(doc->body(), exception); 219 range->selectNodeContents(doc->body(), exception);
219 220
220 if (exception == 0) { 221 if (exception == 0) {
221 // The text iterator will walk nodes giving us text. This is similar to 222 // The text iterator will walk nodes giving us text. This is similar to
222 // the plainText() function in TextIterator.h, but we implement the maximum 223 // the plainText() function in TextIterator.h, but we implement the maximum
223 // size and also copy the results directly into a wstring, avoiding the 224 // size and also copy the results directly into a wstring, avoiding the
224 // string conversion. 225 // string conversion.
225 for (TextIterator it(range.get()); !it.atEnd(); it.advance()) { 226 for (TextIterator it(range.get()); !it.atEnd(); it.advance()) {
226 const wchar_t* chars = reinterpret_cast<const wchar_t*>(it.characters()); 227 const uint16* chars = reinterpret_cast<const uint16*>(it.characters());
227 if (!chars) { 228 if (!chars) {
228 if (it.length() != 0) { 229 if (it.length() != 0) {
229 // It appears from crash reports that an iterator can get into a state 230 // It appears from crash reports that an iterator can get into a state
230 // where the character count is nonempty but the character pointer is 231 // where the character count is nonempty but the character pointer is
231 // NULL. advance()ing it will then just add that many to the NULL 232 // NULL. advance()ing it will then just add that many to the NULL
232 // pointer which won't be caught in a NULL check but will crash. 233 // pointer which won't be caught in a NULL check but will crash.
233 // 234 //
234 // A NULL pointer and 0 length is common for some nodes. 235 // A NULL pointer and 0 length is common for some nodes.
235 // 236 //
236 // IF YOU CATCH THIS IN A DEBUGGER please let brettw know. We don't 237 // IF YOU CATCH THIS IN A DEBUGGER please let brettw know. We don't
237 // currently understand the conditions for this to occur. Ideally, the 238 // currently understand the conditions for this to occur. Ideally, the
238 // iterators would never get into the condition so we should fix them 239 // iterators would never get into the condition so we should fix them
239 // if we can. 240 // if we can.
240 NOTREACHED(); 241 NOTREACHED();
241 break; 242 break;
242 } 243 }
243 244
244 // Just got a NULL node, we can forge ahead! 245 // Just got a NULL node, we can forge ahead!
245 continue; 246 continue;
246 } 247 }
247 int to_append = std::min(it.length(), 248 int to_append = std::min(it.length(),
248 max_chars - static_cast<int>(output->size())); 249 max_chars - static_cast<int>(output->size()));
249 output->append(chars, to_append); 250 std::wstring wstr;
251 UTF16ToWide(reinterpret_cast<const char16*>(chars), to_append, &wstr);
252 output->append(wstr.c_str(), to_append);
250 if (output->size() >= static_cast<size_t>(max_chars)) 253 if (output->size() >= static_cast<size_t>(max_chars))
251 return; // Filled up the buffer. 254 return; // Filled up the buffer.
252 } 255 }
253 } 256 }
254 257
255 // Recursively walk the children. 258 // Recursively walk the children.
256 FrameTree* frame_tree = frame->tree(); 259 FrameTree* frame_tree = frame->tree();
257 for (Frame* cur_child = frame_tree->firstChild(); cur_child; 260 for (Frame* cur_child = frame_tree->firstChild(); cur_child;
258 cur_child = cur_child->tree()->nextSibling()) { 261 cur_child = cur_child->tree()->nextSibling()) {
259 // Make sure the frame separator won't fill up the buffer, and give up if 262 // Make sure the frame separator won't fill up the buffer, and give up if
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 if (loader) { 1890 if (loader) {
1888 return WebCore::FrameLoadTypeReloadAllowingStaleData == 1891 return WebCore::FrameLoadTypeReloadAllowingStaleData ==
1889 loader->policyLoadType(); 1892 loader->policyLoadType();
1890 } 1893 }
1891 return false; 1894 return false;
1892 } 1895 }
1893 1896
1894 int WebFrameImpl::PendingFrameUnloadEventCount() const { 1897 int WebFrameImpl::PendingFrameUnloadEventCount() const {
1895 return frame()->eventHandler()->pendingFrameUnloadEventCount(); 1898 return frame()->eventHandler()->pendingFrameUnloadEventCount();
1896 } 1899 }
OLDNEW
« no previous file with comments | « base/logging.cc ('k') | webkit/tools/test_shell/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698