зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1368022 - Remove autoscroll property from UI reducer; r=nchevobbe
MozReview-Commit-ID: IwOvNrJjS1l --HG-- extra : rebase_source : b2711c0b8f52a66da44aab1a94d1b26da9463699
This commit is contained in:
Родитель
1bbc103c25
Коммит
62685cf8c0
|
@ -16,7 +16,6 @@ const {
|
|||
getAllMessagesUiById,
|
||||
getAllMessagesTableDataById,
|
||||
} = require("devtools/client/webconsole/new-console-output/selectors/messages");
|
||||
const { getScrollSetting } = require("devtools/client/webconsole/new-console-output/selectors/ui");
|
||||
const MessageContainer = createFactory(require("devtools/client/webconsole/new-console-output/components/message-container").MessageContainer);
|
||||
|
||||
const ConsoleOutput = createClass({
|
||||
|
@ -31,7 +30,6 @@ const ConsoleOutput = createClass({
|
|||
openContextMenu: PropTypes.func.isRequired,
|
||||
sourceMapService: PropTypes.object,
|
||||
}),
|
||||
autoscroll: PropTypes.bool.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
timestampsVisible: PropTypes.bool,
|
||||
messagesTableData: PropTypes.object.isRequired,
|
||||
|
@ -47,17 +45,16 @@ const ConsoleOutput = createClass({
|
|||
},
|
||||
|
||||
componentWillUpdate(nextProps, nextState) {
|
||||
if (!this.outputNode) {
|
||||
const outputNode = this.outputNode;
|
||||
if (!outputNode || !outputNode.lastChild) {
|
||||
return;
|
||||
}
|
||||
|
||||
const outputNode = this.outputNode;
|
||||
|
||||
// Figure out if we are at the bottom. If so, then any new message should be scrolled
|
||||
// into view.
|
||||
if (this.props.autoscroll && outputNode.lastChild) {
|
||||
this.shouldScrollBottom = isScrolledToBottom(outputNode.lastChild, outputNode);
|
||||
}
|
||||
const lastChild = outputNode.lastChild;
|
||||
const delta = nextProps.messages.size - this.props.messages.size;
|
||||
this.shouldScrollBottom = delta > 0 && isScrolledToBottom(lastChild, outputNode);
|
||||
},
|
||||
|
||||
componentDidUpdate() {
|
||||
|
@ -75,7 +72,6 @@ const ConsoleOutput = createClass({
|
|||
render() {
|
||||
let {
|
||||
dispatch,
|
||||
autoscroll,
|
||||
messages,
|
||||
messagesUi,
|
||||
messagesTableData,
|
||||
|
@ -92,7 +88,6 @@ const ConsoleOutput = createClass({
|
|||
serviceContainer,
|
||||
open: messagesUi.includes(message.id),
|
||||
tableData: messagesTableData.get(message.id),
|
||||
autoscroll,
|
||||
indent: message.indent,
|
||||
timestampsVisible,
|
||||
})
|
||||
|
@ -128,7 +123,6 @@ function mapStateToProps(state, props) {
|
|||
messages: getAllMessages(state),
|
||||
messagesUi: getAllMessagesUiById(state),
|
||||
messagesTableData: getAllMessagesTableDataById(state),
|
||||
autoscroll: getScrollSetting(state),
|
||||
timestampsVisible: state.ui.timestampsVisible,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ const MessageContainer = createClass({
|
|||
message: PropTypes.object.isRequired,
|
||||
open: PropTypes.bool.isRequired,
|
||||
serviceContainer: PropTypes.object.isRequired,
|
||||
autoscroll: PropTypes.bool.isRequired,
|
||||
indent: PropTypes.number.isRequired,
|
||||
tableData: PropTypes.object,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
|
|
|
@ -17,7 +17,6 @@ ConsoleCommand.displayName = "ConsoleCommand";
|
|||
|
||||
ConsoleCommand.propTypes = {
|
||||
message: PropTypes.object.isRequired,
|
||||
autoscroll: PropTypes.bool.isRequired,
|
||||
indent: PropTypes.number.isRequired,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
serviceContainer: PropTypes.object,
|
||||
|
@ -32,7 +31,6 @@ ConsoleCommand.defaultProps = {
|
|||
*/
|
||||
function ConsoleCommand(props) {
|
||||
const {
|
||||
autoscroll,
|
||||
indent,
|
||||
message,
|
||||
timestampsVisible,
|
||||
|
@ -52,7 +50,6 @@ function ConsoleCommand(props) {
|
|||
level,
|
||||
topLevelClasses: [],
|
||||
messageBody,
|
||||
scrollToMessage: autoscroll,
|
||||
serviceContainer,
|
||||
indent,
|
||||
timestampsVisible,
|
||||
|
|
|
@ -76,7 +76,6 @@ function EvaluationResult(props) {
|
|||
topLevelClasses,
|
||||
messageBody,
|
||||
messageId,
|
||||
scrollToMessage: props.autoscroll,
|
||||
serviceContainer,
|
||||
exceptionDocURL,
|
||||
frame,
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
const {
|
||||
FILTER_BAR_TOGGLE,
|
||||
MESSAGE_ADD,
|
||||
REMOVED_MESSAGES_CLEAR,
|
||||
TIMESTAMPS_TOGGLE
|
||||
} = require("devtools/client/webconsole/new-console-output/constants");
|
||||
const Immutable = require("devtools/client/shared/vendor/immutable");
|
||||
|
@ -16,27 +14,15 @@ const Immutable = require("devtools/client/shared/vendor/immutable");
|
|||
const UiState = Immutable.Record({
|
||||
filterBarVisible: false,
|
||||
filteredMessageVisible: false,
|
||||
autoscroll: true,
|
||||
timestampsVisible: true,
|
||||
});
|
||||
|
||||
function ui(state = new UiState(), action) {
|
||||
// Autoscroll should be set for all action types. If the last action was not message
|
||||
// add, then turn it off. This prevents us from scrolling after someone toggles a
|
||||
// filter, or to the bottom of the attachment when an expandable message at the bottom
|
||||
// of the list is expanded. It does depend on the MESSAGE_ADD action being the last in
|
||||
// its batch, though.
|
||||
// It also depends on REMOVED_MESSAGES_CLEAR action being sent after MESSAGE_ADD
|
||||
// if number of messages reached the maximum limit.
|
||||
let autoscroll = action.type == MESSAGE_ADD || action.type == REMOVED_MESSAGES_CLEAR;
|
||||
state = state.set("autoscroll", autoscroll);
|
||||
|
||||
switch (action.type) {
|
||||
case FILTER_BAR_TOGGLE:
|
||||
return state.set("filterBarVisible", !state.filterBarVisible);
|
||||
case TIMESTAMPS_TOGGLE:
|
||||
return state.set("timestampsVisible", action.visible);
|
||||
|
||||
}
|
||||
|
||||
return state;
|
||||
|
|
|
@ -10,11 +10,6 @@ function getAllUi(state) {
|
|||
return state.ui;
|
||||
}
|
||||
|
||||
function getScrollSetting(state) {
|
||||
return getAllUi(state).autoscroll;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAllUi,
|
||||
getScrollSetting,
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче