From b8ed980d3dc53094832ba62a7083a30904b421da Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 7 Mar 2015 09:53:58 -0800 Subject: [PATCH] Fix scrollbar being cut off at end of gutter Summary: The "mlb" on the left nav creates a phantom bottom margin which gives the content measurable height but not scrollable height. Replace it with "plb" (padding) instead. The 2px-spacer calculation was also not quite correct. Test Plan: - Viewed pages with navs; padding vs margin didn't seem to make any other differences. - Scrollbar now stops in the right place in Safari, Chrome, Firefox. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12007 --- resources/celerity/map.php | 16 ++++++++-------- src/view/layout/AphrontSideNavFilterView.php | 2 +- webroot/rsrc/externals/javelin/lib/Scrollbar.js | 9 +++++++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 1ca906f60d..250f4ce3c7 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -207,7 +207,7 @@ return array( 'rsrc/externals/javelin/lib/Resource.js' => '44959b73', 'rsrc/externals/javelin/lib/Routable.js' => 'b3e7d692', 'rsrc/externals/javelin/lib/Router.js' => '29274e2b', - 'rsrc/externals/javelin/lib/Scrollbar.js' => '5b2f5a08', + 'rsrc/externals/javelin/lib/Scrollbar.js' => '1ed54a27', 'rsrc/externals/javelin/lib/URI.js' => '6eff08aa', 'rsrc/externals/javelin/lib/Vector.js' => '2caa8fb8', 'rsrc/externals/javelin/lib/WebSocket.js' => 'e292eaf4', @@ -676,7 +676,7 @@ return array( 'javelin-resource' => '44959b73', 'javelin-routable' => 'b3e7d692', 'javelin-router' => '29274e2b', - 'javelin-scrollbar' => '5b2f5a08', + 'javelin-scrollbar' => '1ed54a27', 'javelin-stratcom' => '6c53634d', 'javelin-tokenizer' => '7644823e', 'javelin-typeahead' => '70baed2f', @@ -942,6 +942,12 @@ return array( 'javelin-dom', 'javelin-reactor-dom', ), + '1ed54a27' => array( + 'javelin-install', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-vector', + ), '2035b9cb' => array( 'javelin-behavior', 'javelin-dom', @@ -1175,12 +1181,6 @@ return array( 'javelin-vector', 'javelin-dom', ), - '5b2f5a08' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-vector', - ), '5bc2cb21' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index 29f1d649ad..4f4c0803b8 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -318,7 +318,7 @@ final class AphrontSideNavFilterView extends AphrontView { phutil_tag( 'div', array( - 'class' => 'phabricator-nav-content mlb', + 'class' => 'phabricator-nav-content plb', 'id' => $content_id, ), array( diff --git a/webroot/rsrc/externals/javelin/lib/Scrollbar.js b/webroot/rsrc/externals/javelin/lib/Scrollbar.js index 2242e048b6..6f52811619 100644 --- a/webroot/rsrc/externals/javelin/lib/Scrollbar.js +++ b/webroot/rsrc/externals/javelin/lib/Scrollbar.js @@ -320,10 +320,15 @@ JX.install('Scrollbar', { var spos = JX.Vector.getAggregateScrollForNode(this._viewport); var vdim = JX.Vector.getDim(this._viewport); - var ratio = vdim.y / cdim.y; + var ratio = (vdim.y / cdim.y); + + // We're scaling things down very slightly to leave a 2px margin at + // either end of the scroll gutter, so the bar doesn't quite bump up + // against the chrome. + ratio = ratio * (vdim.y / (vdim.y + 4)); var offset = Math.round(ratio * spos.y) + 2; - var size = Math.floor(ratio * (vdim.y - 2)) - 2; + var size = Math.floor(ratio * vdim.y); if (size < cdim.y) { this._handle.style.top = offset + 'px';