OLD | NEW |
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 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 static_cast<float>(page_size.width), | 1757 static_cast<float>(page_size.width), |
1758 static_cast<float>(page_size.height)); | 1758 static_cast<float>(page_size.height)); |
1759 print_context_->begin(rect.width()); | 1759 print_context_->begin(rect.width()); |
1760 float page_height; | 1760 float page_height; |
1761 // We ignore the overlays calculation for now since they are generated in the | 1761 // We ignore the overlays calculation for now since they are generated in the |
1762 // browser. page_height is actually an output parameter. | 1762 // browser. page_height is actually an output parameter. |
1763 print_context_->computePageRects(rect, 0, 0, 1.0, page_height); | 1763 print_context_->computePageRects(rect, 0, 0, 1.0, page_height); |
1764 return print_context_->pageCount(); | 1764 return print_context_->pageCount(); |
1765 } | 1765 } |
1766 | 1766 |
| 1767 float WebFrameImpl::GetPrintPageShrink(int page) { |
| 1768 // Ensure correct state. |
| 1769 if (!print_context_.get() || page < 0) { |
| 1770 NOTREACHED(); |
| 1771 return 0; |
| 1772 } |
| 1773 |
| 1774 return print_context_->getPageShrink(page); |
| 1775 } |
| 1776 |
1767 float WebFrameImpl::PrintPage(int page, WebCanvas* canvas) { | 1777 float WebFrameImpl::PrintPage(int page, WebCanvas* canvas) { |
1768 // Ensure correct state. | 1778 // Ensure correct state. |
1769 if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) { | 1779 if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) { |
1770 NOTREACHED(); | 1780 NOTREACHED(); |
1771 return 0; | 1781 return 0; |
1772 } | 1782 } |
1773 | 1783 |
1774 #if defined(OS_WIN) || defined(OS_LINUX) | 1784 #if defined(OS_WIN) || defined(OS_LINUX) |
1775 PlatformContextSkia context(canvas); | 1785 PlatformContextSkia context(canvas); |
1776 GraphicsContext spool(&context); | 1786 GraphicsContext spool(&context); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 | 1846 |
1837 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); | 1847 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); |
1838 | 1848 |
1839 if (!frame_->loader()->isScheduledLocationChangePending()) { | 1849 if (!frame_->loader()->isScheduledLocationChangePending()) { |
1840 frame_->loader()->stopAllLoaders(); | 1850 frame_->loader()->stopAllLoaders(); |
1841 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); | 1851 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); |
1842 frame_->loader()->write(script_result); | 1852 frame_->loader()->write(script_result); |
1843 frame_->loader()->end(); | 1853 frame_->loader()->end(); |
1844 } | 1854 } |
1845 } | 1855 } |
OLD | NEW |