1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Clean up some Conpherence beahviors with a mouse

Summary:
Fixes T7825. If JX.Scrollbar activates, we sometimes target the wrong node.

(We don't have this issue in the column because it rebuilds a new JX.Scrollbar every time.)

Test Plan:
  - Sent messages, no spooky text.
  - Loaded page, got scroll to bottom.
  - Unplugged all USB devices, restarted browser, repeated.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7825

Differential Revision: https://secure.phabricator.com/D12413
This commit is contained in:
epriestley 2015-04-14 13:04:22 -07:00
parent a91a3cd22f
commit b40a84c92f
3 changed files with 49 additions and 47 deletions

View file

@ -7,7 +7,7 @@
*/
return array(
'names' => array(
'core.pkg.css' => 'b13bb594',
'core.pkg.css' => '717b46d1',
'core.pkg.js' => '6a4f677f',
'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '3500921f',
@ -29,6 +29,7 @@ return array(
'rsrc/css/aphront/table-view.css' => '59e2c0f8',
'rsrc/css/aphront/tokenizer.css' => '82ce2142',
'rsrc/css/aphront/tooltip.css' => '7672b60f',
'rsrc/css/aphront/transaction.css' => 'bd9f9f6e',
'rsrc/css/aphront/two-column.css' => '16ab3ad2',
'rsrc/css/aphront/typeahead.css' => '0e403212',
'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af',
@ -43,11 +44,10 @@ return array(
'rsrc/css/application/config/config-welcome.css' => '6abd79be',
'rsrc/css/application/config/setup-issue.css' => '22270af2',
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
'rsrc/css/application/conpherence/durable-column.css' => 'f50d701e',
'rsrc/css/application/conpherence/durable-column.css' => '9d3af55b',
'rsrc/css/application/conpherence/menu.css' => 'f389e048',
'rsrc/css/application/conpherence/message-pane.css' => '9ae1b2f7',
'rsrc/css/application/conpherence/message-pane.css' => 'e978e4ae',
'rsrc/css/application/conpherence/notification.css' => '72178795',
'rsrc/css/application/conpherence/transaction.css' => '25138b7f',
'rsrc/css/application/conpherence/update.css' => '1099a660',
'rsrc/css/application/conpherence/widget-pane.css' => 'a9082fd0',
'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4',
@ -209,7 +209,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' => '798fdb63',
'rsrc/externals/javelin/lib/Scrollbar.js' => 'eaa5b321',
'rsrc/externals/javelin/lib/Sound.js' => '949c0fe5',
'rsrc/externals/javelin/lib/URI.js' => '6eff08aa',
'rsrc/externals/javelin/lib/Vector.js' => '2caa8fb8',
@ -356,7 +356,7 @@ return array(
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '0a5192c4',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '7ffa744f',
'rsrc/js/application/conpherence/behavior-menu.js' => '13d94a68',
'rsrc/js/application/conpherence/behavior-menu.js' => '077a1dab',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '93568464',
@ -515,12 +515,11 @@ return array(
'changeset-view-manager' => '58562350',
'config-options-css' => '7fedf08b',
'config-welcome-css' => '6abd79be',
'conpherence-durable-column-view' => 'f50d701e',
'conpherence-durable-column-view' => '9d3af55b',
'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => '9ae1b2f7',
'conpherence-message-pane-css' => 'e978e4ae',
'conpherence-notification-css' => '72178795',
'conpherence-thread-manager' => '0a5192c4',
'conpherence-transaction-css' => '25138b7f',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => 'a9082fd0',
'differential-changeset-view-css' => 'e19cfd6e',
@ -560,7 +559,7 @@ return array(
'javelin-behavior-boards-dropdown' => '0ec56e1d',
'javelin-behavior-choose-control' => '6153c708',
'javelin-behavior-config-reorder-fields' => '14a827de',
'javelin-behavior-conpherence-menu' => '13d94a68',
'javelin-behavior-conpherence-menu' => '077a1dab',
'javelin-behavior-conpherence-pontificate' => '21ba5861',
'javelin-behavior-conpherence-widget-pane' => '93568464',
'javelin-behavior-countdown-timer' => 'e4cc26b3',
@ -681,7 +680,7 @@ return array(
'javelin-resource' => '44959b73',
'javelin-routable' => 'b3e7d692',
'javelin-router' => '29274e2b',
'javelin-scrollbar' => '798fdb63',
'javelin-scrollbar' => 'eaa5b321',
'javelin-sound' => '949c0fe5',
'javelin-stratcom' => '6c53634d',
'javelin-tokenizer' => '7644823e',
@ -751,6 +750,7 @@ return array(
'phabricator-textareautils' => '5c93c52c',
'phabricator-title' => 'df5e11d2',
'phabricator-tooltip' => '1d298e3a',
'phabricator-transaction-view-css' => 'bd9f9f6e',
'phabricator-ui-example-css' => '528b19de',
'phabricator-uiexample-javelin-view' => 'd4a14807',
'phabricator-uiexample-reactor-button' => 'd19198c8',
@ -859,6 +859,20 @@ return array(
'javelin-stratcom',
'javelin-workflow',
),
'077a1dab' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'javelin-scrollbar',
'phabricator-title',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'08883e8b' => array(
'javelin-behavior',
'javelin-stratcom',
@ -909,20 +923,6 @@ return array(
'javelin-uri',
'phabricator-textareautils',
),
'13d94a68' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'javelin-scrollbar',
'phabricator-title',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'1499a8cb' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1392,12 +1392,6 @@ return array(
'javelin-behavior',
'javelin-quicksand',
),
'798fdb63' => array(
'javelin-install',
'javelin-dom',
'javelin-stratcom',
'javelin-vector',
),
'7a68dda3' => array(
'owners-path-editor',
'javelin-behavior',
@ -1923,6 +1917,12 @@ return array(
'phabricator-phtize',
'javelin-dom',
),
'eaa5b321' => array(
'javelin-install',
'javelin-dom',
'javelin-stratcom',
'javelin-vector',
),
'efe49472' => array(
'javelin-install',
'javelin-util',
@ -2040,6 +2040,7 @@ return array(
'phabricator-remarkup-css',
'syntax-highlighting-css',
'aphront-pager-view-css',
'phabricator-transaction-view-css',
'aphront-tooltip-css',
'phabricator-flag-css',
'phui-info-view-css',

View file

@ -302,8 +302,7 @@ JX.install('Scrollbar', {
* height of the scroll area, and we may want to make adjustments.
*/
_onload: function() {
var viewport = this._viewport || this._frame;
var viewport = this.getViewportNode();
var height = viewport.scrollHeight;
var visible = JX.Vector.getDim(viewport).y;
if (this._lastHeight !== null && this._lastHeight != height) {
@ -410,6 +409,14 @@ JX.install('Scrollbar', {
}
},
getContentNode: function() {
return this._content || this._frame;
},
getViewportNode: function() {
return this._viewport || this._frame;
},
scrollTo: function(scroll) {
if (this._viewport !== null) {
this._viewport.scrollTop = scroll;

View file

@ -37,50 +37,46 @@ JX.behavior('conpherence-menu', function(config) {
var form = JX.$H(r.form);
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var header_root = JX.DOM.find(root, 'div', 'conpherence-header-pane');
var messages_root = JX.DOM.find(root, 'div', 'conpherence-messages');
var form_root = JX.DOM.find(root, 'div', 'conpherence-form');
JX.DOM.setContent(header_root, header);
JX.DOM.setContent(messages_root, messages);
JX.DOM.setContent(scrollbar.getContentNode(), messages);
JX.DOM.setContent(form_root, form);
markThreadLoading(false);
didRedrawThread(true);
});
threadManager.setDidUpdateThreadCallback(function(r) {
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var messages_root = JX.DOM.find(root, 'div', 'conpherence-message-pane');
var messages = JX.DOM.find(messages_root, 'div', 'conpherence-messages');
JX.DOM.appendContent(messages, JX.$H(r.transactions));
JX.DOM.appendContent(scrollbar.getContentNode(), JX.$H(r.transactions));
_scrollMessageWindow();
});
threadManager.setWillSendMessageCallback(function () {
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var form_root = JX.DOM.find(root, 'div', 'conpherence-form');
markThreadLoading(true);
JX.DOM.alterClass(form_root, 'loading', true);
});
threadManager.setDidSendMessageCallback(function (r, non_update) {
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var form_root = JX.DOM.find(root, 'div', 'conpherence-form');
var textarea = JX.DOM.find(form_root, 'textarea');
if (!non_update) {
var messages_root = JX.DOM.find(root, 'div', 'conpherence-message-pane');
var messages = JX.DOM.find(messages_root, 'div', 'conpherence-messages');
var fileWidget = null;
try {
fileWidget = JX.DOM.find(root, 'div', 'widgets-files');
} catch (ex) {
// Ignore; maybe no files widget
}
JX.DOM.appendContent(messages, JX.$H(r.transactions));
JX.DOM.appendContent(scrollbar.getContentNode(), JX.$H(r.transactions));
_scrollMessageWindow();
if (fileWidget) {
JX.DOM.setContent(
fileWidget,
JX.$H(r.file_widget)
);
JX.$H(r.file_widget));
}
textarea.value = '';
}
@ -323,8 +319,6 @@ JX.behavior('conpherence-menu', function(config) {
}
var _firstScroll = true;
function _scrollMessageWindow() {
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
var messages_root = JX.DOM.find(root, 'div', 'conpherence-messages');
if (_firstScroll) {
_firstScroll = false;
// let the standard #anchor tech take over
@ -332,7 +326,7 @@ JX.behavior('conpherence-menu', function(config) {
return;
}
}
scrollbar.scrollTo(messages_root.scrollHeight);
scrollbar.scrollTo(scrollbar.getViewportNode().scrollHeight);
}
function _focusTextarea() {
var root = JX.DOM.find(document, 'div', 'conpherence-layout');