• shrike's avatar
    Fix darkly-drawn Show All button in Downloads Shelf. · 890dcc45
    shrike authored
    When the download shelf appears the Show All button at the far right is
    very dark, almost as if its been drawn several times on top of itself
    (see the original bug report for a screenshot of the problem).
    
    The problem is that the Show All button is layer backed (because the
    shelf is), so it caches its contents. The Show All button also declares
    itself to be opaque but wants the shelf background texture to show
    through. It accomplishes this by simulating a lock focus onto the shelf
    from within its drawRect:, and calling the shelf's drawRect:.
    
    Unfortunately, when the button first draws (into its layer) the shelf
    is hidden and so the shelf's height is 0.0. The shelf's drawing routines
    restrict themselves to the shelf's bounds rect - that works most of the
    time because if the shelf has 0 height there should be no drawing to be
    done. This optimization doesn't work for the Show All button when it
    uses the zero-height shelf to draw its background.
    
    The proposed fix is to detect the zero-height shelf from within
    drawRect:, and to use a frame-changed notification from the shelf as
    the signal to request a redraw.
    
    BUG=485782
    
    Review URL: https://codereview.chromium.org/1125363005
    
    Cr-Commit-Position: refs/heads/master@{#330120}
    890dcc45
nsview_additions.h 1.9 KB