• simon.fraser@apple.com's avatar
    Allow opacity to apply to custom scrollbars · 7c818704
    simon.fraser@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=120104
    
    Source/WebCore:
    
    Reviewed by David Hyatt.
    
    Opacity was ignored custom scrollbar pseudoelements because custom scrollbar
    renderers never create layers, and opacity is normally handled by the RenderLayer code.
    
    Fix by having RenderScrollbarTheme and RenderScrollbarPart do the transparency
    layers necessary for opacity. RenderScrollbarPart handles opacity for individual
    parts.
    
    Because ScrollbarThemeComposite::paint() renders the parts on after another (with
    no nesting), opacity handling for the entire scrollbar needs special-casing.
    This is done by willPaintScrollbar()/didPaintScrollbar() on the theme.
    RenderScrollbarTheme consults the opacity the scrollbar (which we get from
    the ScrollbarBGPart renderer) to decide whether to set up a transparency layer.
    
    Test: scrollbars/scrollbar-parts-opacity.html
    
    * platform/ScrollbarThemeComposite.cpp:
    (WebCore::ScrollbarThemeComposite::paint):
    * platform/ScrollbarThemeComposite.h:
    (WebCore::ScrollbarThemeComposite::willPaintScrollbar):
    (WebCore::ScrollbarThemeComposite::didPaintScrollbar):
    * rendering/RenderScrollbar.cpp:
    (WebCore::RenderScrollbar::opacity):
    * rendering/RenderScrollbar.h:
    * rendering/RenderScrollbarPart.cpp:
    (WebCore::RenderScrollbarPart::paintIntoRect):
    * rendering/RenderScrollbarTheme.cpp:
    (WebCore::RenderScrollbarTheme::willPaintScrollbar):
    (WebCore::RenderScrollbarTheme::didPaintScrollbar):
    * rendering/RenderScrollbarTheme.h:
    
    LayoutTests:
    
    Reviewed by David Hyatt.
    
    Ref test for custom scrollbars with opacity on the bar itself,
    and on the thumb.
    
    * scrollbars/scrollbar-parts-opacity-expected.html: Added.
    * scrollbars/scrollbar-parts-opacity.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    7c818704
scrollbar-parts-opacity.html 1.12 KB