Chromium Code Reviews| Index: sky/framework/sky-scrollable.sky |
| diff --git a/sky/framework/sky-scrollable.sky b/sky/framework/sky-scrollable.sky |
| index 3e41d8838ab3e01369b5fc9d5607e18dcd18ea3c..4cdaf56cfeccc570f3c02d6bd00d76c03709f2f2 100644 |
| --- a/sky/framework/sky-scrollable.sky |
| +++ b/sky/framework/sky-scrollable.sky |
| @@ -19,14 +19,14 @@ |
| #vbar { |
| position: absolute; |
| right: 0; |
| - width: 3px; |
| background-color: lightgray; |
| pointer-events: none; |
| top: 0; |
| height: 0; |
| will-change: opacity; |
| opacity: 0; |
| - transition: opacity 0.2s ease-in-out; |
| + transition-property: opacity; |
| + transition-function: ease-in-out; |
| } |
| </style> |
| <div id="scrollable"> |
| @@ -38,6 +38,7 @@ |
| import "dart:math" as math; |
| import "dart:sky"; |
| import "fling-curve.dart"; |
| +import "view-configuration.dart"; |
| @Tagname('sky-scrollable') |
| class SkyScrollable extends SkyElement { |
| @@ -59,6 +60,30 @@ class SkyScrollable extends SkyElement { |
| void shadowRootReady() { |
| _scrollable = shadowRoot.getElementById('scrollable'); |
| _vbar = shadowRoot.getElementById('vbar'); |
| + ViewConfiguration config = new ViewConfiguration(); |
| + // This is not documented anywhere, but the scrollbar appears to only paint |
| + // 3px even though it's official width is 10px? |
| + // Chrome appears 3px wide with a 3px outer spacing. |
| + // Contacts appears 3px wide with a 5px runner and 5px outer spacing. |
| + // Settings appears 4px wide with no outer spacing. |
| + double paintPercent = 0.3; |
| + double outerGapPercent = 0.3; |
| + double innerGapPercent = 0.4; |
| + double paintWidth = paintPercent * config.kScrollbarSize; |
| + _vbar.style['width'] = "${paintWidth}px"; |
| + _vbar.style['margin-right'] = "${outerGapPercent * config.kScrollbarSize}px"; |
| + _vbar.style['margin-left'] ="${innerGapPercent * config.kScrollbarSize}px"; |
| + // The scroll thumb never quite makes it to the top or bottom in gmail |
| + // or chrome (in chrome more from the bottom than the top). |
| + _vbar.style['margin-top'] = "${config.kScrollbarSize}px"; |
| + _vbar.style['margin-bottom'] = "${config.kScrollbarSize}px"; |
| + |
| + // Some android apps round their scrollbars, some don't, not rounding for now. |
| + //_vbar.style['border-radius'] = "${paintWidth / 2}px"; |
|
abarth-chromium
2015/02/24 21:48:25
Remove commented out code?
|
| + |
| + double msToSeconds = 1.0 / 1000.0; |
| + _vbar.style['transition-duration'] = "${msToSeconds * config.kScrollbarFadeDuration}s"; |
| + _vbar.style['transition-delay'] = "${msToSeconds * config.kScrollbarFadeDelay}s"; |
|
abarth-chromium
2015/02/24 21:48:25
Can we make these strings all compile-time constan
|
| } |
| double get scrollOffset => _scrollOffset; |