@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When stabilizing document scroll position for diffs, stick to anchors harder

Summary: Ref T12779. Try a little harder to get the autoscroll heuristic right, but also just stick to anchors if the URL has an anchor and the scroll position is near that anchor.

Test Plan:
- Loaded an anchored diff at a bunch of window sizes, seemed pretty sticky.
- Added `usleep(100000 * mt_rand(1, 15))` to `ChangesetViewController` to make changesets load slowly and in random order, reloaded a bunch of times while scrolling around, things appeared reasonable.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12779

Differential Revision: https://secure.phabricator.com/D18060

+38 -17
+14 -14
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '1475bd91', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => 'a2755617', 16 - 'differential.pkg.js' => '5bf658f0', 16 + 'differential.pkg.js' => '9cab3335', 17 17 'diffusion.pkg.css' => 'b93d9b8c', 18 18 'diffusion.pkg.js' => '84c8f8fd', 19 19 'favicon.ico' => '30672e08', ··· 391 391 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 392 392 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 393 393 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 394 - 'rsrc/js/application/diff/DiffChangeset.js' => '1f6748ae', 394 + 'rsrc/js/application/diff/DiffChangeset.js' => 'aaaf4cb5', 395 395 'rsrc/js/application/diff/DiffChangesetList.js' => '85abc805', 396 396 'rsrc/js/application/diff/DiffInline.js' => '1d17130f', 397 397 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', ··· 770 770 'phabricator-darklog' => 'c8e1ffe3', 771 771 'phabricator-darkmessage' => 'c48cccdd', 772 772 'phabricator-dashboard-css' => 'fe5b1869', 773 - 'phabricator-diff-changeset' => '1f6748ae', 773 + 'phabricator-diff-changeset' => 'aaaf4cb5', 774 774 'phabricator-diff-changeset-list' => '85abc805', 775 775 'phabricator-diff-inline' => '1d17130f', 776 776 'phabricator-drag-and-drop-file-upload' => '58dea2fa', ··· 1024 1024 'javelin-uri', 1025 1025 'javelin-routable', 1026 1026 ), 1027 - '1f6748ae' => array( 1028 - 'javelin-dom', 1029 - 'javelin-util', 1030 - 'javelin-stratcom', 1031 - 'javelin-install', 1032 - 'javelin-workflow', 1033 - 'javelin-router', 1034 - 'javelin-behavior-device', 1035 - 'javelin-vector', 1036 - 'phabricator-diff-inline', 1037 - ), 1038 1027 '1f6794f6' => array( 1039 1028 'javelin-behavior', 1040 1029 'javelin-stratcom', ··· 1715 1704 'javelin-dom', 1716 1705 'javelin-util', 1717 1706 'phabricator-prefab', 1707 + ), 1708 + 'aaaf4cb5' => array( 1709 + 'javelin-dom', 1710 + 'javelin-util', 1711 + 'javelin-stratcom', 1712 + 'javelin-install', 1713 + 'javelin-workflow', 1714 + 'javelin-router', 1715 + 'javelin-behavior-device', 1716 + 'javelin-vector', 1717 + 'phabricator-diff-inline', 1718 1718 ), 1719 1719 'ab2f381b' => array( 1720 1720 'javelin-request',
+24 -3
webroot/rsrc/js/application/diff/DiffChangeset.js
··· 516 516 var target_bot = (target_pos.y + target_dim.y); 517 517 518 518 // Detect if the changeset is entirely (or, at least, almost entirely) 519 - // above us. 520 - var above_screen = (target_bot < old_pos.y + 128); 519 + // above us. The height here is roughly the height of the persistent 520 + // banner. 521 + var above_screen = (target_bot < old_pos.y + 64); 522 + 523 + // If we have a URL anchor and are currently nearby, stick to it 524 + // no matter what. 525 + var on_target = null; 526 + if (window.location.hash) { 527 + try { 528 + var anchor = JX.$(window.location.hash.replace('#', '')); 529 + if (anchor) { 530 + var anchor_pos = JX.$V(anchor); 531 + if ((anchor_pos.y > old_pos.y) && 532 + (anchor_pos.y < old_pos.y + 96)) { 533 + on_target = anchor; 534 + } 535 + } 536 + } catch (ignored) { 537 + // If we have a bogus anchor, just ignore it. 538 + } 539 + } 521 540 522 541 var frame = this._getContentFrame(); 523 542 JX.DOM.setContent(frame, JX.$H(response.changeset)); 524 543 525 544 if (this._stabilize) { 526 - if (!near_top) { 545 + if (on_target) { 546 + JX.DOM.scrollToPosition(old_pos.x, JX.$V(on_target).y - 60); 547 + } else if (!near_top) { 527 548 if (near_bot || above_screen) { 528 549 // Figure out how much taller the document got. 529 550 var delta = (JX.Vector.getDocument().y - old_dim.y);