| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 result.append(DumpFramesAsText(child, recursive)); | 128 result.append(DumpFramesAsText(child, recursive)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 return result; | 131 return result; |
| 132 } | 132 } |
| 133 | 133 |
| 134 string16 DumpRenderer(WebFrame* web_frame) { | 134 string16 DumpRenderer(WebFrame* web_frame) { |
| 135 return web_frame->renderTreeAsText(); | 135 return web_frame->renderTreeAsText(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 int NumberOfPages(WebFrame* web_frame, | |
| 139 float page_width_in_pixels, | |
| 140 float page_height_in_pixels) { | |
| 141 WebSize size(static_cast<int>(page_width_in_pixels), | |
| 142 static_cast<int>(page_height_in_pixels)); | |
| 143 | |
| 144 WebPrintParams print_params; | |
| 145 print_params.paperSize = size; | |
| 146 print_params.printContentArea = WebRect(0, 0, size.width, size.height); | |
| 147 print_params.printableArea = WebRect(0, 0, size.width, size.height); | |
| 148 | |
| 149 int number_of_pages = web_frame->printBegin(print_params); | |
| 150 web_frame->printEnd(); | |
| 151 return number_of_pages; | |
| 152 } | |
| 153 | |
| 154 string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { | 138 string16 DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { |
| 155 gfx::Size offset = web_frame->scrollOffset(); | 139 gfx::Size offset = web_frame->scrollOffset(); |
| 156 std::string result_utf8; | 140 std::string result_utf8; |
| 157 | 141 |
| 158 if (offset.width() > 0 || offset.height() > 0) { | 142 if (offset.width() > 0 || offset.height() > 0) { |
| 159 if (web_frame->parent()) { | 143 if (web_frame->parent()) { |
| 160 base::StringAppendF(&result_utf8, "frame '%s' ", | 144 base::StringAppendF(&result_utf8, "frame '%s' ", |
| 161 UTF16ToUTF8(web_frame->uniqueName()).c_str()); | 145 UTF16ToUTF8(web_frame->uniqueName()).c_str()); |
| 162 } | 146 } |
| 163 base::StringAppendF(&result_utf8, "scrolled to %d,%d\n", | 147 base::StringAppendF(&result_utf8, "scrolled to %d,%d\n", |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 case WebKit::WebReferrerPolicyOrigin: | 312 case WebKit::WebReferrerPolicyOrigin: |
| 329 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; | 313 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; |
| 330 break; | 314 break; |
| 331 } | 315 } |
| 332 request->set_referrer_policy(net_referrer_policy); | 316 request->set_referrer_policy(net_referrer_policy); |
| 333 } | 317 } |
| 334 | 318 |
| 335 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); | 319 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); |
| 336 | 320 |
| 337 } // namespace webkit_glue | 321 } // namespace webkit_glue |
| OLD | NEW |