| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 body { |
| 4 height: 2000px; |
| 5 width: 2000px; |
| 6 } |
| 7 ::-webkit-scrollbar { |
| 8 width: 20px; |
| 9 height: 20px; |
| 10 } /* this targets the default scrollbar (compulsory) */ |
| 11 |
| 12 ::-webkit-scrollbar-track { |
| 13 background-color: #b46868; |
| 14 } /* the new scrollbar will have a flat appearance with the set background col
or */ |
| 15 |
| 16 ::-webkit-scrollbar-thumb { |
| 17 background-color: rgba(0, 0, 0, 0.2); |
| 18 } /* this will style the thumb, ignoring the track */ |
| 19 </style> |
| 20 |
| 21 <script src="../../../resources/testharness.js"></script> |
| 22 <script src="../../../resources/testharnessreport.js"></script> |
| 23 <script> |
| 24 var browserZoomFactor = 1.25; |
| 25 var pageScaleFactor = 2; |
| 26 var scrollbarWidth = 20; |
| 27 var scrollbarHeight = 20; |
| 28 |
| 29 function viewport() { |
| 30 return document.visualViewport; |
| 31 } |
| 32 |
| 33 async_test(function(t) { |
| 34 window.onload = t.step_func(function() { |
| 35 // TODO(ymalik): Remove hook to internals to pinch-zoom here and browser |
| 36 // zoom below. This will be required to upstream to w3c repo. |
| 37 internals.setPageScaleFactor(pageScaleFactor); |
| 38 |
| 39 // Verify viewport dimensions exclude scrollbar. |
| 40 assert_equals(viewport().clientWidth, 800 / pageScaleFactor - scrollbarWid
th); |
| 41 assert_equals(viewport().clientHeight, 600 / pageScaleFactor - scrollbarHe
ight); |
| 42 |
| 43 // Apply browser zoom. |
| 44 window.internals.setZoomFactor(browserZoomFactor); |
| 45 |
| 46 // Verify scrollbar exclusion with browser zoom. Custom scrollbars are |
| 47 // scaled with browser zoom but remain unchanged with pinch zoom. |
| 48 assert_equals(viewport().clientWidth, 800 / browserZoomFactor / pageScaleF
actor - scrollbarWidth * browserZoomFactor); |
| 49 assert_equals(viewport().clientHeight, 600 / browserZoomFactor / pageScale
Factor - scrollbarHeight * browserZoomFactor); |
| 50 t.done(); |
| 51 }); |
| 52 }, 'Verify viewport dimensions exclude custom scrollbars.'); |
| 53 </script> |
| OLD | NEW |