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