Bug 958687 - Fixes pseudo-class lock in highlighter intermittent test failure; r=jwalker

This commit is contained in:
Patrick Brosset
2014-01-17 23:07:48 +01:00
parent 219a844fee
commit 43c695a84b
2 changed files with 24 additions and 8 deletions

View File

@@ -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
});