| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 WebFrame* frame) { | 457 WebFrame* frame) { |
| 458 #if defined(OS_WIN) | 458 #if defined(OS_WIN) |
| 459 // Generate a memory-based EMF file. The EMF will use the current screen's | 459 // Generate a memory-based EMF file. The EMF will use the current screen's |
| 460 // DPI. | 460 // DPI. |
| 461 gfx::Emf emf; | 461 gfx::Emf emf; |
| 462 | 462 |
| 463 emf.CreateDc(NULL, NULL); | 463 emf.CreateDc(NULL, NULL); |
| 464 HDC hdc = emf.hdc(); | 464 HDC hdc = emf.hdc(); |
| 465 DCHECK(hdc); | 465 DCHECK(hdc); |
| 466 skia::PlatformDeviceWin::InitializeDC(hdc); | 466 skia::PlatformDeviceWin::InitializeDC(hdc); |
| 467 int size_x = canvas_size.width(); | 467 // Since WebKit extends the page width depending on the magical shrink |
| 468 int size_y = canvas_size.height(); | 468 // factor we make sure the canvas covers the worst case scenario |
| 469 // (x2.0 currently). PrintContext will then set the correct clipping region. |
| 470 int size_x = static_cast<int>(canvas_size.width() * params.params.max_shrink); |
| 471 int size_y = static_cast<int>(canvas_size.height() * |
| 472 params.params.max_shrink); |
| 469 // Calculate the dpi adjustment. | 473 // Calculate the dpi adjustment. |
| 470 float shrink = static_cast<float>(canvas_size.width()) / | 474 float shrink = static_cast<float>(canvas_size.width()) / |
| 471 params.params.printable_size.width(); | 475 params.params.printable_size.width(); |
| 472 #if 0 | 476 #if 0 |
| 473 // TODO(maruel): This code is kept for testing until the 100% GDI drawing | 477 // TODO(maruel): This code is kept for testing until the 100% GDI drawing |
| 474 // code is stable. maruels use this code's output as a reference when the | 478 // code is stable. maruels use this code's output as a reference when the |
| 475 // GDI drawing code fails. | 479 // GDI drawing code fails. |
| 476 | 480 |
| 477 // Mix of Skia and GDI based. | 481 // Mix of Skia and GDI based. |
| 478 skia::PlatformCanvasWin canvas(size_x, size_y, true); | 482 skia::PlatformCanvasWin canvas(size_x, size_y, true); |
| (...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2958 void RenderView::OnExtensionResponse(int callback_id, | 2962 void RenderView::OnExtensionResponse(int callback_id, |
| 2959 const std::string& response) { | 2963 const std::string& response) { |
| 2960 WebFrame* web_frame = pending_extension_callbacks_.Lookup(callback_id); | 2964 WebFrame* web_frame = pending_extension_callbacks_.Lookup(callback_id); |
| 2961 if (!web_frame) | 2965 if (!web_frame) |
| 2962 return; // The frame went away. | 2966 return; // The frame went away. |
| 2963 | 2967 |
| 2964 extensions_v8::ExtensionProcessBindings::ExecuteCallbackInFrame( | 2968 extensions_v8::ExtensionProcessBindings::ExecuteCallbackInFrame( |
| 2965 web_frame, callback_id, response); | 2969 web_frame, callback_id, response); |
| 2966 pending_extension_callbacks_.Remove(callback_id); | 2970 pending_extension_callbacks_.Remove(callback_id); |
| 2967 } | 2971 } |
| OLD | NEW |