Changeset 80573 in webkit


Ignore:
Timestamp:
Mar 8, 2011 11:24:26 AM (13 years ago)
Author:
Darin Adler
Message:

2011-03-08 Darin Adler <Darin Adler>

Reviewed by Timothy Hatcher.

Promote a method used outside WebKit from internal to private
https://bugs.webkit.org/show_bug.cgi?id=55949

  • Misc/WebNSPasteboardExtras.mm: Removed an unused category declaration. Minor tweak, not directly related to the rest of this patch.
  • WebView/WebFrame.mm: (-[WebFrame _computePageRectsWithPrintScaleFactor:pageSize:]): Moved this method from the internal category into the private category. Streamlined the code a bit.
  • WebView/WebFrameInternal.h: Removed _computePageRects method.
  • WebView/WebFramePrivate.h: Added _computePageRects method.
Location:
trunk/Source/WebKit/mac
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r80528 r80573  
     12011-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
    1192011-03-07  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm

    r63632 r80573  
    4848#import <wtf/StdLibExtras.h>
    4949
    50 @interface NSFilePromiseDragSource : NSObject
    51 - (id)initWithSource:(id)draggingSource;
    52 - (void)setTypes:(NSArray *)types onPasteboard:(NSPasteboard *)pboard;
    53 @end
    54 
    5550using namespace WebCore;
    5651
  • trunk/Source/WebKit/mac/WebView/WebFrame.mm

    r80498 r80573  
    580580   
    581581    if (contentsOnly)
    582         _private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect));
     582        view->paintContents(&context, enclosingIntRect(rect));
    583583    else
    584         _private->coreFrame->view()->paint(&context, enclosingIntRect(rect));
     584        view->paint(&context, enclosingIntRect(rect));
    585585
    586586    if (shouldFlatten)
    587587        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)pageSize
    592 {
    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;
    625588}
    626589
     
    13881351}
    13891352
     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
    13901388@end
    13911389
  • trunk/Source/WebKit/mac/WebView/WebFrameInternal.h

    r80059 r80573  
    126126- (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly;
    127127- (BOOL)_getVisibleRect:(NSRect*)rect;
    128 - (NSArray*)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize;
    129128
    130129- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string;
  • trunk/Source/WebKit/mac/WebView/WebFramePrivate.h

    r79793 r80573  
    11/*
    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.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7070
    7171@interface WebFrame (WebPrivate)
     72
    7273- (BOOL)_isDescendantOfFrame:(WebFrame *)frame;
    73 - (void)_setShouldCreateRenderers:(BOOL)f;
     74- (void)_setShouldCreateRenderers:(BOOL)shouldCreateRenderers;
    7475- (NSColor *)_bodyBackgroundColor;
    7576- (BOOL)_isFrameSet;
     
    149150- (void)_clearOpener;
    150151
     152// Printing.
     153- (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize;
    151154
    152155@end
Note: See TracChangeset for help on using the changeset viewer.