Changeset 155683 in webkit


Ignore:
Timestamp:
Sep 13, 2013 3:08:36 AM (11 years ago)
Author:
timothy_horton@apple.com
Message:

REGRESSION (r155615): Lots of reftests fail with single line or single pixel differences
https://bugs.webkit.org/show_bug.cgi?id=121245

Reviewed by Darin Adler.

Similar to https://bugs.webkit.org/show_bug.cgi?id=120963,
we need to manually ensure that some pieces of persistent
CoreGraphics state are restored after PDFKit changes them.

In this case, we bookend our restoration around the various
_recursiveDisplay... functions that we also use in WebHTMLView.

  • WebView/WebPDFView.mm:

(-[WebPDFView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]):
(-[WebPDFView _recursiveDisplayAllDirtyWithLockFocus:visRect:]):
(-[WebPDFView _recursive:displayRectIgnoringOpacity:inContext:topView:]):
(-[WebPDFView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]):

Location:
trunk/Source/WebKit/mac
Files:
2 edited

Legend:

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

    r155641 r155683  
     12013-09-13  Tim Horton  <timothy_horton@apple.com>
     2
     3        REGRESSION (r155615): Lots of reftests fail with single line or single pixel differences
     4        https://bugs.webkit.org/show_bug.cgi?id=121245
     5
     6        Reviewed by Darin Adler.
     7
     8        Similar to https://bugs.webkit.org/show_bug.cgi?id=120963,
     9        we need to manually ensure that some pieces of persistent
     10        CoreGraphics state are restored after PDFKit changes them.
     11
     12        In this case, we bookend our restoration around the various
     13        _recursiveDisplay... functions that we also use in WebHTMLView.
     14
     15        * WebView/WebPDFView.mm:
     16        (-[WebPDFView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]):
     17        (-[WebPDFView _recursiveDisplayAllDirtyWithLockFocus:visRect:]):
     18        (-[WebPDFView _recursive:displayRectIgnoringOpacity:inContext:topView:]):
     19        (-[WebPDFView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]):
     20
    1212013-09-12  Anders Carlsson  <andersca@apple.com>
    222
  • trunk/Source/WebKit/mac/WebView/WebPDFView.mm

    r155228 r155683  
    6666#import <wtf/CurrentTime.h>
    6767
     68#ifdef __has_include
     69#if __has_include(<ApplicationServices/ApplicationServicesPriv.h>)
     70#import <ApplicationServices/ApplicationServicesPriv.h>
     71#endif
     72#endif
     73
     74extern "C" {
     75    bool CGContextGetAllowsFontSmoothing(CGContextRef context);
     76    bool CGContextGetAllowsFontSubpixelQuantization(CGContextRef context);
     77}
     78
    6879using namespace WebCore;
    6980
     
    101112@end;
    102113
     114@interface NSView (Details)
     115- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView;
     116- (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect;
     117- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView;
     118- (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)ctx topView:(BOOL)isTopView shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor;
     119@end
     120
    103121// WebPDFPrefUpdatingProxy is a class that forwards everything it gets to a target and updates the PDF viewing prefs
    104122// after each of those messages.  We use it as a way to hook all the places that the PDF viewing attrs change.
     
    345363   
    346364    return self;
     365}
     366
     367// These states can be mutated by PDFKit but are not saved
     368// on the context's state stack. (<rdar://problem/14951759>)
     369
     370- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView
     371{
     372    CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
     373   
     374    bool allowsSmoothing = CGContextGetAllowsFontSmoothing(context);
     375    bool allowsSubpixelQuantization = CGContextGetAllowsFontSubpixelQuantization(context);
     376   
     377    [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView topView:topView];
     378   
     379    CGContextSetAllowsFontSmoothing(context, allowsSmoothing);
     380    CGContextSetAllowsFontSubpixelQuantization(context, allowsSubpixelQuantization);
     381}
     382
     383- (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect
     384{
     385    CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
     386   
     387    bool allowsSmoothing = CGContextGetAllowsFontSmoothing(context);
     388    bool allowsSubpixelQuantization = CGContextGetAllowsFontSubpixelQuantization(context);
     389   
     390    [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus visRect:visRect];
     391   
     392    CGContextSetAllowsFontSmoothing(context, allowsSmoothing);
     393    CGContextSetAllowsFontSubpixelQuantization(context, allowsSubpixelQuantization);
     394}
     395
     396- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)graphicsContext topView:(BOOL)topView
     397{
     398    CGContextRef context = (CGContextRef)[graphicsContext graphicsPort];
     399   
     400    bool allowsSmoothing = CGContextGetAllowsFontSmoothing(context);
     401    bool allowsSubpixelQuantization = CGContextGetAllowsFontSubpixelQuantization(context);
     402   
     403    [super _recursive:recurse displayRectIgnoringOpacity:displayRect inContext:graphicsContext topView:topView];
     404   
     405    CGContextSetAllowsFontSmoothing(context, allowsSmoothing);
     406    CGContextSetAllowsFontSubpixelQuantization(context, allowsSubpixelQuantization);
     407}
     408
     409- (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)context topView:(BOOL)isTopView shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor
     410{
     411    bool allowsSmoothing = CGContextGetAllowsFontSmoothing(context);
     412    bool allowsSubpixelQuantization = CGContextGetAllowsFontSubpixelQuantization(context);
     413   
     414    [super _recursive:recurseX displayRectIgnoringOpacity:displayRect inGraphicsContext:graphicsContext CGContext:context topView:isTopView shouldChangeFontReferenceColor:shouldChangeFontReferenceColor];
     415   
     416    CGContextSetAllowsFontSmoothing(context, allowsSmoothing);
     417    CGContextSetAllowsFontSubpixelQuantization(context, allowsSubpixelQuantization);
    347418}
    348419
Note: See TracChangeset for help on using the changeset viewer.