Bug 958687 - Fixes pseudo-class lock in highlighter intermittent test failure; r=jwalker
This commit is contained in:
@@ -282,6 +282,23 @@ MarkupView.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Given the known reason, should the current selection be briefly highlighted
|
||||
* In a few cases, we don't want to highlight the node:
|
||||
* - If the reason is null (used to reset the selection),
|
||||
* - if it's "inspector-open" (when the inspector opens up, let's not highlight
|
||||
* the default node)
|
||||
* - if it's "navigateaway" (since the page is being navigated away from)
|
||||
* - if it's "test" (this is a special case for mochitest. In tests, we often
|
||||
* need to select elements but don't necessarily want the highlighter to come
|
||||
* and go after a delay as this might break test scenarios)
|
||||
*/
|
||||
_shouldNewSelectionBeHighlighted: function() {
|
||||
let reason = this._inspector.selection.reason;
|
||||
let unwantedReasons = ["inspector-open", "navigateaway", "test"];
|
||||
return reason && unwantedReasons.indexOf(reason) === -1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight the inspector selected node.
|
||||
*/
|
||||
@@ -291,8 +308,7 @@ MarkupView.prototype = {
|
||||
this.htmlEditor.hide();
|
||||
let done = this._inspector.updating("markup-view");
|
||||
if (selection.isNode()) {
|
||||
let reason = selection.reason;
|
||||
if (reason && reason !== "inspector-open" && reason !== "navigateaway") {
|
||||
if (this._shouldNewSelectionBeHighlighted()) {
|
||||
this._brieflyShowBoxModel(selection.nodeFront, {
|
||||
scrollIntoView: true
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user