Changeset 104663 in webkit


Ignore:
Timestamp:
Jan 10, 2012 8:50:17 PM (12 years ago)
Author:
mrowe@apple.com
Message:

REGRESSION (r104377): All pages print blank on Snow Leopard
<http://webkit.org/b/75879> / <rdar://problem/10674335>

We need to explicitly load PDFKit.framework before using PDFDocument and friends.
On SnowLeopard the framework is not necessarily loaded by anything else before we
print, which would lead to us failing to allocate the PDFDocument that we use for
drawing the content from the web process.

Reviewed by Dan Bernstein.

  • UIProcess/API/mac/WKPrintingView.mm:

(pdfKitFrameworkPath): Construct the path to the PDFKit framework.
(classFromPDFKit): Ensure that the PDFKit framework is loaded, and then retrieve the
given class from it.
(pdfAnnotationLinkClass): ASSERT that we found the class.
(pdfDocumentClass): Ditto.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r104656 r104663  
     12012-01-10  Mark Rowe  <mrowe@apple.com>
     2
     3        REGRESSION (r104377): All pages print blank on Snow Leopard
     4        <http://webkit.org/b/75879> / <rdar://problem/10674335>
     5
     6        We need to explicitly load PDFKit.framework before using PDFDocument and friends.
     7        On SnowLeopard the framework is not necessarily loaded by anything else before we
     8        print, which would lead to us failing to allocate the PDFDocument that we use for
     9        drawing the content from the web process.
     10
     11        Reviewed by Dan Bernstein.
     12
     13        * UIProcess/API/mac/WKPrintingView.mm:
     14        (pdfKitFrameworkPath): Construct the path to the PDFKit framework.
     15        (classFromPDFKit): Ensure that the PDFKit framework is loaded, and then retrieve the
     16        given class from it.
     17        (pdfAnnotationLinkClass): ASSERT that we found the class.
     18        (pdfDocumentClass): Ditto.
     19
    1202012-01-10  Chris Marrin  <cmarrin@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm

    r104377 r104663  
    412412}
    413413
     414static NSString *pdfKitFrameworkPath()
     415{
     416    NSString *systemLibraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, NO) objectAtIndex:0];
     417    return [systemLibraryPath stringByAppendingPathComponent:@"Frameworks/Quartz.framework/Frameworks/PDFKit.framework"];
     418}
     419
     420static Class classFromPDFKit(NSString *className)
     421{
     422    static NSBundle *pdfKitBundle = [NSBundle bundleWithPath:pdfKitFrameworkPath()];
     423    [pdfKitBundle load];
     424    return [pdfKitBundle classNamed:className];
     425}
     426
    414427static Class pdfAnnotationLinkClass()
    415428{
    416     static Class pdfAnnotationLinkClass = NSClassFromString(@"PDFAnnotationLink");
     429    static Class pdfAnnotationLinkClass = classFromPDFKit(@"PDFAnnotationLink");
     430    ASSERT(pdfAnnotationLinkClass);
    417431    return pdfAnnotationLinkClass;
    418432}
     
    420434static Class pdfDocumentClass()
    421435{
    422     static Class pdfDocumentClass = NSClassFromString(@"PDFDocument");
     436    static Class pdfDocumentClass = classFromPDFKit(@"PDFDocument");
     437    ASSERT(pdfDocumentClass);
    423438    return pdfDocumentClass;
    424439}
Note: See TracChangeset for help on using the changeset viewer.