Ignore:
Timestamp:
Aug 21, 2013, 11:04:42 AM (12 years ago)
Author:
Simon Fraser
Message:

Allow opacity to apply to custom scrollbars
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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderScrollbar.cpp

    r143848 r154400  
    358358}
    359359
    360 }
     360float RenderScrollbar::opacity()
     361{
     362    RenderScrollbarPart* partRenderer = m_parts.get(ScrollbarBGPart);
     363    if (!partRenderer)
     364        return 1;
     365
     366    return partRenderer->style()->opacity();
     367}
     368
     369}
Note: See TracChangeset for help on using the changeset viewer.