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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 static_cast<float>(page_size.width), | 1737 static_cast<float>(page_size.width), |
1738 static_cast<float>(page_size.height)); | 1738 static_cast<float>(page_size.height)); |
1739 print_context_->begin(rect.width()); | 1739 print_context_->begin(rect.width()); |
1740 float page_height; | 1740 float page_height; |
1741 // We ignore the overlays calculation for now since they are generated in the | 1741 // We ignore the overlays calculation for now since they are generated in the |
1742 // browser. page_height is actually an output parameter. | 1742 // browser. page_height is actually an output parameter. |
1743 print_context_->computePageRects(rect, 0, 0, 1.0, page_height); | 1743 print_context_->computePageRects(rect, 0, 0, 1.0, page_height); |
1744 return print_context_->pageCount(); | 1744 return print_context_->pageCount(); |
1745 } | 1745 } |
1746 | 1746 |
| 1747 float WebFrameImpl::GetPrintPageShrink(int page) { |
| 1748 // Ensure correct state. |
| 1749 if (!print_context_.get() || page < 0) { |
| 1750 NOTREACHED(); |
| 1751 return 0; |
| 1752 } |
| 1753 |
| 1754 return print_context_->getPageShrink(page); |
| 1755 } |
| 1756 |
1747 float WebFrameImpl::PrintPage(int page, WebCanvas* canvas) { | 1757 float WebFrameImpl::PrintPage(int page, WebCanvas* canvas) { |
1748 // Ensure correct state. | 1758 // Ensure correct state. |
1749 if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) { | 1759 if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) { |
1750 NOTREACHED(); | 1760 NOTREACHED(); |
1751 return 0; | 1761 return 0; |
1752 } | 1762 } |
1753 | 1763 |
1754 #if defined(OS_WIN) || defined(OS_LINUX) | 1764 #if defined(OS_WIN) || defined(OS_LINUX) |
1755 PlatformContextSkia context(canvas); | 1765 PlatformContextSkia context(canvas); |
1756 GraphicsContext spool(&context); | 1766 GraphicsContext spool(&context); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 | 1826 |
1817 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); | 1827 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); |
1818 | 1828 |
1819 if (!frame_->loader()->isScheduledLocationChangePending()) { | 1829 if (!frame_->loader()->isScheduledLocationChangePending()) { |
1820 frame_->loader()->stopAllLoaders(); | 1830 frame_->loader()->stopAllLoaders(); |
1821 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); | 1831 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); |
1822 frame_->loader()->write(script_result); | 1832 frame_->loader()->write(script_result); |
1823 frame_->loader()->end(); | 1833 frame_->loader()->end(); |
1824 } | 1834 } |
1825 } | 1835 } |
OLD | NEW |