Skip to content
  • bokan's avatar
    Use nine-patch resource for drawing Aura overlay scrollbar thumb. · e7a058aa
    bokan authored
    This patch factors out the nine-patch generation from NinePatchLayer
    into a NinePatchGenerator and uses it to create a nine-patch scrollbar
    layer that can change size without a repaint. This is used only in the
    compositor. Scrollbars painted in Blink paint to the full required size.
    
    The new scrollbar type is implemented in OverlayScrollbarLayer and Impl.
    We add methods to NativeTheme to draw 9-patch versions of a theme part,
    currently implemented for the scrollbar thumb for overlays in
    NativeThemeAura. The NativeTheme provides two methods:
    
    NinePatchCanvasSize() returns the size of the smallest canvas onto which
    a nine patch part can be drawn.
    
    NinePatchAperture() returns the rect in the canvas, whose size is
    provided by the method above, which will be used as the middle patch in
    the resource. Resizing the part will stretch only the middle patch in
    both directions.
    
    This is used mainly for the thinning animation in Aura overlay
    scrollbars. We still need to repaint due to hover and pressed effects.
    Technically, we could avoid repainting on size changes too but this would
    require some additional work.
    
    BUG=669670
    CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
    
    Review-Url: https://codereview.chromium.org/2591863003
    Cr-Commit-Position: refs/heads/master@{#454413}
    e7a058aa