diff --git a/resources/celerity/map.php b/resources/celerity/map.php index b1d28cf453..575ce9a2b1 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -12,8 +12,8 @@ return array( 'core.pkg.css' => 'ee5f28cd', 'core.pkg.js' => '8c5f913d', 'darkconsole.pkg.js' => '1f9a31bc', - 'differential.pkg.css' => '4ff77743', - 'differential.pkg.js' => '85543704', + 'differential.pkg.css' => 'ea471cb0', + 'differential.pkg.js' => '7f24021f', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -64,7 +64,7 @@ return array( 'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869', 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', - 'rsrc/css/application/differential/changeset-view.css' => '69a3c268', + 'rsrc/css/application/differential/changeset-view.css' => '6a77323e', 'rsrc/css/application/differential/core.css' => '5b7b8ff4', 'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542', 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', @@ -390,13 +390,13 @@ return array( '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' => 'c5742feb', - 'rsrc/js/application/diff/DiffChangesetList.js' => 'f1101e6e', - 'rsrc/js/application/diff/DiffInline.js' => 'a81c29d4', + 'rsrc/js/application/diff/DiffChangeset.js' => '34e513e2', + 'rsrc/js/application/diff/DiffChangesetList.js' => 'fcbf80e9', + 'rsrc/js/application/diff/DiffInline.js' => 'c2e9ff4c', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', - 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '89d11432', + 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'd59300f5', 'rsrc/js/application/differential/behavior-populate.js' => '5e41c819', 'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb', 'rsrc/js/application/differential/behavior-user-select.js' => 'a8d8459d', @@ -567,7 +567,7 @@ return array( 'conpherence-thread-manager' => '4d863052', 'conpherence-transaction-css' => '85129c68', 'd3' => 'a11a5ff2', - 'differential-changeset-view-css' => '69a3c268', + 'differential-changeset-view-css' => '6a77323e', 'differential-core-view-css' => '5b7b8ff4', 'differential-revision-add-comment-css' => 'c47f8c40', 'differential-revision-comment-css' => '14b8565a', @@ -619,7 +619,7 @@ return array( 'javelin-behavior-device' => 'bb1dd507', 'javelin-behavior-diff-preview-link' => '051c7832', 'javelin-behavior-differential-diff-radios' => 'e1ff79b1', - 'javelin-behavior-differential-edit-inline-comments' => '89d11432', + 'javelin-behavior-differential-edit-inline-comments' => 'd59300f5', 'javelin-behavior-differential-feedback-preview' => 'b064af76', 'javelin-behavior-differential-populate' => '5e41c819', 'javelin-behavior-differential-toggle-files' => 'ca3f91eb', @@ -779,9 +779,9 @@ return array( 'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darkmessage' => 'c48cccdd', 'phabricator-dashboard-css' => 'fe5b1869', - 'phabricator-diff-changeset' => 'c5742feb', - 'phabricator-diff-changeset-list' => 'f1101e6e', - 'phabricator-diff-inline' => 'a81c29d4', + 'phabricator-diff-changeset' => '34e513e2', + 'phabricator-diff-changeset-list' => 'fcbf80e9', + 'phabricator-diff-inline' => 'c2e9ff4c', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-fatal-config-template-css' => '8f18fa41', @@ -1129,6 +1129,17 @@ return array( 'javelin-dom', 'javelin-workflow', ), + '34e513e2' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + 'phabricator-diff-inline', + ), '3ab51e2c' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1398,12 +1409,12 @@ return array( '6882e80a' => array( 'javelin-dom', ), - '69a3c268' => array( - 'phui-inline-comment-view-css', - ), '69adf288' => array( 'javelin-install', ), + '6a77323e' => array( + 'phui-inline-comment-view-css', + ), '6ad39b6f' => array( 'javelin-install', 'javelin-event', @@ -1564,13 +1575,6 @@ return array( 'phabricator-draggable-list', 'javelin-workboard-column', ), - '89d11432' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'javelin-util', - 'javelin-vector', - ), '8a41885b' => array( 'javelin-install', 'javelin-dom', @@ -1718,9 +1722,6 @@ return array( 'javelin-stratcom', 'javelin-dom', ), - 'a81c29d4' => array( - 'javelin-dom', - ), 'a8beebea' => array( 'phui-oi-list-view-css', ), @@ -1909,23 +1910,15 @@ return array( 'javelin-dom', 'javelin-vector', ), + 'c2e9ff4c' => array( + 'javelin-dom', + ), 'c420b0b9' => array( 'javelin-behavior', 'javelin-behavior-device', 'javelin-stratcom', 'phabricator-tooltip', ), - 'c5742feb' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - 'phabricator-diff-inline', - ), 'c587b80f' => array( 'javelin-install', ), @@ -2043,6 +2036,13 @@ return array( 'javelin-dom', 'javelin-stratcom', ), + 'd59300f5' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'javelin-util', + 'javelin-vector', + ), 'd5a2d665' => array( 'javelin-behavior', 'javelin-stratcom', @@ -2174,9 +2174,6 @@ return array( 'javelin-workflow', 'javelin-json', ), - 'f1101e6e' => array( - 'javelin-install', - ), 'f50152ad' => array( 'phui-timeline-view-css', ), @@ -2224,6 +2221,9 @@ return array( 'javelin-dom', 'phortune-credit-card-form', ), + 'fcbf80e9' => array( + 'javelin-install', + ), 'fe287620' => array( 'javelin-install', 'javelin-dom', diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css index 1c14883a36..92a544c24c 100644 --- a/webroot/rsrc/css/application/differential/changeset-view.css +++ b/webroot/rsrc/css/application/differential/changeset-view.css @@ -109,10 +109,6 @@ color: {$darkgreytext}; } -.differential-diff th.selected { - background-color: {$sh-yellowbackground}; -} - .differential-changeset-immutable .differential-diff th { cursor: auto; } @@ -308,6 +304,7 @@ td.cov-I { top: 0; left: 0; box-sizing: border-box; + pointer-events: none; } .differential-diff .inline > td { diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js index 3130fced44..8176e4f12b 100644 --- a/webroot/rsrc/js/application/diff/DiffChangeset.js +++ b/webroot/rsrc/js/application/diff/DiffChangeset.js @@ -27,6 +27,9 @@ JX.install('DiffChangeset', { this._encoding = data.encoding; this._loaded = data.loaded; + this._leftID = data.left; + this._rightID = data.right; + this._inlines = []; }, @@ -48,8 +51,19 @@ JX.install('DiffChangeset', { _encoding: null, _undoTemplates: null, + _leftID: null, + _rightID: null, + _inlines: null, + getLeftChangesetID: function() { + return this._leftID; + }, + + getRightChangesetID: function() { + return this._rightID; + }, + /** * Has the content of this changeset been loaded? * diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js index 6380ccbf42..d9f1e35991 100644 --- a/webroot/rsrc/js/application/diff/DiffChangesetList.js +++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js @@ -56,6 +56,12 @@ JX.install('DiffChangesetList', { 'mousedown', ['differential-inline-comment', 'differential-inline-header'], onselect); + + var onhover = JX.bind(this, this._ifawake, this._onhover); + JX.Stratcom.listen( + ['mouseover', 'mouseout'], + 'differential-inline-comment', + onhover); }, properties: { @@ -74,16 +80,24 @@ JX.install('DiffChangesetList', { _focusStart: null, _focusEnd: null, + _hoverNode: null, + _hoverInline: null, + _hoverOrigin: null, + _hoverTarget: null, + sleep: function() { this._asleep = true; this._redrawFocus(); + this._redrawSelection(); + this.resetHover(); }, wake: function() { this._asleep = false; this._redrawFocus(); + this._redrawSelection(); if (this._initialized) { return; @@ -428,6 +442,21 @@ JX.install('DiffChangesetList', { return result; }, + _onhover: function(e) { + if (e.getIsTouchEvent()) { + return; + } + + var inline; + if (e.getType() == 'mouseout') { + inline = null; + } else { + inline = this._getInlineForEvent(e); + } + + this._setHoverInline(inline); + }, + _onmore: function(e) { e.kill(); @@ -669,6 +698,8 @@ JX.install('DiffChangesetList', { _onresize: function() { this._redrawFocus(); + this._redrawSelection(); + this._redrawHover(); }, _onselect: function(e) { @@ -769,6 +800,11 @@ JX.install('DiffChangesetList', { if (forms.length) { JX.DOM.invoke(forms[0], 'shouldRefresh'); } + + // Clear the mouse hover reticle after a substantive edit: we don't get + // a "mouseout" event if the row vanished because of row being removed + // after an edit. + this.reseHover(); }, setFocus: function(node, extended_node) { @@ -812,6 +848,112 @@ JX.install('DiffChangesetList', { return this._focusNode; }, + _setHoverInline: function(inline) { + this._hoverInline = inline; + + if (inline) { + var changeset = inline.getChangeset(); + + var changeset_id; + var side = inline.getDisplaySide(); + if (side == 'right') { + changeset_id = changeset.getRightChangesetID(); + } else { + changeset_id = changeset.getLeftChangesetID(); + } + + var new_part; + if (inline.isNewFile()) { + new_part = 'N'; + } else { + new_part = 'O'; + } + + var prefix = 'C' + changeset_id + new_part + 'L'; + + var number = inline.getLineNumber(); + var length = inline.getLineLength(); + + var origin = JX.$(prefix + number); + var target = JX.$(prefix + (number + length)); + + this._hoverOrigin = origin; + this._hoverTarget = target; + } else { + this._hoverOrigin = null; + this._hoverTarget = null; + } + + this._redrawHover(); + }, + + resetHover: function() { + this._setHoverInline(null); + }, + + _redrawHover: function() { + var reticle = this._getHoverNode(); + if (!this._hoverOrigin || this.isAsleep()) { + JX.DOM.remove(reticle); + return; + } + + JX.DOM.getContentFrame().appendChild(reticle); + + var top = this._hoverOrigin; + var bot = this._hoverTarget; + if (JX.$V(top).y > JX.$V(bot).y) { + var tmp = top; + top = bot; + bot = tmp; + } + + // Find the leftmost cell that we're going to highlight: this is the next + //