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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1038 static_cast<float>(page_size.width), | 1038 static_cast<float>(page_size.width), |
1039 static_cast<float>(page_size.height)); | 1039 static_cast<float>(page_size.height)); |
1040 print_context_->begin(rect.width()); | 1040 print_context_->begin(rect.width()); |
1041 float page_height; | 1041 float page_height; |
1042 // We ignore the overlays calculation for now since they are generated in the | 1042 // We ignore the overlays calculation for now since they are generated in the |
1043 // browser. page_height is actually an output parameter. | 1043 // browser. page_height is actually an output parameter. |
1044 print_context_->computePageRects(rect, 0, 0, 1.0, page_height); | 1044 print_context_->computePageRects(rect, 0, 0, 1.0, page_height); |
1045 return print_context_->pageCount(); | 1045 return print_context_->pageCount(); |
1046 } | 1046 } |
1047 | 1047 |
1048 float WebFrameImpl::getPrintPageShrink(int page) { | |
1049 // Ensure correct state. | |
1050 if (!print_context_.get() || page < 0) { | |
darin (slow to review)
2009/08/13 16:57:01
I don't think it is important to check these thing
| |
1051 NOTREACHED(); | |
1052 return 0; | |
1053 } | |
1054 | |
1055 return print_context_->getPageShrink(page); | |
1056 } | |
1057 | |
1048 float WebFrameImpl::printPage(int page, WebCanvas* canvas) { | 1058 float WebFrameImpl::printPage(int page, WebCanvas* canvas) { |
1049 // Ensure correct state. | 1059 // Ensure correct state. |
1050 if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) { | 1060 if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) { |
1051 NOTREACHED(); | 1061 NOTREACHED(); |
1052 return 0; | 1062 return 0; |
1053 } | 1063 } |
1054 | 1064 |
1055 #if defined(OS_WIN) || defined(OS_LINUX) | 1065 #if defined(OS_WIN) || defined(OS_LINUX) |
1056 PlatformContextSkia context(canvas); | 1066 PlatformContextSkia context(canvas); |
1057 GraphicsContext spool(&context); | 1067 GraphicsContext spool(&context); |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1851 | 1861 |
1852 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); | 1862 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); |
1853 | 1863 |
1854 if (!frame_->loader()->isScheduledLocationChangePending()) { | 1864 if (!frame_->loader()->isScheduledLocationChangePending()) { |
1855 frame_->loader()->stopAllLoaders(); | 1865 frame_->loader()->stopAllLoaders(); |
1856 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); | 1866 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); |
1857 frame_->loader()->write(script_result); | 1867 frame_->loader()->write(script_result); |
1858 frame_->loader()->end(); | 1868 frame_->loader()->end(); |
1859 } | 1869 } |
1860 } | 1870 } |
OLD | NEW |