Bug 1662059 - [devtools] Only read devtools.overflow.debugging.enabled from the client. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D92363
This commit is contained in:
Gabriel Luong 2020-10-06 02:50:38 +00:00
Родитель 6d87f384ee
Коммит 7afa635edb
2 изменённых файлов: 15 добавлений и 29 удалений

Просмотреть файл

@ -103,12 +103,7 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
this.wasDisplayed = this.isDisplayed;
this.wasScrollable = wasScrollable;
// We check this on each call because a static check requires a full browser restart
// to pick up changes.
const OVERFLOW_DEBUGGING_ENABLED = Services.prefs.getBoolPref(
"devtools.overflow.debugging.enabled"
);
if (OVERFLOW_DEBUGGING_ENABLED && wasScrollable) {
if (wasScrollable) {
this.walker.updateOverflowCausingElements(
this,
this.walker.overflowCausingElementsMap

Просмотреть файл

@ -212,13 +212,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
targetActor.chromeEventHandler
);
// TODO: This preference is a client preference and should not be read here.
// See Bug 1662059.
this.isOverflowDebuggingEnabled = Services.prefs.getBoolPref(
"devtools.overflow.debugging.enabled",
false
);
// In this map, the key-value pairs are the overflow causing elements and their
// respective ancestor scrollable node actor.
this.overflowCausingElementsMap = new Map();
@ -568,7 +561,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
actor.wasScrollable = isScrollable;
}
if (this.isOverflowDebuggingEnabled && isScrollable) {
if (isScrollable) {
this.updateOverflowCausingElements(
actor,
currentOverflowCausingElementsMap
@ -576,24 +569,22 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
}
}
if (this.isOverflowDebuggingEnabled) {
// Get the NodeActor for each node in the symmetric difference of
// currentOverflowCausingElementsMap and this.overflowCausingElementsMap
const overflowStateChanges = [...currentOverflowCausingElementsMap.keys()]
.filter(node => !this.overflowCausingElementsMap.has(node))
.concat(
[...this.overflowCausingElementsMap.keys()].filter(
node => !currentOverflowCausingElementsMap.has(node)
)
// Get the NodeActor for each node in the symmetric difference of
// currentOverflowCausingElementsMap and this.overflowCausingElementsMap
const overflowStateChanges = [...currentOverflowCausingElementsMap.keys()]
.filter(node => !this.overflowCausingElementsMap.has(node))
.concat(
[...this.overflowCausingElementsMap.keys()].filter(
node => !currentOverflowCausingElementsMap.has(node)
)
.filter(node => this.hasNode(node))
.map(node => this.getNode(node));
)
.filter(node => this.hasNode(node))
.map(node => this.getNode(node));
this.overflowCausingElementsMap = currentOverflowCausingElementsMap;
this.overflowCausingElementsMap = currentOverflowCausingElementsMap;
if (overflowStateChanges.length) {
this.emit("overflow-change", overflowStateChanges);
}
if (overflowStateChanges.length) {
this.emit("overflow-change", overflowStateChanges);
}
if (displayTypeChanges.length) {