Changeset 80573 in webkit
- Timestamp:
- Mar 8, 2011 11:24:26 AM (13 years ago)
- Location:
- trunk/Source/WebKit/mac
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/ChangeLog
r80528 r80573 1 2011-03-08 Darin Adler <darin@apple.com> 2 3 Reviewed by Timothy Hatcher. 4 5 Promote a method used outside WebKit from internal to private 6 https://bugs.webkit.org/show_bug.cgi?id=55949 7 8 * Misc/WebNSPasteboardExtras.mm: Removed an unused category declaration. 9 Minor tweak, not directly related to the rest of this patch. 10 11 * WebView/WebFrame.mm: 12 (-[WebFrame _computePageRectsWithPrintScaleFactor:pageSize:]): Moved 13 this method from the internal category into the private category. 14 Streamlined the code a bit. 15 16 * WebView/WebFrameInternal.h: Removed _computePageRects method. 17 * WebView/WebFramePrivate.h: Added _computePageRects method. 18 1 19 2011-03-07 Ryosuke Niwa <rniwa@webkit.org> 2 20 -
trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm
r63632 r80573 48 48 #import <wtf/StdLibExtras.h> 49 49 50 @interface NSFilePromiseDragSource : NSObject51 - (id)initWithSource:(id)draggingSource;52 - (void)setTypes:(NSArray *)types onPasteboard:(NSPasteboard *)pboard;53 @end54 55 50 using namespace WebCore; 56 51 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r80498 r80573 580 580 581 581 if (contentsOnly) 582 _private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect));582 view->paintContents(&context, enclosingIntRect(rect)); 583 583 else 584 _private->coreFrame->view()->paint(&context, enclosingIntRect(rect));584 view->paint(&context, enclosingIntRect(rect)); 585 585 586 586 if (shouldFlatten) 587 587 view->setPaintBehavior(oldBehavior); 588 }589 590 // Used by pagination code called from AppKit when a standalone web page is printed.591 - (NSArray*)_computePageRectsWithPrintScaleFactor:(float)printScaleFactor pageSize:(NSSize)pageSize592 {593 NSMutableArray* pages = [NSMutableArray arrayWithCapacity:5];594 if (printScaleFactor <= 0) {595 LOG_ERROR("printScaleFactor has bad value %.2f", printScaleFactor);596 return pages;597 }598 599 if (!_private->coreFrame || !_private->coreFrame->document() || !_private->coreFrame->view()) return pages;600 RenderView* root = toRenderView(_private->coreFrame->document()->renderer());601 if (!root) return pages;602 603 FrameView* view = _private->coreFrame->view();604 if (!view)605 return pages;606 607 NSView* documentView = view->documentView();608 if (!documentView)609 return pages;610 611 float docWidth = root->docWidth();612 float docHeight = root->docHeight();613 614 float printWidth = root->style()->isHorizontalWritingMode() ? docWidth / printScaleFactor : pageSize.width;615 float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : docHeight / printScaleFactor;616 617 PrintContext printContext(_private->coreFrame);618 printContext.computePageRectsWithPageSize(FloatSize(printWidth, printHeight), true);619 620 const Vector<IntRect>& pageRects = printContext.pageRects();621 const size_t pageCount = pageRects.size();622 for (size_t pageNumber = 0; pageNumber < pageCount; ++pageNumber)623 [pages addObject: [NSValue valueWithRect: NSRect(pageRects[pageNumber])]];624 return pages;625 588 } 626 589 … … 1388 1351 } 1389 1352 1353 // Used by pagination code called from AppKit when a standalone web page is printed. 1354 - (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printScaleFactor pageSize:(NSSize)pageSize 1355 { 1356 if (printScaleFactor <= 0) { 1357 LOG_ERROR("printScaleFactor has bad value %.2f", printScaleFactor); 1358 return [NSArray array]; 1359 } 1360 1361 if (!_private->coreFrame) 1362 return [NSArray array]; 1363 if (!_private->coreFrame->document()) 1364 return [NSArray array]; 1365 if (!_private->coreFrame->view()) 1366 return [NSArray array]; 1367 if (!_private->coreFrame->view()->documentView()) 1368 return [NSArray array]; 1369 1370 RenderView* root = toRenderView(_private->coreFrame->document()->renderer()); 1371 if (!root) 1372 return [NSArray array]; 1373 1374 float printWidth = root->style()->isHorizontalWritingMode() ? root->docWidth() / printScaleFactor : pageSize.width; 1375 float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : root->docHeight() / printScaleFactor; 1376 1377 PrintContext printContext(_private->coreFrame); 1378 printContext.computePageRectsWithPageSize(FloatSize(printWidth, printHeight), true); 1379 const Vector<IntRect>& pageRects = printContext.pageRects(); 1380 1381 size_t size = pageRects.size(); 1382 NSMutableArray *pages = [NSMutableArray arrayWithCapacity:size]; 1383 for (size_t i = 0; i < size; ++i) 1384 [pages addObject:[NSValue valueWithRect:NSRect(pageRects[i])]]; 1385 return pages; 1386 } 1387 1390 1388 @end 1391 1389 -
trunk/Source/WebKit/mac/WebView/WebFrameInternal.h
r80059 r80573 126 126 - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly; 127 127 - (BOOL)_getVisibleRect:(NSRect*)rect; 128 - (NSArray*)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize;129 128 130 129 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string; -
trunk/Source/WebKit/mac/WebView/WebFramePrivate.h
r79793 r80573 1 1 /* 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Computer,Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 70 70 71 71 @interface WebFrame (WebPrivate) 72 72 73 - (BOOL)_isDescendantOfFrame:(WebFrame *)frame; 73 - (void)_setShouldCreateRenderers:(BOOL) f;74 - (void)_setShouldCreateRenderers:(BOOL)shouldCreateRenderers; 74 75 - (NSColor *)_bodyBackgroundColor; 75 76 - (BOOL)_isFrameSet; … … 149 150 - (void)_clearOpener; 150 151 152 // Printing. 153 - (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize; 151 154 152 155 @end
Note: See TracChangeset
for help on using the changeset viewer.