haikuwebkit/LayoutTests/scrollbars/scrollbar-parts-opacity.html

59 lines
1.1 KiB
HTML
Raw Permalink Normal View History

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. Canonical link: https://commits.webkit.org/138063@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-21 18:04:42 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
}
::-webkit-scrollbar {
width: 60px;
height: 60px;
background-color: green;
opacity: 0.75;
}
::-webkit-scrollbar-thumb {
background-color: navy;
opacity: 0.5;
}
.overflow {
position: absolute;
height: 400px;
width: 400px;
overflow: scroll;
}
.contents {
height: 800px;
width: 800px;
}
.backdrop {
position: absolute;
top: 100px;
left: 100px;
height: 400px;
width: 400px;
background-color: gray;
}
.vertical {
width: 150px;
}
.horizontal {
height: 150px;
}
</style>
</head>
<body>
<div class="backdrop vertical"></div>
<div class="backdrop horizontal"></div>
<div class="composited overflow">
<div class="contents"></div>
</div>
</body>
</html>