Changeset 64409 in webkit
- Timestamp:
- Jul 30, 2010, 10:59:02 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 18 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/mac/printing/media-queries-print-expected.txt (modified) (1 diff)
-
LayoutTests/printing/page-break-margin-collapsed-expected.txt (modified) (1 diff)
-
LayoutTests/printing/resources/paged-media-test-utils.js (modified) (1 diff)
-
LayoutTests/printing/script-tests/stretch-to-view-height.js (added)
-
LayoutTests/printing/stretch-to-view-height-expected.txt (added)
-
LayoutTests/printing/stretch-to-view-height.html (added)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.exp.in (modified) (1 diff)
-
WebCore/page/Frame.cpp (modified) (2 diffs)
-
WebCore/page/Frame.h (modified) (1 diff)
-
WebCore/page/FrameView.cpp (modified) (4 diffs)
-
WebCore/page/FrameView.h (modified) (2 diffs)
-
WebCore/page/PrintContext.cpp (modified) (6 diffs)
-
WebCore/page/PrintContext.h (modified) (1 diff)
-
WebCore/rendering/RenderBox.cpp (modified) (1 diff)
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebView/WebHTMLView.mm (modified) (22 diffs)
-
WebKit/mac/WebView/WebHTMLViewPrivate.h (modified) (1 diff)
-
WebKit/win/ChangeLog (modified) (1 diff)
-
WebKit/win/WebFrame.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r64408 r64409 1 2010-07-30 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 <rdar://problem/8257783> Short documents may print a second blank page 6 https://bugs.webkit.org/show_bug.cgi?id=43271 7 8 * platform/mac/printing/media-queries-print-expected.txt: 9 * printing/page-break-margin-collapsed-expected.txt: 10 * printing/resources/paged-media-test-utils.js: 11 (ratioToPageHeightToPixels): Changed to reflect the default shrink factor of 1.25. 12 * printing/script-tests/stretch-to-view-height.js: Added. 13 (test): 14 * printing/stretch-to-view-height-expected.txt: Added. 15 * printing/stretch-to-view-height.html: Added. 16 1 17 2010-07-30 Mihai Parparita <mihaip@chromium.org> 2 18 -
trunk/LayoutTests/platform/mac/printing/media-queries-print-expected.txt
r63403 r64409 1 layer at (0,0) size 1000x 5852 RenderView at (0,0) size 1000x 5853 layer at (0,0) size 1000x 5854 RenderBlock {HTML} at (0,0) size 1000x 5855 RenderBody {BODY} at (8,8) size 984x5 691 layer at (0,0) size 1000x600 2 RenderView at (0,0) size 1000x600 3 layer at (0,0) size 1000x600 4 RenderBlock {HTML} at (0,0) size 1000x600 5 RenderBody {BODY} at (8,8) size 984x584 6 6 RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#008000] 7 7 RenderBlock (anonymous) at (0,100) size 984x18 -
trunk/LayoutTests/printing/page-break-margin-collapsed-expected.txt
r61530 r64409 6 6 7 7 PASS: page number of "page1" is 1 8 FAIL: expected page number of "page2" is 2. Was 1 678 FAIL: expected page number of "page2" is 2. Was 134 9 9 10 10 PASS successfullyParsed is true -
trunk/LayoutTests/printing/resources/paged-media-test-utils.js
r61309 r64409 63 63 function ratioToPageHeightToPixels(heightInRatioToPageHeight) 64 64 { 65 var pageHeightInPixels = 600 ;65 var pageHeightInPixels = 600 * 1.25; 66 66 return Math.floor(pageHeightInPixels * heightInRatioToPageHeight); 67 67 } -
trunk/WebCore/ChangeLog
r64408 r64409 1 2010-07-30 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 <rdar://problem/8257783> Short documents may print a second blank page 6 https://bugs.webkit.org/show_bug.cgi?id=43271 7 8 Test: printing/stretch-to-view-height.html 9 10 * WebCore.exp.in: Export Frame::forceLayoutForPagination(), replacing forceLayoutWithPageWidthRange(). 11 * page/Frame.cpp: 12 (WebCore::Frame::setPrinting): Now takes a page width and height and a maximum shrink factor and passes 13 them down to forceLayoutForPagination(). 14 * page/Frame.h: 15 (WebCore::Frame::): 16 * page/FrameView.cpp: 17 (WebCore::FrameView::reset): Initialize m_pageHeight. 18 (WebCore::FrameView::forceLayoutForPagination): Renamed forceLayoutWithPageWidthRange() to this and 19 changed it to take a page width and height and a maximum shrink factor. Sets m_pageHeight, which is 20 queried by RenderBox::calcHeight() during layout. If the given pageHeight is 0, m_pageHeight is set 21 to the visible height, retaining the behavior before this change. 22 * page/FrameView.h: 23 (WebCore::FrameView::pageHeight): Added this accessor. 24 * page/PrintContext.cpp: 25 (WebCore::PrintContext::begin): Added a height parameter, used when calling setPrinting(). 26 (WebCore::PrintContext::end): Updated for setPrinting() changes. 27 (WebCore::PrintContext::pageNumberForElement): Account for shrink-to-fit. 28 (WebCore::PrintContext::pageProperty): Pass 0 for the height, retaining current behavior. 29 (WebCore::PrintContext::numberOfPages): Account for shrink-to-fit. 30 (WebCore::PrintContext::spoolAllPagesWithBoundaries): Pass the page width to begin(). 31 * page/PrintContext.h: 32 * rendering/RenderBox.cpp: 33 (WebCore::RenderBox::calcHeight): When printing, use FrameView::pageHeight() as the basis for 34 viewport-relative heights. 35 1 36 2010-07-30 Mihai Parparita <mihaip@chromium.org> 2 37 -
trunk/WebCore/WebCore.exp.in
r64400 r64409 770 770 __ZN7WebCore9FrameView23layoutIfNeededRecursiveEv 771 771 __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv 772 __ZN7WebCore9FrameView2 9forceLayoutWithPageWidthRangeEffb772 __ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE 773 773 __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb 774 774 __ZN7WebCore9FrameView29syncCompositingStateRecursiveEv -
trunk/WebCore/page/Frame.cpp
r63927 r64409 618 618 } 619 619 620 void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize)620 void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize) 621 621 { 622 622 m_doc->setPrinting(printing); … … 624 624 625 625 m_doc->updateStyleSelector(); 626 view()->forceLayout WithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize);626 view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize); 627 627 628 628 for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) 629 child->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize);629 child->setPrinting(printing, pageSize, maximumShrinkRatio, shouldAdjustViewSize); 630 630 } 631 631 -
trunk/WebCore/page/Frame.h
r61324 r64409 141 141 Settings* settings() const; // can be NULL 142 142 143 void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize); 143 enum AdjustViewSizeOrNot { DoNotAdjustViewSize, AdjustViewSize }; 144 void setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot); 144 145 145 146 bool inViewSourceMode() const; -
trunk/WebCore/page/FrameView.cpp
r64158 r64409 213 213 m_lastLayoutSize = IntSize(); 214 214 m_lastZoomFactor = 1.0f; 215 m_pageHeight = 0; 215 216 m_deferringRepaints = 0; 216 217 m_repaintCount = 0; … … 2043 2044 } 2044 2045 2045 void FrameView::forceLayout WithPageWidthRange(float minPageWidth, float maxPageWidth, bool _adjustViewSize)2046 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot shouldAdjustViewSize) 2046 2047 { 2047 2048 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see … … 2049 2050 RenderView *root = toRenderView(m_frame->document()->renderer()); 2050 2051 if (root) { 2051 // This magic is basically copied from khtmlview::print2052 int pageW = (int)ceilf(minPageWidth);2052 int pageW = ceilf(pageSize.width()); 2053 m_pageHeight = pageSize.height() ? pageSize.height() : visibleHeight(); 2053 2054 root->setWidth(pageW); 2054 2055 root->setNeedsLayoutAndPrefWidthsRecalc(); 2055 2056 forceLayout(); 2056 2057 2057 // If we don't fit in the minimumpage width, we'll lay out again. If we don't fit in the2058 // maximum page width, we will lay out to the maximum page widthand clip extra content.2058 // If we don't fit in the given page width, we'll lay out again. If we don't fit in the 2059 // page width when shrunk, we will lay out at maximum shrink and clip extra content. 2059 2060 // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping 2060 2061 // implementation should not do this! 2061 2062 int rightmostPos = root->rightmostPosition(); 2062 if (rightmostPos > minPageWidth) { 2063 pageW = std::min(rightmostPos, (int)ceilf(maxPageWidth)); 2063 if (rightmostPos > pageSize.width()) { 2064 pageW = std::min<int>(rightmostPos, ceilf(pageSize.width() * maximumShrinkFactor)); 2065 if (pageSize.height()) 2066 m_pageHeight = pageW / pageSize.width() * pageSize.height(); 2064 2067 root->setWidth(pageW); 2065 2068 root->setNeedsLayoutAndPrefWidthsRecalc(); … … 2068 2071 } 2069 2072 2070 if ( _adjustViewSize)2073 if (shouldAdjustViewSize) 2071 2074 adjustViewSize(); 2075 m_pageHeight = 0; 2072 2076 } 2073 2077 -
trunk/WebCore/page/FrameView.h
r64054 r64409 200 200 201 201 void forceLayout(bool allowSubtree = false); 202 void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize); 202 void forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot); 203 int pageHeight() const { return m_pageHeight; } 203 204 204 205 void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit); … … 333 334 String m_mediaTypeWhenNotPrinting; 334 335 336 int m_pageHeight; 337 335 338 unsigned m_enqueueEvents; 336 339 Vector<ScheduledEvent*> m_scheduledEvents; -
trunk/WebCore/page/PrintContext.cpp
r64187 r64409 117 117 } 118 118 119 void PrintContext::begin(float width )119 void PrintContext::begin(float width, float height) 120 120 { 121 121 ASSERT(!m_isPrinting); … … 136 136 137 137 float minLayoutWidth = width * PrintingMinimumShrinkFactor; 138 float m axLayoutWidth = width * PrintingMaximumShrinkFactor;138 float minLayoutHeight = height * PrintingMinimumShrinkFactor; 139 139 140 140 // FIXME: This will modify the rendering of the on-screen frame. 141 141 // Could lead to flicker during printing. 142 m_frame->setPrinting(true, minLayoutWidth, maxLayoutWidth, true);142 m_frame->setPrinting(true, FloatSize(minLayoutWidth, minLayoutHeight), PrintingMaximumShrinkFactor / PrintingMinimumShrinkFactor, Frame::AdjustViewSize); 143 143 } 144 144 … … 160 160 ASSERT(m_isPrinting); 161 161 m_isPrinting = false; 162 m_frame->setPrinting(false, 0, 0, true);162 m_frame->setPrinting(false, FloatSize(), 0, Frame::AdjustViewSize); 163 163 } 164 164 … … 186 186 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); 187 187 PrintContext printContext(frame); 188 printContext.begin(pageRect.width()); 189 printContext.computePageRectsWithPageSize(pageSizeInPixels, false); 188 printContext.begin(pageRect.width(), pageRect.height()); 189 FloatSize scaledPageSize = pageSizeInPixels; 190 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); 191 printContext.computePageRectsWithPageSize(scaledPageSize, false); 190 192 191 193 int top = box->offsetTop(); … … 244 246 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); 245 247 PrintContext printContext(frame); 246 printContext.begin(pageRect.width()); 247 printContext.computePageRectsWithPageSize(pageSizeInPixels, false); 248 printContext.begin(pageRect.width(), pageRect.height()); 249 // Account for shrink-to-fit. 250 FloatSize scaledPageSize = pageSizeInPixels; 251 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); 252 printContext.computePageRectsWithPageSize(scaledPageSize, false); 248 253 return printContext.pageCount(); 249 254 } … … 257 262 258 263 PrintContext printContext(frame); 259 printContext.begin(pageSizeInPixels.width() );264 printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height()); 260 265 261 266 float pageHeight; -
trunk/WebCore/page/PrintContext.h
r63521 r64409 47 47 48 48 // TODO: eliminate width param 49 void begin(float width );49 void begin(float width, float height = 0); 50 50 51 51 // TODO: eliminate width param -
trunk/WebCore/rendering/RenderBox.cpp
r64272 r64409 1514 1514 if (stretchesToViewHeight() || printingNeedsBaseHeight) { 1515 1515 int margins = collapsedMarginTop() + collapsedMarginBottom(); 1516 int visHeight = document()->printing() ? view()->frameView()-> visibleHeight() : view()->viewHeight();1516 int visHeight = document()->printing() ? view()->frameView()->pageHeight() : view()->viewHeight(); 1517 1517 if (isRoot()) 1518 1518 setHeight(max(height(), visHeight - margins)); -
trunk/WebKit/mac/ChangeLog
r64403 r64409 1 2010-07-30 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 <rdar://problem/8257783> Short documents may print a second blank page 6 https://bugs.webkit.org/show_bug.cgi?id=43271 7 8 * WebView/WebHTMLView.mm: 9 (-[WebHTMLView _web_setPrintingModeRecursive]): Updated for additional height parameter 10 to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. 11 (-[WebHTMLView _web_clearPrintingModeRecursive]): Ditto. 12 (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]): Ditto. 13 (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]): Added height parameter, 14 which is scaled and passed on to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. 15 (-[WebHTMLView _endPrintMode]): Updated for additional height parameter to 16 _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. 17 (-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]): Added 18 height parameter, which is passed on to FrameView::forceLayoutForPagination(). 19 (-[WebHTMLView layout]): Updated for additional height parameter. 20 (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:]): Added height 21 parameter, which is passed on to -layoutToMinimumPageWidth:height:maximumPageWidth:adjustViewSize:. 22 (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]): Updated for additional height 23 parameter. 24 (-[WebHTMLView setPageWidthForPrinting:]): Ditto. 25 (-[WebHTMLView knowsPageRange:]): Pass the available height on the page on to 26 _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize. 27 * WebView/WebHTMLViewPrivate.h: 28 1 29 2010-07-30 Joseph Pecoraro <joepeck@webkit.org> 2 30 -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r63856 r64409 400 400 401 401 @interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick. 402 - (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize;402 - (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize; 403 403 @end 404 404 … … 1041 1041 - (void)_web_setPrintingModeRecursive 1042 1042 { 1043 [self _setPrinting:YES minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];1043 [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 1044 1044 1045 1045 #ifndef NDEBUG … … 1053 1053 unsigned count = [descendantWebHTMLViews count]; 1054 1054 for (unsigned i = 0; i < count; ++i) 1055 [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];1055 [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 1056 1056 1057 1057 [descendantWebHTMLViews release]; … … 1064 1064 - (void)_web_clearPrintingModeRecursive 1065 1065 { 1066 [self _setPrinting:NO minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];1066 [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 1067 1067 1068 1068 #ifndef NDEBUG … … 1076 1076 unsigned count = [descendantWebHTMLViews count]; 1077 1077 for (unsigned i = 0; i < count; ++i) 1078 [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:NO minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];1078 [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 1079 1079 1080 1080 [descendantWebHTMLViews release]; … … 1087 1087 - (void)_web_setPrintingModeRecursiveAndAdjustViewSize 1088 1088 { 1089 [self _setPrinting:YES minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:YES];1089 [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES]; 1090 1090 1091 1091 #ifndef NDEBUG … … 1099 1099 unsigned count = [descendantWebHTMLViews count]; 1100 1100 for (unsigned i = 0; i < count; ++i) 1101 [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:YES];1101 [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES]; 1102 1102 1103 1103 [descendantWebHTMLViews release]; … … 2231 2231 } 2232 2232 2233 - (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth shrinkToFit:(BOOL)shrinkToFit2233 - (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit 2234 2234 { 2235 2235 Frame* frame = core([self _frame]); … … 2238 2238 2239 2239 float minLayoutWidth = 0; 2240 float minLayoutHeight = 0; 2240 2241 float maxLayoutWidth = 0; 2241 2242 … … 2244 2245 if (!frame->document() || !frame->document()->isFrameSet()) { 2245 2246 minLayoutWidth = shrinkToFit ? pageWidth * _WebHTMLViewPrintingMinimumShrinkFactor : pageWidth; 2247 minLayoutHeight = shrinkToFit ? pageHeight * _WebHTMLViewPrintingMinimumShrinkFactor : pageHeight; 2246 2248 maxLayoutWidth = shrinkToFit ? pageWidth * _WebHTMLViewPrintingMaximumShrinkFactor : pageWidth; 2247 2249 } 2248 [self _setPrinting:YES minimumPageWidth:minLayoutWidth maximumPageWidth:maxLayoutWidth adjustViewSize:YES];2250 [self _setPrinting:YES minimumPageWidth:minLayoutWidth height:minLayoutHeight maximumPageWidth:maxLayoutWidth adjustViewSize:YES]; 2249 2251 2250 2252 return YES; … … 2253 2255 - (void)_endPrintMode 2254 2256 { 2255 [self _setPrinting:NO minimumPageWidth:0 maximumPageWidth:0 adjustViewSize:YES];2257 [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES]; 2256 2258 } 2257 2259 … … 3105 3107 // Do a layout, but set up a new fixed width for the purposes of doing printing layout. 3106 3108 // minPageWidth==0 implies a non-printing layout 3107 - (void)layoutToMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize3109 - (void)layoutToMinimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize 3108 3110 { 3109 3111 [self reapplyStyles]; … … 3124 3126 if (FrameView* coreView = coreFrame->view()) { 3125 3127 if (minPageWidth > 0.0) 3126 coreView->forceLayout WithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize);3128 coreView->forceLayoutForPagination(FloatSize(minPageWidth, minPageHeight), maxPageWidth / minPageWidth, adjustViewSize ? Frame::AdjustViewSize : Frame::DoNotAdjustViewSize); 3127 3129 else { 3128 3130 coreView->forceLayout(!adjustViewSize); … … 3140 3142 - (void)layout 3141 3143 { 3142 [self layoutToMinimumPageWidth:0 .0f maximumPageWidth:0.0fadjustingViewSize:NO];3144 [self layoutToMinimumPageWidth:0 height:0 maximumPageWidth:0 adjustingViewSize:NO]; 3143 3145 } 3144 3146 … … 3821 3823 // Does setNeedsDisplay:NO as a side effect when printing is ending. 3822 3824 // pageWidth != 0 implies we will relayout to a new width 3823 - (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize3825 - (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize 3824 3826 { 3825 3827 WebFrame *frame = [self _frame]; … … 3831 3833 WebFrameView *frameView = [subframe frameView]; 3832 3834 if ([[subframe _dataSource] _isDocumentHTML]) { 3833 [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:adjustViewSize];3835 [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:adjustViewSize]; 3834 3836 } 3835 3837 } … … 3843 3845 [self setNeedsToApplyStyles:YES]; 3844 3846 [self setNeedsLayout:YES]; 3845 [self layoutToMinimumPageWidth:minPageWidth maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize];3847 [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize]; 3846 3848 if (!printing) { 3847 3849 // Can't do this when starting printing or nested printing won't work, see 3491427. … … 3864 3866 BOOL wasInPrintingMode = _private->printing; 3865 3867 if (!wasInPrintingMode) 3866 [self _setPrinting:YES minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];3868 [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 3867 3869 3868 3870 *newBottom = [self _adjustedBottomOfPageWithTop:oldTop bottom:oldBottom limit:bottomLimit]; … … 3875 3877 else 3876 3878 // not sure if this is actually ever invoked, it probably shouldn't be 3877 [self _setPrinting:NO minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];3879 [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 3878 3880 } 3879 3881 } … … 3905 3907 - (void)setPageWidthForPrinting:(float)pageWidth 3906 3908 { 3907 [self _setPrinting:NO minimumPageWidth:0 .0f maximumPageWidth:0.0fadjustViewSize:NO];3908 [self _setPrinting:YES minimumPageWidth:pageWidth maximumPageWidth:pageWidth adjustViewSize:YES];3909 [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO]; 3910 [self _setPrinting:YES minimumPageWidth:pageWidth height:0 maximumPageWidth:pageWidth adjustViewSize:YES]; 3909 3911 } 3910 3912 … … 3949 3951 [[self window] setAutodisplay:NO]; 3950 3952 3953 [[self _webView] _adjustPrintingMarginsForHeaderAndFooter]; 3951 3954 NSPrintOperation *printOperation = [NSPrintOperation currentOperation]; 3952 if (![self _beginPrintModeWithPageWidth:[printOperation _web_availablePaperWidth] shrinkToFit:YES])3955 if (![self _beginPrintModeWithPageWidth:[printOperation _web_availablePaperWidth] height:[printOperation _web_availablePaperHeight] shrinkToFit:YES]) 3953 3956 return NO; 3954 3957 … … 3960 3963 // which is after beginDocument and endDocument would be called. 3961 3964 [self performSelector:@selector(_delayedEndPrintMode:) withObject:printOperation afterDelay:0]; 3962 [[self _webView] _adjustPrintingMarginsForHeaderAndFooter];3963 3965 3964 3966 // There is a theoretical chance that someone could do some drawing between here and endDocument, -
trunk/WebKit/mac/WebView/WebHTMLViewPrivate.h
r57723 r64409 136 136 - (WebCGFloat)_adjustedBottomOfPageWithTop:(WebCGFloat)top bottom:(WebCGFloat)bottom limit:(WebCGFloat)bottomLimit; 137 137 - (BOOL)_isInPrintMode; 138 - (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth shrinkToFit:(BOOL)shrinkToFit;138 - (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit; 139 139 - (void)_endPrintMode; 140 140 -
trunk/WebKit/win/ChangeLog
r64400 r64409 1 2010-07-30 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 <rdar://problem/8257783> Short documents may print a second blank page 6 https://bugs.webkit.org/show_bug.cgi?id=43271 7 8 * WebFrame.cpp: 9 (WebFrame::setPrinting): Updated for changes to Frame::setPrinting(). Passing 0 for the 10 page height, which maintains existing behavior. 11 1 12 2010-07-30 Joseph Pecoraro <joepeck@webkit.org> 2 13 -
trunk/WebKit/win/WebFrame.cpp
r61572 r64409 1940 1940 Frame* coreFrame = core(this); 1941 1941 ASSERT(coreFrame); 1942 coreFrame->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize);1942 coreFrame->setPrinting(printing, FloatSize(minPageWidth, 0), maxPageWidth / minPageWidth, adjustViewSize ? Frame::AdjustViewSize : Frame:DoNotAdjustViewSize); 1943 1943 } 1944 1944
Note:
See TracChangeset
for help on using the changeset viewer.