Page MenuHomePhabricator

D18052.id43414.diff
No OneTemporary

D18052.id43414.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -13,7 +13,7 @@
'core.pkg.js' => '1475bd91',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '7d4cfa59',
- 'differential.pkg.js' => '1d120743',
+ 'differential.pkg.js' => 'c14e5857',
'diffusion.pkg.css' => 'b93d9b8c',
'diffusion.pkg.js' => '84c8f8fd',
'favicon.ico' => '30672e08',
@@ -391,7 +391,7 @@
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
- 'rsrc/js/application/diff/DiffChangeset.js' => 'cf4e2140',
+ 'rsrc/js/application/diff/DiffChangeset.js' => '7fc48e4f',
'rsrc/js/application/diff/DiffChangesetList.js' => '7a184082',
'rsrc/js/application/diff/DiffInline.js' => '19582231',
'rsrc/js/application/diff/ScrollObjective.js' => '7e8877e7',
@@ -779,7 +779,7 @@
'phabricator-darklog' => 'c8e1ffe3',
'phabricator-darkmessage' => 'c48cccdd',
'phabricator-dashboard-css' => 'fe5b1869',
- 'phabricator-diff-changeset' => 'cf4e2140',
+ 'phabricator-diff-changeset' => '7fc48e4f',
'phabricator-diff-changeset-list' => '7a184082',
'phabricator-diff-inline' => '19582231',
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
@@ -1531,6 +1531,17 @@
'7f243deb' => array(
'javelin-install',
),
+ '7fc48e4f' => array(
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-stratcom',
+ 'javelin-install',
+ 'javelin-workflow',
+ 'javelin-router',
+ 'javelin-behavior-device',
+ 'javelin-vector',
+ 'phabricator-diff-inline',
+ ),
'8018ee50' => array(
'javelin-install',
'javelin-util',
@@ -2002,17 +2013,6 @@
'cd2b9b77' => array(
'phui-oi-list-view-css',
),
- 'cf4e2140' => array(
- 'javelin-dom',
- 'javelin-util',
- 'javelin-stratcom',
- 'javelin-install',
- 'javelin-workflow',
- 'javelin-router',
- 'javelin-behavior-device',
- 'javelin-vector',
- 'phabricator-diff-inline',
- ),
'd0a99ab4' => array(
'javelin-behavior',
'javelin-typeahead-ondemand-source',
diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js
--- a/webroot/rsrc/js/application/diff/DiffChangeset.js
+++ b/webroot/rsrc/js/application/diff/DiffChangeset.js
@@ -501,12 +501,17 @@
// diff with a large number of changes don't constantly have the text
// area scrolled off the bottom of the screen until the entire diff loads.
//
- // There are two three major cases here:
+ // There are several major cases here:
//
// - If we're near the top of the document, never scroll.
- // - If we're near the bottom of the document, always scroll.
- // - Otherwise, scroll if the changes were above the midline of the
- // viewport.
+ // - If we're near the bottom of the document, always scroll, unless
+ // we have an anchor.
+ // - Otherwise, scroll if the changes were above (or, at least,
+ // almost entirely above) the viewport.
+ //
+ // We don't scroll if the changes were just near the top of the viewport
+ // because this makes us scroll incorrectly when an anchored change is
+ // visible. See T12779.
var target = this._node;
@@ -529,17 +534,18 @@
var target_pos = JX.Vector.getPos(target);
var target_dim = JX.Vector.getDim(target);
- var target_mid = (target_pos.y + (target_dim.y / 2));
+ var target_bot = (target_pos.y + target_dim.y);
- var view_mid = (old_pos.y + (old_view.y / 2));
- var above_mid = (target_mid < view_mid);
+ // Detect if the changeset is entirely (or, at least, almost entirely)
+ // above us.
+ var above_screen = (target_bot < old_pos.y + 128);
var frame = this._getContentFrame();
JX.DOM.setContent(frame, JX.$H(response.changeset));
if (this._stabilize) {
if (!near_top) {
- if (near_bot || above_mid) {
+ if (near_bot || above_screen) {
// Figure out how much taller the document got.
var delta = (JX.Vector.getDocument().y - old_dim.y);
JX.DOM.scrollToPosition(old_pos.x, old_pos.y + delta);

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 23, 6:23 AM (5 d, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7717993
Default Alt Text
D18052.id43414.diff (4 KB)

Event Timeline