• tapted's avatar
    Mac: Hack around Sierra autolayout bug in the certificate viewer. · 027233cd
    tapted authored
    Currently on macOS 10.12 Sierra, invoking the OS-provided SSL
    certificate viewer used by Chrome will show a window sheet with an
    improperly constrained height. Tracing shows the autolayout algorithm
    going berserk - it gets invoked a few thousand times and decides that
    the NSScrollView containing the certificate details should be sized as
    though details are expanded, and doesn't add scrollbars. This usually
    results in an attached panel window much larger than the screen height,
    which is mostly unusable.
    
    This happens when linking to the 10.10 SDK, but not the 10.11 SDK, and
    only when running against Sierra's 10.12 SDK.
    
    To fix, append an override of -[NSWindow setFrame:display:animate] to
    the certificate viewer's class implementation using the Objective C
    runtime. This override prevents programmatic changes to the frame from
    setting a height more than 400 pixels. User-initiated resizes function
    as usual.
    
    BUG=643123
    TEST=On macOS 10.12 Sierra, go to a secure site (e.g.
    https://www.google.com) and view the SSL certificate (click padlock,
    click Details, click View Certificate). It should fit within the screen
    area. On other OSX versions, there should be no change.
    
    Review-Url: https://codereview.chromium.org/2356113002
    Cr-Commit-Position: refs/heads/master@{#420038}
    027233cd
certificate_viewer_mac.mm 6.94 KB